]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
inmates: arm: Initialize bss programmatically
authorJan Kiszka <jan.kiszka@siemens.com>
Sat, 2 Jan 2016 14:52:08 +0000 (15:52 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 8 Jan 2016 18:34:38 +0000 (19:34 +0100)
Aligns ARM with x86: initialize bss with a small assembly loop before
inmate_main is invoked. This allows to move it after other sections,
effectively removing it from the image file.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates/lib/arm/header.S
inmates/lib/arm/inmate.lds

index b8501e4421165a2516e5e69be101822d856db6c1..72631cfad0120692851ccdf2cc595926577888b4 100644 (file)
@@ -2,9 +2,11 @@
  * Jailhouse, a Linux-based partitioning hypervisor
  *
  * Copyright (c) ARM Limited, 2014
+ * Copyright (c) Siemens AG, 2016
  *
  * Authors:
  *  Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
+ *  Jan Kiszka <jan.kiszka@siemens.com>
  *
  * This work is licensed under the terms of the GNU GPL, version 2.  See
  * the COPYING file in the top-level directory.
@@ -41,6 +43,14 @@ __reset_entry:
        ldr     r0, =vectors
        mcr     p15, 0, r0, c12, c0, 0  @ VBAR
 
+       mov     r0, #0
+       ldr     r1, =bss_start
+       ldr     r2, =bss_dwords
+1:     str     r0, [r1]
+       add     r1, #4
+       subs    r2, #1
+       bne     1b
+
        ldr     sp, =stack_top
 
        b       inmate_main
index d015860ab03298a8d1c541d8cd05210c0bf7471e..16c48710df99b57d6eb25872bb8d39411f9fc1bc 100644 (file)
@@ -2,9 +2,11 @@
  * Jailhouse, a Linux-based partitioning hypervisor
  *
  * Copyright (c) ARM Limited, 2014
+ * Copyright (c) Siemens AG, 2016
  *
  * Authors:
  *  Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
+ *  Jan Kiszka <jan.kiszka@siemens.com>
  *
  * This work is licensed under the terms of the GNU GPL, version 2.  See
  * the COPYING file in the top-level directory.
@@ -14,11 +16,6 @@ SECTIONS {
        . = 0;
        .boot           : { *(.boot) }
 
-       bss_start = .;
-       .bss            : {
-               *(.bss)
-       }
-
        . = ALIGN(4);
        .text           : {
                *(.text)
@@ -32,6 +29,13 @@ SECTIONS {
                *(.data)
        }
 
+       .bss            : {
+               bss_start = .;
+               *(.bss)
+               . = ALIGN(4);
+       }
+       bss_dwords = SIZEOF(.bss) / 4;
+
        . = ALIGN(4096);
        . += 0x1000;
        stack_top = .;