rust-osdev / multiboot2

Rusty wrappers for Multiboot2.
Apache License 2.0
113 stars 56 forks source link

How to get elf information? #244

Closed mldulaney closed 1 month ago

mldulaney commented 1 month ago

Used to be, i could simply iterate through elf_sections_tag.sections() and get what I wanted, but that is no longer the case. What is the current way to get things like e.g. the elf section size and location for each section?

mldulaney commented 1 month ago

I guess i should point out my ultimate goal is to get os size (and possibly in the future location)

phip1611 commented 1 month ago

Hi!

What about https://docs.rs/multiboot2/0.23.0/multiboot2/struct.BootInformation.html#method.elf_sections, isn't this what you need?

I didn't change anything in the API intentionally for that specific part. I might accidentally broke something.

I can look into it next week

mldulaney commented 1 month ago

Yeah, I can't see any public methods to actually get the data i want out.

phip1611 commented 1 month ago

Yeah, I can't see any public methods to actually get the data i want out.

Which data do you want to get specifically? Is https://github.com/rust-osdev/multiboot2/pull/246/commits/a537d2410ac69c7eb4e1b8746195887bb79c69ae a valid solution for you? Now you can get the tag and use its methods (including the section iterator) by using the getter of BootInformation, just like for all the other tags

mldulaney commented 1 month ago

i'll check it out this evening. my ultimate goal is to find the location and size of my kernel in memory, and i was hoping to use the elf tags to do so.

mldulaney commented 1 month ago

groovy, this seems to have done the trick, thanks!

phip1611 commented 1 month ago

Fixed with v0.23.1.