diff --git a/runtime/include/sandbox.h b/runtime/include/sandbox.h index 0860c65..ec2330f 100644 --- a/runtime/include/sandbox.h +++ b/runtime/include/sandbox.h @@ -103,15 +103,6 @@ struct sandbox { char request_response_data[1]; /* of request_response_data_length, following sandbox mem.. */ } PAGE_ALIGNED; -/*************************** - * Externs * - **************************/ - -extern void worker_thread_block_current_sandbox(void); -extern void worker_thread_on_sandbox_exit(struct sandbox *sandbox); -extern void worker_thread_process_io(void); -extern void worker_thread_wakeup_sandbox(struct sandbox *sandbox); - /*************************** * Public API * **************************/ diff --git a/runtime/include/worker_thread.h b/runtime/include/worker_thread.h index 99beb47..92f064f 100644 --- a/runtime/include/worker_thread.h +++ b/runtime/include/worker_thread.h @@ -47,3 +47,6 @@ worker_thread_get_memory_string(uint32_t offset, uint32_t max_length) } return NULL; } + +void worker_thread_block_current_sandbox(void); +__attribute__((noreturn)) void worker_thread_on_sandbox_exit(); diff --git a/runtime/src/priority_queue.c b/runtime/src/priority_queue.c index fb76c75..52cfc7f 100644 --- a/runtime/src/priority_queue.c +++ b/runtime/src/priority_queue.c @@ -180,7 +180,6 @@ struct priority_queue * priority_queue_initialize(size_t capacity, bool use_lock, priority_queue_get_priority_fn_t get_priority_fn) { assert(get_priority_fn != NULL); - assert(!software_interrupt_is_enabled()); /* Add one to capacity because this data structure ignores the element at 0 */ size_t one_based_capacity = capacity + 1; diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index 77f8a6a..b83ab3d 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -362,13 +362,12 @@ sandbox_close_http(struct sandbox *sandbox) * sending, and cleanup */ void -current_sandbox_main(void) +sandbox_start(void) { struct sandbox *sandbox = current_sandbox_get(); assert(sandbox != NULL); assert(sandbox->state == SANDBOX_RUNNING); - int rc; char *error_message = ""; assert(!software_interrupt_is_enabled()); @@ -380,8 +379,7 @@ current_sandbox_main(void) sandbox_open_http(sandbox); /* Parse the request */ - rc = sandbox_receive_and_parse_client_request(sandbox); - if (rc < 0) { + if (sandbox_receive_and_parse_client_request(sandbox) < 0) { error_message = "Unable to receive and parse client request\n"; goto err; }; @@ -401,8 +399,7 @@ current_sandbox_main(void) sandbox->completion_timestamp = __getcycles(); /* Retrieve the result, construct the HTTP response, and send to client */ - rc = sandbox_build_and_send_client_response(sandbox); - if (rc < 0) { + if (sandbox_build_and_send_client_response(sandbox) < 0) { error_message = "Unable to build and send client response\n"; goto err; }; @@ -561,8 +558,7 @@ sandbox_set_as_initialized(struct sandbox *sandbox, struct sandbox_request *sand /* Initialize the sandbox's context, stack, and instruction pointer */ /* stack_start points to the bottom of the usable stack, so add stack_size to get to top */ - arch_context_init(&sandbox->ctxt, (reg_t)current_sandbox_main, - (reg_t)sandbox->stack_start + sandbox->stack_size); + arch_context_init(&sandbox->ctxt, (reg_t)sandbox_start, (reg_t)sandbox->stack_start + sandbox->stack_size); /* Initialize file descriptors to -1 */ for (int i = 0; i < SANDBOX_MAX_IO_HANDLE_COUNT; i++) sandbox->io_handles[i].file_descriptor = -1; diff --git a/runtime/src/worker_thread.c b/runtime/src/worker_thread.c index 43e7b67..e528a8b 100644 --- a/runtime/src/worker_thread.c +++ b/runtime/src/worker_thread.c @@ -341,9 +341,8 @@ worker_thread_main(void *argument) * releases the linear memory, and then returns to the base context */ __attribute__((noreturn)) void -worker_thread_on_sandbox_exit(struct sandbox *exiting_sandbox) +worker_thread_on_sandbox_exit() { - assert(exiting_sandbox); assert(!software_interrupt_is_enabled()); generic_thread_dump_lock_overhead(); worker_thread_switch_to_base_context();