Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
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 ... )
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
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...
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
Thank you, bluemoon. That helped.
And now, here is the (i guess) correct memory map (presented hex-dump):
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).
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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]