Commit | Line | Data |
---|---|---|
a09e091a JB |
1 | /* |
2 | * XFree86 int10 module | |
3 | * execute BIOS int 10h calls in x86 real mode environment | |
4 | * Copyright 1999 Egbert Eich | |
5 | */ | |
6 | #ifdef HAVE_XORG_CONFIG_H | |
7 | #include <xorg-config.h> | |
8 | #endif | |
9 | ||
10 | #include <x86emu.h> | |
11 | #include "xf86.h" | |
12 | #include "compiler.h" | |
13 | #include "xf86_OSproc.h" | |
14 | #include "xf86Pci.h" | |
15 | #define _INT10_PRIVATE | |
16 | #include "xf86int10.h" | |
17 | #include "int10Defines.h" | |
18 | ||
19 | #define M _X86EMU_env | |
20 | ||
21 | static void | |
22 | x86emu_do_int(int num) | |
23 | { | |
24 | Int10Current->num = num; | |
25 | ||
26 | if (!int_handler(Int10Current)) { | |
27 | X86EMU_halt_sys(); | |
28 | } | |
29 | } | |
30 | ||
31 | void | |
32 | xf86ExecX86int10(xf86Int10InfoPtr pInt) | |
33 | { | |
34 | int sig = setup_int(pInt); | |
35 | ||
36 | if (sig < 0) | |
37 | return; | |
38 | ||
39 | if (int_handler(pInt)) { | |
40 | X86EMU_exec(); | |
41 | } | |
42 | ||
43 | finish_int(pInt, sig); | |
44 | } | |
45 | ||
46 | Bool | |
47 | xf86Int10ExecSetup(xf86Int10InfoPtr pInt) | |
48 | { | |
49 | int i; | |
50 | X86EMU_intrFuncs intFuncs[256]; | |
51 | ||
52 | X86EMU_pioFuncs pioFuncs = { | |
53 | (&x_inb), | |
54 | (&x_inw), | |
55 | (&x_inl), | |
56 | (&x_outb), | |
57 | (&x_outw), | |
58 | (&x_outl) | |
59 | }; | |
60 | ||
61 | X86EMU_memFuncs memFuncs = { | |
62 | (&Mem_rb), | |
63 | (&Mem_rw), | |
64 | (&Mem_rl), | |
65 | (&Mem_wb), | |
66 | (&Mem_ww), | |
67 | (&Mem_wl) | |
68 | }; | |
69 | ||
70 | X86EMU_setupMemFuncs(&memFuncs); | |
71 | ||
72 | pInt->cpuRegs = &M; | |
73 | M.mem_base = 0; | |
74 | M.mem_size = 1024 * 1024 + 1024; | |
75 | X86EMU_setupPioFuncs(&pioFuncs); | |
76 | ||
77 | for (i = 0; i < 256; i++) | |
78 | intFuncs[i] = x86emu_do_int; | |
79 | X86EMU_setupIntrFuncs(intFuncs); | |
80 | return TRUE; | |
81 | } | |
82 | ||
83 | void | |
84 | printk(const char *fmt, ...) | |
85 | { | |
86 | va_list argptr; | |
87 | ||
88 | va_start(argptr, fmt); | |
89 | VErrorF(fmt, argptr); | |
90 | va_end(argptr); | |
91 | } |