[FREELDR] Move common x64 runtime-specific ASM helpers to a misc file.

Co-authored-by: Justin Miller <justinmiller100@gmail.com>
This commit is contained in:
Hermès Bélusca-Maïto 2023-03-09 17:26:38 +01:00
parent 557306f5c0
commit 7a2aca423e
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 39 additions and 34 deletions

View file

@ -163,6 +163,7 @@ elseif(ARCH STREQUAL "amd64")
list(APPEND FREELDR_COMMON_ASM_SOURCE
arch/amd64/entry.S
arch/amd64/int386.S
arch/amd64/misc.S
arch/amd64/pnpbios.S
arch/amd64/linux.S)

View file

@ -212,40 +212,6 @@ CallRealMode_return:
/////////////////////////////////////////
// void __fastfail(unsigned int Code<rcx>);
PUBLIC __fastfail
__fastfail:
// mov ecx, [rsp + 4]
int HEX(29)
// void __lgdt(void *Source<rcx>);
PUBLIC __lgdt
__lgdt:
#ifdef _USE_ML
lgdt fword ptr [rcx]
#else
lgdt cs:[rcx]
#endif
ret
// void __ltr(unsigned short Source<rcx>);
PUBLIC __ltr
__ltr:
ltr cx
ret
// void _sgdt(void *Destination<rcx>);
PUBLIC __sgdt
__sgdt:
#ifdef _USE_ML
sgdt fword ptr [rcx]
#else
sgdt cs:[rcx]
#endif
ret
/* 64-bit stack pointer */
stack64:
.quad STACKADDR

View file

@ -0,0 +1,38 @@
#include <asm.inc>
.code64
// void __fastfail(unsigned int Code<rcx>);
PUBLIC __fastfail
__fastfail:
// mov ecx, [rsp + 4]
int HEX(29)
// void __lgdt(void *Source<rcx>);
PUBLIC __lgdt
__lgdt:
#ifdef _USE_ML
lgdt fword ptr [rcx]
#else
lgdt cs:[rcx]
#endif
ret
// void __ltr(unsigned short Source<rcx>);
PUBLIC __ltr
__ltr:
ltr cx
ret
// void _sgdt(void *Destination<rcx>);
PUBLIC __sgdt
__sgdt:
#ifdef _USE_ML
sgdt fword ptr [rcx]
#else
sgdt cs:[rcx]
#endif
ret
END