VirtualBox

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

Last change on this file since 78071 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

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