Moving cpu/runtime/ to cpu/.

This commit is contained in:
Ben Vanik
2015-03-24 08:25:58 -07:00
parent 29912f44c0
commit 9281d62106
102 changed files with 394 additions and 771 deletions

View File

@@ -0,0 +1,55 @@
/**
******************************************************************************
* 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_ENTRY_TABLE_H_
#define XENIA_CPU_ENTRY_TABLE_H_
#include <mutex>
#include <unordered_map>
#include <vector>
namespace xe {
namespace cpu {
class Function;
typedef struct Entry_t {
typedef enum {
STATUS_NEW = 0,
STATUS_COMPILING,
STATUS_READY,
STATUS_FAILED,
} Status;
uint64_t address;
uint64_t end_address;
Status status;
Function* function;
} Entry;
class EntryTable {
public:
EntryTable();
~EntryTable();
Entry* Get(uint64_t address);
Entry::Status GetOrCreate(uint64_t address, Entry** out_entry);
std::vector<Function*> FindWithAddress(uint64_t address);
private:
// TODO(benvanik): replace with a better data structure.
std::mutex lock_;
std::unordered_map<uint64_t, Entry*> map_;
};
} // namespace cpu
} // namespace xe
#endif // XENIA_CPU_ENTRY_TABLE_H_