35 for (
y = 0;
y < 0x100;
y++)
37 for (
x = 0;
x < 0x10;
x++)
98 for (Pfn = 0; Pfn < 0x100; Pfn++)
104 for (ListEntry = LoaderBlock->MemoryDescriptorListHead.
Flink;
105 ListEntry != &LoaderBlock->MemoryDescriptorListHead;
106 ListEntry = ListEntry->
Flink)
122 for (Pfn =
Descriptor->BasePage; Pfn < Last; Pfn++)
141 DPRINT1(
"*x86BiosMemoryMapping: %p, %p\n",
260 PFAST486_STATE
State,
281 PFAST486_STATE
State,
307 case 0x3C0:
return (
Size == 1) && IsWrite;
308 case 0x3C1:
return (
Size == 1) && !IsWrite;
309 case 0x3C2:
return (
Size == 1) && IsWrite;
310 case 0x3C4:
return IsWrite;
311 case 0x3C5:
return (
Size <= 2);
312 case 0x3C7:
return (
Size == 1) && IsWrite;
313 case 0x3CC:
return (
Size == 1) && !IsWrite;
314 case 0x3CE:
return IsWrite;
315 case 0x3CF:
return (
Size <= 2);
316 case 0x3D4:
return IsWrite;
317 case 0x3D5:
return (
Size <= 2);
318 case 0x3C6:
return (
Size == 1);
319 case 0x3C8:
return (
Size == 1) && IsWrite;
320 case 0x3C9:
return (
Size == 1);
321 case 0x3DA:
return (
Size == 1) && !IsWrite;
325 case 0x402:
return (
Size == 1) && IsWrite;
328 case 0x1CE:
return (
Size == 1) && IsWrite;
329 case 0x1CF:
return (
Size == 1);
332 case 0x3B6:
return (
Size <= 2);
336 DPRINT1(
"Unknown port 0x%x, size %d, write %d\n",
Port,
Size, IsWrite);
344 PFAST486_STATE
State,
368 PFAST486_STATE
State,
392 PFAST486_STATE
State,
402 PFAST486_STATE
State)
414 const ULONG StackBase = 0x2000;
417 PUCHAR InstructionPointer;
437 EmulatorContext.SegmentRegs[FAST486_REG_DS].Selector = Registers->SegDs;
438 EmulatorContext.SegmentRegs[FAST486_REG_ES].Selector = Registers->SegEs;
446 FlatIp = StackBase - 4;
448 InstructionPointer[0] = 0xCD;
449 InstructionPointer[1] = (
UCHAR)InterruptNumber;
450 InstructionPointer[2] = 0x90;
465 if (FlatIp >= 0x100000)
467 DPRINT1(
"x86BiosCall: invalid IP (0x%lx) during BIOS execution\n", FlatIp);
472 if (FlatIp == (StackBase - 2))
489 Registers->SegDs =
EmulatorContext.SegmentRegs[FAST486_REG_DS].Selector;
490 Registers->SegEs =
EmulatorContext.SegmentRegs[FAST486_REG_ES].Selector;
509 Registers.
Eax = 0x12;
VOID NTAPI Fast486SetStack(PFAST486_STATE State, USHORT Segment, ULONG Offset)
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)
VOID NTAPI Fast486ExecuteAt(PFAST486_STATE State, USHORT Segment, ULONG Offset)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
VOID NTAPI WRITE_PORT_BUFFER_UCHAR(IN PUCHAR Port, IN PUCHAR Buffer, IN ULONG Count)
VOID NTAPI WRITE_PORT_BUFFER_ULONG(IN PULONG Port, IN PULONG Buffer, IN ULONG Count)
VOID NTAPI WRITE_PORT_BUFFER_USHORT(IN PUSHORT Port, IN PUSHORT Buffer, IN ULONG Count)
VOID NTAPI READ_PORT_BUFFER_UCHAR(IN PUCHAR Port, OUT PUCHAR Buffer, IN ULONG Count)
VOID NTAPI READ_PORT_BUFFER_USHORT(IN PUSHORT Port, OUT PUSHORT Buffer, IN ULONG Count)
VOID NTAPI READ_PORT_BUFFER_ULONG(IN PULONG Port, OUT PULONG Buffer, IN ULONG Count)
BOOLEAN NTAPI HalpBiosDisplayReset(VOID)
ULONG64 NTAPI HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG64 MaxAddress, IN PFN_NUMBER PageCount, IN BOOLEAN Aligned)
#define RtlFillMemory(Dest, Length, Fill)
#define InterlockedBitTestAndSet
#define InterlockedBitTestAndReset
void __cdecl _disable(void)
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
__INTRIN_INLINE uintptr_t __readeflags(void)
#define _In_reads_bytes_(size)
#define _Out_writes_bytes_(size)
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
_In_ ULONG _In_ ULONG Offset
@ LoaderFirmwarePermanent
VOID NTAPI Fast486StepInto(PFAST486_STATE State)
struct _LIST_ENTRY * Flink
FAST486_STATE EmulatorContext
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
LONG x86BiosBufferIsAllocated
static VOID FASTCALL x86IoRead(PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
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)
VOID NTAPI DbgDumpPage(PUCHAR MemBuffer, USHORT Segment)
BOOLEAN NTAPI x86BiosCall(_In_ ULONG InterruptNumber, _Inout_ PX86_BIOS_REGISTERS Registers)
NTSTATUS NTAPI x86BiosWriteMemory(_In_ USHORT Segment, _In_ USHORT Offset, _In_reads_bytes_(Size) PVOID Buffer, _In_ ULONG Size)
VOID NTAPI HalInitializeBios(_In_ ULONG Phase, _In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
static VOID FASTCALL x86MemWrite(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
static VOID FASTCALL x86MemRead(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
BOOLEAN x86BiosIsInitialized
PUCHAR x86BiosMemoryMapping
static UCHAR FASTCALL x86IntAck(PFAST486_STATE State)
ULONG64 x86BiosBufferPhysical
static VOID FASTCALL x86IoWrite(PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
static BOOLEAN ValidatePort(USHORT Port, UCHAR Size, BOOLEAN IsWrite)
static VOID FASTCALL x86BOP(PFAST486_STATE State, UCHAR BopCode)
PFN_NUMBER x86BiosFallbackPfn
NTSTATUS NTAPI x86BiosAllocateBuffer(_In_ ULONG *Size, _In_ USHORT *Segment, _In_ USHORT *Offset)
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define MmGetMdlPfnArray(_Mdl)