From 1297540c3d3bd2aa47621c084ba462c7a0da03f4 Mon Sep 17 00:00:00 2001 From: Echelon9 Date: Wed, 2 Jan 2013 21:12:24 +1100 Subject: [PATCH] Implementation (basic) of the HalReadSMBusValue kernel call 0x002D (45) --- import/OpenXDK/include/xboxkrnl/hal.h | 12 ++++------ src/CxbxKrnl/EmuKrnl.cpp | 34 +++++++++++++++++++++++++++ src/CxbxKrnl/KernelThunk.cpp | 2 +- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/import/OpenXDK/include/xboxkrnl/hal.h b/import/OpenXDK/include/xboxkrnl/hal.h index f2306ccfb..612bc7f54 100644 --- a/import/OpenXDK/include/xboxkrnl/hal.h +++ b/import/OpenXDK/include/xboxkrnl/hal.h @@ -32,14 +32,12 @@ XBSYSAPI VOID *HalGetInterruptVector; // ****************************************************************** // * HalReadSMBusValue // ****************************************************************** -XBSYSAPI EXPORTNUM(45) VOID NTAPI HalReadSMBusValue +XBSYSAPI EXPORTNUM(45) NTSTATUS NTAPI HalReadSMBusValue ( - ULONG BusNumber, - ULONG SlotNumber, - ULONG RegisterNumber, - PVOID Buffer, - ULONG Length, - BOOLEAN WritePCISpace + IN UCHAR Address, + IN UCHAR Command, + IN BOOLEAN WriteWord, + OUT PULONG DataValue ); // ****************************************************************** diff --git a/src/CxbxKrnl/EmuKrnl.cpp b/src/CxbxKrnl/EmuKrnl.cpp index 192f99b9f..fba671622 100644 --- a/src/CxbxKrnl/EmuKrnl.cpp +++ b/src/CxbxKrnl/EmuKrnl.cpp @@ -1553,6 +1553,40 @@ XBSYSAPI EXPORTNUM(37) xboxkrnl::LONG NTAPI xboxkrnl::FscSetCacheSize(ULONG uCac return 0; } +// ****************************************************************** +// * 0x002D - HalReadSMBusValue +// ****************************************************************** +XBSYSAPI EXPORTNUM(45) xboxkrnl::NTSTATUS NTAPI xboxkrnl::HalReadSMBusValue +( + IN UCHAR Address, + IN UCHAR Command, + IN BOOLEAN ReadWord, + OUT PULONG DataValue +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuKrnl (0x%X): HalReadSMBusValue\n" + "(\n" + " Address : 0x%.08X\n" + " Command : 0x%.08X\n" + " ReadWord : 0x%.08X\n" + " DataValue : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Address, Command, ReadWord, DataValue); + + if (ReadWord) { + // Write UCHAR + } else { + // Write BYTE + } + + EmuSwapFS(); // Xbox FS + + return STATUS_SUCCESS; +} + + // ****************************************************************** // * 0x0031 - HalReturnToFirmware // ****************************************************************** diff --git a/src/CxbxKrnl/KernelThunk.cpp b/src/CxbxKrnl/KernelThunk.cpp index 40f92efc6..f8d647973 100644 --- a/src/CxbxKrnl/KernelThunk.cpp +++ b/src/CxbxKrnl/KernelThunk.cpp @@ -102,7 +102,7 @@ extern "C" CXBXKRNL_API uint32 CxbxKrnl_KernelThunkTable[367] = (uint32)PANIC(0x002A), // 0x002A (42) (uint32)PANIC(0x002B), // 0x002B (43) (uint32)PANIC(0x002C), // 0x002C (44) - (uint32)PANIC(0x002D), // 0x002D (45) + (uint32)&xboxkrnl::HalReadSMBusValue, // 0x002D (45) (uint32)PANIC(0x002E), // 0x002E (46) (uint32)PANIC(0x002F), // 0x002F (47) (uint32)PANIC(0x0030), // 0x0030 (48)