From f9b836d23e0df6ed6da04ec7d58b94e51662c593 Mon Sep 17 00:00:00 2001 From: Jeremy Soller <jeremy@system76.com> Date: Sun, 9 Dec 2018 15:28:45 -0700 Subject: [PATCH] Add more pte functions --- src/platform/redox/pte.rs | 15 +++++++++++++++ src/start.rs | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/platform/redox/pte.rs b/src/platform/redox/pte.rs index ba6309a88..926aac11d 100644 --- a/src/platform/redox/pte.rs +++ b/src/platform/redox/pte.rs @@ -135,8 +135,17 @@ pub unsafe extern "C" fn pte_osThreadWaitForEnd(handle: pte_osThreadHandle) -> p } // pte_osResult pte_osThreadCancel(pte_osThreadHandle threadHandle) +#[no_mangle] +pub unsafe extern "C" fn pte_osThreadCancel(handle: pte_osThreadHandle) -> pte_osResult { + //TODO: allow cancel of thread + PTE_OS_OK +} // pte_osResult pte_osThreadCheckCancel(pte_osThreadHandle threadHandle) +#[no_mangle] +pub unsafe extern "C" fn pte_osThreadCheckCancel(handle: pte_osThreadHandle) -> pte_osResult { + PTE_OS_OK +} //void pte_osThreadSleep(unsigned int msecs) #[no_mangle] @@ -288,6 +297,12 @@ pub unsafe extern "C" fn pte_osSemaphorePend(handle: pte_osSemaphoreHandle, pTim PTE_OS_OK } +#[no_mangle] +pub unsafe extern "C" fn pte_osSemaphoreCancellablePend(handle: pte_osSemaphoreHandle, pTimeout: *mut c_uint) -> pte_osResult { + //TODO + pte_osSemaphorePend(handle, pTimeout) +} + /* int pte_osAtomicExchange(int *ptarg, int val) int pte_osAtomicCompareExchange(int *pdest, int exchange, int comp) diff --git a/src/start.rs b/src/start.rs index ec462a432..5c5115e65 100644 --- a/src/start.rs +++ b/src/start.rs @@ -57,12 +57,13 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! { fn main(argc: isize, argv: *mut *mut c_char, envp: *mut *mut c_char) -> c_int; } + // Set up argc and argv let argc = sp.argc(); let argv = sp.argv(); - platform::inner_argv = copy_string_array(argv, argc as usize); platform::argv = platform::inner_argv.as_mut_ptr(); + // Set up envp let envp = sp.envp(); let mut len = 0; while ! (*envp.add(len)).is_null() { @@ -76,6 +77,7 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! { stdio::stdout = stdio::default_stdout.get(); stdio::stderr = stdio::default_stderr.get(); + // Call init section _init(); // Look for the neighbor functions in memory until the end -- GitLab