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
+1
View File
@@ -148,6 +148,7 @@ PRIVATE void initialize(void)
map(SYS_DEVIO, do_devio); /* inb, inw, inl, outb, outw, outl */
map(SYS_SDEVIO, do_sdevio); /* phys_insb, _insw, _outsb, _outsw */
map(SYS_VDEVIO, do_vdevio); /* vector with devio requests */
map(SYS_INT86, do_int86); /* BIOS call */
/* System control. */
map(SYS_ABORT, do_abort); /* abort MINIX */
+2
View File
@@ -107,6 +107,8 @@ _PROTOTYPE( int do_vdevio, (message *m_ptr) );
#define do_vdevio do_unused
#endif
_PROTOTYPE( int do_int86, (message *m_ptr) );
_PROTOTYPE( int do_sdevio, (message *m_ptr) );
#if ! USE_SDEVIO
#define do_sdevio do_unused
+4 -1
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
View File
@@ -0,0 +1 @@
+19
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
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);
}
+3
View File
@@ -99,6 +99,9 @@ PUBLIC struct system_image image[] = {
#endif
#if ENABLE_LOG
{ LOG_PROC_NR, 0, SYS_F, SYS_T, 2, 0, FILLED_MASK, SYSTEM_SEND_MASK, "LOG" },
#endif
#if ENABLE_BIOS_WINI
{ BIOS_WINI, 0, SYS_F, SYS_T, 2, 0, FILLED_MASK, SYSTEM_SEND_MASK, "BIOS" },
#endif
{ INIT_PROC_NR, 0, USER_F, USER_T, USER_Q, 0, USER_CALL_MASK, USER_SEND_MASK, "INIT" },
};