VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm@ 93115

Last change on this file since 93115 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 6.3 KB
Line 
1; $Id: timerA-r0drv-os2.asm 93115 2022-01-01 11:31: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-2022 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; This code is based on:
30;
31; Copyright (c) 2007 knut st. osmundsen <[email protected]>
32;
33; Permission is hereby granted, free of charge, to any person
34; obtaining a copy of this software and associated documentation
35; files (the "Software"), to deal in the Software without
36; restriction, including without limitation the rights to use,
37; copy, modify, merge, publish, distribute, sublicense, and/or sell
38; copies of the Software, and to permit persons to whom the
39; Software is furnished to do so, subject to the following
40; conditions:
41;
42; The above copyright notice and this permission notice shall be
43; included in all copies or substantial portions of the Software.
44;
45; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
46; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
47; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
48; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
49; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
50; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
51; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
52; OTHER DEALINGS IN THE SOFTWARE.
53;
54
55
56;*******************************************************************************
57;* Header Files *
58;*******************************************************************************
59%define RT_INCL_16BIT_SEGMENTS
60%include "iprt/asmdefs.mac"
61%include "iprt/err.mac"
62
63
64;*******************************************************************************
65;* External Symbols *
66;*******************************************************************************
67extern KernThunkStackTo32
68extern KernThunkStackTo16
69extern NAME(rtTimerOs2Tick)
70extern NAME(RTErrConvertFromOS2)
71BEGINDATA16
72extern NAME(g_fpfnDevHlp)
73
74
75;*******************************************************************************
76;* Defined Constants And Macros *
77;*******************************************************************************
78%define DevHlp_SetTimer 01dh
79%define DevHlp_ResetTimer 01eh
80
81
82BEGINCODE
83
84;;
85; Arms the our OS/2 timer.
86;
87; @returns IPRT status code.
88;
89BEGINPROC_EXPORTED rtTimerOs2Arm
90 call KernThunkStackTo16
91 push ebp
92 mov ebp, esp
93
94 ; jump to the 16-bit code.
95 ;jmp far dword NAME(rtTimerOs2Arm_16) wrt CODE16
96 db 066h
97 db 0eah
98 dw NAME(rtTimerOs2Arm_16) wrt CODE16
99 dw CODE16
100BEGINCODE16
101GLOBALNAME rtTimerOs2Arm_16
102
103 ; setup and do the call
104 push ds
105 push es
106 mov dx, DATA16
107 mov ds, dx
108 mov es, dx
109
110 mov ax, NAME(rtTimerOs2TickAsm) wrt CODE16
111 mov dl, DevHlp_SetTimer
112 call far [NAME(g_fpfnDevHlp)]
113
114 pop es
115 pop ds
116
117 ;jmp far dword NAME(rtTimerOs2Arm_32) wrt FLAT
118 db 066h
119 db 0eah
120 dd NAME(rtTimerOs2Arm_32) ;wrt FLAT
121 dw TEXT32 wrt FLAT
122BEGINCODE
123GLOBALNAME rtTimerOs2Arm_32
124 jc .error
125 xor eax, eax
126.done:
127
128 leave
129 push eax
130 call KernThunkStackTo32
131 pop eax
132 ret
133
134 ; convert the error code.
135.error:
136 and eax, 0ffffh
137 call NAME(RTErrConvertFromOS2)
138 jmp .done
139ENDPROC rtTimerOs2Arm
140
141
142;;
143; Dearms the our OS/2 timer.
144;
145; @returns IPRT status code.
146;
147BEGINPROC_EXPORTED rtTimerOs2Dearm
148 call KernThunkStackTo16
149 push ebp
150 mov ebp, esp
151
152 ; jump to the 16-bit code.
153 ;jmp far dword NAME(rtTimerOs2Dearm_16) wrt CODE16
154 db 066h
155 db 0eah
156 dw NAME(rtTimerOs2Dearm_16) wrt CODE16
157 dw CODE16
158BEGINCODE16
159GLOBALNAME rtTimerOs2Dearm_16
160
161 ; setup and do the call
162 push ds
163 push es
164 mov dx, DATA16
165 mov ds, dx
166 mov es, dx
167
168 mov ax, NAME(rtTimerOs2TickAsm) wrt CODE16
169 mov dl, DevHlp_ResetTimer
170 call far [NAME(g_fpfnDevHlp)]
171
172 pop es
173 pop ds
174
175 ;jmp far dword NAME(rtTimerOs2Dearm_32) wrt FLAT
176 db 066h
177 db 0eah
178 dd NAME(rtTimerOs2Dearm_32) ;wrt FLAT
179 dw TEXT32 wrt FLAT
180BEGINCODE
181GLOBALNAME rtTimerOs2Dearm_32
182 jc .error
183 xor eax, eax
184.done:
185
186 ; epilogue
187 leave
188 push eax
189 call KernThunkStackTo32
190 pop eax
191 ret
192
193 ; convert the error code.
194.error:
195 and eax, 0ffffh
196 call NAME(RTErrConvertFromOS2)
197 jmp .done
198ENDPROC rtTimerOs2Dearm
199
200
201BEGINCODE16
202
203;;
204; OS/2 timer tick callback.
205;
206BEGINPROC rtTimerOs2TickAsm
207 push ds
208 push es
209 push ecx
210 push edx
211 push eax
212
213 mov ax, DATA32 wrt FLAT
214 mov ds, ax
215 mov es, ax
216
217 ;jmp far dword NAME(rtTimerOs2TickAsm_32) wrt FLAT
218 db 066h
219 db 0eah
220 dd NAME(rtTimerOs2TickAsm_32) ;wrt FLAT
221 dw TEXT32 wrt FLAT
222BEGINCODE
223GLOBALNAME rtTimerOs2TickAsm_32
224 call KernThunkStackTo32
225 call NAME(rtTimerOs2Tick)
226 call KernThunkStackTo16
227
228 ;jmp far dword NAME(rtTimerOs2TickAsm_16) wrt CODE16
229 db 066h
230 db 0eah
231 dw NAME(rtTimerOs2TickAsm_16) wrt CODE16
232 dw CODE16
233BEGINCODE16
234GLOBALNAME rtTimerOs2TickAsm_16
235
236 pop eax
237 pop edx
238 pop ecx
239 pop es
240 pop ds
241 retf
242ENDPROC rtTimerOs2TickAsm
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette