*** empty log message ***

This commit is contained in:
Aaron Robinson 2003-04-25 16:55:24 +00:00
parent 8bec072d1d
commit a40fbad03f
6 changed files with 50 additions and 28 deletions

View File

@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="Cxbx" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 60000
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101

View File

@ -66,7 +66,7 @@ typedef signed long sint32;
// ******************************************************************
// * Define this to trace intercepted function calls
// ******************************************************************
//#define _DEBUG_TRACE
#define _DEBUG_TRACE
// ******************************************************************
// * Round up dwValue to nearest multiple of dwMult

View File

@ -452,13 +452,29 @@ void EmuInstallWrappers(OOVPATable *OovpaTable, uint32 OovpaTableSize, void (*En
// ******************************************************************
// * func: EmuException
// ******************************************************************
// ******************************************************************
int EmuException(LPEXCEPTION_POINTERS e)
{
int ret = MessageBox(NULL, "ERROR: Recieved Exception.\n\nPress 'OK' to terminate emulation.\nPress 'Cancel' to debug.", "Cxbx", MB_ICONSTOP | MB_OKCANCEL);
if(ret == IDOK)
ExitProcess(1);
// ******************************************************************
// * Debugging Information
// ******************************************************************
{
printf("\n");
printf("Recieved Exception : 0x%.08X\n", e->ExceptionRecord->ExceptionCode);
printf("\n");
}
// ******************************************************************
// * Notify User
// ******************************************************************
{
char buffer[256];
sprintf(buffer, "Recieved Exception [0x%.08X]\n\nPress 'OK' to terminate emulation.\nPress 'Cancel' to debug.", e->ExceptionRecord->ExceptionCode);
if(MessageBox(NULL, buffer, "Cxbx", MB_ICONSTOP | MB_OKCANCEL) == IDOK)
ExitProcess(1);
}
return EXCEPTION_CONTINUE_SEARCH;
}

View File

@ -48,9 +48,6 @@ namespace xboxkrnl
#undef FIELD_OFFSET // prevent macro redefinition warnings
#include <windows.h>
static uint16 g_NewFS = -1;
static uint16 g_OrgFS = -1;
// ******************************************************************
// * func: EmuInitFS
// ******************************************************************
@ -67,6 +64,8 @@ void EmuGenerateFS(int TlsAdjust)
NT_TIB *OrgNtTib;
xboxkrnl::KPCR *NewPcr;
uint16 NewFS = -1, OrgFS = -1;
void *TLSPtr = 0;
// ******************************************************************
@ -79,7 +78,7 @@ void EmuGenerateFS(int TlsAdjust)
memset(NewPcr, 0, sizeof(*NewPcr));
g_NewFS = EmuAllocateLDT((uint32)NewPcr, (uint32)NewPcr + dwSize);
NewFS = EmuAllocateLDT((uint32)NewPcr, (uint32)NewPcr + dwSize);
}
// ******************************************************************
@ -89,15 +88,19 @@ void EmuGenerateFS(int TlsAdjust)
{
// Obtain "OrgFS"
mov ax, fs
mov g_OrgFS, ax
mov OrgFS, ax
// Obtain "OrgNtTib"
mov eax, fs:[0x18]
mov OrgNtTib, eax
// Save "NewFS" inside OrgFS.ArbitraryUserPointer
mov ax, g_NewFS
mov fs:[0x14], ax
// Save "NewFS" inside OrgFS.ArbitraryUserPointer.SwapFS
mov ax, NewFS
mov fs:[0x14], ax
// Save "True" inside OrgFS.ArbitraryUserPointer.isOrgFS
mov ah, 1
mov fs:[0x16], ah
}
// ******************************************************************
@ -144,8 +147,11 @@ void EmuGenerateFS(int TlsAdjust)
// ******************************************************************
__asm
{
mov ax, g_OrgFS
mov ax, OrgFS
mov fs:[0x14], ax // NewFS.ArbitraryUserPointer
mov ah, 0
mov fs:[0x16], ah // NewFS.ArbitraryUserPointer.isOrgFS
}
// ******************************************************************
@ -168,13 +174,13 @@ void EmuGenerateFS(int TlsAdjust)
// ******************************************************************
bool EmuIsXboxFS()
{
uint16 chk = 0;
bool chk = 0;
__asm
{
mov ax, fs:[0x04]
mov chk, ax
}
return (g_NewFS == chk);
mov ah, fs:[0x16]
mov chk, ah
}
return chk;
}

View File

@ -124,7 +124,7 @@ static DWORD WINAPI PCSTProxy
__try
{
__asm
{
{
mov esi, StartRoutine
push StartContext2
push StartContext1
@ -779,7 +779,7 @@ XBSYSAPI EXPORTNUM(255) NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadEx
iPCSTProxyParam->StartContext2 = StartContext2;
iPCSTProxyParam->StartRoutine = StartRoutine;
*ThreadHandle = CreateThread(NULL, NULL, &PCSTProxy, iPCSTProxyParam, NULL, &dwThreadId);
*ThreadHandle = CreateThread(NULL, NULL, &PCSTProxy, iPCSTProxyParam, CreateSuspended ? CREATE_SUSPENDED : NULL, &dwThreadId);
if(ThreadId != NULL)
*ThreadId = dwThreadId;

View File

@ -52,8 +52,8 @@ void Mutex::Lock()
while(true)
{
// Grab the lock, letting us look at the variables
// while(InterlockedCompareExchange((LPVOID*)&m_MutexLock, (LPVOID)1, (LPVOID)0))
while(InterlockedCompareExchange((LPLONG)&m_MutexLock, (LONG)1, (LONG)0))
while(InterlockedCompareExchange((LPVOID*)&m_MutexLock, (LPVOID)1, (LPVOID)0))
// while(InterlockedCompareExchange((LPLONG)&m_MutexLock, (LONG)1, (LONG)0))
Sleep(1);
// Are we the the new owner?
@ -99,8 +99,8 @@ void Mutex::Lock()
void Mutex::Unlock()
{
// Grab the lock, letting us look at the variables
// while(InterlockedCompareExchange((LPVOID*)&m_MutexLock, (LPVOID)1, (LPVOID)0))
while (InterlockedCompareExchange((LPLONG)&m_MutexLock, (LONG)1, (LONG)0))
while(InterlockedCompareExchange((LPVOID*)&m_MutexLock, (LPVOID)1, (LPVOID)0))
// while (InterlockedCompareExchange((LPLONG)&m_MutexLock, (LONG)1, (LONG)0))
Sleep(1);
// Decrement the lock count