]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
inmates: Clear bss during initialization
authorJan Kiszka <jan.kiszka@siemens.com>
Sun, 16 Feb 2014 18:52:03 +0000 (19:52 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Sun, 16 Feb 2014 18:53:31 +0000 (19:53 +0100)
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>
inmates/header.S
inmates/inmate.lds

index fd613e5ddb3346f5ccf3062b1344be671618b527..51067731b7b08914104a8a71221502c631417e45 100644 (file)
@@ -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
 
index 171bb802d094d18cd9af3cb876d3945780dde540..8ab694e96f9c78cfadab18cfb68b5dcae10e88ab 100644 (file)
@@ -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) {