-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathx86_64.rs
More file actions
186 lines (160 loc) · 4.02 KB
/
x86_64.rs
File metadata and controls
186 lines (160 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// SPDX-FileCopyrightText: 2020 Sean Cross <sean@xobs.io>
// SPDX-License-Identifier: Apache-2.0
use xous::PID;
pub mod irq {
/// Disable external interrupts
pub fn disable_all_irqs() {
unimplemented!();
}
/// Enable external interrupts
pub fn enable_all_irqs() {
unimplemented!();
}
pub fn enable_irq(irq_no: usize) {
unimplemented!();
}
pub fn disable_irq(irq_no: usize) {
unimplemented!();
}
}
pub fn current_pid() -> PID {
unimplemented!();
}
pub fn init() {}
pub mod syscall {
use crate::arch::Context;
pub fn invoke(
context: &mut Context,
supervisor: bool,
pc: usize,
sp: usize,
ret_addr: usize,
args: &[usize],
) -> ! {
unimplemented!();
}
fn set_supervisor(supervisor: bool) {
unimplemented!();
}
pub fn resume(supervisor: bool, context: &Context) -> ! {
unimplemented!();
}
}
pub mod mem {
use crate::mem::MemoryManager;
use xous::{Error, MemoryFlags, PID};
#[derive(Copy, Clone, Default, PartialEq)]
pub struct MemoryMapping {}
impl MemoryMapping {
pub unsafe fn from_raw(&mut self, new: usize) {
unimplemented!();
}
pub fn get_pid(&self) -> PID {
unimplemented!();
}
pub fn current() -> MemoryMapping {
unimplemented!();
}
pub fn activate(&self) {
unimplemented!();
}
pub fn flags_for_address(&self, addr: usize) -> usize {
unimplemented!();
}
pub fn reserve_address(
&mut self,
mm: &mut MemoryManager,
addr: usize,
flags: MemoryFlags,
) -> Result<(), XousError> {
unimplemented!();
}
}
impl core::fmt::Debug for MemoryMapping {
fn fmt(
&self,
fmt: &mut core::fmt::Formatter,
) -> core::result::Result<(), core::fmt::Error> {
write!(fmt, "unimplemented",)
}
}
pub fn map_page_inner(
mm: &mut MemoryManager,
pid: PID,
phys: usize,
virt: usize,
req_flags: MemoryFlags,
) -> Result<(), XousError> {
unimplemented!();
}
pub fn unmap_page_inner(mm: &mut MemoryManager, virt: usize) -> Result<usize, XousError> {
unimplemented!();
}
pub const DEFAULT_MEMORY_MAPPING: MemoryMapping = MemoryMapping {};
pub const DEFAULT_STACK_TOP: usize = 0xffff_0000;
pub const DEFAULT_HEAP_BASE: usize = 0x4000_0000;
pub const DEFAULT_MESSAGE_BASE: usize = 0x8000_0000;
pub const DEFAULT_BASE: usize = 0xc000_0000;
pub const USER_AREA_END: usize = 0xff000000;
pub const PAGE_SIZE: usize = 4096;
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct Context {}
impl Context {
pub fn current() -> &'static mut Context {
unimplemented!();
}
pub fn saved() -> &'static mut Context {
unimplemented!();
}
/// Determine whether a process context is valid.
/// Contexts are valid when the `SATP.VALID` bit is `1`.
pub fn valid(&self) -> bool {
unimplemented!();
}
/// Invalidate a context by setting its `SATP.VALID` bit to 0.
pub fn invalidate(&mut self) {
unimplemented!();
}
pub fn get_stack(&self) -> usize {
unimplemented!();
}
pub fn init(&mut self, entrypoint: usize, stack: usize) {}
}
#[cfg(test)]
#[no_mangle]
pub fn _xous_syscall_rust(
nr: usize,
a1: usize,
a2: usize,
a3: usize,
a4: usize,
a5: usize,
a6: usize,
a7: usize,
ret: &mut xous::Result,
) {
unimplemented!();
}
#[cfg(test)]
#[no_mangle]
fn _xous_syscall(
nr: usize,
a1: usize,
a2: usize,
a3: usize,
a4: usize,
a5: usize,
a6: usize,
a7: usize,
ret: &mut xous::Result,
) {
unimplemented!();
}
pub fn virt_to_phys(virt: usize) -> Result<usize, xous::Result> {
unimplemented!();
}
pub fn address_available(virt: usize) -> bool {
virt_to_phys(virt).is_err()
}