2024-02-25 08:20:34 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2019-11-19 10:30:04 +00:00
|
|
|
#pragma once
|
2023-10-03 14:19:17 +00:00
|
|
|
|
2020-10-18 04:43:09 +00:00
|
|
|
#include "bus.h"
|
2019-11-19 10:30:04 +00:00
|
|
|
#include "cpu_types.h"
|
2023-09-03 04:30:26 +00:00
|
|
|
|
2024-05-05 11:32:04 +00:00
|
|
|
class Error;
|
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
namespace CPU::CodeCache {
|
2021-05-22 04:55:25 +00:00
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
/// Returns true if any recompiler is in use.
|
|
|
|
bool IsUsingAnyRecompiler();
|
2019-11-27 15:55:33 +00:00
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
/// Returns true if any recompiler and fastmem is in use.
|
|
|
|
bool IsUsingFastmem();
|
2019-11-27 15:55:33 +00:00
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
/// Allocates resources, call once at startup.
|
2024-05-05 11:32:04 +00:00
|
|
|
bool ProcessStartup(Error* error);
|
2019-11-27 15:55:33 +00:00
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
/// Frees resources, call once at shutdown.
|
|
|
|
void ProcessShutdown();
|
2021-07-20 02:33:37 +00:00
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
/// Initializes resources for the system.
|
2020-10-18 04:43:55 +00:00
|
|
|
void Initialize();
|
2020-10-18 04:43:09 +00:00
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
/// Frees resources used by the system.
|
|
|
|
void Shutdown();
|
2023-08-15 13:12:21 +00:00
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
/// Runs the system.
|
|
|
|
[[noreturn]] void Execute();
|
2020-08-08 05:42:11 +00:00
|
|
|
|
2020-07-31 07:09:18 +00:00
|
|
|
/// Flushes the code cache, forcing all blocks to be recompiled.
|
2023-10-03 14:19:17 +00:00
|
|
|
void Reset();
|
2019-11-23 03:16:43 +00:00
|
|
|
|
2020-07-31 07:09:18 +00:00
|
|
|
/// Invalidates all blocks which are in the range of the specified code page.
|
|
|
|
void InvalidateBlocksWithPageIndex(u32 page_index);
|
2019-11-23 03:16:43 +00:00
|
|
|
|
2021-12-02 08:40:31 +00:00
|
|
|
/// Invalidates all blocks in the cache.
|
2023-10-03 14:19:17 +00:00
|
|
|
void InvalidateAllRAMBlocks();
|
2019-11-23 03:16:43 +00:00
|
|
|
|
2023-10-03 14:19:17 +00:00
|
|
|
} // namespace CPU::CodeCache
|