Any "MS-DOS compatible" OS is will require BIOS (or provide an emulation of one). Almost all DOS programs (and many parts of DOS itself) use BIOS services. DOS itself doesn't provide anything like a complete API for programming the PC and was designed to be used in conjunction with the BIOS. Even if the OS could be made BIOS-independent, there would be very few DOS applications that would run without it.
Basically, "DOS" without the BIOS would be almost completely useless.
BIOS calls and registers
Re: BIOS calls and registers
It seems the topic has run far off course.
To return to the original question: Are there any registers whose contents I can be sure will be preserved when utilizing a BIOS call?
RBIL doesn't mention what registers are preserved, etc, when describing E820. Naturally, I assume all the ones it doesn't mention as being altered or used by the call, are preserved.
But how sure can I be of that?
~K
To return to the original question: Are there any registers whose contents I can be sure will be preserved when utilizing a BIOS call?
RBIL doesn't mention what registers are preserved, etc, when describing E820. Naturally, I assume all the ones it doesn't mention as being altered or used by the call, are preserved.
But how sure can I be of that?
~K
Re: BIOS calls and registers
Every register not mentioned is preserved, SS & SP is saved by the int XX.elderK wrote:RBIL doesn't mention what registers are preserved
RBIL is the BIBLE about interrupts, if something is not mentioned there you'll have to search the BIOS source code directly.
"God! Not Unix" - Richard Stallman
Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Re: BIOS calls and registers
I would say it is not a good idea to trust that. I could write a code snippet like this:b.zaar wrote:Every register not mentioned is preserved
Code: Select all
RandomByteVal equ 0x12
RandomAddrOff equ 0x1234
RandomAddrSeg equ 0x4321
ExampleCode:
mov ax, RandomAddrSeg
mov ds, ax
cmp byte [RandomAddrOff], RandomByteVal
jne SafeBranch
call TurnOffTheSun ; THIS MUST NOT BE CALLED!
SafeBranch:
Re: BIOS calls and registers
I'm not sure what your point is here? Where is the bios interrupt and which register did it corrupt?Antti wrote:I would say it is not a good idea to trust that. I could write a code snippet like this:b.zaar wrote:Every register not mentioned is preserved
I am almost sure the Sun is not turned off. Do I like to have this kind of code? No.Code: Select all
RandomByteVal equ 0x12 RandomAddrOff equ 0x1234 RandomAddrSeg equ 0x4321 ExampleCode: mov ax, RandomAddrSeg mov ds, ax cmp byte [RandomAddrOff], RandomByteVal jne SafeBranch call TurnOffTheSun ; THIS MUST NOT BE CALLED! SafeBranch:
"God! Not Unix" - Richard Stallman
Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Re: BIOS calls and registers
The point was to show that code could be safe in practice. If you accept that quality level, then it is perfectly fine. Most of the programmers do that. Saying that all the registers not mentioned are preserved is not something that I would assume.b.zaar wrote:I'm not sure what your point is here? Where is the bios interrupt and which register did it corrupt?
It is not too difficult to write code that does not care whether registers are preserved or not. I will assume that registers cs, ss, and sp are preserved if calling BIOS interrupt services.
Re: BIOS calls and registers
The bios has been around a long time and I think if it couldn't be trusted there's a lot of software out there since 1981 that has been very lucky when using it.Antti wrote:
The point was to show that code could be safe in practice. If you accept that quality level, then it is perfectly fine. Most of the programmers do that. Saying that all the registers not mentioned are preserved is not something that I would assume.
It is not too difficult to write code that does not care whether registers are preserved or not. I will assume that registers cs, ss, and sp are preserved if calling BIOS interrupt services.
Feel free to browse the bochs bios source code though
Bios shouldn't be trusted any less than dos, Amiga os, os/2 or even any c library you use.
"God! Not Unix" - Richard Stallman
Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed