change the prefix from lwut_ to lwt_

we'll be using a lot of this code in kernelmode too, later.
This commit is contained in:
edef 2014-12-24 06:37:16 +01:00
parent c209eed3a6
commit 3d35f5280d
4 changed files with 19 additions and 19 deletions

View File

@ -4,15 +4,15 @@ use std::mem::{size_of, zeroed};
use stack::Stack; use stack::Stack;
extern "C" { extern "C" {
#[link_name = "lwut_bootstrap"] #[link_name = "lwt_bootstrap"]
pub fn bootstrap(); pub fn bootstrap();
#[link_name = "lwut_swapcontext"] #[link_name = "lwt_swapcontext"]
pub fn swapcontext(save: *mut Registers, restore: *mut Registers); 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; 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); pub fn set_sp_limit(limit: *const u8);
#[link_name = "lwut_abort"] #[link_name = "lwt_abort"]
pub fn abort() -> !; pub fn abort() -> !;
} }

View File

@ -23,8 +23,8 @@ struc context
ctx_xmm5 resq 2 ctx_xmm5 resq 2
endstruc endstruc
global lwut_swapcontext global lwt_swapcontext
lwut_swapcontext: lwt_swapcontext:
;; this is where the actual context switching takes place. first, save every ;; 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, ;; 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 ;; making sure the return address ends up in the IP slot. then, restore every
@ -77,8 +77,8 @@ lwut_swapcontext:
jmp [rsi+ctx_ip] jmp [rsi+ctx_ip]
global lwut_bootstrap global lwt_bootstrap
lwut_bootstrap: lwt_bootstrap:
;; some of the parameter registers aren't saved on context switch, and thus ;; 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 ;; 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 ;; 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 ;; functions, with inline assembly, but I prefer keeping all the assembly-land
;; stuff in here. ;; stuff in here.
global lwut_set_sp_limit global lwt_set_sp_limit
lwut_set_sp_limit: lwt_set_sp_limit:
mov [fs:0x70], rdi mov [fs:0x70], rdi
ret ret
global lwut_get_sp_limit global lwt_get_sp_limit
lwut_get_sp_limit: lwt_get_sp_limit:
mov rax, [fs:0x70] mov rax, [fs:0x70]
ret ret
global lwut_abort global lwt_abort
lwut_abort: lwt_abort:
;; when a context is created for a native thread, it should only be switched ;; 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 ;; out of. if it's accidentally switched into, it'll hit this, because that's
;; what we set the initial IP to. ;; what we set the initial IP to.

View File

@ -7,12 +7,12 @@
// Register a stack with Valgrind. start < end. Returns an integer ID that can // Register a stack with Valgrind. start < end. Returns an integer ID that can
// be used to deregister the stack when it's deallocated. // 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); return VALGRIND_STACK_REGISTER(start, end);
} }
// Deregister a stack from Valgrind. Takes the integer ID that was returned // Deregister a stack from Valgrind. Takes the integer ID that was returned
// on registration. // on registration.
void lwut_stack_deregister(unsigned int id) { void lwt_stack_deregister(unsigned int id) {
VALGRIND_STACK_DEREGISTER(id); VALGRIND_STACK_DEREGISTER(id);
} }

View File

@ -1,8 +1,8 @@
use libc; use libc;
extern "C" { 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; 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); pub fn stack_deregister(id: libc::c_uint);
} }