Hi, I was just wondering, if theres a way to determine how much asm is plugged into the computer without using the bios etc....sort of just write and read back blocks of bytes etc till they come back wrong?
I have a feeling writing to memory locations that are inaccecible causes memory acceptions and crashes....of course this is all done in a mini os I'm playing with
Not sure if this is allowed or if theres a method which is the norm on how to determine memory...I jsut remember on my old pc at startup it would count through memory or checking memory at bootup
Any info or advice would be great.
Thanks a great deal.
Ben
memory polling to determine memory size startup?
Re:memory polling to determine memory size startup?
You can probe memory manually like that but it is highly recommended that you use the BIOS as your memory probe may write to a memory mapped device causing weird things to happen.
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:memory polling to determine memory size startup?
I daresay, you've posted this in the wrong board. *gg*
Might a mod move this to "os development" board? Thx
As of your question, I'm not sure if I understand right - but yes, by writing something to some memory loco to get the total amount of memory installed, you might get trouble (unless you save the previous value and restore it after the testing action.)
There are more reliable and less dangerous methods to find the amount of memory installed: you may ask the bios (recent boards deliver quite accurate values) you may take the value grub delivers, etx ...
Might a mod move this to "os development" board? Thx
As of your question, I'm not sure if I understand right - but yes, by writing something to some memory loco to get the total amount of memory installed, you might get trouble (unless you save the previous value and restore it after the testing action.)
There are more reliable and less dangerous methods to find the amount of memory installed: you may ask the bios (recent boards deliver quite accurate values) you may take the value grub delivers, etx ...
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:memory polling to determine memory size startup?
Even then. Your write might have triggered something in a device mapped to that memory area. "Undefined behaviour". (The experienced ASM/C coder runs for cover...)beyond infinity wrote: As of your question, I'm not sure if I understand right - but yes, by writing something to some memory loco to get the total amount of memory installed, you might get trouble (unless you save the previous value and restore it after the testing action.)
Every good solution is obvious once you've found it.
Re:memory polling to determine memory size startup?
The possibility of accidentally hitting something important is made much worse by the fact that since all of normal RAM need not be continuous, you can't simply stop after you get wrong values first time, unless you are happy with only part of the memory.
Another big problem is that if you hit a video framebuffer, you will probably read the same value that you wrote, but if you then think that it's RAM, you will have really slow applications, and possibly fancy visuals as well.
In short: just use the BIOS.
Another big problem is that if you hit a video framebuffer, you will probably read the same value that you wrote, but if you then think that it's RAM, you will have really slow applications, and possibly fancy visuals as well.
In short: just use the BIOS.