Skip to content
Browse files

inmates: Clear bss during initialization

Stop relying on the Jailhouse loader to clear call memory and perform
the required bss initialization to zero on our own.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information...
1 parent bf7390e commit 74e9c53d180524a3caacb7121fde0a75b23d4cdc @jan-kiszka jan-kiszka committed Feb 16, 2014
Showing with 12 additions and 2 deletions.
  1. +5 −0 inmates/header.S
  2. +7 −2 inmates/inmate.lds
View
5 inmates/header.S
@@ -62,6 +62,11 @@ start32:
start64:
mov $stack_top,%rsp
+ xor %rax,%rax
+ mov $bss_start,%rdi
+ mov $bss_qwords,%rcx
+ rep stosq
+
mov $inmate_main,%rax
jmpq *%rax
View
9 inmates/inmate.lds
@@ -22,10 +22,15 @@ SECTIONS
. = ALIGN(16);
}
- /* 32-bit sections */
+ /* 32/64-bit sections */
. = 0xe0000;
stack_top = .;
- .bss : { *(.bss) }
+ bss_start = .;
+ .bss : {
+ *(.bss)
+ . = ALIGN(8);
+ }
+ bss_qwords = SIZEOF(.bss) / 8;
. = 0xf0000 + SIZEOF(.startup);
.text : AT (ADDR(.text) & 0xffff) {

0 comments on commit 74e9c53

Please sign in to comment.
Something went wrong with that request. Please try again.