Hi.
After grub boots kernel, I would like to copy all the information from multiboot2 info to bss, so I want to know if I can just copy total_bytes(stored in mbi structure)?
I.e., is all the info in the mbi in a continuous chunk of memory?
I was looking at the code in the multiboot2 spec and it seems that all the mbi info is in memory continuously.
Is multiboot2 info stored in memory without holes?
-
- Member
- Posts: 5560
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Is multiboot2 info stored in memory without holes?
It is all in one continuous chunk of memory, but you can't copy it to bss because its size is not a compile-time constant.
-
- Member
- Posts: 70
- Joined: Fri Jun 28, 2013 1:48 am
- Contact:
Re: Is multiboot2 info stored in memory without holes?
You can reserve a buffer at end of BSS. Make sure that buffer is large enough to hold temporary info.
Copy boot info, mmap, sections, and all other temporary data to the buffer, and keep track of how many buffer used.
After all important data has been saved into BSS, you can use ram as you want.
Copy boot info, mmap, sections, and all other temporary data to the buffer, and keep track of how many buffer used.
After all important data has been saved into BSS, you can use ram as you want.
Reinventing the Wheel, code: https://github.com/songziming/wheel
Re: Is multiboot2 info stored in memory without holes?
May I ask why you want to do that? If it is just to have the data available after turning on paging, you may want to consider copying it to the initial stack instead. Bear in mind that you also need to relocate any pointers.
Carpe diem!