source: branches/minix3-book/kernel/system/do_int86.c@ 9

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

Importazione sorgenti libro

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 <ibm/int86.h>
11
12struct reg86u reg86;
13
14/*===========================================================================*
15 * do_int86 *
16 *===========================================================================*/
17PUBLIC int do_int86(m_ptr)
18register message *m_ptr; /* pointer to request message */
19{
20 int caller;
21 vir_bytes caller_vir;
22 phys_bytes caller_phys, kernel_phys;
23
24 caller = (int) m_ptr->m_source;
25 caller_vir = (vir_bytes) m_ptr->INT86_REG86;
26 caller_phys = umap_local(proc_addr(caller), D, caller_vir, sizeof(reg86));
27 if (0 == caller_phys) return(EFAULT);
28 kernel_phys = vir2phys(&reg86);
29 phys_copy(caller_phys, kernel_phys, (phys_bytes) sizeof(reg86));
30
31 level0(int86);
32
33 /* Copy results back to the caller */
34 phys_copy(kernel_phys, caller_phys, (phys_bytes) sizeof(reg86));
35
36 /* The BIOS call eats interrupts. Call get_randomness to generate some
37 * entropy. Normally, get_randomness is called from an interrupt handler.
38 * Figuring out the exact source is too complicated. CLOCK_IRQ is normally
39 * not very random.
40 */
41 lock(0, "do_int86");
42 get_randomness(CLOCK_IRQ);
43 unlock(0);
44
45 return(OK);
46}
Note: See TracBrowser for help on using the repository browser.