[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCHv4 19/43] plat/kvm: Add link script for Arm64


  • To: <minios-devel@xxxxxxxxxxxxxxxxxxxx>, <simon.kuenzer@xxxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Fri, 6 Jul 2018 09:03:32 +0000
  • Authentication-results: spf=fail (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=arm.com;
  • Cc: Kaly.Xin@xxxxxxx, nd@xxxxxxx, wei.chen@xxxxxxx
  • Delivery-date: Fri, 06 Jul 2018 09:04:55 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

This link script is based on x86 version, except following
differences:
1. Arm64 needs DTB to parse devices, and QEMU/KVM will revserve
   the first 64KB of RAM as DTB area. In this case, we add a DTB
   section to this link script.
2. We will use mmu to control each section's attribute, so the
   boundaries of sections with different memory attributes must
   be 4KiB alignment. For instance, the dtb section is readonly,
   but the text section  is readonly+exec. So the _text must start
   at a 4KiB alignment  address.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
 plat/kvm/arm/link64.ld | 111 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 plat/kvm/arm/link64.ld

diff --git a/plat/kvm/arm/link64.ld b/plat/kvm/arm/link64.ld
new file mode 100644
index 0000000..8798a5b
--- /dev/null
+++ b/plat/kvm/arm/link64.ld
@@ -0,0 +1,111 @@
+/* SPDX-License-Identifier: ISC */
+/*
+ * Author(s): Dan Williams <djwillia@xxxxxxxxxx>
+ *            Martin Lucina <martin.lucina@xxxxxxxxxx>
+ *            Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ *            Wei Chen <wei.chen@xxxxxxx>
+ *
+ * Copyright (c) 2016, IBM
+ *           (c) 2016-2017 Docker, Inc.
+ *           (c) 2017, NEC Europe Ltd.
+ *           (c) 2018, Arm Ltd.
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted, provided
+ * that the above copyright notice and this permission notice appear
+ * in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+OUTPUT_FORMAT("elf64-littleaarch64")
+OUTPUT_ARCH(aarch64)
+ENTRY(_libkvmplat_entry)
+
+/*
+ * We use mmu to control each section's attribute, so the boundaries
+ * of sections with different memory attributes must be 4KiB alignment.
+ * For instance, the dtb section is readonly, but the text section
+ * is readonly+exec. So the _text must start at a 4KiB alignment
+ * address.
+ */
+SECTIONS {
+       /* QEMU-AArch64 virt platform's ram base address */
+       . = 0x40000000;
+
+       /* Reserve first 64 KBytes for DTB */
+       _dtb = .;
+       . = . + 0x10000;
+
+       /* Code */
+       _text = .;
+       .text :
+       {
+               *(.text)
+               *(.text.*)
+       }
+
+       . = ALIGN(0x1000);
+       _etext = .;
+
+       /* Read-only data */
+       _rodata = .;
+       .rodata :
+       {
+               *(.rodata)
+               *(.rodata.*)
+       }
+       .eh_frame :
+       {
+               *(.eh_frame)
+       }
+       _erodata = .;
+
+       /* Constructor tables (read-only) */
+       _ctors = .;
+       .preinit_array : {
+               . = ALIGN(0x8);
+               PROVIDE_HIDDEN (__preinit_array_start = .);
+               KEEP (*(.preinit_array))
+               PROVIDE_HIDDEN (__preinit_array_end = .);
+       }
+
+       .init_array : {
+               . = ALIGN(0x8);
+               PROVIDE_HIDDEN (__init_array_start = .);
+               KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) 
SORT_BY_INIT_PRIORITY(.ctors.*)))
+               KEEP (*(.init_array .ctors))
+               PROVIDE_HIDDEN (__init_array_end = .);
+       }
+       . = ALIGN(0x1000);
+       _ectors = .;
+
+       /* Read-write data (initialized) */
+       _data = .;
+       .data :
+       {
+               *(.data)
+               *(.data.*)
+       }
+       _edata = .;
+
+       . = ALIGN(0x1000);
+       __bss_start = .;
+       /* Read-write data (uninitialized) */
+       .bss :
+       {
+               *(.bss)
+               *(.bss.*)
+               *(COMMON)
+               . = ALIGN(0x1000);
+       }
+
+       _end = .;
+}
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.