Merge pull request #72 in SEL4/sel4_libs from ~ALYONS/sel4_libs:minor to master * commit 'cde762c0ce9510aa916419d407f55c3617f8c4a8': sel4vspace: add seL4_ARCH_LargePageObject constant sel4platsupport: use hpet specific destroy
diff --git a/libsel4allocman/src/cspace/two_level.c b/libsel4allocman/src/cspace/two_level.c index 0cb6d65..4667680 100644 --- a/libsel4allocman/src/cspace/two_level.c +++ b/libsel4allocman/src/cspace/two_level.c
@@ -28,7 +28,7 @@ could be a two level cspace and this would still work */ if(!cspace->second_levels[l1slot]) { assert(!"ERROR: Tried make a path to a non existant slot\n"); - return (cspacepath_t) {0, 0, 0, 0, 0, 0}; + return (cspacepath_t) {0, 0, 0, 0, 0, 0, 0}; } l1_path = _cspace_single_level_make_path(&cspace->first_level, l1slot); l2_path =_cspace_single_level_make_path(&cspace->second_levels[l1slot]->second_level, l2slot);
diff --git a/libsel4bench/Makefile b/libsel4bench/Makefile index ebd6d43..49752a5 100644 --- a/libsel4bench/Makefile +++ b/libsel4bench/Makefile
@@ -14,7 +14,9 @@ # Source files required to build the target CFILES := \ $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/*.c)) \ - $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/arch-$(ARCH)/*.c)) + $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/arch-$(ARCH)/*.c)) \ + $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/arch-$(ARCH)/armv/$(ARMV)/*.c)) \ + $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/arch-$(ARCH)/cpu/$(CPU)/*.c)) # Header files/directories this library provides # Note: sel4_client.h may not have been built at the time this is evaluated.
diff --git a/libsel4bench/src/arch-arm/event_counters_armv7a.c b/libsel4bench/src/arch-arm/armv/armv7-a/event_counters_armv7a.c similarity index 97% rename from libsel4bench/src/arch-arm/event_counters_armv7a.c rename to libsel4bench/src/arch-arm/armv/armv7-a/event_counters_armv7a.c index 5ae1544..5b5b0d7 100644 --- a/libsel4bench/src/arch-arm/event_counters_armv7a.c +++ b/libsel4bench/src/arch-arm/armv/armv7-a/event_counters_armv7a.c
@@ -8,11 +8,9 @@ * @TAG(NICTA_BSD) */ -#if defined(ARMV7_A) - #include <utils/util.h> -#include "event_counters.h" +#include "../../event_counters.h" #define NAME_EVENT(id, name) EVENT_COUNTER_FORMAT(SEL4BENCH_ARMV7A_EVENT_##id, name) @@ -58,5 +56,3 @@ { return ARRAY_SIZE(sel4bench_arch_event_counter_data); } - -#endif /* defined(ARMV7_A) */
diff --git a/libsel4bench/src/arch-arm/event_counters_arm1136.c b/libsel4bench/src/arch-arm/cpu/arm1136jf-s/event_counters_arm1136.c similarity index 93% rename from libsel4bench/src/arch-arm/event_counters_arm1136.c rename to libsel4bench/src/arch-arm/cpu/arm1136jf-s/event_counters_arm1136.c index 44a9870..0ef3948 100644 --- a/libsel4bench/src/arch-arm/event_counters_arm1136.c +++ b/libsel4bench/src/arch-arm/cpu/arm1136jf-s/event_counters_arm1136.c
@@ -8,11 +8,9 @@ * @TAG(NICTA_BSD) */ -#if defined(ARM1136J_S) || defined(ARM1136JF_S) - #include <utils/util.h> -#include "event_counters.h" +#include "../../event_counters.h" #define NAME_EVENT(id, name) EVENT_COUNTER_FORMAT(SEL4BENCH_ARM1136_EVENT_##id, name) @@ -54,5 +52,3 @@ { return ARRAY_SIZE(sel4bench_cpu_event_counter_data); } - -#endif /* defined(ARM1136J_S) || defined(ARM1136JF_S) */
diff --git a/libsel4bench/src/arch-arm/event_counters_cortexa15.c b/libsel4bench/src/arch-arm/cpu/cortex-a15/event_counters_cortexa15.c similarity index 96% rename from libsel4bench/src/arch-arm/event_counters_cortexa15.c rename to libsel4bench/src/arch-arm/cpu/cortex-a15/event_counters_cortexa15.c index 396625c..565daf5 100644 --- a/libsel4bench/src/arch-arm/event_counters_cortexa15.c +++ b/libsel4bench/src/arch-arm/cpu/cortex-a15/event_counters_cortexa15.c
@@ -8,11 +8,7 @@ * @TAG(NICTA_BSD) */ -#include <autoconf.h> - -#if defined(CONFIG_ARM_CORTEX_A15) - -#include "event_counters.h" +#include "../../event_counters.h" #define NAME_EVENT(id, name) EVENT_COUNTER_FORMAT(SEL4BENCH_CORTEXA15_EVENT_##id, name) @@ -67,5 +63,3 @@ { return ARRAY_SIZE(sel4bench_cpu_event_counter_data); } - -#endif /* defined(CONFIG_ARM_CORTEX_A15) */
diff --git a/libsel4bench/src/arch-arm/event_counters_cortexa8.c b/libsel4bench/src/arch-arm/cpu/cortex-a8/event_counters_cortexa8.c similarity index 94% rename from libsel4bench/src/arch-arm/event_counters_cortexa8.c rename to libsel4bench/src/arch-arm/cpu/cortex-a8/event_counters_cortexa8.c index 58bfa26..2b0f53c 100644 --- a/libsel4bench/src/arch-arm/event_counters_cortexa8.c +++ b/libsel4bench/src/arch-arm/cpu/cortex-a8/event_counters_cortexa8.c
@@ -8,11 +8,7 @@ * @TAG(NICTA_BSD) */ -#include <autoconf.h> - -#if defined(CONFIG_ARM_CORTEX_A8) - -#include "event_counters.h" +#include "../../event_counters.h" #define NAME_EVENT(id, name) EVENT_COUNTER_FORMAT(SEL4BENCH_CORTEXA8_EVENT_##id, name) @@ -54,5 +50,3 @@ { return ARRAY_SIZE(sel4bench_cpu_event_counter_data); } - -#endif /* defined(CONFIG_ARM_CORTEX_A8) */
diff --git a/libsel4bench/src/arch-arm/event_counters_cortexa9.c b/libsel4bench/src/arch-arm/cpu/cortex-a9/event_counters_cortexa9.c similarity index 95% rename from libsel4bench/src/arch-arm/event_counters_cortexa9.c rename to libsel4bench/src/arch-arm/cpu/cortex-a9/event_counters_cortexa9.c index d8e3a41..c25db15 100644 --- a/libsel4bench/src/arch-arm/event_counters_cortexa9.c +++ b/libsel4bench/src/arch-arm/cpu/cortex-a9/event_counters_cortexa9.c
@@ -8,11 +8,7 @@ * @TAG(NICTA_BSD) */ -#include <autoconf.h> - -#if defined(CONFIG_ARM_CORTEX_A9) - -#include "event_counters.h" +#include "../../event_counters.h" #define NAME_EVENT(id, name) EVENT_COUNTER_FORMAT(SEL4BENCH_CORTEXA9_EVENT_##id, name) @@ -63,5 +59,3 @@ { return ARRAY_SIZE(sel4bench_cpu_event_counter_data); } - -#endif /* defined(CONFIG_ARM_CORTEX_A9) */
diff --git a/libsel4test/include/sel4test/prototype.h b/libsel4test/include/sel4test/prototype.h index 06a7726..a3438bc 100644 --- a/libsel4test/include/sel4test/prototype.h +++ b/libsel4test/include/sel4test/prototype.h
@@ -23,7 +23,7 @@ * * @name name of test suite */ -void sel4test_start_suite(char *name); +void sel4test_start_suite(const char *name); /** @@ -44,14 +44,14 @@ * Can report multiple errors. * This will fail a test case. */ -void _sel4test_report_error(char *error, char *file, int line); +void _sel4test_report_error(const char *error, const char *file, int line); /* * Mark the current test as failed. Should * only be called once per test case */ -void _sel4test_failure(char *failure, char *file, int line); +void _sel4test_failure(const char *failure, const char *file, int line); /* * End the current test case
diff --git a/libsel4test/include/sel4test/test.h b/libsel4test/include/sel4test/test.h index a7a9125..f1644f1 100644 --- a/libsel4test/include/sel4test/test.h +++ b/libsel4test/include/sel4test/test.h
@@ -76,7 +76,7 @@ } /* Fails a test case, stop running the rest of the test, but keep running other tests. */ -static inline int _test_fail(char *condition, char *file, int line) +static inline int _test_fail(const char *condition, const char *file, int line) { _sel4test_failure(condition, file, line); #ifdef CONFIG_TESTPRINTER_HALT_ON_TEST_FAILURE @@ -92,7 +92,7 @@ } /* Fails a test case, keep running the rest of the test, then keep running other tests. */ -static inline void _test_error(char *condition, char *file, int line) +static inline void _test_error(const char *condition, const char *file, int line) { _sel4test_report_error(condition, file, line); @@ -109,7 +109,7 @@ } /* Fails a test case, stop everything. */ -static inline void _test_abort(char *condition, char *file, int line) +static inline void _test_abort(const char *condition, const char *file, int line) { _sel4test_failure(condition, file, line); printf("Halting on fatal assertion...\n"); @@ -224,7 +224,7 @@ * @param run_test function that runs the tests. * */ -void sel4test_run_tests(char *name, int (*run_test)(struct testcase *t)); +void sel4test_run_tests(const char *name, int (*run_test)(struct testcase *t)); /* * Get a testcase. @@ -232,7 +232,7 @@ * @param name the name of the test to retrieve. * @return the test corresponding to name, NULL if test not found. */ -testcase_t* sel4test_get_test(char *name); +testcase_t* sel4test_get_test(const char *name); bool sel4test_get_result(void);
diff --git a/libsel4test/src/test.c b/libsel4test/src/test.c index 0f1b1ab..d5b3c5a 100644 --- a/libsel4test/src/test.c +++ b/libsel4test/src/test.c
@@ -54,7 +54,7 @@ void -sel4test_start_suite(char *name) { +sel4test_start_suite(const char *name) { #ifdef CONFIG_PRINT_XML buf_index = 0; @@ -101,7 +101,7 @@ } void -_sel4test_report_error(char *error, char *file, int line) { +_sel4test_report_error(const char *error, const char *file, int line) { #ifdef CONFIG_PRINT_XML printf("\t\t<error>%s at line %d of file %s</error>\n", error, line, file); #else @@ -112,7 +112,7 @@ void -_sel4test_failure(char *failure, char *file, int line) { +_sel4test_failure(const char *failure, const char *file, int line) { #ifdef CONFIG_PRINT_XML printf("\t\t<failure type=\"failure\">%s at line %d of file %s</failure>\n", failure, line, file); #else @@ -160,7 +160,7 @@ static USED SECTION("_test_case") struct {} dummy; testcase_t* -sel4test_get_test(char *name) +sel4test_get_test(const char *name) { for (testcase_t *t = __start__test_case; t < __stop__test_case; t++) { @@ -174,7 +174,7 @@ void -sel4test_run_tests(char *name, int (*run_test)(struct testcase *t)) { +sel4test_run_tests(const char *name, int (*run_test)(struct testcase *t)) { /* Count how many tests actually exist and allocate space for them */ int max_tests = (int)(__stop__test_case - __start__test_case);
diff --git a/libsel4utils/include/sel4utils/elf.h b/libsel4utils/include/sel4utils/elf.h index ab07af7..cd84b94 100644 --- a/libsel4utils/include/sel4utils/elf.h +++ b/libsel4utils/include/sel4utils/elf.h
@@ -53,7 +53,7 @@ */ void * sel4utils_elf_load_record_regions(vspace_t *loadee, vspace_t *loader, vka_t *loadee_vka, - vka_t *loader_vka, char *image_name, sel4utils_elf_region_t *regions, int mapanywhere); + vka_t *loader_vka, const char *image_name, sel4utils_elf_region_t *regions, int mapanywhere); /** * Wrapper for sel4utils_elf_load_record_regions. Does not record/perform reservations and @@ -69,7 +69,7 @@ */ void * sel4utils_elf_load(vspace_t *loadee, vspace_t *loader, vka_t *loadee_vka, - vka_t *loader_vka, char *image_name); + vka_t *loader_vka, const char *image_name); /** * Parses an elf file but does not actually load it. Merely reserves the regions in the vspace @@ -83,7 +83,7 @@ * @return The entry point of the elf, NULL on error */ void * -sel4utils_elf_reserve(vspace_t *loadee, char *image_name, sel4utils_elf_region_t *regions); +sel4utils_elf_reserve(vspace_t *loadee, const char *image_name, sel4utils_elf_region_t *regions); /** * Parses an elf file and returns the number of loadable regions. The result of this @@ -94,7 +94,7 @@ * @return Number of loadable regions in the elf */ int -sel4utils_elf_num_regions(char *image_name); +sel4utils_elf_num_regions(const char *image_name); /** * Looks for the __vsyscall section in an elf file and returns the value. This @@ -104,7 +104,7 @@ * * @return Address of vsyscall function or 0 if not found */ -uintptr_t sel4utils_elf_get_vsyscall(char *image_name); +uintptr_t sel4utils_elf_get_vsyscall(const char *image_name); #endif /* (defined CONFIG_LIB_SEL4_VKA && defined CONFIG_LIB_SEL4_VSPACE) */ #endif /* SEL4UTILS_ELF_H */
diff --git a/libsel4utils/include/sel4utils/process.h b/libsel4utils/include/sel4utils/process.h index ddbe650..03ab1b8 100644 --- a/libsel4utils/include/sel4utils/process.h +++ b/libsel4utils/include/sel4utils/process.h
@@ -84,7 +84,7 @@ /* should we handle elf logic at all? */ bool is_elf; /* if so what is the image name? */ - char *image_name; + const char *image_name; /* Do you want the elf image preloaded? */ bool do_elf_load; @@ -201,7 +201,7 @@ * @return 0 on success, -1 on error. */ int sel4utils_configure_process(sel4utils_process_t *process, vka_t *vka, vspace_t *vspace, - uint8_t priority, char *image_name); + uint8_t priority, const char *image_name); /** * Configure a process with more customisations (Create your own vspace, customise cspace size).
diff --git a/libsel4utils/include/sel4utils/sel4_debug.h b/libsel4utils/include/sel4utils/sel4_debug.h index 1fe1a76..6dc88fb 100644 --- a/libsel4utils/include/sel4utils/sel4_debug.h +++ b/libsel4utils/include/sel4utils/sel4_debug.h
@@ -13,8 +13,8 @@ #define sel4_error(e, str) ((e == seL4_NoError) ? (void)0 : __sel4_error(e, __FILE__, __func__, __LINE__, str)) -void __sel4_error(int, const char *, const char *, int, char *); +void __sel4_error(int, const char *, const char *, int, const char *); -extern char *sel4_errlist[]; +extern const char *sel4_errlist[]; #endif /* _SEL4_DEBUG_ */
diff --git a/libsel4utils/src/elf.c b/libsel4utils/src/elf.c index 2fe7d78..e14a9e2 100644 --- a/libsel4utils/src/elf.c +++ b/libsel4utils/src/elf.c
@@ -132,7 +132,7 @@ } int -sel4utils_elf_num_regions(char *image_name) +sel4utils_elf_num_regions(const char *image_name) { int i; unsigned long elf_size; @@ -183,7 +183,7 @@ } void * -sel4utils_elf_reserve(vspace_t *loadee, char *image_name, sel4utils_elf_region_t *regions) +sel4utils_elf_reserve(vspace_t *loadee, const char *image_name, sel4utils_elf_region_t *regions) { unsigned long elf_size; char *elf_file = cpio_get_file(_cpio_archive, image_name, &elf_size); @@ -226,7 +226,7 @@ } void * -sel4utils_elf_load_record_regions(vspace_t *loadee, vspace_t *loader, vka_t *loadee_vka, vka_t *loader_vka, char *image_name, sel4utils_elf_region_t *regions, int mapanywhere) +sel4utils_elf_load_record_regions(vspace_t *loadee, vspace_t *loader, vka_t *loadee_vka, vka_t *loader_vka, const char *image_name, sel4utils_elf_region_t *regions, int mapanywhere) { unsigned long elf_size; char *elf_file = cpio_get_file(_cpio_archive, image_name, &elf_size); @@ -288,7 +288,7 @@ return error == seL4_NoError ? (void*)(seL4_Word)entry_point : NULL; } -uintptr_t sel4utils_elf_get_vsyscall(char *image_name) +uintptr_t sel4utils_elf_get_vsyscall(const char *image_name) { unsigned long elf_size; char *elf_file = cpio_get_file(_cpio_archive, image_name, &elf_size); @@ -307,7 +307,7 @@ } void * -sel4utils_elf_load(vspace_t *loadee, vspace_t *loader, vka_t *loadee_vka, vka_t *loader_vka, char *image_name) +sel4utils_elf_load(vspace_t *loadee, vspace_t *loader, vka_t *loadee_vka, vka_t *loader_vka, const char *image_name) { return sel4utils_elf_load_record_regions(loadee, loader, loadee_vka, loader_vka, image_name, NULL, 0); }
diff --git a/libsel4utils/src/process.c b/libsel4utils/src/process.c index fe3b992..ed2fb3a 100644 --- a/libsel4utils/src/process.c +++ b/libsel4utils/src/process.c
@@ -358,7 +358,7 @@ int sel4utils_configure_process(sel4utils_process_t *process, vka_t *vka, - vspace_t *vspace, uint8_t priority, char *image_name) + vspace_t *vspace, uint8_t priority, const char *image_name) { sel4utils_process_config_t config = { .is_elf = true,
diff --git a/libsel4utils/src/sel4_debug.c b/libsel4utils/src/sel4_debug.c index e0ad761..8f64b50 100644 --- a/libsel4utils/src/sel4_debug.c +++ b/libsel4utils/src/sel4_debug.c
@@ -12,7 +12,7 @@ #include <stdlib.h> /* For abort() */ #include <sel4utils/sel4_debug.h> -char *sel4_errlist[] = { +const char *sel4_errlist[] = { "seL4_NoError", "seL4_InvalidArgument", "seL4_InvalidCapability", @@ -29,7 +29,7 @@ void __sel4_error(int sel4_error, const char *file, - const char *function, int line, char * str) + const char *function, int line, const char * str) { fprintf(stderr, "seL4 Error: %s, function %s, file %s, line %d: %s\n", sel4_errlist[sel4_error],