Update Solo5 patch
parent
4ecd77a06d
commit
d343e1ee7b
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
|
||||
|
||||
{ stdenv, buildPackages, fetchurl, llvmPackages }:
|
||||
{ stdenv, buildPackages, fetchurl, llvmPackages, pkgconfig, genode }:
|
||||
|
||||
let version = "0.6.3";
|
||||
in stdenv.mkDerivation {
|
||||
|
@ -11,6 +11,10 @@ in stdenv.mkDerivation {
|
|||
|
||||
outputs = [ "out" "tests" ];
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
|
||||
buildInputs = [ genode.base.dev genode.os.dev ];
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/Solo5/solo5/releases/download/v${version}/solo5-v${version}.tar.gz";
|
||||
sha256 = "08z2gv0jlsq6r92vacapdj0hqhyfqfy3xdjn5k9c1pd23a2syq7w";
|
||||
|
|
|
@ -81,7 +81,7 @@ index 147c245..d3efb36 100644
|
|||
GENODE_LDFLAGS := -nostdlib -z max-page-size=$(CONFIG_GUEST_PAGE_SIZE) -shared \
|
||||
-gc-sections --eh-frame-hdr --entry=0x0 -T genode/genode_rel.ld
|
||||
diff --git a/bindings/genode/bindings.cc b/bindings/genode/bindings.cc
|
||||
index eb55ffb..a131ca3 100644
|
||||
index eb55ffb..927a62f 100644
|
||||
--- a/bindings/genode/bindings.cc
|
||||
+++ b/bindings/genode/bindings.cc
|
||||
@@ -35,15 +35,15 @@
|
||||
|
@ -176,41 +176,36 @@ index eb55ffb..a131ca3 100644
|
|||
}
|
||||
|
||||
|
||||
@@ -605,6 +613,44 @@ solo5_set_tls_base(uintptr_t base)
|
||||
@@ -605,6 +613,39 @@ solo5_set_tls_base(uintptr_t base)
|
||||
return SOLO5_R_EUNSPEC;
|
||||
}
|
||||
|
||||
+
|
||||
+__attribute__((__visibility__("hidden")))
|
||||
+void *memcpy(void *restrict dest, const void *restrict src, size_t n)
|
||||
+{
|
||||
+ return Genode::memcpy(dest, src, n);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+__attribute__((__visibility__("hidden")))
|
||||
+void *memset(void *dest, int c, size_t n)
|
||||
+{
|
||||
+ return Genode::memset(dest, c, n);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+__attribute__((__visibility__("hidden")))
|
||||
+int strncmp(const char *l, const char *r, size_t n)
|
||||
+{
|
||||
+ return Genode::strcmp(l, r, n);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+__attribute__((__visibility__("hidden")))
|
||||
+void _assert_fail(const char *file, const char *line, const char *e)
|
||||
+{
|
||||
+ Genode::error("Solo5: ABORT: ", file, ":", line, ": Assertion `", e, "' failed");
|
||||
+ Platform::instance->exit(SOLO5_EXIT_ABORT, NULL);
|
||||
+ Platform::instance->exit(SOLO5_EXIT_ABORT, nullptr);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+__attribute__((__visibility__("hidden")))
|
||||
+void _abort(const char *file, const char *line, const char *s, void *regs_hint)
|
||||
+{
|
||||
+ Genode::error("Solo5: ABORT: ", file, ":", line, ": ", s);
|
||||
|
@ -221,7 +216,7 @@ index eb55ffb..a131ca3 100644
|
|||
} // extern "C"
|
||||
|
||||
|
||||
@@ -616,16 +662,19 @@ solo5_set_tls_base(uintptr_t base)
|
||||
@@ -616,16 +657,19 @@ solo5_set_tls_base(uintptr_t base)
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* Validate the device manifest */
|
||||
|
@ -246,7 +241,7 @@ index eb55ffb..a131ca3 100644
|
|||
Platform::instance = &inst;
|
||||
|
||||
static struct solo5_start_info si {
|
||||
@@ -641,12 +690,14 @@ void Component::construct(Genode::Env &env)
|
||||
@@ -641,12 +685,14 @@ void Component::construct(Genode::Env &env)
|
||||
if (si.heap_size > 1<<20)
|
||||
si.heap_size -= 1<<19;
|
||||
|
||||
|
@ -455,150 +450,3 @@ index 7171244..a10655f 100644
|
|||
conflicts: [
|
||||
"solo5-bindings-hvt"
|
||||
"solo5-bindings-spt"
|
||||
diff --git a/tests/test_tls/GNUmakefile b/tests/test_tls/GNUmakefile
|
||||
deleted file mode 100644
|
||||
index cc7f951..0000000
|
||||
--- a/tests/test_tls/GNUmakefile
|
||||
+++ /dev/null
|
||||
@@ -1,23 +0,0 @@
|
||||
-# Copyright (c) 2015-2019 Contributors as noted in the AUTHORS file
|
||||
-#
|
||||
-# This file is part of Solo5, a sandboxed execution environment.
|
||||
-#
|
||||
-# Permission to use, copy, modify, and/or distribute this software
|
||||
-# for any purpose with or without fee is hereby granted, provided
|
||||
-# that the above copyright notice and this permission notice appear
|
||||
-# in all copies.
|
||||
-#
|
||||
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
-# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
-# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
-# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
||||
-# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
-# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
-# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
-
|
||||
-include $(TOPDIR)/Makefile.common
|
||||
-
|
||||
-test_NAME := test_tls
|
||||
-
|
||||
-include ../Makefile.tests
|
||||
diff --git a/tests/test_tls/manifest.json b/tests/test_tls/manifest.json
|
||||
deleted file mode 100644
|
||||
index 1100fc5..0000000
|
||||
--- a/tests/test_tls/manifest.json
|
||||
+++ /dev/null
|
||||
@@ -1,5 +0,0 @@
|
||||
-{
|
||||
- "type": "solo5.manifest",
|
||||
- "version": 1,
|
||||
- "devices": [ ]
|
||||
-}
|
||||
diff --git a/tests/test_tls/test_tls.c b/tests/test_tls/test_tls.c
|
||||
deleted file mode 100644
|
||||
index ce441b9..0000000
|
||||
--- a/tests/test_tls/test_tls.c
|
||||
+++ /dev/null
|
||||
@@ -1,101 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (c) 2015-2019 Contributors as noted in the AUTHORS file
|
||||
- *
|
||||
- * This file is part of Solo5, a sandboxed execution environment.
|
||||
- *
|
||||
- * Permission to use, copy, modify, and/or distribute this software
|
||||
- * for any purpose with or without fee is hereby granted, provided
|
||||
- * that the above copyright notice and this permission notice appear
|
||||
- * in all copies.
|
||||
- *
|
||||
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
||||
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
- */
|
||||
-
|
||||
-#include "solo5.h"
|
||||
-#include "../../bindings/lib.c"
|
||||
-
|
||||
-#if defined(__x86_64__) || defined(__powerpc64__)
|
||||
-/* Variant II */
|
||||
-struct tcb {
|
||||
- volatile uint64_t _data;
|
||||
- void *tp;
|
||||
-};
|
||||
-
|
||||
-#define PPC64_TLS_OFFSET 0x7000
|
||||
-
|
||||
-#elif defined(__aarch64__)
|
||||
-/* Variant I */
|
||||
-struct tcb {
|
||||
- void *tp;
|
||||
- void *pad;
|
||||
- volatile uint64_t _data;
|
||||
-};
|
||||
-#else
|
||||
-#error Unsupported architecture
|
||||
-#endif
|
||||
-
|
||||
-struct tcb tcb1;
|
||||
-struct tcb tcb2;
|
||||
-
|
||||
-static void puts(const char *s)
|
||||
-{
|
||||
- solo5_console_write(s, strlen(s));
|
||||
-}
|
||||
-
|
||||
-#if defined(__OpenBSD__)
|
||||
-/* __thread is not supported in OpenBSD (this test fails on it). */
|
||||
-volatile uint64_t _data;
|
||||
-#else
|
||||
-__thread volatile uint64_t _data;
|
||||
-#endif
|
||||
-
|
||||
-uint64_t __attribute__ ((noinline)) get_data()
|
||||
-{
|
||||
- return _data;
|
||||
-}
|
||||
-
|
||||
-void __attribute__ ((noinline)) set_data(uint64_t data)
|
||||
-{
|
||||
- _data = data;
|
||||
-}
|
||||
-
|
||||
-int solo5_app_main(const struct solo5_start_info *si __attribute__((unused)))
|
||||
-{
|
||||
- puts("\n**** Solo5 standalone test_tls ****\n\n");
|
||||
-
|
||||
-#if defined (__powerpc64__)
|
||||
- tcb1.tp = (void *)&tcb1._data + PPC64_TLS_OFFSET;
|
||||
- tcb2.tp = (void *)&tcb2._data + PPC64_TLS_OFFSET;
|
||||
-#else
|
||||
- tcb1.tp = &tcb1.tp;
|
||||
- tcb2.tp = &tcb2.tp;
|
||||
-#endif
|
||||
-
|
||||
- if (solo5_set_tls_base((uintptr_t)tcb1.tp) != SOLO5_R_OK)
|
||||
- return 1;
|
||||
- set_data(1);
|
||||
-
|
||||
- if (solo5_set_tls_base((uintptr_t)tcb2.tp) != SOLO5_R_OK)
|
||||
- return 2;
|
||||
- set_data(2);
|
||||
-
|
||||
- if (solo5_set_tls_base((uintptr_t)tcb1.tp) != SOLO5_R_OK)
|
||||
- return 3;
|
||||
- if (get_data() != 1)
|
||||
- return 4;
|
||||
-
|
||||
- if (solo5_set_tls_base((uintptr_t)tcb2.tp) != SOLO5_R_OK)
|
||||
- return 5;
|
||||
- if (get_data() != 2)
|
||||
- return 6;
|
||||
-
|
||||
- puts("SUCCESS\n");
|
||||
- return SOLO5_EXIT_SUCCESS;
|
||||
-}
|
||||
|
|
Loading…
Reference in New Issue