Re: Value in memory changes... Why?!
- From: SpooK <keith@xxxxxxxxxxx>
- Date: Tue, 28 Aug 2007 08:45:55 -0700
On Aug 28, 10:25 am, 001 <snthib...@xxxxxxxxx> wrote:
SpooK schreef:
Off the bat, you should know that "mov word[ds:0],ax" is really "mov
word[0],ax" as DS is the default segment selector in most
instructions.
The real issue, IIRC, is that you are trying to write data to the BIOS
which is mapped to E000:0000 to FFFF:FFFF. This will (should) fail.
The area from A000:0000 to FFFF:FFFF is riddled with non-usable memory
due to memory-mapped devices such as the BIOS, this area is called
Upper Memory (the upper 384KB of the first MB of RAM.)
You need to stick to the Conventional (usable) Memory area. This area
is from 0000:0000 to 9FFF:FFFF (the lower 640KB of the first MB of
RAM.) Watch out, as even some of those areas are not safe. The Real
Mode BIOS has the Interrupt Vector Table consuming the first Kilbyte
of RAM. Right after that as another 256 bytes being used as the BIOS
Data Area. If you are doing your own boot-sector stuff, you boot
sector will be loaded to 0000:7C00, so it is best to avoid that 512
byte area as well. So, the best place to stay safe is between
0000:8000 and A000:0000.
HtH ;)
Thank you for this response! I thought the entire meg could contain
data except for the beginning. I'm at a point in my OS right before
switching to P-mode but memory mapping was needed first. Luckily I
won't have to bother about memory area's when I have mapped it (in
fact I do have but... I can then just look it up ;) ). I'm immensely
happy with your response, it took me over an hour to reduce the
problem to those lines and then I still didn't understand :P
Regards,
Stéphane
You're welcome :)
If you are interested in OS dev, I highly recommend visiting
http://www.osdev.org/
You will find, either directly or through links, a vast amount of x86
OS development information ;)
As for the "memory mapping" thing, unless you are trying to enable
paging, it is not needed. If you are trying to enable paging, then you
need *at least* 8KB of RAM to use for standard paging, in which needs
a 4KB Page Directory and an initial 4KB Page Table representing the
immediate 4KB memory area you are working with.
I would suggest avoiding paging for the time being. Once you've gotten
your basic 32-bit "Hello World" kernel in a flat addressing space and
interrupts working, I would *then* tackle paging and move on to
software task switching.
A couple more links that may help...
http://www.asmcommunity.net/board/index.php?action=wiki;title=Operating_System_Development;sa=view
- I still need to finish converting that guide from the old format,
but it has a good start :P
http://www.mt2002.sitesled.com/OSDevIndex.html - A tutorial that takes
you through the practical implementation of a basic Protected Mode
kernel. This tutorial was posted at OSDev.org recently and is nearly
the same as what I was doing with my guide in the above link.
HtH.
.
- References:
- Re: Value in memory changes... Why?!
- From: SpooK
- Re: Value in memory changes... Why?!
- Prev by Date: Re: Value in memory changes... Why?!
- Next by Date: Re: ELF loading
- Previous by thread: Re: Value in memory changes... Why?!
- Next by thread: Re: Value in memory changes... Why?!
- Index(es):
Relevant Pages
|