diff --git a/runtime/include/arch/aarch64/context.h b/runtime/include/arch/aarch64/context.h index f8404c9..365b1dd 100644 --- a/runtime/include/arch/aarch64/context.h +++ b/runtime/include/arch/aarch64/context.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include diff --git a/runtime/include/arch/x86_64/context.h b/runtime/include/arch/x86_64/context.h index 70c2bc5..4e763c6 100644 --- a/runtime/include/arch/x86_64/context.h +++ b/runtime/include/arch/x86_64/context.h @@ -1,10 +1,11 @@ #pragma once #include +#include +#include #include #include #include -#include #define ARCH_NREGS (16 /* GP registers */ + 1 /* for IP */) #define ARCH_SIG_JMP_OFF 8 diff --git a/runtime/include/global_request_scheduler.h b/runtime/include/global_request_scheduler.h index d9f1a31..0972e1c 100644 --- a/runtime/include/global_request_scheduler.h +++ b/runtime/include/global_request_scheduler.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "sandbox_request.h" /* Returns pointer back if successful, null otherwise */ typedef sandbox_request_t *(*global_request_scheduler_add_fn_t)(void *); diff --git a/runtime/include/global_request_scheduler_deque.h b/runtime/include/global_request_scheduler_deque.h index 1e1757e..1dbe4af 100644 --- a/runtime/include/global_request_scheduler_deque.h +++ b/runtime/include/global_request_scheduler_deque.h @@ -1,5 +1,5 @@ #pragma once -#include +#include "global_request_scheduler.h" void global_request_scheduler_deque_initialize(); diff --git a/runtime/include/global_request_scheduler_minheap.h b/runtime/include/global_request_scheduler_minheap.h index 5c39170..5202014 100644 --- a/runtime/include/global_request_scheduler_minheap.h +++ b/runtime/include/global_request_scheduler_minheap.h @@ -1,5 +1,5 @@ #pragma once -#include +#include "global_request_scheduler.h" void global_request_scheduler_minheap_initialize(); diff --git a/runtime/include/http_request.h b/runtime/include/http_request.h index 4bdbbeb..f82b5ab 100644 --- a/runtime/include/http_request.h +++ b/runtime/include/http_request.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "types.h" /* all in-memory ptrs.. don't mess around with that! */ struct http_header { diff --git a/runtime/include/http_response.h b/runtime/include/http_response.h index e8c2ffc..b738e5b 100644 --- a/runtime/include/http_response.h +++ b/runtime/include/http_response.h @@ -1,9 +1,10 @@ #pragma once #include -#include #include +#include "types.h" + /* Conditionally load libuv */ #ifdef USE_HTTP_UVIO #include diff --git a/runtime/include/libuv_callbacks.h b/runtime/include/libuv_callbacks.h index aa90d8f..1162b3c 100644 --- a/runtime/include/libuv_callbacks.h +++ b/runtime/include/libuv_callbacks.h @@ -1,14 +1,14 @@ #pragma once #include -#include -#include #include #include #include #include -#include +#include "http_request.h" +#include "runtime.h" +#include "sandbox.h" /** * Parses data read by the libuv stream chunk-by-chunk until the message is complete * Then stops the stream and wakes up the sandbox diff --git a/runtime/include/local_runqueue.h b/runtime/include/local_runqueue.h index c7ab3d7..dace39e 100644 --- a/runtime/include/local_runqueue.h +++ b/runtime/include/local_runqueue.h @@ -1,7 +1,8 @@ #pragma once #include -#include + +#include "sandbox.h" /* Returns pointer back if successful, null otherwise */ typedef struct sandbox *(*local_runqueue_add_fn_t)(struct sandbox *); diff --git a/runtime/include/module.h b/runtime/include/module.h index 45fd48c..a617338 100644 --- a/runtime/include/module.h +++ b/runtime/include/module.h @@ -1,7 +1,8 @@ #pragma once #include -#include + +#include "types.h" struct module { char name[MODULE_MAX_NAME_LENGTH]; diff --git a/runtime/include/sandbox.h b/runtime/include/sandbox.h index d875475..90c8046 100644 --- a/runtime/include/sandbox.h +++ b/runtime/include/sandbox.h @@ -7,8 +7,8 @@ #include "arch/context.h" #include "deque.h" -#include -#include +#include "http_request.h" +#include "http_response.h" #include "module.h" #include "ps_list.h" #include "software_interrupt.h" diff --git a/runtime/include/software_interrupt.h b/runtime/include/software_interrupt.h index b340a03..a046768 100644 --- a/runtime/include/software_interrupt.h +++ b/runtime/include/software_interrupt.h @@ -1,8 +1,8 @@ #pragma once -#include #include #include +#include /************ * Externs * diff --git a/runtime/include/types.h b/runtime/include/types.h index 67a3ac0..a8f50f5 100644 --- a/runtime/include/types.h +++ b/runtime/include/types.h @@ -11,11 +11,11 @@ #include #include #include +#include +#include #include #include -#include -#include #define EXPORT __attribute__((visibility("default"))) #define IMPORT __attribute__((visibility("default"))) diff --git a/runtime/include/worker_thread.h b/runtime/include/worker_thread.h index 33c8586..381a28d 100644 --- a/runtime/include/worker_thread.h +++ b/runtime/include/worker_thread.h @@ -1,6 +1,7 @@ #pragma once #include + #include "types.h" extern __thread uv_loop_t worker_thread_uvio_handle; diff --git a/runtime/src/arch/aarch64/env.c b/runtime/src/arch/aarch64/env.c index 3949e82..9d5ade1 100644 --- a/runtime/src/arch/aarch64/env.c +++ b/runtime/src/arch/aarch64/env.c @@ -1,6 +1,6 @@ #if defined(AARCH64) || defined(aarch64) -#include +#include "runtime.h" unsigned long long int __getcycles(void) diff --git a/runtime/src/arch/x86_64/env.c b/runtime/src/arch/x86_64/env.c index 3ec3dcd..8a66844 100644 --- a/runtime/src/arch/x86_64/env.c +++ b/runtime/src/arch/x86_64/env.c @@ -1,17 +1,17 @@ #if defined(X86_64) || defined(x86_64) -#include +#include "runtime.h" unsigned long long int __getcycles(void) { - unsigned long long int cpu_time_in_cycles = 0; - unsigned int cycles_lo; - unsigned int cycles_hi; - __asm__ volatile("rdtsc" : "=a"(cycles_lo), "=d"(cycles_hi)); - cpu_time_in_cycles = (unsigned long long int)cycles_hi << 32 | cycles_lo; + unsigned long long int cpu_time_in_cycles = 0; + unsigned int cycles_lo; + unsigned int cycles_hi; + __asm__ volatile("rdtsc" : "=a"(cycles_lo), "=d"(cycles_hi)); + cpu_time_in_cycles = (unsigned long long int)cycles_hi << 32 | cycles_lo; - return cpu_time_in_cycles; + return cpu_time_in_cycles; } #endif diff --git a/runtime/src/env.c b/runtime/src/env.c index f139f68..5b970e5 100644 --- a/runtime/src/env.c +++ b/runtime/src/env.c @@ -1,8 +1,9 @@ /* https://github.com/gwsystems/silverfish/blob/master/runtime/libc/libc_backing.c */ -#include -#include #include +#include "runtime.h" +#include "worker_thread.h" + extern i32 inner_syscall_handler(i32 n, i32 a, i32 b, i32 c, i32 d, i32 e, i32 f); i32 diff --git a/runtime/src/global_request_scheduler.c b/runtime/src/global_request_scheduler.c index 435d958..0198e2d 100644 --- a/runtime/src/global_request_scheduler.c +++ b/runtime/src/global_request_scheduler.c @@ -1,4 +1,4 @@ -#include +#include "global_request_scheduler.h" /* The global of our polymorphic interface */ diff --git a/runtime/src/global_request_scheduler_deque.c b/runtime/src/global_request_scheduler_deque.c index 4577b9b..7ee14b9 100644 --- a/runtime/src/global_request_scheduler_deque.c +++ b/runtime/src/global_request_scheduler_deque.c @@ -1,4 +1,4 @@ -#include +#include "global_request_scheduler.h" static struct deque_sandbox *global_request_scheduler_deque; static pthread_mutex_t global_request_scheduler_deque_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/runtime/src/global_request_scheduler_minheap.c b/runtime/src/global_request_scheduler_minheap.c index d2fad90..af86c23 100644 --- a/runtime/src/global_request_scheduler_minheap.c +++ b/runtime/src/global_request_scheduler_minheap.c @@ -1,4 +1,4 @@ -#include +#include "global_request_scheduler.h" #include "priority_queue.h" static struct priority_queue global_request_scheduler_minheap; diff --git a/runtime/src/http_parser_settings.c b/runtime/src/http_parser_settings.c index 171a11a..ee0f296 100644 --- a/runtime/src/http_parser_settings.c +++ b/runtime/src/http_parser_settings.c @@ -1,9 +1,10 @@ -#include -#include -#include -#include #include +#include "http_request.h" +#include "http_response.h" +#include "http_parser_settings.h" +#include "sandbox.h" + static http_parser_settings runtime_http_parser_settings; /*********************************************************************** diff --git a/runtime/src/http_request.c b/runtime/src/http_request.c index d865098..a53e403 100644 --- a/runtime/src/http_request.c +++ b/runtime/src/http_request.c @@ -1,4 +1,4 @@ -#include +#include "http_request.h" /*************************************************** * General HTTP Request Functions * diff --git a/runtime/src/http_response.c b/runtime/src/http_response.c index 013141c..d2dbb7f 100644 --- a/runtime/src/http_response.c +++ b/runtime/src/http_response.c @@ -1,4 +1,4 @@ -#include +#include "http_response.h" #ifdef USE_HTTP_UVIO #include diff --git a/runtime/src/local_runqueue.c b/runtime/src/local_runqueue.c index 183bd8b..3983c7e 100644 --- a/runtime/src/local_runqueue.c +++ b/runtime/src/local_runqueue.c @@ -1,4 +1,4 @@ -#include +#include "local_runqueue.h" static struct local_runqueue_config local_runqueue; diff --git a/runtime/src/main.c b/runtime/src/main.c index 6f71f00..fd9c033 100644 --- a/runtime/src/main.c +++ b/runtime/src/main.c @@ -1,18 +1,18 @@ #include #include +#include #include #include -#include #include #include #include #include -#include -#include -#include -#include -#include +#include "module.h" +#include "runtime.h" +#include "sandbox.h" +#include "software_interrupt.h" +#include "worker_thread.h" /* Conditionally used by debuglog when DEBUG is set */ #ifdef DEBUG diff --git a/runtime/src/module.c b/runtime/src/module.c index d0ae976..6a26638 100644 --- a/runtime/src/module.c +++ b/runtime/src/module.c @@ -4,10 +4,10 @@ #include #include -#include "types.h" #include "module.h" #include "module_database.h" #include "runtime.h" +#include "types.h" /************************* * Private Static Inline * diff --git a/runtime/src/module_database.c b/runtime/src/module_database.c index 9a5f604..9519627 100644 --- a/runtime/src/module_database.c +++ b/runtime/src/module_database.c @@ -1,5 +1,4 @@ -#include - +#include "module_database.h" /******************* * Module Database * diff --git a/runtime/src/runtime.c b/runtime/src/runtime.c index 58efc3d..64fb5f4 100644 --- a/runtime/src/runtime.c +++ b/runtime/src/runtime.c @@ -1,27 +1,18 @@ -/* Something is not idempotent with this or some other include. If placed in Local Includes, error is triggered that - * memset was implicitly declared */ -#include - -/*************************** - * External Includes * - **************************/ #include #include -#include /* Wasmception. Included as submodule */ -#include /* Wasmception. Included as submodule */ +#include +#include #include -/*************************** - * Local Includes * - **************************/ -#include -#include -#include -#include -#include -#include -#include -#include +#include "arch/context.h" +#include "global_request_scheduler_deque.h" +#include "global_request_scheduler_minheap.h" +#include "http_parser_settings.h" +#include "module.h" +#include "runtime.h" +#include "sandbox_request.h" +#include "software_interrupt.h" +#include "types.h" /*************************** * Shared Process State * diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index 6d1800e..07216d4 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -1,7 +1,7 @@ #include -#include #include #include +#include #include #include "current_sandbox.h" diff --git a/runtime/src/software_interrupt.c b/runtime/src/software_interrupt.c index 464ea8c..82ec709 100644 --- a/runtime/src/software_interrupt.c +++ b/runtime/src/software_interrupt.c @@ -1,19 +1,19 @@ +#include #include #include #include -#include #include #include #include #include -#include -#include -#include -#include -#include -#include +#include "arch/context.h" +#include "current_sandbox.h" #include "local_runqueue.h" +#include "module.h" +#include "sandbox.h" +#include "software_interrupt.h" +#include "types.h" /******************* * Process Globals * diff --git a/runtime/src/worker_thread.c b/runtime/src/worker_thread.c index d74a5f8..e9f84ec 100644 --- a/runtime/src/worker_thread.c +++ b/runtime/src/worker_thread.c @@ -1,27 +1,18 @@ -/* Something is not idempotent with this or some other include. -If placed in Local Includes, error is triggered that memset was implicitly declared */ -#include - -/*************************** - * External Includes * - **************************/ #include #include -#include /* Wasmception. Included as submodule */ -#include /* Wasmception. Included as submodule */ +#include +#include #include -/*************************** - * Local Includes * - **************************/ -#include -#include -#include -#include -#include -#include -#include -#include +#include "current_sandbox.h" +#include "global_request_scheduler.h" +#include "local_completion_queue.h" +#include "local_runqueue.h" +#include "local_runqueue_list.h" +#include "local_runqueue_minheap.h" +#include "runtime.h" +#include "types.h" +#include "worker_thread.h" /*************************** * Worker Thread State *