wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / hal / hal.c
blob21ce6e12c99d5b20b12589b021d9731796d7fd45
1 /*
2 * hal.dll implementation
4 * Copyright (C) 2007 Chris Wulff
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "ntstatus.h"
24 #define WIN32_NO_STATUS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winternl.h"
28 #include "excpt.h"
29 #include "ddk/ntddk.h"
30 #include "wine/asm.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl);
35 #ifdef __i386__
37 #ifndef _WIN32
39 extern void * WINAPI wrap_fastcall_func1( void *func, const void *a );
40 __ASM_STDCALL_FUNC( wrap_fastcall_func1, 8,
41 "popl %ecx\n\t"
42 "popl %eax\n\t"
43 "xchgl (%esp),%ecx\n\t"
44 "jmp *%eax" );
45 extern void * WINAPI wrap_fastcall_func2( void *func, const void *a, const void *b );
46 __ASM_STDCALL_FUNC( wrap_fastcall_func2, 12,
47 "popl %edx\n\t"
48 "popl %eax\n\t"
49 "popl %ecx\n\t"
50 "xchgl (%esp),%edx\n\t"
51 "jmp *%eax" );
53 #define call_fastcall_func1(func,a) wrap_fastcall_func1(func,a)
54 #define call_fastcall_func2(func,a,b) wrap_fastcall_func2(func,a,b)
56 #else /* _WIN32 */
58 #define call_fastcall_func1(func,a) func(a)
59 #define call_fastcall_func2(func,a,b) func(a,b)
61 #endif /* _WIN32 */
63 DEFINE_FASTCALL1_WRAPPER( ExAcquireFastMutex )
64 void FASTCALL ExAcquireFastMutex( FAST_MUTEX *mutex )
66 call_fastcall_func1( ExAcquireFastMutexUnsafe, mutex );
69 DEFINE_FASTCALL1_WRAPPER( ExReleaseFastMutex )
70 void FASTCALL ExReleaseFastMutex( FAST_MUTEX *mutex )
72 call_fastcall_func1( ExReleaseFastMutexUnsafe, mutex );
75 DEFINE_FASTCALL1_WRAPPER( ExTryToAcquireFastMutex )
76 BOOLEAN FASTCALL ExTryToAcquireFastMutex( FAST_MUTEX *mutex )
78 TRACE("mutex %p.\n", mutex);
80 return (InterlockedCompareExchange( &mutex->Count, 0, 1 ) == 1);
83 DEFINE_FASTCALL1_WRAPPER( KfAcquireSpinLock )
84 KIRQL FASTCALL KfAcquireSpinLock( KSPIN_LOCK *lock )
86 KIRQL irql;
87 KeAcquireSpinLock( lock, &irql );
88 return irql;
91 void WINAPI KeAcquireSpinLock( KSPIN_LOCK *lock, KIRQL *irql )
93 TRACE("lock %p, irql %p.\n", lock, irql);
94 KeAcquireSpinLockAtDpcLevel( lock );
95 *irql = 0;
98 DEFINE_FASTCALL_WRAPPER( KfReleaseSpinLock, 8 )
99 void FASTCALL KfReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql )
101 KeReleaseSpinLock( lock, irql );
104 void WINAPI KeReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql )
106 TRACE("lock %p, irql %u.\n", lock, irql);
107 KeReleaseSpinLockFromDpcLevel( lock );
110 DEFINE_FASTCALL_WRAPPER( KeAcquireInStackQueuedSpinLock, 8 )
111 void FASTCALL KeAcquireInStackQueuedSpinLock( KSPIN_LOCK *lock, KLOCK_QUEUE_HANDLE *queue )
113 call_fastcall_func2( KeAcquireInStackQueuedSpinLockAtDpcLevel, lock, queue );
116 DEFINE_FASTCALL1_WRAPPER( KeReleaseInStackQueuedSpinLock )
117 void FASTCALL KeReleaseInStackQueuedSpinLock( KLOCK_QUEUE_HANDLE *queue )
119 call_fastcall_func1( KeReleaseInStackQueuedSpinLockFromDpcLevel, queue );
121 #endif /* __i386__ */
123 #if defined(__i386__) || defined(__arm__) || defined(__aarch64__)
125 DEFINE_FASTCALL1_WRAPPER( KfLowerIrql )
126 VOID FASTCALL KfLowerIrql(KIRQL NewIrql)
128 FIXME( "(%u) stub!\n", NewIrql );
131 DEFINE_FASTCALL1_WRAPPER( KfRaiseIrql )
132 KIRQL FASTCALL KfRaiseIrql(KIRQL NewIrql)
134 FIXME( "(%u) stub!\n", NewIrql );
136 return 0;
139 KIRQL WINAPI KeGetCurrentIrql(VOID)
141 FIXME( " stub!\n");
142 return 0;
145 UCHAR WINAPI READ_PORT_UCHAR(UCHAR *port)
147 FIXME("(%p) stub!\n", port);
148 return 0;
151 ULONG WINAPI READ_PORT_ULONG(ULONG *port)
153 FIXME("(%p) stub!\n", port);
154 return 0;
157 void WINAPI WRITE_PORT_UCHAR(UCHAR *port, UCHAR value)
159 FIXME("(%p %d) stub!\n", port, value);
162 void WINAPI WRITE_PORT_ULONG(ULONG *port, ULONG value)
164 FIXME("(%p %d) stub!\n", port, value);
166 #endif /* __i386__ || __arm__ || __arm64__ */
168 ULONG WINAPI HalGetBusData(BUS_DATA_TYPE BusDataType, ULONG BusNumber, ULONG SlotNumber, PVOID Buffer, ULONG Length)
170 FIXME("(%u %u %u %p %u) stub!\n", BusDataType, BusNumber, SlotNumber, Buffer, Length);
171 /* Claim that there is no such bus */
172 return 0;
175 ULONG WINAPI HalGetBusDataByOffset(BUS_DATA_TYPE BusDataType, ULONG BusNumber, ULONG SlotNumber, PVOID Buffer, ULONG Offset, ULONG Length)
177 FIXME("(%u %u %u %p %u %u) stub!\n", BusDataType, BusNumber, SlotNumber, Buffer, Offset, Length);
178 /* Claim that there is no such bus */
179 return 0;
182 BOOLEAN WINAPI HalTranslateBusAddress(INTERFACE_TYPE InterfaceType, ULONG BusNumber, PHYSICAL_ADDRESS BusAddress,
183 PULONG AddressSpace, PPHYSICAL_ADDRESS TranslatedAddress)
185 FIXME("(%d %d %s %p %p) stub!\n", InterfaceType, BusNumber,
186 wine_dbgstr_longlong(BusAddress.QuadPart), AddressSpace, TranslatedAddress);
187 return FALSE;
190 ULONGLONG WINAPI KeQueryPerformanceCounter(LARGE_INTEGER *frequency)
192 LARGE_INTEGER counter;
194 TRACE("(%p)\n", frequency);
196 NtQueryPerformanceCounter(&counter, frequency);
197 return counter.QuadPart;