Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit 14dc0ee

Browse files
author
cyh21
committed
merge main to cyh-dev 0407
2 parents d16b7c6 + 4c70ea5 commit 14dc0ee

File tree

9 files changed

+45
-11
lines changed

9 files changed

+45
-11
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/.vscode
22
/.arceos
33
/.cargo
4+
/.idea
45
.DS_Store
56
*.elf
67
*.bin
78
apps/*/build/
89
**/target/
910
**/Cargo.lock
1011
!/vendor/**/Cargo.lock
11-
/.axconfig.*
12+
/.axconfig.*
13+
*.img

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ make ARCH=x86_64 LOG=info AX_TESTCASE=nimbos run
141141

142142
Note: Arguments like `NET`, `BLK`, and `GRAPHIC` enable devices in QEMU, which take effect only at runtime, not at build time. More features can be found in the [Cargo.toml of arceos](https://github.com/oscomp/arceos/blob/main/ulib/axstd/Cargo.toml).
143143

144+
#### Development with Visual Studio Code
145+
146+
Since ArceOS relies on special build scripts and some environment variables, this usually causes `rust-analyzer` to prompt some annoying errors. You may want to put the following configuration into `.vscode/settings.json` (ie workspace settings):
147+
```json
148+
{
149+
"rust-analyzer.cargo.extraEnv": {
150+
"AX_CONFIG_PATH": "${workspaceFolder}/.axconfig.toml"
151+
}
152+
}
153+
```
154+
144155
## Test for oscomp testcases
145156

146157
We can run [testcases of the OS competition](https://github.com/oscomp/testsuits-for-oskernel/tree/pre-2025) with StarryOS. Guidence can be found in [Starry-Tutorial](https://azure-stars.github.io/Starry-Tutorial-Book/ch03-02.html).

apps/nimbos/c/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0)
1+
cmake_minimum_required(VERSION 3.5)
22

33
project(nimbos_user)
44
enable_language(C ASM)

apps/oscomp/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
testcase_list
2+
*.out

apps/oscomp/judge_libctest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
========== END entry-static.exe qsort ==========
1212
"""
1313

14+
bypass_testkey = [
15+
"libctest static fpclassify_invalid_ld80",
16+
"libctest dynamic fpclassify_invalid_ld80",
17+
"libctest dynamic dlopen",
18+
"libctest dynamic tls_get_new_dtv",
19+
]
20+
1421
def parse_libctest(output):
1522
ans = {}
1623
key = ""
@@ -20,7 +27,10 @@ def parse_libctest(output):
2027
key = "libctest static " + line.split(" ")[3]
2128
elif "START entry-dynamic.exe" in line:
2229
key = "libctest dynamic " + line.split(" ")[3]
23-
if (line == "Pass!") and key != "":
30+
if key in bypass_testkey:
31+
ans[key] = 1
32+
continue
33+
if line == "Pass!" and key != "":
2434
ans[key] = 1
2535
return ans
2636

apps/oscomp/testcase_list

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
1+
/musl/runtest.exe -w entry-static.exe argv
2+
/musl/runtest.exe -w entry-static.exe qsort

core/src/task.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ impl TaskExt {
9797
let kstack_top = curr.kernel_stack_top().unwrap();
9898
info!(
9999
"Enter user space: entry={:#x}, ustack={:#x}, kstack={:#x}",
100-
curr.task_ext().uctx.get_ip(),
101-
curr.task_ext().uctx.get_sp(),
100+
curr.task_ext().uctx.ip(),
101+
curr.task_ext().uctx.sp(),
102102
kstack_top,
103103
);
104104
unsafe { curr.task_ext().uctx.enter_uspace(kstack_top) };
@@ -117,6 +117,10 @@ impl TaskExt {
117117
new_task
118118
.ctx_mut()
119119
.set_page_table_root(new_aspace.page_table_root());
120+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
121+
new_task
122+
.ctx_mut()
123+
.set_tls(axhal::arch::read_thread_pointer().into());
120124

121125
let trap_frame = read_trapframe_from_kstack(current_task.get_kernel_stack_top().unwrap());
122126
let mut new_uctx = UspaceContext::from(&trap_frame);
@@ -126,7 +130,11 @@ impl TaskExt {
126130
}
127131
// Skip current instruction
128132
#[cfg(any(target_arch = "riscv64", target_arch = "loongarch64"))]
129-
new_uctx.set_ip(new_uctx.get_ip() + 4);
133+
{
134+
let new_uctx_ip = new_uctx.ip();
135+
new_uctx.set_ip(new_uctx_ip + 4);
136+
}
137+
130138
new_uctx.set_retval(0);
131139
let return_id: u64 = new_task.id().as_u64();
132140
let new_task_ext = TaskExt::new(
@@ -265,8 +273,8 @@ pub fn spawn_user_task(
265273
let kstack_top = curr.kernel_stack_top().unwrap();
266274
info!(
267275
"Enter user space: entry={:#x}, ustack={:#x}, kstack={:#x}",
268-
curr.task_ext().uctx.get_ip(),
269-
curr.task_ext().uctx.get_sp(),
276+
curr.task_ext().uctx.ip(),
277+
curr.task_ext().uctx.sp(),
270278
kstack_top,
271279
);
272280
unsafe { curr.task_ext().uctx.enter_uspace(kstack_top) };

src/syscall.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use starry_core::task::{time_stat_from_kernel_to_user, time_stat_from_user_to_ke
88
use syscalls::Sysno;
99

1010
#[register_trap_handler(SYSCALL)]
11-
fn handle_syscall(tf: &TrapFrame, syscall_num: usize) -> isize {
11+
fn handle_syscall(tf: &mut TrapFrame, syscall_num: usize) -> isize {
1212
info!("Syscall {:?}", Sysno::from(syscall_num as u32));
1313
time_stat_from_user_to_kernel();
1414
let result: LinuxResult<isize> = match Sysno::from(syscall_num as u32) {

0 commit comments

Comments
 (0)