ReactOS 0.4.15-dev-6680-g8c76870
halfuncs.h File Reference
#include <umtypes.h>
#include <haltypes.h>
#include <ketypes.h>
#include <section_attribs.h>
Include dependency graph for halfuncs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HalHandlerForBus   HALPRIVATEDISPATCH->HalHandlerForBus
 
#define HalHandlerForConfigSpace   HALPRIVATEDISPATCH->HalHandlerForConfigSpace
 
#define HalLocateHiberRanges   HALPRIVATEDISPATCH->HalLocateHiberRanges
 
#define HalRegisterBusHandler   HALPRIVATEDISPATCH->HalRegisterBusHandler
 
#define HalSetWakeEnable   HALPRIVATEDISPATCH->HalSetWakeEnable
 
#define HalSetWakeAlarm   HALPRIVATEDISPATCH->HalSetWakeAlarm
 
#define HalPciTranslateBusAddress   HALPRIVATEDISPATCH->HalPciTranslateBusAddress
 
#define HalPciAssignSlotResources   HALPRIVATEDISPATCH->HalPciAssignSlotResources
 
#define HalHaltSystem   HALPRIVATEDISPATCH->HalHaltSystem
 
#define HalFindBusAddressTranslation   HALPRIVATEDISPATCH->HalFindBusAddressTranslation
 
#define HalResetDisplay   HALPRIVATEDISPATCH->HalResetDisplay
 
#define HalAllocateMapRegisters   HALPRIVATEDISPATCH->HalAllocateMapRegisters
 
#define KdSetupPciDeviceForDebugging   HALPRIVATEDISPATCH->KdSetupPciDeviceForDebugging
 
#define KdReleasePciDeviceforDebugging   HALPRIVATEDISPATCH->KdReleasePciDeviceforDebugging
 
#define KdGetAcpiTablePhase0   HALPRIVATEDISPATCH->KdGetAcpiTablePhase0
 
#define KdCheckPowerButton   HALPRIVATEDISPATCH->KdCheckPowerButton
 
#define HalVectorToIDTEntry   HALPRIVATEDISPATCH->HalVectorToIDTEntry
 
#define KdMapPhysicalMemory64   HALPRIVATEDISPATCH->KdMapPhysicalMemory64
 
#define KdUnmapVirtualAddress   HALPRIVATEDISPATCH->KdUnmapVirtualAddress
 

Functions

NTHALAPI VOID NTAPI HalDisplayString (_In_ PCHAR String)
 
NTHALAPI BOOLEAN NTAPI HalAllProcessorsStarted (VOID)
 
NTHALAPI VOID NTAPI HalReturnToFirmware (_In_ FIRMWARE_REENTRY Action)
 
NTHALAPI VOID NTAPI HalProcessorIdle (VOID)
 
NTHALAPI BOOLEAN NTAPI HalBeginSystemInterrupt (_In_ KIRQL Irql, _In_ ULONG Vector, _Out_ PKIRQL OldIrql)
 
VOID FASTCALL HalClearSoftwareInterrupt (_In_ KIRQL Request)
 
NTHALAPI VOID NTAPI HalDisableSystemInterrupt (_In_ ULONG Vector, _In_ KIRQL Irql)
 
NTHALAPI BOOLEAN NTAPI HalEnableSystemInterrupt (_In_ ULONG Vector, _In_ KIRQL Irql, _In_ KINTERRUPT_MODE InterruptMode)
 
NTHALAPI VOID NTAPI HalEndSystemInterrupt (_In_ KIRQL Irql, _In_ UCHAR Vector)
 
NTHALAPI VOID NTAPI HalReportResourceUsage (VOID)
 
NTHALAPI VOID FASTCALL HalRequestSoftwareInterrupt (_In_ KIRQL SoftwareInterruptRequested)
 
NTHALAPI VOID NTAPI HalRequestIpi (_In_ KAFFINITY TargetSet)
 
NTHALAPI VOID NTAPI HalHandleNMI (PVOID NmiInfo)
 
NTHALAPI UCHAR FASTCALL HalSystemVectorDispatchEntry (_In_ ULONG Vector, _Out_ PKINTERRUPT_ROUTINE **FlatDispatch, _Out_ PKINTERRUPT_ROUTINE *NoConnection)
 
NTHALAPI NTSTATUS NTAPI HalAdjustResourceList (_Inout_ PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList)
 
VOID NTAPI HalStartProfileInterrupt (_In_ KPROFILE_SOURCE ProfileSource)
 
NTHALAPI VOID NTAPI HalStopProfileInterrupt (_In_ KPROFILE_SOURCE ProfileSource)
 
NTHALAPI ULONG_PTR NTAPI HalSetProfileInterval (_In_ ULONG_PTR Interval)
 
NTHALAPI BOOLEAN NTAPI HalQueryRealTimeClock (_In_ PTIME_FIELDS RtcTime)
 
NTHALAPI BOOLEAN NTAPI HalSetRealTimeClock (_In_ PTIME_FIELDS RtcTime)
 
NTHALAPI ULONG NTAPI HalSetTimeIncrement (_In_ ULONG Increment)
 
NTSTATUS NTAPI x86BiosAllocateBuffer (_In_ ULONG *Size, _In_ USHORT *Segment, _In_ USHORT *Offset)
 
NTSTATUS NTAPI x86BiosFreeBuffer (_In_ USHORT Segment, _In_ USHORT Offset)
 
NTSTATUS NTAPI x86BiosReadMemory (_In_ USHORT Segment, _In_ USHORT Offset, _Out_writes_bytes_(Size) PVOID Buffer, _In_ ULONG Size)
 
NTSTATUS NTAPI x86BiosWriteMemory (_In_ USHORT Segment, _In_ USHORT Offset, _In_reads_bytes_(Size) PVOID Buffer, _In_ ULONG Size)
 
BOOLEAN NTAPI x86BiosCall (_In_ ULONG InterruptNumber, _Inout_ PX86_BIOS_REGISTERS Registers)
 

Macro Definition Documentation

◆ HalAllocateMapRegisters

#define HalAllocateMapRegisters   HALPRIVATEDISPATCH->HalAllocateMapRegisters

Definition at line 46 of file halfuncs.h.

◆ HalFindBusAddressTranslation

#define HalFindBusAddressTranslation   HALPRIVATEDISPATCH->HalFindBusAddressTranslation

Definition at line 44 of file halfuncs.h.

◆ HalHaltSystem

#define HalHaltSystem   HALPRIVATEDISPATCH->HalHaltSystem

Definition at line 43 of file halfuncs.h.

◆ HalHandlerForBus

#define HalHandlerForBus   HALPRIVATEDISPATCH->HalHandlerForBus

Definition at line 35 of file halfuncs.h.

◆ HalHandlerForConfigSpace

#define HalHandlerForConfigSpace   HALPRIVATEDISPATCH->HalHandlerForConfigSpace

Definition at line 36 of file halfuncs.h.

◆ HalLocateHiberRanges

#define HalLocateHiberRanges   HALPRIVATEDISPATCH->HalLocateHiberRanges

Definition at line 37 of file halfuncs.h.

◆ HalPciAssignSlotResources

#define HalPciAssignSlotResources   HALPRIVATEDISPATCH->HalPciAssignSlotResources

Definition at line 42 of file halfuncs.h.

◆ HalPciTranslateBusAddress

#define HalPciTranslateBusAddress   HALPRIVATEDISPATCH->HalPciTranslateBusAddress

Definition at line 41 of file halfuncs.h.

◆ HalRegisterBusHandler

#define HalRegisterBusHandler   HALPRIVATEDISPATCH->HalRegisterBusHandler

Definition at line 38 of file halfuncs.h.

◆ HalResetDisplay

#define HalResetDisplay   HALPRIVATEDISPATCH->HalResetDisplay

Definition at line 45 of file halfuncs.h.

◆ HalSetWakeAlarm

#define HalSetWakeAlarm   HALPRIVATEDISPATCH->HalSetWakeAlarm

Definition at line 40 of file halfuncs.h.

◆ HalSetWakeEnable

#define HalSetWakeEnable   HALPRIVATEDISPATCH->HalSetWakeEnable

Definition at line 39 of file halfuncs.h.

◆ HalVectorToIDTEntry

#define HalVectorToIDTEntry   HALPRIVATEDISPATCH->HalVectorToIDTEntry

Definition at line 51 of file halfuncs.h.

◆ KdCheckPowerButton

#define KdCheckPowerButton   HALPRIVATEDISPATCH->KdCheckPowerButton

Definition at line 50 of file halfuncs.h.

◆ KdGetAcpiTablePhase0

#define KdGetAcpiTablePhase0   HALPRIVATEDISPATCH->KdGetAcpiTablePhase0

Definition at line 49 of file halfuncs.h.

◆ KdMapPhysicalMemory64

#define KdMapPhysicalMemory64   HALPRIVATEDISPATCH->KdMapPhysicalMemory64

Definition at line 52 of file halfuncs.h.

◆ KdReleasePciDeviceforDebugging

#define KdReleasePciDeviceforDebugging   HALPRIVATEDISPATCH->KdReleasePciDeviceforDebugging

Definition at line 48 of file halfuncs.h.

◆ KdSetupPciDeviceForDebugging

#define KdSetupPciDeviceForDebugging   HALPRIVATEDISPATCH->KdSetupPciDeviceForDebugging

Definition at line 47 of file halfuncs.h.

◆ KdUnmapVirtualAddress

#define KdUnmapVirtualAddress   HALPRIVATEDISPATCH->KdUnmapVirtualAddress

Definition at line 53 of file halfuncs.h.

Function Documentation

◆ HalAdjustResourceList()

NTHALAPI NTSTATUS NTAPI HalAdjustResourceList ( _Inout_ PIO_RESOURCE_REQUIREMENTS_LIST pResourceList)

◆ HalAllProcessorsStarted()

NTHALAPI BOOLEAN NTAPI HalAllProcessorsStarted ( VOID  )

Definition at line 60 of file processor.c.

61{
62 /* Do nothing */
63 return TRUE;
64}
#define TRUE
Definition: types.h:120

Referenced by Phase1InitializationDiscard().

◆ HalBeginSystemInterrupt()

NTHALAPI BOOLEAN NTAPI HalBeginSystemInterrupt ( _In_ KIRQL  Irql,
_In_ ULONG  Vector,
_Out_ PKIRQL  OldIrql 
)

◆ HalClearSoftwareInterrupt()

VOID FASTCALL HalClearSoftwareInterrupt ( _In_ KIRQL  Request)

◆ HalDisableSystemInterrupt()

NTHALAPI VOID NTAPI HalDisableSystemInterrupt ( _In_ ULONG  Vector,
_In_ KIRQL  Irql 
)

◆ HalDisplayString()

NTHALAPI VOID NTAPI HalDisplayString ( _In_ PCHAR  String)

◆ HalEnableSystemInterrupt()

NTHALAPI BOOLEAN NTAPI HalEnableSystemInterrupt ( _In_ ULONG  Vector,
_In_ KIRQL  Irql,
_In_ KINTERRUPT_MODE  InterruptMode 
)

◆ HalEndSystemInterrupt()

NTHALAPI VOID NTAPI HalEndSystemInterrupt ( _In_ KIRQL  Irql,
_In_ UCHAR  Vector 
)

◆ HalHandleNMI()

NTHALAPI VOID NTAPI HalHandleNMI ( PVOID  NmiInfo)

◆ HalProcessorIdle()

NTHALAPI VOID NTAPI HalProcessorIdle ( VOID  )

Definition at line 83 of file processor.c.

84{
85 /* Enable interrupts and halt the processor */
86 _enable();
88 while (TRUE);
89}
#define UNIMPLEMENTED
Definition: debug.h:115
void __cdecl _enable(void)
Definition: intrin_arm.h:373

Referenced by PopIdle0().

◆ HalQueryRealTimeClock()

NTHALAPI BOOLEAN NTAPI HalQueryRealTimeClock ( _In_ PTIME_FIELDS  RtcTime)

◆ HalReportResourceUsage()

NTHALAPI VOID NTAPI HalReportResourceUsage ( VOID  )

Definition at line 67 of file usage.c.

68{
69 UNICODE_STRING HalString;
70
71 /* Build HAL usage */
72 RtlInitUnicodeString(&HalString, L"ARM Versatile HAL");
74}
VOID NTAPI HalpReportResourceUsage(IN PUNICODE_STRING HalName, IN INTERFACE_TYPE InterfaceType)
Definition: usage.c:26
@ Internal
Definition: hwresource.cpp:137
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define L(x)
Definition: ntvdm.h:50

Referenced by Phase1InitializationDiscard().

◆ HalRequestIpi()

NTHALAPI VOID NTAPI HalRequestIpi ( _In_ KAFFINITY  TargetSet)

◆ HalRequestSoftwareInterrupt()

NTHALAPI VOID FASTCALL HalRequestSoftwareInterrupt ( _In_ KIRQL  SoftwareInterruptRequested)

◆ HalReturnToFirmware()

NTHALAPI VOID NTAPI HalReturnToFirmware ( _In_ FIRMWARE_REENTRY  Action)

Definition at line 21 of file reboot.c.

23{
24 /* Check what kind of action this is */
25 switch (Action)
26 {
27 /* All recognized actions */
28 case HalHaltRoutine:
32 {
33 /* Acquire the display */
35 // TODO: Reboot
36 }
37
38 /* Anything else */
39 default:
40 {
41 /* Print message and break */
42 DbgPrint("HalReturnToFirmware called!\n");
44 }
45 }
46}
#define DbgPrint
Definition: hal.h:12
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:289
NTSYSAPI void WINAPI DbgBreakPoint(void)
@ HalRestartRoutine
Definition: haltypes.h:36
@ HalHaltRoutine
Definition: haltypes.h:34
@ HalPowerDownRoutine
Definition: haltypes.h:35
@ HalRebootRoutine
Definition: haltypes.h:37
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

Referenced by KdbpCmdReboot(), KdpSendWaitContinue(), KeBugCheckWithTf(), and PopShutdownSystem().

◆ HalSetProfileInterval()

NTHALAPI ULONG_PTR NTAPI HalSetProfileInterval ( _In_ ULONG_PTR  Interval)

Definition at line 58 of file profil.c.

60{
61 /*
62 * FIXME:
63 * 1) What is the maximum and minimum interrupt frequency for the RTC?
64 * 2) Find the maximum possible clock divisor value.
65 */
67
68 /* Update interval */
71
72 /* For now... */
73 return Interval;
74}
VOID NTAPI HalStartProfileInterrupt(_In_ KPROFILE_SOURCE ProfileSource)
Definition: profil.c:41
BOOLEAN HalpProfilingStopped
Definition: profil.c:17
DWORD Interval
Definition: netstat.c:30

◆ HalSetRealTimeClock()

NTHALAPI BOOLEAN NTAPI HalSetRealTimeClock ( _In_ PTIME_FIELDS  RtcTime)

Definition at line 288 of file cmos.c.

290{
291 UCHAR i, j;
292 UCHAR SysTime[6];
293
295
296 HalpRtcWriteCommand(RTC_CMD_REGISTER_SHIFT);
297
298 SysTime[0] = INT_BCD(Time->Second);
299 SysTime[1] = INT_BCD(Time->Minute);
300 SysTime[2] = INT_BCD(Time->Hour);
301 SysTime[3] = INT_BCD(Time->Day);
302 SysTime[4] = (Time->Month << 4) | (Time->Weekday & 0x0F);
303 SysTime[5] = INT_BCD(Time->Year % 100);
304
305 /* Write time fields to RTC */
306 for (i = 0; i < 6; i++)
307 {
308 for (j = 0; j < 8; j++)
309 HalpRtcWriteBit(SysTime[i] >> j);
310 }
311
312 HalpRtcWriteCommand(RTC_CMD_TIME_SET_COUNTER_HOLD);
313 HalpRtcWriteCommand(RTC_CMD_REGISTER_HOLD);
314
316
317 return TRUE;
318}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
VOID NTAPI HalpReleaseCmosSpinLock(VOID)
Definition: spinlock.c:243
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:226
#define INT_BCD(int)
Definition: halp.h:59
static PLARGE_INTEGER Time
Definition: time.c:105
#define RTC_CMD_REGISTER_HOLD
Definition: rtc.h:16
#define RTC_CMD_TIME_SET_COUNTER_HOLD
Definition: rtc.h:18
#define RTC_CMD_REGISTER_SHIFT
Definition: rtc.h:17
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ HalSetTimeIncrement()

NTHALAPI ULONG NTAPI HalSetTimeIncrement ( _In_ ULONG  Increment)

◆ HalStartProfileInterrupt()

VOID NTAPI HalStartProfileInterrupt ( _In_ KPROFILE_SOURCE  ProfileSource)

Definition at line 41 of file profil.c.

43{
44 UNREFERENCED_PARAMETER(ProfileSource);
45
47
49
50 /* Configure the clock divisor for generating periodic interrupts */
52
54}
#define FALSE
Definition: types.h:117
UCHAR HalpProfileRate
Definition: profil.c:18
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define RTC_IO_o_INT_CLOCK_DIVISOR
Definition: rtc.h:37

◆ HalStopProfileInterrupt()

NTHALAPI VOID NTAPI HalStopProfileInterrupt ( _In_ KPROFILE_SOURCE  ProfileSource)

Definition at line 24 of file profil.c.

26{
27 UNREFERENCED_PARAMETER(ProfileSource);
28
30
31 /* Clear the interrupt flag */
33
35
37}
#define VOID
Definition: acefi.h:82
PPC_QUAL unsigned char __inbyte(const unsigned long Port)
Definition: intrin_ppc.h:539
#define RTC_IO_i_INTERRUPT_RESET
Definition: rtc.h:44

◆ HalSystemVectorDispatchEntry()

NTHALAPI UCHAR FASTCALL HalSystemVectorDispatchEntry ( _In_ ULONG  Vector,
_Out_ PKINTERRUPT_ROUTINE **  FlatDispatch,
_Out_ PKINTERRUPT_ROUTINE NoConnection 
)

◆ x86BiosAllocateBuffer()

NTSTATUS NTAPI x86BiosAllocateBuffer ( _In_ ULONG Size,
_In_ USHORT Segment,
_In_ USHORT Offset 
)

Definition at line 152 of file x86bios.c.

156{
157 /* Check if the system is initialized and the buffer is large enough */
159 {
160 /* Something was wrong, fail! */
162 }
163
164 /* Check if the buffer is already allocated */
166 {
167 /* Buffer was already allocated, fail */
169 }
170
171 /* The buffer is sufficient, return hardcoded address and size */
172 *Size = PAGE_SIZE;
174 *Offset = 0;
175
176 return STATUS_SUCCESS;
177}
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define InterlockedBitTestAndSet
Definition: interlocked.h:30
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
LONG x86BiosBufferIsAllocated
Definition: x86bios.c:23
BOOLEAN x86BiosIsInitialized
Definition: x86bios.c:22
ULONG64 x86BiosBufferPhysical
Definition: x86bios.c:27
_Inout_ PVOID Segment
Definition: exfuncs.h:1101

Referenced by IntInt10AllocateBuffer().

◆ x86BiosCall()

BOOLEAN NTAPI x86BiosCall ( _In_ ULONG  InterruptNumber,
_Inout_ PX86_BIOS_REGISTERS  Registers 
)

Definition at line 411 of file x86bios.c.

414{
415 const ULONG StackBase = 0x2000;
416 FAST486_STATE EmulatorContext;
417 ULONG FlatIp;
418 PUCHAR InstructionPointer;
419
420 /* Initialize the emulator context */
424 x86IoRead,
426 x86BOP,
427 x86IntAck,
428 NULL, // FpuCallback,
429 NULL); // Tlb
430
431 /* Copy the registers */
432 EmulatorContext.GeneralRegs[FAST486_REG_EAX].Long = Registers->Eax;
433 EmulatorContext.GeneralRegs[FAST486_REG_EBX].Long = Registers->Ebx;
434 EmulatorContext.GeneralRegs[FAST486_REG_ECX].Long = Registers->Ecx;
435 EmulatorContext.GeneralRegs[FAST486_REG_EDX].Long = Registers->Edx;
436 EmulatorContext.GeneralRegs[FAST486_REG_ESI].Long = Registers->Esi;
437 EmulatorContext.GeneralRegs[FAST486_REG_EDI].Long = Registers->Edi;
438 EmulatorContext.SegmentRegs[FAST486_REG_DS].Selector = Registers->SegDs;
439 EmulatorContext.SegmentRegs[FAST486_REG_ES].Selector = Registers->SegEs;
440
441 /* Set Eflags */
442 EmulatorContext.Flags.Long = 0;
443 EmulatorContext.Flags.AlwaysSet = 1;
444 EmulatorContext.Flags.If = 1;
445
446 /* Set up the INT stub */
447 FlatIp = StackBase - 4;
448 InstructionPointer = x86BiosMemoryMapping + FlatIp;
449 InstructionPointer[0] = 0xCD; // INT instruction
450 InstructionPointer[1] = (UCHAR)InterruptNumber;
451 InstructionPointer[2] = 0x90; // NOP. We will stop at this address.
452
453 /* Set the stack pointer */
454 Fast486SetStack(&EmulatorContext, 0, StackBase - 8);
455
456 /* Start execution at the INT stub */
457 Fast486ExecuteAt(&EmulatorContext, 0x00, FlatIp);
458
459 while (TRUE)
460 {
461 /* Get the current flat IP */
462 FlatIp = (EmulatorContext.SegmentRegs[FAST486_REG_CS].Selector << 4) +
463 EmulatorContext.InstPtr.Long;
464
465 /* Make sure we haven't left the allowed memory range */
466 if (FlatIp >= 0x100000)
467 {
468 DPRINT1("x86BiosCall: invalid IP (0x%lx) during BIOS execution", FlatIp);
469 return FALSE;
470 }
471
472 /* Check if we returned from our int stub */
473 if (FlatIp == (StackBase - 2))
474 {
475 /* We are done! */
476 break;
477 }
478
479 /* Emulate one instruction */
481 }
482
483 /* Copy the registers back */
484 Registers->Eax = EmulatorContext.GeneralRegs[FAST486_REG_EAX].Long;
485 Registers->Ebx = EmulatorContext.GeneralRegs[FAST486_REG_EBX].Long;
486 Registers->Ecx = EmulatorContext.GeneralRegs[FAST486_REG_ECX].Long;
487 Registers->Edx = EmulatorContext.GeneralRegs[FAST486_REG_EDX].Long;
488 Registers->Esi = EmulatorContext.GeneralRegs[FAST486_REG_ESI].Long;
489 Registers->Edi = EmulatorContext.GeneralRegs[FAST486_REG_EDI].Long;
490 Registers->SegDs = EmulatorContext.SegmentRegs[FAST486_REG_DS].Selector;
491 Registers->SegEs = EmulatorContext.SegmentRegs[FAST486_REG_ES].Selector;
492
493 return TRUE;
494}
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
VOID NTAPI Fast486SetStack(PFAST486_STATE State, USHORT Segment, ULONG Offset)
Definition: fast486.c:227
VOID NTAPI Fast486Initialize(PFAST486_STATE State, FAST486_MEM_READ_PROC MemReadCallback, FAST486_MEM_WRITE_PROC MemWriteCallback, FAST486_IO_READ_PROC IoReadCallback, FAST486_IO_WRITE_PROC IoWriteCallback, FAST486_BOP_PROC BopCallback, FAST486_INT_ACK_PROC IntAckCallback, FAST486_FPU_PROC FpuCallback, PULONG Tlb)
Definition: fast486.c:103
VOID NTAPI Fast486ExecuteAt(PFAST486_STATE State, USHORT Segment, ULONG Offset)
Definition: fast486.c:212
if(dx< 0)
Definition: linetemp.h:194
VOID NTAPI Fast486StepInto(PFAST486_STATE State)
Definition: debug.c:248
FAST486_STATE EmulatorContext
Definition: cpu.c:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
static VOID FASTCALL x86IoRead(PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
Definition: x86bios.c:344
static VOID FASTCALL x86MemWrite(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
Definition: x86bios.c:281
static VOID FASTCALL x86MemRead(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
Definition: x86bios.c:260
PUCHAR x86BiosMemoryMapping
Definition: x86bios.c:24
static UCHAR FASTCALL x86IntAck(PFAST486_STATE State)
Definition: x86bios.c:402
static VOID FASTCALL x86IoWrite(PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
Definition: x86bios.c:368
static VOID FASTCALL x86BOP(PFAST486_STATE State, UCHAR BopCode)
Definition: x86bios.c:392

Referenced by IntInt10CallBios().

◆ x86BiosFreeBuffer()

NTSTATUS NTAPI x86BiosFreeBuffer ( _In_ USHORT  Segment,
_In_ USHORT  Offset 
)

Definition at line 181 of file x86bios.c.

184{
185 /* Check if the system is initialized and if the address matches */
186 if (!x86BiosIsInitialized || (Segment != 0x2000) || (Offset != 0))
187 {
188 /* Something was wrong, fail */
190 }
191
192 /* Check if the buffer was allocated */
194 {
195 /* It was not, fail */
197 }
198
199 /* Buffer is freed, nothing more to do */
200 return STATUS_SUCCESS;
201}
#define InterlockedBitTestAndReset
Definition: interlocked.h:35
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by IntInt10FreeBuffer().

◆ x86BiosReadMemory()

NTSTATUS NTAPI x86BiosReadMemory ( _In_ USHORT  Segment,
_In_ USHORT  Offset,
_Out_writes_bytes_(Size) PVOID  Buffer,
_In_ ULONG  Size 
)

Definition at line 205 of file x86bios.c.

210{
212
213 /* Calculate the physical address */
214 Address = (Segment << 4) + Offset;
215
216 /* Check if it's valid */
217 if (!x86BiosIsInitialized || ((Address + Size) > 0x100000))
218 {
219 /* Invalid */
221 }
222
223 /* Copy the memory to the buffer */
225
226 /* Return success */
227 return STATUS_SUCCESS;
228}
Definition: bufpool.h:45
static WCHAR Address[46]
Definition: ping.c:68
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by IntInt10ReadMemory().

◆ x86BiosWriteMemory()

NTSTATUS NTAPI x86BiosWriteMemory ( _In_ USHORT  Segment,
_In_ USHORT  Offset,
_In_reads_bytes_(Size) PVOID  Buffer,
_In_ ULONG  Size 
)

Definition at line 232 of file x86bios.c.

237{
239
240 /* Calculate the physical address */
241 Address = (Segment << 4) + Offset;
242
243 /* Check if it's valid */
244 if (!x86BiosIsInitialized || ((Address + Size) > 0x100000))
245 {
246 /* Invalid */
248 }
249
250 /* Copy the memory from the buffer */
252
253 /* Return success */
254 return STATUS_SUCCESS;
255}

Referenced by IntInt10WriteMemory().