flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Where does the BIOS code reside?

Author
Thread Post new topic Reply to topic
milind



Joined: 15 Feb 2004
Posts: 33
milind
I wanted to know the memory locations where the BIOS code resides. The BIOS has to be present at the location 0xFFFFFFF0 since this is the 1st address the processor jumps to after Reset, then there are like base addresses of COM ports in the lower memeory addresses like 0000:0400 so iis it there also? Also where are the BIOS interrupts placed? Are they in the memory or do they always reside in a ROM wich is mapped to the memory space?
Post 02 Mar 2004, 11:14
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
Ralph



Joined: 04 Oct 2003
Posts: 86
Ralph
http://board.flatassembler.net/download.php?id=583

Quote:

;=>PC Memory map at bootup (from OSD)
;===================
;000000-0003FF interrupt vector table
;000400-0004FF BIOS data area
;000500-007BFF FREE CONVENTIONAL MEMORY
;007C00-007DFF boot sector
;007E00-09FBFF FREE CONVENTIONAL MEMORY
;09FC00-09FFFF extended BDA (variable length)
;0A0000-0FFFFF video memory and BIOS ROMs
;100000-10FFEF high memory area (HMA)
;10FFF0- FREE EXTENDED MEMORY
Post 03 Mar 2004, 00:58
View user's profile Send private message Reply with quote
milind



Joined: 15 Feb 2004
Posts: 33
milind
This is a paragraph from the Intel System Programming Manual:


The first instruction that is fetched and executed following a hardware reset is located at physical address FFFFFFF0H. This address is 16 bytes below the processor’s uppermost physical address. The EPROM containing the software-initialization code must be located at this address.


Therefor the BIOS ROM should be present in that address to but this memory map doesn't show that
Post 04 Mar 2004, 12:07
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73
Rom can exist anywhere basically, it is all how the motherboard configures it.
The first jump does go to address fffffff0. Chances are it just jumps to somewhere in f0000-fffff range so that real mode stuff works. Most rom is located between a0000 and fffff. A search is done to see which cards use up memory between a0000 and fffff.
Usually the bios copies the rom to memory for speed purposes.
Com ports do not use up any memory but use up IO space.
The 0000:0400 is a DOS thing I believe(I don't think it is a BIOS thing)

So basically to answer your original question, the interrupt vector table uses 0000-03ff which is totally relocateable.
BIOS interrups would point to code in the a0000-fffff range.
Once DOS is loaded some of the interrupts will point to where ever DOS is loaded.
Post 04 Mar 2004, 18:34
View user's profile Send private message Reply with quote
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73
Sorry, I guess it is bios and not DOS that uses the 0400-04ff because I believe the timer tick thing is somewhere in this area.
It makes sense since bios can't write to rom.
Post 04 Mar 2004, 19:47
View user's profile Send private message Reply with quote
milind



Joined: 15 Feb 2004
Posts: 33
milind
Actually I did not mean COM ports use up memory in the range 0000:0400 but BIOS places their base addresses there. Secondly the Interrupt vector table is not relocatable in Real mode but in the Protected mode.
The memory map I found on a website is described to be like this:

from * - to * in what
---------- - -------- --------- ---------------------------------------
0 - START

0 - 400 RAM Real-Mode Interrupt Vector Table (IVT)
400 - 500 RAM BIOS data area (BDA)

500 - 9FC00 RAM Conventional memory (free for use)

9FC00 - A0000 RAM Extended BIOS data area (EBDA)
A0000 - C0000 video RAM VGA Framebuffers
C0000 - C8000 ROM Video BIOS (32K is typical size)
C8000 - F0000 NOTHING
F0000 - 100000 ROM Motherboard BIOS (64K is typical size)

100000 - FEC00000 RAM Extended memory (free for use)

FEC00000 - FFFFFFFF various Motherboard BIOS, PnP NVRAM, ACPI, etc.

- FFFFFFFF END


But this map does not show any space in the memory map where the BIOS interrupts are loaded. The vector table is from 0000 to 03FF but where are the actual ISRs?? Isn't the area where they are copied in memory supposed to be reserved, even if we switch to protected mode???
Post 04 Mar 2004, 21:32
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73
The ISR's are stored in the a0000-fffff range. And yes, this memory is still valid in Protected mode.
Just run debug after you boot-up with dos and type the following:
d 0:0
You will see a few entries that start with f000:something.
DOS takes over some of the interupts, but not all. These would point at the bottom of the 500-9ffff or top depending how dos chooses to put it's routines.

You can relocate the Interrupt Vector Table in real mode. Check out the DOS fasm source code.

Once you switch to protected mode, unless you are going back to real mode, you can basically use everything under A0000 since it is useless in protected mode. You can also use everything above 10000 though there might be some memory holes(I think between 15meg and 16meg). Some video cards have some protected modes calls in their rom, but that is about the only useful code area between a0000 and fffff. Of course your video memory is still valid between those locations.
Post 05 Mar 2004, 02:52
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.