From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web09.7182.1646227944999519812 for ; Wed, 02 Mar 2022 05:32:25 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Htmu/hGN; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: sebastien.boeuf@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646227945; x=1677763945; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=REcb2JzaDunTLVmvnrL1qQE+lGPYZ2Js++FBgfBnyNE=; b=Htmu/hGND6kGi1Y7gSWgIbO7fwMqEG/pDnMC+zx4encQFYgXZKqc4UFU 3Q3DoL9uO2Xjn0RlpbWrvshyxEvCHv1vTohMOfDh3+zJuCl0cUoCNJx2X K6q0qS32DnYYUzsNYP2fZ+uf48fYVcdeROptSmdxzRM1AjpdpM96iK8cR 2OxCnHVvtwpLEzzE38DUHq7zMgYffHEUA7yvYwcHsuCCvs8cBSFZvOPuo FFKOEcWMmMUGvCnNOOQNsay4s/zL3IvwCij2kIJIOn5wQOXfUFDzUH2UQ d1TEDiGN6jIbNpDnksCBGQAVbtaac3Tu+mX2jGkxrrUYibSdPKS5YPWlV g==; X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="250974653" X-IronPort-AV: E=Sophos;i="5.90,149,1643702400"; d="scan'208";a="250974653" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 05:32:03 -0800 X-IronPort-AV: E=Sophos;i="5.90,149,1643702400"; d="scan'208";a="535389250" Received: from spearce-mobl1.amr.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.27.130]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 05:32:01 -0800 From: "Boeuf, Sebastien" To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, jordan.l.justen@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [PATCH v6 2/8] OvmfPkg: Xen: Use a new fdf include for the PVH ELF header Date: Wed, 2 Mar 2022 14:31:31 +0100 Message-Id: <706cda501c9864adcccf9e1da681fbefb16c4eac.1646227817.git.sebastien.boeuf@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From: Sebastien Boeuf Instead of having the PVH ELF header part of the fdf file directly, we move it to a dedicated include file. This is the first step in automating the generation of the header. Acked-by: Gerd Hoffmann Signed-off-by: Sebastien Boeuf --- OvmfPkg/OvmfXen.fdf | 57 ++------------------------------ OvmfPkg/XenElfHeader.fdf.inc | 64 ++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 55 deletions(-) create mode 100644 OvmfPkg/XenElfHeader.fdf.inc diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index a6acf3b835..2e67db5d32 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -31,61 +31,8 @@ NumBlocks =3D $(FW_BLOCKS) !if $(FD_SIZE_IN_KB) =3D=3D 4096 0x00000000|0x00040000 !endif -DATA =3D { - # - # This hex array have been generated by OvmfPkg/OvmfXenElfHeaderGenerato= r.c - # and copied manually. - # - # ELF file header - 0x7f, 0x45, 0x4c, 0x46, # e_ident[0..3]: Magic number - 0x01, # File class: 32-bit objects - 0x01, # Data encoding: 2's complement, little endian - 0x01, # File version - 0x03, # OS ABI identification: Object uses GNU ELF extensions - 0x00, # ABI version - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # e_ident[EI_PAD...] - 0x02, 0x00, # e_type =3D Executable file - 0x03, 0x00, # e_machine =3D Intel 80386 - 0x01, 0x00, 0x00, 0x00, # e_version - 0xd0, 0xff, 0x2f, 0x00, # e_entry: Entry point virtual address - 0x34, 0x00, 0x00, 0x00, # e_phoff: Program header table file offset - 0x00, 0x00, 0x00, 0x00, # e_shoff: Section header table file offset - 0x00, 0x00, 0x00, 0x00, # e_flags: Processor-specific flags - 0x34, 0x00, # e_ehsize: ELF header size - 0x20, 0x00, # e_phentsize: Program header table entry size - 0x02, 0x00, # e_phnum: Program header table entry count - 0x00, 0x00, # e_shentsize: Section header table entry size - 0x00, 0x00, # e_shnum: Section header table entry count - 0x00, 0x00, # e_shstrndx - - # ELF Program segment headers - # - Load segment - 0x01, 0x00, 0x00, 0x00, # p_type =3D Loadable program segment - 0x00, 0x00, 0x00, 0x00, # p_offset - 0x00, 0x00, 0x10, 0x00, # p_vaddr: Segment virtual address - 0x00, 0x00, 0x10, 0x00, # p_paddr: Segment physical address - 0x00, 0x00, 0x20, 0x00, # p_filesz: Segment size in file - 0x00, 0x00, 0x20, 0x00, # p_memsz: Segment size in memory - 0x07, 0x00, 0x00, 0x00, # p_flags =3D Segment is executable | writable |= readable - 0x00, 0x00, 0x00, 0x00, # p_align - # - ELFNOTE segment - 0x04, 0x00, 0x00, 0x00, # p_type =3D PT_NOTE - 0x74, 0x00, 0x00, 0x00, # p_offset =3D point to XEN_ELFNOTE_PHYS32_ENTRY= below - 0x74, 0x00, 0x10, 0x00, - 0x74, 0x00, 0x10, 0x00, - 0x14, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, # p_flags =3D Segment is readable - 0x00, 0x00, 0x00, 0x00, - - # XEN_ELFNOTE_PHYS32_ENTRY - 0x04, 0x00, 0x00, 0x00, # name size - 0x04, 0x00, 0x00, 0x00, # desc size - 0x12, 0x00, 0x00, 0x00, # type =3D XEN_ELFNOTE_PHYS32_ENTRY - 0x58, 0x65, 0x6e, 0x00, # name =3D "Xen" - 0xd0, 0xff, 0x2f, 0x00, # desc: PVH entry point - 0x00 -} + +!include XenElfHeader.fdf.inc = !if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048) 0x0000e000|0x00001000 diff --git a/OvmfPkg/XenElfHeader.fdf.inc b/OvmfPkg/XenElfHeader.fdf.inc new file mode 100644 index 0000000000..dbc1305d25 --- /dev/null +++ b/OvmfPkg/XenElfHeader.fdf.inc @@ -0,0 +1,64 @@ +## @file +# FDF include file that defines a PVH ELF header. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +DATA =3D { + # + # This hex array have been generated by OvmfPkg/OvmfXenElfHeaderGenerato= r.c + # and copied manually. + # + # ELF file header + 0x7f, 0x45, 0x4c, 0x46, # e_ident[0..3]: Magic number + 0x01, # File class: 32-bit objects + 0x01, # Data encoding: 2's complement, little endian + 0x01, # File version + 0x03, # OS ABI identification: Object uses GNU ELF extensions + 0x00, # ABI version + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # e_ident[EI_PAD...] + 0x02, 0x00, # e_type =3D Executable file + 0x03, 0x00, # e_machine =3D Intel 80386 + 0x01, 0x00, 0x00, 0x00, # e_version + 0xd0, 0xff, 0x2f, 0x00, # e_entry: Entry point virtual address + 0x34, 0x00, 0x00, 0x00, # e_phoff: Program header table file offset + 0x00, 0x00, 0x00, 0x00, # e_shoff: Section header table file offset + 0x00, 0x00, 0x00, 0x00, # e_flags: Processor-specific flags + 0x34, 0x00, # e_ehsize: ELF header size + 0x20, 0x00, # e_phentsize: Program header table entry size + 0x02, 0x00, # e_phnum: Program header table entry count + 0x00, 0x00, # e_shentsize: Section header table entry size + 0x00, 0x00, # e_shnum: Section header table entry count + 0x00, 0x00, # e_shstrndx + + # ELF Program segment headers + # - Load segment + 0x01, 0x00, 0x00, 0x00, # p_type =3D Loadable program segment + 0x00, 0x00, 0x00, 0x00, # p_offset + 0x00, 0x00, 0x10, 0x00, # p_vaddr: Segment virtual address + 0x00, 0x00, 0x10, 0x00, # p_paddr: Segment physical address + 0x00, 0x00, 0x20, 0x00, # p_filesz: Segment size in file + 0x00, 0x00, 0x20, 0x00, # p_memsz: Segment size in memory + 0x07, 0x00, 0x00, 0x00, # p_flags =3D Segment is executable | writable |= readable + 0x00, 0x00, 0x00, 0x00, # p_align + # - ELFNOTE segment + 0x04, 0x00, 0x00, 0x00, # p_type =3D PT_NOTE + 0x74, 0x00, 0x00, 0x00, # p_offset =3D point to XEN_ELFNOTE_PHYS32_ENTRY= below + 0x74, 0x00, 0x10, 0x00, + 0x74, 0x00, 0x10, 0x00, + 0x14, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, # p_flags =3D Segment is readable + 0x00, 0x00, 0x00, 0x00, + + # XEN_ELFNOTE_PHYS32_ENTRY + 0x04, 0x00, 0x00, 0x00, # name size + 0x04, 0x00, 0x00, 0x00, # desc size + 0x12, 0x00, 0x00, 0x00, # type =3D XEN_ELFNOTE_PHYS32_ENTRY + 0x58, 0x65, 0x6e, 0x00, # name =3D "Xen" + 0xd0, 0xff, 0x2f, 0x00, # desc: PVH entry point + 0x00 +} -- = 2.32.0 --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, = 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.