source: trunk/minix/kernel/system/do_int86.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 1.3 KB
Line 
1/* The kernel call implemented in this file:
2 * m_type: SYS_INT86
3 *
4 * The parameters for this kernel call are:
5 * m1_p1: INT86_REG86
6 */
7
8#include "../system.h"
9#include <minix/type.h>
10#include <minix/endpoint.h>
11#include <ibm/int86.h>
12
13struct reg86u reg86;
14
15/*===========================================================================*
16 * do_int86 *
17 *===========================================================================*/
18PUBLIC int do_int86(m_ptr)
19register message *m_ptr; /* pointer to request message */
20{
21 vir_bytes caller_vir;
22 phys_bytes caller_phys, kernel_phys;
23
24 caller_vir = (vir_bytes) m_ptr->INT86_REG86;
25 caller_phys = umap_local(proc_addr(who_p), D, caller_vir, sizeof(reg86));
26 if (0 == caller_phys) return(EFAULT);
27 kernel_phys = vir2phys(&reg86);
28 phys_copy(caller_phys, kernel_phys, (phys_bytes) sizeof(reg86));
29
30 level0(int86);
31
32 /* Copy results back to the caller */
33 phys_copy(kernel_phys, caller_phys, (phys_bytes) sizeof(reg86));
34
35 /* The BIOS call eats interrupts. Call get_randomness to generate some
36 * entropy. Normally, get_randomness is called from an interrupt handler.
37 * Figuring out the exact source is too complicated. CLOCK_IRQ is normally
38 * not very random.
39 */
40 lock(0, "do_int86");
41 get_randomness(CLOCK_IRQ);
42 unlock(0);
43
44 return(OK);
45}
Note: See TracBrowser for help on using the repository browser.