(E)BDA - safe to use memory?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Guest

(E)BDA - safe to use memory?

Post by Guest »

I'm learnign how to create an OS (in pure asm, no C for me).
And I wonder what memory areas I can use end not.

This EBDA, exaclty what is it? It appears as if not all computers has it, and that it's size varies.

I've made a list of the memory as I know it, am I right or is something terrible wrong? I've been delaying my test on real PC untill I know that I won't cause some permanent changes to the computer I'm testing my OS on. (I fear that I might unknowingly write to the falsh BIOS, should I be afraid (thus BIOSes are falshed when writing to some memory area) or are BIOSes flashed by some other method, wich can't accedentally be done)
Are there any such no-no memory areas or is everything writeable.

Memory Map:
[table][tr][td]Linear Adress[/td][td]Name[/td][td]Usage/comment[/td][/tr]
[tr][td]000000->0003FF[/td][td]IDT[/td][td]IDT, read only[/td][/tr]
[tr][td]000400->0004FF[/td][td]BDA[/td][td]BIOS data area, read only[/td][/tr]
[tr][td]000500->007BFF[/td][td]FREE[/td][td]Free memory, read/write at will[/td][/tr]
[tr][td]007C00->007DFF[/td][td]boot sect[/td][td]Boot sector, read/write at will[/td][/tr]
[tr][td]007E00->09FBFF[/td][td]FREE[/td][td]Free memory, read/write at will[/td][/tr]
[tr][td]09FC00->09FFFF[/td][td]EBDA[/td][td]extended BIOS data area, read only?[/td][/tr]
[tr][td]0A0000->0AFFFF[/td][td]Gfx Mem[/td][td]Graphics memory, may be written to[/td][/tr]
[tr][td]0B0000->0BFFFF[/td][td]Video Text Mem[/td][td]Video text memory, may be written to[/td][/tr]
[tr][td]0C0000->0C7FFF[/td][td]Video BIOS[/td][td]Video BIOS, read only[/td][/tr]
[tr][td]0C8000->0EFFFF[/td][td]ROMs[/td][td]Adapter ROMs, read only[/td][/tr]
[tr][td]0F0000->0FFFFF[/td][td]Sys BIOS[/td][td]System BIOS, read only[/td][/tr]
[tr][td]100000->10FFEF[/td][td]HMA[/td][td]High Memory Area, read/write at will[/td][/tr]
[tr][td]10FFF0->[/td][td]FREE[/td][td]Free extened memory, read/write at will[/td][/tr]
[/table]
DarylD

Re:(E)BDA - safe to use memory?

Post by DarylD »

To be honest, don't use the (E)BDA areas, (E stands for extended incidentally)

But do you really need those few hundred bytes on modern machines???

Daryl.
DynatOS

Re:(E)BDA - safe to use memory?

Post by DynatOS »

In conventional memory you have around 512K of RAM to freely work with. (0x00000500 - 0x0009FFFF).

ROM and some bootloaders load data to 0x00007C00. You could make the first stage boot loader (MBR) load the second stage boot loader (LBR) to whatever part of memory you want above 1.25K (0x00000500) and under 640K (0x000A0000) if the A20 gate is disabled.

Basically, stay out of the upper 640K of the first megabyte of memory (0x000A0000 - 0x000FFFFF) until you know what you are doing and you will be fine.
scientica

Thanks for the replies :)

Post by scientica »

Ok, so memmory in range 500h to and 9FFFFh is free use. And memmory in the range 0A0000h to and FFFFFh is no-no write (exept from B0000h which is used for text out put in text mode). And everything above FFFFFh is free for use.

One thing that worries my mind is that I might accedentally flash my BIOS by writing to the "wrong" memory range, is there any risk do do that? (btw how is flashing of the BIOS done, I'd like to know so I don't flash it)

[sub](I started this thread, and just registered. In case anyone wonders)[/sub]
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:(E)BDA - safe to use memory?

Post by Pype.Clicker »

don't be worried anymore .

First of all, what you access from your BIOS data&coderange is not really the FLASH ROM device, but some RAM that has been configured to mirror the FLASH content and to block write accesses (for speed reasons)

Second, in order to reprogram a flash, you must provide some special codes and give the bytes to a specific port, not simply sending it a conventionnal write cycle. It will ususally require a special program to do this, and that program is likely to be motherboard (or at least FLASH chip) dependent ...
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:(E)BDA - safe to use memory?

Post by df »

i actually treat it from 0x600 to 0x9FFFF

ive never really bothered wit the EBDA.
-- Stu --
mr. xsism

Re:(E)BDA - safe to use memory?

Post by mr. xsism »

you'll need the EBDA later for V86 mode to use BIOS ints in pmode. So unless you don't want BIOS later on, don't mess with the EBDA right now.

Regards,
Mr. xsism

irc.wyldryde.net @ #osdev <- i'm there a lot
Peter_Vigren

Re:(E)BDA - safe to use memory?

Post by Peter_Vigren »

mr. xsism wrote: you'll need the EBDA later for V86 mode to use BIOS ints in pmode. So unless you don't want BIOS later on, don't mess with the EBDA right now.

Regards,
Mr. xsism

irc.wyldryde.net @ #osdev <- i'm there a lot
Why is the EBDA needed if I want to use the BIOS in V86?
Peter_Vigren

Re:(E)BDA - safe to use memory?

Post by Peter_Vigren »

Guest wrote: I'm learnign how to create an OS (in pure asm, no C for me).
Join the club :-)
I don't want to use C either. It feels better with asm... even if I have to write alot of code it feels better since I gets closer to the machine and get a better understanding of how it works... I thought I was the only one that wanted to do an OS in pure assembly :-)
mr. xsism

Re:(E)BDA - safe to use memory?

Post by mr. xsism »

V86 mode basically allows you to use 16bit BIOS ints from 32bit pmode. You need the EBDA to call those BIOS ints, otherwise where would you get them from?

btw, check Pype.Clicker's post on IS ID cards. I have a good lookin temp there that i want everyone to critique :)

Regards,
Mr. xsism
Peter_Vigren

Re:(E)BDA - safe to use memory?

Post by Peter_Vigren »

mr. xsism wrote: V86 mode basically allows you to use 16bit BIOS ints from 32bit pmode. You need the EBDA to call those BIOS ints, otherwise where would you get them from?
From the IVT perhaps?
Post Reply