Commit graph

511 commits

Author SHA1 Message Date
bunnie
6ab88117f6 bump xous-api-log version & fix version pins 2023-10-31 20:07:28 +08:00
bunnie
d63b5912b1 absorb new xous-rs version 2023-10-10 16:50:00 +08:00
bunnie
5d82630502 fix return bug in xous-rs
turns out we were testing against the published version on crates.io
the local version was irrelevant in previous tests.
2023-10-10 16:47:08 +08:00
Sean Cross
c7c5a56a7d xous-rs: cache the current process ID
This value does not change, so cache it in order to reduce the number of
trips to the kernel.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-10-09 17:47:47 +08:00
bunnie
83256257e1 bump xous-rs crate to absorb Send derives on Messages
this is necessary for the smoltcp port
2023-10-03 20:54:14 +08:00
bunnie
11b6ca1266 add Send trait to the xous Message type 2023-09-26 15:09:13 +08:00
bunnie
478a612c02 commit version bump 2023-09-12 16:25:10 +08:00
Sean Cross
5dfad296ae xous: mark MemoryRange::as_slice and friends as unsafe
Mark `MemoryRange::as_slice()` and `MemoryRange::as_slice_mut()` as
unsafe.

This is due to the fact that not all representable types can be cast to
an arbitrary value. For example, if Process A sends random values to
Process B, then Process B casts the memory to a slice of `bool`, then
any values that are not 0 or 1 are undefined.

Because these functions can leak UB into the program, they are marked as
unsafe.

This patch adds `unsafe {}` blocks to all instances where this function
is called. Additionally, all instances have been checked to verify that
they do not cast to any invalid types -- most use `u8` or `u32`.

Additionally, the long-deprecated `MemoryRange::from_parts()` call was
removed, since that causes UB without being marked as unsafe.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-09-12 10:07:38 +08:00
bunnie
53469a68d0 publish package updates, sync to release tag 2023-08-08 14:35:49 +08:00
bunnie
b127cd093f bump version pins for change to xous-rs 2023-08-03 13:29:39 +08:00
Vihaan Jim
1d75c127e8 Fix `ProcessStartup'
Previously, `ProcessStartup' did not have `repr(C)' above it. This
meant that it was using rust layout, which is weird and is not
compatible with `_xous_syscall_return_result'
2023-08-02 16:59:08 -04:00
bunnie
51278451a0 update version pins to pull in cramium target 2023-07-19 21:07:56 +08:00
bunnie
4ac979f0ab update pins, again 2023-07-04 11:20:12 +08:00
bunnie
2ba77894bd it helps to test against the local copy :P 2023-07-04 11:19:12 +08:00
bunnie
c9f8f2681b update version pins 2023-07-04 11:09:13 +08:00
bunnie
adbb168343 strip out vestiges of unused assembly code in kernel package 2023-07-04 11:06:38 +08:00
Jean-Pierre De Jesus DIAZ
054d4831db
xous-rs: Remove arm assembly code
It was not used and it probably won't get used in the future

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-06-27 16:56:06 +02:00
bunnie
952ba18fba commit vesrion pin bumps 2023-06-16 01:30:18 +08:00
Jean-Pierre De Jesus DIAZ
2af737b57e
xous-rs: move LANG variable to locales
This change is made with the intention of making the xous-rs crate a bit
more freestanding without depending on the xtask build system.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-06-15 18:23:12 +02:00
Jean-Pierre De Jesus DIAZ
8ec8892a56
locales: use no_std by default.
This way the crate will always fail to compile if it doesn't compile on
no_std.

It being no_std by default won't affect std build of other crates as
no_std and std crates can interop by default.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-06-15 18:10:59 +02:00
bunnie
fbe3cb2a3d bump package numbers to absorb PR #388 2023-05-28 15:58:11 +08:00
bunnie
a244b204cc
Merge pull request #388 from Foundation-Devices/syscall-virt-to-phys-pid
Add virt_to_phys_pid syscall
2023-05-28 15:52:57 +08:00
eupn
05d7f6a286
Add virt_to_phys_pid syscall
This syscall allows to obtain a physical address from a mapping of a specific process
2023-05-23 19:43:53 +04:00
bunnie
5a2df4432c technical debt: cleanup UTRA package
- make the "base" field no longer public. It is accessible, but only
through an `unsafe` method, because, it is unsafe.
- add accessors to offest/mask fields. Because, it's not at all
unsafe to access these, and it can be useful for bit-ops that are
not part of the generic set of UTRA.
- add Arc to AtomicCSR, and require `std` for AtomicCSR types.
This should not break anything, I checked inside @foundation-devices
keyOS and they don't seem to be using AtomicCSR anywhere.

The Arc makes it a bit safer to clone the AtomicCSR base pointer
and share it between threads, but it will have an impact on performance.
The USB stack (which requires AtomicCSR) was regression testing and the
impact seems minimal.

Recall that the main purpose of AtomicCSR is to provide a CSR accessor
that does not require a mutable reference to the base object. This
can make certain Rust idioms a bit cleaner. We wrap the base accessor
in Arc+Atomic to try and improve the safety of throwing the borrow
checker under the bus, but it's still not perfect because hardware
mutable state can have side-effects within hardware itself that cannot
be modeled or checked by Rust's borrow checker.
2023-05-23 18:11:24 +08:00
bunnie
697d44de3d bump version pins to absorb changes to svd2utra etc. 2023-05-03 23:11:12 +08:00
bunnie
8a574f937f bump for xous-rs version pin update 2023-04-27 22:18:30 +08:00
bunnie
95cc71ce32 update assembly artifacts 2023-04-27 22:09:29 +08:00
bunnie
fb710592b0 harmonize scripts around xpack distro (goodbye sifive) 2023-04-27 22:09:08 +08:00
Jean-Pierre De Jesus DIAZ
14e9b4162b
xous-rs: move vex AES functions to services/aes
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-04-20 15:42:18 +02:00
bunnie
849c136b90 bump versions because API crate changed 2023-04-12 23:02:30 +08:00
Jean-Pierre De Jesus DIAZ
9cd614fd35
fix xous-rs documentation tests
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-04-12 16:43:29 +02:00
bunnie
8357ab31a5 bump all pins because utralib got updated 2023-04-09 00:48:35 +08:00
bunnie
9c94d6b4c0 bump versions because xous-rs API changed for gdb-stub 2023-04-08 23:49:24 +08:00
Sean Cross
3f2c4de163 xous: add interrupts to irq-capable calls
These calls should be possible to make during interrupts.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-06 10:48:45 +08:00
bunnie
e469eba167 bump version for utralib patch 2023-04-04 02:13:02 +08:00
bunnie
704aaf98af bump versions for kernel interface changes 2023-03-22 02:48:55 +08:00
eupn
a027fc6a2c
xous-rs: checkout ARM assembly binary 2023-03-14 19:00:49 +04:00
eupn
b720426855
xous-rs: extend assemble script with arm arch 2023-03-14 19:00:17 +04:00
eupn
92969c8d42
xous-rs: extend build script to pick arm assembly binary too 2023-03-14 18:59:49 +04:00
eupn
294d75da4e
xous-rs: add ARM arch modules 2023-03-14 18:59:13 +04:00
eupn
76114c060a
xous-rs: add increase_heap syscall
This is used in ARM version of dlmalloc-rs for Xous stdlib
2023-03-14 18:51:07 +04:00
eupn
0f420b7b63
xous-rs: add "device" memory flag 2023-03-14 18:49:22 +04:00
bunnie
303f595d6f bump versions to cleanup renode.rs sync issue 2023-03-14 16:34:53 +08:00
bunnie
82e3aa322f bump toml files in prep for publish 2023-03-08 03:54:37 +08:00
bunnie
9256e7cc09 bump versions to absorb xous-names fix 2023-01-31 15:07:32 +08:00
bunnie
84368c3f3a bump versions for publication 2023-01-31 02:18:12 +08:00
Sean Cross
a24291b462 xous: use asm!() macro for syscalls
Previously we used externally-linked assembly in order to make syscalls.
Now that `asm!()` is stable, use this macro.

This will help to optimize IPC between programs and the kernel.
Additionally, it resolves an unsoundness issue where we were filling in
values on the stack and hoping that Rust didn't reorder the structs.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 22:15:01 +08:00
bunnie
232a4b6c6c bump xous version 2023-01-18 00:02:46 +08:00
bunnie
bb5d7b3adf bump versions to absorb hosted mode fix 2023-01-05 14:07:24 +08:00
bunnie
64fa83cec4
Merge pull request #290 from betrusted-io/reply-and-receive-next-syscall
Fix ReplyAndReceiveNext for hosted mode
2023-01-05 13:56:24 +08:00
Sean Cross
81351bed32 xous: syscall: support call.memory() for ReplyAndReceiveNext
Much of the hosted machinery requires the ability to access memory on
syscalls. This feature was overlooked in the previous implementation of
ReplyAndReceiveNext, which caused it to not properly return memory.

Implement the ability to call `.memory()` on ReplyAndReceiveNext
messages.

Note that this requires the use of a sentinal value in the
previously-unused `valid` field.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-05 11:53:59 +08:00
bunnie
36398810dd bump version numbers to absorb new syscalls 2022-12-30 15:24:36 +08:00
Sean Cross
d88254b1b1 xous: add reply_and_receive_next_legacy call
This call is used to return values while simultaneously listening for
new messages.

The -legacy suffix is used to disambiguate scalar values, so we know
whether to send Scalar1, Scalar2, or Scalar5 messages.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-12-29 21:00:35 +08:00
Sean Cross
64c88f9942 xous: add Message type
This type actually contains the message contents, and will be used to
return data to the caller.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-12-29 21:00:05 +08:00
Sean Cross
d463f9563f xous: rename Message to MessageEnvelope
This reflects the fact that up until now, the `Message` struct has
merely been the envelope that surrounds the message. It does not contain
any actual Message contents.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-12-29 20:58:51 +08:00
Sean Cross
be56af6303 xous: add wrapper for reply_and_receive_next
This wrapper enables userspace programs to use the new
ReplyAndReceiveNext syscall easily.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-12-29 16:26:37 +08:00
Sean Cross
36e6e6c30b xous: syscall: add ReplyAndReceiveNext call
Signed-off-by: Sean Cross <sean@xobs.io>
2022-12-29 16:26:34 +08:00
bunnie
5370ce396d bump all revs due to SoC artifact update 2022-12-12 16:07:20 +08:00
bunnie
1d1b3a35b7 commit version bump 2022-11-26 10:00:44 +08:00
bunnie
aa9977cc58 bump all the things because we changed utralib again 2022-11-17 22:13:40 +08:00
bunnie
dabbfd6c35 bump all the things to absorb the SoC change 2022-11-17 19:39:18 +08:00
bunnie
30583bdf07 bump versions with xous change 2022-11-06 03:48:12 +08:00
Sean Cross
c9f751f5f0 xous: add api support for scalar5
With the addition of scalar5, existing api calls must be updated to take
advantage of it. This will allow `send_message()` to return a `scalar5`.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-11-05 18:44:01 +08:00
Sean Cross
c8bb039c41 xous: add api support for Scalar5
Add syscall and return definitions for Scalar5, as well as
ReturnScalar5. This will enable us to pass up to five scalars as a
return from a blockingscalar call.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-11-05 18:39:06 +08:00
bunnie
ba28dd8795 bump to absorb utralib straggler configs 2022-10-28 15:11:17 +08:00
bunnie
dfb10ed7f2 bump crate numbers to publish lang-fr change into xous-rs 2022-10-28 14:01:09 +08:00
bunnie
0ee9ec1d80 bump version numbers for crate publication 2022-10-25 22:38:58 +08:00
Jean-Pierre De Jesus DIAZ
f5176ea380
Remove xous-rs unused features
The rationale is that xous-rs should have only architecture
specific code, e.g.: riscv, arm, x86, etc. To make other
crates that depend on it not specify the features.

This could be useful when using xous-rs with `libstd`
for example.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-10-25 13:29:15 +02:00
Jean-Pierre De Jesus DIAZ
14b92dede4
Remove baremetal cfg detection in build script
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-10-25 13:24:59 +02:00
bunnie
d331d405ee bump version numbers for publication 2022-10-25 17:23:40 +08:00
Sean Cross
6066619906 xous-rs: use target_os and target_arch cfgs
Look at `target_os` to determine whether to enter "hosted" mode or not.
If `target_os` is "xous", then the Xous standard library should default
to using builtin Rust libstd features.

If it is "xous", then we should instead use our arch-specific
implementations.

This enables third-party programs to directly use the `xous` crate
without specifying feature flags.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-10-25 15:50:53 +08:00
bunnie
9c4a39066d rollback the cache clear instruction in the asm entry
this causes instability when present with the older vex core.
2022-10-20 04:20:59 +08:00
bunnie
7b0f30c318 add Charles' flush command + recommended nops
the Vex has a custom flush instruction, after contacting
charles he recommends maybe adding some nops to make sure it
completes (maybe hardware bug? unclear. we're about to find out.)
2022-10-19 23:42:43 +08:00
bunnie
0584ad2f2c switch to local paths to see if this helps the build 2022-10-18 00:26:56 +08:00
bunnie
4b368d71db bump versions of crates 2022-10-15 01:31:54 +08:00
bunnie
63a87ca1bc bump all the versions 2022-10-14 16:54:43 +08:00
bunnie
ff30131f43 absorb more fixes into the kernel 2022-10-13 04:08:56 +08:00
bunnie
966cdef65f remove warning 2022-10-13 04:03:08 +08:00
bunnie
64b942f3b4 fix errors is the test module from PR#238 2022-10-13 04:01:43 +08:00
bunnie
51752aac9d
Merge pull request #239 from Foundation-Devices/baremetal
Use CARGO_CFG_TARGET_OS in build scripts.
2022-10-12 12:56:17 -07:00
bunnie
3503965f98 bump versions to absorb xous-rs changes 2022-10-13 03:41:16 +08:00
bunnie
84bdfa1d2f fix some escapes from #237/#238 due to xous-rs being on crates.io 2022-10-13 03:29:46 +08:00
bunnie
be239f9812
Merge pull request #238 from Foundation-Devices/from-into
Implement From instead of Into.
2022-10-12 11:49:19 -07:00
Jean-Pierre De Jesus DIAZ
955fbc8788
xous: Use CARGO_CFG_TARGET_OS in build scripts.
This allows for a more reliable detection of target_os configuration
in build scripts. The target is inconsistent between some architectures,
notably armv7a is `armv7a-none-eabi` skipping the `unknown` (the vendor,
I guess) part. This happen with some of the unrelated Cortex-M targets
present, and others may also be.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-10-12 19:03:46 +02:00
Jean-Pierre De Jesus DIAZ
3cbcf7b7e4
xous-rs: Implement Display instead of Into
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-10-12 15:39:02 +02:00
Jean-Pierre De Jesus DIAZ
c74d54f345
xous-rs: Implement From instead of Into
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-10-12 15:38:44 +02:00
bunnie
02b80425f5 bump xous-rs to absorb change in language specification 2022-10-10 03:07:44 +08:00
bunnie
3bca9de2a0 bump version numbers for xous-kernel patch
this fixes tests in CI
2022-10-05 23:51:35 +08:00
bunnie
32e3cf588f bump xous-rs to 0.9.11 to absorb feature flags into the kernel API 2022-10-05 18:26:58 +08:00
bunnie
0ae89626fe add default for crates 2022-10-05 17:20:26 +08:00
bunnie
644a52e784 defaults for cargo packaging 2022-10-05 17:18:54 +08:00
bunnie
586f2bddf6 bump xous-rs version to absorb feature flag changes from utralib 2022-10-05 17:15:28 +08:00
bunnie
4e40ae6c5d move from target selectors to feature selectors for back-ends
This will allow for e.g. xous on riscv32-imac but not a precursor
target, for example: by using feature selectors we get to have
a bigger range of targets that we support, such as for implementations
that haven't been upstreamed or have official target-triples.

The downsides are:

- patch override libraries don't absorb feature flags. so, for
example, the AES crate that is used to patch other crates won't
be aware of the target features without modifying the referencing
crates.

- features are normally meant to be additive, but target features
are mutually exclusive. The mutex is enforced by a check in
utralib that throws a panic on build if two targets are accidentally
selected at the same time.
2022-10-02 02:56:44 +08:00
bunnie
147d55bdf8 bump xous-rs version 2022-09-26 11:08:22 +08:00
bunnie
ea37ce2ea1 add feature gate on v2p per xobs' request 2022-09-15 14:06:07 +08:00
bunnie
6d9848c239 add virt_to_phys syscall
this will help speed up performance profiling as we can
resolve the physical address of the performance buffer allocated
in RAM and use a USB command to read it out, instead of streaming
it over serial.
2022-09-14 18:09:13 +08:00
bunnie
d3337bdaba make constant naming consistent (prefix indicates the address space offset) 2022-07-13 04:36:17 +08:00
bunnie
fa21e01b94 add the location of the backup block 2022-07-12 03:31:37 +08:00
Sean Cross
20389e0941 xous: definitions: correct offsets for Result::from_usize()
The offsets were corrected with `to_usize()`, but hadn't been updated
for the other direction.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-07-05 23:12:22 +08:00
Sean Cross
c10541c0cc xous: definitions: fix discriminant shift for Results
The ServerID return type was placed in the middle of the results list,
which caused results 8-15 to be shifted by one to become results 9-15,
with result 8 being swapped with result 15.

This fixes this offset.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-07-04 16:54:32 +08:00