Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

Commit

Permalink
Address pull request comments, add TODOs and issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tbu- committed Apr 15, 2017
1 parent 12e9713 commit 7760a04
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "std"
version = "0.1.0"

[dependencies]
sc = { git = "git://github.com/japaric/syscall.rs" }
sc = "0.2.0"

[dependencies.ralloc]
default-features = false
Expand Down
2 changes: 1 addition & 1 deletion src/libc/internal/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ unsafe extern "C" fn __steed_clone() {
}

pub unsafe fn set_thread_pointer(thread_data: *mut ()) {
let _ = thread_data; // TODO(steed): Set thread-local pointer.
let _ = thread_data; // TODO(steed, #127): Set thread-local pointer.
}
2 changes: 1 addition & 1 deletion src/libc/internal/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ unsafe extern "C" fn __steed_clone() {
}

pub unsafe fn set_thread_pointer(thread_data: *mut ()) {
let _ = thread_data; // TODO(steed): Set thread-local pointer.
let _ = thread_data; // TODO(steed, #127): Set thread-local pointer.
}
2 changes: 1 addition & 1 deletion src/libc/internal/powerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ unsafe extern "C" fn __steed_clone() {
}

pub unsafe fn set_thread_pointer(thread_data: *mut ()) {
let _ = thread_data; // TODO(steed): Set thread-local pointer.
let _ = thread_data; // TODO(steed, #127): Set thread-local pointer.
}
2 changes: 2 additions & 0 deletions src/libc/internal/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ pub unsafe fn set_thread_pointer(thread_data: *mut ()) {
entry_number: -1i32 as u32,
base_addr: thread_data as u32,
limit: 0xfffff,
// This `flags` value is explained in the `asm!` block of
// `__steed_clone` above.
flags: 0x51,
};
let result = linux::set_thread_area(&mut user_desc);
Expand Down
4 changes: 3 additions & 1 deletion src/libc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ pub unsafe fn pthread_create(pthread: *mut pthread_t,
let mask = align - 1;
let stack_size = ((*attr).stack_size + mask) & !mask;

// TODO(steed, #131): Make sure this is freed on normal and abnormal thread
// exit.
let map = mmap(ptr::null_mut(),
stack_size + mem::size_of::<thread>(),
PROT_READ | PROT_WRITE,
Expand Down Expand Up @@ -288,7 +290,7 @@ pub unsafe fn pthread_join(pthread: pthread_t, retval: *mut *mut c_void)
if tmp == 0 {
return 0;
}
// TODO(steed): Why does FUTEX_WAIT_PRIVATE not work?
// TODO(steed, #130): Why does FUTEX_WAIT_PRIVATE not work?
let res = linux::futex(&mut (*thread).thread_id as *mut _ as *mut u32,
linux::FUTEX_WAIT,
(*thread).thread_id as u32,
Expand Down
1 change: 1 addition & 0 deletions src/sys/linux/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub fn exit(code: i32) -> ! {
}

pub fn page_size() -> usize {
// TODO(steed, #133): Implement me.
unimplemented!();
}

Expand Down
1 change: 1 addition & 0 deletions src/sys/linux/stack_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub struct Handler(());

impl Handler {
pub unsafe fn new() -> Handler {
// TODO(steed, #132): Implement a stack overflow handler.
Handler(())
}
}
1 change: 1 addition & 0 deletions src/sys/linux/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ impl Thread {
*/
}

// TODO(steed, #134): Implement `Drop` for `Thread`.
/*
impl Drop for Thread {
fn drop(&mut self) {
Expand Down
2 changes: 2 additions & 0 deletions src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl Builder {
imp::Thread::set_name(name);
}
unsafe {
// TODO(steed, #128): Add guard page to new threads.
/*
thread_info::set(imp::guard::current(), their_thread);
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(f));
Expand Down Expand Up @@ -110,6 +111,7 @@ pub struct ThreadId(u64);
impl ThreadId {
// Generate a new unique thread ID.
fn new() -> ThreadId {
// TODO(steed, #129): Use `std`s implementation (commented out below).
/*
static GUARD: mutex::Mutex = mutex::Mutex::new();
static mut COUNTER: u64 = 0;
Expand Down

0 comments on commit 7760a04

Please sign in to comment.