mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
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>
This commit is contained in:
parent
c9d5074dd2
commit
c10541c0cc
1 changed files with 35 additions and 18 deletions
|
|
@ -282,11 +282,6 @@ impl MemoryRange {
|
||||||
/// so it is imperitive that this only be used to point to valid, page-aligned
|
/// so it is imperitive that this only be used to point to valid, page-aligned
|
||||||
/// ranges.
|
/// ranges.
|
||||||
pub unsafe fn new(addr: usize, size: usize) -> core::result::Result<MemoryRange, Error> {
|
pub unsafe fn new(addr: usize, size: usize) -> core::result::Result<MemoryRange, Error> {
|
||||||
assert!(
|
|
||||||
addr != 0,
|
|
||||||
"tried to construct a memory range with a null pointer"
|
|
||||||
);
|
|
||||||
assert!(size != 0, "tried to construct a zero-length memory range");
|
|
||||||
Ok(MemoryRange {
|
Ok(MemoryRange {
|
||||||
addr: MemoryAddress::new(addr).ok_or(Error::BadAddress)?,
|
addr: MemoryAddress::new(addr).ok_or(Error::BadAddress)?,
|
||||||
size: MemorySize::new(size).ok_or(Error::BadAddress)?,
|
size: MemorySize::new(size).ok_or(Error::BadAddress)?,
|
||||||
|
|
@ -390,10 +385,18 @@ impl core::fmt::Display for MemoryType {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum Result {
|
pub enum Result {
|
||||||
|
// 0
|
||||||
Ok,
|
Ok,
|
||||||
|
// 1
|
||||||
Error(Error),
|
Error(Error),
|
||||||
|
|
||||||
|
// 2
|
||||||
MemoryAddress(MemoryAddress),
|
MemoryAddress(MemoryAddress),
|
||||||
|
|
||||||
|
// 3
|
||||||
MemoryRange(MemoryRange),
|
MemoryRange(MemoryRange),
|
||||||
|
|
||||||
|
// 4
|
||||||
ReadyThreads(
|
ReadyThreads(
|
||||||
usize, /* count */
|
usize, /* count */
|
||||||
usize,
|
usize,
|
||||||
|
|
@ -403,29 +406,43 @@ pub enum Result {
|
||||||
usize,
|
usize,
|
||||||
/* pid2 */ usize, /* context2 */
|
/* pid2 */ usize, /* context2 */
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// 5
|
||||||
ResumeProcess,
|
ResumeProcess,
|
||||||
|
|
||||||
|
// 6
|
||||||
ServerID(SID),
|
ServerID(SID),
|
||||||
|
|
||||||
|
// 7
|
||||||
ConnectionID(CID),
|
ConnectionID(CID),
|
||||||
|
|
||||||
|
// 8
|
||||||
NewServerID(SID, CID),
|
NewServerID(SID, CID),
|
||||||
|
|
||||||
|
// 9
|
||||||
Message(MessageEnvelope),
|
Message(MessageEnvelope),
|
||||||
|
|
||||||
|
// 10
|
||||||
ThreadID(TID),
|
ThreadID(TID),
|
||||||
|
|
||||||
|
// 11
|
||||||
ProcessID(PID),
|
ProcessID(PID),
|
||||||
|
|
||||||
/// The requested system call is unimplemented
|
/// 12: The requested system call is unimplemented
|
||||||
Unimplemented,
|
Unimplemented,
|
||||||
|
|
||||||
/// The process is blocked and should perform the read() again. This is only
|
/// 13: The process is blocked and should perform the read() again. This is only
|
||||||
/// ever seen in `Hosted` mode, because when running natively the kernel
|
/// ever seen in `Hosted` mode, because when running natively the kernel
|
||||||
/// simply never schedules the process.
|
/// simply never schedules the process.
|
||||||
BlockedProcess,
|
BlockedProcess,
|
||||||
|
|
||||||
/// A scalar with one value
|
/// 14: A scalar with one value
|
||||||
Scalar1(usize),
|
Scalar1(usize),
|
||||||
|
|
||||||
/// A scalar with two values
|
/// 15: A scalar with two values
|
||||||
Scalar2(usize, usize),
|
Scalar2(usize, usize),
|
||||||
|
|
||||||
/// The syscall should be attempted again. This is returned when calling
|
/// 16: The syscall should be attempted again. This is returned when calling
|
||||||
/// functions such as `try_connect()` and `try_send()` that may block.
|
/// functions such as `try_connect()` and `try_send()` that may block.
|
||||||
RetryCall,
|
RetryCall,
|
||||||
|
|
||||||
|
|
@ -470,19 +487,19 @@ impl Result {
|
||||||
Result::Message(me) => {
|
Result::Message(me) => {
|
||||||
let me_enc = me.to_usize();
|
let me_enc = me.to_usize();
|
||||||
[
|
[
|
||||||
8, me_enc[0], me_enc[1], me_enc[2], me_enc[3], me_enc[4], me_enc[5], me_enc[6],
|
9, me_enc[0], me_enc[1], me_enc[2], me_enc[3], me_enc[4], me_enc[5], me_enc[6],
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Result::ThreadID(ctx) => [9, *ctx as usize, 0, 0, 0, 0, 0, 0],
|
Result::ThreadID(ctx) => [10, *ctx as usize, 0, 0, 0, 0, 0, 0],
|
||||||
Result::ProcessID(pid) => [10, pid.get() as _, 0, 0, 0, 0, 0, 0],
|
Result::ProcessID(pid) => [11, pid.get() as _, 0, 0, 0, 0, 0, 0],
|
||||||
Result::Unimplemented => [11, 0, 0, 0, 0, 0, 0, 0],
|
Result::Unimplemented => [21, 0, 0, 0, 0, 0, 0, 0],
|
||||||
Result::BlockedProcess => [12, 0, 0, 0, 0, 0, 0, 0],
|
Result::BlockedProcess => [13, 0, 0, 0, 0, 0, 0, 0],
|
||||||
Result::Scalar1(a) => [13, *a, 0, 0, 0, 0, 0, 0],
|
Result::Scalar1(a) => [14, *a, 0, 0, 0, 0, 0, 0],
|
||||||
Result::Scalar2(a, b) => [14, *a, *b, 0, 0, 0, 0, 0],
|
Result::Scalar2(a, b) => [15, *a, *b, 0, 0, 0, 0, 0],
|
||||||
Result::NewServerID(sid, cid) => {
|
Result::NewServerID(sid, cid) => {
|
||||||
let s = sid.to_u32();
|
let s = sid.to_u32();
|
||||||
[
|
[
|
||||||
15,
|
8,
|
||||||
s.0 as _,
|
s.0 as _,
|
||||||
s.1 as _,
|
s.1 as _,
|
||||||
s.2 as _,
|
s.2 as _,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue