I am trying to get my kernel to be moved to virtual address 4MB and yet have it loaded at the 1MB physical.
I wrote some basic code to move my kernel to a higher place and it was working fine with grub. But now grub errors out because the load address is below 1 meg and grub doesnt support that.
The funny thing is it was working before. There are two possibilites to my problem.
[*] it isnt loaded at 1MB or above, but Ive checked this.
[*] if you load it to a really high address like 0xC0000000, it will overflow because I guess your trying to access memory thats not there.
I believe my problem lies with the second possibility. Could I be correct? How can I get around this?
[attachment deleted by admin]
grub problems
Re:grub problems
I think this is the problem:
Look at your own comment: these are PHYSICAL addresses. A symbol like 'mboot' or 'kernel_code' is a virtual address; if you look in the disassembly, you should find that these symbols are located above 4MB.
You need to translate each symbol's virtual address to the corresponding physical address, for example: (I think this is from the GRUB sample kernel)
(apologies for the AT&T syntax but hopefully you get the idea)
Code: Select all
; fields used if MULTIBOOT_AOUT_KLUDGE is set in MULTIBOOT_HEADER_FLAGS
dd mboot ; These are PHYSICAL addresses
dd kernel_code ; Start of kernel .text (code) section
dd kernel_data ; End of kernel .data section
dd kernel_end ; End of kernel BSS
dd _start ; Kernel entry point (initial EIP)
You need to translate each symbol's virtual address to the corresponding physical address, for example: (I think this is from the GRUB sample kernel)
Code: Select all
#define V2P(x) ((x) - ADDR_KERNEL_VIRT + ADDR_KERNEL_PHYS)
/* header_addr */
.long V2P(_multiboot_header)
/* load_addr */
.long ADDR_KERNEL_PHYS
/* load_end_addr */
.long V2P(__end__)
/* bss_end_addr */
.long V2P(__bss_end__)
/* entry_addr */
.long V2P(_KernelEntry)
Re:grub problems
Ok, Ive fixed that problem and have added paging code. I have finaly gotten it to compile and when I went to test it on Grub, it reports: selected item cannot fit into memory.
I looked at the grub documentation and this is what is says
Thanks in advance.
I looked at the grub documentation and this is what is says
Does anybody know what could be causing this? Is there a workaround?28 : Selected item cannot fit into memory
This error is returned if a kernel, module, or raw file load command is either trying to load its data such that it won't fit into memory or it is simply too big.
Thanks in advance.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:grub problems
iirc, this error is often thrown because the target load address of your file is too high (GRUB is trying hard to put your file at *physical* 0xC000_0000 ...)
Re:grub problems
Even though I have loaded it at 0x40000000 which is 1GB. I guess I'll try a lower address.Pype.Clicker wrote: iirc, this error is often thrown because the target load address of your file is too high (GRUB is trying hard to put your file at *physical* 0xC000_0000 ...)
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:grub problems
i guess we should put this in the FAQ: it's always coming back ...
Re:grub problems
You could add this if you like. It didnt work for me but it might work for someone else.
Selected item cannot fit into memory
Selected item cannot fit into memory1
Selected item cannot fit into memory
Selected item cannot fit into memory1