]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: make the jailhouse-header arch-independent
authorBenjamin Block <bebl@mageta.org>
Mon, 22 Sep 2014 13:08:27 +0000 (15:08 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Wed, 24 Sep 2014 16:58:09 +0000 (18:58 +0200)
The header of jailhouse is defined with arch-dependent types such as
`unsigned long` which on linux varies in size. Because this header can
be considered the "communication"-relay with the environment, it should
be type-safe on any arch. Thus change all types into fixed-size-types.

Signed-off-by: Benjamin Block <bebl@mageta.org>
[Jan: adjusted jailhouse_entry to keep unsigned int]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver.c
hypervisor/include/jailhouse/entry.h
hypervisor/include/jailhouse/header.h
hypervisor/setup.c

index 983764a1fbf37fef8ef367cc919a1cff9a3b5cfe..d47c7ee5ff753dd113b251a37aa4b14e7d884106 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -386,10 +386,11 @@ static void *jailhouse_ioremap(phys_addr_t phys, unsigned long virt,
 static void enter_hypervisor(void *info)
 {
        struct jailhouse_header *header = info;
+       jailhouse_entry entry = (jailhouse_entry)header->entry;
        int err;
 
        /* either returns 0 or the same error code across all CPUs */
-       err = header->entry(smp_processor_id());
+       err = entry(smp_processor_id());
        if (err)
                error_code = err;
 
index 6e67454eb73aef538454a2701b89c75051a2cde6..3f7f431dc38198861ca43e6c214bd8a318a3d2a2 100644 (file)
@@ -13,8 +13,8 @@
 #ifndef _JAILHOUSE_ENTRY_H
 #define _JAILHOUSE_ENTRY_H
 
-#include <jailhouse/header.h>
 #include <asm/types.h>
+#include <jailhouse/header.h>
 
 #include <jailhouse/cell-config.h>
 
index 24c90a971e9a4a77679b78941ebc85cc6e06eb4f..43b70b31ad3bf3691f795b378881cc7a75d1ab25 100644 (file)
 
 #define JAILHOUSE_SIGNATURE    "JAILHOUS"
 
+typedef int (*jailhouse_entry)(unsigned int);
+
 struct jailhouse_header {
        /* filled at build time */
-       char signature[8];
-       unsigned long core_size;
-       unsigned long percpu_size;
-       int (*entry)(unsigned int);
+       __u8    signature[8];
+       __u64   core_size;
+       __u64   percpu_size;
+
+       /* jailhouse_entry */
+       __u64   entry;
 
        /* filled by loader */
-       unsigned int max_cpus;
-       unsigned int online_cpus;
+       __u32   max_cpus;
+       __u32   online_cpus;
 };
index c6a9932fdf768c9735876058fce49065d0b55e88..aea0e929f418395e59bf921c81bf4701737a4b9c 100644 (file)
@@ -206,5 +206,5 @@ hypervisor_header = {
        .signature = JAILHOUSE_SIGNATURE,
        .core_size = (unsigned long)__hv_core_end - JAILHOUSE_BASE,
        .percpu_size = sizeof(struct per_cpu),
-       .entry = arch_entry,
+       .entry = (unsigned long)arch_entry,
 };