2013-01-20 09:13:59 +00:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
* 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_PROCESSOR_H_
|
|
|
|
#define XENIA_CPU_PROCESSOR_H_
|
|
|
|
|
2014-08-16 07:56:50 +00:00
|
|
|
#include <mutex>
|
|
|
|
#include <vector>
|
|
|
|
|
2015-02-01 06:49:47 +00:00
|
|
|
#include "xenia/common.h"
|
|
|
|
#include "xenia/export_resolver.h"
|
|
|
|
#include "xenia/memory.h"
|
2013-06-01 04:22:00 +00:00
|
|
|
|
2013-01-20 09:13:59 +00:00
|
|
|
namespace xe {
|
|
|
|
namespace cpu {
|
|
|
|
|
2014-08-21 05:50:10 +00:00
|
|
|
class XenonRuntime;
|
|
|
|
class XenonThreadState;
|
|
|
|
class XexModule;
|
2013-01-20 09:13:59 +00:00
|
|
|
|
2014-08-04 22:39:42 +00:00
|
|
|
enum class Irql : uint32_t {
|
|
|
|
PASSIVE = 0,
|
|
|
|
APC = 1,
|
|
|
|
DISPATCH = 2,
|
|
|
|
DPC = 3,
|
|
|
|
};
|
|
|
|
|
2014-07-10 04:21:40 +00:00
|
|
|
class Processor {
|
2014-08-21 05:50:10 +00:00
|
|
|
public:
|
2014-09-10 03:25:38 +00:00
|
|
|
Processor(Memory* memory, ExportResolver* export_resolver);
|
2013-01-20 09:13:59 +00:00
|
|
|
~Processor();
|
|
|
|
|
2013-10-24 03:42:24 +00:00
|
|
|
ExportResolver* export_resolver() const { return export_resolver_; }
|
2013-12-07 06:57:16 +00:00
|
|
|
XenonRuntime* runtime() const { return runtime_; }
|
|
|
|
Memory* memory() const { return memory_; }
|
2013-01-20 09:13:59 +00:00
|
|
|
|
|
|
|
int Setup();
|
|
|
|
|
2014-08-21 05:50:10 +00:00
|
|
|
int Execute(XenonThreadState* thread_state, uint64_t address);
|
|
|
|
uint64_t Execute(XenonThreadState* thread_state, uint64_t address,
|
|
|
|
uint64_t args[], size_t arg_count);
|
2013-09-25 07:46:09 +00:00
|
|
|
|
2014-08-04 22:39:42 +00:00
|
|
|
Irql RaiseIrql(Irql new_value);
|
|
|
|
void LowerIrql(Irql old_value);
|
|
|
|
|
2014-08-21 05:50:10 +00:00
|
|
|
uint64_t ExecuteInterrupt(uint32_t cpu, uint64_t address, uint64_t args[],
|
|
|
|
size_t arg_count);
|
2013-01-28 01:49:32 +00:00
|
|
|
|
2014-08-21 05:50:10 +00:00
|
|
|
private:
|
|
|
|
ExportResolver* export_resolver_;
|
2013-12-07 06:57:16 +00:00
|
|
|
|
2014-08-21 05:50:10 +00:00
|
|
|
XenonRuntime* runtime_;
|
|
|
|
Memory* memory_;
|
2013-12-07 06:57:16 +00:00
|
|
|
|
2014-08-21 05:50:10 +00:00
|
|
|
Irql irql_;
|
|
|
|
std::mutex interrupt_thread_lock_;
|
|
|
|
XenonThreadState* interrupt_thread_state_;
|
|
|
|
uint64_t interrupt_thread_block_;
|
2013-01-20 09:13:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace cpu
|
|
|
|
} // namespace xe
|
|
|
|
|
|
|
|
#endif // XENIA_CPU_PROCESSOR_H_
|