More shared header cleanup.
This commit is contained in:
parent
4675161902
commit
6cb9ca432f
|
@ -14,7 +14,5 @@
|
|||
#include <xenia/logging.h>
|
||||
#include <xenia/malloc.h>
|
||||
#include <xenia/profiling.h>
|
||||
#include <xenia/string.h>
|
||||
#include <xenia/types.h>
|
||||
|
||||
#endif // ALLOY_CORE_H_
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <alloy/core.h>
|
||||
#include <alloy/vec128.h>
|
||||
#include <poly/poly.h>
|
||||
|
||||
namespace alloy { namespace runtime {
|
||||
class Runtime;
|
||||
|
@ -37,7 +38,7 @@ using vec128_t = alloy::vec128_t;
|
|||
// 128-256: VR
|
||||
|
||||
#pragma pack(push, 4)
|
||||
typedef struct XECACHEALIGN64 PPCContext_s {
|
||||
typedef struct alignas(64) PPCContext_s {
|
||||
// Must be stored at 0x0 for now.
|
||||
// TODO(benvanik): find a nice way to describe this to the JIT.
|
||||
runtime::ThreadState* thread_state;
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#define ALLOY_VEC128_H_
|
||||
|
||||
#include <alloy/core.h>
|
||||
#include <poly/poly.h>
|
||||
|
||||
namespace alloy {
|
||||
|
||||
typedef struct XECACHEALIGN vec128_s {
|
||||
typedef struct alignas(16) vec128_s {
|
||||
union {
|
||||
struct {
|
||||
float x;
|
||||
|
|
|
@ -123,12 +123,6 @@ XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN
|
|||
#define XE_CPU_LITTLEENDIAN 1
|
||||
#endif // [big endian flags]
|
||||
|
||||
#if XE_CPU_32BIT
|
||||
#define XE_ALIGNMENT 8
|
||||
#else
|
||||
#define XE_ALIGNMENT 16
|
||||
#endif // 32BIT
|
||||
|
||||
#if XE_PLATFORM_WINCE || XE_PLATFORM_WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
|
|
@ -14,24 +14,36 @@
|
|||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/debug_agent.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/cpu/xenon_memory.h>
|
||||
|
||||
|
||||
XEDECLARECLASS1(xe, ExportResolver);
|
||||
XEDECLARECLASS2(xe, apu, AudioSystem);
|
||||
XEDECLARECLASS2(xe, cpu, Processor);
|
||||
XEDECLARECLASS2(xe, gpu, GraphicsSystem);
|
||||
XEDECLARECLASS2(xe, hid, InputSystem);
|
||||
XEDECLARECLASS2(xe, kernel, KernelState);
|
||||
XEDECLARECLASS2(xe, kernel, XamModule);
|
||||
XEDECLARECLASS2(xe, kernel, XboxkrnlModule);
|
||||
XEDECLARECLASS3(xe, kernel, fs, FileSystem);
|
||||
XEDECLARECLASS2(xe, ui, Window);
|
||||
|
||||
#include <xenia/debug_agent.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
namespace apu {
|
||||
class AudioSystem;
|
||||
} // namespace apu
|
||||
namespace cpu {
|
||||
class Processor;
|
||||
} // namespace cpu
|
||||
namespace gpu {
|
||||
class GraphicsSystem;
|
||||
} // namespace gpu
|
||||
namespace hid {
|
||||
class InputSystem;
|
||||
} // namespace hid
|
||||
namespace kernel {
|
||||
class XamModule;
|
||||
class XboxkrnlModule;
|
||||
} // namespace kernel
|
||||
namespace ui {
|
||||
class Window;
|
||||
} // namespace ui
|
||||
} // namespace xe
|
||||
|
||||
namespace xe {
|
||||
|
||||
class ExportResolver;
|
||||
|
||||
class Emulator {
|
||||
public:
|
||||
|
|
|
@ -18,6 +18,25 @@ namespace gpu {
|
|||
namespace xenos {
|
||||
|
||||
|
||||
#if XE_COMPILER_MSVC
|
||||
#define XEPACKEDSTRUCT(name, value) \
|
||||
__pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \
|
||||
typedef struct name##_s name;
|
||||
#define XEPACKEDSTRUCTANONYMOUS(value) \
|
||||
__pragma(pack(push, 1)) struct value __pragma(pack(pop));
|
||||
#define XEPACKEDUNION(name, value) \
|
||||
__pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \
|
||||
typedef union name##_s name;
|
||||
#elif XE_COMPILER_GNUC
|
||||
#define XEPACKEDSTRUCT(name, value) \
|
||||
struct __attribute__((packed)) name
|
||||
#define XEPACKEDSTRUCTANONYMOUS(value) \
|
||||
struct __attribute__((packed))
|
||||
#define XEPACKEDUNION(name, value) \
|
||||
union __attribute__((packed)) name
|
||||
#endif // MSVC
|
||||
|
||||
|
||||
// This code comes from the freedreno project:
|
||||
// https://github.com/freedreno/freedreno/blob/master/includes/instr-a2xx.h
|
||||
/*
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define XENIA_GPU_XENOS_XENOS_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/gpu/xenos/ucode.h>
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -23,23 +23,24 @@
|
|||
#include <xenia/kernel/user_profile.h>
|
||||
#include <xenia/kernel/fs/filesystem.h>
|
||||
|
||||
|
||||
XEDECLARECLASS1(xe, Emulator);
|
||||
XEDECLARECLASS2(xe, cpu, Processor);
|
||||
XEDECLARECLASS2(xe, kernel, Dispatcher);
|
||||
XEDECLARECLASS2(xe, kernel, XModule);
|
||||
XEDECLARECLASS2(xe, kernel, XNotifyListener);
|
||||
XEDECLARECLASS2(xe, kernel, XThread);
|
||||
XEDECLARECLASS2(xe, kernel, XUserModule);
|
||||
XEDECLARECLASS3(xe, kernel, fs, FileSystem);
|
||||
|
||||
namespace xe {
|
||||
class Emulator;
|
||||
namespace cpu {
|
||||
class Processor;
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
class Dispatcher;
|
||||
class XModule;
|
||||
class XNotifyListener;
|
||||
class XThread;
|
||||
class XUserModule;
|
||||
|
||||
class KernelState {
|
||||
public:
|
||||
public:
|
||||
KernelState(Emulator* emulator);
|
||||
~KernelState();
|
||||
|
||||
|
@ -72,33 +73,33 @@ public:
|
|||
void UnregisterNotifyListener(XNotifyListener* listener);
|
||||
void BroadcastNotification(XNotificationID id, uint32_t data);
|
||||
|
||||
void CompleteOverlapped(uint32_t overlapped_ptr, X_RESULT result, uint32_t length = 0);
|
||||
void CompleteOverlappedImmediate(uint32_t overlapped_ptr, X_RESULT result, uint32_t length = 0);
|
||||
void CompleteOverlapped(uint32_t overlapped_ptr, X_RESULT result,
|
||||
uint32_t length = 0);
|
||||
void CompleteOverlappedImmediate(uint32_t overlapped_ptr, X_RESULT result,
|
||||
uint32_t length = 0);
|
||||
|
||||
private:
|
||||
Emulator* emulator_;
|
||||
Memory* memory_;
|
||||
private:
|
||||
Emulator* emulator_;
|
||||
Memory* memory_;
|
||||
cpu::Processor* processor_;
|
||||
fs::FileSystem* file_system_;
|
||||
|
||||
Dispatcher* dispatcher_;
|
||||
Dispatcher* dispatcher_;
|
||||
|
||||
std::unique_ptr<XAppManager> app_manager_;
|
||||
std::unique_ptr<UserProfile> user_profile_;
|
||||
|
||||
ObjectTable* object_table_;
|
||||
std::mutex object_mutex_;
|
||||
ObjectTable* object_table_;
|
||||
std::mutex object_mutex_;
|
||||
std::unordered_map<uint32_t, XThread*> threads_by_id_;
|
||||
std::vector<XNotifyListener*> notify_listeners_;
|
||||
|
||||
XUserModule* executable_module_;
|
||||
XUserModule* executable_module_;
|
||||
|
||||
friend class XObject;
|
||||
};
|
||||
|
||||
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_KERNEL_KERNEL_STATE_H_
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#define XE_OPTION_LOG_KERNEL 1
|
||||
#define XE_OPTION_LOG_FS 1
|
||||
|
||||
#define XE_EMPTY_MACRO do { } while(0)
|
||||
|
||||
#if XE_COMPILER_GNUC
|
||||
#define XE_LOG_LINE_ATTRIBUTE __attribute__ ((format (printf, 5, 6)))
|
||||
#else
|
||||
|
|
|
@ -21,6 +21,7 @@ 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);
|
||||
|
||||
typedef __declspec(align(16)) volatile void xe_aligned_void_t;
|
||||
xe_aligned_void_t *xe_malloc_aligned(const size_t size);
|
||||
void xe_free_aligned(xe_aligned_void_t *ptr);
|
||||
|
||||
|
|
|
@ -10,60 +10,12 @@
|
|||
#ifndef XENIA_TYPES_H_
|
||||
#define XENIA_TYPES_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
#include <poly/platform.h>
|
||||
|
||||
|
||||
#define XE_EMPTY_MACRO do { } while(0)
|
||||
|
||||
#define XEDECLARECLASS1(ns1, name) \
|
||||
namespace ns1 { class name; }
|
||||
#define XEDECLARECLASS2(ns1, ns2, name) \
|
||||
namespace ns1 { namespace ns2 { \
|
||||
class name; \
|
||||
} }
|
||||
#define XEDECLARECLASS3(ns1, ns2, ns3, name) \
|
||||
namespace ns1 { namespace ns2 { namespace ns3 { \
|
||||
class name; \
|
||||
} } }
|
||||
#define XEDECLARECLASS4(ns1, ns2, ns3, ns4, name) \
|
||||
namespace ns1 { namespace ns2 { namespace ns3 { namespace ns4 { \
|
||||
class name; \
|
||||
} } } }
|
||||
|
||||
#if XE_COMPILER_MSVC
|
||||
#define XEPACKEDSTRUCT(name, value) \
|
||||
__pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \
|
||||
typedef struct name##_s name;
|
||||
#define XEPACKEDSTRUCTANONYMOUS(value) \
|
||||
__pragma(pack(push, 1)) struct value __pragma(pack(pop));
|
||||
#define XEPACKEDUNION(name, value) \
|
||||
__pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \
|
||||
typedef union name##_s name;
|
||||
#elif XE_COMPILER_GNUC
|
||||
#define XEPACKEDSTRUCT(name, value) \
|
||||
struct __attribute__((packed)) name
|
||||
#define XEPACKEDSTRUCTANONYMOUS(value) \
|
||||
struct __attribute__((packed))
|
||||
#define XEPACKEDUNION(name, value) \
|
||||
union __attribute__((packed)) name
|
||||
#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;
|
||||
|
||||
#define XEFAIL() goto XECLEANUP
|
||||
#define XEEXPECT(expr) if (!(expr) ) { goto XECLEANUP; }
|
||||
|
@ -74,5 +26,4 @@ typedef XECACHEALIGN volatile void xe_aligned_void_t;
|
|||
#define XEEXPECTNULL(expr) if ( (expr) != NULL ) { goto XECLEANUP; }
|
||||
#define XEEXPECTNOTNULL(expr) if ( (expr) == NULL ) { goto XECLEANUP; }
|
||||
|
||||
|
||||
#endif // XENIA_TYPES_H_
|
||||
|
|
Loading…
Reference in New Issue