2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2019-11-19 10:30:04 +00:00
|
|
|
#pragma once
|
2020-07-31 07:09:18 +00:00
|
|
|
#include "cpu_code_cache.h"
|
2019-12-28 04:04:15 +00:00
|
|
|
#include "cpu_types.h"
|
2019-11-19 10:30:04 +00:00
|
|
|
|
2019-12-28 04:04:15 +00:00
|
|
|
namespace CPU {
|
2021-05-22 04:55:25 +00:00
|
|
|
struct CodeBlock;
|
2019-12-28 04:04:15 +00:00
|
|
|
struct CodeBlockInstruction;
|
|
|
|
|
2020-07-31 07:09:18 +00:00
|
|
|
namespace Recompiler::Thunks {
|
2019-11-19 10:30:04 +00:00
|
|
|
|
2020-07-31 07:09:18 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Trampolines for calling back from the JIT
|
|
|
|
// Needed because we can't cast member functions to void*...
|
|
|
|
// TODO: Abuse carry flag or something else for exception
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
bool InterpretInstruction();
|
2020-08-19 13:26:57 +00:00
|
|
|
bool InterpretInstructionPGXP();
|
2020-08-29 12:07:33 +00:00
|
|
|
void CheckAndUpdateICache(u32 pc, u32 line_count);
|
2020-07-31 07:09:18 +00:00
|
|
|
|
|
|
|
// Memory access functions for the JIT - MSB is set on exception.
|
2020-08-08 05:15:56 +00:00
|
|
|
u64 ReadMemoryByte(u32 address);
|
|
|
|
u64 ReadMemoryHalfWord(u32 address);
|
|
|
|
u64 ReadMemoryWord(u32 address);
|
2021-04-26 11:57:00 +00:00
|
|
|
u32 WriteMemoryByte(u32 address, u32 value);
|
|
|
|
u32 WriteMemoryHalfWord(u32 address, u32 value);
|
2020-08-08 05:15:56 +00:00
|
|
|
u32 WriteMemoryWord(u32 address, u32 value);
|
2020-07-31 07:09:18 +00:00
|
|
|
|
2020-08-08 06:44:12 +00:00
|
|
|
// Unchecked memory access variants. No alignment or bus exceptions.
|
|
|
|
u32 UncheckedReadMemoryByte(u32 address);
|
|
|
|
u32 UncheckedReadMemoryHalfWord(u32 address);
|
|
|
|
u32 UncheckedReadMemoryWord(u32 address);
|
2021-04-26 11:57:00 +00:00
|
|
|
void UncheckedWriteMemoryByte(u32 address, u32 value);
|
|
|
|
void UncheckedWriteMemoryHalfWord(u32 address, u32 value);
|
2020-08-08 06:44:12 +00:00
|
|
|
void UncheckedWriteMemoryWord(u32 address, u32 value);
|
|
|
|
|
2021-05-22 04:55:25 +00:00
|
|
|
void ResolveBranch(CodeBlock* block, void* host_pc, void* host_resolve_pc, u32 host_pc_size);
|
|
|
|
void LogPC(u32 pc);
|
|
|
|
|
2020-07-31 07:09:18 +00:00
|
|
|
} // namespace Recompiler::Thunks
|
2019-12-28 04:04:15 +00:00
|
|
|
|
2020-11-20 15:56:51 +00:00
|
|
|
} // namespace CPU
|