Skip to content

Commit

Permalink
[CODEREVIEW]
Browse files Browse the repository at this point in the history
Co-authored-by: Hermès BÉLUSCA - MAÏTO <[email protected]>
  • Loading branch information
DarkFire01 and HBelusca committed Oct 11, 2023
1 parent e04cbd3 commit dbd3356
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
17 changes: 6 additions & 11 deletions boot/freeldr/freeldr/arch/uefi/amd64/uefiasm.S
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ _exituefi:
push rdi
push rbx


/* Save the old stack */
mov rbx, rsp

Expand All @@ -46,6 +45,12 @@ _exituefi:
pop rsi
pop rbp

#ifdef _USE_ML
lgdt fword ptr [_gdtptr]
#else
lgdt cs:[_gdtptr][rip] /* GAS isn't my friend - avoid letting it generate absolute addressing */
#endif

/* All done */
ret

Expand All @@ -58,16 +63,6 @@ _changestack:
call ExecuteLoaderCleanly[rip]
ret

// void _changegdt(VOID)
PUBLIC _changegdt
_changegdt:
#ifdef _USE_ML
lgdt fword ptr [_gdtptr]
#else
lgdt cs:[_gdtptr][rip] /* GAS isn't my friend - avoid letting it generate absolute addressing */
#endif
ret

.align 8
gdt:
.word HEX(0000), HEX(0000), HEX(0000), HEX(0000) /* 00: NULL descriptor */
Expand Down
7 changes: 7 additions & 0 deletions boot/freeldr/freeldr/arch/uefi/i386/uefiasm.S
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ __exituefi:
pop esi
pop ebp

#ifdef _USE_ML
lidt fword ptr ds:[_i386idtptr]
lgdt fword ptr [_gdtptr]
#else
lgdt cs:[_gdtptr]
lidt _i386idtptr
#endif

/* All done */
ret
Expand Down
2 changes: 1 addition & 1 deletion boot/freeldr/freeldr/arch/uefi/uefildr.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ VOID __cdecl Reboot(VOID)
WARN("Stopping freeloader something has gone wrong - Freezing");
for(;;)
{

NOTHING;
}
}
#endif
4 changes: 1 addition & 3 deletions boot/freeldr/freeldr/arch/uefi/uefimem.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ EFI_HANDLE PublicBootHandle;
PVOID ExitStack;
PVOID EndofExitStack;

void _changegdt(VOID);
void _exituefi(VOID);

/* FUNCTIONS *****************************************************************/
Expand Down Expand Up @@ -89,7 +88,7 @@ VOID
UefiSetMemory(
_Inout_ PFREELDR_MEMORY_DESCRIPTOR MemoryMap,
_In_ ULONG_PTR BaseAddress,
_In_ PFN_COUNT Size,
_In_ PFN_COUNT SizeInPages,
_In_ TYPE_OF_MEMORY MemoryType)
{
ULONG_PTR BasePage, PageCount;
Expand Down Expand Up @@ -327,5 +326,4 @@ VOID
UefiPrepareForReactOS(VOID)
{
_exituefi();
_changegdt();
}

0 comments on commit dbd3356

Please sign in to comment.