Re: Value in memory changes... Why?!



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.

.



Relevant Pages

  • Re: Random Restarts - Please Help
    ... I upgraded my BIOS a long time ago ... Beginners Guides: Diagnosing Bad Memory ... How to diagnose bad RAM ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Continuous beeping and Machine_check_exception STOP:A 0X000000
    ... all the ram is used. ... You would think revision F1 BIOS would be good enough, ... like that, it should work, but it might not have as high a memory ... These are the settings typically used for a system like that. ...
    (microsoft.public.windowsxp.general)
  • Re: 4GBs of RAM Miscount
    ... If you look in the BIOS at boot time, ... Why can't I see all of the 4GB of RAM in my machine? ... have you ever applied the switch to a SBS 2003 box? ... it increases the 'pointers' for memory handling to allow 32b systems ...
    (microsoft.public.windows.server.sbs)
  • Re: Extra RAM Installation Blues Vol 2
    ... >> & most of the Memory Manufacturers, ... >> Slot, along with various esoteric Info, such as the RAM Timings etc. ... > and even gives the manufacturer. ... along with the BIOS & Chipset etc. ...
    (uk.people.silversurfers)
  • BIOS sees 4GB of RAM, not sure about the OS
    ... I found some information on the net about getting the BIOS to ... I upgraded my computer to 4GB of RAM. ... I enabled "Memory Remapping Feature" in the BIOS, ... I want to say that the kernel I'm using has bigsmp support. ...
    (alt.os.linux.suse)