Hi! If I recall correctly, UEFI drivers are not guaranteed to have a valid ConOut and ConIn, and you're not supposed to use those. They are (always?) valid in UEFI apps. Can you try to use DebugLib (don't forget to place DebugLib in LibraryClasses) and DEBUG((DEBUG_INFO, "Blah\n")); ? That should pretty much work. Note that OVMF will send those debug messages to a special device, so you can pass "-debugcon file:debug.log -global isa-debugcon.iobase=0x402" to QEMU to keep them. The rest of your procedure looks mostly OK as far as I can tell. Crash theory: ConOut was garbage, so you tried to jump into a random address. Random address had random data/instructions in there, which caused you an int 6 -> Invalid opcode. Thanks, Pedro On Wed, Nov 2, 2022 at 2:02 PM d.meneses via groups.io wrote: > As detailed on this post on Super User > , I am trying to *add a DXE > driver to an OVMF image* I'm building with edk2. Nobody was able to help > me there so I turn here for your help. > > I haven't found any proper documentation on exactly what I'm trying to > achieve so I am probably missing something. > > So far what I have done is: > > - create the simplest DXE driver I managed > > In folder *MdeModulePkg/Application/Hello*, I have: > *Hello.c* : > include > > ... > > while (1) > SystemTable->ConOut->OutputString(SystemTable->ConOut, > L"It works!\n"); > return EFI_SUCCESS; > > > *Hello.inf* : > [Defines] > INF_VERSION = 0x00010005 > BASE_NAME = Hello > FILE_GUID = ... > MODULE_TYPE = DXE_DRIVER > VERSION_STRING = 1.0 > ENTRY_POINT = UefiMain > > > [Sources] > Hello.c > > [Packages] > MdePkg/MdePkg.dec > MdeModulePkg/MdeModulePkg.dec > > [LibraryClasses] > UefiDriverEntryPoint > UefiLib > > [Depex] > TRUE > > - Set *OvmfPkg/OvmfPkgX64.dsc* as my target platform with *GCC5* as > the toolchain > - Add *MdeModulePkg/Application/Hello/Hello.inf* to the end of the > component section (I have tried to add it after other certain drivers) in > the *.dsc* file. > - Add *Mde**ModulePkg/Application/Hello/Hello.inf* to the end of the > *[FV.DXEFV**]* section in *OvmfPkgX64.fdf* (I have also tried to add > it after other certain drivers) > - Run *build* > - Run *QEMU* with the resulting *OVMF* image: *qemu-system-x86_64** -d > int -D log.txt -bios OVMF.fd -net none -drive > file=fat:rw:bootdrv,format=raw* > - *QEMU* hangs with message *"Guest has not initialized display (yet)"* > - *log.txt* has one log: *check_exception old: 0xffffffff new 0x6* > > > > > -- Pedro Falcato