forked from M-Labs/libfringe
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:
parent
c209eed3a6
commit
3d35f5280d
10
src/arch.rs
10
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() -> !;
|
||||
}
|
||||
|
||||
|
|
20
src/arch.s
20
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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue