PC IBM & reserved memory...
PC IBM & reserved memory...
Hi all, (sorry if my English is't perfect: the important thing is that you
understand...)
I have a doubt about IBM PC and compatibles... I know that the memory area
between 640KB and 1MB is reserved by firmwares, video RAM, video ROM... but I
really don't understand how all this works!
For example:
if I write a byte to memory location 0xB8000 (video RAM in TEXT mode)
what happens?
1. The CPU writes the byte in RAM and then the Video Card reads from
RAM?
2. The CPU sends the byte to the Video Card directly?
And in the second case how it works? Who "decides" if a byte must go to RAM or
elsewhere?
Another question is derived from a test (in my stupid kernel: protected mode), I
see that the reserved memory area which I was talking about (excluding the
video RAM for text mode) turns out to be READ-ONLY! How this can happens?
Here there is the C code that I've used for the test:
static void test_memory(void)
{
long flags;
volatile unsigned char *mem = (unsigned char*)0xa0000;
const unsigned char *stop = (unsigned char*)0x100000;
unsigned char a, b;
char old_w=1, w; /* is writable? */
for (; mem<=stop; mem++) {
a = *mem;
*mem = b = ~a;
if (*mem == b)
w = 1;
else
w = 0;
switch (old_w) {
case 1:
if (!w) {
printk("Start of ROM at 0x%x\n", mem);
}
break;
case 0:
if (w) {
printk("End of ROM at 0x%x\n", mem);
}
}
if (w)
*mem = a;
old_w = w;
}
}
And here there is the OUTPUT (tested on three PC):
Start of ROM at 0xa0000
End of ROM at 0xb8000
Start of ROM at 0xc0000
End of ROM at 0x100000
Can anyone explain this these things?
Or can anyone say me where to find these informations?
Bye,
Paolo
PS = How is my English?
understand...)
I have a doubt about IBM PC and compatibles... I know that the memory area
between 640KB and 1MB is reserved by firmwares, video RAM, video ROM... but I
really don't understand how all this works!
For example:
if I write a byte to memory location 0xB8000 (video RAM in TEXT mode)
what happens?
1. The CPU writes the byte in RAM and then the Video Card reads from
RAM?
2. The CPU sends the byte to the Video Card directly?
And in the second case how it works? Who "decides" if a byte must go to RAM or
elsewhere?
Another question is derived from a test (in my stupid kernel: protected mode), I
see that the reserved memory area which I was talking about (excluding the
video RAM for text mode) turns out to be READ-ONLY! How this can happens?
Here there is the C code that I've used for the test:
static void test_memory(void)
{
long flags;
volatile unsigned char *mem = (unsigned char*)0xa0000;
const unsigned char *stop = (unsigned char*)0x100000;
unsigned char a, b;
char old_w=1, w; /* is writable? */
for (; mem<=stop; mem++) {
a = *mem;
*mem = b = ~a;
if (*mem == b)
w = 1;
else
w = 0;
switch (old_w) {
case 1:
if (!w) {
printk("Start of ROM at 0x%x\n", mem);
}
break;
case 0:
if (w) {
printk("End of ROM at 0x%x\n", mem);
}
}
if (w)
*mem = a;
old_w = w;
}
}
And here there is the OUTPUT (tested on three PC):
Start of ROM at 0xa0000
End of ROM at 0xb8000
Start of ROM at 0xc0000
End of ROM at 0x100000
Can anyone explain this these things?
Or can anyone say me where to find these informations?
Bye,
Paolo
PS = How is my English?
RE:PC IBM & reserved memory...
It's realy simple. The CPU does not care where does the byte go. It just puts it on the adress/data line. The Video card snoops it's addresses(B8000...0xA0000) and the RAM chip snoops it's addresses. So the byte gets where it is supposed to go. BTW the addresses which you listed, might not "exist" at all, which means that there is no devie responsible for those memory ranges. So you write to empty space. There are alot of devices on the address line. You can also map memory from other PCI devices to different addresses(How do you think the Video memory(128MB) is accessed?). You can find such memory ranges in device setups(in Windows or Linux), so look there if interested.
Anton.
PS. One thing for shure, it's better then my English.
Anton.
PS. One thing for shure, it's better then my English.
RE:PC IBM & reserved memory...
So the memory(RAM) between 640k and 1MB doesn't exist or anyway I can't access to it because this range of addresses is reserved for standard devices like VGA...
In other words if I write a "kernel" and I want manage the memory I simply don't deal this space as memory...
But if this is true my RAM (128 MB) can't be used totally! I can only use 127MB + 640KB... right?
Bye,
Paolo
In other words if I write a "kernel" and I want manage the memory I simply don't deal this space as memory...
But if this is true my RAM (128 MB) can't be used totally! I can only use 127MB + 640KB... right?
Bye,
Paolo
RE:PC IBM & reserved memory...
Ram usualy starts at 1MB(so you will have all 128MB). 640KB are not part of it, it is seperate memory and depends on the motherboard.
Anton.
Anton.
RE:PC IBM & reserved memory...
Are you so sure?
I have changed my "memory_test" code to test how much memory I have starting
from 0x100000(1MB), the result is that my RAM works (and so exists)
FROM: 0x0100000 ( 1MB) included
TO: 0x8000000 (128MB) excluded
so I have 127 MB of memory + 640KB... are you sure that the 640KB are "on" the
motherboard and the 128MB are separated?
Where is the first MB of my RAM? Is it lost? Is it never used?
If what you say is true my PC should work "fine" also without my only "bench of
RAM" (I hope this should be written in this way !
Now I try to unplug the "bench of RAM"... hoping that the BIOS doesn't laments!
... the BIOS start beeping and I don't see anything on the screen ...
SO the question is still opened!
What do you say?
bye,
Paolo
I have changed my "memory_test" code to test how much memory I have starting
from 0x100000(1MB), the result is that my RAM works (and so exists)
FROM: 0x0100000 ( 1MB) included
TO: 0x8000000 (128MB) excluded
so I have 127 MB of memory + 640KB... are you sure that the 640KB are "on" the
motherboard and the 128MB are separated?
Where is the first MB of my RAM? Is it lost? Is it never used?
If what you say is true my PC should work "fine" also without my only "bench of
RAM" (I hope this should be written in this way !
Now I try to unplug the "bench of RAM"... hoping that the BIOS doesn't laments!
... the BIOS start beeping and I don't see anything on the screen ...
SO the question is still opened!
What do you say?
bye,
Paolo
RE:PC IBM & reserved memory...
Modern computers might not boot deliberetly, thinking that the user is a dummy. What type of ram do you have(RIMM,DIMM,) and what type of computer(P4 or ... P).
Anton.
Anton.
RE:PC IBM & reserved memory...
After all, I guess you can't acess the first MB: it is shadowed by the 640k.(But you can probably do it usin i/o port of the RAM chips them selves, but that is another story) As far as i remember there should also be some hole around 15MB mark.
Anton.
Anton.
RE:PC IBM & reserved memory...
RAM:
128 MB DIMM
CPU:
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 3
model name : AMD Duron(tm) Processor
stepping : 1
cpu MHz : 756.758
cache size : 64 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr syscall mmxext 3dnowext 3dnow
bogomips : 1510.60
bye,
Paolo
128 MB DIMM
CPU:
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 3
model name : AMD Duron(tm) Processor
stepping : 1
cpu MHz : 756.758
cache size : 64 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr syscall mmxext 3dnowext 3dnow
bogomips : 1510.60
bye,
Paolo
RE:PC IBM & reserved memory...
Are you sure you know what you're talking about? Where did you get this (mis-?)information? For one, if a computer has enough memory for the boot process, it will boot. It leaves it up to the OS to decide if there's enough memory. Assuming for one second that it did just decide not to boot, it would at least display what the problem is on the screen. Afterall, 640K is definately enough to do that.
As for the hole around 15MB - it may exist on some systems, but not all. My BIOS doesn't put a hole there. Mine does, however, reserve some memory just below the 384MB mark (right at the end of my memory). While we're on the subject, does anyone have any idea what that space is reserved for?
As for the hole around 15MB - it may exist on some systems, but not all. My BIOS doesn't put a hole there. Mine does, however, reserve some memory just below the 384MB mark (right at the end of my memory). While we're on the subject, does anyone have any idea what that space is reserved for?
RE:PC IBM & reserved memory...
Something called os2 i believe. Some kind of service of compatibility or something.
My BIOS will allow me to set whether i want os2 enabled, thus, if i disable it. I don't get a 15mb memory hole.
And it's not just the 15mb mark. Other holes exist too. These are 'reserved' by certain devices like usb, pci devices and other stuff physically soldered to the motherboard etc. When i run my dev os in bochs, i get 0-640kb, 1mb - 32mb free - out of 32mb total. If i run it with vmware (and vmware immitates the host machines hardware, unlike bochs which imitates whatever hardware it feels like) i have a long grub memory map spanning many address ranges because i have my graphics card, network card, sound card, usb plus more along with all the other motherboard chipset services like dma etc needing a probe into memory as a method of communication with them.
Brill.
My BIOS will allow me to set whether i want os2 enabled, thus, if i disable it. I don't get a 15mb memory hole.
And it's not just the 15mb mark. Other holes exist too. These are 'reserved' by certain devices like usb, pci devices and other stuff physically soldered to the motherboard etc. When i run my dev os in bochs, i get 0-640kb, 1mb - 32mb free - out of 32mb total. If i run it with vmware (and vmware immitates the host machines hardware, unlike bochs which imitates whatever hardware it feels like) i have a long grub memory map spanning many address ranges because i have my graphics card, network card, sound card, usb plus more along with all the other motherboard chipset services like dma etc needing a probe into memory as a method of communication with them.
Brill.
RE:PC IBM & reserved memory...
Look, I know that the BIOS reserves space. (I'm not a moron!) I was referring to everything Anton had said in this whole thread, especially about booting and the memory from 0 to 640kB (sorry to confuse you). What I said about the reserved space at 15 MB was just a minor thing, and you just reiterated my point about it anyway: "it may exist on some systems, but not all." Perhaps "configurations" would have been a better word than "systems" though.
RE:PC IBM & reserved memory...
//Assuming for one second that it did just decide not to boot, it would at
//least display what the problem is on the screen. Afterall, 640K is definately
//enough to do that
I said just that, but javaman said that his computer does not boot(BIOS beeps) when he took the ram out. And that he only has 127MB after the first 1MB(cheked by probing). I cheked my computer also, and in the bios it writes, that i have 640 base memory + 127MB extended. So i gess the last part is true. With the first part i don't know, i ALSO think that the computer should boot without extra RAM using just 640kb(that's what i said from the start), but it doesn't(as javaman said). My computer is full with PCI cards and it's hard to reach the RAM, so i can't test it. Can you do a independent test.
Anton.
//least display what the problem is on the screen. Afterall, 640K is definately
//enough to do that
I said just that, but javaman said that his computer does not boot(BIOS beeps) when he took the ram out. And that he only has 127MB after the first 1MB(cheked by probing). I cheked my computer also, and in the bios it writes, that i have 640 base memory + 127MB extended. So i gess the last part is true. With the first part i don't know, i ALSO think that the computer should boot without extra RAM using just 640kb(that's what i said from the start), but it doesn't(as javaman said). My computer is full with PCI cards and it's hard to reach the RAM, so i can't test it. Can you do a independent test.
Anton.
RE:PC IBM & reserved memory...
15-16MB is for ISA cards(it reserves memory), so it has nothing to do with os/2.
RAM>64MB has to do with OS/2. I belive it chages some BIOS functions interfaces, to work correctly(the way OS/2 expects it to when there is more then 64MB)
Anton.
RAM>64MB has to do with OS/2. I belive it chages some BIOS functions interfaces, to work correctly(the way OS/2 expects it to when there is more then 64MB)
Anton.
RE:PC IBM... CORRECTION & memory holes
In a previous message I have said:
"on three PC I have this situation:
Start of ROM at 0xa0000
End of ROM at 0xb8000
Start of ROM at 0xc0000
End of ROM at 0x100000"
But it isn't all true! On my "main" PC (AMD Duron 750...) I have noticed an area
of "RAM"(always using the same code) between 0xE8000 and 0xF0000...
Now I see some messages speaking about memory holes... but how can a simple OS
(for IBM PC) know what memory he can relly use?
Isn't sufficient assume that the first 640k are avaiable and get the amount of
the extended memory trought a BIOS call*?
*= something like this:
/* Now detect memory size (extended in KB) */
movb $0x88, %ah
int $0x15
memory_error:
jc memory_error
movw %ax, EXT_MEMORY
YES, I know the limits of this call but my simple system don't need a lot
of memory...
Is this OK or I must use the same srategy of linux?:
# Try three different memory detection schemes. First, try
# e820h, which lets us assemble a memory map, then try e801h,
# which returns a 32-bit memory size, and finally 88h, which
# returns 0-64m
bye,
Paolo
"on three PC I have this situation:
Start of ROM at 0xa0000
End of ROM at 0xb8000
Start of ROM at 0xc0000
End of ROM at 0x100000"
But it isn't all true! On my "main" PC (AMD Duron 750...) I have noticed an area
of "RAM"(always using the same code) between 0xE8000 and 0xF0000...
Now I see some messages speaking about memory holes... but how can a simple OS
(for IBM PC) know what memory he can relly use?
Isn't sufficient assume that the first 640k are avaiable and get the amount of
the extended memory trought a BIOS call*?
*= something like this:
/* Now detect memory size (extended in KB) */
movb $0x88, %ah
int $0x15
memory_error:
jc memory_error
movw %ax, EXT_MEMORY
YES, I know the limits of this call but my simple system don't need a lot
of memory...
Is this OK or I must use the same srategy of linux?:
# Try three different memory detection schemes. First, try
# e820h, which lets us assemble a memory map, then try e801h,
# which returns a 32-bit memory size, and finally 88h, which
# returns 0-64m
bye,
Paolo