]> git.proxmox.com Git - mirror_edk2.git/commit
OvmfPkg/AcpiPlatformDxe: implement the QEMU_LOADER_WRITE_POINTER command
authorLaszlo Ersek <lersek@redhat.com>
Wed, 8 Feb 2017 20:53:02 +0000 (21:53 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Tue, 21 Feb 2017 12:10:39 +0000 (13:10 +0100)
commit9965cbd424f22b35e7743c2f59ab3ee1db15142a
treee80df06c697ecfeddc5c77e5720cf748394a059f
parentab63766baf3d46ed0d61af58b74d044936129e8b
OvmfPkg/AcpiPlatformDxe: implement the QEMU_LOADER_WRITE_POINTER command

The QEMU_LOADER_WRITE_POINTER command instructs the firmware to write the
address of a field within a previously allocated/downloaded fw_cfg blob
into another (writeable) fw_cfg file at a specific offset.

Put differently, QEMU_LOADER_WRITE_POINTER propagates, to QEMU, the
address that QEMU_LOADER_ALLOCATE placed the designated fw_cfg blob at, as
adjusted for the given field inside the allocated blob.

The implementation is similar to that of QEMU_LOADER_ADD_POINTER. Since
here we "patch" a pointer object in "fw_cfg file space", not guest memory
space, we utilize the QemuFwCfgSkipBytes() and QemuFwCfgWriteBytes() APIs
completed in commit range 465663e9f128..7fcb73541299.

An interesting aspect is that QEMU_LOADER_WRITE_POINTER creates a
host-level reference to a guest memory location. Therefore, if we fail to
process the linker/loader script for any reason, we have to clear out
those references first, before we release the guest memory allocations in
response to the error.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c