bios_wini driver

This commit is contained in:
Philip Homburg
2005-07-29 10:21:04 +00:00
parent f6b0544de9
commit 49c25df569
18 changed files with 640 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ OBJECTS = \
$(SYSTEM)(do_irqctl.o) \
$(SYSTEM)(do_devio.o) \
$(SYSTEM)(do_vdevio.o) \
$(SYSTEM)(do_int86.o) \
$(SYSTEM)(do_sdevio.o) \
$(SYSTEM)(do_copy.o) \
$(SYSTEM)(do_vcopy.o) \
@@ -96,6 +97,9 @@ $(SYSTEM)(do_sdevio.o): do_sdevio.c
$(SYSTEM)(do_vdevio.o): do_vdevio.c
$(CC) do_vdevio.c
$(SYSTEM)(do_int86.o): do_int86.c
$(CC) do_int86.c
$(SYSTEM)(do_copy.o): do_copy.c
$(CC) do_copy.c
@@ -134,4 +138,3 @@ $(SYSTEM)(do_privctl.o): do_privctl.c
$(SYSTEM)(do_segctl.o): do_segctl.c
$(CC) do_segctl.c

1
kernel/system/do_bios.c Normal file
View File

@@ -0,0 +1 @@

View File

@@ -15,6 +15,9 @@
#include "../system.h"
static unsigned long bios_buf[1024]; /* 4K, what about alignment */
static vir_bytes bios_buf_vir, bios_buf_len;
#if USE_GETINFO
/*===========================================================================*
@@ -113,6 +116,22 @@ register message *m_ptr; /* pointer to request message */
break;
}
#endif
case GET_BIOSBUFFER:
bios_buf_vir = (vir_bytes)bios_buf;
bios_buf_len = sizeof(bios_buf);
length = sizeof(bios_buf_len);
src_phys = vir2phys(&bios_buf_len);
if (length != m_ptr->I_VAL_LEN2) return (EINVAL);
proc_nr = m_ptr->m_source; /* only caller can request copy */
dst_phys = numap_local(proc_nr, (vir_bytes) m_ptr->I_VAL_PTR2, length);
if (src_phys == 0 || dst_phys == 0) return(EFAULT);
phys_copy(src_phys, dst_phys, length);
length = sizeof(bios_buf_vir);
src_phys = vir2phys(&bios_buf_vir);
break;
default:
return(EINVAL);
}

46
kernel/system/do_int86.c Normal file
View File

@@ -0,0 +1,46 @@
/* The system call implemented in this file:
* m_type: SYS_INT86
*
* The parameters for this system call are:
* m1_p1: INT86_REG86
*/
#include "../system.h"
#include <minix/type.h>
#include <ibm/int86.h>
struct reg86u reg86;
/*===========================================================================*
* do_int86 *
*===========================================================================*/
PUBLIC int do_int86(m_ptr)
register message *m_ptr; /* pointer to request message */
{
int caller;
vir_bytes caller_vir;
phys_bytes caller_phys, kernel_phys;
caller = (int) m_ptr->m_source;
caller_vir = (vir_bytes) m_ptr->INT86_REG86;
caller_phys = umap_local(proc_addr(caller), D, caller_vir, sizeof(reg86));
if (0 == caller_phys) return(EFAULT);
kernel_phys = vir2phys(&reg86);
phys_copy(caller_phys, kernel_phys, (phys_bytes) sizeof(reg86));
level0(int86);
/* Copy results back to the caller */
phys_copy(kernel_phys, caller_phys, (phys_bytes) sizeof(reg86));
/* The BIOS call eats interrupts. Call get_randomness to generate some
* entropy. Normally, get_randomness is called from an interrupt handler.
* Figuring out the exact source is too complicated. CLOCK_IRQ is normally
* not very random.
*/
lock(0, "do_int86");
get_randomness(CLOCK_IRQ);
unlock(0);
return(OK);
}