2007-10-31 00:02:00 +00:00
|
|
|
/*
|
|
|
|
* hal.dll implementation
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Chris Wulff
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include "windef.h"
|
2019-01-24 05:50:34 +00:00
|
|
|
#include "winbase.h"
|
2007-10-31 00:02:00 +00:00
|
|
|
#include "winternl.h"
|
|
|
|
#include "excpt.h"
|
2008-03-06 12:28:27 +00:00
|
|
|
#include "ddk/ntddk.h"
|
2007-10-31 00:02:00 +00:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl);
|
|
|
|
|
|
|
|
#ifdef __i386__
|
|
|
|
#define DEFINE_FASTCALL1_ENTRYPOINT( name ) \
|
2009-06-14 13:34:28 +00:00
|
|
|
__ASM_STDCALL_FUNC( name, 4, \
|
2007-10-31 00:02:00 +00:00
|
|
|
"popl %eax\n\t" \
|
|
|
|
"pushl %ecx\n\t" \
|
|
|
|
"pushl %eax\n\t" \
|
2009-06-14 13:34:28 +00:00
|
|
|
"jmp " __ASM_NAME("__regs_") #name __ASM_STDCALL(4))
|
2007-10-31 00:02:00 +00:00
|
|
|
#define DEFINE_FASTCALL2_ENTRYPOINT( name ) \
|
2009-06-14 13:34:28 +00:00
|
|
|
__ASM_STDCALL_FUNC( name, 8, \
|
2007-10-31 00:02:00 +00:00
|
|
|
"popl %eax\n\t" \
|
|
|
|
"pushl %edx\n\t" \
|
|
|
|
"pushl %ecx\n\t" \
|
|
|
|
"pushl %eax\n\t" \
|
2009-06-14 13:34:28 +00:00
|
|
|
"jmp " __ASM_NAME("__regs_") #name __ASM_STDCALL(8))
|
2007-10-31 00:02:00 +00:00
|
|
|
|
2008-12-09 03:19:34 +00:00
|
|
|
DEFINE_FASTCALL1_ENTRYPOINT( ExAcquireFastMutex )
|
2017-07-25 09:48:40 +00:00
|
|
|
VOID WINAPI DECLSPEC_HIDDEN __regs_ExAcquireFastMutex(PFAST_MUTEX FastMutex)
|
2008-12-09 03:19:34 +00:00
|
|
|
{
|
|
|
|
FIXME("%p: stub\n", FastMutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_FASTCALL1_ENTRYPOINT( ExReleaseFastMutex )
|
2017-07-25 09:48:40 +00:00
|
|
|
VOID WINAPI DECLSPEC_HIDDEN __regs_ExReleaseFastMutex(PFAST_MUTEX FastMutex)
|
2008-12-09 03:19:34 +00:00
|
|
|
{
|
|
|
|
FIXME("%p: stub\n", FastMutex);
|
|
|
|
}
|
|
|
|
|
2010-09-22 16:04:53 +00:00
|
|
|
DEFINE_FASTCALL1_ENTRYPOINT( ExTryToAcquireFastMutex )
|
2017-07-25 09:48:40 +00:00
|
|
|
BOOLEAN WINAPI DECLSPEC_HIDDEN __regs_ExTryToAcquireFastMutex(PFAST_MUTEX FastMutex)
|
2010-09-22 16:04:53 +00:00
|
|
|
{
|
|
|
|
FIXME("(%p) stub\n", FastMutex);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-10-31 00:02:00 +00:00
|
|
|
DEFINE_FASTCALL1_ENTRYPOINT( KfAcquireSpinLock )
|
2019-01-24 05:50:36 +00:00
|
|
|
KIRQL WINAPI DECLSPEC_HIDDEN __regs_KfAcquireSpinLock( KSPIN_LOCK *lock )
|
2007-10-31 00:02:00 +00:00
|
|
|
{
|
2019-01-24 05:50:36 +00:00
|
|
|
KIRQL irql;
|
|
|
|
KeAcquireSpinLock( lock, &irql );
|
|
|
|
return irql;
|
|
|
|
}
|
2007-10-31 00:02:00 +00:00
|
|
|
|
2019-01-24 05:50:36 +00:00
|
|
|
static inline void small_pause(void)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__( "rep;nop" : : : "memory" );
|
|
|
|
}
|
|
|
|
|
|
|
|
void WINAPI KeAcquireSpinLock( KSPIN_LOCK *lock, KIRQL *irql )
|
|
|
|
{
|
|
|
|
TRACE("lock %p, irql %p.\n", lock, irql);
|
|
|
|
while (!InterlockedCompareExchangePointer( (void **)lock, (void *)1, (void *)0 ))
|
|
|
|
small_pause();
|
|
|
|
*irql = 0;
|
2007-10-31 00:02:00 +00:00
|
|
|
}
|
|
|
|
|
2019-01-24 05:50:32 +00:00
|
|
|
DEFINE_FASTCALL2_ENTRYPOINT( KfReleaseSpinLock )
|
2019-01-24 05:50:34 +00:00
|
|
|
void WINAPI DECLSPEC_HIDDEN __regs_KfReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql )
|
2019-01-24 05:50:32 +00:00
|
|
|
{
|
2019-01-24 05:50:34 +00:00
|
|
|
KeReleaseSpinLock( lock, irql );
|
|
|
|
}
|
|
|
|
|
|
|
|
void WINAPI KeReleaseSpinLock( KSPIN_LOCK *lock, KIRQL irql )
|
|
|
|
{
|
|
|
|
TRACE("lock %p, irql %u.\n", lock, irql);
|
|
|
|
InterlockedExchangePointer( (void **)lock, 0 );
|
2019-01-24 05:50:32 +00:00
|
|
|
}
|
|
|
|
#endif /* __i386__ */
|
2007-10-31 00:02:00 +00:00
|
|
|
|
2019-01-24 05:50:32 +00:00
|
|
|
#if defined(__i386__) || defined(__arm__) || defined(__aarch64__)
|
2007-10-31 00:02:00 +00:00
|
|
|
#ifdef DEFINE_FASTCALL1_ENTRYPOINT
|
|
|
|
DEFINE_FASTCALL1_ENTRYPOINT( KfLowerIrql )
|
2017-07-25 09:48:40 +00:00
|
|
|
VOID WINAPI DECLSPEC_HIDDEN __regs_KfLowerIrql(KIRQL NewIrql)
|
2007-10-31 00:02:00 +00:00
|
|
|
#else
|
|
|
|
VOID WINAPI KfLowerIrql(KIRQL NewIrql)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
FIXME( "(%u) stub!\n", NewIrql );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEFINE_FASTCALL1_ENTRYPOINT
|
|
|
|
DEFINE_FASTCALL1_ENTRYPOINT( KfRaiseIrql )
|
2017-07-25 09:48:40 +00:00
|
|
|
KIRQL WINAPI DECLSPEC_HIDDEN __regs_KfRaiseIrql(KIRQL NewIrql)
|
2007-10-31 00:02:00 +00:00
|
|
|
#else
|
|
|
|
KIRQL WINAPI KfRaiseIrql(KIRQL NewIrql)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
FIXME( "(%u) stub!\n", NewIrql );
|
|
|
|
|
2008-12-05 06:45:49 +00:00
|
|
|
return 0;
|
2007-10-31 00:02:00 +00:00
|
|
|
}
|
|
|
|
|
2009-07-08 23:57:06 +00:00
|
|
|
KIRQL WINAPI KeGetCurrentIrql(VOID)
|
|
|
|
{
|
|
|
|
FIXME( " stub!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2015-12-23 01:35:00 +00:00
|
|
|
|
2016-04-26 04:47:05 +00:00
|
|
|
UCHAR WINAPI READ_PORT_UCHAR(UCHAR *port)
|
|
|
|
{
|
|
|
|
FIXME("(%p) stub!\n", port);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-12-23 01:35:00 +00:00
|
|
|
ULONG WINAPI READ_PORT_ULONG(ULONG *port)
|
|
|
|
{
|
|
|
|
FIXME("(%p) stub!\n", port);
|
|
|
|
return 0;
|
|
|
|
}
|
2016-04-26 04:47:28 +00:00
|
|
|
|
2016-08-16 20:30:20 +00:00
|
|
|
void WINAPI WRITE_PORT_UCHAR(UCHAR *port, UCHAR value)
|
|
|
|
{
|
|
|
|
FIXME("(%p %d) stub!\n", port, value);
|
|
|
|
}
|
|
|
|
|
2016-04-26 04:47:28 +00:00
|
|
|
void WINAPI WRITE_PORT_ULONG(ULONG *port, ULONG value)
|
|
|
|
{
|
|
|
|
FIXME("(%p %d) stub!\n", port, value);
|
|
|
|
}
|
2019-01-24 05:50:32 +00:00
|
|
|
#endif /* __i386__ || __arm__ || __arm64__ */
|
|
|
|
|
|
|
|
ULONG WINAPI HalGetBusData(BUS_DATA_TYPE BusDataType, ULONG BusNumber, ULONG SlotNumber, PVOID Buffer, ULONG Length)
|
|
|
|
{
|
|
|
|
FIXME("(%u %u %u %p %u) stub!\n", BusDataType, BusNumber, SlotNumber, Buffer, Length);
|
|
|
|
/* Claim that there is no such bus */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG WINAPI HalGetBusDataByOffset(BUS_DATA_TYPE BusDataType, ULONG BusNumber, ULONG SlotNumber, PVOID Buffer, ULONG Offset, ULONG Length)
|
|
|
|
{
|
|
|
|
FIXME("(%u %u %u %p %u %u) stub!\n", BusDataType, BusNumber, SlotNumber, Buffer, Offset, Length);
|
|
|
|
/* Claim that there is no such bus */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOLEAN WINAPI HalTranslateBusAddress(INTERFACE_TYPE InterfaceType, ULONG BusNumber, PHYSICAL_ADDRESS BusAddress,
|
|
|
|
PULONG AddressSpace, PPHYSICAL_ADDRESS TranslatedAddress)
|
|
|
|
{
|
|
|
|
FIXME("(%d %d %s %p %p) stub!\n", InterfaceType, BusNumber,
|
|
|
|
wine_dbgstr_longlong(BusAddress.QuadPart), AddressSpace, TranslatedAddress);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2018-02-28 00:29:41 +00:00
|
|
|
|
|
|
|
ULONGLONG WINAPI KeQueryPerformanceCounter(LARGE_INTEGER *frequency)
|
|
|
|
{
|
|
|
|
LARGE_INTEGER counter;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", frequency);
|
|
|
|
|
|
|
|
NtQueryPerformanceCounter(&counter, frequency);
|
|
|
|
return counter.QuadPart;
|
|
|
|
}
|