linking a pei-i386 kernel file problems

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
zecarlos
Posts: 11
Joined: Tue Feb 18, 2020 8:20 am

linking a pei-i386 kernel file problems

Post by zecarlos »

Greetings everyone.
I am trying to compile and test a pm32 bit operating system on VirtualBox. The tutorial I chose is loaded by GRUB in ELF format. My development environment is on Windows7 with the Mingw32-gcc compiler. The format of my OS files is PE.
My adventure has barely started and I already have my head spinning, with the first problem. It seems to me that something is not right with linking the "ld" the data that some fields present does not seem correct, among them AddressEntryPoint, BaseCode, BaseData, SizeImage and VirtualAddress of all sections.
I did two different tests, the first:
After forming an executable file in the PE format I used ("objcopy -O binary krnl32.exe krnl32.sys") in this test everything works fine until an interruption occurs that causes a jump to the address 0xffffff0.
In the second test I use the PEI-i386 format which, in addition to the mentioned defect, now happens even without triggering an interrupt, and the data segment descriptor is pointing to .bss and not to .data,

I attached the memory map of the link, the executable file and the floppy image that can run on VirtualBox or Bochs.
Maybe someone can help me, because I don't know how to explain it better.
Attachments
ultron.rar
(14.04 KiB) Downloaded 44 times

[The extension ld has been deactivated and can no longer be displayed.]

Post Reply