From: Jan Kiszka Date: Sat, 2 Jan 2016 14:52:08 +0000 (+0100) Subject: inmates: arm: Initialize bss programmatically X-Git-Url: https://rtime.felk.cvut.cz/gitweb/jailhouse.git/commitdiff_plain/5eb1a649bcdb2650742831e38d3031bf8ca4e09f inmates: arm: Initialize bss programmatically 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 --- diff --git a/inmates/lib/arm/header.S b/inmates/lib/arm/header.S index b8501e4..72631cf 100644 --- a/inmates/lib/arm/header.S +++ b/inmates/lib/arm/header.S @@ -2,9 +2,11 @@ * Jailhouse, a Linux-based partitioning hypervisor * * Copyright (c) ARM Limited, 2014 + * Copyright (c) Siemens AG, 2016 * * Authors: * Jean-Philippe Brucker + * Jan Kiszka * * 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 diff --git a/inmates/lib/arm/inmate.lds b/inmates/lib/arm/inmate.lds index d015860..16c4871 100644 --- a/inmates/lib/arm/inmate.lds +++ b/inmates/lib/arm/inmate.lds @@ -2,9 +2,11 @@ * Jailhouse, a Linux-based partitioning hypervisor * * Copyright (c) ARM Limited, 2014 + * Copyright (c) Siemens AG, 2016 * * Authors: * Jean-Philippe Brucker + * Jan Kiszka * * 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 = .;