Kernel
This commit is contained in:
parent
78162a75e4
commit
003f61c9c6
13
Doc/Todo.txt
13
Doc/Todo.txt
|
@ -2,15 +2,10 @@ Cxbx Todo:
|
||||||
|
|
||||||
General Code Cleanup [caustik]
|
General Code Cleanup [caustik]
|
||||||
|
|
||||||
- FS: structure construction (EmuXInit)
|
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,
|
||||||
- Initialize necessary components of EmuXFS
|
the current crashing method is an attempt to locate TLSData inside of a
|
||||||
- SwapFS before *all* Win32/NT calls.
|
KTHREAD object returned by fs:28h.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Exe->Xbe should use an "OpenXDK" logo bitmap by default. This can be done
|
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
|
by having a debug version of Cxbx output the necessary raw data. Then, you
|
||||||
|
|
|
@ -76,21 +76,6 @@ CXBXKRNL_API void NTAPI EmuXDummy();
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
CXBXKRNL_API void NTAPI EmuXPanic();
|
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)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -97,7 +97,7 @@ BEGIN
|
||||||
POPUP "&Patch", GRAYED
|
POPUP "&Patch", GRAYED
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Allow >64 MB", ID_EDIT_PATCH_ALLOW64MB
|
MENUITEM "&Allow >64 MB", ID_EDIT_PATCH_ALLOW64MB
|
||||||
MENUITEM "Debug Mode", ID_EDIT_PATCH_DEBUGMODE
|
MENUITEM "&Debug Mode", ID_EDIT_PATCH_DEBUGMODE
|
||||||
END
|
END
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Extract &Xbe Info...", ID_EDIT_EXTRACTXBEINFO
|
MENUITEM "Extract &Xbe Info...", ID_EDIT_EXTRACTXBEINFO
|
||||||
|
@ -112,7 +112,7 @@ BEGIN
|
||||||
MENUITEM "&File...", ID_VIEW_DEBUGOUTPUTGUI_FILE
|
MENUITEM "&File...", ID_VIEW_DEBUGOUTPUTGUI_FILE
|
||||||
|
|
||||||
END
|
END
|
||||||
POPUP "Debug Output (Kernel)"
|
POPUP "Debug Output (&Kernel)"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Console", ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE
|
MENUITEM "&Console", ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE
|
||||||
|
|
||||||
|
|
|
@ -84,13 +84,17 @@ inline void EmuXSwapFS()
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
void EmuXGenerateFS()
|
void EmuXGenerateFS()
|
||||||
{
|
{
|
||||||
|
NT_TIB *OrgNtTib;
|
||||||
|
xboxkrnl::KPCR *NewPcr;
|
||||||
|
|
||||||
|
uint16 NewFS=0;
|
||||||
uint16 OrgFS=0;
|
uint16 OrgFS=0;
|
||||||
|
|
||||||
uint32 dwSize = sizeof(EMUX_KPCR);
|
uint32 dwSize = sizeof(xboxkrnl::KPCR);
|
||||||
|
|
||||||
uint32 pNewFS = (uint32)new char[dwSize];
|
NewPcr = (xboxkrnl::KPCR*)new char[dwSize];
|
||||||
|
|
||||||
uint16 NewFS = LDTAllocate(pNewFS, pNewFS + dwSize);
|
NewFS = LDTAllocate((uint32)NewPcr, (uint32)NewPcr + dwSize);
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * Obtain "OrgFS"
|
// * Obtain "OrgFS"
|
||||||
|
@ -101,13 +105,31 @@ void EmuXGenerateFS()
|
||||||
mov OrgFS, ax
|
mov OrgFS, ax
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Obtain "OrgNtTib"
|
||||||
|
// ******************************************************************
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov eax, fs:[0x18]
|
||||||
|
mov OrgNtTib, eax
|
||||||
|
}
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * Save "NewFS" inside OrgFS.ArbitraryUserPointer
|
// * Save "NewFS" inside OrgFS.ArbitraryUserPointer
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov ax, NewFS
|
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
|
__asm
|
||||||
{
|
{
|
||||||
mov ax, OrgFS
|
mov ax, OrgFS
|
||||||
mov fs:[0x14], ax // FS.ArbitraryUserPointer
|
mov fs:[0x14], ax // NewFS.ArbitraryUserPointer
|
||||||
}
|
}
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
|
Loading…
Reference in New Issue