ReXGlue SDK
Loading...
Searching...
No Matches
guest.h
Go to the documentation of this file.
1
11
12#pragma once
13
14#include <cstddef>
15#include <span>
16#include <stop_token>
17#include <string_view>
18
19#include <rex/platform.h>
20#include <rex/result.h>
21#include <rex/types.h>
22#include <rex/utility.h>
23
24namespace rex {
25
27 u32 address = 0;
28 u32 length = 0;
29};
30
32 public:
33 virtual ~IPhysicalWriteListener() = default;
34
43 virtual PhysicalRange OnPhysicalWrite(PhysicalRange range, bool exact) = 0;
44};
45
51 public:
52 virtual ~IPhysicalMemory() = default;
53
60 [[nodiscard]] virtual Result<void> CopyFromPhysical(u32 address, std::span<std::byte> out) = 0;
61
68 [[nodiscard]] virtual Result<void> CopyToPhysical(u32 address,
69 std::span<const std::byte> data) = 0;
70
75 PhysicalRange range) = 0;
76
82 PhysicalRange range) = 0;
83
90 [[nodiscard]] virtual Result<void> StoreRelease32(u32 address, u32 value) = 0;
91
98 [[nodiscard]] virtual Result<u32> LoadAcquire32(u32 address) = 0;
99};
100
102 public:
103 virtual ~IPhysicalWriteWatch() = default;
104
111 [[nodiscard]] virtual ScopeGuard AddWriteListener(IPhysicalWriteListener& listener) = 0;
112
116 virtual void WatchPhysicalWrites(PhysicalRange range) = 0;
117
123 [[nodiscard]] virtual ScopeGuard LockWriteWatches() = 0;
124};
125
128 public:
129 virtual ~IGuestInterrupts() = default;
130
138 [[nodiscard]] virtual Result<void> RaiseGraphicsInterrupt(u32 source, u32 cpu) = 0;
139
146 [[nodiscard]] virtual Result<ScopeGuard> StartHostThread(
147 std::string_view name, MoveOnlyFunction<void(std::stop_token)> fn) = 0;
148};
149
150} // namespace rex
Definition guest.h:127
virtual Result< ScopeGuard > StartHostThread(std::string_view name, MoveOnlyFunction< void(std::stop_token)> fn)=0
virtual Result< void > RaiseGraphicsInterrupt(u32 source, u32 cpu)=0
Definition guest.h:50
virtual Result< void > CopyToPhysical(u32 address, std::span< const std::byte > data)=0
virtual Result< u32 > LoadAcquire32(u32 address)=0
virtual Result< std::span< const std::byte > > GetReadOnlyPhysicalSpan(PhysicalRange range)=0
virtual Result< void > StoreRelease32(u32 address, u32 value)=0
virtual Result< std::span< std::byte > > GetWritablePhysicalSpan(PhysicalRange range)=0
virtual Result< void > CopyFromPhysical(u32 address, std::span< std::byte > out)=0
Definition guest.h:31
virtual PhysicalRange OnPhysicalWrite(PhysicalRange range, bool exact)=0
Definition guest.h:101
virtual ScopeGuard LockWriteWatches()=0
virtual void WatchPhysicalWrites(PhysicalRange range)=0
virtual ScopeGuard AddWriteListener(IPhysicalWriteListener &listener)=0
Definition utility.h:305
Definition app.h:36
typename detail::MoveOnlyFunctionFor< Signature >::type MoveOnlyFunction
Definition utility.h:254
std::expected< T, Error > Result
Definition result.h:98
Platform flags, packing macros and export markers.
Definition guest.h:26
Integer types, byte order wrappers and size literals.
Move only function, const propagating pointer and scope guard.