source: GPL/trunk/drv32/startup.inc@ 689

Last change on this file since 689 was 679, checked in by David Azarewicz, 5 years ago

Merge changes from Paul's uniaud32next branch.

File size: 5.6 KB
Line 
1; $Id: startup.inc,v 1.1.1.1 2003/07/02 13:56:56 eleph Exp $
2;*
3;* Assembly macro and constant definitions
4;*
5;* (C) 2000-2002 InnoTek Systemberatung GmbH
6;* (C) 2000-2001 Sander van Leeuwen (sandervl@xs4all.nl)
7;*
8;* This program is free software; you can redistribute it and/or
9;* modify it under the terms of the GNU General Public License as
10;* published by the Free Software Foundation; either version 2 of
11;* the License, or (at your option) any later version.
12;*
13;* This program is distributed in the hope that it will be useful,
14;* but WITHOUT ANY WARRANTY; without even the implied warranty of
15;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;* GNU General Public License for more details.
17;*
18;* You should have received a copy of the GNU General Public
19;* License along with this program; if not, write to the Free
20;* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
21;* USA.
22;*
23
24
25; MACRO'S
26;*******************************************************************************
27;enter a 16:32 far function
28;*******************************************************************************
29enter32 MACRO
30 push bp
31 mov bp, sp
32 push ds
33 mov ax, DATA16
34 mov ds, ax
35 ENDM
36;*******************************************************************************
37;return to 16:32 far caller
38;*******************************************************************************
39ret32 MACRO
40 pop ds
41 pop bp
42 db 66h ; Force next instruction 32-bit
43 ret
44 ENDM
45
46enter16 MACRO
47 push bp
48 mov bp, sp
49 ENDM
50ret16 MACRO
51 pop bp
52 ret
53 ENDM
54
55;pushfd/popfd trashed by fucking BUGY KernThunkStackTo32
56;fix idea by zuko
57
58;;******************************************************************************
59;;Need to preserve fs:ebx!! (all other registers must be saved by the caller)
60;;******************************************************************************
61DevThunkStackTo32 MACRO
62 push stacksel
63 push stackbase
64 push edx
65 mov edx, ss
66 mov stacksel, edx
67 pushfd
68 call KernThunkStackTo32
69 popfd
70 mov stackbase, edx
71 pop edx ;trashed by KernThunkStackTo32
72 ENDM
73
74;;******************************************************************************
75;;******************************************************************************
76DevThunkStackTo32_Int MACRO
77 push eax
78 push edx
79 pushfd
80 call KernThunkStackTo32
81 popfd
82 pop edx ;trashed by KernThunkStackTo32
83 pop eax ;trashed by KernThunkStackTo32
84 ENDM
85
86;;******************************************************************************
87;;******************************************************************************
88DevThunkStackTo16 MACRO
89 push edx
90 push eax
91 pushfd
92 call KernThunkStackTo16
93 popfd
94 pop eax ;trashed by KernThunkStackTo16
95 pop edx ;trashed by KernThunkStackTo16 when called in interrupt context
96 pop stackbase
97 pop stacksel
98 ENDM
99
100;;******************************************************************************
101;;******************************************************************************
102DevThunkStackTo16_Int MACRO
103 push edx
104 push eax
105 pushfd
106 call KernThunkStackTo16
107 popfd
108 pop eax ;trashed by KernThunkStackTo16
109 pop edx ;trashed by KernThunkStackTo16 when called in interrupt context
110 ENDM
111
112;*******************************************************************************
113;enter a function that needs to switch to a 16 bits stack
114;*******************************************************************************
115enterKEERM MACRO
116 push ebp
117 mov ebp, esp
118 push ds
119 push es
120 push ebx
121 push ecx
122 push edx
123 push esi
124 push edi
125 ;to access the parameters on the 32 bits stack, once we've switched
126 mov edi, ebp
127 DevThunkStackTo16_Int
128 ENDM
129
130;*******************************************************************************
131;switch stack from 16 bits to 32 bits and return
132;*******************************************************************************
133retKEERM MACRO
134 DevThunkStackTo32_Int
135 pop edi
136 pop esi
137 pop edx
138 pop ecx
139 pop ebx
140 pop es
141 pop ds
142 pop ebp
143 ret
144 ENDM
145
146;;******************************************************************************
147;;******************************************************************************
148
149
150;Constants and structure definitions
151
152; Status word masks
153STERR EQU 8000H ; Bit 15 - Error
154STINTER EQU 0400H ; Bit 10 - Interim character
155STBUI EQU 0200H ; Bit 9 - Busy
156STDON EQU 0100H ; Bit 8 - Done
157STECODE EQU 00FFH ; Error code
158
159; Definition of the request packet header.
160
161reqPacket struc
162reqLenght db ?
163reqUnit db ?
164reqCommand db ?
165reqStatus dw ?
166reqFlags db ?
167 db 3 dup (?) ; Reserved field
168reqLink dd ?
169reqPacket ends
170
171rpInitIn struc
172i_rph db size reqPacket dup (?)
173i_unit db ?
174i_devHelp dd ?
175i_initArgs dd ?
176i_driveNum db ?
177rpInitIn ends
178
179rpInitOut struc
180o_rph db size reqPacket dup (?)
181o_unit db ?
182o_codeend dw ?
183o_dataend dw ?
184o_bpbarray dd ?
185o_status dw ?
186rpInitOut ends
Note: See TracBrowser for help on using the repository browser.