Boot question
- crazygray1
- Member
- Posts: 168
- Joined: Thu Nov 22, 2007 7:18 pm
- Location: USA,Hawaii,Honolulu(Seriously)
Boot question
When the computer starts up what is the drive number of the boot drive?
Codname: Cipher
Working On: Design Doc(CFFS file system)
Working On: Design Doc(CFFS file system)
Re: Boot question
Hi,
Where possible (e.g. when the BIOS boots some from some sort of storage device that actually has a drive number), the BIOS tells the boot loader which drive number the storage device is (or which drive number the emulated storage device is) in the DL register.
Often the drive number is either 0x00 (first floppy drive or an emulated floppy drive) or 0x80 (first hard drive or an emulated hard drive). Even for hard drives and floppy drives this isn't always the case - for example, a boot manager could boot (chain load) the second floppy drive and tell the boot loader it booted from drive 0x01.
Cheers,
Brendan
There is no set drive number - it could be the first floppy, the first hard drive, a CD-ROM (with floppy emulation, hard disk emulation or no emulation), a network card, flash memory/USB, etc.crazygray1 wrote:When the computer starts up what is the drive number of the boot drive?
Where possible (e.g. when the BIOS boots some from some sort of storage device that actually has a drive number), the BIOS tells the boot loader which drive number the storage device is (or which drive number the emulated storage device is) in the DL register.
Often the drive number is either 0x00 (first floppy drive or an emulated floppy drive) or 0x80 (first hard drive or an emulated hard drive). Even for hard drives and floppy drives this isn't always the case - for example, a boot manager could boot (chain load) the second floppy drive and tell the boot loader it booted from drive 0x01.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
- crazygray1
- Member
- Posts: 168
- Joined: Thu Nov 22, 2007 7:18 pm
- Location: USA,Hawaii,Honolulu(Seriously)
So I can have something like this at the beginning of my code?
Code: Select all
movb %dl,(BOOTDRIVE)
Codname: Cipher
Working On: Design Doc(CFFS file system)
Working On: Design Doc(CFFS file system)
Yep.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}