VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/nt/nt3fakesA-r0drv-nt.asm@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1; $Id: nt3fakesA-r0drv-nt.asm 98103 2023-01-17 14:15:46Z vboxsync $
2;; @file
3; IPRT - Companion to nt3fakes-r0drv-nt.cpp that provides import stuff to satisfy the linker.
4;
5
6;
7; Copyright (C) 2006-2023 Oracle and/or its affiliates.
8;
9; This file is part of VirtualBox base platform packages, as
10; available from https://www.virtualbox.org.
11;
12; This program is free software; you can redistribute it and/or
13; modify it under the terms of the GNU General Public License
14; as published by the Free Software Foundation, in version 3 of the
15; License.
16;
17; This program is distributed in the hope that it will be useful, but
18; WITHOUT ANY WARRANTY; without even the implied warranty of
19; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20; General Public License for more details.
21;
22; You should have received a copy of the GNU General Public License
23; along with this program; if not, see <https://www.gnu.org/licenses>.
24;
25; The contents of this file may alternatively be used under the terms
26; of the Common Development and Distribution License Version 1.0
27; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28; in the VirtualBox distribution, in which case the provisions of the
29; CDDL are applicable instead of those of the GPL.
30;
31; You may elect to license modified versions of this file under the
32; terms and conditions of either the GPL or the CDDL or both.
33;
34; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35;
36
37;*******************************************************************************
38;* Header Files *
39;*******************************************************************************
40%include "iprt/asmdefs.mac"
41
42%undef NAME
43%define NAME(name) NAME_OVERLOAD(name)
44
45BEGINCODE
46
47;;
48; Called from rtR0Nt3InitSymbols after symbols have been resolved.
49BEGINPROC _rtNt3InitSymbolsAssembly
50 push ebp
51 mov ebp, esp
52
53;;
54; @param 1 The fastcall name.
55; @param 2 Byte size of arguments.
56%macro DefineImportDataAndInitCode 3
57extern $%1 %+ Nt3Fb_ %+ %2 %+ @ %+ %3
58BEGINDATA
59extern _g_pfnrt %+ %2
60GLOBALNAME __imp_ %+ %1 %+ %2 %+ @ %+ %3
61 dd $%1 %+ Nt3Fb_ %+ %2 %+ @ %+ %3
62BEGINCODE
63 mov eax, [_g_pfnrt %+ %2]
64 test eax, eax
65 jz %%next
66 mov [__imp_ %+ %1 %+ %2 %+ @ %+ %3], eax
67%%next:
68%endmacro
69
70 DefineImportDataAndInitCode _,PsGetVersion, 16
71 DefineImportDataAndInitCode _,ZwQuerySystemInformation, 16
72 DefineImportDataAndInitCode _,KeSetTimerEx, 20
73 DefineImportDataAndInitCode _,IoAttachDeviceToDeviceStack, 8
74 DefineImportDataAndInitCode _,PsGetCurrentProcessId, 0
75 DefineImportDataAndInitCode _,ZwYieldExecution, 0
76 DefineImportDataAndInitCode @,ExAcquireFastMutex, 4
77 DefineImportDataAndInitCode @,ExReleaseFastMutex, 4
78
79 xor eax, eax
80 leave
81 ret
82ENDPROC _rtNt3InitSymbolsAssembly
83
84
85;;
86; @param 1 The fastcall name.
87; @param 2 The stdcall name.
88; @param 3 Byte size of arguments.
89; @param 4 Zero if 1:1 mapping;
90; One if 2nd parameter is a byte pointer that the farcall version
91; instead returns in al.
92%macro FastOrStdCallWrapper 4
93BEGINCODE
94extern _g_pfnrt %+ %1
95extern _g_pfnrt %+ %2
96BEGINPROC_EXPORTED $@ %+ %1 %+ @ %+ %3
97 mov eax, [_g_pfnrt %+ %1]
98 cmp eax, 0
99 jnz .got_fast_call
100 mov eax, .stdcall_wrapper
101 mov [__imp_@ %+ %1 %+ @ %+ %3], eax
102
103.stdcall_wrapper:
104 push ebp
105 mov ebp, esp
106%if %4 == 1
107 push dword 0
108 push esp
109%else
110 push edx
111%endif
112 push ecx
113 call [_g_pfnrt %+ %2]
114%if %4 == 1
115 movzx eax, byte [ebp - 4]
116%endif
117 leave
118 ret
119
120.got_fast_call:
121 mov [__imp_@ %+ %1 %+ @ %+ %3], eax
122 jmp eax
123ENDPROC $@ %+ %1 %+ @ %+ %3
124
125BEGINDATA
126GLOBALNAME __imp_@ %+ %1 %+ @ %+ %3
127 dd $@ %+ %1 %+ @ %+ %3
128%endmacro
129
130FastOrStdCallWrapper IofCompleteRequest, IoCompleteRequest, 8, 0
131FastOrStdCallWrapper IofCallDriver, IoCallDriver, 8, 0
132FastOrStdCallWrapper ObfDereferenceObject, ObDereferenceObject, 4, 0
133FastOrStdCallWrapper KfAcquireSpinLock, KeAcquireSpinLock, 4, 1
134FastOrStdCallWrapper KfReleaseSpinLock, KeReleaseSpinLock, 8, 0
135FastOrStdCallWrapper KfRaiseIrql, KeRaiseIrql, 4, 1
136FastOrStdCallWrapper KfLowerIrql, KeLowerIrql, 4, 0
137FastOrStdCallWrapper KefAcquireSpinLockAtDpcLevel, KeAcquireSpinLockAtDpcLevel, 4, 0
138FastOrStdCallWrapper KefReleaseSpinLockFromDpcLevel,KeReleaseSpinLockFromDpcLevel, 4, 0
139
140
141BEGINCODE
142; LONG FASTCALL InterlockedExchange(LONG volatile *,LONG );
143BEGINPROC_EXPORTED $@InterlockedExchange@8
144 mov eax, edx
145 xchg [ecx], eax
146 ret
147
148BEGINDATA
149GLOBALNAME __imp_@InterlockedExchange@8
150 dd $@InterlockedExchange@8
151
152
153BEGINDATA
154GLOBALNAME __imp__KeTickCount
155GLOBALNAME _KeTickCount
156 dd 0
157
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