[Prev][Next][Index][Thread]

Re: Can I call the BIOS in my kernel?



> From: David Nowak <nowak@lineone.net>
> Subject: Can I call the BIOS in my kernel?
> Date: Sat, 07 Apr 2001 16:14:29 +0100
> 
> Can I call the (real mode) BIOS in my kernel?  Could you give me an
> example?

Sure. Here is an example from boot/pxe/main.c.

    #include <oskit/x86/i16.h>
    #include <oskit/x86/base_trap.h>
    #include <oskit/x86/base_vm.h>
    #include <oskit/x86/pc/base_i16.h>

    int
    biosread(int device, int cyl, int head, int sector, int count, void *addr)
    {
    	ts.trapno	= 0x13;
    	ts.eax		= (0x2 << 8)  | count;
    	ts.ecx		= (cyl << 8)  | sector;
    	ts.edx		= (head << 8) | device;
    	ts.ebx		= (oskit_u32_t) addr;
    	ts.v86_es	= 0;
    
    	base_real_int(&ts);
    	return ts.eax & 0xFF;
    }
    
Lbs

----------------------------------------
Leigh B. Stoller
University of Utah - Flux Research Group
http://www.cs.utah.edu/~stoller
----------------------------------------

References: