Making sure shim calls are cdecl.

This commit is contained in:
Ben Vanik 2013-05-23 01:04:14 -07:00
parent 426fccdbb4
commit 4495637616
7 changed files with 34 additions and 31 deletions

View File

@ -22,7 +22,7 @@ using namespace xe::kernel::xam;
namespace {
void XGetAVPack_shim(
SHIM_CALL XGetAVPack_shim(
xe_ppc_state_t* ppc_state, XamState* state) {
// DWORD
// Not sure what the values are for this, but 6 is VGA.
@ -33,7 +33,7 @@ void XGetAVPack_shim(
}
void XGetGameRegion_shim(
SHIM_CALL XGetGameRegion_shim(
xe_ppc_state_t* ppc_state, XamState* state) {
XELOGD("XGetGameRegion()");
@ -41,7 +41,7 @@ void XGetGameRegion_shim(
}
void XGetLanguage_shim(
SHIM_CALL XGetLanguage_shim(
xe_ppc_state_t* ppc_state, XamState* state) {
XELOGD("XGetLanguage()");

View File

@ -21,7 +21,7 @@ using namespace xe::kernel::xboxkrnl;
namespace {
void HalReturnToFirmware_shim(
SHIM_CALL HalReturnToFirmware_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// void
// IN FIRMWARE_REENTRY Routine

View File

@ -21,7 +21,7 @@ using namespace xe::kernel::xboxkrnl;
namespace {
void NtAllocateVirtualMemory_shim(
SHIM_CALL NtAllocateVirtualMemory_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// NTSTATUS
// _Inout_ PVOID *BaseAddress,
@ -96,7 +96,7 @@ void NtAllocateVirtualMemory_shim(
SHIM_SET_RETURN(X_STATUS_SUCCESS);
}
void NtFreeVirtualMemory_shim(
SHIM_CALL NtFreeVirtualMemory_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// NTSTATUS
// _Inout_ PVOID *BaseAddress,

View File

@ -23,14 +23,14 @@ using namespace xe::kernel::xboxkrnl;
namespace {
// void ExGetXConfigSetting_shim(
// SHIM_CALL ExGetXConfigSetting_shim(
// xe_ppc_state_t* ppc_state, KernelState* state) {
// // ?
// SHIM_SET_RETURN(0);
// }
void XexCheckExecutablePrivilege_shim(
SHIM_CALL XexCheckExecutablePrivilege_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// BOOL
// DWORD Privilege
@ -62,7 +62,7 @@ void XexCheckExecutablePrivilege_shim(
}
void XexGetModuleHandle_shim(
SHIM_CALL XexGetModuleHandle_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// BOOL
// LPCSZ ModuleName
@ -90,12 +90,12 @@ void XexGetModuleHandle_shim(
}
// void XexGetModuleSection_shim(
// SHIM_CALL XexGetModuleSection_shim(
// xe_ppc_state_t* ppc_state, KernelState* state) {
// }
// void XexGetProcedureAddress_shim(
// SHIM_CALL XexGetProcedureAddress_shim(
// xe_ppc_state_t* ppc_state, KernelState* state) {
// }

View File

@ -24,7 +24,7 @@ namespace {
// http://msdn.microsoft.com/en-us/library/ff561778
void RtlCompareMemory_shim(
SHIM_CALL RtlCompareMemory_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// SIZE_T
// _In_ const VOID *Source1,
@ -57,7 +57,7 @@ void RtlCompareMemory_shim(
}
// http://msdn.microsoft.com/en-us/library/ff552123
void RtlCompareMemoryUlong_shim(
SHIM_CALL RtlCompareMemoryUlong_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// SIZE_T
// _In_ PVOID Source,
@ -97,7 +97,7 @@ void RtlCompareMemoryUlong_shim(
}
// http://msdn.microsoft.com/en-us/library/ff552263
void RtlFillMemoryUlong_shim(
SHIM_CALL RtlFillMemoryUlong_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// VOID
// _Out_ PVOID Destination,
@ -132,7 +132,7 @@ void RtlFillMemoryUlong_shim(
// http://msdn.microsoft.com/en-us/library/ff561918
void RtlInitAnsiString_shim(
SHIM_CALL RtlInitAnsiString_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// VOID
// _Out_ PANSI_STRING DestinationString,
@ -153,7 +153,7 @@ void RtlInitAnsiString_shim(
// http://msdn.microsoft.com/en-us/library/ff561899
void RtlFreeAnsiString_shim(
SHIM_CALL RtlFreeAnsiString_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// VOID
// _Inout_ PANSI_STRING AnsiString
@ -180,7 +180,7 @@ void RtlFreeAnsiString_shim(
// http://msdn.microsoft.com/en-us/library/ff561934
void RtlInitUnicodeString_shim(
SHIM_CALL RtlInitUnicodeString_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// VOID
// _Out_ PUNICODE_STRING DestinationString,
@ -202,7 +202,7 @@ void RtlInitUnicodeString_shim(
// http://msdn.microsoft.com/en-us/library/ff561903
void RtlFreeUnicodeString_shim(
SHIM_CALL RtlFreeUnicodeString_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// VOID
// _Inout_ PUNICODE_STRING UnicodeString
@ -222,7 +222,7 @@ void RtlFreeUnicodeString_shim(
// http://msdn.microsoft.com/en-us/library/ff562969
void RtlUnicodeStringToAnsiString_shim(
SHIM_CALL RtlUnicodeStringToAnsiString_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// NTSTATUS
// _Inout_ PANSI_STRING DestinationString,
@ -250,7 +250,7 @@ void RtlUnicodeStringToAnsiString_shim(
}
void RtlImageXexHeaderField_shim(
SHIM_CALL RtlImageXexHeaderField_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// PVOID
// PVOID XexHeaderBase
@ -340,7 +340,7 @@ typedef struct {
}
void RtlInitializeCriticalSection_shim(
SHIM_CALL RtlInitializeCriticalSection_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// VOID
// _Out_ LPCRITICAL_SECTION lpCriticalSection
@ -357,7 +357,7 @@ void RtlInitializeCriticalSection_shim(
}
void RtlInitializeCriticalSectionAndSpinCount_shim(
SHIM_CALL RtlInitializeCriticalSectionAndSpinCount_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// NTSTATUS
// _Out_ LPCRITICAL_SECTION lpCriticalSection,
@ -382,7 +382,7 @@ void RtlInitializeCriticalSectionAndSpinCount_shim(
}
void RtlEnterCriticalSection_shim(
SHIM_CALL RtlEnterCriticalSection_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// VOID
// _Inout_ LPCRITICAL_SECTION lpCriticalSection
@ -421,7 +421,7 @@ spin:
}
void RtlTryEnterCriticalSection_shim(
SHIM_CALL RtlTryEnterCriticalSection_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// DWORD
// _Inout_ LPCRITICAL_SECTION lpCriticalSection
@ -452,7 +452,7 @@ void RtlTryEnterCriticalSection_shim(
}
void RtlLeaveCriticalSection_shim(
SHIM_CALL RtlLeaveCriticalSection_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// VOID
// _Inout_ LPCRITICAL_SECTION lpCriticalSection

View File

@ -55,7 +55,7 @@ namespace {
// }
void ExCreateThread_shim(
SHIM_CALL ExCreateThread_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// DWORD
// LPHANDLE Handle,
@ -107,7 +107,7 @@ void ExCreateThread_shim(
}
void KeGetCurrentProcessType_shim(
SHIM_CALL KeGetCurrentProcessType_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// DWORD
@ -125,7 +125,7 @@ void KeGetCurrentProcessType_shim(
// http://msdn.microsoft.com/en-us/library/ms686801
void KeTlsAlloc_shim(
SHIM_CALL KeTlsAlloc_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// DWORD
@ -150,7 +150,7 @@ void KeTlsAlloc_shim(
// http://msdn.microsoft.com/en-us/library/ms686804
void KeTlsFree_shim(
SHIM_CALL KeTlsFree_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// BOOL
// _In_ DWORD dwTlsIndex
@ -179,7 +179,7 @@ void KeTlsFree_shim(
// http://msdn.microsoft.com/en-us/library/ms686812
void KeTlsGetValue_shim(
SHIM_CALL KeTlsGetValue_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// LPVOID
// _In_ DWORD dwTlsIndex
@ -208,7 +208,7 @@ void KeTlsGetValue_shim(
// http://msdn.microsoft.com/en-us/library/ms686818
void KeTlsSetValue_shim(
SHIM_CALL KeTlsSetValue_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
// BOOL
// _In_ DWORD dwTlsIndex,

View File

@ -22,6 +22,8 @@ namespace xe {
namespace kernel {
#define SHIM_CALL void _cdecl
#define SHIM_MEM_ADDR(a) (ppc_state->membase + a)
#define SHIM_MEM_16(a) (uint16_t)XEGETUINT16BE(SHIM_MEM_ADDR(a));
@ -38,6 +40,7 @@ namespace kernel {
#define SHIM_GET_ARG_64(n) SHIM_GPR_64(3 + n)
#define SHIM_SET_RETURN(v) SHIM_SET_GPR_64(3, v)
} // namespace kernel
} // namespace xe