add SEGABOOT_EP_XOR and update GetXbeType to use named value

This commit is contained in:
RadWolfie 2020-04-05 14:12:17 -05:00
parent d2f104f251
commit 0623d4f485
2 changed files with 6 additions and 2 deletions

View File

@ -32,6 +32,7 @@
#define KiB(x) ((x) * 1024 ) // = 0x00000400
#define MiB(x) ((x) * KiB(1024)) // = 0x00100000
// TODO: Convert the rest of defines to constexpr or const in AddressRanges.h file in master/develop branch.
#define USER_ADDRESS1_BASE 0x00010000
#define USER_ADDRESS1_SIZE (MiB(64) - KiB(64)) // = 0x03FF0000
#define USER_ADDRESS1_END (USER_ADDRESS1_BASE + USER_ADDRESS1_SIZE - 1) // 0x03FFFFFF
@ -41,6 +42,9 @@
#define USER_ADDRESS2_END (USER_ADDRESS2_BASE + USER_ADDRESS2_SIZE - 1) // 0x07FFFFFF
// Base addresses of various components
// Segaboot entry point xor address
inline const uint32_t SEGABOOT_EP_XOR = 0x40000000;
// Kernel Segment Zero
#define KSEG0_BASE 0x80000000
#define PHYSICAL_MAP_BASE 0x80000000

View File

@ -815,12 +815,12 @@ XbeType Xbe::GetXbeType()
{
// Detect if the XBE is for Chihiro (Untested!) :
// This is based on https://github.com/radare/radare2/blob/master/libr/bin/p/bin_xbe.c#L45
if ((m_Header.dwEntryAddr & 0xf0000000) == 0x40000000)
if ((m_Header.dwEntryAddr & XBOX_WRITE_COMBINED_BASE) == SEGABOOT_EP_XOR)
return XbeType::xtChihiro;
// Check for Debug XBE, using high bit of the kernel thunk address :
// (DO NOT test like https://github.com/radare/radare2/blob/master/libr/bin/p/bin_xbe.c#L49 !)
if ((m_Header.dwKernelImageThunkAddr & 0x80000000) > 0)
if ((m_Header.dwKernelImageThunkAddr & KSEG0_BASE) > 0)
return XbeType::xtDebug;
// Otherwise, the XBE is a Retail build :