The Pedigree Project 0.1
Public Member Functions | Public Attributes | Private Attributes | Friends | List of all members
X64SyscallState Class Reference

#include <state.h>

+ Collaboration diagram for X64SyscallState:

Public Member Functions

const X64UserEntryMetadata & getUserEntryMetadata () const
 
void setUserEntryMetadata (const X64UserEntryMetadata &metadata)
 
void refreshUserTlsBase ()
 
uintptr_t getStackPointer () const
 
void setStackPointer (uintptr_t stackPointer)
 
uintptr_t getInstructionPointer () const
 
void setInstructionPointer (uintptr_t instructionPointer)
 
uintptr_t getBasePointer () const
 
void setBasePointer (uintptr_t basePointer)
 
size_t getRegisterCount () const
 
EXPORTED_PUBLIC processor_register_t getRegister (size_t index) const
 
EXPORTED_PUBLIC void setRegister (size_t index, uintptr_t value)
 
const char * getRegisterName (size_t index) const
 
size_t getRegisterSize (size_t index) const
 
size_t getSyscallService () const
 
size_t getSyscallNumber () const
 
ALWAYS_INLINE uintptr_t getSyscallParameter (size_t n) const
 
void setSyscallReturnValue (uintptr_t val)
 
void setSyscallErrno (uintptr_t val)
 
uint64_t getFlags () const
 
void setFlags (uint64_t newFlags)
 

Public Attributes

X64UserEntryMetadata m_UserEntry
 
uint64_t m_R15
 
uint64_t m_R14
 
uint64_t m_R13
 
uint64_t m_R12
 
uint64_t m_R10
 
uint64_t m_R9
 
uint64_t m_R8
 
uint64_t m_Rbp
 
uint64_t m_Rsi
 
uint64_t m_Rdi
 

Private Attributes

uint64_t m_Rdx
 
uint64_t m_Rbx
 
uint64_t m_Rax
 
uint64_t m_RFlagsR11
 
uint64_t m_RipRcx
 
uint64_t m_Rsp
 

Friends

class X64ProcessorState
 
class X64SyscallManager
 

Detailed Description

x64 Syscall State

Definition at line 199 of file x64/state.h.

Member Function Documentation

◆ getBasePointer()

uintptr_t X64SyscallState::getBasePointer ( ) const
inline

Get the base-pointer

Returns
the base-pointer

Definition at line 487 of file x64/state.h.

References m_Rbp.

◆ getFlags()

uint64_t X64SyscallState::getFlags ( ) const
inline

Definition at line 543 of file x64/state.h.

◆ getInstructionPointer()

uintptr_t X64SyscallState::getInstructionPointer ( ) const
inline

Get the instruction-pointer of the next instruction that is executed after the syscall is processed

Returns
the instruction-pointer

Definition at line 481 of file x64/state.h.

References m_RipRcx.

◆ getRegister()

processor_register_t X64SyscallState::getRegister ( size_t  index) const

Get a specific register

Parameters
[in]indexthe index of the register (from 0 to getRegisterCount() - 1)
Returns
the value of the register

Definition at line 119 of file x64/state.cc.

References m_R10, m_R12, m_R13, m_R14, m_R15, m_R8, m_R9, m_Rax, m_Rbp, m_Rbx, m_Rdi, m_Rdx, m_RFlagsR11, m_RipRcx, m_Rsi, and m_Rsp.

◆ getRegisterCount()

size_t X64SyscallState::getRegisterCount ( ) const

Get the number of registers

Returns
the number of registers

Definition at line 116 of file x64/state.cc.

◆ getRegisterName()

const char * X64SyscallState::getRegisterName ( size_t  index) const

Get the name of a specific register

Parameters
[in]indexthe index of the register (from 0 to getRegisterCount() - 1)
Returns
the name of the register

Definition at line 188 of file x64/state.cc.

◆ getRegisterSize()

size_t X64SyscallState::getRegisterSize ( size_t  index) const
inline

Get the register's size in bytes

Parameters
[in]indexthe index of the register (from 0 to getRegisterCount() - 1)
Returns
the register size in bytes

Definition at line 493 of file x64/state.h.

◆ getStackPointer()

uintptr_t X64SyscallState::getStackPointer ( ) const
inline

Get the stack-pointer before the syscall occured

Returns
the stack-pointer before the syscall

Definition at line 475 of file x64/state.h.

References m_Rsp.

◆ getSyscallNumber()

size_t X64SyscallState::getSyscallNumber ( ) const
inline

Get the syscall function number

Returns
the syscall function number

Definition at line 500 of file x64/state.h.

References m_Rax.

◆ getSyscallParameter()

uintptr_t X64SyscallState::getSyscallParameter ( size_t  n) const
inline

Get the n'th parameter for this syscall.

Definition at line 503 of file x64/state.h.

References Dec, m_R10, m_R8, m_R9, m_Rbx, m_Rdi, m_Rdx, and m_Rsi.

◆ getSyscallService()

size_t X64SyscallState::getSyscallService ( ) const
inline

Get the syscall service number

Returns
the syscall service number

Definition at line 497 of file x64/state.h.

References m_Rax.

◆ getUserEntryMetadata()

const X64UserEntryMetadata & X64SyscallState::getUserEntryMetadata ( ) const
inline

Definition at line 204 of file x64/state.h.

◆ refreshUserTlsBase()

void X64SyscallState::refreshUserTlsBase ( )

Definition at line 240 of file x64/state.cc.

◆ setBasePointer()

void X64SyscallState::setBasePointer ( uintptr_t  basePointer)
inline

Set the base-pointer

Parameters
[in]basePointerthe new base-pointer

Definition at line 490 of file x64/state.h.

References m_Rbp.

◆ setFlags()

void X64SyscallState::setFlags ( uint64_t  newFlags)
inline

Definition at line 546 of file x64/state.h.

◆ setInstructionPointer()

void X64SyscallState::setInstructionPointer ( uintptr_t  instructionPointer)
inline

Set the instruction-pointer

Parameters
[in]instructionPointerthe new instruction-pointer

Definition at line 484 of file x64/state.h.

References m_RipRcx.

◆ setRegister()

void X64SyscallState::setRegister ( size_t  index,
uintptr_t  value 
)

Set a specific register in the syscall return image.

Definition at line 154 of file x64/state.cc.

References m_R10, m_R12, m_R13, m_R14, m_R15, m_R8, m_R9, m_Rax, m_Rbp, m_Rbx, m_Rdi, m_Rdx, m_RFlagsR11, m_RipRcx, m_Rsi, and m_Rsp.

◆ setStackPointer()

void X64SyscallState::setStackPointer ( uintptr_t  stackPointer)
inline

Set the userspace stack-pointer

Parameters
[in]stackPointerthe new stack-pointer

Definition at line 478 of file x64/state.h.

References m_Rsp.

◆ setSyscallErrno()

void X64SyscallState::setSyscallErrno ( uintptr_t  val)
inline

Definition at line 540 of file x64/state.h.

◆ setSyscallReturnValue()

void X64SyscallState::setSyscallReturnValue ( uintptr_t  val)
inline

Definition at line 537 of file x64/state.h.

◆ setUserEntryMetadata()

void X64SyscallState::setUserEntryMetadata ( const X64UserEntryMetadata &  metadata)
inline

Definition at line 210 of file x64/state.h.

Friends And Related Symbol Documentation

◆ X64ProcessorState

friend class X64ProcessorState
friend

Definition at line 200 of file x64/state.h.

◆ X64SyscallManager

friend class X64SyscallManager
friend

Definition at line 201 of file x64/state.h.

Member Data Documentation

◆ m_R10

uint64_t X64SyscallState::m_R10

The R10 general purpose register

Definition at line 291 of file x64/state.h.

Referenced by getRegister(), getSyscallParameter(), and setRegister().

◆ m_R12

uint64_t X64SyscallState::m_R12

The R12 general purpose register

Definition at line 289 of file x64/state.h.

Referenced by getRegister(), and setRegister().

◆ m_R13

uint64_t X64SyscallState::m_R13

The R14 general purpose register

Definition at line 287 of file x64/state.h.

Referenced by getRegister(), and setRegister().

◆ m_R14

uint64_t X64SyscallState::m_R14

The R14 general purpose register

Definition at line 285 of file x64/state.h.

Referenced by getRegister(), and setRegister().

◆ m_R15

uint64_t X64SyscallState::m_R15

The R15 general purpose register

Definition at line 283 of file x64/state.h.

Referenced by getRegister(), and setRegister().

◆ m_R8

uint64_t X64SyscallState::m_R8

The R8 general purpose register

Definition at line 295 of file x64/state.h.

Referenced by getRegister(), getSyscallParameter(), and setRegister().

◆ m_R9

uint64_t X64SyscallState::m_R9

The R9 general purpose register

Definition at line 293 of file x64/state.h.

Referenced by getRegister(), getSyscallParameter(), and setRegister().

◆ m_Rax

uint64_t X64SyscallState::m_Rax
private

The RAX general purpose register

Definition at line 311 of file x64/state.h.

Referenced by getRegister(), getSyscallNumber(), getSyscallService(), and setRegister().

◆ m_Rbp

uint64_t X64SyscallState::m_Rbp

The base-pointer

Definition at line 297 of file x64/state.h.

Referenced by getBasePointer(), getRegister(), setBasePointer(), and setRegister().

◆ m_Rbx

uint64_t X64SyscallState::m_Rbx
private

The RBX general purpose register

Definition at line 309 of file x64/state.h.

Referenced by getRegister(), getSyscallParameter(), and setRegister().

◆ m_Rdi

uint64_t X64SyscallState::m_Rdi

The RDI general purpose register

Definition at line 303 of file x64/state.h.

Referenced by getRegister(), getSyscallParameter(), and setRegister().

◆ m_Rdx

uint64_t X64SyscallState::m_Rdx
private

The RDX general purpose register

Definition at line 307 of file x64/state.h.

Referenced by getRegister(), getSyscallParameter(), and setRegister().

◆ m_RFlagsR11

uint64_t X64SyscallState::m_RFlagsR11
private

The R11/RFlags register

Definition at line 313 of file x64/state.h.

Referenced by getRegister(), and setRegister().

◆ m_RipRcx

uint64_t X64SyscallState::m_RipRcx
private

The RIP/RCX register

Definition at line 315 of file x64/state.h.

Referenced by getInstructionPointer(), getRegister(), setInstructionPointer(), and setRegister().

◆ m_Rsi

uint64_t X64SyscallState::m_Rsi

The RSI general purpose register

Definition at line 301 of file x64/state.h.

Referenced by getRegister(), getSyscallParameter(), and setRegister().

◆ m_Rsp

uint64_t X64SyscallState::m_Rsp
private

The stack-pointer

Definition at line 317 of file x64/state.h.

Referenced by getRegister(), getStackPointer(), setRegister(), and setStackPointer().

◆ m_UserEntry

X64UserEntryMetadata X64SyscallState::m_UserEntry

Definition at line 280 of file x64/state.h.


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