Page 3 of 3

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 9:43 am
by makuc9
m12: Than I don't really know why you wrote that comment (about assuming too much) in the first place ... But let's head back to the topic.

I have re-written the function from scratch and now I have been wondering (before I post the hex dump), does calling E820h always return the same size in CL register? (Just so I do not implement any complex mechanism for storing each CL as well ... :D )

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 9:45 am
by Combuster
makuc9 wrote:does always
Assumption is the mother of all (...)

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 10:13 am
by AJ
Hi,
makuc9 wrote:Just so I do not implement any complex mechanism for storing each CL as well ...
Why is storing CL complex?

Cheers,
Adam

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 10:32 am
by makuc9
Well, storing each returned CL and associating it with entry it was returned with can be (altough not necessarily, but I could start complicating things without any real purpose and discovering an easier method later...). That's why I was asking. Is there any point in saving every CL (MM entry size) I get returned? (if not, don't you think that would be pointless memory loss?)
One CL would be saved anyway...

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 10:44 am
by bluemoon
If you provided 24 bytes zero for it, there are 5 possibilities:
1. return ECX < 20, something is seriously wrong with the BIOS
2. return ECX=20, the last 4 bytes is not touch and you automatically have zero for the supposed ACPI field.
3. ECX=21,22,23. something is seriously wrong with the BIOS
4. ECX=24, good, check if acpi bit is set, clear the field if otherwise
5. ECX>24, something is seriously wrong with the BIOS

I don't see why you need to store CL (or ECX)

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 1:11 pm
by makuc9
Thank you, bluemoon. That helped.
And now, here is the (i guess) correct memory map (presented hex-dump):
Image
So, is it correct this time? (i am still working on function to display it better properly, but for some reason it is never the same as reversed this by hand ...). I will update this post once I finish. Last for bytes are trash (uncleaned memory, since function only returns 20 bytes. It would notify me if it is 24 or give error if anything else. I made all the tests as bluemoon said there should be).

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 1:34 pm
by dozniak
bluemoon wrote: you provided 24 bytes zero for it
4. ECX=24, good, check if acpi bit is set, clear the field if otherwise
Other than that, the map looks better now.

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 2:04 pm
by makuc9
Thank you for your feedback. Will be fixing this little issue shortly and afterwards finally move forward. :D

Re: (hardware) reserved memory & GDT question

Posted: Wed Apr 24, 2013 2:14 pm
by Combuster
bluemoon wrote:If you provided 24 bytes zero for it
And if you do provide garbage, some bioses will refuse to clear it up and leave the garbage where you'd expect zeroes.

In other words, zeroing the destination memory is mandatory.