OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 1:46 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Is multiboot2 info stored in memory without holes?
PostPosted: Wed Dec 27, 2023 7:39 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 300
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.


Top
 Profile  
 
 Post subject: Re: Is multiboot2 info stored in memory without holes?
PostPosted: Wed Dec 27, 2023 8:14 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5146
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.


Top
 Profile  
 
 Post subject: Re: Is multiboot2 info stored in memory without holes?
PostPosted: Wed Dec 27, 2023 11:34 pm 
Offline
Member
Member

Joined: Fri Jun 28, 2013 1:48 am
Posts: 65
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.

_________________
Reinventing the Wheel, code: https://github.com/songziming/wheel


Top
 Profile  
 
 Post subject: Re: Is multiboot2 info stored in memory without holes?
PostPosted: Thu Dec 28, 2023 2:05 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1605
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group