Skip to content

UEFI module cannot print using Print() or DEBUG() function #1266

@Sunxingzhezhexingsun

Description

@Sunxingzhezhexingsun

Describe the bug
UEFI module cannot print using Print() or DEBUG() function.
When I tried to print strings using Print() or DEBUG() in UEFI code, I didn't get the desired output and Qiling didn't report any errors.

UEFI Module code:

Print(L"[%d]My UEFI Helloworld.\n", Index);
# Or use DEBUG()
# DEBUG((DEBUG_INFO, "[%a][%d]: MyHelloWorldDxe saying Hi\n", __FUNCTION__, i));

Qiling code:

    with open(r'./lzx_uefi/rom2_nvar.pickel', 'rb') as f:
        env = pickle.load(f)

    ql = Qiling(["./lzx_uefi/bin/MyHelloWorldApp.efi"], "./lzx_uefi/", env=env, verbose=QL_VERBOSE.DEBUG)
    # ql.debugger = True
    
    class MyMapper:
        def add_fs_mapping(self, ql_path, real_dest):
            pass
    
    ql.os.fs_mapper = MyMapper()
    ql.run()

Expected behavior
Outut the specific string.

Nothing is printed:
image

[=]     Module ./lzx_uefi/bin/MyHelloWorldApp.efi loaded to 0x100000
[=]     Module entry point at 0x1003a8
[=]     Initializing EFI_LOADED_IMAGE_PROTOCOL
[=]
[=]     Done loading modules
[=]     Running from 0x001003a8 of ./lzx_uefi/bin/MyHelloWorldApp.efi
[+]     0x00000000040001b8: LocateProtocol(Protocol = EfiDevicePathUtilitiesProtocolGuid, Registration = NULL, Interface = 0x00101840) = 0x800000000000000e
[+]     0x00000000040000b8: AllocatePool(PoolType = 0x4, Size = 0x282, Buffer = 0x0507ff38) = 0x0
[+]     0x00000000040000c0: FreePool(Buffer = 0x04011098) = 0x0
[+]     0x00000000040000b8: AllocatePool(PoolType = 0x4, Size = 0x282, Buffer = 0x0507ff38) = 0x0
[+]     0x00000000040000c0: FreePool(Buffer = 0x04011098) = 0x0
[+]     0x00000000040000b8: AllocatePool(PoolType = 0x4, Size = 0x282, Buffer = 0x0507ff38) = 0x0
[+]     0x00000000040000c0: FreePool(Buffer = 0x04011098) = 0x0
[+]     0x00000000040000b8: AllocatePool(PoolType = 0x4, Size = 0x282, Buffer = 0x0507ff38) = 0x0
[+]     0x00000000040000c0: FreePool(Buffer = 0x04011098) = 0x0
[+]     0x00000000040000b8: AllocatePool(PoolType = 0x4, Size = 0x282, Buffer = 0x0507ff38) = 0x0
[+]     0x00000000040000c0: FreePool(Buffer = 0x04011098) = 0x0
[+]     0x00000000040000b8: AllocatePool(PoolType = 0x4, Size = 0x282, Buffer = 0x0507ff38) = 0x0
[+]     0x00000000040000c0: FreePool(Buffer = 0x04011098) = 0x0
[+]     0x00000000040000b8: AllocatePool(PoolType = 0x4, Size = 0x282, Buffer = 0x0507ff38) = 0x0
[+]     0x00000000040000c0: FreePool(Buffer = 0x04011098) = 0x0
[+]     0x00000000040000b8: AllocatePool(PoolType = 0x4, Size = 0x282, Buffer = 0x0507ff38) = 0x0
[+]     0x00000000040000c0: FreePool(Buffer = 0x04011098) = 0x0
[=]     No more modules to run

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existsos uefiUEFI emulation related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions