Page 1 of 1

Using the top of ram.

Posted: Sun May 13, 2007 5:59 pm
by astrocrep
Basically I want to push my paging structures and mm bitmap at the top of ram.

What I am doing is:

Code: Select all

char *temp;
temp = (char *) ((mbd->mem_upper + 1024) * 1024);
temp[0] = 0x1;
--or--
*temp = 0x1;
That works without error... but if I

Code: Select all

temp[1] = 0x1;
--or--
*temp++;
*temp  = 0x1;
It doesn't error out either... I would expect it to crash if or do something if I am pointing out of bounds of memory...

NOTE: mbd is the grub multiboot record.

Whats the deal...

Thanks,
Rich

Posted: Mon May 14, 2007 12:09 am
by pcmattman
Remember, there's usually 640K as well (LOWER memory).

Posted: Mon May 14, 2007 5:11 am
by astrocrep
Well grub says... here the amount of ram above 1mb, thats why I add on the 1024 before I convert it to bytes.

I am assuming that the memory wraps?? I tried setting a ptr to like 1gb in a system where only 128mb ram is present (and paging is off) and it set a byte without issue...

??

-Rich

Posted: Mon May 14, 2007 7:17 am
by Brendan
Hi,
astrocrep wrote:I am assuming that the memory wraps?? I tried setting a ptr to like 1gb in a system where only 128mb ram is present (and paging is off) and it set a byte without issue...
It doesn't wrap - there's 4 GB (or more) of physical address space. Some of the space has RAM connected to it, some has ROM, some has memory mapped devices and some of it has nothing connected to it.

When you write to "top of RAM + 1 KB" you're writing to nothing. If you try to read the value back you'll probably (but not necessarily) read back 0xFFFFFFF, regardless of what value you wrote.

It's a bit like writing a letter addressed to "The Aliens" - you can send the letter, but don't expect the aliens to actually receive it.


Cheers,

Brendan

Posted: Mon May 14, 2007 7:35 am
by astrocrep
Ahh...

Thank you! Crystal clear now.

-Rich