Skip to content

Commit

Permalink
Merge #2799
Browse files Browse the repository at this point in the history
2799: doc: misc updates r=brghena a=bradjc

### Pull Request Overview

I did a quick pass on the doc folder and made some updates where I saw issues.


### Testing Strategy

n/a


### TODO or Help Wanted

n/a


### Documentation Updated

- [x] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [x] Ran `make prepush`.


Co-authored-by: Brad Campbell <bradjc5@gmail.com>
  • Loading branch information
bors[bot] and bradjc committed Aug 25, 2021
2 parents c489623 + 21699ae commit 6ade39d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
12 changes: 6 additions & 6 deletions doc/Syscalls.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ as the return address (`ra`) register.
After a system call is made, the call is handled and routed by the Tock kernel
in [`sched.rs`](../kernel/src/kernel.rs) through a series of steps.

1. For Command, Subscribe, Allow Read-Write and Allow Read-Only system
1. For Command, Subscribe, Allow Read-Write, and Allow Read-Only system
call classes, the kernel calls a platform-defined system call filter
function. This function determines if the kernel should handle the
system call or not. Yield, Exit, and Memop system calls are not
filtered. This filter function allows the kernel to impose security
policies that limit which system calls a process might invoke. The
filter function takes the system call and which process issued the system call
to return a `Result((), ErrorCode)` to signal if the system call should be
to return a `Result<(), ErrorCode>` to signal if the system call should be
handled or if an error should be returned to the process. If the
filter function disallows the system call it returns `Err(ErrorCode)` and
the `ErrorCode` is provided to the process as the return code for the
Expand All @@ -234,24 +234,24 @@ which implements the Memop class.
4. Allow Read-Write, Allow Read-Only, Subscribe, and Command follow a
more complex execution path because are implemented by drivers. To
route these system calls, the scheduler loop calls a struct that
implements the `Platform` trait. This trait has a `with_driver()`
implements the `SyscallDriverLookup` trait. This trait has a `with_driver()`
function that the driver number as an argument and returns either a
reference to the corresponding driver or `None` if it is not
installed. The kernel uses the returned reference to call the
appropriate system call function on that driver with the remaining
system call arguments.

An example board that implements the `Platform` trait looks something like
An example board that implements the `SyscallDriverLookup` trait looks something like
this:

```rust
struct TestBoard {
console: &'static Console<'static, usart::USART>,
}

impl Platform for TestBoard {
impl SyscallDriverLookup for TestBoard {
fn with_driver<F, R>(&self, driver_num: usize, f: F) -> R
where F: FnOnce(Option<&kernel::Driver>) -> R
where F: FnOnce(Option<&kernel::syscall::SyscallDriver>) -> R
{

match driver_num {
Expand Down
3 changes: 3 additions & 0 deletions doc/reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ Tock Reference Documents

- **[TRD 1](trd1-trds.md)**: Tock Reference Documents
- **[TRD 102](trd102-adc.md)**: ADC
- **[TRD 103](trd103-adc.md)**: GPIO
- **[TRD 104](trd104-adc.md)**: Syscalls
- **[TRD 105](trd105-adc.md)**: Time
8 changes: 4 additions & 4 deletions doc/syscalls/memop.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ All memop calls pass an operation type as the first parameter. Some include
an argument in the second parameter:

```rust
memop(op_type: u32, argument: u32) -> [[ VARIES ]] as u32
memop(op_type: u32, argument: u32) -> [[ VARIES ]]
```

## Memory Operations
Expand All @@ -25,7 +25,7 @@ memop(op_type: u32, argument: u32) -> [[ VARIES ]] as u32
**Argument 1** `as *u8`: Address of the new program break (aka maximum
accessible value).

**Returns** `Result<(), ErrorCode> as u32`: `Ok(())` or `NOMEM`.
**Returns** `Result<(), ErrorCode>`: `Ok(())` or `NOMEM`.

* ### Operation type `1`: `sbrk`

Expand Down Expand Up @@ -117,12 +117,12 @@ memop(op_type: u32, argument: u32) -> [[ VARIES ]] as u32

**Argument 1** `as *const u8`: Address of the stack top.

**Returns** `Result<(), ErrorCode> as u32`: Always `Ok(())`.
**Returns** `Result<(), ErrorCode>`: Always `Ok(())`.

* ### Operation type `11`: (debug) Specify heap location

**Description**: Specify the start of the application heap.

**Argument 1** `as *const u8`: Address of the heap start.

**Returns** `Result<(), ErrorCode> as u32`: Always `Ok(())`.
**Returns** `Result<(), ErrorCode>`: Always `Ok(())`.

0 comments on commit 6ade39d

Please sign in to comment.