This commit is contained in:
Aaron Robinson 2003-01-31 09:23:00 +00:00
parent 78162a75e4
commit 003f61c9c6
4 changed files with 34 additions and 32 deletions

View File

@ -2,15 +2,10 @@ Cxbx Todo:
General Code Cleanup [caustik]
- FS: structure construction (EmuXInit)
- Initialize necessary components of EmuXFS
- SwapFS before *all* Win32/NT calls.
Debug outputs should be configurable to STDOUT (console) or text file.
- Passing a ptr to CxbxKrnl is not enough (seperate process) pass the
full DebugFilename.
Use KeGetCurrentThread for fs:28h (May not be able to w/out kernel mode)
If not, fake it by constructing a fake KTHREAD possibly. In any event,
the current crashing method is an attempt to locate TLSData inside of a
KTHREAD object returned by fs:28h.
Exe->Xbe should use an "OpenXDK" logo bitmap by default. This can be done
by having a debug version of Cxbx output the necessary raw data. Then, you

View File

@ -76,21 +76,6 @@ CXBXKRNL_API void NTAPI EmuXDummy();
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXPanic();
// ******************************************************************
// * _EMUX_KPCR
// ******************************************************************
// *
// * Emulated Xbox KPCR. Includes special field(s) for emulation
// * purposes.
// *
// ******************************************************************
typedef struct _EMUX_KPCR
{
struct xboxkrnl::_KPCR Pcr;
uint16 OriginalFS; // 0x025C (our cached FS register from win2k/XP)
}
EMUX_KPCR, *PEMUX_KPCR;
#if defined(__cplusplus)
}
#endif

View File

@ -97,7 +97,7 @@ BEGIN
POPUP "&Patch", GRAYED
BEGIN
MENUITEM "&Allow >64 MB", ID_EDIT_PATCH_ALLOW64MB
MENUITEM "Debug Mode", ID_EDIT_PATCH_DEBUGMODE
MENUITEM "&Debug Mode", ID_EDIT_PATCH_DEBUGMODE
END
MENUITEM SEPARATOR
MENUITEM "Extract &Xbe Info...", ID_EDIT_EXTRACTXBEINFO
@ -112,7 +112,7 @@ BEGIN
MENUITEM "&File...", ID_VIEW_DEBUGOUTPUTGUI_FILE
END
POPUP "Debug Output (Kernel)"
POPUP "Debug Output (&Kernel)"
BEGIN
MENUITEM "&Console", ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE

View File

@ -84,13 +84,17 @@ inline void EmuXSwapFS()
// ******************************************************************
void EmuXGenerateFS()
{
uint16 OrgFS = 0;
NT_TIB *OrgNtTib;
xboxkrnl::KPCR *NewPcr;
uint32 dwSize = sizeof(EMUX_KPCR);
uint16 NewFS=0;
uint16 OrgFS=0;
uint32 pNewFS = (uint32)new char[dwSize];
uint32 dwSize = sizeof(xboxkrnl::KPCR);
uint16 NewFS = LDTAllocate(pNewFS, pNewFS + dwSize);
NewPcr = (xboxkrnl::KPCR*)new char[dwSize];
NewFS = LDTAllocate((uint32)NewPcr, (uint32)NewPcr + dwSize);
// ******************************************************************
// * Obtain "OrgFS"
@ -101,13 +105,31 @@ void EmuXGenerateFS()
mov OrgFS, ax
}
// ******************************************************************
// * Obtain "OrgNtTib"
// ******************************************************************
__asm
{
mov eax, fs:[0x18]
mov OrgNtTib, eax
}
// ******************************************************************
// * Save "NewFS" inside OrgFS.ArbitraryUserPointer
// ******************************************************************
__asm
{
mov ax, NewFS
mov fs:[0x14], ax // FS.ArbitraryUserPointer
mov fs:[0x14], ax // OrgFS.ArbitraryUserPointer
}
// ******************************************************************
// * Generate TIB
// ******************************************************************
{
memcpy(&NewPcr->NtTib, OrgNtTib, sizeof(NT_TIB));
NewPcr->NtTib.Self = &NewPcr->NtTib;
}
// ******************************************************************
@ -121,7 +143,7 @@ void EmuXGenerateFS()
__asm
{
mov ax, OrgFS
mov fs:[0x14], ax // FS.ArbitraryUserPointer
mov fs:[0x14], ax // NewFS.ArbitraryUserPointer
}
// ******************************************************************