Merge branch 'hardware' of github.com:betrusted-io/xous-core into hardware

This commit is contained in:
bunnie 2021-03-16 17:03:37 +08:00
commit 5ba5dc0340
3 changed files with 14 additions and 3 deletions

View file

@ -576,7 +576,12 @@ pub fn idle() -> bool {
crate::arch::process::set_current_pid(pid);
let mut process = Process::current();
let mut response_vec = Vec::new();
let mut capacity = 9 * core::mem::size_of::<usize>();
if let Some(mem) = response.memory() {
capacity += mem.len();
}
let mut response_vec = Vec::with_capacity(capacity);
response_vec.extend_from_slice(&thread_id.to_le_bytes());
for word in response.to_args().iter_mut() {
response_vec.extend_from_slice(&word.to_le_bytes());

View file

@ -21,6 +21,7 @@ const USER_AREA_END: usize = 0xff00_0000;
// and therefore are limited to 4 MB.
const EXCEPTION_STACK_TOP: usize = 0xffff_0000;
const KERNEL_LOAD_OFFSET: usize = 0xffd0_0000;
const KERNEL_STACK_PAGE_COUNT: usize = 1;
const KERNEL_ARGUMENT_OFFSET: usize = 0xffc0_0000;
const FLG_VALID: usize = 0x1;
@ -421,7 +422,7 @@ impl ProgramDescription {
allocator.change_owner(pid as XousPid, pt_addr as usize);
// Allocate stack pages.
for i in 0..STACK_PAGE_COUNT {
for i in 0..if is_kernel { KERNEL_STACK_PAGE_COUNT} else { STACK_PAGE_COUNT } {
let sp_page = allocator.alloc() as usize;
allocator.map_page(
satp,

View file

@ -665,7 +665,12 @@ fn _xous_syscall_to(
// );
// Send the packet to the server
let mut pkt = vec![];
let mut capacity = 9 * core::mem::size_of::<usize>();
if let Some(mem) = call.memory() {
capacity += mem.len();
}
let mut pkt = Vec::with_capacity(capacity);
THREAD_ID.with(|tid| pkt.extend_from_slice(&tid.borrow().to_le_bytes()));
for word in &[nr, a1, a2, a3, a4, a5, a6, a7] {
pkt.extend_from_slice(&word.to_le_bytes());