计算机启动时,执行的第一条指令的地址是固定的,这个地址是内存地址吗?但内存这时候是没有内容的,bios和内存是统一编址吗?
[/quote]
以下只是个人见解,不一定完全准确,只供参考。
1.“内存这时候是没有内容的”,准确的说应该是 RAM中无有意义的内容。但是BIOS ROM和显存ROM等内存中是有一些重要的系统程序和系统数据的。rom和ram一样都是内存。
2.“执行的第一条指令的地址是固定的,这个地址是内存地址吗?”当然是内存地址。
3.bios和内存是统一编址吗? 是统一编址的,对于interX86处理器系列来说,计算机初始启动时,cpu默认是在实模式下开始寻址和执行指令的(所以此时最大可以寻址1MB内存,因为只有20位地址总线是选通的)。这时候1MB的物理内存是这样安排的:
低端640KB被称为基本内存(RAM),而A0000H~BFFFFH要保留给显示卡的显存使用的(rom),C0000H~FFFFFH则被保留给BIOS(bios rom)使用,其中系统BIOS一般占用最后的64KB或更多一点的空间,显示卡BIOS一般在C0000H~C7FFFH处,IDE控制器的BIOS在C8000H~CBFFF。
4.但是这并不意味着BIOS中断向量表也在ROM中,这是由初始执行的bios程序初始化到RAM中的(从物理地址00000H开始的1kb)。
我觉得楼主是想弄明白BIOS ROM和主存RAM的电路结构,,,CPU的第一个电信号流必须首先选中ROM才可以启动BIOS里的程序,,,但是ROM和RAM又是两个独立的电子元件,,,不知道这两个独立的电 ... [/quote]
楼主应该是这个意思吧
所谓的存储器编址就是把地址空间的某一个段分给某个芯片嘛
intel用intel8203一类的控制芯片形成片选信号来选择 这个地址到底接到哪个存储芯片
这个初始地址就是连到ROM上的 是这样吧
Hak Foo Registered: Nov 13, 2006 Posts: 1557 | Posted: Fri Sep 07, 2007 9:26 pm |
Simple question, I'd think, but I've never seen a clear answer. You start 10 bytes from the top of address space, and all there really is room for is a jump to something bigger. HOWEVER, this design decision forces you to put ROM at the top of address space, which lead to the later problems with the 640k barrier, when 0xFFFF0 was no longer near the top of address space, and memory was fragmented. I'd expect the ideal place to go on boot would be at the BOTTOM of memory, maybe 0x1000 or so (after the interrupt vectors and such), so the firmware could stay in the same absolute position no matter how large the address space gets, and avoid fragmentation. Alternatively, they could have done something like the 6502 did: read the last few bytes of memory for the start-up address, and so the real firmware could still be located low in memory, even if it was necessary to move it slightly over time. |
Paul Miner Registered: Jun 7, 2004 Posts: 2195 | Posted: Fri Sep 07, 2007 9:40 pm |
My theory: At the time, 1MB of address space was a lot. I don't think they were planning to go beyond that, and that they had to add a new mode to the processor to go beyond 20-bit addresses supports this. I think the idea was to allow ROM to grow down from the top of memory, while programs grew up from the bottom of memory, similar to how stack was located at the top of a segment, and the code at the bottom. |
Gorth Tribus: The ?ther Registered: Jun 3, 2000 Posts: 4338 | Posted: Fri Sep 07, 2007 10:04 pm |
I don't know, but I'll bet that Paul is on the right track. If you assume that 640k is plenty for everyone (trying to avoid the joke....) then planting the ROM at the top keeps it out of the way and program code can grow up from the bottom without having to worry about jumping around firmware which may change in size on a not infrequent basis. |
throx Registered: Oct 27, 2005 Posts: 712 | Posted: Fri Sep 07, 2007 11:39 pm |
When the 8088/8086 was designed, it was never expected to be still in use almost 30 years later over dozens of iterations. In any case, the pattern was the same then as it is today - user code sits in low memory and system/ROM code sits in high memory. This means if you're expecting your ROM to be in high memory then you may as well boot from the top of it the most simple way possible - load the segment with FFFF and the IP with 0000 - gives you a couple of bytes to play with and then jump wherever you really need to. To maintain compatibility with existing applications, each successive revision maintained the booting from CS=FFFF, IP=0000, however hacks were typically put in the CPU to hold any address lines above A20 high until the first jump instruction no matter what the CS register said - so the x86 will always boot from 16 bytes below the top of the address space. A 386 boots from FFFFFFF0, for example. The "hole" from 640k to 1M isn't from the boot address - it's from the fact that ISA I/O memory ranges typically map into that space. At least, that's my understanding from reading the tech manuals. |
russ-iha et Subscriptor Registered: Dec 25, 2000 Posts: 4211 | Posted: Sat Sep 08, 2007 1:18 am |
quote: Originally posted by throx: The "hole" from 640k to 1M isn't from the boot address - it's from the fact that ISA I/O memory ranges typically map into that space. edit: This is exactly correct. EMM386 also allowed you to load TSRs into that address space to free up a tiny bit more memory. (HIMEM provided access to memory above the 1MB boundary) |
Hak Foo Registered: Nov 13, 2006 Posts: 1557 | Posted: Sat Sep 08, 2007 11:55 am |
quote: Originally posted by throx: The "hole" from 640k to 1M isn't from the boot address - it's from the fact that ISA I/O memory ranges typically map into that space. At least, that's my understanding from reading the tech manuals. I assumed it was sort of a "ripple" effect. "We have to have ROM anyway at F0000, so why not map expansion cards at high addresses too?" |
throx Registered: Oct 27, 2005 Posts: 712 | Posted: Sat Sep 08, 2007 1:27 pm |
quote: Originally posted by Hak Foo: I assumed it was sort of a "ripple" effect. "We have to have ROM anyway at F0000, so why not map expansion cards at high addresses too?" Most likely, but more "we have RAM at low addresses and working up as we add more, let's toss expansion below ROM". As usual, backward compatibility was the driver for complexity as the memory space grew. |
norton_I Registered: Apr 30, 2001 Posts: 2682 | Posted: Sat Sep 08, 2007 2:02 pm |
If ROM/IO space were in low memory, it would have either introduced a fair amount of unnecessary complexity into motherboard design to deal with a memory hole or would have wasted memory -- not acceptable on machines with 64-256K. The problem was with the 20 bit addressing, not putting ROM at the top of the address space. The 640K barrier would still be there if ROM were anywhere else, and even if it were in a separate address space, there would be the 1M barrier. The memory hole is a bit of a PITA, but again not nearly as big of a problem as limited DMA windows for ISA hardware. |
gmiller123456 Registered: Dec 4, 2002 Posts: 1064 | Posted: Tue Sep 11, 2007 1:21 pm |
Throx kinda hinted at the reason... Back in the day, every computer had completely new software written for it. It was never assumed that "640k ought to be enough for anyone", but that when 640k wasn't enough, all new software would be developed for newer machines. |
Reference: