ReXGlue SDK
Loading...
Searching...
No Matches
image.h
Go to the documentation of this file.
1
11
12#pragma once
13
14#include <span>
15#include <cstddef>
16#include <cstdint>
17#include <filesystem>
18#include <optional>
19#include <string_view>
20
21#include <rex/types.h>
22#include <rex/platform.h>
23
24struct PPCFuncMapping;
25
26namespace rex::kernel {
27class IModuleRegistry;
28} // namespace rex::kernel
29
30namespace rex::ppc {
31
38
40using RecompiledCodeFunc = std::span<const u8> (*)();
41
45 bool skip_lr = false;
47 bool ctr_as_local = false;
49 bool xer_as_local = false;
51 bool reserved_as_local = false;
56 bool skip_msr = false;
58 bool cr_as_local = false;
63};
64
67 u32 address;
70};
71
73struct PPCImage {
75 u32 code_size;
76 u32 image_base;
77 u32 image_size;
80 bool shim_heap = false;
84 nullptr;
86 const PPCCallUsage* call_usage = nullptr;
87};
88
91 std::span<const u8> bytes;
92};
93
104REX_PPC_API bool RegisterEmbeddedMetadataAsset(std::string_view relative_path, const u8* data,
105 std::size_t size);
106
112REX_PPC_API std::optional<EmbeddedMetadataAsset> FindEmbeddedMetadataAsset(
113 const std::filesystem::path& relative_path);
114
122
129
136constexpr RuntimeFunction DecodeRuntimeFunction(u32 begin, u32 word) {
137 return RuntimeFunction{begin, static_cast<RuntimeFunctionType>(word >> 30),
138 (word >> 8) & 0x3FFFFFu, word & 0xFFu};
139}
140
141} // namespace rex::ppc
Definition module.h:330
Definition export.h:24
Definition title_runtime.h:33
void(*)(kernel::IModuleRegistry &modules) RegisterModulesFunc
Definition image.h:37
REX_PPC_API bool RegisterEmbeddedMetadataAsset(std::string_view relative_path, const u8 *data, std::size_t size)
std::span< const u8 >(*)() RecompiledCodeFunc
Definition image.h:40
REX_PPC_API std::optional< EmbeddedMetadataAsset > FindEmbeddedMetadataAsset(const std::filesystem::path &relative_path)
constexpr RuntimeFunction DecodeRuntimeFunction(u32 begin, u32 word)
Definition image.h:136
RuntimeFunctionType
Definition image.h:116
@ kNoHandler
Definition image.h:118
@ kHandler
Definition image.h:120
@ kSaveMillicode
Definition image.h:117
@ kRestoreMillicode
Definition image.h:119
Platform flags, packing macros and export markers.
#define REX_PPC_API
Definition platform.h:194
Definition recompiled_code.h:81
Definition image.h:90
Definition image.h:66
u16 fpr_mask
Definition image.h:69
u8 gpr_mask
Definition image.h:68
Definition image.h:43
bool xer_as_local
Definition image.h:49
bool non_argument_as_local
Definition image.h:60
bool skip_lr
Definition image.h:45
bool non_volatile_as_local
Definition image.h:62
bool ctr_as_local
Definition image.h:47
bool reserved_as_local
Definition image.h:51
bool skip_msr
Definition image.h:56
bool cr_as_local
Definition image.h:58
Definition image.h:73
PPCCodegenFlags codegen_flags
Definition image.h:82
RecompiledCodeFunc recompiled_code
Definition image.h:83
RegisterModulesFunc register_modules
Definition image.h:81
const PPCFuncMapping * func_mappings
Definition image.h:79
bool shim_heap
Definition image.h:80
const PPCCallUsage * call_usage
Definition image.h:86
u32 code_base
Definition image.h:74
Definition image.h:123
u32 prologue
Definition image.h:127
u32 length
Definition image.h:126
u32 begin
Definition image.h:124
Integer types, byte order wrappers and size literals.