]>
Commit | Line | Data |
---|---|---|
f083c6c3 A |
1 | /* |
2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. | |
7 | * | |
8 | * This file contains Original Code and/or Modifications of Original Code | |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
22 | * | |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * Copyright 1993 NeXT Computer, Inc. | |
27 | * All rights reserved. | |
28 | * | |
29 | * Harness for calling real-mode BIOS functions. | |
30 | */ | |
31 | ||
32 | #include <architecture/i386/asm_help.h> | |
33 | #include "memory.h" | |
34 | ||
35 | #define data32 .byte 0x66 | |
36 | #define addr32 .byte 0x67 | |
37 | ||
38 | #define O_INT 0 | |
39 | #define O_EAX 4 | |
40 | #define O_EBX 8 | |
41 | #define O_ECX 12 | |
42 | #define O_EDX 16 | |
43 | #define O_EDI 20 | |
44 | #define O_ESI 24 | |
45 | #define O_EBP 28 | |
46 | #define O_CS 32 | |
47 | #define O_DS 34 | |
48 | #define O_ES 36 | |
49 | #define O_FLG 38 | |
50 | ||
51 | .data | |
52 | .lcomm save_eax, 4,2 | |
53 | .lcomm save_edx, 4,2 | |
54 | .lcomm save_es, 2,1 | |
55 | .lcomm save_flag, 2,1 | |
56 | .lcomm new_eax, 4,2 | |
57 | .lcomm new_edx, 4,2 | |
58 | .lcomm new_es, 2,1 | |
59 | ||
60 | .text | |
61 | ||
62 | /*============================================================================ | |
63 | * Call real-mode BIOS INT functions. | |
64 | * | |
65 | */ | |
66 | LABEL(_bios) | |
67 | enter $0, $0 | |
68 | pushal | |
69 | ||
70 | movl 8(%ebp), %edx // address of save area | |
71 | movb O_INT(%edx), %al // save int number | |
72 | movb %al, do_int+1 | |
73 | ||
74 | movl O_EBX(%edx), %ebx | |
75 | movl O_ECX(%edx), %ecx | |
76 | movl O_EDI(%edx), %edi | |
77 | movl O_ESI(%edx), %esi | |
78 | movl O_EBP(%edx), %ebp | |
79 | movl %edx, save_edx | |
80 | movl O_EAX(%edx), %eax | |
81 | movl %eax, new_eax | |
82 | movl O_EDX(%edx), %eax | |
83 | movl %eax, new_edx | |
84 | movw O_ES(%edx), %ax | |
85 | movl %ax, new_es | |
86 | ||
87 | call __prot_to_real | |
88 | ||
89 | data32 | |
90 | addr32 | |
91 | mov OFFSET1U16(new_eax), %eax | |
92 | data32 | |
93 | addr32 | |
94 | mov OFFSET1U16(new_edx), %edx | |
95 | data32 | |
96 | addr32 | |
97 | mov OFFSET1U16(new_es), %es | |
98 | ||
99 | do_int: | |
100 | int $0x00 | |
101 | pushf | |
102 | data32 | |
103 | addr32 | |
104 | movl %eax, OFFSET1U16(save_eax) | |
105 | popl %eax // actually pop %ax | |
106 | addr32 | |
107 | movl %eax, OFFSET1U16(save_flag) // actually movw | |
108 | mov %es, %ax | |
109 | addr32 | |
110 | movl %eax, OFFSET1U16(save_es) // actually movw | |
111 | data32 | |
112 | call __real_to_prot | |
113 | ||
114 | movl %edx, new_edx // save new edx before clobbering | |
115 | movl save_edx, %edx | |
116 | movl new_edx, %eax // now move it into buffer | |
117 | movl %eax, O_EDX(%edx) | |
118 | movl save_eax, %eax | |
119 | movl %eax, O_EAX(%edx) | |
120 | movw save_es, %ax | |
121 | movw %ax, O_ES(%edx) | |
122 | movw save_flag, %ax | |
123 | movw %ax, O_FLG(%edx) | |
124 | movl %ebx, O_EBX(%edx) | |
125 | movl %ecx, O_ECX(%edx) | |
126 | movl %edi, O_EDI(%edx) | |
127 | movl %esi, O_ESI(%edx) | |
128 | movl %ebp, O_EBP(%edx) | |
129 | ||
130 | popal | |
131 | leave | |
132 | ||
133 | ret | |
134 |