jarlin wrote:
yeah, that's my problem wich i don't know how to solve. How can i link the kernel,in elf32 format, to work at 0xC0000000 virutal address, but load it at 0x100000??
Since ELF docs themselves say that the physical address should be disregarded on systems where they have no obvious use (static partitioning systems by example), you do not pay any attention at it. If you want to load it at 0x100000, just load it there (note: realmode loaders cannot load to that address without enabling A20, and if you did they cannot load more than 64K-16 bytes.
Then use the info from the program header to determine where to put what, so if you want it to run at 0xC0000000 (and use -Ttext=0xC0000000) then you are going to have to do some black magic. First of all, the easiest way is not to use nmagic or omagic, since they prevent the code from being page-aligned in the file. Then you relocate it all so that 0x100000 actually comes out at 0xBFFFF000, putting the ELF header before the page itself, and the code starting at (yessir) 0xC0000000. You can relocate it with paging OR segmentation. For paging, set up page tables, page directory + entries for all those pages (3 page tables of entries if it's big), and for segmentation, make a segment with the base address of 0x40100000 (as described by somebody in his tutorial, forgot whose it was) to make the address end up at 0x00100000 (NOTE: this method STRONGLY disadvised by me. It breaks (probably) with every processor having more than 32 address lines, such as the PPro and further, and the AMD K6 series and further).
For a paging example, wait until I have my code online
(have decided to go open source anyway).