Massive dump of xenia-info required code.

This is a working xenia-info for xex files (no gdfs files yet).
This commit is contained in:
Ben Vanik 2013-01-12 23:25:41 -08:00
parent 986d63e412
commit bcd575f9b0
66 changed files with 6859 additions and 304 deletions

View File

@ -21,6 +21,15 @@
'include/', 'include/',
], ],
'defines': [
'__STDC_LIMIT_MACROS=1',
'__STDC_CONSTANT_MACROS=1',
'_ISOC99_SOURCE=1',
],
'cflags': [
'-std=c99',
],
'configurations': { 'configurations': {
'debug': { 'debug': {
'defines': [ 'defines': [

72
include/xenia/assert.h Normal file
View File

@ -0,0 +1,72 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_ASSERT_H_
#define XENIA_ASSERT_H_
#include <assert.h>
#include <xenia/assert.h>
#include <xenia/config.h>
#include <xenia/platform.h>
#include <xenia/platform_includes.h>
#include <xenia/types.h>
#if XE_COMPILER(MSVC)
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
#if !defined(__WFILE__)
#define WIDEN2(x) L##x
#define WIDEN(x) WIDEN2(x)
#define __WFILE__ WIDEN(__FILE__)
#define __WFUNCTION__ WIDEN(__FUNCTION__)
#endif
#define XE_CURRENT_FILE __WFILE__
#define XE_CURRENT_FUNCTION __WFUNCTION__
#else
#define XE_CURRENT_FILE __FILE__
#define XE_CURRENT_FUNCTION __FUNCTION__
#endif // MSVC
#define XE_CURRENT_LINE __LINE__
#define __XE_ASSERT(expr) assert(expr)
#if XE_OPTION(ENABLE_ASSERTS)
#define XEASSERTCORE(expr) __XE_ASSERT(expr)
#else
#define XEASSERTCORE(expr) XE_EMPTY_MACRO
#endif // ENABLE_ASSERTS
#define XEASSERTALWAYS() XEASSERTCORE( 0 )
#define XEASSERT(expr) XEASSERTCORE( (expr) )
#define XEASSERTTRUE(expr) XEASSERTCORE( (expr) )
#define XEASSERTFALSE(expr) XEASSERTCORE(!(expr) )
#define XEASSERTZERO(expr) XEASSERTCORE( (expr) == 0 )
#define XEASSERTNOTZERO(expr) XEASSERTCORE( (expr) != 0 )
#define XEASSERTNULL(expr) XEASSERTCORE( (expr) == NULL )
#define XEASSERTNOTNULL(expr) XEASSERTCORE( (expr) != NULL )
#if XE_COMPILER(MSVC)
// http://msdn.microsoft.com/en-us/library/bb918086.aspx
// TODO(benvanik): if 2010+, use static_assert?
// http://msdn.microsoft.com/en-us/library/dd293588.aspx
#define XESTATICASSERT(expr, message) _STATIC_ASSERT(expr)
//#elif XE_COMPILER(GNUC)
// http://stackoverflow.com/questions/3385515/static-assert-in-c
//#define XESTATICASSERT(expr, message) ({ extern int __attribute__((error("assertion failure: '" #expr "' not true - " #message))) compile_time_check(); ((expr)?0:compile_time_check()),0; })
#else
// http://stackoverflow.com/questions/3385515/static-assert-in-c
#define XESTATICASSERT3(expr, L) typedef char static_assertion_##L[(expr)?1:-1]
#define XESTATICASSERT2(expr, L) XESTATICASSERT3(expr, L)
#define XESTATICASSERT(expr, message) XESTATICASSERT2(expr, __LINE__)
#endif // MSVC
#endif // XENIA_ASSERT_H_

81
include/xenia/atomic.h Normal file
View File

@ -0,0 +1,81 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_ATOMIC_H_
#define XENIA_ATOMIC_H_
#include <xenia/platform.h>
#include <xenia/platform_includes.h>
// These functions are modeled off of the Apple OSAtomic routines
// http://developer.apple.com/library/mac/#documentation/DriversKernelHardware/Reference/libkern_ref/OSAtomic_h/
#if XE_LIKE(OSX)
#include <libkern/OSAtomic.h>
#define xe_atomic_inc_32(value) \
OSAtomicIncrement32Barrier(value)
#define xe_atomic_dec_32(value) \
OSAtomicDecrement32Barrier(value)
#define xe_atomic_add_32(amount, value) \
((void)OSAtomicAdd32Barrier(amount, value))
#define xe_atomic_sub_32(amount, value) \
((void)OSAtomicAdd32Barrier(-amount, value))
#define xe_atomic_cas_32(oldValue, newValue, value) \
OSAtomicCompareAndSwap32Barrier(oldValue, newValue, value)
typedef OSQueueHead xe_atomic_stack_t;
#define xe_atomic_stack_init(stack) \
*(stack) = (OSQueueHead)OS_ATOMIC_QUEUE_INIT
#define xe_atomic_stack_enqueue(stack, item, offset) \
OSAtomicEnqueue((OSQueueHead*)stack, item, offset)
#define xe_atomic_stack_dequeue(stack, offset) \
OSAtomicDequeue((OSQueueHead*)stack, offset)
#elif XE_LIKE(WIN32)
#define xe_atomic_inc_32(value) \
InterlockedIncrement((volatile LONG*)value)
#define xe_atomic_dec_32(value) \
InterlockedDecrement((volatile LONG*)value)
#define xe_atomic_add_32(amount, value) \
((void)InterlockedExchangeAdd((volatile LONG*)value, amount))
#define xe_atomic_sub_32(amount, value) \
((void)InterlockedExchangeSubtract((volatile unsigned*)value, amount))
#define xe_atomic_vas_32(oldValue, newValue, value) \
(InterlockedCompareExchange((volatile LONG*)value, newValue, oldValue) == oldValue)
typedef SLIST_HEADER xe_atomic_stack_t;
#define xe_atomic_stack_init(stack) \
InitializeSListHead((PSLIST_HEADER)stack)
#define xe_atomic_stack_enqueue(stack, item, offset) \
XEIGNORE(InterlockedPushEntrySList((PSLIST_HEADER)stack, (PSLIST_ENTRY)((byte*)item + offset)))
XEFORCEINLINE void* xe_atomic_stack_dequeue(xe_atomic_stack_t* stack,
const size_t offset) {
void* ptr = (void*)InterlockedPopEntrySList((PSLIST_HEADER)stack);
if (ptr) {
return (void*)(((byte*)ptr) - offset);
} else {
return NULL;
}
}
#elif XE_LIKE(POSIX)
#error TODO(benvanik): POSIX atomic primitives
#else
#error No atomic primitives defined for this platform/cpu combination.
#endif // OSX
#endif // XENIA_ATOMIC_H_

View File

@ -0,0 +1,68 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_BYTE_ORDER_H_
#define XENIA_BYTE_ORDER_H_
#include <xenia/platform.h>
#include <xenia/types.h>
#if XE_COMPILER(MSVC)
#define XESWAP16 _byteswap_ushort
#define XESWAP32 _byteswap_ulong
#define XESWAP64 _byteswap_uint64
#elif XE_LIKE(OSX)
#include <libkern/OSByteOrder.h>
#define XESWAP16 OSSwapInt16
#define XESWAP32 OSSwapInt32
#define XESWAP64 OSSwapInt64
#else
#define XESWAP16 bswap_16
#define XESWAP32 bswap_32
#define XESWAP64 bswap_64
#endif
#if XE_CPU(BIGENDIAN)
#define XESWAP16BE(p) (p)
#define XESWAP32BE(p) (p)
#define XESWAP64BE(p) (p)
#define XESWAP16LE(p) XESWAP16(p)
#define XESWAP32LE(p) XESWAP32(p)
#define XESWAP64LE(p) XESWAP64(p)
#else
#define XESWAP16BE(p) XESWAP16(p)
#define XESWAP32BE(p) XESWAP32(p)
#define XESWAP64BE(p) XESWAP64(p)
#define XESWAP16LE(p) (p)
#define XESWAP32LE(p) (p)
#define XESWAP64LE(p) (p)
#endif
#define XEGETINT8BE(p) ( (int8_t)(*(p)))
#define XEGETUINT8BE(p) ( (uint8_t)(*(p)))
#define XEGETINT16BE(p) ( (int16_t)XESWAP16BE(*(uint16_t*)(p)))
#define XEGETUINT16BE(p) ((uint16_t)XESWAP16BE(*(uint16_t*)(p)))
#define XEGETINT32BE(p) ( (int32_t)XESWAP32BE(*(uint32_t*)(p)))
#define XEGETUINT32BE(p) ((uint32_t)XESWAP32BE(*(uint32_t*)(p)))
#define XEGETINT64BE(p) ( (int64_t)XESWAP64BE(*(uint64_t*)(p)))
#define XEGETUINT64BE(p) ((uint64_t)XESWAP64BE(*(uint64_t*)(p)))
#define XEGETINT8LE(p) ( (int8_t)(*(p)))
#define XEGETUINT8LE(p) ( (uint8_t)(*(p)))
#define XEGETINT16LE(p) ( (int16_t)XESWAP16LE(*(uint16_t*)(p)))
#define XEGETUINT16LE(p) ((uint16_t)XESWAP16LE(*(uint16_t*)(p)))
#define XEGETINT32LE(p) ( (int32_t)XESWAP32LE(*(uint32_t*)(p)))
#define XEGETUINT32LE(p) ((uint32_t)XESWAP32LE(*(uint32_t*)(p)))
#define XEGETINT64LE(p) ( (int64_t)XESWAP64LE(*(uint64_t*)(p)))
#define XEGETUINT64LE(p) ((uint64_t)XESWAP64LE(*(uint64_t*)(p)))
#endif // XENIA_BYTE_ORDER_H_

24
include/xenia/common.h Normal file
View File

@ -0,0 +1,24 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_COMMON_H_
#define XENIA_COMMON_H_
#include <xenia/assert.h>
#include <xenia/atomic.h>
#include <xenia/byte_order.h>
#include <xenia/config.h>
#include <xenia/logging.h>
#include <xenia/malloc.h>
#include <xenia/platform.h>
#include <xenia/platform_includes.h>
#include <xenia/string.h>
#include <xenia/types.h>
#endif // XENIA_COMMON_H_

31
include/xenia/config.h Normal file
View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CONFIG_H_
#define XENIA_CONFIG_H_
#define XE_OPTION(NAME) (defined XE_OPTION_##NAME && XE_OPTION_##NAME)
// Enable compile-time and runtime-time assertions.
#define XE_OPTION_ENABLE_ASSERTS 1
// Enable general logging.
#define XE_OPTION_ENABLE_LOGGING 1
#define XE_OPTION_LOG_ERROR 1
#define XE_OPTION_LOG_WARNING 1
#define XE_OPTION_LOG_INFO 1
#define XE_OPTION_LOG_DEBUG 1
#define XE_OPTION_LOG_CPU 1
#define XE_OPTION_LOG_GPU 1
#define XE_OPTION_LOG_KERNEL 1
#endif // XENIA_CONFIG_H_

21
include/xenia/core.h Normal file
View File

@ -0,0 +1,21 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CORE_H_
#define XENIA_CORE_H_
#include <xenia/common.h>
#include <xenia/core/file.h>
#include <xenia/core/memory.h>
#include <xenia/core/mmap.h>
#include <xenia/core/pal.h>
#include <xenia/core/ref.h>
#endif // XENIA_CORE_H_

37
include/xenia/core/file.h Normal file
View File

@ -0,0 +1,37 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CORE_FILE_H_
#define XENIA_CORE_FILE_H_
#include <xenia/common.h>
#include <xenia/core/pal.h>
#include <xenia/core/ref.h>
struct xe_file;
typedef struct xe_file* xe_file_ref;
typedef enum {
kXEFileModeRead = (1 << 0),
kXEFileModeWrite = (1 << 1),
} xe_file_mode;
xe_file_ref xe_file_open(xe_pal_ref pal, const xe_file_mode mode,
const xechar_t *path);
xe_file_ref xe_file_retain(xe_file_ref file);
void xe_file_release(xe_file_ref file);
size_t xe_file_get_length(xe_file_ref file);
size_t xe_file_read(xe_file_ref file, const size_t offset,
uint8_t *buffer, const size_t buffer_size);
#endif // XENIA_CORE_FILE_H_

View File

@ -0,0 +1,35 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CORE_MEMORY_H_
#define XENIA_CORE_MEMORY_H_
#include <xenia/common.h>
#include <xenia/core/pal.h>
#include <xenia/core/ref.h>
typedef struct {
int reserved;
} xe_memory_options_t;
struct xe_memory;
typedef struct xe_memory* xe_memory_ref;
xe_memory_ref xe_memory_create(xe_pal_ref pal, xe_memory_options_t options);
xe_memory_ref xe_memory_retain(xe_memory_ref memory);
void xe_memory_release(xe_memory_ref memory);
size_t xe_memory_get_length(xe_memory_ref memory);
void *xe_memory_addr(xe_memory_ref memory, uint32_t guest_addr);
#endif // XENIA_CORE_MEMORY_H_

32
include/xenia/core/mmap.h Normal file
View File

@ -0,0 +1,32 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CORE_MMAP_H_
#define XENIA_CORE_MMAP_H_
#include <xenia/common.h>
#include <xenia/core/file.h>
#include <xenia/core/pal.h>
#include <xenia/core/ref.h>
struct xe_mmap;
typedef struct xe_mmap* xe_mmap_ref;
xe_mmap_ref xe_mmap_open(xe_pal_ref pal, const xe_file_mode mode,
const xechar_t *path,
const size_t offset, const size_t length);
xe_mmap_ref xe_mmap_retain(xe_mmap_ref mmap);
void xe_mmap_release(xe_mmap_ref mmap);
void *xe_mmap_get_addr(xe_mmap_ref mmap);
size_t xe_mmap_get_length(xe_mmap_ref mmap);
#endif // XENIA_CORE_MMAP_H_

31
include/xenia/core/pal.h Normal file
View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CORE_PAL_H_
#define XENIA_CORE_PAL_H_
#include <xenia/common.h>
#include <xenia/core/ref.h>
typedef struct {
int reserved;
} xe_pal_options_t;
struct xe_pal;
typedef struct xe_pal* xe_pal_ref;
xe_pal_ref xe_pal_create(xe_pal_options_t options);
xe_pal_ref xe_pal_retain(xe_pal_ref pal);
void xe_pal_release(xe_pal_ref pal);
#endif // XENIA_CORE_PAL_H_

29
include/xenia/core/ref.h Normal file
View File

@ -0,0 +1,29 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CORE_REF_H_
#define XENIA_CORE_REF_H_
#include <xenia/common.h>
typedef struct {
volatile int32_t count;
} xe_ref_t;
typedef xe_ref_t* xe_ref;
typedef void (*xe_ref_dealloc_t)(xe_ref);
void xe_ref_init(xe_ref ref);
void xe_ref_retain(xe_ref ref);
void xe_ref_release(xe_ref ref, xe_ref_dealloc_t dealloc);
#endif // XENIA_CORE_REF_H_

18
include/xenia/cpu.h Normal file
View File

@ -0,0 +1,18 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CPU_H_
#define XENIA_CPU_H_
#include <xenia/common.h>
#include <xenia/core.h>
void do_cpu_stuff();
#endif // XENIA_CPU_H_

18
include/xenia/gpu.h Normal file
View File

@ -0,0 +1,18 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_H_
#define XENIA_GPU_H_
#include <xenia/common.h>
#include <xenia/core.h>
void do_gpu_stuff();
#endif // XENIA_GPU_H_

49
include/xenia/kernel.h Normal file
View File

@ -0,0 +1,49 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_H_
#define XENIA_KERNEL_H_
#include <xenia/common.h>
#include <xenia/core.h>
#include <xenia/kernel/export.h>
#include <xenia/kernel/module.h>
#include <xenia/kernel/xex2.h>
typedef struct {
xechar_t command_line[2048];
} xe_kernel_options_t;
struct xe_kernel;
typedef struct xe_kernel* xe_kernel_ref;
xe_kernel_ref xe_kernel_create(xe_pal_ref pal, xe_memory_ref memory,
xe_kernel_options_t options);
xe_kernel_ref xe_kernel_retain(xe_kernel_ref kernel);
void xe_kernel_release(xe_kernel_ref kernel);
xe_pal_ref xe_kernel_get_pal(xe_kernel_ref kernel);
xe_memory_ref xe_kernel_get_memory(xe_kernel_ref kernel);
const xechar_t *xe_kernel_get_command_line(xe_kernel_ref kernel);
xe_kernel_export_resolver_ref xe_kernel_get_export_resolver(
xe_kernel_ref kernel);
xe_module_ref xe_kernel_load_module(xe_kernel_ref kernel, const xechar_t *path);
void xe_kernel_launch_module(xe_kernel_ref kernel, xe_module_ref module);
xe_module_ref xe_kernel_get_module(xe_kernel_ref kernel, const xechar_t *path);
void xe_kernel_unload_module(xe_kernel_ref kernel, xe_module_ref module);
#endif // XENIA_KERNEL_H_

View File

@ -0,0 +1,76 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_EXPORT_H_
#define XENIA_KERNEL_EXPORT_H_
#include <xenia/core.h>
typedef enum {
kXEKernelExportFlagFunction = 1 << 0,
kXEKernelExportFlagVariable = 1 << 1,
} xe_kernel_export_flags;
typedef void (*xe_kernel_export_fn)();
typedef struct {
uint32_t ordinal;
uint32_t flags;
char signature[16];
char name[96];
union {
// Variable data. Only valid when kXEKernelExportFlagVariable is set.
void *variable_data;
struct {
// Real function implementation (if present).
xe_kernel_export_fn impl;
// Shimmed implementation (call if param structs are big endian).
// This may be NULL if no shim is needed or present.
xe_kernel_export_fn shim;
} function_data;
};
} xe_kernel_export_t;
#define XE_DECLARE_EXPORT(module, ordinal, name, signature, flags) \
{ \
ordinal, \
flags, \
#signature, \
#name, \
}
bool xe_kernel_export_is_implemented(const xe_kernel_export_t *kernel_export);
struct xe_kernel_export_resolver;
typedef struct xe_kernel_export_resolver* xe_kernel_export_resolver_ref;
xe_kernel_export_resolver_ref xe_kernel_export_resolver_create();
xe_kernel_export_resolver_ref xe_kernel_export_resolver_retain(
xe_kernel_export_resolver_ref resolver);
void xe_kernel_export_resolver_release(xe_kernel_export_resolver_ref resolver);
void xe_kernel_export_resolver_register_table(
xe_kernel_export_resolver_ref resolver, const char *library_name,
xe_kernel_export_t *exports, const size_t count);
xe_kernel_export_t *xe_kernel_export_resolver_get_by_ordinal(
xe_kernel_export_resolver_ref resolver, const char *library_name,
const uint32_t ordinal);
xe_kernel_export_t *xe_kernel_export_resolver_get_by_name(
xe_kernel_export_resolver_ref resolver, const char *library_name,
const char *name);
#endif // XENIA_KERNEL_EXPORT_H_

View File

@ -0,0 +1,71 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_MODULE_H_
#define XENIA_KERNEL_MODULE_H_
#include <xenia/core.h>
#include <xenia/kernel/export.h>
#include <xenia/kernel/xex2.h>
typedef struct {
xechar_t path[2048];
xechar_t name[256];
} xe_module_options_t;
struct xe_module;
typedef struct xe_module* xe_module_ref;
#define kXEPESectionContainsCode 0x00000020
#define kXEPESectionContainsDataInit 0x00000040
#define kXEPESectionContainsDataUninit 0x00000080
#define kXEPESectionMemoryExecute 0x20000000
#define kXEPESectionMemoryRead 0x40000000
#define kXEPESectionMemoryWrite 0x80000000
typedef struct {
char name[9]; // 8 + 1 for \0
uint32_t raw_address;
size_t raw_size;
uint32_t address;
size_t size;
uint32_t flags; // kXEPESection*
} xe_module_pe_section_t;
typedef struct {
uint32_t address;
size_t total_length; // in bytes
size_t prolog_length; // in bytes
} xe_module_pe_method_info_t;
xe_module_ref xe_module_load(xe_memory_ref memory,
xe_kernel_export_resolver_ref export_resolver,
const void* addr, const size_t length,
xe_module_options_t options);
xe_module_ref xe_module_retain(xe_module_ref module);
void xe_module_release(xe_module_ref module);
uint32_t xe_module_get_handle(xe_module_ref module);
xe_xex2_ref xe_module_get_xex(xe_module_ref module);
const xe_xex2_header_t *xe_module_get_xex_header(xe_module_ref module);
void *xe_module_get_proc_address(xe_module_ref module, const uint32_t ordinal);
xe_module_pe_section_t *xe_module_get_section(xe_module_ref module,
const char *name);
int xe_module_get_method_hints(xe_module_ref module,
xe_module_pe_method_info_t **out_method_infos,
size_t *out_method_info_count);
void xe_module_dump(xe_module_ref module);
#endif // XENIA_KERNEL_MODULE_H_

View File

@ -0,0 +1,46 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_XEX2_H_
#define XENIA_KERNEL_XEX2_H_
#include <xenia/core.h>
#include <xenia/kernel/xex2_info.h>
typedef struct {
int reserved;
} xe_xex2_options_t;
struct xe_xex2;
typedef struct xe_xex2* xe_xex2_ref;
typedef struct {
uint32_t ordinal;
uint32_t value_address; // address to place value
uint32_t thunk_address; // NULL or address of thunk
} xe_xex2_import_info_t;
xe_xex2_ref xe_xex2_load(xe_memory_ref memory,
const void* addr, const size_t length,
xe_xex2_options_t options);
xe_xex2_ref xe_xex2_retain(xe_xex2_ref xex);
void xe_xex2_release(xe_xex2_ref xex);
const xechar_t *xe_xex2_get_name(xe_xex2_ref xex);
const xe_xex2_header_t *xe_xex2_get_header(xe_xex2_ref xex);
int xe_xex2_get_import_infos(xe_xex2_ref xex,
const xe_xex2_import_library_t *library,
xe_xex2_import_info_t **out_import_infos,
size_t *out_import_info_count);
#endif // XENIA_KERNEL_XEX2_H_

View File

@ -0,0 +1,459 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_XEX2_INFO_H_
#define XENIA_KERNEL_XEX2_INFO_H_
#include <xenia/common.h>
typedef enum {
XEX_HEADER_RESOURCE_INFO = 0x000002FF,
XEX_HEADER_FILE_FORMAT_INFO = 0x000003FF,
XEX_HEADER_DELTA_PATCH_DESCRIPTOR = 0x000005FF,
XEX_HEADER_BASE_REFERENCE = 0x00000405,
XEX_HEADER_BOUNDING_PATH = 0x000080FF,
XEX_HEADER_DEVICE_ID = 0x00008105,
XEX_HEADER_ORIGINAL_BASE_ADDRESS = 0x00010001,
XEX_HEADER_ENTRY_POINT = 0x00010100,
XEX_HEADER_IMAGE_BASE_ADDRESS = 0x00010201,
XEX_HEADER_IMPORT_LIBRARIES = 0x000103FF,
XEX_HEADER_CHECKSUM_TIMESTAMP = 0x00018002,
XEX_HEADER_ENABLED_FOR_CALLCAP = 0x00018102,
XEX_HEADER_ENABLED_FOR_FASTCAP = 0x00018200,
XEX_HEADER_ORIGINAL_PE_NAME = 0x000183FF,
XEX_HEADER_STATIC_LIBRARIES = 0x000200FF,
XEX_HEADER_TLS_INFO = 0x00020104,
XEX_HEADER_DEFAULT_STACK_SIZE = 0x00020200,
XEX_HEADER_DEFAULT_FILESYSTEM_CACHE_SIZE = 0x00020301,
XEX_HEADER_DEFAULT_HEAP_SIZE = 0x00020401,
XEX_HEADER_PAGE_HEAP_SIZE_AND_FLAGS = 0x00028002,
XEX_HEADER_SYSTEM_FLAGS = 0x00030000,
XEX_HEADER_EXECUTION_INFO = 0x00040006,
XEX_HEADER_TITLE_WORKSPACE_SIZE = 0x00040201,
XEX_HEADER_GAME_RATINGS = 0x00040310,
XEX_HEADER_LAN_KEY = 0x00040404,
XEX_HEADER_XBOX360_LOGO = 0x000405FF,
XEX_HEADER_MULTIDISC_MEDIA_IDS = 0x000406FF,
XEX_HEADER_ALTERNATE_TITLE_IDS = 0x000407FF,
XEX_HEADER_ADDITIONAL_TITLE_MEMORY = 0x00040801,
XEX_HEADER_EXPORTS_BY_NAME = 0x00E10402,
} xe_xex2_header_keys;
typedef enum {
XEX_MODULE_TITLE = 0x00000001,
XEX_MODULE_EXPORTS_TO_TITLE = 0x00000002,
XEX_MODULE_SYSTEM_DEBUGGER = 0x00000004,
XEX_MODULE_DLL_MODULE = 0x00000008,
XEX_MODULE_MODULE_PATCH = 0x00000010,
XEX_MODULE_PATCH_FULL = 0x00000020,
XEX_MODULE_PATCH_DELTA = 0x00000040,
XEX_MODULE_USER_MODE = 0x00000080,
} xe_xex2_module_flags;
typedef enum {
XEX_SYSTEM_NO_FORCED_REBOOT = 0x00000001,
XEX_SYSTEM_FOREGROUND_TASKS = 0x00000002,
XEX_SYSTEM_NO_ODD_MAPPING = 0x00000004,
XEX_SYSTEM_HANDLE_MCE_INPUT = 0x00000008,
XEX_SYSTEM_RESTRICTED_HUD_FEATURES = 0x00000010,
XEX_SYSTEM_HANDLE_GAMEPAD_DISCONNECT = 0x00000020,
XEX_SYSTEM_INSECURE_SOCKETS = 0x00000040,
XEX_SYSTEM_XBOX1_INTEROPERABILITY = 0x00000080,
XEX_SYSTEM_DASH_CONTEXT = 0x00000100,
XEX_SYSTEM_USES_GAME_VOICE_CHANNEL = 0x00000200,
XEX_SYSTEM_PAL50_INCOMPATIBLE = 0x00000400,
XEX_SYSTEM_INSECURE_UTILITY_DRIVE = 0x00000800,
XEX_SYSTEM_XAM_HOOKS = 0x00001000,
XEX_SYSTEM_ACCESS_PII = 0x00002000,
XEX_SYSTEM_CROSS_PLATFORM_SYSTEM_LINK = 0x00004000,
XEX_SYSTEM_MULTIDISC_SWAP = 0x00008000,
XEX_SYSTEM_MULTIDISC_INSECURE_MEDIA = 0x00010000,
XEX_SYSTEM_AP25_MEDIA = 0x00020000,
XEX_SYSTEM_NO_CONFIRM_EXIT = 0x00040000,
XEX_SYSTEM_ALLOW_BACKGROUND_DOWNLOAD = 0x00080000,
XEX_SYSTEM_CREATE_PERSISTABLE_RAMDRIVE = 0x00100000,
XEX_SYSTEM_INHERIT_PERSISTENT_RAMDRIVE = 0x00200000,
XEX_SYSTEM_ALLOW_HUD_VIBRATION = 0x00400000,
XEX_SYSTEM_ACCESS_UTILITY_PARTITIONS = 0x00800000,
XEX_SYSTEM_IPTV_INPUT_SUPPORTED = 0x01000000,
XEX_SYSTEM_PREFER_BIG_BUTTON_INPUT = 0x02000000,
XEX_SYSTEM_ALLOW_EXTENDED_SYSTEM_RESERVATION = 0x04000000,
XEX_SYSTEM_MULTIDISC_CROSS_TITLE = 0x08000000,
XEX_SYSTEM_INSTALL_INCOMPATIBLE = 0x10000000,
XEX_SYSTEM_ALLOW_AVATAR_GET_METADATA_BY_XUID = 0x20000000,
XEX_SYSTEM_ALLOW_CONTROLLER_SWAPPING = 0x40000000,
XEX_SYSTEM_DASH_EXTENSIBILITY_MODULE = 0x80000000,
// TODO: figure out how stored
/*XEX_SYSTEM_ALLOW_NETWORK_READ_CANCEL = 0x0,
XEX_SYSTEM_UNINTERRUPTABLE_READS = 0x0,
XEX_SYSTEM_REQUIRE_FULL_EXPERIENCE = 0x0,
XEX_SYSTEM_GAME_VOICE_REQUIRED_UI = 0x0,
XEX_SYSTEM_CAMERA_ANGLE = 0x0,
XEX_SYSTEM_SKELETAL_TRACKING_REQUIRED = 0x0,
XEX_SYSTEM_SKELETAL_TRACKING_SUPPORTED = 0x0,*/
} xe_xex2_system_flags;
// ESRB (Entertainment Software Rating Board)
typedef enum {
XEX_RATING_ESRB_eC = 0x00,
XEX_RATING_ESRB_E = 0x02,
XEX_RATING_ESRB_E10 = 0x04,
XEX_RATING_ESRB_T = 0x06,
XEX_RATING_ESRB_M = 0x08,
XEX_RATING_ESRB_AO = 0x0E,
XEX_RATING_ESRB_UNRATED = 0xFF,
} xe_xex2_rating_esrb_value;
// PEGI (Pan European Game Information)
typedef enum {
XEX_RATING_PEGI_3_PLUS = 0,
XEX_RATING_PEGI_7_PLUS = 4,
XEX_RATING_PEGI_12_PLUS = 9,
XEX_RATING_PEGI_16_PLUS = 13,
XEX_RATING_PEGI_18_PLUS = 14,
XEX_RATING_PEGI_UNRATED = 0xFF,
} xe_xex2_rating_pegi_value;
// PEGI (Pan European Game Information) - Finland
typedef enum {
XEX_RATING_PEGI_FI_3_PLUS = 0,
XEX_RATING_PEGI_FI_7_PLUS = 4,
XEX_RATING_PEGI_FI_11_PLUS = 8,
XEX_RATING_PEGI_FI_15_PLUS = 12,
XEX_RATING_PEGI_FI_18_PLUS = 14,
XEX_RATING_PEGI_FI_UNRATED = 0xFF,
} xe_xex2_rating_pegi_fi_value;
// PEGI (Pan European Game Information) - Portugal
typedef enum {
XEX_RATING_PEGI_PT_4_PLUS = 1,
XEX_RATING_PEGI_PT_6_PLUS = 3,
XEX_RATING_PEGI_PT_12_PLUS = 9,
XEX_RATING_PEGI_PT_16_PLUS = 13,
XEX_RATING_PEGI_PT_18_PLUS = 14,
XEX_RATING_PEGI_PT_UNRATED = 0xFF,
} xe_xex2_rating_pegi_pt_value;
// BBFC (British Board of Film Classification) - UK/Ireland
typedef enum {
XEX_RATING_BBFC_UNIVERSAL = 1,
XEX_RATING_BBFC_PG = 5,
XEX_RATING_BBFC_3_PLUS = 0,
XEX_RATING_BBFC_7_PLUS = 4,
XEX_RATING_BBFC_12_PLUS = 9,
XEX_RATING_BBFC_15_PLUS = 12,
XEX_RATING_BBFC_16_PLUS = 13,
XEX_RATING_BBFC_18_PLUS = 14,
XEX_RATING_BBFC_UNRATED = 0xFF,
} xe_xex2_rating_bbfc_value;
// CERO (Computer Entertainment Rating Organization)
typedef enum {
XEX_RATING_CERO_A = 0,
XEX_RATING_CERO_B = 2,
XEX_RATING_CERO_C = 4,
XEX_RATING_CERO_D = 6,
XEX_RATING_CERO_Z = 8,
XEX_RATING_CERO_UNRATED = 0xFF,
} xe_xex2_rating_cero_value;
// USK (Unterhaltungssoftware SelbstKontrolle)
typedef enum {
XEX_RATING_USK_ALL = 0,
XEX_RATING_USK_6_PLUS = 2,
XEX_RATING_USK_12_PLUS = 4,
XEX_RATING_USK_16_PLUS = 6,
XEX_RATING_USK_18_PLUS = 8,
XEX_RATING_USK_UNRATED = 0xFF,
} xe_xex2_rating_usk_value;
// OFLC (Office of Film and Literature Classification) - Australia
typedef enum {
XEX_RATING_OFLC_AU_G = 0,
XEX_RATING_OFLC_AU_PG = 2,
XEX_RATING_OFLC_AU_M = 4,
XEX_RATING_OFLC_AU_MA15_PLUS = 6,
XEX_RATING_OFLC_AU_UNRATED = 0xFF,
} xe_xex2_rating_oflc_au_value;
// OFLC (Office of Film and Literature Classification) - New Zealand
typedef enum {
XEX_RATING_OFLC_NZ_G = 0,
XEX_RATING_OFLC_NZ_PG = 2,
XEX_RATING_OFLC_NZ_M = 4,
XEX_RATING_OFLC_NZ_MA15_PLUS = 6,
XEX_RATING_OFLC_NZ_UNRATED = 0xFF,
} xe_xex2_rating_oflc_nz_value;
// KMRB (Korea Media Rating Board)
typedef enum {
XEX_RATING_KMRB_ALL = 0,
XEX_RATING_KMRB_12_PLUS = 2,
XEX_RATING_KMRB_15_PLUS = 4,
XEX_RATING_KMRB_18_PLUS = 6,
XEX_RATING_KMRB_UNRATED = 0xFF,
} xe_xex2_rating_kmrb_value;
// Brazil
typedef enum {
XEX_RATING_BRAZIL_ALL = 0,
XEX_RATING_BRAZIL_12_PLUS = 2,
XEX_RATING_BRAZIL_14_PLUS = 4,
XEX_RATING_BRAZIL_16_PLUS = 5,
XEX_RATING_BRAZIL_18_PLUS = 8,
XEX_RATING_BRAZIL_UNRATED = 0xFF,
} xe_xex2_rating_brazil_value;
// FPB (Film and Publication Board)
typedef enum {
XEX_RATING_FPB_ALL = 0,
XEX_RATING_FPB_PG = 6,
XEX_RATING_FPB_10_PLUS = 7,
XEX_RATING_FPB_13_PLUS = 10,
XEX_RATING_FPB_16_PLUS = 13,
XEX_RATING_FPB_18_PLUS = 14,
XEX_RATING_FPB_UNRATED = 0xFF,
} xe_xex2_rating_fpb_value;
typedef struct {
xe_xex2_rating_esrb_value esrb;
xe_xex2_rating_pegi_value pegi;
xe_xex2_rating_pegi_fi_value pegifi;
xe_xex2_rating_pegi_pt_value pegipt;
xe_xex2_rating_bbfc_value bbfc;
xe_xex2_rating_cero_value cero;
xe_xex2_rating_usk_value usk;
xe_xex2_rating_oflc_au_value oflcau;
xe_xex2_rating_oflc_nz_value oflcnz;
xe_xex2_rating_kmrb_value kmrb;
xe_xex2_rating_brazil_value brazil;
xe_xex2_rating_fpb_value fpb;
} xe_xex2_game_ratings_t;
typedef union {
uint32_t value;
struct {
uint32_t major : 4;
uint32_t minor : 4;
uint32_t build : 16;
uint32_t qfe : 8;
};
} xe_xex2_version_t;
typedef struct {
uint32_t key;
uint32_t length;
union {
uint32_t value;
uint32_t offset;
};
} xe_xex2_opt_header_t;
typedef struct {
char title_id[8];
uint32_t address;
uint32_t size;
} xe_xex2_resource_info_t;
typedef struct {
uint32_t media_id;
xe_xex2_version_t version;
xe_xex2_version_t base_version;
uint32_t title_id;
uint8_t platform;
uint8_t executable_table;
uint8_t disc_number;
uint8_t disc_count;
uint32_t savegame_id;
} xe_xex2_execution_info_t;
typedef struct {
uint32_t slot_count;
uint32_t raw_data_address;
uint32_t data_size;
uint32_t raw_data_size;
} xe_xex2_tls_info_t;
typedef struct {
char name[32];
uint8_t digest[20];
uint32_t import_id;
xe_xex2_version_t version;
xe_xex2_version_t min_version;
size_t record_count;
uint32_t *records;
} xe_xex2_import_library_t;
typedef enum {
XEX_APPROVAL_UNAPPROVED = 0,
XEX_APPROVAL_POSSIBLE = 1,
XEX_APPROVAL_APPROVED = 2,
XEX_APPROVAL_EXPIRED = 3,
} xe_xex2_approval_type;
typedef struct {
char name[9]; // 8 + 1 for \0
uint16_t major;
uint16_t minor;
uint16_t build;
uint16_t qfe;
xe_xex2_approval_type approval;
} xe_xex2_static_library_t;
typedef enum {
XEX_ENCRYPTION_NONE = 0,
XEX_ENCRYPTION_NORMAL = 1,
} xe_xex2_encryption_type;
typedef enum {
XEX_COMPRESSION_NONE = 0,
XEX_COMPRESSION_BASIC = 1,
XEX_COMPRESSION_NORMAL = 2,
XEX_COMPRESSION_DELTA = 3,
} xe_xex2_compression_type;
typedef struct {
uint32_t data_size;
uint32_t zero_size;
} xe_xex2_file_basic_compression_block_t;
typedef struct {
uint32_t block_count;
xe_xex2_file_basic_compression_block_t *blocks;
} xe_xex2_file_basic_compression_info_t;
typedef struct {
uint32_t window_size;
uint32_t window_bits;
uint32_t block_size;
uint8_t block_hash[20];
} xe_xex2_file_normal_compression_info_t;
typedef struct {
xe_xex2_encryption_type encryption_type;
xe_xex2_compression_type compression_type;
union {
xe_xex2_file_basic_compression_info_t basic;
xe_xex2_file_normal_compression_info_t normal;
} compression_info;
} xe_xex2_file_format_info_t;
typedef enum {
XEX_IMAGE_MANUFACTURING_UTILITY = 0x00000002,
XEX_IMAGE_MANUFACTURING_SUPPORT_TOOLS = 0x00000004,
XEX_IMAGE_XGD2_MEDIA_ONLY = 0x00000008,
XEX_IMAGE_CARDEA_KEY = 0x00000100,
XEX_IMAGE_XEIKA_KEY = 0x00000200,
XEX_IMAGE_USERMODE_TITLE = 0x00000400,
XEX_IMAGE_USERMODE_SYSTEM = 0x00000800,
XEX_IMAGE_ORANGE0 = 0x00001000,
XEX_IMAGE_ORANGE1 = 0x00002000,
XEX_IMAGE_ORANGE2 = 0x00004000,
XEX_IMAGE_IPTV_SIGNUP_APPLICATION = 0x00010000,
XEX_IMAGE_IPTV_TITLE_APPLICATION = 0x00020000,
XEX_IMAGE_KEYVAULT_PRIVILEGES_REQUIRED = 0x04000000,
XEX_IMAGE_ONLINE_ACTIVATION_REQUIRED = 0x08000000,
XEX_IMAGE_PAGE_SIZE_4KB = 0x10000000, // else 64KB
XEX_IMAGE_REGION_FREE = 0x20000000,
XEX_IMAGE_REVOCATION_CHECK_OPTIONAL = 0x40000000,
XEX_IMAGE_REVOCATION_CHECK_REQUIRED = 0x80000000,
} xe_xex2_image_flags;
typedef enum {
XEX_MEDIA_HARDDISK = 0x00000001,
XEX_MEDIA_DVD_X2 = 0x00000002,
XEX_MEDIA_DVD_CD = 0x00000004,
XEX_MEDIA_DVD_5 = 0x00000008,
XEX_MEDIA_DVD_9 = 0x00000010,
XEX_MEDIA_SYSTEM_FLASH = 0x00000020,
XEX_MEDIA_MEMORY_UNIT = 0x00000080,
XEX_MEDIA_USB_MASS_STORAGE_DEVICE = 0x00000100,
XEX_MEDIA_NETWORK = 0x00000200,
XEX_MEDIA_DIRECT_FROM_MEMORY = 0x00000400,
XEX_MEDIA_RAM_DRIVE = 0x00000800,
XEX_MEDIA_SVOD = 0x00001000,
XEX_MEDIA_INSECURE_PACKAGE = 0x01000000,
XEX_MEDIA_SAVEGAME_PACKAGE = 0x02000000,
XEX_MEDIA_LOCALLY_SIGNED_PACKAGE = 0x04000000,
XEX_MEDIA_LIVE_SIGNED_PACKAGE = 0x08000000,
XEX_MEDIA_XBOX_PACKAGE = 0x10000000,
} xe_xex2_media_flags;
typedef enum {
XEX_REGION_NTSCU = 0x000000FF,
XEX_REGION_NTSCJ = 0x0000FF00,
XEX_REGION_NTSCJ_JAPAN = 0x00000100,
XEX_REGION_NTSCJ_CHINA = 0x00000200,
XEX_REGION_PAL = 0x00FF0000,
XEX_REGION_PAL_AU_NZ = 0x00010000,
XEX_REGION_OTHER = 0xFF000000,
XEX_REGION_ALL = 0xFFFFFFFF,
} xe_xex2_region_flags;
typedef struct {
uint32_t header_size;
uint32_t image_size;
uint8_t rsa_signature[256];
uint32_t unklength;
xe_xex2_image_flags image_flags;
uint32_t load_address;
uint8_t section_digest[20];
uint32_t import_table_count;
uint8_t import_table_digest[20];
uint8_t media_id[16];
uint8_t file_key[16];
uint32_t export_table;
uint8_t header_digest[20];
xe_xex2_region_flags game_regions;
xe_xex2_media_flags media_flags;
} xe_xex2_loader_info_t;
typedef enum {
XEX_SECTION_CODE = 1,
XEX_SECTION_DATA = 2,
XEX_SECTION_READONLY_DATA = 3,
} xe_xex2_section_type;
typedef struct {
union {
struct {
xe_xex2_section_type type : 4;
uint32_t page_count : 28; // # of 64kb pages
};
uint32_t value; // To make uint8_t swapping easier
} info;
uint8_t digest[20];
} xe_xex2_section_t;
#define xe_xex2_section_length 0x00010000
typedef struct {
uint32_t xex2;
xe_xex2_module_flags module_flags;
uint32_t exe_offset;
uint32_t unknown0;
uint32_t certificate_offset;
xe_xex2_system_flags system_flags;
xe_xex2_resource_info_t resource_info;
xe_xex2_execution_info_t execution_info;
xe_xex2_game_ratings_t game_ratings;
xe_xex2_tls_info_t tls_info;
size_t import_library_count;
xe_xex2_import_library_t import_libraries[32];
size_t static_library_count;
xe_xex2_static_library_t static_libraries[32];
xe_xex2_file_format_info_t file_format_info;
xe_xex2_loader_info_t loader_info;
uint8_t session_key[16];
uint32_t exe_address;
uint32_t exe_entry_point;
uint32_t exe_stack_size;
uint32_t exe_heap_size;
size_t header_count;
xe_xex2_opt_header_t headers[64];
size_t section_count;
xe_xex2_section_t* sections;
} xe_xex2_header_t;
#endif // XENIA_KERNEL_XEX2_INFO_H_

72
include/xenia/logging.h Normal file
View File

@ -0,0 +1,72 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_LOGGING_H_
#define XENIA_LOGGING_H_
#include <xenia/config.h>
#include <xenia/string.h>
#if XE_COMPILER(GNUC)
#define XE_LOG_LINE_ATTRIBUTE __attribute__ ((format (printf, 5, 6)))
#else
#define XE_LOG_LINE_ATTRIBUTE
#endif // GNUC
void xe_log_line(const xechar_t* file_path, const uint32_t line_number,
const xechar_t* function_name, const xechar_t level_char,
const xechar_t* fmt, ...) XE_LOG_LINE_ATTRIBUTE;
#undef XE_LOG_LINE_ATTRIBUTE
#if XE_OPTION(ENABLE_LOGGING)
#define XELOGCORE(level, fmt, ...) xe_log_line( \
XE_CURRENT_FILE, XE_CURRENT_LINE, XE_CURRENT_FUNCTION, level, \
fmt, ##__VA_ARGS__)
#else
#define XELOGCORE(level, fmt, ...) XE_EMPTY_MACRO
#endif // ENABLE_LOGGING
#if XE_OPTION(LOG_ERROR)
#define XELOGE(fmt, ...) XELOGCORE('!', fmt, ##__VA_ARGS__)
#else
#define XELOGE(fmt, ...) XE_EMPTY_MACRO
#endif
#if XE_OPTION(LOG_WARNING)
#define XELOGW(fmt, ...) XELOGCORE('w', fmt, ##__VA_ARGS__)
#else
#define XELOGW(fmt, ...) XE_EMPTY_MACRO
#endif
#if XE_OPTION(LOG_INFO)
#define XELOGI(fmt, ...) XELOGCORE('i', fmt, ##__VA_ARGS__)
#else
#define XELOGI(fmt, ...) XE_EMPTY_MACRO
#endif
#if XE_OPTION(LOG_DEBUG)
#define XELOGD(fmt, ...) XELOGCORE('d', fmt, ##__VA_ARGS__)
#else
#define XELOGD(fmt, ...) XE_EMPTY_MACRO
#endif
#if XE_OPTION(LOG_CPU)
#define XELOGCPU(fmt, ...) XELOGCORE('C', fmt, ##__VA_ARGS__)
#else
#define XELOGCPU(fmt, ...) XE_EMPTY_MACRO
#endif
#if XE_OPTION(LOG_GPU)
#define XELOGGPU(fmt, ...) XELOGCORE('G', fmt, ##__VA_ARGS__)
#else
#define XELOGGPU(fmt, ...) XE_EMPTY_MACRO
#endif
#if XE_OPTION(LOG_KERNEL)
#define XELOGKERNEL(fmt, ...) XELOGCORE('K', fmt, ##__VA_ARGS__)
#else
#define XELOGKERNEL(fmt, ...) XE_EMPTY_MACRO
#endif
#endif // XENIA_LOGGING_H_

33
include/xenia/malloc.h Normal file
View File

@ -0,0 +1,33 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_MALLOC_H_
#define XENIA_MALLOC_H_
#include <xenia/types.h>
void *xe_malloc(const size_t size);
void *xe_calloc(const size_t size);
void *xe_realloc(void *ptr, const size_t old_size, const size_t new_size);
void *xe_recalloc(void *ptr, const size_t old_size, const size_t new_size);
void xe_free(void *ptr);
xe_aligned_void_t *xe_malloc_aligned(const size_t size);
void xe_free_aligned(xe_aligned_void_t *ptr);
int xe_zero_struct(void *ptr, const size_t size);
int xe_zero_memory(void *ptr, const size_t size, const size_t offset,
const size_t length);
int xe_copy_struct(void *dest, const void *source, const size_t size);
int xe_copy_memory(void *dest, const size_t dest_size, const void *source,
const size_t source_size);
#endif // XENIA_MALLOC_H_

155
include/xenia/platform.h Normal file
View File

@ -0,0 +1,155 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_PLATFORM_H_
#define XENIA_PLATFORM_H_
// NOTE: ordering matters here as sometimes multiple flags are defined on
// certain platforms.
// Great resource on predefined macros: http://predef.sourceforge.net/preos.html
/*
XE_PLATFORM: IOS | OSX | XBOX360 | WINCE | WIN32 | ANDROID | NACL | UNIX
XE_LIKE: OSX | WIN32 | POSIX
XE_PROFILE: EMBEDDED | DESKTOP (+ _SIMULATOR)
XE_COMPILER: GNUC | MSVC | INTEL | UNKNOWN
XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN
*/
#define XE_PLATFORM(NAME) (defined XE_PLATFORM_##NAME && XE_PLATFORM_##NAME )
#define XE_LIKE(NAME) (defined XE_LIKE_##NAME && XE_LIKE_##NAME )
#define XE_PROFILE(NAME) (defined XE_PROFILE_##NAME && XE_PROFILE_##NAME )
#define XE_COMPILER(NAME) (defined XE_COMPILER_##NAME && XE_COMPILER_##NAME )
#define XE_CPU(NAME) (defined XE_CPU_##NAME && XE_CPU_##NAME )
#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif
#if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED ) || \
(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE ) || \
(defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
#define XE_PLATFORM_IOS 1
#define XE_LIKE_OSX 1
#define XE_PROFILE_EMBEDDED 1
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
// EMBEDDED *and* SIMULATOR
#define XE_PROFILE_SIMULATOR 1
#endif
#elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
#define XE_PLATFORM_OSX 1
#define XE_LIKE_OSX 1
#define XE_PROFILE_DESKTOP 1
#elif defined(_XBOX)
#define XE_PLATFORM_XBOX360 1
#define XE_LIKE_WIN32 1
#define XE_PROFILE_EMBEDDED 1
#elif defined(_WIN32_WCE)
#define XE_PLATFORM_WINCE 1
#define XE_LIKE_WIN32 1
#define XE_PROFILE_EMBEDDED 1
#elif defined(__CYGWIN__)
#define XE_PLATFORM_CYGWIN 1
#define XE_LIKE_POSIX 1
#define XE_PROFILE_DESKTOP 1
#elif defined(WIN32) || defined(_WIN32)
#define XE_PLATFORM_WIN32 1
#define XE_LIKE_WIN32 1
#define XE_PROFILE_DESKTOP 1
#elif defined(ANDROID)
#define XE_PLATFORM_ANDROID 1
#define XE_LIKE_POSIX 1
#define XE_PROFILE_EMBEDDED 1
#elif defined(__native_client__)
#define XE_PLATFORM_NACL 1
#define XE_LIKE_POSIX 1
#define XE_PROFILE_DESKTOP 1
#else
#define XE_PLATFORM_UNIX 1
#define XE_LIKE_POSIX 1
#define XE_PROFILE_DESKTOP 1
#endif
#if defined(__GNUC__)
#define XE_COMPILER_GNUC 1
#elif defined(_MSC_VER)
#define XE_COMPILER_MSVC 1
#elif defined(__MINGW32)
#define XE_COMPILER_MINGW32 1
#elif defined(__INTEL_COMPILER)
#define XE_COMPILER_INTEL 1
#else
#define XE_COMPILER_UNKNOWN 1
#endif
#if defined(__ia64__) || defined(_M_IA64) || \
defined(__ppc64__) || defined(__PPC64__) || \
defined(__arch64__) || \
defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \
defined(__LP64__) || defined(__LLP64) || \
defined(_WIN64) || \
(__WORDSIZE == 64)
#define XE_CPU_64BIT 1
#else
#define XE_CPU_32BIT 1
#endif // [64bit flags]
#if defined(__ppc__) || defined(__PPC__) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(_M_PPC) || defined(__PPC) || \
defined(__ppc64__) || defined(__PPC64__) || \
defined(__ARMEB__) || \
defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__)
#define XE_CPU_BIGENDIAN 1
#else
#define XE_CPU_LITTLEENDIAN 1
#endif // [big endian flags]
#if defined(DEBUG) || defined(_DEBUG)
#define XE_DEBUG 1
#endif // DEBUG
#if XE_CPU(32BIT)
#define XE_ALIGNMENT 8
#else
#define XE_ALIGNMENT 16
#endif // 32BIT
#if XE_LIKE(WIN32)
#define XE_MAIN_THUNK(name) \
int wmain(int argc, wchar_t *argv[]) { \
return name(argc, (xechar_t**)argv); \
}
#else
#define XE_MAIN_THUNK(name) \
int main(int argc, char **argv) { \
return name(argc, argv); \
}
#endif // WIN32
#endif // XENIA_PLATFORM_H_

View File

@ -0,0 +1,51 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_PLATFORM_INCLUDES_H_
#define XENIA_PLATFORM_INCLUDES_H_
#include <xenia/platform.h>
#if XE_PLATFORM(WINCE) || XE_PLATFORM(WIN32)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <SDKDDKVer.h>
#include <windows.h>
#endif // WINCE || WIN32
#if XE_PLATFORM(XBOX360)
#include <xtl.h>
#include <xboxmath.h>
#endif // XBOX360
#if XE_COMPILER(MSVC)
// Disable warning C4068: unknown pragma
#pragma warning(disable : 4068)
#endif // MSVC
#include <stddef.h>
#include <memory.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <float.h>
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <locale.h>
#include <errno.h>
#include <string>
#include <assert.h>
#endif // XENIA_PLATFORM_INCLUDES_H_

106
include/xenia/string.h Normal file
View File

@ -0,0 +1,106 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_STRING_H_
#define XENIA_STRING_H_
#include <xenia/platform.h>
#include <xenia/platform_includes.h>
// NOTE: these differing implementations should behave pretty much the same.
// If they don't, then they will have to be abstracted out.
#define XEInvalidSize ((size_t)(-1))
#if !XE_LIKE(WIN32)
int strncpy_s(char* dest, size_t destLength, const char* source, size_t count);
#define strcpy_s(dest, destLength, source) !(strcpy(dest, source) == dest + (destLength*0))
#define strcat_s(dest, destLength, source) !(strcat(dest, source) == dest + (destLength*0))
#define _snprintf_s(dest, destLength, format, ...) snprintf(dest, destLength, format, ##__VA_ARGS__)
#else
#define strcasecmp _stricmp
#endif
#define xestrlenw wcslen
#define xestrcmpw wcscmp
#define xestrcasecmpw _wcsicmp
#define xestrchrw wcschr
#define xestrrchrw wcsrchr
#define xestrstrw wcsstr
#define xestrcpyw(dest, destLength, source) (wcscpy_s(dest, destLength, source) == 0)
#define xestrncpyw(dest, destLength, source, count) (wcsncpy_s(dest, destLength, source, count) == 0)
#define xestrcatw(dest, destLength, source) (wcscat_s(dest, destLength, source) == 0)
#define xesnprintfw(buffer, bufferCount, format, ...) _snwprintf_s(buffer, bufferCount, (bufferCount) ? (bufferCount - 1) : 0, format, ##__VA_ARGS__)
#define xevsnprintfw(buffer, bufferCount, format, args) _vsnwprintf_s(buffer, bufferCount, (bufferCount) ? (bufferCount - 1) : 0, format, args)
#define xevscprintfw(format, args) _vscwprintf(format, args)
#define xestrlena strlen
#define xestrcmpa strcmp
#define xestrcasecmpa strcasecmp
#define xestrchra strchr
#define xestrrchra strrchr
#define xestrstra strstr
#define xestrcpya(dest, destLength, source) (strcpy_s(dest, destLength, source) == 0)
#define xestrncpya(dest, destLength, source, count) (strncpy_s(dest, destLength, source, count) == 0)
#define xestrcata(dest, destLength, source) (strcat_s(dest, destLength, source) == 0)
#define xesnprintfa(buffer, bufferCount, format, ...) _snprintf_s(buffer, bufferCount, format, ##__VA_ARGS__)
#define xevsnprintfa(buffer, bufferCount, format, args) vsnprintf(buffer, bufferCount, format, args)
#if XE_PLATFORM(WIN32)
typedef wchar_t xechar_t;
#define XE_WCHAR 1
#define XETEXT(s) L ## s
#define xestrlen xestrlenw
#define xestrcmp xestrcmpw
#define xestrcasecmp xestrcasecmpw
#define xestrchr xestrchrw
#define xestrrchr xestrrchrw
#define xestrstr xestrstrw
#define xestrcpy xestrcpyw
#define xestrncpy xestrncpyw
#define xestrcat xestrcatw
#define xesnprintf xesnprintfw
#define xevsnprintf xevsnprintfw
#define xestrnarrow(dest, destLength, source) (wcstombs_s(NULL, dest, destLength, source, _TRUNCATE) == 0)
#define xestrwiden(dest, destLength, source) (mbstowcs_s(NULL, dest, destLength, source, _TRUNCATE) == 0)
#else
typedef char xechar_t;
#define XE_CHAR 1
#define XETEXT(s) s
#define xestrlen xestrlena
#define xestrcmp xestrcmpa
#define xestrcasecmp xestrcasecmpa
#define xestrchr xestrchra
#define xestrrchr xestrrchra
#define xestrstr xestrstra
#define xestrcpy xestrcpya
#define xestrncpy xestrncpya
#define xestrcat xestrcata
#define xesnprintf xesnprintfa
#define xevsnprintf xevsnprintfa
#define xestrnarrow(dest, destLength, source) xestrCpy(dest, destLength, source)
#define xestrwiden(dest, destLength, source) xestrCpy(dest, destLength, source)
#endif // WIN32
#define XT XETEXT
#if XE_LIKE(WIN32)
#define XE_PATH_SEPARATOR ((xechar_t)'\\')
#else
#define XE_PATH_SEPARATOR ((xechar_t)'/')
#endif // WIN32
#endif // XENIA_STRING_H_

109
include/xenia/types.h Normal file
View File

@ -0,0 +1,109 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_TYPES_H_
#define XENIA_TYPES_H_
#include <xenia/platform.h>
#include <xenia/platform_includes.h>
#define XE_EMPTY_MACRO do { } while(0)
#define XEUNREFERENCED(expr) (void)(expr)
#if XE_COMPILER(MSVC)
#define XEASSUME(expr) __analysis_assume(expr)
#else
#define XEASSUME(expr)
#endif // MSVC
#if XE_COMPILER(MSVC)
#define XECDECL __cdecl
#else
#define XECDECL
#endif // MSVC
#if defined(__cplusplus)
#define XEEXTERNC extern "C"
#define XEEXTERNC_BEGIN extern "C" {
#define XEEXTERNC_END }
#else
#define XEEXTERNC extern
#define XEEXTERNC_BEGIN
#define XEEXTERNC_END
#endif // __cplusplus
#if XE_COMPILER(MSVC)
// http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
#define XEFORCEINLINE static __forceinline
#define XENOINLINE __declspec(noinline)
#elif XE_COMPILER(GNUC)
// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
#if (__GNUC__ >= 4)
#define XEFORCEINLINE static __inline__ __attribute__((always_inline))
#else
#define XEFORCEINLINE static __inline__
#endif
#define XENOINLINE
#else
#define XEFORCEINLINE
#define XENOINLINE
#endif // MSVC
#if XE_COMPILER(MSVC)
// http://msdn.microsoft.com/en-us/library/83ythb65.aspx
#define XECACHEALIGN __declspec(align(XE_ALIGNMENT))
#define XECACHEALIGN64 __declspec(align(64))
#elif XE_COMPILER(GNUC)
// http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
#define XECACHEALIGN __attribute__ ((aligned(XE_ALIGNMENT)))
#define XECACHEALIGN64 __attribute__ ((aligned(64)))
#else
#define XECACHEALIGN
#define XECACHEALIGN64
#endif // MSVC
typedef XECACHEALIGN volatile void xe_aligned_void_t;
#if XE_COMPILER(MSVC)
// http://msdn.microsoft.com/en-us/library/ms175773.aspx
#define XECOUNT(array) _countof(array)
#elif XE_COMPILER(GNUC)
#define XECOUNT(array) (sizeof(array) / sizeof(__typeof__(array[0])))
#else
#define XECOUNT(array) (sizeof(array) / sizeof(array[0]))
#endif // MSVC
#if !defined(MIN)
#if XE_COMPILER(GNUC)
#define MIN(A, B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); (__a < __b) ? __a : __b; })
#define MAX(A, B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); (__a < __b) ? __b : __a; })
//#elif XE_COMPILER(MSVC)
// TODO(benvanik): experiment with decltype:
// http://msdn.microsoft.com/en-us/library/dd537655.aspx
#else
// NOTE: this implementation will evaluate the arguments twice - may be worth
// writing an inline function instead.
#define MIN(A, B) ( ((A) < (B)) ? (A) : (B) )
#define MAX(A, B) ( ((A) < (B)) ? (B) : (A) )
#endif // GNUC
#endif // !MIN
#define XEFAIL() goto XECLEANUP
#define XEEXPECT(expr) if (!(expr) ) { goto XECLEANUP; }
#define XEEXPECTTRUE(expr) if (!(expr) ) { goto XECLEANUP; }
#define XEEXPECTFALSE(expr) if ( (expr) ) { goto XECLEANUP; }
#define XEEXPECTZERO(expr) if ( (expr) != 0 ) { goto XECLEANUP; }
#define XEEXPECTNOTZERO(expr) if ( (expr) == 0 ) { goto XECLEANUP; }
#define XEEXPECTNULL(expr) if ( (expr) != NULL ) { goto XECLEANUP; }
#define XEEXPECTNOTNULL(expr) if ( (expr) == NULL ) { goto XECLEANUP; }
#define XEIGNORE(expr) do { (void)(expr); } while(0)
#endif // XENIA_TYPES_H_

View File

@ -10,6 +10,12 @@
#ifndef XENIA_H_ #ifndef XENIA_H_
#define XENIA_H_ #define XENIA_H_
#include <xenia/common.h>
#include <xenia/cpu.h>
#include <xenia/core.h>
#include <xenia/gpu.h>
#include <xenia/kernel.h>
int some_function(int x); int some_function(int x);
#endif // XENIA_H_ #endif // XENIA_H_

85
src/core/file.cc Normal file
View File

@ -0,0 +1,85 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/core/file.h>
typedef struct xe_file {
xe_ref_t ref;
void* handle;
} xe_file_t;
#if XE_LIKE(WIN32)
#define fseeko _fseeki64
#define ftello _ftelli64
#endif // WIN32
xe_file_ref xe_file_open(xe_pal_ref pal, const xe_file_mode mode,
const xechar_t *path) {
xe_file_ref file = (xe_file_ref)xe_calloc(sizeof(xe_file_t));
xe_ref_init((xe_ref)file);
xechar_t mode_string[10];
mode_string[0] = 0;
if (mode & kXEFileModeRead) {
XEIGNORE(xestrcat(mode_string, XECOUNT(mode_string), XT("r")));
}
if (mode & kXEFileModeWrite) {
XEIGNORE(xestrcat(mode_string, XECOUNT(mode_string), XT("w")));
}
XEIGNORE(xestrcat(mode_string, XECOUNT(mode_string), XT("b")));
#if XE_LIKE(WIN32)
XEEXPECTZERO(_wfopen_s((FILE**)&file->handle, path, mode_string));
#else
file->handle = fopen(path, mode_string);
XEEXPECTNOTNULL(file->handle);
#endif // WIN32
return file;
XECLEANUP:
xe_file_release(file);
return NULL;
}
void xe_file_dealloc(xe_file_ref file) {
FILE* handle = (FILE*)file->handle;
fclose(handle);
file->handle = NULL;
}
xe_file_ref xe_file_retain(xe_file_ref file) {
xe_ref_retain((xe_ref)file);
return file;
}
void xe_file_release(xe_file_ref file) {
xe_ref_release((xe_ref)file, (xe_ref_dealloc_t)xe_file_dealloc);
}
size_t xe_file_get_length(xe_file_ref file) {
FILE* handle = (FILE*)file->handle;
fseeko(handle, 0, SEEK_END);
return ftello(handle);
}
size_t xe_file_read(xe_file_ref file, const size_t offset,
uint8_t *buffer, const size_t buffer_size) {
FILE* handle = (FILE*)file->handle;
if (fseeko(handle, offset, SEEK_SET) != 0) {
return -1;
}
return fread(buffer, 1, buffer_size, handle);
}

74
src/core/memory.cc Normal file
View File

@ -0,0 +1,74 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/core/memory.h>
#include <sys/mman.h>
/**
* Memory map:
* 0x00000000 - 0x40000000 (1024mb) - virtual 4k pages
* 0x40000000 - 0x80000000 (1024mb) - virtual 64k pages
* 0x80000000 - 0x8C000000 ( 192mb) - xex 64k pages
* 0x8C000000 - 0x90000000 ( 64mb) - xex 64k pages (encrypted)
* 0x90000000 - 0xA0000000 ( 256mb) - xex 4k pages
* 0xA0000000 - 0xC0000000 ( 512mb) - physical 64k pages
*
* We use the host OS to create an entire addressable range for this. That way
* we don't have to emulate a TLB. It'd be really cool to pass through page
* sizes or use madvice to let the OS know what to expect.
*/
struct xe_memory {
xe_ref_t ref;
size_t length;
void *ptr;
};
xe_memory_ref xe_memory_create(xe_pal_ref pal, xe_memory_options_t options) {
xe_memory_ref memory = (xe_memory_ref)xe_calloc(sizeof(xe_memory));
xe_ref_init((xe_ref)memory);
memory->length = 0xC0000000;
memory->ptr = mmap(0, memory->length, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
XEEXPECTNOTNULL(memory->ptr);
XEEXPECT(memory->ptr != MAP_FAILED);
return memory;
XECLEANUP:
xe_memory_release(memory);
return NULL;
}
void xe_memory_dealloc(xe_memory_ref memory) {
munmap(memory->ptr, memory->length);
}
xe_memory_ref xe_memory_retain(xe_memory_ref memory) {
xe_ref_retain((xe_ref)memory);
return memory;
}
void xe_memory_release(xe_memory_ref memory) {
xe_ref_release((xe_ref)memory, (xe_ref_dealloc_t)xe_memory_dealloc);
}
size_t xe_memory_get_length(xe_memory_ref memory) {
return memory->length;
}
void* xe_memory_addr(xe_memory_ref memory, uint32_t guest_addr) {
return (uint8_t*)memory->ptr + guest_addr;
}

101
src/core/mmap_posix.cc Normal file
View File

@ -0,0 +1,101 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/core/mmap.h>
#include <sys/mman.h>
typedef struct xe_mmap {
xe_ref_t ref;
void* file_handle;
void* mmap_handle;
void* addr;
size_t length;
} xe_mmap_t;
xe_mmap_ref xe_mmap_open(xe_pal_ref pal, const xe_file_mode mode,
const xechar_t *path,
const size_t offset, const size_t length) {
xe_mmap_ref mmap = (xe_mmap_ref)xe_calloc(sizeof(xe_mmap_t));
xe_ref_init((xe_ref)mmap);
xechar_t mode_string[10];
mode_string[0] = 0;
if (mode & kXEFileModeRead) {
XEIGNORE(xestrcat(mode_string, XECOUNT(mode_string), XT("r")));
}
if (mode & kXEFileModeWrite) {
XEIGNORE(xestrcat(mode_string, XECOUNT(mode_string), XT("w")));
}
XEIGNORE(xestrcat(mode_string, XECOUNT(mode_string), XT("b")));
int prot = 0;
if (mode & kXEFileModeRead) {
prot |= PROT_READ;
}
if (mode & kXEFileModeWrite) {
prot |= PROT_WRITE;
}
FILE* file_handle = fopen(path, mode_string);
mmap->file_handle = file_handle;
XEEXPECTNOTNULL(mmap->file_handle);
size_t map_length;
map_length = length;
if (!length) {
fseeko(file_handle, 0, SEEK_END);
map_length = ftello(file_handle);
}
mmap->length = map_length;
mmap->addr = ::mmap(0, map_length, prot, MAP_SHARED, fileno(file_handle),
offset);
XEEXPECTNOTNULL(mmap->addr);
return mmap;
XECLEANUP:
xe_mmap_release(mmap);
return NULL;
}
void xe_mmap_dealloc(xe_mmap_ref mmap) {
if (mmap->addr) {
munmap(mmap->addr, mmap->length);
mmap->addr = NULL;
}
FILE* file_handle = (FILE*)mmap->file_handle;
if (file_handle) {
fclose(file_handle);
mmap->file_handle = NULL;
}
}
xe_mmap_ref xe_mmap_retain(xe_mmap_ref mmap) {
xe_ref_retain((xe_ref)mmap);
return mmap;
}
void xe_mmap_release(xe_mmap_ref mmap) {
xe_ref_release((xe_ref)mmap, (xe_ref_dealloc_t)xe_mmap_dealloc);
}
void* xe_mmap_get_addr(xe_mmap_ref mmap) {
return mmap->addr;
}
size_t xe_mmap_get_length(xe_mmap_ref mmap) {
return mmap->length;
}

39
src/core/pal.cc Normal file
View File

@ -0,0 +1,39 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/core/pal.h>
typedef struct xe_pal {
xe_ref_t ref;
} xe_pal_t;
xe_pal_ref xe_pal_create(xe_pal_options_t options) {
xe_pal_ref pal = (xe_pal_ref)xe_calloc(sizeof(xe_pal_t));
xe_ref_init((xe_ref)pal);
//
return pal;
}
void xe_pal_dealloc(xe_pal_ref pal) {
//
}
xe_pal_ref xe_pal_retain(xe_pal_ref pal) {
xe_ref_retain((xe_ref)pal);
return pal;
}
void xe_pal_release(xe_pal_ref pal) {
xe_ref_release((xe_ref)pal, (xe_ref_dealloc_t)xe_pal_dealloc);
}

31
src/core/ref.cc Normal file
View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/core/ref.h>
void xe_ref_init(xe_ref_t* ref) {
ref->count = 1;
}
void xe_ref_retain(xe_ref_t* ref) {
xe_atomic_inc_32(&ref->count);
}
void xe_ref_release(xe_ref_t* ref, xe_ref_dealloc_t dealloc) {
if (!ref) {
return;
}
if (!xe_atomic_dec_32(&ref->count)) {
if (dealloc) {
dealloc(ref);
}
xe_free(ref);
}
}

View File

@ -1,6 +1,21 @@
# Copyright 2013 Ben Vanik. All Rights Reserved. # Copyright 2013 Ben Vanik. All Rights Reserved.
{ {
'sources': [ 'sources': [
'something.cc', 'file.cc',
'memory.cc',
'pal.cc',
'ref.cc',
],
'conditions': [
['OS == "mac" or OS == "linux"', {
'sources': [
'mmap_posix.cc',
],
}],
['OS == "win"', {
'sources': [
],
}],
], ],
} }

View File

@ -7,7 +7,7 @@
****************************************************************************** ******************************************************************************
*/ */
#include <xenia/xenia.h> #include <xenia/cpu.h>
#include <llvm/IR/DerivedTypes.h> #include <llvm/IR/DerivedTypes.h>
#include <llvm/IR/IRBuilder.h> #include <llvm/IR/IRBuilder.h>
@ -16,7 +16,10 @@
using namespace llvm; using namespace llvm;
int some_function(int xx) {
void do_cpu_stuff() {
XELOGCPU(XT("cpu"));
LLVMContext &context = getGlobalContext(); LLVMContext &context = getGlobalContext();
//IRBuilder<> builder(context); //IRBuilder<> builder(context);
Module *module = new Module("my cool jit", context); Module *module = new Module("my cool jit", context);
@ -49,7 +52,8 @@ int some_function(int xx) {
builder.CreateRet(tmp2); builder.CreateRet(tmp2);
XELOGD(XT("woo %d"), 123);
module->dump(); module->dump();
delete module; delete module;
return xx + 4;
} }

6
src/cpu/sources.gypi Normal file
View File

@ -0,0 +1,6 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'cpu.cc',
],
}

15
src/gpu/gpu.cc Normal file
View File

@ -0,0 +1,15 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/gpu.h>
void do_gpu_stuff() {
XELOGGPU(XT("gpu"));
}

6
src/gpu/sources.gypi Normal file
View File

@ -0,0 +1,6 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'gpu.cc',
],
}

96
src/kernel/export.cc Normal file
View File

@ -0,0 +1,96 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/kernel/export.h>
bool xe_kernel_export_is_implemented(const xe_kernel_export_t *kernel_export) {
if (kernel_export->flags & kXEKernelExportFlagFunction) {
if (kernel_export->function_data.impl) {
return true;
}
} else if (kernel_export->flags & kXEKernelExportFlagVariable) {
if (kernel_export->variable_data) {
return true;
}
}
return false;
}
typedef struct {
char name[32];
xe_kernel_export_t *exports;
size_t count;
} xe_kernel_export_table_t;
#define kXEKernelExportResolverTableMaxCount 8
struct xe_kernel_export_resolver {
xe_ref_t ref;
xe_kernel_export_table_t tables[kXEKernelExportResolverTableMaxCount];
size_t table_count;
};
xe_kernel_export_resolver_ref xe_kernel_export_resolver_create() {
xe_kernel_export_resolver_ref resolver = (xe_kernel_export_resolver_ref)
xe_calloc(sizeof(xe_kernel_export_resolver));
xe_ref_init((xe_ref)resolver);
return resolver;
}
void xe_kernel_export_resolver_dealloc(xe_kernel_export_resolver_ref resolver) {
}
xe_kernel_export_resolver_ref xe_kernel_export_resolver_retain(
xe_kernel_export_resolver_ref resolver) {
xe_ref_retain((xe_ref)resolver);
return resolver;
}
void xe_kernel_export_resolver_release(xe_kernel_export_resolver_ref resolver) {
xe_ref_release((xe_ref)resolver,
(xe_ref_dealloc_t)xe_kernel_export_resolver_dealloc);
}
void xe_kernel_export_resolver_register_table(
xe_kernel_export_resolver_ref resolver, const char *library_name,
xe_kernel_export_t *exports, const size_t count) {
XEASSERT(resolver->table_count + 1 < kXEKernelExportResolverTableMaxCount);
xe_kernel_export_table_t *table = &resolver->tables[resolver->table_count++];
XEIGNORE(xestrcpya(table->name, XECOUNT(table->name), library_name));
table->exports = exports;
table->count = count;
}
xe_kernel_export_t *xe_kernel_export_resolver_get_by_ordinal(
xe_kernel_export_resolver_ref resolver, const char *library_name,
const uint32_t ordinal) {
// TODO(benvanik): binary search everything.
for (size_t n = 0; n < resolver->table_count; n++) {
const xe_kernel_export_table_t *table = &resolver->tables[n];
if (!xestrcmpa(library_name, table->name)) {
// TODO(benvanik): binary search table.
for (size_t m = 0; m < table->count; m++) {
if (table->exports[m].ordinal == ordinal) {
return &table->exports[m];
}
}
}
}
return NULL;
}
xe_kernel_export_t *xe_kernel_export_resolver_get_by_name(
xe_kernel_export_resolver_ref resolver, const char *library_name,
const char *name) {
return NULL;
}

130
src/kernel/kernel.cc Normal file
View File

@ -0,0 +1,130 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/kernel.h>
#include "kernel/modules/modules.h"
typedef struct xe_kernel {
xe_ref_t ref;
xe_kernel_options_t options;
xe_pal_ref pal;
xe_memory_ref memory;
xe_kernel_export_resolver_ref export_resolver;
struct {
xe_xam_ref xam;
xe_xbdm_ref xbdm;
xe_xboxkrnl_ref xboxkrnl;
} modules;
} xe_kernel_t;
xe_kernel_ref xe_kernel_create(xe_pal_ref pal, xe_memory_ref memory,
xe_kernel_options_t options) {
xe_kernel_ref kernel = (xe_kernel_ref)xe_calloc(sizeof(xe_kernel));
xe_ref_init((xe_ref)kernel);
xe_copy_struct(&kernel->options, &options, sizeof(xe_kernel_options_t));
kernel->pal = xe_pal_retain(pal);
kernel->memory = xe_memory_retain(memory);
kernel->export_resolver = xe_kernel_export_resolver_create();
kernel->modules.xam =
xe_xam_create(pal, memory, kernel->export_resolver);
kernel->modules.xbdm =
xe_xbdm_create(pal, memory, kernel->export_resolver);
kernel->modules.xboxkrnl =
xe_xboxkrnl_create(pal, memory, kernel->export_resolver);
return kernel;
}
void xe_kernel_dealloc(xe_kernel_ref kernel) {
xe_xboxkrnl_release(kernel->modules.xboxkrnl);
xe_kernel_export_resolver_release(kernel->export_resolver);
xe_memory_release(kernel->memory);
xe_pal_release(kernel->pal);
}
xe_kernel_ref xe_kernel_retain(xe_kernel_ref kernel) {
xe_ref_retain((xe_ref)kernel);
return kernel;
}
void xe_kernel_release(xe_kernel_ref kernel) {
xe_ref_release((xe_ref)kernel, (xe_ref_dealloc_t)xe_kernel_dealloc);
}
xe_pal_ref xe_kernel_get_pal(xe_kernel_ref kernel) {
return xe_pal_retain(kernel->pal);
}
xe_memory_ref xe_kernel_get_memory(xe_kernel_ref kernel) {
return xe_memory_retain(kernel->memory);
}
const xechar_t *xe_kernel_get_command_line(xe_kernel_ref kernel) {
return kernel->options.command_line;
}
xe_kernel_export_resolver_ref xe_kernel_get_export_resolver(
xe_kernel_ref kernel) {
return xe_kernel_export_resolver_retain(kernel->export_resolver);
}
xe_module_ref xe_kernel_load_module(xe_kernel_ref kernel,
const xechar_t *path) {
xe_module_ref module = xe_kernel_get_module(kernel, path);
if (module) {
return module;
}
// TODO(benvanik): map file from filesystem
xe_mmap_ref mmap = xe_mmap_open(kernel->pal, kXEFileModeRead, path, 0, 0);
if (!mmap) {
return NULL;
}
void *addr = xe_mmap_get_addr(mmap);
size_t length = xe_mmap_get_length(mmap);
xe_module_options_t options;
xe_zero_struct(&options, sizeof(xe_module_options_t));
XEIGNORE(xestrcpy(options.path, XECOUNT(options.path), path));
module = xe_module_load(kernel->memory, kernel->export_resolver,
addr, length, options);
// TODO(benvanik): retain memory somehow? is it needed?
xe_mmap_release(mmap);
if (!module) {
return NULL;
}
// stash in modules list
return xe_module_retain(module);
}
void xe_kernel_launch_module(xe_kernel_ref kernel, xe_module_ref module) {
//
}
xe_module_ref xe_kernel_get_module(xe_kernel_ref kernel, const xechar_t *path) {
return NULL;
}
void xe_kernel_unload_module(xe_kernel_ref kernel, xe_module_ref module) {
//
}

444
src/kernel/module.cc Normal file
View File

@ -0,0 +1,444 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/kernel/module.h>
#include <third_party/pe/pe_image.h>
#define kXEModuleMaxSectionCount 32
typedef struct xe_module {
xe_ref_t ref;
xe_module_options_t options;
xe_memory_ref memory;
xe_kernel_export_resolver_ref export_resolver;
uint32_t handle;
xe_xex2_ref xex;
size_t section_count;
xe_module_pe_section_t sections[kXEModuleMaxSectionCount];
} xe_module_t;
int xe_module_load_pe(xe_module_ref module);
xe_module_ref xe_module_load(xe_memory_ref memory,
xe_kernel_export_resolver_ref export_resolver,
const void *addr, const size_t length,
xe_module_options_t options) {
xe_module_ref module = (xe_module_ref)xe_calloc(sizeof(xe_module));
xe_ref_init((xe_ref)module);
xe_copy_struct(&module->options, &options, sizeof(xe_module_options_t));
module->memory = xe_memory_retain(memory);
module->export_resolver = xe_kernel_export_resolver_retain(export_resolver);
xe_xex2_options_t xex_options;
module->xex = xe_xex2_load(memory, addr, length, xex_options);
XEEXPECTNOTNULL(module->xex);
XEEXPECTZERO(xe_module_load_pe(module));
return module;
XECLEANUP:
xe_module_release(module);
return NULL;
}
void xe_module_dealloc(xe_module_ref module) {
xe_kernel_export_resolver_release(module->export_resolver);
xe_memory_release(module->memory);
}
xe_module_ref xe_module_retain(xe_module_ref module) {
xe_ref_retain((xe_ref)module);
return module;
}
void xe_module_release(xe_module_ref module) {
xe_ref_release((xe_ref)module, (xe_ref_dealloc_t)xe_module_dealloc);
}
uint32_t xe_module_get_handle(xe_module_ref module) {
return module->handle;
}
xe_xex2_ref xe_module_get_xex(xe_module_ref module) {
return xe_xex2_retain(module->xex);
}
const xe_xex2_header_t *xe_module_get_xex_header(xe_module_ref module) {
return xe_xex2_get_header(module->xex);
}
void *xe_module_get_proc_address(xe_module_ref module, const uint32_t ordinal) {
return NULL;
}
// IMAGE_CE_RUNTIME_FUNCTION_ENTRY
// http://msdn.microsoft.com/en-us/library/ms879748.aspx
typedef struct IMAGE_XBOX_RUNTIME_FUNCTION_ENTRY_t {
uint32_t FuncStart; // Virtual address
union {
struct {
uint32_t PrologLen : 8; // # of prolog instructions (size = x4)
uint32_t FuncLen : 22; // # of instructions total (size = x4)
uint32_t ThirtyTwoBit : 1; // Always 1
uint32_t ExceptionFlag : 1; // 1 if PDATA_EH in .text -- unknown if used
} Flags;
uint32_t FlagsValue; // To make byte swapping easier
};
} IMAGE_XBOX_RUNTIME_FUNCTION_ENTRY;
int xe_module_load_pe(xe_module_ref module) {
const xe_xex2_header_t *xex_header = xe_xex2_get_header(module->xex);
uint8_t *mem = (uint8_t*)xe_memory_addr(module->memory, 0);
const uint8_t *p = mem + xex_header->exe_address;
// Verify DOS signature (MZ).
const IMAGE_DOS_HEADER* doshdr = (const IMAGE_DOS_HEADER*)p;
if (doshdr->e_magic != IMAGE_DOS_SIGNATURE) {
return 1;
}
// Move to the NT header offset from the DOS header.
p += doshdr->e_lfanew;
// Verify NT signature (PE\0\0).
const IMAGE_NT_HEADERS32* nthdr = (const IMAGE_NT_HEADERS32*)(p);
if (nthdr->Signature != IMAGE_NT_SIGNATURE) {
return 1;
}
// Verify matches an Xbox PE.
const IMAGE_FILE_HEADER* filehdr = &nthdr->FileHeader;
if ((filehdr->Machine != IMAGE_FILE_MACHINE_POWERPCBE) ||
!(filehdr->Characteristics & IMAGE_FILE_32BIT_MACHINE)) {
return 1;
}
// Verify the expected size.
if (filehdr->SizeOfOptionalHeader != IMAGE_SIZEOF_NT_OPTIONAL_HEADER) {
return 1;
}
// Verify optional header is 32bit.
const IMAGE_OPTIONAL_HEADER32* opthdr = &nthdr->OptionalHeader;
if (opthdr->Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
return 1;
}
// Verify subsystem.
if (opthdr->Subsystem != IMAGE_SUBSYSTEM_XBOX) {
return 1;
}
// Linker version - likely 8+
// Could be useful for recognizing certain patterns
//opthdr->MajorLinkerVersion; opthdr->MinorLinkerVersion;
// Data directories of interest:
// EXPORT IMAGE_EXPORT_DIRECTORY
// IMPORT IMAGE_IMPORT_DESCRIPTOR[]
// EXCEPTION IMAGE_CE_RUNTIME_FUNCTION_ENTRY[]
// BASERELOC
// DEBUG IMAGE_DEBUG_DIRECTORY[]
// ARCHITECTURE /IMAGE_ARCHITECTURE_HEADER/ ----- import thunks!
// TLS IMAGE_TLS_DIRECTORY
// IAT Import Address Table ptr
//opthdr->DataDirectory[IMAGE_DIRECTORY_ENTRY_X].VirtualAddress / .Size
// Verify section count not overrun.
// NOTE: if this ever asserts, change to a dynamic section list.
XEASSERT(filehdr->NumberOfSections <= kXEModuleMaxSectionCount);
if (filehdr->NumberOfSections > kXEModuleMaxSectionCount) {
return 1;
}
module->section_count = filehdr->NumberOfSections;
// Quick scan to determine bounds of sections.
size_t upper_address = 0;
const IMAGE_SECTION_HEADER* sechdr = IMAGE_FIRST_SECTION(nthdr);
for (size_t n = 0; n < filehdr->NumberOfSections; n++, sechdr++) {
const size_t physical_address = opthdr->ImageBase + sechdr->VirtualAddress;
upper_address =
MAX(upper_address, physical_address + sechdr->Misc.VirtualSize);
}
// Setup/load sections.
sechdr = IMAGE_FIRST_SECTION(nthdr);
for (size_t n = 0; n < filehdr->NumberOfSections; n++, sechdr++) {
xe_module_pe_section_t *section = &module->sections[n];
xe_copy_memory(section->name, sizeof(section->name),
sechdr->Name, sizeof(sechdr->Name));
section->name[8] = 0;
section->raw_address = sechdr->PointerToRawData;
section->raw_size = sechdr->SizeOfRawData;
section->address = xex_header->exe_address + sechdr->VirtualAddress;
section->size = sechdr->Misc.VirtualSize;
section->flags = sechdr->Characteristics;
}
//DumpTLSDirectory(pImageBase, pNTHeader, (PIMAGE_TLS_DIRECTORY32)0);
//DumpExportsSection(pImageBase, pNTHeader);
return 0;
}
xe_module_pe_section_t *xe_module_get_section(xe_module_ref module,
const char *name) {
for (size_t n = 0; n < module->section_count; n++) {
if (xestrcmpa(module->sections[n].name, name) == 0) {
return &module->sections[n];
}
}
return NULL;
}
int xe_module_get_method_hints(xe_module_ref module,
xe_module_pe_method_info_t **out_method_infos,
size_t *out_method_info_count) {
uint8_t *mem = (uint8_t*)xe_memory_addr(module->memory, 0);
*out_method_infos = NULL;
*out_method_info_count = 0;
const IMAGE_XBOX_RUNTIME_FUNCTION_ENTRY *entry = NULL;
// Find pdata, which contains the exception handling entries.
xe_module_pe_section_t *pdata = xe_module_get_section(module, ".pdata");
if (!pdata) {
// No exception data to go on.
return 0;
}
// Resolve.
const uint8_t *p = mem + pdata->address;
// Entry count = pdata size / sizeof(entry).
const size_t entry_count =
pdata->size / sizeof(IMAGE_XBOX_RUNTIME_FUNCTION_ENTRY);
if (entry_count == 0) {
// Empty?
return 0;
}
// Allocate output.
xe_module_pe_method_info_t *method_infos =
(xe_module_pe_method_info_t*)xe_calloc(
entry_count * sizeof(xe_module_pe_method_info_t));
XEEXPECTNOTNULL(method_infos);
// Parse entries.
// NOTE: entries are in memory as big endian, so pull them out and swap the
// values before using them.
entry = (const IMAGE_XBOX_RUNTIME_FUNCTION_ENTRY*)p;
IMAGE_XBOX_RUNTIME_FUNCTION_ENTRY temp_entry;
for (size_t n = 0; n < entry_count; n++, entry++) {
xe_module_pe_method_info_t *method_info = &method_infos[n];
method_info->address = XESWAP32BE(entry->FuncStart);
// The bitfield needs to be swapped by hand.
temp_entry.FlagsValue = XESWAP32BE(entry->FlagsValue);
method_info->total_length = temp_entry.Flags.FuncLen * 4;
method_info->prolog_length = temp_entry.Flags.PrologLen * 4;
}
*out_method_infos = method_infos;
*out_method_info_count = entry_count;
return 0;
XECLEANUP:
if (method_infos) {
xe_free(method_infos);
}
return 1;
}
void xe_module_dump(xe_module_ref module) {
//const uint8_t *mem = (const uint8_t*)xe_memory_addr(module->memory, 0);
const xe_xex2_header_t *header = xe_xex2_get_header(module->xex);
// XEX info.
printf("Module %s:\n\n", module->options.path);
printf(" Module Flags: %.8X\n", header->module_flags);
printf(" System Flags: %.8X\n", header->system_flags);
printf("\n");
printf(" Address: %.8X\n", header->exe_address);
printf(" Entry Point: %.8X\n", header->exe_entry_point);
printf(" Stack Size: %.8X\n", header->exe_stack_size);
printf(" Heap Size: %.8X\n", header->exe_heap_size);
printf("\n");
printf(" Execution Info:\n");
printf(" Media ID: %.8X\n", header->execution_info.media_id);
printf(" Version: %d.%d.%d.%d\n",
header->execution_info.version.major,
header->execution_info.version.minor,
header->execution_info.version.build,
header->execution_info.version.qfe);
printf(" Base Version: %d.%d.%d.%d\n",
header->execution_info.base_version.major,
header->execution_info.base_version.minor,
header->execution_info.base_version.build,
header->execution_info.base_version.qfe);
printf(" Title ID: %.8X\n", header->execution_info.title_id);
printf(" Platform: %.8X\n", header->execution_info.platform);
printf(" Exec Table: %.8X\n", header->execution_info.executable_table);
printf(" Disc Number: %d\n", header->execution_info.disc_number);
printf(" Disc Count: %d\n", header->execution_info.disc_count);
printf(" Savegame ID: %.8X\n", header->execution_info.savegame_id);
printf("\n");
printf(" Loader Info:\n");
printf(" Image Flags: %.8X\n", header->loader_info.image_flags);
printf(" Game Regions: %.8X\n", header->loader_info.game_regions);
printf(" Media Flags: %.8X\n", header->loader_info.media_flags);
printf("\n");
printf(" TLS Info:\n");
printf(" Slot Count: %d\n", header->tls_info.slot_count);
printf(" Data Size: %db\n", header->tls_info.data_size);
printf(" Address: %.8X, %db\n", header->tls_info.raw_data_address,
header->tls_info.raw_data_size);
printf("\n");
printf(" Headers:\n");
for (size_t n = 0; n < header->header_count; n++) {
const xe_xex2_opt_header_t *opt_header = &header->headers[n];
printf(" %.8X (%.8X, %4db) %.8X = %11d\n",
opt_header->key, opt_header->offset, opt_header->length,
opt_header->value, opt_header->value);
}
printf("\n");
// Resources.
printf("Resources:\n");
printf(" %.8X, %db\n", header->resource_info.address,
header->resource_info.size);
printf(" TODO\n");
printf("\n");
// Section info.
printf("Sections:\n");
for (size_t n = 0, i = 0; n < header->section_count; n++) {
const xe_xex2_section_t *section = &header->sections[n];
const char* type = "UNKNOWN";
switch (section->info.type) {
case XEX_SECTION_CODE:
type = "CODE ";
break;
case XEX_SECTION_DATA:
type = "RWDATA ";
break;
case XEX_SECTION_READONLY_DATA:
type = "RODATA ";
break;
}
const size_t start_address = header->exe_address +
(i * xe_xex2_section_length);
const size_t end_address = start_address + (section->info.page_count *
xe_xex2_section_length);
printf(" %3d %s %3d pages %.8X - %.8X (%d bytes)\n",
(int)n, type, section->info.page_count, (int)start_address,
(int)end_address, section->info.page_count * xe_xex2_section_length);
i += section->info.page_count;
}
printf("\n");
// Static libraries.
printf("Static Libraries:\n");
for (size_t n = 0; n < header->static_library_count; n++) {
const xe_xex2_static_library_t *library = &header->static_libraries[n];
printf(" %-8s : %d.%d.%d.%d\n", library->name, library->major,
library->minor, library->build, library->qfe);
}
printf("\n");
// Imports.
printf("Imports:\n");
for (size_t n = 0; n < header->import_library_count; n++) {
const xe_xex2_import_library_t *library = &header->import_libraries[n];
xe_xex2_import_info_t* import_infos;
size_t import_info_count;
if (!xe_xex2_get_import_infos(module->xex, library,
&import_infos, &import_info_count)) {
printf(" %s - %d imports\n", library->name, (int)import_info_count);
printf(" Version: %d.%d.%d.%d\n",
library->version.major, library->version.minor,
library->version.build, library->version.qfe);
printf(" Min Version: %d.%d.%d.%d\n",
library->min_version.major, library->min_version.minor,
library->min_version.build, library->min_version.qfe);
printf("\n");
// Counts.
int known_count = 0;
int unknown_count = 0;
int impl_count = 0;
int unimpl_count = 0;
for (size_t m = 0; m < import_info_count; m++) {
const xe_xex2_import_info_t *info = &import_infos[m];
const xe_kernel_export_t *kernel_export =
xe_kernel_export_resolver_get_by_ordinal(
module->export_resolver, library->name, info->ordinal);
if (kernel_export) {
known_count++;
if (xe_kernel_export_is_implemented(kernel_export)) {
impl_count++;
}
} else {
unknown_count++;
unimpl_count++;
}
}
printf(" Total: %4zu\n", import_info_count);
printf(" Known: %3d%% (%d known, %d unknown)\n",
(int)(known_count / (float)import_info_count * 100.0f),
known_count, unknown_count);
printf(" Implemented: %3d%% (%d implemented, %d unimplemented)\n",
(int)(impl_count / (float)import_info_count * 100.0f),
impl_count, unimpl_count);
printf("\n");
// Listing.
for (size_t m = 0; m < import_info_count; m++) {
const xe_xex2_import_info_t *info = &import_infos[m];
const xe_kernel_export_t *kernel_export =
xe_kernel_export_resolver_get_by_ordinal(
module->export_resolver, library->name, info->ordinal);
const char *name = "UNKNOWN";
bool implemented = false;
if (kernel_export) {
name = kernel_export->name;
implemented = xe_kernel_export_is_implemented(kernel_export);
}
if (info->thunk_address) {
printf(" F %.8X %.8X %.3X (%3d) %s %s\n",
info->value_address, info->thunk_address, info->ordinal,
info->ordinal, implemented ? " " : "!!", name);
} else {
printf(" V %.8X %.3X (%3d) %s %s\n",
info->value_address, info->ordinal, info->ordinal,
implemented ? " " : "!!", name);
}
}
xe_free(import_infos);
}
printf("\n");
}
// Exports.
printf("Exports:\n");
printf(" TODO\n");
printf("\n");
}

View File

@ -0,0 +1,17 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_MODULES_H_
#define XENIA_KERNEL_MODULES_H_
#include "kernel/modules/xam/xam.h"
#include "kernel/modules/xbdm/xbdm.h"
#include "kernel/modules/xboxkrnl/xboxkrnl.h"
#endif // XENIA_KERNEL_MODULES_H_

View File

@ -0,0 +1,8 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'includes': [
'xam/sources.gypi',
'xbdm/sources.gypi',
'xboxkrnl/sources.gypi',
],
}

View File

@ -0,0 +1,6 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'xam.cc',
],
}

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "kernel/modules/xam/xam.h"
#include "kernel/modules/xam/xam_table.h"
struct xe_xam {
xe_ref_t ref;
};
xe_xam_ref xe_xam_create(
xe_pal_ref pal, xe_memory_ref memory,
xe_kernel_export_resolver_ref export_resolver) {
xe_xam_ref module = (xe_xam_ref)xe_calloc(sizeof(xe_xam));
xe_ref_init((xe_ref)module);
xe_kernel_export_resolver_register_table(export_resolver, "xam.xex",
xe_xam_export_table, XECOUNT(xe_xam_export_table));
return module;
}
void xe_xam_dealloc(xe_xam_ref module) {
}
xe_xam_ref xe_xam_retain(xe_xam_ref module) {
xe_ref_retain((xe_ref)module);
return module;
}
void xe_xam_release(xe_xam_ref module) {
xe_ref_release((xe_ref)module, (xe_ref_dealloc_t)xe_xam_dealloc);
}

View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_MODULES_XAM_H_
#define XENIA_KERNEL_MODULES_XAM_H_
#include <xenia/common.h>
#include <xenia/core.h>
#include <xenia/kernel/export.h>
struct xe_xam;
typedef struct xe_xam* xe_xam_ref;
xe_xam_ref xe_xam_create(
xe_pal_ref pal, xe_memory_ref memory,
xe_kernel_export_resolver_ref export_resolver);
xe_xam_ref xe_xam_retain(xe_xam_ref module);
void xe_xam_release(xe_xam_ref module);
#endif // XENIA_KERNEL_MODULES_XAM_H_

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'xbdm.cc',
],
}

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "kernel/modules/xbdm/xbdm.h"
#include "kernel/modules/xbdm/xbdm_table.h"
struct xe_xbdm {
xe_ref_t ref;
};
xe_xbdm_ref xe_xbdm_create(
xe_pal_ref pal, xe_memory_ref memory,
xe_kernel_export_resolver_ref export_resolver) {
xe_xbdm_ref module = (xe_xbdm_ref)xe_calloc(sizeof(xe_xbdm));
xe_ref_init((xe_ref)module);
xe_kernel_export_resolver_register_table(export_resolver, "xbdm.exe",
xe_xbdm_export_table, XECOUNT(xe_xbdm_export_table));
return module;
}
void xe_xbdm_dealloc(xe_xbdm_ref module) {
}
xe_xbdm_ref xe_xbdm_retain(xe_xbdm_ref module) {
xe_ref_retain((xe_ref)module);
return module;
}
void xe_xbdm_release(xe_xbdm_ref module) {
xe_ref_release((xe_ref)module, (xe_ref_dealloc_t)xe_xbdm_dealloc);
}

View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_MODULES_XBDM_H_
#define XENIA_KERNEL_MODULES_XBDM_H_
#include <xenia/common.h>
#include <xenia/core.h>
#include <xenia/kernel/export.h>
struct xe_xbdm;
typedef struct xe_xbdm* xe_xbdm_ref;
xe_xbdm_ref xe_xbdm_create(
xe_pal_ref pal, xe_memory_ref memory,
xe_kernel_export_resolver_ref export_resolver);
xe_xbdm_ref xe_xbdm_retain(xe_xbdm_ref module);
void xe_xbdm_release(xe_xbdm_ref module);
#endif // XENIA_KERNEL_MODULES_XBDM_H_

View File

@ -0,0 +1,26 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_MODULES_XBDM_TABLE_H_
#define XENIA_KERNEL_MODULES_XBDM_TABLE_H_
#include <xenia/kernel/export.h>
#define FLAG(t) kXEKernelExportFlag##t
static xe_kernel_export_t xe_xbdm_export_table[] = {
};
#undef FLAG
#endif // XENIA_KERNEL_MODULES_XBDM_TABLE_H_

View File

@ -0,0 +1,6 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'xboxkrnl.cc',
],
}

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "kernel/modules/xboxkrnl/xboxkrnl.h"
#include "kernel/modules/xboxkrnl/xboxkrnl_table.h"
struct xe_xboxkrnl {
xe_ref_t ref;
};
xe_xboxkrnl_ref xe_xboxkrnl_create(
xe_pal_ref pal, xe_memory_ref memory,
xe_kernel_export_resolver_ref export_resolver) {
xe_xboxkrnl_ref module = (xe_xboxkrnl_ref)xe_calloc(sizeof(xe_xboxkrnl));
xe_ref_init((xe_ref)module);
xe_kernel_export_resolver_register_table(export_resolver, "xboxkrnl.exe",
xe_xboxkrnl_export_table, XECOUNT(xe_xboxkrnl_export_table));
return module;
}
void xe_xboxkrnl_dealloc(xe_xboxkrnl_ref module) {
}
xe_xboxkrnl_ref xe_xboxkrnl_retain(xe_xboxkrnl_ref module) {
xe_ref_retain((xe_ref)module);
return module;
}
void xe_xboxkrnl_release(xe_xboxkrnl_ref module) {
xe_ref_release((xe_ref)module, (xe_ref_dealloc_t)xe_xboxkrnl_dealloc);
}

View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_MODULES_XBOXKRNL_H_
#define XENIA_KERNEL_MODULES_XBOXKRNL_H_
#include <xenia/common.h>
#include <xenia/core.h>
#include <xenia/kernel/export.h>
struct xe_xboxkrnl;
typedef struct xe_xboxkrnl* xe_xboxkrnl_ref;
xe_xboxkrnl_ref xe_xboxkrnl_create(
xe_pal_ref pal, xe_memory_ref memory,
xe_kernel_export_resolver_ref export_resolver);
xe_xboxkrnl_ref xe_xboxkrnl_retain(xe_xboxkrnl_ref module);
void xe_xboxkrnl_release(xe_xboxkrnl_ref module);
#endif // XENIA_KERNEL_MODULES_XBOXKRNL_H_

View File

@ -0,0 +1,885 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_MODULES_XBOXKRNL_TABLE_H_
#define XENIA_KERNEL_MODULES_XBOXKRNL_TABLE_H_
#include <xenia/kernel/export.h>
#define FLAG(t) kXEKernelExportFlag##t
static xe_kernel_export_t xe_xboxkrnl_export_table[] = {
XE_DECLARE_EXPORT(xboxkrnl, 0x00000001, DbgBreakPoint, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000002, DbgBreakPointWithStatus, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000003, DbgPrint, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000004, DbgPrompt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000005, DumpGetRawDumpInfo, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000006, DumpWriteDump, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000007, ExAcquireReadWriteLockExclusive, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000008, ExAcquireReadWriteLockShared, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000009, ExAllocatePool, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000000A, ExAllocatePoolWithTag, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000000B, ExAllocatePoolTypeWithTag, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000000C, ExConsoleGameRegion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000000D, ExCreateThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000000E, ExEventObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000000F, ExFreePool, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000010, ExGetXConfigSetting, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000011, ExInitializeReadWriteLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000012, ExMutantObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000013, ExQueryPoolBlockSize, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000014, ExRegisterThreadNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000015, ExRegisterTitleTerminateNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000016, ExReleaseReadWriteLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000017, ExSemaphoreObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000018, ExSetXConfigSetting, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000019, ExTerminateThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000001A, ExTerminateTitleProcess, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000001B, ExThreadObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000001C, ExTimerObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000001D, MmDoubleMapMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000001E, MmUnmapMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000001F, XeKeysGetConsoleCertificate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000020, FscGetCacheElementCount, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000021, FscSetCacheElementCount, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000022, HalGetCurrentAVPack, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000023, HalGpioControl, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000024, HalOpenCloseODDTray, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000025, HalReadWritePCISpace, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000026, HalRegisterPowerDownNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000027, HalRegisterSMCNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000028, HalReturnToFirmware, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000029, HalSendSMCMessage, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000002A, HalSetAudioEnable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000002B, InterlockedFlushSList, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000002C, InterlockedPopEntrySList, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000002D, InterlockedPushEntrySList, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000002E, IoAcquireDeviceObjectLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000002F, IoAllocateIrp, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000030, IoBuildAsynchronousFsdRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000031, IoBuildDeviceIoControlRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000032, IoBuildSynchronousFsdRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000033, IoCallDriver, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000034, IoCheckShareAccess, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000035, IoCompleteRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000036, IoCompletionObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000037, IoCreateDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000038, IoCreateFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000039, IoDeleteDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000003A, IoDeviceObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000003B, IoDismountVolume, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000003C, IoDismountVolumeByFileHandle, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000003D, IoDismountVolumeByName, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000003E, IoFileObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000003F, IoFreeIrp, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000040, IoInitializeIrp, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000041, IoInvalidDeviceRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000042, ExSetBetaFeaturesEnabled, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000043, IoQueueThreadIrp, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000044, IoReleaseDeviceObjectLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000045, IoRemoveShareAccess, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000046, IoSetIoCompletion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000047, IoSetShareAccess, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000048, IoStartNextPacket, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000049, IoStartNextPacketByKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000004A, IoStartPacket, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000004B, IoSynchronousDeviceIoControlRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000004C, IoSynchronousFsdRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000004D, KeAcquireSpinLockAtRaisedIrql, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000004E, KeAlertResumeThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000004F, KeAlertThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000050, KeBlowFuses, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000051, KeBoostPriorityThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000052, KeBugCheck, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000053, KeBugCheckEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000054, KeCancelTimer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000055, KeConnectInterrupt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000056, KeContextFromKframes, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000057, KeContextToKframes, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000058, KeCreateUserMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000059, KeDebugMonitorData, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000005A, KeDelayExecutionThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000005B, KeDeleteUserMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000005C, KeDisconnectInterrupt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000005D, KeEnableFpuExceptions, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000005E, KeEnablePPUPerformanceMonitor, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000005F, KeEnterCriticalRegion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000060, KeEnterUserMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000061, KeFlushCacheRange, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000062, KeFlushCurrentEntireTb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000063, KeFlushEntireTb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000064, KeFlushUserModeCurrentTb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000065, KeFlushUserModeTb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000066, KeGetCurrentProcessType, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000067, KeGetPMWRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000068, KeGetPRVRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000069, KeGetSocRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000006A, KeGetSpecialPurposeRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000006B, KeLockL2, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000006C, KeUnlockL2, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000006D, KeInitializeApc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000006E, KeInitializeDeviceQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000006F, KeInitializeDpc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000070, KeInitializeEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000071, KeInitializeInterrupt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000072, KeInitializeMutant, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000073, KeInitializeQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000074, KeInitializeSemaphore, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000075, KeInitializeTimerEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000076, KeInsertByKeyDeviceQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000077, KeInsertDeviceQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000078, KeInsertHeadQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000079, KeInsertQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000007A, KeInsertQueueApc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000007B, KeInsertQueueDpc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000007C, KeIpiGenericCall, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000007D, KeLeaveCriticalRegion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000007E, KeLeaveUserMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000007F, KePulseEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000080, KeQueryBackgroundProcessors, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000081, KeQueryBasePriorityThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000082, KeQueryInterruptTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000083, KeQueryPerformanceFrequency, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000084, KeQuerySystemTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000085, KeRaiseIrqlToDpcLevel, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000086, KeRegisterDriverNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000087, KeReleaseMutant, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000088, KeReleaseSemaphore, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000089, KeReleaseSpinLockFromRaisedIrql, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000008A, KeRemoveByKeyDeviceQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000008B, KeRemoveDeviceQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000008C, KeRemoveEntryDeviceQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000008D, KeRemoveQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000008E, KeRemoveQueueDpc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000008F, KeResetEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000090, KeRestoreFloatingPointState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000091, KeRestoreVectorUnitState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000092, KeResumeThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000093, KeRetireDpcList, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000094, KeRundownQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000095, KeSaveFloatingPointState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000096, KeSaveVectorUnitState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000097, KeSetAffinityThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000098, KeSetBackgroundProcessors, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000099, KeSetBasePriorityThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000009A, KeSetCurrentProcessType, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000009B, KeSetCurrentStackPointers, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000009C, KeSetDisableBoostThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000009D, KeSetEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000009E, KeSetEventBoostPriority, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000009F, KeSetPMWRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A0, KeSetPowerMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A1, KeSetPRVRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A2, KeSetPriorityClassThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A3, KeSetPriorityThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A4, KeSetSocRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A5, KeSetSpecialPurposeRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A6, KeSetTimer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A7, KeSetTimerEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A8, KeStallExecutionProcessor, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000A9, KeSuspendThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000AA, KeSweepDcacheRange, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000AB, KeSweepIcacheRange, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000AC, KeTestAlertThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000AD, KeTimeStampBundle, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000AE, KeTryToAcquireSpinLockAtRaisedIrql, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000AF, KeWaitForMultipleObjects, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B0, KeWaitForSingleObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B1, KfAcquireSpinLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B2, KfRaiseIrql, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B3, KfLowerIrql, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B4, KfReleaseSpinLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B5, KiBugCheckData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B6, LDICreateDecompression, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B7, LDIDecompress, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B8, LDIDestroyDecompression, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000B9, MmAllocatePhysicalMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000BA, MmAllocatePhysicalMemoryEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000BB, MmCreateKernelStack, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000BC, MmDeleteKernelStack, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000BD, MmFreePhysicalMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000BE, MmGetPhysicalAddress, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000BF, MmIsAddressValid, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C0, MmLockAndMapSegmentArray, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C1, MmLockUnlockBufferPages, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C2, MmMapIoSpace, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C3, MmPersistPhysicalMemoryAllocation, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C4, MmQueryAddressProtect, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C5, MmQueryAllocationSize, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C6, MmQueryStatistics, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C7, MmSetAddressProtect, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C8, MmSplitPhysicalMemoryAllocation, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000C9, MmUnlockAndUnmapSegmentArray, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000CA, MmUnmapIoSpace, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000CB, Nls844UnicodeCaseTable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000CC, NtAllocateVirtualMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000CD, NtCancelTimer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000CE, NtClearEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000CF, NtClose, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D0, NtCreateDirectoryObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D1, NtCreateEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D2, NtCreateFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D3, NtCreateIoCompletion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D4, NtCreateMutant, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D5, NtCreateSemaphore, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D6, NtCreateSymbolicLinkObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D7, NtCreateTimer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D8, NtDeleteFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000D9, NtDeviceIoControlFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000DA, NtDuplicateObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000DB, NtFlushBuffersFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000DC, NtFreeVirtualMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000DD, NtMakeTemporaryObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000DE, NtOpenDirectoryObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000DF, NtOpenFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E0, NtOpenSymbolicLinkObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E1, NtProtectVirtualMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E2, NtPulseEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E3, NtQueueApcThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E4, NtQueryDirectoryFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E5, NtQueryDirectoryObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E6, NtQueryEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E7, NtQueryFullAttributesFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E8, NtQueryInformationFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000E9, NtQueryIoCompletion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000EA, NtQueryMutant, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000EB, NtQuerySemaphore, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000EC, NtQuerySymbolicLinkObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000ED, NtQueryTimer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000EE, NtQueryVirtualMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000EF, NtQueryVolumeInformationFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F0, NtReadFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F1, NtReadFileScatter, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F2, NtReleaseMutant, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F3, NtReleaseSemaphore, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F4, NtRemoveIoCompletion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F5, NtResumeThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F6, NtSetEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F7, NtSetInformationFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F8, NtSetIoCompletion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000F9, NtSetSystemTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000FA, NtSetTimerEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000FB, NtSignalAndWaitForSingleObjectEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000FC, NtSuspendThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000FD, NtWaitForSingleObjectEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000FE, NtWaitForMultipleObjectsEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000000FF, NtWriteFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000100, NtWriteFileGather, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000101, NtYieldExecution, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000102, ObCreateObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000103, ObCreateSymbolicLink, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000104, ObDeleteSymbolicLink, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000105, ObDereferenceObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000106, ObDirectoryObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000107, ObGetWaitableObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000108, ObInsertObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000109, ObIsTitleObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000010A, ObLookupAnyThreadByThreadId, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000010B, ObLookupThreadByThreadId, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000010C, ObMakeTemporaryObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000010D, ObOpenObjectByName, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000010E, ObOpenObjectByPointer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000010F, ObReferenceObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000110, ObReferenceObjectByHandle, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000111, ObReferenceObjectByName, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000112, ObSymbolicLinkObjectType, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000113, ObTranslateSymbolicLink, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000114, RtlAnsiStringToUnicodeString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000115, RtlAppendStringToString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000116, RtlAppendUnicodeStringToString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000117, RtlAppendUnicodeToString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000118, RtlAssert, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000119, RtlCaptureContext, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000011A, RtlCompareMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000011B, RtlCompareMemoryUlong, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000011C, RtlCompareString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000011D, RtlCompareStringN, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000011E, RtlCompareUnicodeString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000011F, RtlCompareUnicodeStringN, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000120, RtlCompareUtf8ToUnicode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000121, RtlCopyString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000122, RtlCopyUnicodeString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000123, RtlCreateUnicodeString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000124, RtlDowncaseUnicodeChar, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000125, RtlEnterCriticalSection, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000126, RtlFillMemoryUlong, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000127, RtlFreeAnsiString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000128, RtlFreeUnicodeString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000129, RtlGetCallersAddress, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000012A, RtlGetStackLimits, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000012B, RtlImageXexHeaderField, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000012C, RtlInitAnsiString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000012D, RtlInitUnicodeString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000012E, RtlInitializeCriticalSection, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000012F, RtlInitializeCriticalSectionAndSpinCount, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000130, RtlLeaveCriticalSection, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000131, RtlLookupFunctionEntry, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000132, RtlLowerChar, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000133, RtlMultiByteToUnicodeN, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000134, RtlMultiByteToUnicodeSize, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000135, RtlNtStatusToDosError, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000136, RtlRaiseException, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000137, RtlRaiseStatus, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000138, RtlRip, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000139, _scprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000013A, _snprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000013B, sprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000013C, _scwprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000013D, _snwprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000013E, _swprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000013F, RtlTimeFieldsToTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000140, RtlTimeToTimeFields, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000141, RtlTryEnterCriticalSection, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000142, RtlUnicodeStringToAnsiString, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000143, RtlUnicodeToMultiByteN, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000144, RtlUnicodeToMultiByteSize, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000145, RtlUnicodeToUtf8, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000146, RtlUnicodeToUtf8Size, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000147, RtlUnwind, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000148, RtlUnwind2, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000149, RtlUpcaseUnicodeChar, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000014A, RtlUpperChar, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000014B, RtlVirtualUnwind, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000014C, _vscprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000014D, _vsnprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000014E, vsprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000014F, _vscwprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000150, _vsnwprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000151, _vswprintf, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000152, KeTlsAlloc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000153, KeTlsFree, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000154, KeTlsGetValue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000155, KeTlsSetValue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000156, XboxHardwareInfo, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000157, XboxKrnlBaseVersion, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000158, XboxKrnlVersion, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000159, XeCryptAesKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000015A, XeCryptAesEcb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000015B, XeCryptAesCbc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000015C, XeCryptBnDwLeDhEqualBase, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000015D, XeCryptBnDwLeDhInvalBase, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000015E, XeCryptBnDwLeDhModExp, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000015F, XeCryptBnDw_Copy, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000160, XeCryptBnDw_SwapLeBe, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000161, XeCryptBnDw_Zero, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000162, XeCryptBnDwLePkcs1Format, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000163, XeCryptBnDwLePkcs1Verify, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000164, XeCryptBnQwBeSigCreate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000165, XeCryptBnQwBeSigFormat, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000166, XeCryptBnQwBeSigVerify, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000167, XeCryptBnQwNeModExp, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000168, XeCryptBnQwNeModExpRoot, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000169, XeCryptBnQwNeModInv, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000016A, XeCryptBnQwNeModMul, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000016B, XeCryptBnQwNeRsaKeyGen, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000016C, XeCryptBnQwNeRsaPrvCrypt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000016D, XeCryptBnQwNeRsaPubCrypt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000016E, XeCryptBnQw_Copy, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000016F, XeCryptBnQw_SwapDwQw, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000170, XeCryptBnQw_SwapDwQwLeBe, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000171, XeCryptBnQw_SwapLeBe, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000172, XeCryptBnQw_Zero, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000173, XeCryptChainAndSumMac, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000174, XeCryptDesParity, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000175, XeCryptDesKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000176, XeCryptDesEcb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000177, XeCryptDesCbc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000178, XeCryptDes3Key, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000179, XeCryptDes3Ecb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000017A, XeCryptDes3Cbc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000017B, XeCryptHmacMd5Init, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000017C, XeCryptHmacMd5Update, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000017D, XeCryptHmacMd5Final, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000017E, XeCryptHmacMd5, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000017F, XeCryptHmacShaInit, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000180, XeCryptHmacShaUpdate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000181, XeCryptHmacShaFinal, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000182, XeCryptHmacSha, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000183, XeCryptHmacShaVerify, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000184, XeCryptMd5Init, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000185, XeCryptMd5Update, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000186, XeCryptMd5Final, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000187, XeCryptMd5, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000188, XeCryptParveEcb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000189, XeCryptParveCbcMac, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000018A, XeCryptRandom, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000018B, XeCryptRc4Key, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000018C, XeCryptRc4Ecb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000018D, XeCryptRc4, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000018E, XeCryptRotSumSha, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000018F, XeCryptShaInit, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000190, XeCryptShaUpdate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000191, XeCryptShaFinal, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000192, XeCryptSha, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000193, XexExecutableModuleHandle, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000194, XexCheckExecutablePrivilege, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000195, XexGetModuleHandle, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000196, XexGetModuleSection, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000197, XexGetProcedureAddress, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000198, XexLoadExecutable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000199, XexLoadImage, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000019A, XexLoadImageFromMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000019B, XexLoadImageHeaders, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000019C, XexPcToFileHeader, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000019D, KiApcNormalRoutineNop, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000019E, XexRegisterPatchDescriptor, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000019F, XexSendDeferredNotifications, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A0, XexStartExecutable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A1, XexUnloadImage, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A2, XexUnloadImageAndExitThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A3, XexUnloadTitleModules, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A4, XexVerifyImageHeaders, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A5, __C_specific_handler, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A6, DbgLoadImageSymbols, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A7, DbgUnLoadImageSymbols, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A8, RtlImageDirectoryEntryToData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001A9, RtlImageNtHeader, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001AA, ExDebugMonitorService, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001AB, MmDbgReadCheck, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001AC, MmDbgReleaseAddress, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001AD, MmDbgWriteCheck, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001AE, ExLoadedCommandLine, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001AF, ExLoadedImageName, ? , FLAG(Variable)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B0, VdBlockUntilGUIIdle, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B1, VdCallGraphicsNotificationRoutines, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B2, VdDisplayFatalError, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B3, VdEnableClosedCaption, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B4, VdEnableDisableClockGating, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B5, VdEnableDisablePowerSavingMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B6, VdEnableRingBufferRPtrWriteBack, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B7, VdGenerateGPUCSCCoefficients, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B8, VdGetClosedCaptionReadyStatus, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001B9, VdGetCurrentDisplayGamma, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001BA, VdGetCurrentDisplayInformation, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001BB, VdGetDisplayModeOverride, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001BC, VdGetGraphicsAsicID, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001BD, VdGetSystemCommandBuffer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001BE, VdGlobalDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001BF, VdGlobalXamDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C0, VdGpuClockInMHz, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C1, VdHSIOCalibrationLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C2, VdInitializeEngines, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C3, VdInitializeRingBuffer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C4, VdInitializeScaler, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C5, VdInitializeScalerCommandBuffer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C6, VdIsHSIOTrainingSucceeded, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C7, VdPersistDisplay, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C8, VdQuerySystemCommandBuffer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001C9, VdQueryVideoFlags, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001CA, VdQueryVideoMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001CB, VdReadDVERegisterUlong, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001CC, VdReadWriteHSIOCalibrationFlag, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001CD, VdRegisterGraphicsNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001CE, VdRegisterXamGraphicsNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001CF, VdSendClosedCaptionData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D0, VdSetCGMSOption, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D1, VdSetColorProfileAdjustment, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D2, VdSetCscMatricesOverride, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D3, VdSetDisplayMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D4, VdSetDisplayModeOverride, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D5, VdSetGraphicsInterruptCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D6, VdSetHDCPOption, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D7, VdSetMacrovisionOption, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D8, VdSetSystemCommandBuffer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001D9, VdSetSystemCommandBufferGpuIdentifierAddress, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001DA, VdSetWSSData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001DB, VdSetWSSOption, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001DC, VdShutdownEngines, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001DD, VdTurnDisplayOff, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001DE, VdTurnDisplayOn, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001DF, KiApcNormalRoutineNop, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E0, VdWriteDVERegisterUlong, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E1, XVoicedHeadsetPresent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E2, XVoicedSubmitPacket, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E3, XVoicedClose, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E4, XVoicedActivate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E5, XInputdGetCapabilities, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E6, XInputdReadState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E7, XInputdWriteState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E8, XInputdNotify, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001E9, XInputdRawState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001EA, HidGetCapabilities, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001EB, HidReadKeys, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001EC, XInputdGetDeviceStats, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001ED, XInputdResetDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001EE, XInputdSetRingOfLight, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001EF, XInputdSetRFPowerMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F0, XInputdSetRadioFrequency, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F1, HidGetLastInputTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F2, XAudioRenderDriverInitialize, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F3, XAudioRegisterRenderDriverClient, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F4, XAudioUnregisterRenderDriverClient, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F5, XAudioSubmitRenderDriverFrame, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F6, XAudioRenderDriverLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F7, XAudioGetVoiceCategoryVolumeChangeMask, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F8, XAudioGetVoiceCategoryVolume, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001F9, XAudioSetVoiceCategoryVolume, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001FA, XAudioBeginDigitalBypassMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001FB, XAudioEndDigitalBypassMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001FC, XAudioSubmitDigitalPacket, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001FD, XAudioQueryDriverPerformance, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001FE, XAudioGetRenderDriverThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000001FF, XAudioGetSpeakerConfig, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000200, XAudioSetSpeakerConfig, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000201, NicSetUnicastAddress, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000202, NicAttach, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000203, NicDetach, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000204, NicXmit, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000205, NicUpdateMcastMembership, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000206, NicFlushXmitQueue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000207, NicShutdown, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000208, NicGetLinkState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000209, NicGetStats, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000020A, NicGetOpt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000020B, NicSetOpt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000020C, DrvSetSysReqCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000020D, DrvSetUserBindingCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000020E, DrvSetContentStorageCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000020F, DrvSetAutobind, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000210, DrvGetContentStorageNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000211, MtpdBeginTransaction, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000212, MtpdCancelTransaction, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000213, MtpdEndTransaction, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000214, MtpdGetCurrentDevices, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000215, MtpdReadData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000216, MtpdReadEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000217, MtpdResetDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000218, MtpdSendData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000219, MtpdVerifyProximity, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000021A, XUsbcamSetCaptureMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000021B, XUsbcamGetConfig, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000021C, XUsbcamSetConfig, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000021D, XUsbcamGetState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000021E, XUsbcamReadFrame, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000021F, XUsbcamSnapshot, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000220, XUsbcamSetView, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000221, XUsbcamGetView, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000222, XUsbcamCreate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000223, XUsbcamDestroy, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000224, XMACreateContext, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000225, XMAInitializeContext, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000226, XMAReleaseContext, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000227, XMAEnableContext, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000228, XMADisableContext, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000229, XMAGetOutputBufferWriteOffset, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000022A, XMASetOutputBufferReadOffset, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000022B, XMAGetOutputBufferReadOffset, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000022C, XMASetOutputBufferValid, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000022D, XMAIsOutputBufferValid, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000022E, XMASetInputBuffer0Valid, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000022F, XMAIsInputBuffer0Valid, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000230, XMASetInputBuffer1Valid, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000231, XMAIsInputBuffer1Valid, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000232, XMASetInputBuffer0, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000233, XMASetInputBuffer1, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000234, XMAGetPacketMetadata, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000235, XMABlockWhileInUse, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000236, XMASetLoopData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000237, XMASetInputBufferReadOffset, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000238, XMAGetInputBufferReadOffset, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000239, ExIsBetaFeatureEnabled, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000023A, XeKeysGetFactoryChallenge, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000023B, XeKeysSetFactoryResponse, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000023C, XeKeysInitializeFuses, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000023D, XeKeysSaveBootLoader, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000023E, XeKeysSaveKeyVault, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000023F, XeKeysGetStatus, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000240, XeKeysGeneratePrivateKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000241, XeKeysGetKeyProperties, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000242, XeKeysSetKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000243, XeKeysGenerateRandomKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000244, XeKeysGetKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000245, XeKeysGetDigest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000246, XeKeysGetConsoleID, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000247, XeKeysGetConsoleType, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000248, XeKeysQwNeRsaPrvCrypt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000249, XeKeysHmacSha, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000024A, XInputdPassThroughRFCommand, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000024B, XeKeysAesCbc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000024C, XeKeysDes2Cbc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000024D, XeKeysDesCbc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000024E, XeKeysObscureKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000024F, XeKeysHmacShaUsingKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000250, XeKeysSaveBootLoaderEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000251, XeKeysAesCbcUsingKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000252, XeKeysDes2CbcUsingKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000253, XeKeysDesCbcUsingKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000254, XeKeysObfuscate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000255, XeKeysUnObfuscate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000256, XeKeysConsolePrivateKeySign, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000257, XeKeysConsoleSignatureVerification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000258, XeKeysVerifyRSASignature, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000259, StfsCreateDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000025A, StfsControlDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000025B, VdSwap, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000025C, HalFsbInterruptCount, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000025D, XeKeysSaveSystemUpdate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000025E, XeKeysLockSystemUpdate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000025F, XeKeysExecute, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000260, XeKeysGetVersions, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000261, XInputdPowerDownDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000262, AniBlockOnAnimation, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000263, AniTerminateAnimation, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000264, XUsbcamReset, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000265, AniSetLogo, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000266, KeCertMonitorData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000267, HalIsExecutingPowerDownDpc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000268, VdInitializeEDRAM, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000269, VdRetrainEDRAM, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000026A, VdRetrainEDRAMWorker, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000026B, VdHSIOTrainCount, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000026C, HalGetPowerUpCause, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000026D, VdHSIOTrainingStatus, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000026E, RgcBindInfo, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000026F, VdReadEEDIDBlock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000270, VdEnumerateVideoModes, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000271, VdEnableHDCP, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000272, VdRegisterHDCPNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000273, HidReadMouseChanges, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000274, DumpSetCollectionFacility, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000275, XexTransformImageKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000276, XAudioOverrideSpeakerConfig, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000277, XInputdReadTextKeystroke, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000278, DrvXenonButtonPressed, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000279, DrvBindToUser, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000027A, XexGetModuleImportVersions, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000027B, RtlComputeCrc32, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000027C, XeKeysSetRevocationList, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000027D, HalRegisterPowerDownCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000027E, VdGetDisplayDiscoveryData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000027F, XInputdSendStayAliveRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000280, XVoicedSendVPort, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000281, XVoicedGetBatteryStatus, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000282, XInputdFFGetDeviceInfo, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000283, XInputdFFSetEffect, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000284, XInputdFFUpdateEffect, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000285, XInputdFFEffectOperation, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000286, XInputdFFDeviceControl, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000287, XInputdFFSetDeviceGain, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000288, XInputdFFCancelIo, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000289, XInputdFFSetRumble, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000028A, NtAllocateEncryptedMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000028B, NtFreeEncryptedMemory, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000028C, XeKeysExSaveKeyVault, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000028D, XeKeysExSetKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000028E, XeKeysExGetKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000028F, DrvSetDeviceConfigChangeCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000290, DrvDeviceConfigChange, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000291, HalRegisterHdDvdRomNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000292, XeKeysSecurityInitialize, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000293, XeKeysSecurityLoadSettings, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000294, XeKeysSecuritySaveSettings, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000295, XeKeysSecuritySetDetected, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000296, XeKeysSecurityGetDetected, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000297, XeKeysSecuritySetActivated, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000298, XeKeysSecurityGetActivated, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000299, XeKeysDvdAuthAP25InstallTable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000029A, XeKeysDvdAuthAP25GetTableVersion, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000029B, XeKeysGetProtectedFlag, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000029C, XeKeysSetProtectedFlag, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000029D, KeEnablePFMInterrupt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000029E, KeDisablePFMInterrupt, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000029F, KeSetProfilerISR, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A0, VdStartDisplayDiscovery, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A1, VdSetHDCPRevocationList, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A2, XeKeysGetUpdateSequence, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A3, XeKeysDvdAuthExActivate, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A4, KeGetImagePageTableEntry, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A5, HalRegisterBackgroundModeTransitionCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A6, AniStartBootAnimation, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A7, HalClampUnclampOutputDACs, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A8, HalPowerDownToBackgroundMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002A9, HalNotifyAddRemoveBackgroundTask, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002AA, HalCallBackgroundModeNotificationRoutines, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002AB, HalFsbResetCount, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002AC, HalGetMemoryInformation, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002AD, XInputdGetLastTextInputTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002AE, VdEnableWMAProOverHDMI, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002AF, XeKeysRevokeSaveSettings, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B0, XInputdSetTextMessengerIndicator, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B1, MicDeviceRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B2, XeKeysGetMediaID, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B3, XeKeysLoadKeyVault, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B4, KeGetVidInfo, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B5, HalNotifyBackgroundModeTransitionComplete, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B6, IoAcquireCancelSpinLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B7, IoReleaseCancelSpinLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B8, NtCancelIoFile, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002B9, NtCancelIoFileEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002BA, HalFinalizePowerLossRecovery, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002BB, HalSetPowerLossRecovery, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002BC, ExReadModifyWriteXConfigSettingUlong, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002BD, HalRegisterXamPowerDownCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002BE, ExCancelAlarm, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002BF, ExInitializeAlarm, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C0, ExSetAlarm, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C1, XexActivationGetNonce, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C2, XexActivationSetLicense, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C3, IptvSetBoundaryKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C4, IptvSetSessionKey, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C5, IptvVerifyOmac1Signature, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C6, IptvGetAesCtrTransform, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C7, SataCdRomRecordReset, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C8, XInputdSetTextDeviceKeyLocks, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002C9, XInputdGetTextDeviceKeyLocks, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002CA, XexActivationVerifyOwnership, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002CB, XexDisableVerboseDbgPrint, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002CC, SvodCreateDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002CD, RtlCaptureStackBackTrace, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002CE, XeKeysRevokeUpdateDynamic, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002CF, XexImportTraceEnable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D0, ExRegisterXConfigNotification, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D1, XeKeysSecuritySetStat, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D2, VdQueryRealVideoMode, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D3, XexSetExecutablePrivilege, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D4, XAudioSuspendRenderDriverClients, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D5, IptvGetSessionKeyHash, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D6, VdSetCGMSState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D7, VdSetSCMSState, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D8, KeFlushMultipleTb, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002D9, VdGetOption, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002DA, VdSetOption, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002DB, UsbdBootEnumerationDoneEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002DC, StfsDeviceErrorEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002DD, ExTryToAcquireReadWriteLockExclusive, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002DE, ExTryToAcquireReadWriteLockShared, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002DF, XexSetLastKdcTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E0, XInputdControl, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E1, RmcDeviceRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E2, LDIResetDecompression, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E3, NicRegisterDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E4, UsbdAddDeviceComplete, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E5, UsbdCancelAsyncTransfer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E6, UsbdGetDeviceSpeed, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E7, UsbdGetDeviceTopology, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E8, UsbdGetEndpointDescriptor, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002E9, UsbdIsDeviceAuthenticated, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002EA, UsbdOpenDefaultEndpoint, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002EB, UsbdOpenEndpoint, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002EC, UsbdQueueAsyncTransfer, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002ED, UsbdQueueCloseDefaultEndpoint, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002EE, UsbdQueueCloseEndpoint, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002EF, UsbdRemoveDeviceComplete, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F0, KeRemoveQueueApc, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F1, UsbdDriverLoadRequiredEvent, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F2, UsbdGetRequiredDrivers, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F3, UsbdRegisterDriverObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F4, UsbdUnregisterDriverObject, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F5, UsbdCallAndBlockOnDpcRoutine, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F6, UsbdResetDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F7, UsbdGetDeviceDescriptor, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F8, NomnilGetExtension, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002F9, NomnilStartCloseDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002FA, WifiBeginAuthentication, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002FB, WifiCheckCounterMeasures, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002FC, WifiChooseAuthenCipherSetFromBSSID, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002FD, WifiCompleteAuthentication, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002FE, WifiGetAssociationIE, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x000002FF, WifiOnMICError, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000300, WifiPrepareAuthenticationContext, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000301, WifiRecvEAPOLPacket, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000302, WifiDeduceNetworkType, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000303, NicUnregisterDevice, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000304, DumpXitThread, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000305, XInputdSetWifiChannel, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000306, NomnilSetLed, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000307, WifiCalculateRegulatoryDomain, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000308, WifiSelectAdHocChannel, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000309, WifiChannelToFrequency, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000030A, MmGetPoolPagesType, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000030B, ExExpansionInstall, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000030C, ExExpansionCall, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000030D, PsCamDeviceRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000030E, McaDeviceRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000030F, DetroitDeviceRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000310, XeCryptSha256Init, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000311, XeCryptSha256Update, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000312, XeCryptSha256Final, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000313, XeCryptSha256, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000314, XeCryptSha384Init, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000315, XeCryptSha384Update, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000316, XInputdGetDevicePid, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000317, HalGetNotedArgonErrors, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000318, XeCryptSha384Final, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000319, HalReadArgonEeprom, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000031A, HalWriteArgonEeprom, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000031B, XeKeysFcrtLoad, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000031C, XeKeysFcrtSave, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000031D, XeKeysFcrtSet, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000031E, XeCryptSha384, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000031F, XeCryptSha512Init, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000320, XAudioRegisterRenderDriverMECClient, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000321, XAudioUnregisterRenderDriverMECClient, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000322, XAudioCaptureRenderDriverFrame, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000323, XeCryptSha512Update, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000324, XeCryptSha512Final, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000325, XeCryptSha512, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000326, XeCryptBnQwNeCompare, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000327, XVoicedGetDirectionalData, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000328, DrvSetMicArrayStartCallback, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000329, DevAuthGetStatistics, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000032A, NullCableRequest, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000032B, XeKeysRevokeIsDeviceRevoked, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000032C, DumpUpdateDumpSettings, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000032D, EtxConsumerDisableEventType, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000032E, EtxConsumerEnableEventType, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000032F, EtxConsumerProcessLogs, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000330, EtxConsumerRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000331, EtxConsumerUnregister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000332, EtxProducerLog, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000333, EtxProducerLogV, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000334, EtxProducerRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000335, EtxProducerUnregister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000336, EtxConsumerFlushBuffers, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000337, EtxProducerLogXwpp, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000338, EtxProducerLogXwppV, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000339, UsbdEnableDisableRootHubPort, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000033A, EtxBufferRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000033B, EtxBufferUnregister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000033C, DumpRegisterDedicatedDataBlock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000033D, XeKeysDvdAuthExSave, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000033E, XeKeysDvdAuthExInstall, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000033F, XexShimDisable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000340, XexShimEnable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000341, XexShimEntryDisable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000342, XexShimEntryEnable, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000343, XexShimEntryRegister, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000344, XexShimLock, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000345, XboxKrnlVersion4Digit, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000346, XeKeysObfuscateEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000347, XeKeysUnObfuscateEx, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000348, XexTitleHash, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000349, XexTitleHashClose, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000034A, XexTitleHashContinue, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000034B, XexTitleHashOpen, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000034C, XAudioGetRenderDriverTic, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000034D, XAudioEnableDucker, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000034E, XAudioSetDuckerLevel, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000034F, XAudioIsDuckerEnabled, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000350, XAudioGetDuckerLevel, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000351, XAudioGetDuckerThreshold, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000352, XAudioSetDuckerThreshold, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000353, XAudioGetDuckerAttackTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000354, XAudioSetDuckerAttackTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000355, XAudioGetDuckerReleaseTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000356, XAudioSetDuckerReleaseTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000357, XAudioGetDuckerHoldTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000358, XAudioSetDuckerHoldTime, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x00000359, DevAuthShouldAlwaysEnforce, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000035A, XAudioGetUnderrunCount, ? , FLAG(Function)),
XE_DECLARE_EXPORT(xboxkrnl, 0x0000035C, XVoicedIsActiveProcess, ? , FLAG(Function)),
};
#undef FLAG
#endif // XENIA_KERNEL_MODULES_XBOXKRNL_TABLE_H_

13
src/kernel/sources.gypi Normal file
View File

@ -0,0 +1,13 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'export.cc',
'kernel.cc',
'module.cc',
'xex2.cc',
],
'includes': [
'modules/sources.gypi',
],
}

829
src/kernel/xex2.cc Normal file
View File

@ -0,0 +1,829 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/kernel/xex2.h>
#include <third_party/crypto/rijndael-alg-fst.h>
#include <third_party/crypto/rijndael-alg-fst.c>
#include <third_party/mspack/lzx.h>
#include <third_party/mspack/lzxd.c>
#include <third_party/mspack/mspack.h>
typedef struct xe_xex2 {
xe_ref_t ref;
xe_memory_ref memory;
xe_xex2_header_t header;
} xe_xex2_t;
int xe_xex2_read_header(const uint8_t *addr, const size_t length,
xe_xex2_header_t *header);
int xe_xex2_decrypt_key(xe_xex2_header_t *header);
int xe_xex2_read_image(xe_xex2_ref xex,
const uint8_t *xex_addr, const size_t xex_length,
xe_memory_ref memory);
xe_xex2_ref xe_xex2_load(xe_memory_ref memory,
const void* addr, const size_t length,
xe_xex2_options_t options) {
xe_xex2_ref xex = (xe_xex2_ref)xe_calloc(sizeof(xe_xex2));
xe_ref_init((xe_ref)xex);
xex->memory = xe_memory_retain(memory);
XEEXPECTZERO(xe_xex2_read_header((const uint8_t*)addr, length, &xex->header));
XEEXPECTZERO(xe_xex2_decrypt_key(&xex->header));
XEEXPECTZERO(xe_xex2_read_image(xex, (const uint8_t*)addr, length, memory));
return xex;
XECLEANUP:
xe_xex2_release(xex);
return NULL;
}
void xe_xex2_dealloc(xe_xex2_ref xex) {
xe_xex2_header_t *header = &xex->header;
xe_free(header->sections);
if (header->file_format_info.compression_type == XEX_COMPRESSION_BASIC) {
xe_free(header->file_format_info.compression_info.basic.blocks);
}
for (size_t n = 0; n < header->import_library_count; n++) {
xe_xex2_import_library_t *library = &header->import_libraries[n];
xe_free(library->records);
}
xe_memory_release(xex->memory);
}
xe_xex2_ref xe_xex2_retain(xe_xex2_ref xex) {
xe_ref_retain((xe_ref)xex);
return xex;
}
void xe_xex2_release(xe_xex2_ref xex) {
xe_ref_release((xe_ref)xex, (xe_ref_dealloc_t)xe_xex2_dealloc);
}
const xechar_t* xe_xex2_get_name(xe_xex2_ref xex) {
// TODO(benvanik): get name.
return NULL;
}
const xe_xex2_header_t* xe_xex2_get_header(xe_xex2_ref xex) {
return &xex->header;
}
int xe_xex2_read_header(const uint8_t *addr, const size_t length,
xe_xex2_header_t *header) {
const uint8_t *p = addr;
const uint8_t *pc;
const uint8_t *ps;
xe_xex2_loader_info_t *ldr;
header->xex2 = XEGETUINT32BE(p + 0x00);
if (header->xex2 != 0x58455832) {
return 1;
}
header->module_flags = (xe_xex2_module_flags)XEGETUINT32BE(p + 0x04);
header->exe_offset = XEGETUINT32BE(p + 0x08);
header->unknown0 = XEGETUINT32BE(p + 0x0C);
header->certificate_offset = XEGETUINT32BE(p + 0x10);
header->header_count = XEGETUINT32BE(p + 0x14);
for (size_t n = 0; n < header->header_count; n++) {
const uint8_t *ph = p + 0x18 + (n * 8);
const uint32_t key = XEGETUINT32BE(ph + 0x00);
const uint32_t data_offset = XEGETUINT32BE(ph + 0x04);
xe_xex2_opt_header_t *opt_header = &header->headers[n];
opt_header->key = key;
switch (key & 0xFF) {
case 0x01:
// dataOffset = data
opt_header->length = 0;
opt_header->value = data_offset;
break;
case 0xFF:
// dataOffset = offset (first dword in data is size)
opt_header->length = XEGETUINT32BE(p + data_offset);
opt_header->offset = data_offset;
break;
default:
// dataOffset = size in dwords
opt_header->length = (key & 0xFF) * 4;
opt_header->offset = data_offset;
break;
}
const uint8_t *pp = p + opt_header->offset;
switch (opt_header->key) {
case XEX_HEADER_SYSTEM_FLAGS:
header->system_flags = (xe_xex2_system_flags)data_offset;
break;
case XEX_HEADER_RESOURCE_INFO:
{
xe_xex2_resource_info_t *res = &header->resource_info;
XEEXPECTZERO(xe_copy_memory(res->title_id,
sizeof(res->title_id), pp + 0x04, 8));
res->address = XEGETUINT32BE(pp + 0x0C);
res->size = XEGETUINT32BE(pp + 0x10);
if ((opt_header->length - 4) / 16 > 1) {
// Ignoring extra resources (not yet seen)
XELOGW(XT("ignoring extra XEX_HEADER_RESOURCE_INFO resources"));
}
}
break;
case XEX_HEADER_EXECUTION_INFO:
{
xe_xex2_execution_info_t *ex = &header->execution_info;
ex->media_id = XEGETUINT32BE(pp + 0x00);
ex->version.value = XEGETUINT32BE(pp + 0x04);
ex->base_version.value = XEGETUINT32BE(pp + 0x08);
ex->title_id = XEGETUINT32BE(pp + 0x0C);
ex->platform = XEGETUINT8BE(pp + 0x10);
ex->executable_table = XEGETUINT8BE(pp + 0x11);
ex->disc_number = XEGETUINT8BE(pp + 0x12);
ex->disc_count = XEGETUINT8BE(pp + 0x13);
ex->savegame_id = XEGETUINT32BE(pp + 0x14);
}
break;
case XEX_HEADER_GAME_RATINGS:
{
xe_xex2_game_ratings_t *ratings = &header->game_ratings;
ratings->esrb = (xe_xex2_rating_esrb_value)XEGETUINT8BE(pp + 0x00);
ratings->pegi = (xe_xex2_rating_pegi_value)XEGETUINT8BE(pp + 0x01);
ratings->pegifi = (xe_xex2_rating_pegi_fi_value)XEGETUINT8BE(pp + 0x02);
ratings->pegipt = (xe_xex2_rating_pegi_pt_value)XEGETUINT8BE(pp + 0x03);
ratings->bbfc = (xe_xex2_rating_bbfc_value)XEGETUINT8BE(pp + 0x04);
ratings->cero = (xe_xex2_rating_cero_value)XEGETUINT8BE(pp + 0x05);
ratings->usk = (xe_xex2_rating_usk_value)XEGETUINT8BE(pp + 0x06);
ratings->oflcau = (xe_xex2_rating_oflc_au_value)XEGETUINT8BE(pp + 0x07);
ratings->oflcnz = (xe_xex2_rating_oflc_nz_value)XEGETUINT8BE(pp + 0x08);
ratings->kmrb = (xe_xex2_rating_kmrb_value)XEGETUINT8BE(pp + 0x09);
ratings->brazil = (xe_xex2_rating_brazil_value)XEGETUINT8BE(pp + 0x0A);
ratings->fpb = (xe_xex2_rating_fpb_value)XEGETUINT8BE(pp + 0x0B);
}
break;
case XEX_HEADER_TLS_INFO:
{
xe_xex2_tls_info_t *tls = &header->tls_info;
tls->slot_count = XEGETUINT32BE(pp + 0x00);
tls->raw_data_address = XEGETUINT32BE(pp + 0x04);
tls->data_size = XEGETUINT32BE(pp + 0x08);
tls->raw_data_size = XEGETUINT32BE(pp + 0x0C);
}
break;
case XEX_HEADER_IMAGE_BASE_ADDRESS:
header->exe_address = opt_header->value;
break;
case XEX_HEADER_ENTRY_POINT:
header->exe_entry_point = opt_header->value;
break;
case XEX_HEADER_DEFAULT_STACK_SIZE:
header->exe_stack_size = opt_header->value;
break;
case XEX_HEADER_DEFAULT_HEAP_SIZE:
header->exe_heap_size = opt_header->value;
break;
case XEX_HEADER_IMPORT_LIBRARIES:
{
const size_t max_count = XECOUNT(header->import_libraries);
size_t count = XEGETUINT32BE(pp + 0x08);
XEASSERT(count <= max_count);
if (count > max_count) {
XELOGW(XT("ignoring %zu extra entries in "
"XEX_HEADER_IMPORT_LIBRARIES"), (max_count - count));
count = max_count;
}
header->import_library_count = count;
uint32_t string_table_size = XEGETUINT32BE(pp + 0x04);
const char *string_table = (const char*)(pp + 0x0C);
pp += 12 + string_table_size;
for (size_t m = 0; m < count; m++) {
xe_xex2_import_library_t *library = &header->import_libraries[m];
XEEXPECTZERO(xe_copy_memory(library->digest, sizeof(library->digest),
pp + 0x04, 20));
library->import_id = XEGETUINT32BE(pp + 0x18);
library->version.value = XEGETUINT32BE(pp + 0x1C);
library->min_version.value = XEGETUINT32BE(pp + 0x20);
const uint16_t name_index = XEGETUINT16BE(pp + 0x24);
for (size_t i = 0, j = 0; i < string_table_size;) {
if (j == name_index) {
XEIGNORE(xestrcpya(library->name, XECOUNT(library->name),
string_table + i));
break;
}
if (string_table[i] == 0) {
i++;
if (i % 4) {
i += 4 - (i % 4);
}
j++;
} else {
i++;
}
}
library->record_count = XEGETUINT16BE(pp + 0x26);
library->records = (uint32_t*)xe_calloc(
library->record_count * sizeof(uint32_t));
XEEXPECTNOTNULL(library->records);
pp += 0x28;
for (size_t i = 0; i < library->record_count; i++) {
library->records[i] = XEGETUINT32BE(pp);
pp += 4;
}
}
}
break;
case XEX_HEADER_STATIC_LIBRARIES:
{
const size_t max_count = XECOUNT(header->static_libraries);
size_t count = (opt_header->length - 4) / 16;
XEASSERT(count <= max_count);
if (count > max_count) {
XELOGW(XT("ignoring %zu extra entries in "
"XEX_HEADER_STATIC_LIBRARIES"), (max_count - count));
count = max_count;
}
header->static_library_count = count;
pp += 4;
for (size_t m = 0; m < count; m++) {
xe_xex2_static_library_t *library = &header->static_libraries[m];
XEEXPECTZERO(xe_copy_memory(library->name, sizeof(library->name),
pp + 0x00, 8));
library->name[8] = 0;
library->major = XEGETUINT16BE(pp + 0x08);
library->minor = XEGETUINT16BE(pp + 0x0A);
library->build = XEGETUINT16BE(pp + 0x0C);
uint16_t qfeapproval = XEGETUINT16BE(pp + 0x0E);
library->approval = (xe_xex2_approval_type)(qfeapproval & 0x8000);
library->qfe = qfeapproval & ~0x8000;
pp += 16;
}
}
break;
case XEX_HEADER_FILE_FORMAT_INFO:
{
xe_xex2_file_format_info_t *fmt = &header->file_format_info;
fmt->encryption_type =
(xe_xex2_encryption_type)XEGETUINT16BE(pp + 0x04);
fmt->compression_type =
(xe_xex2_compression_type)XEGETUINT16BE(pp + 0x06);
switch (fmt->compression_type) {
case XEX_COMPRESSION_NONE:
// TODO: XEX_COMPRESSION_NONE
XEASSERTALWAYS();
break;
case XEX_COMPRESSION_BASIC:
{
xe_xex2_file_basic_compression_info_t *comp_info =
&fmt->compression_info.basic;
uint32_t info_size = XEGETUINT32BE(pp + 0x00);
comp_info->block_count = (info_size - 8) / 8;
comp_info->blocks = (xe_xex2_file_basic_compression_block_t*)
xe_calloc(comp_info->block_count *
sizeof(xe_xex2_file_basic_compression_block_t));
XEEXPECTNOTNULL(comp_info->blocks);
for (size_t m = 0; m < comp_info->block_count; m++) {
xe_xex2_file_basic_compression_block_t *block =
&comp_info->blocks[m];
block->data_size = XEGETUINT32BE(pp + 0x08 + (m * 8));
block->zero_size = XEGETUINT32BE(pp + 0x0C + (m * 8));
}
}
break;
case XEX_COMPRESSION_NORMAL:
{
xe_xex2_file_normal_compression_info_t *comp_info =
&fmt->compression_info.normal;
uint32_t window_size = XEGETUINT32BE(pp + 0x08);
uint32_t window_bits = 0;
for (size_t m = 0; m < 32; m++, window_bits++) {
window_size <<= 1;
if (window_size == 0x80000000) {
break;
}
}
comp_info->window_size = XEGETUINT32BE(pp + 0x08);
comp_info->window_bits = window_bits;
comp_info->block_size = XEGETUINT32BE(pp + 0x0C);
XEEXPECTZERO(xe_copy_memory(comp_info->block_hash,
sizeof(comp_info->block_hash),
pp + 0x10, 20));
}
break;
case XEX_COMPRESSION_DELTA:
// TODO: XEX_COMPRESSION_DELTA
XEASSERTALWAYS();
break;
}
}
break;
}
}
// Loader info.
pc = p + header->certificate_offset;
ldr = &header->loader_info;
ldr->header_size = XEGETUINT32BE(pc + 0x000);
ldr->image_size = XEGETUINT32BE(pc + 0x004);
XEEXPECTZERO(xe_copy_memory(ldr->rsa_signature, sizeof(ldr->rsa_signature),
pc + 0x008, 256));
ldr->unklength = XEGETUINT32BE(pc + 0x108);
ldr->image_flags = (xe_xex2_image_flags)XEGETUINT32BE(pc + 0x10C);
ldr->load_address = XEGETUINT32BE(pc + 0x110);
XEEXPECTZERO(xe_copy_memory(ldr->section_digest, sizeof(ldr->section_digest),
pc + 0x114, 20));
ldr->import_table_count = XEGETUINT32BE(pc + 0x128);
XEEXPECTZERO(xe_copy_memory(ldr->import_table_digest,
sizeof(ldr->import_table_digest),
pc + 0x12C, 20));
XEEXPECTZERO(xe_copy_memory(ldr->media_id, sizeof(ldr->media_id),
pc + 0x140, 16));
XEEXPECTZERO(xe_copy_memory(ldr->file_key, sizeof(ldr->file_key),
pc + 0x150, 16));
ldr->export_table = XEGETUINT32BE(pc + 0x160);
XEEXPECTZERO(xe_copy_memory(ldr->header_digest, sizeof(ldr->header_digest),
pc + 0x164, 20));
ldr->game_regions = (xe_xex2_region_flags)XEGETUINT32BE(pc + 0x178);
ldr->media_flags = (xe_xex2_media_flags)XEGETUINT32BE(pc + 0x17C);
// Section info follows loader info.
ps = p + header->certificate_offset + 0x180;
header->section_count = XEGETUINT32BE(ps + 0x000);
ps += 4;
header->sections = (xe_xex2_section_t*)xe_calloc(
header->section_count * sizeof(xe_xex2_section_t));
XEEXPECTNOTNULL(header->sections);
for (size_t n = 0; n < header->section_count; n++) {
xe_xex2_section_t *section = &header->sections[n];
section->info.value = XEGETUINT32BE(ps);
ps += 4;
XEEXPECTZERO(xe_copy_memory(section->digest, sizeof(section->digest), ps,
sizeof(section->digest)));
ps += sizeof(section->digest);
}
return 0;
XECLEANUP:
return 1;
}
int xe_xex2_decrypt_key(xe_xex2_header_t *header) {
const static uint8_t xe_xex2_retail_key[16] = {
0x20, 0xB1, 0x85, 0xA5, 0x9D, 0x28, 0xFD, 0xC3,
0x40, 0x58, 0x3F, 0xBB, 0x08, 0x96, 0xBF, 0x91
};
const static uint8_t xe_xex2_devkit_key[16] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// Guess key based on file info.
// TODO: better way to finding out which key to use?
const uint8_t *xexkey;
if (header->file_format_info.compression_type == XEX_COMPRESSION_NORMAL &&
header->file_format_info.encryption_type == XEX_ENCRYPTION_NORMAL) {
xexkey = xe_xex2_retail_key;
} else {
xexkey = xe_xex2_devkit_key;
}
// Decrypt the header key.
uint32_t rk[4 * (MAXNR + 1)];
int32_t Nr = rijndaelKeySetupDec(rk, xexkey, 128);
rijndaelDecrypt(rk, Nr,
header->loader_info.file_key, header->session_key);
return 0;
}
typedef struct mspack_memory_file_t {
struct mspack_system sys;
void *buffer;
off_t buffer_size;
off_t offset;
} mspack_memory_file;
mspack_memory_file *mspack_memory_open(struct mspack_system *sys,
void* buffer, const size_t buffer_size) {
XEASSERT(buffer_size < INT_MAX);
if (buffer_size >= INT_MAX) {
return NULL;
}
mspack_memory_file *memfile = (mspack_memory_file*)xe_calloc(
sizeof(mspack_memory_file));
if (!memfile) {
return NULL;
}
memfile->buffer = buffer;
memfile->buffer_size = (off_t)buffer_size;
memfile->offset = 0;
return memfile;
}
void mspack_memory_close(mspack_memory_file *file) {
mspack_memory_file *memfile = (mspack_memory_file*)file;
xe_free(memfile);
}
int mspack_memory_read(struct mspack_file *file, void *buffer, int chars) {
mspack_memory_file *memfile = (mspack_memory_file*)file;
const off_t remaining = memfile->buffer_size - memfile->offset;
const off_t total = MIN(chars, remaining);
if (xe_copy_memory(buffer, total,
(uint8_t*)memfile->buffer + memfile->offset, total)) {
return -1;
}
memfile->offset += total;
return (int)total;
}
int mspack_memory_write(struct mspack_file *file, void *buffer, int chars) {
mspack_memory_file *memfile = (mspack_memory_file*)file;
const off_t remaining = memfile->buffer_size - memfile->offset;
const off_t total = MIN(chars, remaining);
if (xe_copy_memory((uint8_t*)memfile->buffer + memfile->offset,
memfile->buffer_size - memfile->offset, buffer, total)) {
return -1;
}
memfile->offset += total;
return (int)total;
}
void *mspack_memory_alloc(struct mspack_system *sys, size_t chars) {
XEUNREFERENCED(sys);
return xe_calloc(chars);
}
void mspack_memory_free(void *ptr) {
xe_free(ptr);
}
void mspack_memory_copy(void *src, void *dest, size_t chars) {
xe_copy_memory(dest, chars, src, chars);
}
struct mspack_system *mspack_memory_sys_create() {
struct mspack_system *sys = (struct mspack_system *)xe_calloc(
sizeof(struct mspack_system));
if (!sys) {
return NULL;
}
sys->read = mspack_memory_read;
sys->write = mspack_memory_write;
sys->alloc = mspack_memory_alloc;
sys->free = mspack_memory_free;
sys->copy = mspack_memory_copy;
return sys;
}
void mspack_memory_sys_destroy(struct mspack_system *sys) {
xe_free(sys);
}
void xe_xex2_decrypt_buffer(const uint8_t *session_key,
const uint8_t *input_buffer,
const size_t input_size, uint8_t* output_buffer,
const size_t output_size) {
uint32_t rk[4 * (MAXNR + 1)];
uint8_t ivec[16] = {0};
int32_t Nr = rijndaelKeySetupDec(rk, session_key, 128);
const uint8_t *ct = input_buffer;
uint8_t* pt = output_buffer;
for (size_t n = 0; n < input_size; n += 16, ct += 16, pt += 16) {
// Decrypt 16 uint8_ts from input -> output.
rijndaelDecrypt(rk, Nr, ct, pt);
for (size_t i = 0; i < 16; i++) {
// XOR with previous.
pt[i] ^= ivec[i];
// Set previous.
ivec[i] = ct[i];
}
}
}
int xe_xex2_read_image_uncompressed(const xe_xex2_header_t *header,
const uint8_t *xex_addr,
const size_t xex_length,
xe_memory_ref memory) {
uint8_t *buffer = (uint8_t*)xe_memory_addr(memory, header->exe_address);
size_t buffer_size = 0x40000000;
const size_t exe_length = xex_length - header->exe_offset;
const uint8_t *p = (const uint8_t*)xex_addr + header->exe_offset;
switch (header->file_format_info.encryption_type) {
case XEX_ENCRYPTION_NONE:
return xe_copy_memory(buffer, buffer_size, p, exe_length);
case XEX_ENCRYPTION_NORMAL:
xe_xex2_decrypt_buffer(header->session_key, p, exe_length, buffer,
buffer_size);
return 0;
default:
XEASSERTALWAYS();
return 1;
}
return 0;
}
int xe_xex2_read_image_basic_compressed(const xe_xex2_header_t *header,
const uint8_t *xex_addr,
const size_t xex_length,
xe_memory_ref memory) {
uint8_t *buffer = (uint8_t*)xe_memory_addr(memory, header->exe_address);
size_t buffer_size = 0x40000000;
const size_t exe_length = xex_length - header->exe_offset;
const uint8_t* source_buffer = (const uint8_t*)xex_addr + header->exe_offset;
const uint8_t *p = source_buffer;
uint8_t *d = buffer;
uint32_t rk[4 * (MAXNR + 1)];
uint8_t ivec[16] = {0};
int32_t Nr = rijndaelKeySetupDec(rk, header->session_key, 128);
const xe_xex2_file_basic_compression_info_t* comp_info =
&header->file_format_info.compression_info.basic;
for (size_t n = 0; n < comp_info->block_count; n++) {
const size_t data_size = comp_info->blocks[n].data_size;
const size_t zero_size = comp_info->blocks[n].zero_size;
switch (header->file_format_info.encryption_type) {
case XEX_ENCRYPTION_NONE:
XEEXPECTZERO(xe_copy_memory(d, buffer_size - (d - buffer), p,
exe_length - (p - source_buffer)));
break;
case XEX_ENCRYPTION_NORMAL:
{
const uint8_t *ct = p;
uint8_t* pt = d;
for (size_t n = 0; n < data_size; n += 16, ct += 16, pt += 16) {
// Decrypt 16 uint8_ts from input -> output.
rijndaelDecrypt(rk, Nr, ct, pt);
for (size_t i = 0; i < 16; i++) {
// XOR with previous.
pt[i] ^= ivec[i];
// Set previous.
ivec[i] = ct[i];
}
}
}
break;
default:
XEASSERTALWAYS();
return 1;
}
p += data_size;
d += data_size + zero_size;
}
return 0;
XECLEANUP:
return 1;
}
int xe_xex2_read_image_compressed(const xe_xex2_header_t *header,
const uint8_t *xex_addr,
const size_t xex_length,
xe_memory_ref memory) {
uint8_t *buffer = (uint8_t*)xe_memory_addr(memory, header->exe_address);
size_t buffer_size = 0x40000000;
const size_t exe_length = xex_length - header->exe_offset;
const uint8_t *exe_buffer = (const uint8_t*)xex_addr + header->exe_offset;
// src -> dest:
// - decrypt (if encrypted)
// - de-block:
// 4b total size of next block in uint8_ts
// 20b hash of entire next block (including size/hash)
// Nb block uint8_ts
// - decompress block contents
int result_code = 1;
uint8_t *compress_buffer = NULL;
const uint8_t *p = NULL;
uint8_t *d = NULL;
uint8_t *deblock_buffer = NULL;
size_t block_size = 0;
struct mspack_system *sys = NULL;
mspack_memory_file *lzxsrc = NULL;
mspack_memory_file *lzxdst = NULL;
struct lzxd_stream *lzxd = NULL;
// Decrypt (if needed).
bool free_input = false;
const uint8_t *input_buffer = exe_buffer;
const size_t input_size = exe_length;
switch (header->file_format_info.encryption_type) {
case XEX_ENCRYPTION_NONE:
// No-op.
break;
case XEX_ENCRYPTION_NORMAL:
// TODO: a way to do without a copy/alloc?
free_input = true;
input_buffer = (const uint8_t*)xe_calloc(input_size);
XEEXPECTNOTNULL(input_buffer);
xe_xex2_decrypt_buffer(header->session_key, exe_buffer, exe_length,
(uint8_t*)input_buffer, input_size);
break;
default:
XEASSERTALWAYS();
return false;
}
compress_buffer = (uint8_t*)xe_calloc(exe_length);
XEEXPECTNOTNULL(compress_buffer);
p = input_buffer;
d = compress_buffer;
// De-block.
deblock_buffer = (uint8_t*)xe_calloc(input_size);
XEEXPECTNOTNULL(deblock_buffer);
block_size = header->file_format_info.compression_info.normal.block_size;
while (block_size) {
const uint8_t *pnext = p + block_size;
const size_t next_size = XEGETINT32BE(p);
p += 4;
p += 20; // skip 20b hash
while(true) {
const size_t chunk_size = (p[0] << 8) | p[1];
p += 2;
if (!chunk_size) {
break;
}
xe_copy_memory(d, exe_length - (d - compress_buffer), p, chunk_size);
p += chunk_size;
d += chunk_size;
}
p = pnext;
block_size = next_size;
}
// Setup decompressor and decompress.
sys = mspack_memory_sys_create();
XEEXPECTNOTNULL(sys);
lzxsrc = mspack_memory_open(sys, (void*)compress_buffer, d - compress_buffer);
XEEXPECTNOTNULL(lzxsrc);
lzxdst = mspack_memory_open(sys, buffer, buffer_size);
XEEXPECTNOTNULL(lzxdst);
lzxd = lzxd_init(
sys,
(struct mspack_file *)lzxsrc,
(struct mspack_file *)lzxdst,
header->file_format_info.compression_info.normal.window_bits,
0,
32768,
(off_t)header->loader_info.image_size);
XEEXPECTNOTNULL(lzxd);
XEEXPECTZERO(lzxd_decompress(lzxd, (off_t)header->loader_info.image_size));
result_code = 0;
XECLEANUP:
if (lzxd) {
lzxd_free(lzxd);
lzxd = NULL;
}
if (lzxsrc) {
mspack_memory_close(lzxsrc);
lzxsrc = NULL;
}
if (lzxdst) {
mspack_memory_close(lzxdst);
lzxdst = NULL;
}
if (sys) {
mspack_memory_sys_destroy(sys);
sys = NULL;
}
xe_free(compress_buffer);
xe_free(deblock_buffer);
if (free_input) {
xe_free((void*)input_buffer);
}
return result_code;
}
int xe_xex2_read_image(xe_xex2_ref xex, const uint8_t *xex_addr,
const size_t xex_length, xe_memory_ref memory) {
const xe_xex2_header_t *header = &xex->header;
switch (header->file_format_info.compression_type) {
case XEX_COMPRESSION_NONE:
return xe_xex2_read_image_uncompressed(
header, xex_addr, xex_length, memory);
case XEX_COMPRESSION_BASIC:
return xe_xex2_read_image_basic_compressed(
header, xex_addr, xex_length, memory);
case XEX_COMPRESSION_NORMAL:
return xe_xex2_read_image_compressed(
header, xex_addr, xex_length, memory);
default:
XEASSERTALWAYS();
return 1;
}
}
int xe_xex2_get_import_infos(xe_xex2_ref xex,
const xe_xex2_import_library_t *library,
xe_xex2_import_info_t **out_import_infos,
size_t *out_import_info_count) {
uint8_t *mem = (uint8_t*)xe_memory_addr(xex->memory, 0);
const xe_xex2_header_t *header = xe_xex2_get_header(xex);
// Find library index for verification.
size_t library_index = -1;
for (size_t n = 0; n < header->import_library_count; n++) {
if (&header->import_libraries[n] == library) {
library_index = n;
break;
}
}
XEASSERT(library_index != (size_t)-1);
// Records:
// The number of records does not correspond to the number of imports!
// Each record points at either a location in text or data - dereferencing the
// pointer will yield a value that & 0xFFFF = the import ordinal,
// >> 16 & 0xFF = import library index, and >> 24 & 0xFF = 0 if a variable
// (just get address) or 1 if a thunk (needs rewrite).
// Calculate real count.
size_t info_count = 0;
for (size_t n = 0; n < library->record_count; n++) {
const uint32_t record = library->records[n];
const uint32_t value = XEGETUINT32BE(mem + record);
if (value & 0xFF000000) {
// Thunk for previous record - ignore.
} else {
// Variable/thunk.
info_count++;
}
}
// Allocate storage.
xe_xex2_import_info_t *infos = (xe_xex2_import_info_t*)xe_calloc(
info_count * sizeof(xe_xex2_import_info_t));
XEEXPECTNOTNULL(infos);
// Construct infos.
for (size_t n = 0, i = 0; n < library->record_count; n++) {
const uint32_t record = library->records[n];
const uint32_t value = XEGETUINT32BE(mem + record);
const uint32_t type = (value & 0xFF000000) >> 24;
// Verify library index matches given library.
XEASSERT(library_index == ((value >> 16) & 0xFF));
switch (type) {
case 0x00:
{
xe_xex2_import_info_t* info = &infos[i++];
info->ordinal = value & 0xFFFF;
info->value_address = record;
}
break;
case 0x01:
{
// Thunk for previous record.
XEASSERT(i > 0);
xe_xex2_import_info_t* info = &infos[i - 1];
XEASSERT(info->ordinal == (value & 0xFFFF));
info->thunk_address = record;
}
break;
default:
XEASSERTALWAYS();
break;
}
}
*out_import_info_count = info_count;
*out_import_infos = infos;
return 0;
XECLEANUP:
xe_free(infos);
*out_import_info_count = 0;
*out_import_infos = NULL;
return 1;
}

59
src/xenia/logging.cc Normal file
View File

@ -0,0 +1,59 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/logging.h>
#include <xenia/common.h>
void xe_log_line(const xechar_t* file_path, const uint32_t line_number,
const xechar_t* function_name, const xechar_t level_char,
const xechar_t* fmt, ...) {
const int kLogMax = 2048;
// Strip out just the filename from the path.
const xechar_t* filename = xestrrchr(file_path, XE_PATH_SEPARATOR);
if (filename) {
// Slash - skip over it.
filename++;
} else {
// No slash, entire thing is filename.
filename = file_path;
}
// Scribble args into the print buffer.
va_list args;
va_start(args, fmt);
xechar_t buffer[kLogMax];
int buffer_length = xevsnprintf(buffer, XECOUNT(buffer), fmt, args);
va_end(args);
if (buffer_length < 0) {
return;
}
// Format string - add a trailing newline if required.
const xechar_t* outfmt;
if ((buffer_length >= 1) && buffer[buffer_length - 1] == '\n') {
outfmt = XT("XE[%c] %s:%d: %s");
} else {
outfmt = XT("XE[%c] %s:%d: %s\n");
}
#if defined(OutputDebugString)
xechar_t full_output[kLogMax];
if (xesnprintf(full_output, XECOUNT(buffer), outfmt, level_char,
filename, line_number, buffer) >= 0) {
OutputDebugString(full_output);
}
#elif defined(XE_WCHAR)
XEIGNORE(fwprintf(stdout, outfmt, level_char, filename, line_number, buffer));
#else
XEIGNORE(fprintf(stdout, outfmt, level_char, filename, line_number, buffer));
#endif // OutputDebugString
}

137
src/xenia/malloc.cc Normal file
View File

@ -0,0 +1,137 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/malloc.h>
#include <xenia/common.h>
void *xe_malloc(const size_t size) {
// Some platforms return NULL from malloc with size zero.
if (!size) {
return malloc(1);
}
return malloc(size);
}
void *xe_calloc(const size_t size) {
// Some platforms return NULL from malloc with size zero.
if (!size) {
return calloc(1, 1);
}
return calloc(1, size);
}
void* xe_realloc(void *ptr, const size_t old_size, const size_t new_size) {
if (!ptr) {
// Support realloc as malloc.
return malloc(new_size);
}
if (old_size == new_size) {
// No-op.
return ptr;
}
if (!new_size) {
// Zero-size realloc, return a dummy buffer for platforms that don't support
// zero-size allocs.
void *dummy = malloc(1);
if (!dummy) {
return NULL;
}
xe_free(ptr);
return dummy;
}
return realloc(ptr, new_size);
}
void* xe_recalloc(void *ptr, const size_t old_size, const size_t new_size) {
if (!ptr) {
// Support realloc as malloc.
return calloc(1, new_size);
}
if (old_size == new_size) {
// No-op.
return ptr;
}
if (!new_size) {
// Zero-size realloc, return a dummy buffer for platforms that don't support
// zero-size allocs.
void *dummy = calloc(1, 1);
if (!dummy) {
return NULL;
}
xe_free(ptr);
return dummy;
}
void *result = realloc(ptr, new_size);
if (!result) {
return NULL;
}
// Zero out new memory.
if (new_size > old_size) {
xe_zero_memory(result, new_size, old_size, new_size - old_size);
}
return result;
}
void xe_free(void *ptr) {
if (ptr) {
free(ptr);
}
}
xe_aligned_void_t *xe_malloc_aligned(const size_t size) {
// TODO(benvanik): validate every platform is aligned to XE_ALIGNMENT.
return xe_malloc(size);
}
void xe_free_aligned(xe_aligned_void_t *ptr) {
xe_free((void*)ptr);
}
int xe_zero_struct(void *ptr, const size_t size) {
return xe_zero_memory(ptr, size, 0, size);
}
int xe_zero_memory(void *ptr, const size_t size, const size_t offset,
const size_t length) {
// TODO(benvanik): validate sizing/clamp.
if (!ptr || !length) {
return 0;
}
if (offset + length > size) {
return 1;
}
memset((uint8_t*)ptr + offset, 0, length);
return 0;
}
int xe_copy_struct(void *dest, const void *source, const size_t size) {
return xe_copy_memory(dest, size, source, size);
}
int xe_copy_memory(void *dest, const size_t dest_size, const void *source,
const size_t source_size) {
// TODO(benvanik): validate sizing.
if (!source_size) {
return 0;
}
if (!dest || !source) {
return 1;
}
if (dest_size < source_size) {
return 1;
}
memcpy(dest, source, source_size);
return 0;
}

7
src/xenia/sources.gypi Normal file
View File

@ -0,0 +1,7 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'logging.cc',
'malloc.cc',
],
}

View File

@ -1295,7 +1295,7 @@ void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], in
(Te4[(s1 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(s1 >> 8) & 0xff] & 0x0000ff00) ^
(Te4[(s2 ) & 0xff] & 0x000000ff) ^ (Te4[(s2 ) & 0xff] & 0x000000ff) ^
rk[3]; rk[3];
s0 = t0; s0 = t0;
s1 = t1; s1 = t1;
s2 = t2; s2 = t2;

View File

@ -23,58 +23,58 @@
#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */ #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
typedef struct _IMAGE_DOS_HEADER { /* DOS .EXE header */ typedef struct _IMAGE_DOS_HEADER { /* DOS .EXE header */
uint16 e_magic; /* Magic number */ uint16_t e_magic; /* Magic number */
uint16 e_cblp; /* Bytes on last page of file */ uint16_t e_cblp; /* Bytes on last page of file */
uint16 e_cp; /* Pages in file */ uint16_t e_cp; /* Pages in file */
uint16 e_crlc; /* Relocations */ uint16_t e_crlc; /* Relocations */
uint16 e_cparhdr; /* Size of header in paragraphs */ uint16_t e_cparhdr; /* Size of header in paragraphs */
uint16 e_minalloc; /* Minimum extra paragraphs needed */ uint16_t e_minalloc; /* Minimum extra paragraphs needed */
uint16 e_maxalloc; /* Maximum extra paragraphs needed */ uint16_t e_maxalloc; /* Maximum extra paragraphs needed */
uint16 e_ss; /* Initial (relative) SS value */ uint16_t e_ss; /* Initial (relative) SS value */
uint16 e_sp; /* Initial SP value */ uint16_t e_sp; /* Initial SP value */
uint16 e_csum; /* Checksum */ uint16_t e_csum; /* Checksum */
uint16 e_ip; /* Initial IP value */ uint16_t e_ip; /* Initial IP value */
uint16 e_cs; /* Initial (relative) CS value */ uint16_t e_cs; /* Initial (relative) CS value */
uint16 e_lfarlc; /* File address of relocation table */ uint16_t e_lfarlc; /* File address of relocation table */
uint16 e_ovno; /* Overlay number */ uint16_t e_ovno; /* Overlay number */
uint16 e_res[4]; /* Reserved words */ uint16_t e_res[4]; /* Reserved words */
uint16 e_oemid; /* OEM identifier (for e_oeminfo) */ uint16_t e_oemid; /* OEM identifier (for e_oeminfo) */
uint16 e_oeminfo; /* OEM information; e_oemid specific */ uint16_t e_oeminfo; /* OEM information; e_oemid specific */
uint16 e_res2[10]; /* Reserved words */ uint16_t e_res2[10]; /* Reserved words */
int32 e_lfanew; /* File address of new exe header */ int32_t e_lfanew; /* File address of new exe header */
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
typedef struct _IMAGE_OS2_HEADER { /* OS/2 .EXE header */ typedef struct _IMAGE_OS2_HEADER { /* OS/2 .EXE header */
uint16 ne_magic; /* Magic number */ uint16_t ne_magic; /* Magic number */
int8 ne_ver; /* Version number */ int8_t ne_ver; /* Version number */
int8 ne_rev; /* Revision number */ int8_t ne_rev; /* Revision number */
uint16 ne_enttab; /* Offset of Entry Table */ uint16_t ne_enttab; /* Offset of Entry Table */
uint16 ne_cbenttab; /* Number of bytes in Entry Table */ uint16_t ne_cbenttab; /* Number of bytes in Entry Table */
int32 ne_crc; /* Checksum of whole file */ int32_t ne_crc; /* Checksum of whole file */
uint16 ne_flags; /* Flag word */ uint16_t ne_flags; /* Flag word */
uint16 ne_autodata; /* Automatic data segment number */ uint16_t ne_autodata; /* Automatic data segment number */
uint16 ne_heap; /* Initial heap allocation */ uint16_t ne_heap; /* Initial heap allocation */
uint16 ne_stack; /* Initial stack allocation */ uint16_t ne_stack; /* Initial stack allocation */
int32 ne_csip; /* Initial CS:IP setting */ int32_t ne_csip; /* Initial CS:IP setting */
int32 ne_sssp; /* Initial SS:SP setting */ int32_t ne_sssp; /* Initial SS:SP setting */
uint16 ne_cseg; /* Count of file segments */ uint16_t ne_cseg; /* Count of file segments */
uint16 ne_cmod; /* Entries in Module Reference Table */ uint16_t ne_cmod; /* Entries in Module Reference Table */
uint16 ne_cbnrestab; /* Size of non-resident name table */ uint16_t ne_cbnrestab; /* Size of non-resident name table */
uint16 ne_segtab; /* Offset of Segment Table */ uint16_t ne_segtab; /* Offset of Segment Table */
uint16 ne_rsrctab; /* Offset of Resource Table */ uint16_t ne_rsrctab; /* Offset of Resource Table */
uint16 ne_restab; /* Offset of resident name table */ uint16_t ne_restab; /* Offset of resident name table */
uint16 ne_modtab; /* Offset of Module Reference Table */ uint16_t ne_modtab; /* Offset of Module Reference Table */
uint16 ne_imptab; /* Offset of Imported Names Table */ uint16_t ne_imptab; /* Offset of Imported Names Table */
int32 ne_nrestab; /* Offset of Non-resident Names Table */ int32_t ne_nrestab; /* Offset of Non-resident Names Table */
uint16 ne_cmovent; /* Count of movable entries */ uint16_t ne_cmovent; /* Count of movable entries */
uint16 ne_align; /* Segment alignment shift count */ uint16_t ne_align; /* Segment alignment shift count */
uint16 ne_cres; /* Count of resource segments */ uint16_t ne_cres; /* Count of resource segments */
uint8 ne_exetyp; /* Target Operating system */ uint8_t ne_exetyp; /* Target Operating system */
uint8 ne_flagsothers; /* Other .EXE flags */ uint8_t ne_flagsothers; /* Other .EXE flags */
uint16 ne_pretthunks; /* offset to return thunks */ uint16_t ne_pretthunks; /* offset to return thunks */
uint16 ne_psegrefbytes; /* offset to segment ref. bytes */ uint16_t ne_psegrefbytes; /* offset to segment ref. bytes */
uint16 ne_swaparea; /* Minimum code swap area size */ uint16_t ne_swaparea; /* Minimum code swap area size */
uint16 ne_expver; /* Expected Windows version number */ uint16_t ne_expver; /* Expected Windows version number */
} IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
/* /*
@ -82,13 +82,13 @@ typedef struct _IMAGE_OS2_HEADER { /* OS/2 .EXE header */
*/ */
typedef struct _IMAGE_FILE_HEADER { typedef struct _IMAGE_FILE_HEADER {
uint16 Machine; uint16_t Machine;
uint16 NumberOfSections; uint16_t NumberOfSections;
uint32 TimeDateStamp; uint32_t TimeDateStamp;
uint32 PointerToSymbolTable; uint32_t PointerToSymbolTable;
uint32 NumberOfSymbols; uint32_t NumberOfSymbols;
uint16 SizeOfOptionalHeader; uint16_t SizeOfOptionalHeader;
uint16 Characteristics; uint16_t Characteristics;
} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
#define IMAGE_SIZEOF_FILE_HEADER 20 #define IMAGE_SIZEOF_FILE_HEADER 20
@ -135,8 +135,8 @@ typedef struct _IMAGE_FILE_HEADER {
*/ */
typedef struct _IMAGE_DATA_DIRECTORY { typedef struct _IMAGE_DATA_DIRECTORY {
uint32 VirtualAddress; uint32_t VirtualAddress;
uint32 Size; uint32_t Size;
} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
@ -150,41 +150,41 @@ typedef struct _IMAGE_OPTIONAL_HEADER {
* Standard fields. * Standard fields.
*/ */
uint16 Magic; uint16_t Magic;
uint8 MajorLinkerVersion; uint8_t MajorLinkerVersion;
uint8 MinorLinkerVersion; uint8_t MinorLinkerVersion;
uint32 SizeOfCode; uint32_t SizeOfCode;
uint32 SizeOfInitializedData; uint32_t SizeOfInitializedData;
uint32 SizeOfUninitializedData; uint32_t SizeOfUninitializedData;
uint32 AddressOfEntryPoint; uint32_t AddressOfEntryPoint;
uint32 BaseOfCode; uint32_t BaseOfCode;
uint32 BaseOfData; uint32_t BaseOfData;
/* /*
* NT additional fields. * NT additional fields.
*/ */
uint32 ImageBase; uint32_t ImageBase;
uint32 SectionAlignment; uint32_t SectionAlignment;
uint32 FileAlignment; uint32_t FileAlignment;
uint16 MajorOperatingSystemVersion; uint16_t MajorOperatingSystemVersion;
uint16 MinorOperatingSystemVersion; uint16_t MinorOperatingSystemVersion;
uint16 MajorImageVersion; uint16_t MajorImageVersion;
uint16 MinorImageVersion; uint16_t MinorImageVersion;
uint16 MajorSubsystemVersion; uint16_t MajorSubsystemVersion;
uint16 MinorSubsystemVersion; uint16_t MinorSubsystemVersion;
uint32 Reserved1; uint32_t Reserved1;
uint32 SizeOfImage; uint32_t SizeOfImage;
uint32 SizeOfHeaders; uint32_t SizeOfHeaders;
uint32 CheckSum; uint32_t CheckSum;
uint16 Subsystem; uint16_t Subsystem;
uint16 DllCharacteristics; uint16_t DllCharacteristics;
uint32 SizeOfStackReserve; uint32_t SizeOfStackReserve;
uint32 SizeOfStackCommit; uint32_t SizeOfStackCommit;
uint32 SizeOfHeapReserve; uint32_t SizeOfHeapReserve;
uint32 SizeOfHeapCommit; uint32_t SizeOfHeapCommit;
uint32 LoaderFlags; uint32_t LoaderFlags;
uint32 NumberOfRvaAndSizes; uint32_t NumberOfRvaAndSizes;
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
@ -202,7 +202,7 @@ typedef IMAGE_OPTIONAL_HEADER IMAGE_OPTIONAL_HEADER32;
#endif #endif
typedef struct _IMAGE_NT_HEADERS { typedef struct _IMAGE_NT_HEADERS {
uint32 Signature; uint32_t Signature;
IMAGE_FILE_HEADER FileHeader; IMAGE_FILE_HEADER FileHeader;
IMAGE_OPTIONAL_HEADER OptionalHeader; IMAGE_OPTIONAL_HEADER OptionalHeader;
} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
@ -210,7 +210,7 @@ typedef struct _IMAGE_NT_HEADERS {
typedef IMAGE_NT_HEADERS IMAGE_NT_HEADERS32; typedef IMAGE_NT_HEADERS IMAGE_NT_HEADERS32;
#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ #define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \
((byte*)ntheader + \ ((uint8_t*)ntheader + \
offsetof( IMAGE_NT_HEADERS, OptionalHeader ) + \ offsetof( IMAGE_NT_HEADERS, OptionalHeader ) + \
((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \
)) ))
@ -267,19 +267,19 @@ typedef IMAGE_NT_HEADERS IMAGE_NT_HEADERS32;
#define IMAGE_SIZEOF_SHORT_NAME 8 #define IMAGE_SIZEOF_SHORT_NAME 8
typedef struct _IMAGE_SECTION_HEADER { typedef struct _IMAGE_SECTION_HEADER {
uint8 Name[IMAGE_SIZEOF_SHORT_NAME]; uint8_t Name[IMAGE_SIZEOF_SHORT_NAME];
union { union {
uint32 PhysicalAddress; uint32_t PhysicalAddress;
uint32 VirtualSize; uint32_t VirtualSize;
} Misc; } Misc;
uint32 VirtualAddress; uint32_t VirtualAddress;
uint32 SizeOfRawData; uint32_t SizeOfRawData;
uint32 PointerToRawData; uint32_t PointerToRawData;
uint32 PointerToRelocations; uint32_t PointerToRelocations;
uint32 PointerToLinenumbers; uint32_t PointerToLinenumbers;
uint16 NumberOfRelocations; uint16_t NumberOfRelocations;
uint16 NumberOfLinenumbers; uint16_t NumberOfLinenumbers;
uint32 Characteristics; uint32_t Characteristics;
} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
#define IMAGE_SIZEOF_SECTION_HEADER 40 #define IMAGE_SIZEOF_SECTION_HEADER 40
@ -301,13 +301,13 @@ typedef struct _IMAGE_SECTION_HEADER {
#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ #define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */
#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ #define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */
#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */ #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* Section can be discarded. */ #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* Section can be discarded. */
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */
@ -323,18 +323,18 @@ typedef struct _IMAGE_SECTION_HEADER {
typedef struct _IMAGE_SYMBOL { typedef struct _IMAGE_SYMBOL {
union { union {
uint8 ShortName[8]; uint8_t ShortName[8];
struct { struct {
uint32 Short; /* if 0, use LongName */ uint32_t Short; /* if 0, use LongName */
uint32 Long; /* offset into string table */ uint32_t Long; /* offset into string table */
} Name; } Name;
uint8* LongName[2]; uint8_t* LongName[2];
} N; } N;
uint32 Value; uint32_t Value;
int16 SectionNumber; int16_t SectionNumber;
uint16 Type; uint16_t Type;
uint8 StorageClass; uint8_t StorageClass;
uint8 NumberOfAuxSymbols; uint8_t NumberOfAuxSymbols;
} IMAGE_SYMBOL; } IMAGE_SYMBOL;
typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL; typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL;
@ -359,18 +359,18 @@ typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL;
#define IMAGE_SYM_TYPE_VOID 1 #define IMAGE_SYM_TYPE_VOID 1
#define IMAGE_SYM_TYPE_CHAR 2 /* type character. */ #define IMAGE_SYM_TYPE_CHAR 2 /* type character. */
#define IMAGE_SYM_TYPE_SHORT 3 /* type short integer. */ #define IMAGE_SYM_TYPE_SHORT 3 /* type short integer. */
#define IMAGE_SYM_TYPE_INT 4 #define IMAGE_SYM_TYPE_INT 4
#define IMAGE_SYM_TYPE_LONG 5 #define IMAGE_SYM_TYPE_LONG 5
#define IMAGE_SYM_TYPE_FLOAT 6 #define IMAGE_SYM_TYPE_FLOAT 6
#define IMAGE_SYM_TYPE_DOUBLE 7 #define IMAGE_SYM_TYPE_DOUBLE 7
#define IMAGE_SYM_TYPE_STRUCT 8 #define IMAGE_SYM_TYPE_STRUCT 8
#define IMAGE_SYM_TYPE_UNION 9 #define IMAGE_SYM_TYPE_UNION 9
#define IMAGE_SYM_TYPE_ENUM 10 /* enumeration. */ #define IMAGE_SYM_TYPE_ENUM 10 /* enumeration. */
#define IMAGE_SYM_TYPE_MOE 11 /* member of enumeration. */ #define IMAGE_SYM_TYPE_MOE 11 /* member of enumeration. */
#define IMAGE_SYM_TYPE_UCHAR 12 #define IMAGE_SYM_TYPE_UCHAR 12
#define IMAGE_SYM_TYPE_USHORT 13 #define IMAGE_SYM_TYPE_USHORT 13
#define IMAGE_SYM_TYPE_UINT 14 #define IMAGE_SYM_TYPE_UINT 14
#define IMAGE_SYM_TYPE_ULONG 15 #define IMAGE_SYM_TYPE_ULONG 15
/* /*
* Type (derived) values. * Type (derived) values.
@ -385,7 +385,7 @@ typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL;
* Storage classes. * Storage classes.
*/ */
#define IMAGE_SYM_CLASS_END_OF_FUNCTION (uint8 )-1 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (uint8_t )-1
#define IMAGE_SYM_CLASS_NULL 0 #define IMAGE_SYM_CLASS_NULL 0
#define IMAGE_SYM_CLASS_AUTOMATIC 1 #define IMAGE_SYM_CLASS_AUTOMATIC 1
#define IMAGE_SYM_CLASS_EXTERNAL 2 #define IMAGE_SYM_CLASS_EXTERNAL 2
@ -460,35 +460,35 @@ typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL;
typedef union _IMAGE_AUX_SYMBOL { typedef union _IMAGE_AUX_SYMBOL {
struct { struct {
uint32 TagIndex; /* struct, union, or enum tag index */ uint32_t TagIndex; /* struct, union, or enum tag index */
union { union {
struct { struct {
uint16 Linenumber; /* declaration line number */ uint16_t Linenumber; /* declaration line number */
uint16 Size; /* size of struct, union, or enum */ uint16_t Size; /* size of struct, union, or enum */
} LnSz; } LnSz;
uint32 TotalSize; uint32_t TotalSize;
} Misc; } Misc;
union { union {
struct { /* if ISFCN, tag, or .bb */ struct { /* if ISFCN, tag, or .bb */
uint32 PointerToLinenumber; uint32_t PointerToLinenumber;
uint32 PointerToNextFunction; uint32_t PointerToNextFunction;
} Function; } Function;
struct { /* if ISARY, up to 4 dimen. */ struct { /* if ISARY, up to 4 dimen. */
uint16 Dimension[4]; uint16_t Dimension[4];
} Array; } Array;
} FcnAry; } FcnAry;
uint16 TvIndex; /* tv index */ uint16_t TvIndex; /* tv index */
} Sym; } Sym;
struct { struct {
uint8 Name[IMAGE_SIZEOF_SYMBOL]; uint8_t Name[IMAGE_SIZEOF_SYMBOL];
} File; } File;
struct { struct {
uint32 Length; /* section length */ uint32_t Length; /* section length */
uint16 NumberOfRelocations; /* number of relocation entries */ uint16_t NumberOfRelocations; /* number of relocation entries */
uint16 NumberOfLinenumbers; /* number of line numbers */ uint16_t NumberOfLinenumbers; /* number of line numbers */
uint32 CheckSum; /* checksum for communal */ uint32_t CheckSum; /* checksum for communal */
int16 Number; /* section number to associate with */ int16_t Number; /* section number to associate with */
uint8 Selection; /* communal selection type */ uint8_t Selection; /* communal selection type */
} Section; } Section;
} IMAGE_AUX_SYMBOL; } IMAGE_AUX_SYMBOL;
typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL; typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL;
@ -516,9 +516,9 @@ typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL;
*/ */
typedef struct _IMAGE_RELOCATION { typedef struct _IMAGE_RELOCATION {
uint32 VirtualAddress; uint32_t VirtualAddress;
uint32 SymbolTableIndex; uint32_t SymbolTableIndex;
uint16 Type; uint16_t Type;
} IMAGE_RELOCATION; } IMAGE_RELOCATION;
typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION; typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION;
@ -604,9 +604,9 @@ typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION;
*/ */
typedef struct _IMAGE_BASE_RELOCATION { typedef struct _IMAGE_BASE_RELOCATION {
uint32 VirtualAddress; uint32_t VirtualAddress;
uint32 SizeOfBlock; uint32_t SizeOfBlock;
/* uint16 TypeOffset[1]; */ /* uint16_t TypeOffset[1]; */
} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; } IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;
#define IMAGE_SIZEOF_BASE_RELOCATION 8 #define IMAGE_SIZEOF_BASE_RELOCATION 8
@ -630,10 +630,10 @@ typedef struct _IMAGE_BASE_RELOCATION {
typedef struct _IMAGE_LINENUMBER { typedef struct _IMAGE_LINENUMBER {
union { union {
uint32 SymbolTableIndex; /* Symbol table index of function name if Linenumber is 0. */ uint32_t SymbolTableIndex; /* Symbol table index of function name if Linenumber is 0. */
uint32 VirtualAddress; /* Virtual address of line number. */ uint32_t VirtualAddress; /* Virtual address of line number. */
} Type; } Type;
uint16 Linenumber; /* Line number. */ uint16_t Linenumber; /* Line number. */
} IMAGE_LINENUMBER; } IMAGE_LINENUMBER;
typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER; typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER;
@ -648,16 +648,16 @@ typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER;
#define IMAGE_ARCHIVE_END "`\n" #define IMAGE_ARCHIVE_END "`\n"
#define IMAGE_ARCHIVE_PAD "\n" #define IMAGE_ARCHIVE_PAD "\n"
#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
uint8 Name[16]; /* File member name - `/' terminated. */ uint8_t Name[16]; /* File member name - `/' terminated. */
uint8 Date[12]; /* File member date - decimal. */ uint8_t Date[12]; /* File member date - decimal. */
uint8 UserID[6]; /* File member user id - decimal. */ uint8_t UserID[6]; /* File member user id - decimal. */
uint8 GroupID[6]; /* File member group id - decimal. */ uint8_t GroupID[6]; /* File member group id - decimal. */
uint8 Mode[8]; /* File member mode - octal. */ uint8_t Mode[8]; /* File member mode - octal. */
uint8 Size[10]; /* File member size - decimal. */ uint8_t Size[10]; /* File member size - decimal. */
uint8 EndHeader[2]; /* String to end header. */ uint8_t EndHeader[2]; /* String to end header. */
} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
@ -671,17 +671,17 @@ typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
*/ */
typedef struct _IMAGE_EXPORT_DIRECTORY { typedef struct _IMAGE_EXPORT_DIRECTORY {
uint32 Characteristics; uint32_t Characteristics;
uint32 TimeDateStamp; uint32_t TimeDateStamp;
uint16 MajorVersion; uint16_t MajorVersion;
uint16 MinorVersion; uint16_t MinorVersion;
uint32 Name; uint32_t Name;
uint32 Base; uint32_t Base;
uint32 NumberOfFunctions; uint32_t NumberOfFunctions;
uint32 NumberOfNames; uint32_t NumberOfNames;
uint32 **AddressOfFunctions; uint32_t **AddressOfFunctions;
uint32 **AddressOfNames; uint32_t **AddressOfNames;
uint16 **AddressOfNameOrdinals; uint16_t **AddressOfNameOrdinals;
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
/* /*
@ -689,14 +689,14 @@ typedef struct _IMAGE_EXPORT_DIRECTORY {
*/ */
typedef struct _IMAGE_IMPORT_BY_NAME { typedef struct _IMAGE_IMPORT_BY_NAME {
uint16 Hint; uint16_t Hint;
uint8 Name[1]; uint8_t Name[1];
} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; } IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
typedef struct _IMAGE_THUNK_DATA { typedef struct _IMAGE_THUNK_DATA {
union { union {
uint32 *Function; uint32_t *Function;
uint32 Ordinal; uint32_t Ordinal;
PIMAGE_IMPORT_BY_NAME AddressOfData; PIMAGE_IMPORT_BY_NAME AddressOfData;
} u1; } u1;
} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; } IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA;
@ -706,10 +706,10 @@ typedef struct _IMAGE_THUNK_DATA {
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
typedef struct _IMAGE_IMPORT_DESCRIPTOR { typedef struct _IMAGE_IMPORT_DESCRIPTOR {
uint32 Characteristics; uint32_t Characteristics;
uint32 TimeDateStamp; uint32_t TimeDateStamp;
uint32 ForwarderChain; uint32_t ForwarderChain;
uint32 Name; uint32_t Name;
PIMAGE_THUNK_DATA FirstThunk; PIMAGE_THUNK_DATA FirstThunk;
} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; } IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR;
@ -719,17 +719,17 @@ typedef struct _IMAGE_IMPORT_DESCRIPTOR {
typedef void (*PIMAGE_TLS_CALLBACK) ( typedef void (*PIMAGE_TLS_CALLBACK) (
void* DllHandle, void* DllHandle,
uint32 Reason, uint32_t Reason,
void* Reserved void* Reserved
); );
typedef struct _IMAGE_TLS_DIRECTORY { typedef struct _IMAGE_TLS_DIRECTORY {
uint32 StartAddressOfRawData; uint32_t StartAddressOfRawData;
uint32 EndAddressOfRawData; uint32_t EndAddressOfRawData;
uint32 *AddressOfIndex; uint32_t *AddressOfIndex;
PIMAGE_TLS_CALLBACK *AddressOfCallBacks; PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
uint32 SizeOfZeroFill; uint32_t SizeOfZeroFill;
uint32 Characteristics; uint32_t Characteristics;
} IMAGE_TLS_DIRECTORY, *PIMAGE_TLS_DIRECTORY; } IMAGE_TLS_DIRECTORY, *PIMAGE_TLS_DIRECTORY;
@ -752,12 +752,12 @@ typedef struct _IMAGE_TLS_DIRECTORY {
*/ */
typedef struct _IMAGE_RESOURCE_DIRECTORY { typedef struct _IMAGE_RESOURCE_DIRECTORY {
uint32 Characteristics; uint32_t Characteristics;
uint32 TimeDateStamp; uint32_t TimeDateStamp;
uint16 MajorVersion; uint16_t MajorVersion;
uint16 MinorVersion; uint16_t MinorVersion;
uint16 NumberOfNamedEntries; uint16_t NumberOfNamedEntries;
uint16 NumberOfIdEntries; uint16_t NumberOfIdEntries;
/* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */ /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
} IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY; } IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY;
@ -780,8 +780,8 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY {
*/ */
typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
uint32 Name; uint32_t Name;
uint32 OffsetToData; uint32_t OffsetToData;
} IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY; } IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
/* /*
@ -794,13 +794,13 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
*/ */
typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
uint16 Length; uint16_t Length;
char NameString[ 1 ]; char NameString[ 1 ];
} IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING; } IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING;
typedef struct _IMAGE_RESOURCE_DIR_STRING_U { typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
uint16 Length; uint16_t Length;
wchar_t NameString[ 1 ]; wchar_t NameString[ 1 ];
} IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U; } IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U;
@ -814,10 +814,10 @@ typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
*/ */
typedef struct _IMAGE_RESOURCE_DATA_ENTRY { typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
uint32 OffsetToData; uint32_t OffsetToData;
uint32 Size; uint32_t Size;
uint32 CodePage; uint32_t CodePage;
uint32 Reserved; uint32_t Reserved;
} IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY; } IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY;
/* /*
@ -825,16 +825,16 @@ typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
*/ */
typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY { typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
uint32 Characteristics; uint32_t Characteristics;
uint32 TimeDateStamp; uint32_t TimeDateStamp;
uint16 MajorVersion; uint16_t MajorVersion;
uint16 MinorVersion; uint16_t MinorVersion;
uint32 GlobalFlagsClear; uint32_t GlobalFlagsClear;
uint32 GlobalFlagsSet; uint32_t GlobalFlagsSet;
uint32 CriticalSectionDefaultTimeout; uint32_t CriticalSectionDefaultTimeout;
uint32 DeCommitFreeBlockThreshold; uint32_t DeCommitFreeBlockThreshold;
uint32 DeCommitTotalFreeThreshold; uint32_t DeCommitTotalFreeThreshold;
uint32 Reserved[ 8 ]; uint32_t Reserved[ 8 ];
} IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY; } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
@ -846,11 +846,11 @@ typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
*/ */
typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY { typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
uint32 BeginAddress; uint32_t BeginAddress;
uint32 EndAddress; uint32_t EndAddress;
void* ExceptionHandler; void* ExceptionHandler;
void* HandlerData; void* HandlerData;
uint32 PrologEndAddress; uint32_t PrologEndAddress;
} IMAGE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_RUNTIME_FUNCTION_ENTRY; } IMAGE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_RUNTIME_FUNCTION_ENTRY;
/* /*
@ -858,14 +858,14 @@ typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
*/ */
typedef struct _IMAGE_DEBUG_DIRECTORY { typedef struct _IMAGE_DEBUG_DIRECTORY {
uint32 Characteristics; uint32_t Characteristics;
uint32 TimeDateStamp; uint32_t TimeDateStamp;
uint16 MajorVersion; uint16_t MajorVersion;
uint16 MinorVersion; uint16_t MinorVersion;
uint32 Type; uint32_t Type;
uint32 SizeOfData; uint32_t SizeOfData;
uint32 AddressOfRawData; uint32_t AddressOfRawData;
uint32 PointerToRawData; uint32_t PointerToRawData;
} IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY; } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
#define IMAGE_DEBUG_TYPE_UNKNOWN 0 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
@ -879,14 +879,14 @@ typedef struct _IMAGE_DEBUG_DIRECTORY {
#define IMAGE_DEBUG_TYPE_RESERVED7 8 #define IMAGE_DEBUG_TYPE_RESERVED7 8
typedef struct _IMAGE_COFF_SYMBOLS_HEADER { typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
uint32 NumberOfSymbols; uint32_t NumberOfSymbols;
uint32 LvaToFirstSymbol; uint32_t LvaToFirstSymbol;
uint32 NumberOfLinenumbers; uint32_t NumberOfLinenumbers;
uint32 LvaToFirstLinenumber; uint32_t LvaToFirstLinenumber;
uint32 RvaToFirstByteOfCode; uint32_t RvaToFirstByteOfCode;
uint32 RvaToLastByteOfCode; uint32_t RvaToLastByteOfCode;
uint32 RvaToFirstByteOfData; uint32_t RvaToFirstByteOfData;
uint32 RvaToLastByteOfData; uint32_t RvaToLastByteOfData;
} IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER; } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
#define FRAME_FPO 0 #define FRAME_FPO 0
@ -897,16 +897,16 @@ typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
#pragma warning(disable:4214) #pragma warning(disable:4214)
#endif #endif
typedef struct _FPO_DATA { typedef struct _FPO_DATA {
uint32 ulOffStart; /* offset 1st byte of function code */ uint32_t ulOffStart; /* offset 1st byte of function code */
uint32 cbProcSize; /* # bytes in function */ uint32_t cbProcSize; /* # bytes in function */
uint32 cdwLocals; /* # bytes in locals/4 */ uint32_t cdwLocals; /* # bytes in locals/4 */
uint16 cdwParams; /* # bytes in params/4 */ uint16_t cdwParams; /* # bytes in params/4 */
uint16 cbProlog : 8; /* # bytes in prolog */ uint16_t cbProlog : 8; /* # bytes in prolog */
uint16 cbRegs : 3; /* # regs saved */ uint16_t cbRegs : 3; /* # regs saved */
uint16 fHasSEH : 1; /* TRUE if SEH in func */ uint16_t fHasSEH : 1; /* TRUE if SEH in func */
uint16 fUseBP : 1; /* TRUE if EBP has been allocated */ uint16_t fUseBP : 1; /* TRUE if EBP has been allocated */
uint16 reserved : 1; /* reserved for future use */ uint16_t reserved : 1; /* reserved for future use */
uint16 cbFrame : 2; /* frame type */ uint16_t cbFrame : 2; /* frame type */
} FPO_DATA, *PFPO_DATA; } FPO_DATA, *PFPO_DATA;
#define SIZEOF_RFPO_DATA 16 #define SIZEOF_RFPO_DATA 16
#ifdef _MSC_VER #ifdef _MSC_VER
@ -916,12 +916,12 @@ typedef struct _FPO_DATA {
#define IMAGE_DEBUG_MISC_EXENAME 1 #define IMAGE_DEBUG_MISC_EXENAME 1
typedef struct _IMAGE_DEBUG_MISC { typedef struct _IMAGE_DEBUG_MISC {
uint32 DataType; /* type of misc data, see defines */ uint32_t DataType; /* type of misc data, see defines */
uint32 Length; /* total length of record, rounded to four */ uint32_t Length; /* total length of record, rounded to four */
/* byte multiple. */ /* byte multiple. */
uint8 Unicode; /* TRUE if data is unicode string */ uint8_t Unicode; /* TRUE if data is unicode string */
uint8 Reserved[ 3 ]; uint8_t Reserved[ 3 ];
uint8 Data[ 1 ]; /* Actual data */ uint8_t Data[ 1 ]; /* Actual data */
} IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC; } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
@ -946,18 +946,18 @@ typedef struct _IMAGE_DEBUG_MISC {
*/ */
typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
uint16 Signature; uint16_t Signature;
uint16 Flags; uint16_t Flags;
uint16 Machine; uint16_t Machine;
uint16 Characteristics; uint16_t Characteristics;
uint32 TimeDateStamp; uint32_t TimeDateStamp;
uint32 CheckSum; uint32_t CheckSum;
uint32 ImageBase; uint32_t ImageBase;
uint32 SizeOfImage; uint32_t SizeOfImage;
uint32 NumberOfSections; uint32_t NumberOfSections;
uint32 ExportedNamesSize; uint32_t ExportedNamesSize;
uint32 DebugDirectorySize; uint32_t DebugDirectorySize;
uint32 Reserved[ 3 ]; uint32_t Reserved[ 3 ];
} IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER; } IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER;
#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
@ -966,21 +966,21 @@ typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
#ifdef USES_COMPLUS20 #ifdef USES_COMPLUS20
/* /*
* COM+ 2.0 header structure. * COM+ 2.0 header structure.
*/ */
typedef struct IMAGE_COR20_HEADER typedef struct IMAGE_COR20_HEADER
{ {
/* Header versioning */ /* Header versioning */
uint32 cb; uint32_t cb;
uint16 MajorRuntimeVersion; uint16_t MajorRuntimeVersion;
uint16 MinorRuntimeVersion; uint16_t MinorRuntimeVersion;
/* Symbol table and startup information */ /* Symbol table and startup information */
IMAGE_DATA_DIRECTORY MetaData; IMAGE_DATA_DIRECTORY MetaData;
uint32 Flags; uint32_t Flags;
uint32 EntryPointToken; uint32_t EntryPointToken;
/* Binding information */ /* Binding information */
IMAGE_DATA_DIRECTORY Resources; IMAGE_DATA_DIRECTORY Resources;
IMAGE_DATA_DIRECTORY StrongNameSignature; IMAGE_DATA_DIRECTORY StrongNameSignature;
@ -1002,7 +1002,7 @@ typedef struct IMAGE_COR20_HEADER
/*@Todo: this is obsolete, being replaced by pdata in the PE header.*/ /*@Todo: this is obsolete, being replaced by pdata in the PE header.*/
IMAGE_DATA_DIRECTORY IPMap; IMAGE_DATA_DIRECTORY IPMap;
} IMAGE_COR20_HEADER; } IMAGE_COR20_HEADER;
#endif /* USES_COMPLUS20 */ #endif /* USES_COMPLUS20 */

View File

@ -9,6 +9,46 @@
#include <xenia/xenia.h> #include <xenia/xenia.h>
int main() {
return some_function(4); int xenia_info(int argc, xechar_t **argv) {
int result_code = 1;
xe_pal_ref pal = NULL;
xe_memory_ref memory = NULL;
xe_kernel_ref kernel = NULL;
xe_module_ref module = NULL;
// TODO(benvanik): real command line parsing.
if (argc < 2) {
printf("usage: xenia-info some.xex\n");
return 1;
}
const xechar_t *path = argv[1];
xe_pal_options_t pal_options;
pal = xe_pal_create(pal_options);
XEEXPECTNOTNULL(pal);
xe_memory_options_t memory_options;
memory = xe_memory_create(pal, memory_options);
XEEXPECTNOTNULL(memory);
xe_kernel_options_t kernel_options;
xe_zero_struct(&kernel_options, sizeof(kernel_options));
kernel = xe_kernel_create(pal, memory, kernel_options);
XEEXPECTNOTNULL(kernel);
module = xe_kernel_load_module(kernel, path);
XEEXPECTNOTNULL(module);
xe_module_dump(module);
result_code = 0;
XECLEANUP:
xe_module_release(module);
xe_kernel_release(kernel);
xe_memory_release(memory);
xe_pal_release(pal);
return result_code;
} }
XE_MAIN_THUNK(xenia_info);

View File

@ -7,6 +7,8 @@
'dependencies': [ 'dependencies': [
'xeniacore', 'xeniacore',
'xeniacpu',
'xeniakernel',
], ],
'include_dirs': [ 'include_dirs': [

View File

@ -9,6 +9,10 @@
#include <xenia/xenia.h> #include <xenia/xenia.h>
int main() {
return some_function(4); int xenia_run(int argc, xechar_t **argv) {
do_cpu_stuff();
do_gpu_stuff();
return 0;
} }
XE_MAIN_THUNK(xenia_run);

View File

@ -7,6 +7,9 @@
'dependencies': [ 'dependencies': [
'xeniacore', 'xeniacore',
'xeniacpu',
'xeniagpu',
'xeniakernel',
], ],
'include_dirs': [ 'include_dirs': [

View File

@ -115,10 +115,21 @@ def has_bin(bin):
'which %s' % (bin), shell=True, stdout=DEVNULL) == 0 else False 'which %s' % (bin), shell=True, stdout=DEVNULL) == 0 else False
def shell_call(command): def shell_call(command, throw_on_error=True):
"""Executes a shell command. """Executes a shell command.
Args:
command: Command to execute.
throw_on_error: Whether to throw an error or return the status code.
Returns:
If throw_on_error is False the status code of the call will be returned.
""" """
subprocess.check_call(command, shell=True) if throw_on_error:
subprocess.check_call(command, shell=True)
return 0
else:
return subprocess.call(command, shell=True)
class Command(object): class Command(object):
@ -358,8 +369,11 @@ class BuildCommand(Command):
print '' print ''
print '- building xenia in %s...' % (config) print '- building xenia in %s...' % (config)
shell_call('third_party/ninja/ninja -C build/xenia/%s' % (config)) result = shell_call('third_party/ninja/ninja -C build/xenia/%s' % (config),
throw_on_error=False)
print '' print ''
if result != 0:
return result
print 'Success!' print 'Success!'
return 0 return 0

126
xenia.gyp
View File

@ -15,47 +15,117 @@
'include_dirs': [ 'include_dirs': [
'include/', 'include/',
], ],
'link_settings': { },
'libraries': [
'<!@(<(llvm_config) --ldflags)',
'<!@(<(llvm_config) --libs core)',
],
'library_dirs': [
# NOTE: this doesn't actually do anything...
# http://code.google.com/p/gyp/issues/detail?id=130
'<!@(<(llvm_config) --libdir)',
],
},
'linkflags': [
],
'libraries': [
#'!@(pkg-config --libs-only-l apr-1)',
],
'xcode_settings': { 'include_dirs': [
'OTHER_LDFLAGS': [ '.',
'<!@(<(llvm_config) --ldflags)', 'src/',
'<!@(<(llvm_config) --libs core)', ],
],
} 'includes': [
'src/xenia/sources.gypi',
'src/core/sources.gypi',
],
},
{
'target_name': 'xeniakernel',
'product_name': 'xeniakernel',
'type': 'static_library',
'dependencies': [
'xeniacore',
],
'export_dependent_settings': [
'xeniacore',
],
'include_dirs': [
'.',
'src/',
],
'includes': [
'src/kernel/sources.gypi',
],
},
{
'target_name': 'xeniacpu',
'product_name': 'xeniacpu',
'type': 'static_library',
'dependencies': [
'xeniacore',
],
'export_dependent_settings': [
'xeniacore',
],
'direct_dependent_settings': {
'target_conditions': [
['_type=="shared_library"', {
'cflags': [
'<!@(<(llvm_config) --cxxflags)'
],
}],
['_type=="executable"', {
'libraries': [
'<!@(<(llvm_config) --ldflags)',
'<!@(<(llvm_config) --libs core)',
],
'library_dirs': [
# NOTE: this doesn't actually do anything...
# http://code.google.com/p/gyp/issues/detail?id=130
'<!@(<(llvm_config) --libdir)',
],
'xcode_settings': {
'OTHER_LDFLAGS': [
'<!@(<(llvm_config) --ldflags)',
'<!@(<(llvm_config) --libs core)',
],
},
}],
],
}, },
'cflags': [ 'cflags': [
'<!@(<(llvm_config) --cxxflags)' '<!@(<(llvm_config) --cxxflags)'
], ],
'defines': [
'__STDC_LIMIT_MACROS=1',
'__STDC_CONSTANT_MACROS=1',
],
'include_dirs': [ 'include_dirs': [
'.', '.',
'src/',
'<!@(<(llvm_config) --includedir)', '<!@(<(llvm_config) --includedir)',
], ],
'includes': [ 'includes': [
'src/core/sources.gypi', 'src/cpu/sources.gypi',
],
},
{
'target_name': 'xeniagpu',
'product_name': 'xeniagpu',
'type': 'static_library',
'dependencies': [
'xeniacore',
],
'export_dependent_settings': [
'xeniacore',
],
'include_dirs': [
'.',
'src/',
],
'includes': [
'src/gpu/sources.gypi',
], ],
}, },
], ],