|
@@ -1,130 +0,0 @@
|
1
|
|
-/* Real-mode interface: assembly-language portions.
|
2
|
|
- *
|
3
|
|
- * Initial version by Michael Brown <mbrown@fensystems.co.uk>, January 2004.
|
4
|
|
- */
|
5
|
|
-
|
6
|
|
-#include "realmode.h"
|
7
|
|
-
|
8
|
|
-#if 1 /* CODE16 */
|
9
|
|
-
|
10
|
|
-#define BOCHSBP xchgw %bx,%bx
|
11
|
|
-
|
12
|
|
-#define NUM_PUSHA_REGS (8)
|
13
|
|
-#define NUM_SEG_REGS (6)
|
14
|
|
-
|
15
|
|
- .text
|
16
|
|
- .arch i386
|
17
|
|
- .section ".text16.nocompress", "ax", @progbits
|
18
|
|
- .code16
|
19
|
|
-
|
20
|
|
- .equ CR0_PE,1
|
21
|
|
-
|
22
|
|
-#ifdef GAS291
|
23
|
|
-#define DATA32 data32;
|
24
|
|
-#define ADDR32 addr32;
|
25
|
|
-#define LJMPI(x) ljmp x
|
26
|
|
-#else
|
27
|
|
-#define DATA32 data32
|
28
|
|
-#define ADDR32 addr32
|
29
|
|
-/* newer GAS295 require #define LJMPI(x) ljmp *x */
|
30
|
|
-#define LJMPI(x) ljmp x
|
31
|
|
-#endif
|
32
|
|
-
|
33
|
|
-#ifdef PXE_EXPORT
|
34
|
|
-/****************************************************************************
|
35
|
|
- * PXE CALLBACK INTERFACE
|
36
|
|
- *
|
37
|
|
- * Prepend this to rm_callback_interface to create a real-mode PXE
|
38
|
|
- * callback interface.
|
39
|
|
- ****************************************************************************
|
40
|
|
- */
|
41
|
|
- .section ".text16", "ax", @progbits
|
42
|
|
- .globl pxe_callback_interface
|
43
|
|
- .code16
|
44
|
|
-pxe_callback_interface:
|
45
|
|
-
|
46
|
|
-/* Macro to calculate offset of labels within code segment in
|
47
|
|
- * installed copy of code.
|
48
|
|
- */
|
49
|
|
-#define INSTALLED(x) ( (x) - pxe_callback_interface )
|
50
|
|
-
|
51
|
|
-/****************************************************************************
|
52
|
|
- * PXE entry points (!PXE and PXENV+ APIs)
|
53
|
|
- ****************************************************************************
|
54
|
|
- */
|
55
|
|
- /* in_call mechanism for !PXE API calls */
|
56
|
|
- .globl _pxe_in_call_far
|
57
|
|
-_pxe_in_call_far:
|
58
|
|
- /* Prepend "PXE API call" and "API version 0x201" to stack */
|
59
|
|
- pushl $0x201
|
60
|
|
- jmp 1f
|
61
|
|
- /* in_call mechanism for PXENV+ API calls */
|
62
|
|
- .globl _pxenv_in_call_far
|
63
|
|
-_pxenv_in_call_far:
|
64
|
|
- /* Prepend "PXE API call" and "API version 0x200" to stack */
|
65
|
|
- pushl $0x200
|
66
|
|
-1: pushl $EB_OPCODE_PXE
|
67
|
|
- /* Perform real-mode in_call */
|
68
|
|
- call pxe_rm_in_call
|
69
|
|
- /* Return */
|
70
|
|
- addw $8, %sp
|
71
|
|
- lret
|
72
|
|
-
|
73
|
|
-/****************************************************************************
|
74
|
|
- * PXE installation check (INT 1A) code
|
75
|
|
- ****************************************************************************
|
76
|
|
- */
|
77
|
|
- .globl _pxe_intercept_int1a
|
78
|
|
-_pxe_intercept_int1a:
|
79
|
|
- pushfw
|
80
|
|
- cmpw $0x5650, %ax
|
81
|
|
- jne 2f
|
82
|
|
-1: /* INT 1A,5650 - Intercept */
|
83
|
|
- popfw
|
84
|
|
- /* Set up return values according to PXE spec: */
|
85
|
|
- movw $0x564e, %ax /* AX := 564Eh (VN) */
|
86
|
|
- pushw %cs:INSTALLED(_pxe_pxenv_segment)
|
87
|
|
- popw %es /* ES:BX := &(PXENV+ structure) */
|
88
|
|
- movw %cs:INSTALLED(_pxe_pxenv_offset), %bx
|
89
|
|
- clc /* CF is cleared */
|
90
|
|
- lret $2 /* 'iret' without reloading flags */
|
91
|
|
-2: /* INT 1A,other - Do not intercept */
|
92
|
|
- popfw
|
93
|
|
- ljmp %cs:*INSTALLED(_pxe_intercepted_int1a)
|
94
|
|
-
|
95
|
|
- .globl _pxe_intercepted_int1a
|
96
|
|
-_pxe_intercepted_int1a: .word 0,0
|
97
|
|
- .globl _pxe_pxenv_location
|
98
|
|
-_pxe_pxenv_location:
|
99
|
|
-_pxe_pxenv_offset: .word 0
|
100
|
|
-_pxe_pxenv_segment: .word 0
|
101
|
|
-
|
102
|
|
-pxe_rm_in_call:
|
103
|
|
-pxe_attach_rm:
|
104
|
|
- /* rm_callback_interface must be appended here */
|
105
|
|
-
|
106
|
|
-pxe_callback_interface_end:
|
107
|
|
-
|
108
|
|
- .globl _pxe_callback_interface_size
|
109
|
|
- .equ _pxe_callback_interface_size, pxe_callback_interface_end - pxe_callback_interface
|
110
|
|
- .globl pxe_callback_interface_size
|
111
|
|
-pxe_callback_interface_size:
|
112
|
|
- .word _pxe_callback_interface_size
|
113
|
|
-
|
114
|
|
-#else /* PXE_EXPORT */
|
115
|
|
-
|
116
|
|
-/* Define symbols used by the linker scripts, to prevent link errors */
|
117
|
|
- .globl _pxe_callback_interface_size
|
118
|
|
- .equ _pxe_callback_interface_size, 0
|
119
|
|
-
|
120
|
|
-#endif /* PXE_EXPORT */
|
121
|
|
-
|
122
|
|
-#else /* CODE16 */
|
123
|
|
-
|
124
|
|
-/* Define symbols used by the linker scripts, to prevent link errors */
|
125
|
|
- .globl _rm_callback_interface_size
|
126
|
|
- .equ _rm_callback_interface_size, 0
|
127
|
|
- .globl _pxe_callback_interface_size
|
128
|
|
- .equ _pxe_callback_interface_size, 0
|
129
|
|
-
|
130
|
|
-#endif /* CODE16 */
|