Implement HlReadGSQuadWord() intrinsic
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Rafal Kupiec 2023-01-23 19:59:54 +01:00
parent 9fd21a8820
commit c81b858757
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 25 additions and 0 deletions

View File

@ -67,6 +67,10 @@ XTCDECL
ULONG_PTR ULONG_PTR
HlReadControlRegister(IN USHORT ControlRegister); HlReadControlRegister(IN USHORT ControlRegister);
XTCDECL
ULONGLONG
HlReadGSQuadWord(ULONG Offset);
XTCDECL XTCDECL
ULONGLONG ULONGLONG
HlReadModelSpecificRegister(IN ULONG Register); HlReadModelSpecificRegister(IN ULONG Register);

View File

@ -318,6 +318,27 @@ HlReadControlRegister(IN USHORT ControlRegister)
return Value; return Value;
} }
/**
* Reads quadword from a memory location specified by an offset relative to the beginning of the GS segment.
*
* @param Offset
* Specifies the offset from the beginning of GS segment.
*
* @return Returns the value read from the specified memory location relative to GS segment.
*
* @since XT 1.0
*/
XTCDECL
ULONGLONG
HlReadGSQuadWord(ULONG Offset)
{
ULONGLONG Value;
/* Read quadword from GS segment */
asm volatile("movq %%gs:%a[Offset], %q[Value]" : [Value] "=r" (Value) : [Offset] "ir" (Offset));
return Value;
}
/** /**
* Reads a 64-bit value from the requested Model Specific Register (MSR). * Reads a 64-bit value from the requested Model Specific Register (MSR).
* *