XU XUv0.16.0

#core/task

import: #core/task

counts: 5 functions, 1 methods, 4 types, 5 constants, 0 method sets

Kernel multi-tasking, context switching, and execution control for baremetal kernels.

const TASK_UNUSED

XuAPI
pub const TASK_UNUSED = 0

Purpose

Constant TASK_UNUSED, defining protocol or algorithm parameters.

const TASK_READY

XuAPI
pub const TASK_READY = 1

Purpose

Constant TASK_READY, defining protocol or algorithm parameters.

const TASK_RUNNING

XuAPI
pub const TASK_RUNNING = 2

Purpose

Constant TASK_RUNNING, defining protocol or algorithm parameters.

const TASK_BLOCKED

XuAPI
pub const TASK_BLOCKED = 3

Purpose

Constant TASK_BLOCKED, defining protocol or algorithm parameters.

const TASK_DEAD

XuAPI
pub const TASK_DEAD = 4

Purpose

Constant TASK_DEAD, defining protocol or algorithm parameters.

struct TaskContext

XuAPI
pub struct TaskContext {
    pub regs0 u64
    pub regs1 u64
    pub regs2 u64
    pub regs3 u64
    pub regs4 u64
    pub regs5 u64
    pub regs6 u64
    pub regs7 u64
    pub regs8 u64
    pub regs9 u64
    pub fp u64    // offset 80
    pub pc u64    // offset 88
    pub sp u64    // offset 96
    pub pad0 u64  // offset 104
    pub pad1 u64  // offset 112
    pub pad2 u64  // offset 120
    pub pad3 u64  // offset 128
    pub pad4 u64  // offset 136
    pub pad5 u64  // offset 144
    pub pad6 u64  // offset 152
    pub pad7 u64  // offset 160
    pub pad8 u64  // offset 168
    pub pad9 u64  // offset 176
    pub pad10 u64 // offset 184
}

Purpose

Structure encapsulating regs0, regs1, regs2, regs3, regs4.

Public fields

regs0 u64
field (u64)
regs1 u64
field (u64)
regs2 u64
field (u64)
regs3 u64
field (u64)
regs4 u64
field (u64)
regs5 u64
field (u64)
regs6 u64
field (u64)
regs7 u64
field (u64)
regs8 u64
field (u64)
regs9 u64
field (u64)
fp u64 // offset 80
field (u64 // offset 80)
pc u64 // offset 88
field (u64 // offset 88)
sp u64 // offset 96
field (u64 // offset 96)
pad0 u64 // offset 104
field (u64 // offset 104)
pad1 u64 // offset 112
field (u64 // offset 112)
pad2 u64 // offset 120
field (u64 // offset 120)
pad3 u64 // offset 128
field (u64 // offset 128)
pad4 u64 // offset 136
field (u64 // offset 136)
pad5 u64 // offset 144
field (u64 // offset 144)
pad6 u64 // offset 152
field (u64 // offset 152)
pad7 u64 // offset 160
field (u64 // offset 160)
pad8 u64 // offset 168
field (u64 // offset 168)
pad9 u64 // offset 176
field (u64 // offset 176)
pad10 u64 // offset 184
field (u64 // offset 184)

task_context_new

XuAPI
pub fn task_context_new() TaskContext

Purpose

Task context new.

Parameters

No arguments are required.

Returns

TaskContext — a value of this type

($&TaskContext) init

XuAPI
pub fn (ctx $&TaskContext) init(entry u64, stack_top u64)

Purpose

Initialize internal state and default parameters.

Parameters

ctx $&TaskContext
The TaskContext instance used by this call (exclusive borrow).
entry u64
entry (u64)
stack_top u64
stack_top (u64)

Returns

This call does not return a value.

task_switch

XuAPI
pub fn task_switch(prev $&TaskContext, next &TaskContext)

Purpose

Safe ergonomic context switch wrapper between two task contexts.

Parameters

prev $&TaskContext
prev (exclusive borrow; may modify the original; type $&TaskContext)
next &TaskContext
next (read-only borrow; caller keeps the original; type &TaskContext)

Returns

This call does not return a value.

struct TrapFrame

XuAPI
pub struct TrapFrame {
    pub r15 u64
    pub r14 u64
    pub r13 u64
    pub r12 u64
    pub r11 u64
    pub r10 u64
    pub r9 u64
    pub r8 u64
    pub rbp u64
    pub rdi u64
    pub rsi u64
    pub rdx u64
    pub rcx u64
    pub rbx u64
    pub rax u64
    pub vec u64
    pub error_code u64
    pub rip u64
    pub cs u64
    pub rflags u64
    pub rsp u64
    pub ss u64
}

Purpose

Task Protocol data frame encapsulation.

Public fields

r15 u64
Saved General Purpose Registers (GPRs)
r14 u64
field (u64)
r13 u64
field (u64)
r12 u64
field (u64)
r11 u64
field (u64)
r10 u64
field (u64)
r9 u64
field (u64)
r8 u64
field (u64)
rbp u64
field (u64)
rdi u64
field (u64)
rsi u64
field (u64)
rdx u64
field (u64)
rcx u64
field (u64)
rbx u64
field (u64)
rax u64
field (u64)
vec u64
Interrupt / Exception vector and error code
error_code u64
field (u64)
rip u64
field (u64)
cs u64
field (u64)
rflags u64
field (u64)
rsp u64
field (u64)
ss u64
field (u64)

trap_frame_new

XuAPI
pub fn trap_frame_new() TrapFrame

Purpose

Trap frame new.

Parameters

No arguments are required.

Returns

TrapFrame — a value of this type

struct Arm64TrapFrame

XuAPI
pub struct Arm64TrapFrame {
    pub x0 u64
    pub x1 u64
    pub x2 u64
    pub x3 u64
    pub x4 u64
    pub x5 u64
    pub x6 u64
    pub x7 u64
    pub x8 u64
    pub x9 u64
    pub x10 u64
    pub x11 u64
    pub x12 u64
    pub x13 u64
    pub x14 u64
    pub x15 u64
    pub x16 u64
    pub x17 u64
    pub x18 u64
    pub x19 u64
    pub x20 u64
    pub x21 u64
    pub x22 u64
    pub x23 u64
    pub x24 u64
    pub x25 u64
    pub x26 u64
    pub x27 u64
    pub x28 u64
    pub x29 u64
    pub x30 u64
    pub sp_el0 u64
    pub elr_el1 u64
    pub spsr_el1 u64
    pub esr_el1 u64
    pub far_el1 u64
}

Purpose

Task Protocol data frame encapsulation.

Public fields

x0 u64
field (u64)
x1 u64
field (u64)
x2 u64
field (u64)
x3 u64
field (u64)
x4 u64
field (u64)
x5 u64
field (u64)
x6 u64
field (u64)
x7 u64
field (u64)
x8 u64
field (u64)
x9 u64
field (u64)
x10 u64
field (u64)
x11 u64
field (u64)
x12 u64
field (u64)
x13 u64
field (u64)
x14 u64
field (u64)
x15 u64
field (u64)
x16 u64
field (u64)
x17 u64
field (u64)
x18 u64
field (u64)
x19 u64
field (u64)
x20 u64
field (u64)
x21 u64
field (u64)
x22 u64
field (u64)
x23 u64
field (u64)
x24 u64
field (u64)
x25 u64
field (u64)
x26 u64
field (u64)
x27 u64
field (u64)
x28 u64
field (u64)
x29 u64
field (u64)
x30 u64
field (u64)
sp_el0 u64
field (u64)
elr_el1 u64
field (u64)
spsr_el1 u64
field (u64)
esr_el1 u64
field (u64)
far_el1 u64
field (u64)

arm64_trap_frame_new

XuAPI
pub fn arm64_trap_frame_new() Arm64TrapFrame

Purpose

Arm64 trap frame new.

Parameters

No arguments are required.

Returns

Arm64TrapFrame — a value of this type

struct Rv64TrapFrame

XuAPI
pub struct Rv64TrapFrame {
    pub x1 u64
    pub x2 u64
    pub x3 u64
    pub x4 u64
    pub x5 u64
    pub x6 u64
    pub x7 u64
    pub x8 u64
    pub x9 u64
    pub x10 u64
    pub x11 u64
    pub x12 u64
    pub x13 u64
    pub x14 u64
    pub x15 u64
    pub x16 u64
    pub x17 u64
    pub x18 u64
    pub x19 u64
    pub x20 u64
    pub x21 u64
    pub x22 u64
    pub x23 u64
    pub x24 u64
    pub x25 u64
    pub x26 u64
    pub x27 u64
    pub x28 u64
    pub x29 u64
    pub x30 u64
    pub x31 u64
    pub sepc u64
    pub sstatus u64
    pub scause u64
    pub stval u64
    pub pad u64
}

Purpose

Task Protocol data frame encapsulation.

Public fields

x1 u64
field (u64)
x2 u64
field (u64)
x3 u64
field (u64)
x4 u64
field (u64)
x5 u64
field (u64)
x6 u64
field (u64)
x7 u64
field (u64)
x8 u64
field (u64)
x9 u64
field (u64)
x10 u64
field (u64)
x11 u64
field (u64)
x12 u64
field (u64)
x13 u64
field (u64)
x14 u64
field (u64)
x15 u64
field (u64)
x16 u64
field (u64)
x17 u64
field (u64)
x18 u64
field (u64)
x19 u64
field (u64)
x20 u64
field (u64)
x21 u64
field (u64)
x22 u64
field (u64)
x23 u64
field (u64)
x24 u64
field (u64)
x25 u64
field (u64)
x26 u64
field (u64)
x27 u64
field (u64)
x28 u64
field (u64)
x29 u64
field (u64)
x30 u64
field (u64)
x31 u64
field (u64)
sepc u64
field (u64)
sstatus u64
field (u64)
scause u64
field (u64)
stval u64
field (u64)
pad u64
field (u64)

rv64_trap_frame_new

XuAPI
pub fn rv64_trap_frame_new() Rv64TrapFrame

Purpose

Rv64 trap frame new.

Parameters

No arguments are required.

Returns

Rv64TrapFrame — a value of this type