Add more intrinsic routines
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
@@ -97,7 +97,7 @@ HlInvalidateTlbEntry(IN PVOID Address)
|
||||
{
|
||||
asm volatile("invlpg (%0)"
|
||||
:
|
||||
: "b"(Address)
|
||||
: "b" (Address)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
@@ -117,8 +117,8 @@ HlIoPortInByte(IN USHORT Port)
|
||||
{
|
||||
UCHAR Value;
|
||||
asm volatile("inb %1, %0"
|
||||
: "=a"(Value)
|
||||
: "Nd"(Port));
|
||||
: "=a" (Value)
|
||||
: "Nd" (Port));
|
||||
return Value;
|
||||
}
|
||||
|
||||
@@ -138,8 +138,8 @@ HlIoPortInShort(IN USHORT Port)
|
||||
{
|
||||
USHORT Value;
|
||||
asm volatile("inw %1, %0"
|
||||
: "=a"(Value)
|
||||
: "Nd"(Port));
|
||||
: "=a" (Value)
|
||||
: "Nd" (Port));
|
||||
return Value;
|
||||
}
|
||||
|
||||
@@ -159,8 +159,8 @@ HlIoPortInLong(IN USHORT Port)
|
||||
{
|
||||
ULONG Value;
|
||||
asm volatile("inl %1, %0"
|
||||
: "=a"(Value)
|
||||
: "Nd"(Port));
|
||||
: "=a" (Value)
|
||||
: "Nd" (Port));
|
||||
return Value;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,8 @@ HlIoPortOutByte(IN USHORT Port,
|
||||
{
|
||||
asm volatile("outb %0, %1"
|
||||
:
|
||||
: "a"(Value),
|
||||
"Nd"(Port));
|
||||
: "a" (Value),
|
||||
"Nd" (Port));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,8 +208,8 @@ HlIoPortOutShort(IN USHORT Port,
|
||||
{
|
||||
asm volatile("outw %0, %1"
|
||||
:
|
||||
: "a"(Value),
|
||||
"Nd"(Port));
|
||||
: "a" (Value),
|
||||
"Nd" (Port));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,8 +232,8 @@ HlIoPortOutLong(IN USHORT Port,
|
||||
{
|
||||
asm volatile("outl %0, %1"
|
||||
:
|
||||
: "a"(Value),
|
||||
"Nd"(Port));
|
||||
: "a" (Value),
|
||||
"Nd" (Port));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,9 +316,9 @@ HlReadModelSpecificRegister(IN ULONG Register)
|
||||
ULONG Low, High;
|
||||
|
||||
asm volatile("rdmsr"
|
||||
: "=a"(Low),
|
||||
"=d"(High)
|
||||
: "c"(Register));
|
||||
: "=a" (Low),
|
||||
"=d" (High)
|
||||
: "c" (Register));
|
||||
|
||||
return ((ULONGLONG)High << 32) | Low;
|
||||
}
|
||||
@@ -337,8 +337,8 @@ HlReadTimeStampCounter()
|
||||
ULONGLONG Low, High;
|
||||
|
||||
asm volatile("rdtsc"
|
||||
: "=a"(Low),
|
||||
"=d"(High));
|
||||
: "=a" (Low),
|
||||
"=d" (High));
|
||||
|
||||
return ((ULONGLONG)High << 32) | Low;
|
||||
}
|
||||
@@ -357,6 +357,116 @@ HlSetInterruptFlag()
|
||||
asm volatile("sti");
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores GDT register into the given memory area.
|
||||
*
|
||||
* @param Destination
|
||||
* Supplies a pointer to the memory area where GDT will be stored.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
HlStoreGlobalDescriptorTable(OUT PVOID Destination)
|
||||
{
|
||||
asm volatile("sgdt %0"
|
||||
:
|
||||
: "m" (*(PSHORT)Destination)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores IDT register into the given memory area.
|
||||
*
|
||||
* @param Destination
|
||||
* Supplies a pointer to the memory area where IDT will be stored.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
HlStoreInterruptDescriptorTable(OUT PVOID Destination)
|
||||
{
|
||||
asm volatile("sidt %0"
|
||||
:
|
||||
: "m" (*(PSHORT)Destination)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores specified segment into the given memory area.
|
||||
*
|
||||
* @param Segment
|
||||
* Supplies a segment identification.
|
||||
*
|
||||
* @param Destination
|
||||
* Supplies a pointer to the memory area where segment data will be stored.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
HlStoreSegment(IN USHORT Segment,
|
||||
OUT PVOID Destination)
|
||||
{
|
||||
switch(Segment)
|
||||
{
|
||||
case SEGMENT_CS:
|
||||
asm volatile("movl %%cs, %0"
|
||||
: "=r" (*(PUINT)Destination));
|
||||
break;
|
||||
case SEGMENT_DS:
|
||||
asm volatile("movl %%ds, %0"
|
||||
: "=r" (*(PUINT)Destination));
|
||||
break;
|
||||
case SEGMENT_ES:
|
||||
asm volatile("movl %%es, %0"
|
||||
: "=r" (*(PUINT)Destination));
|
||||
break;
|
||||
case SEGMENT_FS:
|
||||
asm volatile("movl %%fs, %0"
|
||||
: "=r" (*(PUINT)Destination));
|
||||
break;
|
||||
case SEGMENT_GS:
|
||||
asm volatile("movl %%gs, %0"
|
||||
: "=r" (*(PUINT)Destination));
|
||||
break;
|
||||
case SEGMENT_SS:
|
||||
asm volatile("movl %%ss, %0"
|
||||
: "=r" (*(PUINT)Destination));
|
||||
break;
|
||||
default:
|
||||
Destination = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores TR into the given memory area.
|
||||
*
|
||||
* @param Destination
|
||||
* Supplies a pointer to the memory area where TR will be stores.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
HlStoreTaskRegister(OUT PVOID Destination)
|
||||
{
|
||||
asm volatile("str %0"
|
||||
:
|
||||
: "m" (*(PULONG)Destination)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a value to the specified CPU control register.
|
||||
*
|
||||
@@ -439,7 +549,7 @@ HlWriteModelSpecificRegister(IN ULONG Register,
|
||||
|
||||
asm volatile("wrmsr"
|
||||
:
|
||||
: "c"(Register),
|
||||
"a"(Low),
|
||||
"d"(High));
|
||||
: "c" (Register),
|
||||
"a" (Low),
|
||||
"d" (High));
|
||||
}
|
||||
|
Reference in New Issue
Block a user