Table of Contents

Struct CpuContext

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

The registers of a thread that reached an InstructionHook, as they are before the hooked instruction runs.

public readonly ref struct CpuContext
Inherited Members

Remarks

The thread continues with every register as the handler leaves it. The context addresses the thread's stack, so it is valid only during the handler's call, and as a ref struct it cannot be stored or captured. The upper halves of the AVX registers are not saved, and the handler's compiled code may clear them. Game code with a 256-bit value live in one across the hooked instruction can therefore lose that value's upper half.

Properties

R10

r10.

public ulong R10 { get; set; }

Property Value

ulong

R11

r11.

public ulong R11 { get; set; }

Property Value

ulong

R12

r12.

public ulong R12 { get; set; }

Property Value

ulong

R13

r13.

public ulong R13 { get; set; }

Property Value

ulong

R14

r14.

public ulong R14 { get; set; }

Property Value

ulong

R15

r15.

public ulong R15 { get; set; }

Property Value

ulong

R8

r8.

public ulong R8 { get; set; }

Property Value

ulong

R9

r9.

public ulong R9 { get; set; }

Property Value

ulong

Rax

rax.

public ulong Rax { get; set; }

Property Value

ulong

Rbp

rbp.

public ulong Rbp { get; set; }

Property Value

ulong

Rbx

rbx.

public ulong Rbx { get; set; }

Property Value

ulong

Rcx

rcx.

public ulong Rcx { get; set; }

Property Value

ulong

Rdi

rdi.

public ulong Rdi { get; set; }

Property Value

ulong

Rdx

rdx.

public ulong Rdx { get; set; }

Property Value

ulong

Rflags

The flags register. The thread continues with the value set, so a set trap or direction flag changes how the game's code runs.

public ulong Rflags { get; set; }

Property Value

ulong

Rip

The address of the instruction the thread runs next. It reads as the hooked address until the handler sets it.

public ulong Rip { get; set; }

Property Value

ulong

Remarks

Setting it to the hooked address runs the hooked instruction, as leaving it unchanged does. Setting it to another address skips the hooked instruction and continues there.

Exceptions

InvalidOperationException

The address lies inside a recorded patch or hook past its first byte, where it would begin within an instruction the patch or hook wrote or moved.

Rsi

rsi.

public ulong Rsi { get; set; }

Property Value

ulong

Rsp

The stack pointer at the hooked instruction. It is read-only, since the saved registers lie on the stack it addresses.

public ulong Rsp { get; }

Property Value

ulong

Xmm0

xmm0.

public ref Xmm Xmm0 { get; }

Property Value

Xmm

Xmm1

xmm1.

public ref Xmm Xmm1 { get; }

Property Value

Xmm

Xmm10

xmm10.

public ref Xmm Xmm10 { get; }

Property Value

Xmm

Xmm11

xmm11.

public ref Xmm Xmm11 { get; }

Property Value

Xmm

Xmm12

xmm12.

public ref Xmm Xmm12 { get; }

Property Value

Xmm

Xmm13

xmm13.

public ref Xmm Xmm13 { get; }

Property Value

Xmm

Xmm14

xmm14.

public ref Xmm Xmm14 { get; }

Property Value

Xmm

Xmm15

xmm15.

public ref Xmm Xmm15 { get; }

Property Value

Xmm

Xmm2

xmm2.

public ref Xmm Xmm2 { get; }

Property Value

Xmm

Xmm3

xmm3.

public ref Xmm Xmm3 { get; }

Property Value

Xmm

Xmm4

xmm4.

public ref Xmm Xmm4 { get; }

Property Value

Xmm

Xmm5

xmm5.

public ref Xmm Xmm5 { get; }

Property Value

Xmm

Xmm6

xmm6.

public ref Xmm Xmm6 { get; }

Property Value

Xmm

Xmm7

xmm7.

public ref Xmm Xmm7 { get; }

Property Value

Xmm

Xmm8

xmm8.

public ref Xmm Xmm8 { get; }

Property Value

Xmm

Xmm9

xmm9.

public ref Xmm Xmm9 { get; }

Property Value

Xmm