Skip to content

x64 General Protection Fault in Blog #99

@Knight-Ops

Description

@Knight-Ops

Walking through https://medium.com/@gil0mendes/an-efi-app-a-bit-rusty-82c36b745f49, it seems that the API has changed, but the old API doesn't throw any type errors and compiles fine. When I go through and run within QEMU I get :
!!!! X64 Exception Type - 0D(#GP - General Protection) CPU Apic ID - 00000000 !!!! ExceptionData - 0000000000000000 RIP - 00000000057EE99C, CS - 0000000000000038, RFLAGS - 0000000000000206 RAX - 5453595320494249, RCX - 0000000007BEE018, RDX - 0000000007BEE000 RBX - 0000000007200498, RSP - 0000000007F0C3E0, RBP - 0000000007F0C5A8 RSI - 0000000000000009, RDI - 0000000007200498 R8 - 0000000000000000, R9 - 0000000007200318, R10 - 0000000007276098 R11 - 000000000000000A, R12 - 0000000000000000, R13 - 0000000007200B18 R14 - 0000000000000000, R15 - 0000000006504598 DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030 GS - 0000000000000030, SS - 0000000000000030 CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000 CR4 - 0000000000000668, CR8 - 0000000000000000 DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 GDTR - 0000000007BEE698 0000000000000047, LDTR - 0000000000000000 IDTR - 00000000076F1018 0000000000000FFF, TR - 0000000000000000 FXSAVE_STATE - 0000000007F0C040 !!!! Find image based on IP(0x57EE99C) (snip) (ImageBase=00000000057EB000, EntryPoint=00000000057EC000) !!!!

This seems to stem from the uefi_services::init. Essentially it boils down to trying to dereference RAX which is obviously ASCII, but there doesn't seem to be cross references to the offending function. I didn't dive too deep down the rabbit hole beyond that. I swapped everything over to the new API seen in the test-runner and it also compiles file, but this actually works without faulting. I haven't hunted down where the actual issue is, but thought it might be useful to either re-document or maybe even add a macro that will enforce the new API.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions