about summary refs log tree commit diff
path: root/library/std/src/sys/pal/xous
AgeCommit message (Collapse)AuthorLines
2024-11-26std: update internal uses of `io::const_error!`joboet-77/+60
2024-10-13net: fix dead code warningSean Cross-0/+3
Signed-off-by: Sean Cross <sean@xobs.io>
2024-10-13std: xous: add support for args and envSean Cross-32/+504
Process arguments and environment variables are both passed by way of Application Parameters. These are a TLV format that gets passed in as the second process argument. This patch combines both as they are very similar in their decode. Signed-off-by: Sean Cross <sean@osdyne.com>
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-6/+6
2024-08-27std: move allocators to `sys`joboet-72/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-20/+20
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-16xous: Forbid unwrapped unsafe in platform modulesJubilee Young-1/+1
2024-06-15std: refactor the TLS implementationjoboet-217/+1
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. @rustbot label +A-thread-locals
2024-05-29Make `std::env::{set_var, remove_var}` unsafe in edition 2024Tobias Bucher-2/+2
Allow calling these functions without `unsafe` blocks in editions up until 2021, but don't trigger the `unused_unsafe` lint for `unsafe` blocks containing these functions. Fixes #27970. Fixes #90308. CC #124866.
2024-05-02std: move thread parking to `sys::sync`joboet-113/+0
2024-04-11Factor some common `io::Error` constantsBenoît du Garreau-16/+4
2024-04-05Revert #121666Chris Denton-5/+1
This reverts #121666 due to #123495
2024-04-02Rollup merge of #122935 - RalfJung:with-exposed-provenance, r=AmanieuJacob Pratt-1/+1
rename ptr::from_exposed_addr -> ptr::with_exposed_provenance As discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/To.20expose.20or.20not.20to.20expose/near/427757066). The old name, `from_exposed_addr`, makes little sense as it's not the address that is exposed, it's the provenance. (`ptr.expose_addr()` stays unchanged as we haven't found a better option yet. The intended interpretation is "expose the provenance and return the address".) The new name nicely matches `ptr::without_provenance`.
2024-03-31std: move `thread::current` TLS variable out of `thread_info`joboet-10/+0
2024-03-23rename ptr::from_exposed_addr -> ptr::with_exposed_provenanceRalf Jung-1/+1
2024-03-20Use less restricted memory ordering in xous::thread_local_key.Mara Bos-5/+5
SeqCst isn't necessary in any of these cases.
2024-03-19SeqCst->Relaxed for xous set_nonblocking.Mara Bos-1/+1
The SeqCst wasn't synchronizing with anything. Relaxed is enough.
2024-03-19SeqCst->{Release,Acquire} for xous DropLock.Mara Bos-3/+6
SeqCst is unnecessary. Release+Acquire is the right ordering for a mutex.
2024-03-01Add `get_name` placeholder to other targetsChris Denton-1/+5
2024-02-16std: move locks to `sys` on xousjoboet-340/+0
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-1/+1
2024-02-15Use generic `NonZero` internally.Markus Reiter-3/+3
2024-02-08std: move path into `sys`joboet-2/+0
2024-02-05Remove unused structr0cky-3/+0
2024-01-22Rollup merge of #120109 - joboet:move_pal_cmath, r=ChrisDentonMatthias Krüger-2/+0
Move cmath into `sys` Part of #117276. r? ``@ChrisDenton``
2024-01-22Rollup merge of #119408 - betrusted-io:xous-fixes-add-network, r=Mark-SimulacrumMatthias Krüger-166/+1617
xous: misc fixes + add network support This patchset makes several fixes to Xous support. Additionally, this patch adds networking support. Many of these fixes are the result of the recent patch to get `unwinding` support merged. As a result of this patch, we can now run rust tests. As a result of these tests, we now have 729 tests passing: ``` failures: env::tests::test env::tests::test_self_exe_path env::tests::vars_debug env::tests::vars_os_debug os::raw::tests::same path::tests::test_push path::tests::test_set_file_name time::tests::since_epoch test result: FAILED. 729 passed; 8 failed; 1 ignored; 0 measured; 0 filtered out; finished in 214.54s ``` In the course of fixing several tests and getting the test sequence to reliably run, several issues were found. This patchset fixes those issues.
2024-01-22std: move cmath into `sys`joboet-2/+0
2024-01-15std: move OS String implementation into `sys`joboet-2/+0
2024-01-13xous: thread: mark thread_main() as divergentSean Cross-3/+7
The thread wrapper function never returns, so we can mark it as divergent. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: use constants for stdout and stderrSean Cross-3/+5
Use constants for the opcodes when writing to stdout or stderr. There still is no stdin operation. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: mark stdio structs as `repr(C)`Sean Cross-2/+2
Ensure these structs have a well-defined ABI layout. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13xous: net: initial commit of network supportSean Cross-1/+1364
This is an initial commit of network support for Xous. On hardware, is backed by smoltcp running via a Xous server in a separate process space. This patch adds TCP and UDP client and server support as well as DNS resolution support using the dns Xous server. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: share allocator symbol in testsSean Cross-0/+8
When using the testing framework, a second copy of libstd is built and linked. Use a global symbol for the `DLMALLOC` variable and mark it as `extern` when building as a test. This ensures we only have a single allocator even when running tests. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: fix thread_local_key under testsSean Cross-38/+63
When running tests, libstd gets implemented as a second library. Due to this fact, the `create()` and `destroy()` functions come from different libraries. To work around this, stash the `destroy_tls()` pointer in the first unused slot in the thread local storage pool. That way even if the destruction comes from a different version of libstd, the correct `DTORS` list will be consulted. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: once: use queue implementation on XousSean Cross-2/+0
Use the global queue implementation of Once when running on Xous. This gets us a thread-safe implementation, rather than using the non-threadsafe `unsupported` implementation. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: rewrite rwlock to be more robustSean Cross-21/+23
Add more checks to RwLock on Xous. As part of this, ensure the variable is in a good state when unlocking. Additionally, use the global `yield_now()` rather than platform-specific `do_yield()`. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: use blocking_scalars for mutex unlockSean Cross-13/+7
Use blocking scalars when unlocking a mutex. This ensures that mutexes are unlocked immediately rather than dangling. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: rework condvar to fix soundness issuesSean Cross-61/+98
Rework the Condvar implementation on Xous to ensure notifications are not missed. This involves keeping track of how many times a Condvar timed out and synchronizing based on that. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13xous: std: thread_parking: fix deadlocksbunnie-22/+40
Fix a deadlock condition that can occur when a thread is awoken in between the point at which it checks its wake state and the point where it actually waits. This change will cause the waker to continuously send Notify messages until it actually wakes up the target thread. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-11std: begin moving platform support modules into `pal`joboet-0/+1194