I'm using Bochs 2.0.2 and I want it to allocate 32 MB of RAM.
I'm using a simple algorithm to check the amount of memory available to my OS. It works pretty good, but with bochs, it says that there's only 32 MB - 3 Bytes installed.
Is this due to a bochs bug ? Or Are these 3 bytes used for something special ??
Bochs memory bug ?
Re:Bochs memory bug ?
What algorithm are you using? You should be getting a memory map from the BIOS.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Bochs memory bug ?
Is suspects this come from the fact you're scanning every address (like 0xb8000,0xb8001, 0xb8002, 0xb8003, 0xb8004, etc.) using an integer rather than scanning every multiple-of-four addresses (0xb8000, 0xb8004, 0xb8008) or something.pini wrote: Is this due to a bochs bug ? Or Are these 3 bytes used for something special ??
When you reach the last 4 bytes, the N-4 address works, but at N-3 you have one byte that is off the memory by one ... thus you'll conclude (wrongly) that it did not work from N-3 while the test at N-4 actually proved N-4, N-3, N-2 and N-1 were valid.
Re:Bochs memory bug ?
Pype.Clicker wrote: Is suspects this come from the fact you're scanning every address (like 0xb8000,0xb8001, 0xb8002, 0xb8003, 0xb8004, etc.) using an integer rather than scanning every multiple-of-four addresses (0xb8000, 0xb8004, 0xb8008) or something.
When you reach the last 4 bytes, the N-4 address works, but at N-3 you have one byte that is off the memory by one ... thus you'll conclude (wrongly) that it did not work from N-3 while the test at N-4 actually proved N-4, N-3, N-2 and N-1 were valid.
You're right with the fact that the bytes are outbound at the end of the memory. BTW, i'm not testing each byte (arrg : would be very long).
I'm using dichotomy to find the end of the memory.
Currently, I can't test my algorithm with a byte check rather than a unsigned long check, but I think you're probably right, Pype. I will test this evening.
Thank you !
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Bochs memory bug ?
An integer check is fine as long aspini wrote: Currently, I can't test my algorithm with a byte check rather than a unsigned long check, but I think you're probably right, Pype. I will test this evening.
1. you always check addresses that meets x%4 == 0
2. in case of success, you consider that the highest available address is x+3, and not x itself ...
Note that, afaik, the physical memory is organized in page frames, and i don't think there's something like memory chips that will come with an amount of memory that is lower than 4KB. Thus (theorically), once you found a valid address X, you can assume that (X & 0xffff000)..(X | 0x0000fff) are valid.
Re:Bochs memory bug ?
You're probably right when you say that memory is a multiple of 4KB.
It's true that there's no need to use byte check instead of unsigned long check, as long as you know how the algorithm works, and how to correct the given value.
It's true that there's no need to use byte check instead of unsigned long check, as long as you know how the algorithm works, and how to correct the given value.