From 3d35f5280d78324f75b75806d43a694abdec969c Mon Sep 17 00:00:00 2001 From: edef Date: Wed, 24 Dec 2014 06:37:16 +0100 Subject: [PATCH] change the prefix from lwut_ to lwt_ we'll be using a lot of this code in kernelmode too, later. --- src/arch.rs | 10 +++++----- src/arch.s | 20 ++++++++++---------- src/platform.c | 4 ++-- src/platform.rs | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/arch.rs b/src/arch.rs index cf71fa0..f768b56 100644 --- a/src/arch.rs +++ b/src/arch.rs @@ -4,15 +4,15 @@ use std::mem::{size_of, zeroed}; use stack::Stack; extern "C" { - #[link_name = "lwut_bootstrap"] + #[link_name = "lwt_bootstrap"] pub fn bootstrap(); - #[link_name = "lwut_swapcontext"] + #[link_name = "lwt_swapcontext"] pub fn swapcontext(save: *mut Registers, restore: *mut Registers); - #[link_name = "lwut_get_sp_limit"] + #[link_name = "lwt_get_sp_limit"] pub fn get_sp_limit() -> *const u8; - #[link_name = "lwut_set_sp_limit"] + #[link_name = "lwt_set_sp_limit"] pub fn set_sp_limit(limit: *const u8); - #[link_name = "lwut_abort"] + #[link_name = "lwt_abort"] pub fn abort() -> !; } diff --git a/src/arch.s b/src/arch.s index b13a085..7326511 100644 --- a/src/arch.s +++ b/src/arch.s @@ -23,8 +23,8 @@ struc context ctx_xmm5 resq 2 endstruc -global lwut_swapcontext -lwut_swapcontext: +global lwt_swapcontext +lwt_swapcontext: ;; this is where the actual context switching takes place. first, save every ;; register in the current context into the leaving context, pointed at by rdi, ;; making sure the return address ends up in the IP slot. then, restore every @@ -77,8 +77,8 @@ lwut_swapcontext: jmp [rsi+ctx_ip] -global lwut_bootstrap -lwut_bootstrap: +global lwt_bootstrap +lwt_bootstrap: ;; some of the parameter registers aren't saved on context switch, and thus ;; can't be set into the struct directly. thus, initialisation from Rust-land ;; places the parameters in unrelated registers, and we frob them into place @@ -96,18 +96,18 @@ lwut_bootstrap: ;; functions, with inline assembly, but I prefer keeping all the assembly-land ;; stuff in here. -global lwut_set_sp_limit -lwut_set_sp_limit: +global lwt_set_sp_limit +lwt_set_sp_limit: mov [fs:0x70], rdi ret -global lwut_get_sp_limit -lwut_get_sp_limit: +global lwt_get_sp_limit +lwt_get_sp_limit: mov rax, [fs:0x70] ret -global lwut_abort -lwut_abort: +global lwt_abort +lwt_abort: ;; when a context is created for a native thread, it should only be switched ;; out of. if it's accidentally switched into, it'll hit this, because that's ;; what we set the initial IP to. diff --git a/src/platform.c b/src/platform.c index 69ab11e..c6b393e 100644 --- a/src/platform.c +++ b/src/platform.c @@ -7,12 +7,12 @@ // Register a stack with Valgrind. start < end. Returns an integer ID that can // be used to deregister the stack when it's deallocated. -unsigned int lwut_stack_register(const void *start, const void *end) { +unsigned int lwt_stack_register(const void *start, const void *end) { return VALGRIND_STACK_REGISTER(start, end); } // Deregister a stack from Valgrind. Takes the integer ID that was returned // on registration. -void lwut_stack_deregister(unsigned int id) { +void lwt_stack_deregister(unsigned int id) { VALGRIND_STACK_DEREGISTER(id); } diff --git a/src/platform.rs b/src/platform.rs index 178999b..5754c78 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -1,8 +1,8 @@ use libc; extern "C" { - #[link_name = "lwut_stack_register"] + #[link_name = "lwt_stack_register"] pub fn stack_register(start: *const u8, end: *const u8) -> libc::c_uint; - #[link_name = "lwut_stack_deregister"] + #[link_name = "lwt_stack_deregister"] pub fn stack_deregister(id: libc::c_uint); }