ReXGlue SDK
Toggle main menu visibility
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
24
struct
PPCFuncMapping
;
25
26
namespace
rex::kernel
{
27
class
IModuleRegistry
;
28
}
// namespace rex::kernel
29
30
namespace
rex::ppc
{
31
37
using
RegisterModulesFunc
= void (*)(
kernel::IModuleRegistry
& modules);
38
40
using
RecompiledCodeFunc
= std::span<const u8> (*)();
41
43
struct
PPCCodegenFlags
{
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
;
60
bool
non_argument_as_local
=
false
;
62
bool
non_volatile_as_local
=
false
;
63
};
64
66
struct
PPCCallUsage
{
67
u32 address;
68
u8
gpr_mask
;
69
u16
fpr_mask
;
70
};
71
73
struct
PPCImage
{
74
u32
code_base
;
75
u32 code_size;
76
u32 image_base;
77
u32 image_size;
79
const
PPCFuncMapping
*
func_mappings
;
80
bool
shim_heap
=
false
;
81
RegisterModulesFunc
register_modules
=
nullptr
;
82
PPCCodegenFlags
codegen_flags
{};
83
RecompiledCodeFunc
recompiled_code
=
84
nullptr
;
86
const
PPCCallUsage
*
call_usage
=
nullptr
;
87
};
88
90
struct
EmbeddedMetadataAsset
{
91
std::span<const u8> bytes;
92
};
93
104
REX_PPC_API
bool
RegisterEmbeddedMetadataAsset
(std::string_view relative_path,
const
u8* data,
105
std::size_t size);
106
112
REX_PPC_API
std::optional<EmbeddedMetadataAsset>
FindEmbeddedMetadataAsset
(
113
const
std::filesystem::path& relative_path);
114
116
enum class
RuntimeFunctionType
: u8 {
117
kSaveMillicode
,
118
kNoHandler
,
119
kRestoreMillicode
,
120
kHandler
121
};
122
123
struct
RuntimeFunction
{
124
u32
begin
;
125
RuntimeFunctionType
type;
126
u32
length
;
127
u32
prologue
;
128
};
129
136
constexpr
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
rex::kernel::IModuleRegistry
Definition
module.h:330
rex::kernel
Definition
export.h:24
rex::ppc
Definition
title_runtime.h:33
rex::ppc::RegisterModulesFunc
void(*)(kernel::IModuleRegistry &modules) RegisterModulesFunc
Definition
image.h:37
rex::ppc::RegisterEmbeddedMetadataAsset
REX_PPC_API bool RegisterEmbeddedMetadataAsset(std::string_view relative_path, const u8 *data, std::size_t size)
rex::ppc::RecompiledCodeFunc
std::span< const u8 >(*)() RecompiledCodeFunc
Definition
image.h:40
rex::ppc::FindEmbeddedMetadataAsset
REX_PPC_API std::optional< EmbeddedMetadataAsset > FindEmbeddedMetadataAsset(const std::filesystem::path &relative_path)
rex::ppc::DecodeRuntimeFunction
constexpr RuntimeFunction DecodeRuntimeFunction(u32 begin, u32 word)
Definition
image.h:136
rex::ppc::RuntimeFunctionType
RuntimeFunctionType
Definition
image.h:116
rex::ppc::RuntimeFunctionType::kNoHandler
@ kNoHandler
Definition
image.h:118
rex::ppc::RuntimeFunctionType::kHandler
@ kHandler
Definition
image.h:120
rex::ppc::RuntimeFunctionType::kSaveMillicode
@ kSaveMillicode
Definition
image.h:117
rex::ppc::RuntimeFunctionType::kRestoreMillicode
@ kRestoreMillicode
Definition
image.h:119
platform.h
Platform flags, packing macros and export markers.
REX_PPC_API
#define REX_PPC_API
Definition
platform.h:194
PPCFuncMapping
Definition
recompiled_code.h:81
rex::ppc::EmbeddedMetadataAsset
Definition
image.h:90
rex::ppc::PPCCallUsage
Definition
image.h:66
rex::ppc::PPCCallUsage::fpr_mask
u16 fpr_mask
Definition
image.h:69
rex::ppc::PPCCallUsage::gpr_mask
u8 gpr_mask
Definition
image.h:68
rex::ppc::PPCCodegenFlags
Definition
image.h:43
rex::ppc::PPCCodegenFlags::xer_as_local
bool xer_as_local
Definition
image.h:49
rex::ppc::PPCCodegenFlags::non_argument_as_local
bool non_argument_as_local
Definition
image.h:60
rex::ppc::PPCCodegenFlags::skip_lr
bool skip_lr
Definition
image.h:45
rex::ppc::PPCCodegenFlags::non_volatile_as_local
bool non_volatile_as_local
Definition
image.h:62
rex::ppc::PPCCodegenFlags::ctr_as_local
bool ctr_as_local
Definition
image.h:47
rex::ppc::PPCCodegenFlags::reserved_as_local
bool reserved_as_local
Definition
image.h:51
rex::ppc::PPCCodegenFlags::skip_msr
bool skip_msr
Definition
image.h:56
rex::ppc::PPCCodegenFlags::cr_as_local
bool cr_as_local
Definition
image.h:58
rex::ppc::PPCImage
Definition
image.h:73
rex::ppc::PPCImage::codegen_flags
PPCCodegenFlags codegen_flags
Definition
image.h:82
rex::ppc::PPCImage::recompiled_code
RecompiledCodeFunc recompiled_code
Definition
image.h:83
rex::ppc::PPCImage::register_modules
RegisterModulesFunc register_modules
Definition
image.h:81
rex::ppc::PPCImage::func_mappings
const PPCFuncMapping * func_mappings
Definition
image.h:79
rex::ppc::PPCImage::shim_heap
bool shim_heap
Definition
image.h:80
rex::ppc::PPCImage::call_usage
const PPCCallUsage * call_usage
Definition
image.h:86
rex::ppc::PPCImage::code_base
u32 code_base
Definition
image.h:74
rex::ppc::RuntimeFunction
Definition
image.h:123
rex::ppc::RuntimeFunction::prologue
u32 prologue
Definition
image.h:127
rex::ppc::RuntimeFunction::length
u32 length
Definition
image.h:126
rex::ppc::RuntimeFunction::begin
u32 begin
Definition
image.h:124
types.h
Integer types, byte order wrappers and size literals.
rex
ppc
image.h
Generated by
1.18.0