1 | ; $Id: timerA-r0drv-os2.asm 77120 2019-02-01 15:08:46Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Contributed by knut st. osmundsen.
|
---|
8 | ;
|
---|
9 | ; Copyright (C) 2007-2019 Oracle Corporation
|
---|
10 | ;
|
---|
11 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
13 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | ; General Public License (GPL) as published by the Free Software
|
---|
15 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | ;
|
---|
19 | ; The contents of this file may alternatively be used under the terms
|
---|
20 | ; of the Common Development and Distribution License Version 1.0
|
---|
21 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
22 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
23 | ; CDDL are applicable instead of those of the GPL.
|
---|
24 | ;
|
---|
25 | ; You may elect to license modified versions of this file under the
|
---|
26 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
27 | ;
|
---|
28 | ; --------------------------------------------------------------------
|
---|
29 | ;
|
---|
30 | ; This code is based on:
|
---|
31 | ;
|
---|
32 | ; Copyright (c) 2007 knut st. osmundsen <[email protected]>
|
---|
33 | ;
|
---|
34 | ; Permission is hereby granted, free of charge, to any person
|
---|
35 | ; obtaining a copy of this software and associated documentation
|
---|
36 | ; files (the "Software"), to deal in the Software without
|
---|
37 | ; restriction, including without limitation the rights to use,
|
---|
38 | ; copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
39 | ; copies of the Software, and to permit persons to whom the
|
---|
40 | ; Software is furnished to do so, subject to the following
|
---|
41 | ; conditions:
|
---|
42 | ;
|
---|
43 | ; The above copyright notice and this permission notice shall be
|
---|
44 | ; included in all copies or substantial portions of the Software.
|
---|
45 | ;
|
---|
46 | ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
47 | ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
48 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
49 | ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
50 | ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
51 | ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
52 | ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
53 | ; OTHER DEALINGS IN THE SOFTWARE.
|
---|
54 | ;
|
---|
55 |
|
---|
56 |
|
---|
57 | ;*******************************************************************************
|
---|
58 | ;* Header Files *
|
---|
59 | ;*******************************************************************************
|
---|
60 | %define RT_INCL_16BIT_SEGMENTS
|
---|
61 | %include "iprt/asmdefs.mac"
|
---|
62 | %include "iprt/err.mac"
|
---|
63 |
|
---|
64 |
|
---|
65 | ;*******************************************************************************
|
---|
66 | ;* External Symbols *
|
---|
67 | ;*******************************************************************************
|
---|
68 | extern KernThunkStackTo32
|
---|
69 | extern KernThunkStackTo16
|
---|
70 | extern NAME(rtTimerOs2Tick)
|
---|
71 | extern NAME(RTErrConvertFromOS2)
|
---|
72 | BEGINDATA16
|
---|
73 | extern NAME(g_fpfnDevHlp)
|
---|
74 |
|
---|
75 |
|
---|
76 | ;*******************************************************************************
|
---|
77 | ;* Defined Constants And Macros *
|
---|
78 | ;*******************************************************************************
|
---|
79 | %define DevHlp_SetTimer 01dh
|
---|
80 | %define DevHlp_ResetTimer 01eh
|
---|
81 |
|
---|
82 |
|
---|
83 | BEGINCODE
|
---|
84 |
|
---|
85 | ;;
|
---|
86 | ; Arms the our OS/2 timer.
|
---|
87 | ;
|
---|
88 | ; @returns IPRT status code.
|
---|
89 | ;
|
---|
90 | BEGINPROC_EXPORTED rtTimerOs2Arm
|
---|
91 | call KernThunkStackTo16
|
---|
92 | push ebp
|
---|
93 | mov ebp, esp
|
---|
94 |
|
---|
95 | ; jump to the 16-bit code.
|
---|
96 | ;jmp far dword NAME(rtTimerOs2Arm_16) wrt CODE16
|
---|
97 | db 066h
|
---|
98 | db 0eah
|
---|
99 | dw NAME(rtTimerOs2Arm_16) wrt CODE16
|
---|
100 | dw CODE16
|
---|
101 | BEGINCODE16
|
---|
102 | GLOBALNAME rtTimerOs2Arm_16
|
---|
103 |
|
---|
104 | ; setup and do the call
|
---|
105 | push ds
|
---|
106 | push es
|
---|
107 | mov dx, DATA16
|
---|
108 | mov ds, dx
|
---|
109 | mov es, dx
|
---|
110 |
|
---|
111 | mov ax, NAME(rtTimerOs2TickAsm) wrt CODE16
|
---|
112 | mov dl, DevHlp_SetTimer
|
---|
113 | call far [NAME(g_fpfnDevHlp)]
|
---|
114 |
|
---|
115 | pop es
|
---|
116 | pop ds
|
---|
117 |
|
---|
118 | ;jmp far dword NAME(rtTimerOs2Arm_32) wrt FLAT
|
---|
119 | db 066h
|
---|
120 | db 0eah
|
---|
121 | dd NAME(rtTimerOs2Arm_32) ;wrt FLAT
|
---|
122 | dw TEXT32 wrt FLAT
|
---|
123 | BEGINCODE
|
---|
124 | GLOBALNAME rtTimerOs2Arm_32
|
---|
125 | jc .error
|
---|
126 | xor eax, eax
|
---|
127 | .done:
|
---|
128 |
|
---|
129 | leave
|
---|
130 | push eax
|
---|
131 | call KernThunkStackTo32
|
---|
132 | pop eax
|
---|
133 | ret
|
---|
134 |
|
---|
135 | ; convert the error code.
|
---|
136 | .error:
|
---|
137 | and eax, 0ffffh
|
---|
138 | call NAME(RTErrConvertFromOS2)
|
---|
139 | jmp .done
|
---|
140 | ENDPROC rtTimerOs2Arm
|
---|
141 |
|
---|
142 |
|
---|
143 | ;;
|
---|
144 | ; Dearms the our OS/2 timer.
|
---|
145 | ;
|
---|
146 | ; @returns IPRT status code.
|
---|
147 | ;
|
---|
148 | BEGINPROC_EXPORTED rtTimerOs2Dearm
|
---|
149 | call KernThunkStackTo16
|
---|
150 | push ebp
|
---|
151 | mov ebp, esp
|
---|
152 |
|
---|
153 | ; jump to the 16-bit code.
|
---|
154 | ;jmp far dword NAME(rtTimerOs2Dearm_16) wrt CODE16
|
---|
155 | db 066h
|
---|
156 | db 0eah
|
---|
157 | dw NAME(rtTimerOs2Dearm_16) wrt CODE16
|
---|
158 | dw CODE16
|
---|
159 | BEGINCODE16
|
---|
160 | GLOBALNAME rtTimerOs2Dearm_16
|
---|
161 |
|
---|
162 | ; setup and do the call
|
---|
163 | push ds
|
---|
164 | push es
|
---|
165 | mov dx, DATA16
|
---|
166 | mov ds, dx
|
---|
167 | mov es, dx
|
---|
168 |
|
---|
169 | mov ax, NAME(rtTimerOs2TickAsm) wrt CODE16
|
---|
170 | mov dl, DevHlp_ResetTimer
|
---|
171 | call far [NAME(g_fpfnDevHlp)]
|
---|
172 |
|
---|
173 | pop es
|
---|
174 | pop ds
|
---|
175 |
|
---|
176 | ;jmp far dword NAME(rtTimerOs2Dearm_32) wrt FLAT
|
---|
177 | db 066h
|
---|
178 | db 0eah
|
---|
179 | dd NAME(rtTimerOs2Dearm_32) ;wrt FLAT
|
---|
180 | dw TEXT32 wrt FLAT
|
---|
181 | BEGINCODE
|
---|
182 | GLOBALNAME rtTimerOs2Dearm_32
|
---|
183 | jc .error
|
---|
184 | xor eax, eax
|
---|
185 | .done:
|
---|
186 |
|
---|
187 | ; epilogue
|
---|
188 | leave
|
---|
189 | push eax
|
---|
190 | call KernThunkStackTo32
|
---|
191 | pop eax
|
---|
192 | ret
|
---|
193 |
|
---|
194 | ; convert the error code.
|
---|
195 | .error:
|
---|
196 | and eax, 0ffffh
|
---|
197 | call NAME(RTErrConvertFromOS2)
|
---|
198 | jmp .done
|
---|
199 | ENDPROC rtTimerOs2Dearm
|
---|
200 |
|
---|
201 |
|
---|
202 | BEGINCODE16
|
---|
203 |
|
---|
204 | ;;
|
---|
205 | ; OS/2 timer tick callback.
|
---|
206 | ;
|
---|
207 | BEGINPROC rtTimerOs2TickAsm
|
---|
208 | push ds
|
---|
209 | push es
|
---|
210 | push ecx
|
---|
211 | push edx
|
---|
212 | push eax
|
---|
213 |
|
---|
214 | mov ax, DATA32 wrt FLAT
|
---|
215 | mov ds, ax
|
---|
216 | mov es, ax
|
---|
217 |
|
---|
218 | ;jmp far dword NAME(rtTimerOs2TickAsm_32) wrt FLAT
|
---|
219 | db 066h
|
---|
220 | db 0eah
|
---|
221 | dd NAME(rtTimerOs2TickAsm_32) ;wrt FLAT
|
---|
222 | dw TEXT32 wrt FLAT
|
---|
223 | BEGINCODE
|
---|
224 | GLOBALNAME rtTimerOs2TickAsm_32
|
---|
225 | call KernThunkStackTo32
|
---|
226 | call NAME(rtTimerOs2Tick)
|
---|
227 | call KernThunkStackTo16
|
---|
228 |
|
---|
229 | ;jmp far dword NAME(rtTimerOs2TickAsm_16) wrt CODE16
|
---|
230 | db 066h
|
---|
231 | db 0eah
|
---|
232 | dw NAME(rtTimerOs2TickAsm_16) wrt CODE16
|
---|
233 | dw CODE16
|
---|
234 | BEGINCODE16
|
---|
235 | GLOBALNAME rtTimerOs2TickAsm_16
|
---|
236 |
|
---|
237 | pop eax
|
---|
238 | pop edx
|
---|
239 | pop ecx
|
---|
240 | pop es
|
---|
241 | pop ds
|
---|
242 | retf
|
---|
243 | ENDPROC rtTimerOs2TickAsm
|
---|