Skip to content

Commit

Permalink
modify the assemble code
Browse files Browse the repository at this point in the history
Signed-off-by: Dun Tan <[email protected]>
  • Loading branch information
td36 committed Nov 20, 2021
1 parent bfe096f commit 4fd3b50
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ DxeMain (
IN VOID *HobStart
)
{
IoWrite8(0x3f8, 'a');
IoWrite8(0x3f8, 'f');
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS MemoryBaseAddress;
UINT64 MemoryLength;
Expand Down
3 changes: 3 additions & 0 deletions MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
;------------------------------------------------------------------------------
global ASM_PFX(InternalX86EnablePaging64)
ASM_PFX(InternalX86EnablePaging64):
mov dx, 0x3f8
mov al, 't'
out dx, al
cli
mov DWORD [esp], .0 ; offset for far retf, seg is the 1st arg
mov eax, cr4
Expand Down
3 changes: 3 additions & 0 deletions MdePkg/Library/BaseLib/Ia32/WriteIdtr.nasm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
;------------------------------------------------------------------------------
global ASM_PFX(InternalX86WriteIdtr)
ASM_PFX(InternalX86WriteIdtr):
mov dx, 0x3f8
mov al, 't'
out dx, al
mov eax, [esp + 4]
pushfd
cli
Expand Down
1 change: 1 addition & 0 deletions MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
PcdLib
DebugLib
BaseMemoryLib
IoLib

[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength ## SOMETIMES_CONSUMES
Expand Down
5 changes: 4 additions & 1 deletion MdePkg/Library/BaseLib/X86EnablePaging64.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@




#include <Library/IoLib.h>
#include "BaseLibInternals.h"


/**
Enables the 64-bit paging mode on the CPU.
Expand Down Expand Up @@ -53,7 +54,9 @@ AsmEnablePaging64 (
IN UINT64 NewStack
)
{
IoWrite8(0x3f8, '9');
ASSERT (EntryPoint != 0);
ASSERT (NewStack != 0);
IoWrite8(0x3f8, '8');
InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
}
4 changes: 3 additions & 1 deletion MdePkg/Library/BaseLib/X86WriteIdtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@




#include <Library/IoLib.h>
#include "BaseLibInternals.h"

/**
Expand All @@ -28,6 +28,8 @@ AsmWriteIdtr (
IN CONST IA32_DESCRIPTOR *Idtr
)
{
IoWrite8(0x3f8, 'z');
ASSERT (Idtr != NULL);
IoWrite8(0x3f8, 'z');
InternalX86WriteIdtr (Idtr);
}
3 changes: 2 additions & 1 deletion UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ HandOffToDxeCore (

DEBUG ((
DEBUG_INFO,
"%a() Stack Base: 0x%lx, Stack Size: 0x%x\n",
"%a() Stack Base: 0x%lx, oooooStack Size: 0x%x\n",
__FUNCTION__,
BaseOfStack,
STACK_SIZE
Expand All @@ -356,6 +356,7 @@ HandOffToDxeCore (
// Interrupts will not get turned on until the CPU AP is loaded.
// Call x64 drivers passing in single argument, a pointer to the HOBs.
//
DEBUG ((DEBUG_INFO, "the AsmEnablePaging64 addr is %p\n", AsmEnablePaging64));
AsmEnablePaging64 (
SYS_CODE64_SEL,
DxeCoreEntryPoint,
Expand Down
4 changes: 3 additions & 1 deletion UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ _ModuleEntryPoint (
// Call constructor for all libraries
ProcessLibraryConstructorList ();

DEBUG ((DEBUG_INFO, "the entrypoint addr is %p\n", _ModuleEntryPoint));
DEBUG ((DEBUG_INFO, "the ProcessLibraryConstructorList addr is %p\n", ProcessLibraryConstructorList));
DEBUG ((DEBUG_INFO, "Entering Universal Payload...\n"));
DEBUG ((DEBUG_INFO, "sizeof(UINTN) = 0x%x\n", sizeof(UINTN)));

Expand All @@ -412,7 +414,7 @@ _ModuleEntryPoint (

// Initialize floating point operating environment to be compliant with UEFI spec.
InitializeFloatingPointUnits ();

DEBUG ((DEBUG_INFO, "the InitializeFloatingPointUnits addr is %p\n", InitializeFloatingPointUnits));
// Build HOB based on information from Bootloader
Status = BuildHobs (BootloaderParameter, &DxeFv);
ASSERT_EFI_ERROR (Status);
Expand Down

0 comments on commit 4fd3b50

Please sign in to comment.