Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.vscode
/.arceos
/.cargo
/.idea
.DS_Store
*.elf
*.bin
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/nimbos/c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.5)

project(nimbos_user)
enable_language(C ASM)
Expand Down
18 changes: 13 additions & 5 deletions core/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ impl TaskExt {
let kstack_top = curr.kernel_stack_top().unwrap();
info!(
"Enter user space: entry={:#x}, ustack={:#x}, kstack={:#x}",
curr.task_ext().uctx.get_ip(),
curr.task_ext().uctx.get_sp(),
curr.task_ext().uctx.ip(),
curr.task_ext().uctx.sp(),
kstack_top,
);
unsafe { curr.task_ext().uctx.enter_uspace(kstack_top) };
Expand All @@ -110,6 +110,10 @@ impl TaskExt {
new_task
.ctx_mut()
.set_page_table_root(new_aspace.page_table_root());
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
new_task
.ctx_mut()
.set_tls(axhal::arch::read_thread_pointer().into());

let trap_frame = read_trapframe_from_kstack(current_task.get_kernel_stack_top().unwrap());
let mut new_uctx = UspaceContext::from(&trap_frame);
Expand All @@ -118,7 +122,11 @@ impl TaskExt {
}
// Skip current instruction
#[cfg(any(target_arch = "riscv64", target_arch = "loongarch64"))]
new_uctx.set_ip(new_uctx.get_ip() + 4);
{
let new_uctx_ip = new_uctx.ip();
new_uctx.set_ip(new_uctx_ip + 4);
}

new_uctx.set_retval(0);
let return_id: u64 = new_task.id().as_u64();
let new_task_ext = TaskExt::new(
Expand Down Expand Up @@ -248,8 +256,8 @@ pub fn spawn_user_task(
let kstack_top = curr.kernel_stack_top().unwrap();
info!(
"Enter user space: entry={:#x}, ustack={:#x}, kstack={:#x}",
curr.task_ext().uctx.get_ip(),
curr.task_ext().uctx.get_sp(),
curr.task_ext().uctx.ip(),
curr.task_ext().uctx.sp(),
kstack_top,
);
unsafe { curr.task_ext().uctx.enter_uspace(kstack_top) };
Expand Down
Loading