ReXGlue SDK
Loading...
Searching...
No Matches
rex::ppc::StackFrame Class Reference

#include <rex/ppc/stack.h>

Inheritance diagram for rex::ppc::StackFrame:
[legend]

Public Member Functions

 StackFrame ()
 StackFrame (PPCContext &ctx, u8 *base)
 ~StackFrame ()
template<typename T>
memory::MappedPtr< T > Push ()
template<typename T>
memory::MappedPtr< T > Push (const T &value)
memory::MappedPtr< char > PushString (std::string_view text)
memory::MappedPtr< be_u16 > PushWideString (std::u16string_view text)
memory::MappedPtr< u8 > PushBytes (std::span< const u8 > bytes)
PPCContext & GetContext () const
u8 * GetBase () const

Additional Inherited Members

Protected Member Functions inherited from rex::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete

Detailed Description

Guest stack space pushed during a scope, released at scope exit. Frames close in reverse order and none stays open across a guest SwitchToFiber.

Constructor & Destructor Documentation

◆ StackFrame() [1/2]

rex::ppc::StackFrame::StackFrame ( )
inline

Binds the context and memory of the calling thread and saves r1.

◆ StackFrame() [2/2]

rex::ppc::StackFrame::StackFrame ( PPCContext & ctx,
u8 * base )
inline

Binds a context and saves its r1.

Parameters
ctxThe context whose r1 is lowered by pushes and restored at scope exit.
baseGuest memory base.

◆ ~StackFrame()

rex::ppc::StackFrame::~StackFrame ( )
inline

Restores r1.

Member Function Documentation

◆ GetBase()

u8 * rex::ppc::StackFrame::GetBase ( ) const
inline

Returns the bound guest memory base.

◆ Push() [1/2]

template<typename T>
memory::MappedPtr< T > rex::ppc::StackFrame::Push ( )
inline

Pushes zeroed storage for a value.

Returns
The storage, mapped to its guest address.

◆ Push() [2/2]

template<typename T>
memory::MappedPtr< T > rex::ppc::StackFrame::Push ( const T & value)
inline

Pushes a value. Arithmetic and enum values are stored big endian. Other types are copied as is, so their fields must be big endian and a pointer inside is not caught.

Returns
The storage, mapped to its guest address.

◆ PushBytes()

memory::MappedPtr< u8 > rex::ppc::StackFrame::PushBytes ( std::span< const u8 > bytes)
inline

Pushes raw bytes with no byte swap.

Returns
The bytes, mapped to their guest address.

◆ PushString()

memory::MappedPtr< char > rex::ppc::StackFrame::PushString ( std::string_view text)
inline

Pushes a NUL terminated byte string.

Returns
The string, mapped to its guest address.

◆ PushWideString()

memory::MappedPtr< be_u16 > rex::ppc::StackFrame::PushWideString ( std::u16string_view text)
inline

Pushes a NUL terminated big endian UTF-16 string.

Returns
The string, mapped to its guest address.

The documentation for this class was generated from the following file: