Implement HlLoadSegment() intrinsics routine
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Rafal Kupiec 2023-01-24 19:27:18 +01:00
parent d3d8d144a0
commit 35aa514f95
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
4 changed files with 116 additions and 0 deletions

View File

@ -63,6 +63,11 @@ XTCDECL
VOID VOID
HlLoadGlobalDescriptorTable(IN PVOID Source); HlLoadGlobalDescriptorTable(IN PVOID Source);
XTCDECL
VOID
HlLoadSegment(IN USHORT Segment,
IN PVOID Source);
XTCDECL XTCDECL
VOID VOID
HlLoadTaskRegister(USHORT Source); HlLoadTaskRegister(USHORT Source);

View File

@ -63,6 +63,11 @@ XTCDECL
VOID VOID
HlLoadGlobalDescriptorTable(IN PVOID Source); HlLoadGlobalDescriptorTable(IN PVOID Source);
XTCDECL
VOID
HlLoadSegment(IN USHORT Segment,
IN PVOID Source);
XTCDECL XTCDECL
VOID VOID
HlLoadTaskRegister(USHORT Source); HlLoadTaskRegister(USHORT Source);

View File

@ -256,6 +256,59 @@ HlLoadGlobalDescriptorTable(IN PVOID Source)
: "memory"); : "memory");
} }
/**
* Loads source data into specified segment.
*
* @param Segment
* Supplies a segment identification.
*
* @param Source
* Supplies a pointer to the memory area containing data that will be loaded into specified segment.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlLoadSegment(IN USHORT Segment,
IN PVOID Source)
{
switch(Segment)
{
case SEGMENT_CS:
asm volatile("movl %0, %%cs"
:
: "r" (Source));
break;
case SEGMENT_DS:
asm volatile("movl %0, %%ds"
:
: "r" (Source));
break;
case SEGMENT_ES:
asm volatile("movl %0, %%es"
:
: "r" (Source));
break;
case SEGMENT_FS:
asm volatile("movl %0, %%fs"
:
: "r" (Source));
break;
case SEGMENT_GS:
asm volatile("movl %0, %%gs"
:
: "r" (Source));
break;
case SEGMENT_SS:
asm volatile("movl %0, %%ss"
:
: "r" (Source));
break;
}
}
/** /**
* Loads Task Register (TR) with a segment selector that points to TSS. * Loads Task Register (TR) with a segment selector that points to TSS.
* *

View File

@ -256,6 +256,59 @@ HlLoadGlobalDescriptorTable(IN PVOID Source)
: "memory"); : "memory");
} }
/**
* Loads source data into specified segment.
*
* @param Segment
* Supplies a segment identification.
*
* @param Source
* Supplies a pointer to the memory area containing data that will be loaded into specified segment.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
HlLoadSegment(IN USHORT Segment,
IN PVOID Source)
{
switch(Segment)
{
case SEGMENT_CS:
asm volatile("movl %0, %%cs"
:
: "r" (Source));
break;
case SEGMENT_DS:
asm volatile("movl %0, %%ds"
:
: "r" (Source));
break;
case SEGMENT_ES:
asm volatile("movl %0, %%es"
:
: "r" (Source));
break;
case SEGMENT_FS:
asm volatile("movl %0, %%fs"
:
: "r" (Source));
break;
case SEGMENT_GS:
asm volatile("movl %0, %%gs"
:
: "r" (Source));
break;
case SEGMENT_SS:
asm volatile("movl %0, %%ss"
:
: "r" (Source));
break;
}
}
/** /**
* Loads Task Register (TR) with a segment selector that points to TSS. * Loads Task Register (TR) with a segment selector that points to TSS.
* *