Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1a2de4a
fs: fix inline ext4 extent lookup
a6d9a6m Jun 24, 2026
5dee549
fs: harden ext4 write allocation
a6d9a6m Jun 24, 2026
66a60e3
tests: cover ext4 extended writes
a6d9a6m Jun 24, 2026
e53f0ce
syscall: avoid futex panic after address-space teardown
a6d9a6m Jun 24, 2026
92bd179
syscall: fix riscv clone tls argument order
a6d9a6m Jun 24, 2026
795fb53
syscall: quiet non-tty terminal ioctls
a6d9a6m Jun 24, 2026
e6e1bd8
syscall: ignore deprecated clone detached flag
a6d9a6m Jun 24, 2026
548a33a
fs: cache ext4 regular file reads
a6d9a6m Jun 24, 2026
d55bdaa
fs: cache ext4 directory lookups
a6d9a6m Jun 24, 2026
faeb301
Merge remote-tracking branch 'origin/main' into ccy-dev02
a6d9a6m Jun 24, 2026
e58dc55
signal: support musl pthread cancellation
a6d9a6m Jun 24, 2026
ec569a7
docs: stop tracking local bug record
a6d9a6m Jun 24, 2026
9bc91f2
fix(task): exit group from thread leader
a6d9a6m Jun 24, 2026
c760cad
fix(signal): terminate thread group via leader
a6d9a6m Jun 24, 2026
4649eb9
fix(signal): schedule after default termination
a6d9a6m Jun 24, 2026
041508e
test: stage non-ltp musl tests on tmpfs
a6d9a6m Jun 24, 2026
e0da6b5
fix(sched): implement scheduler syscalls
a6d9a6m Jun 24, 2026
3d06d2f
Merge branch 'ccy-dev02' into fix-rv-cyclictest-iozone
a6d9a6m Jun 24, 2026
49a868c
fix(sched): honor affinity and realtime priority
a6d9a6m Jun 24, 2026
a76240b
fix(ipc): implement sysv shared memory
a6d9a6m Jun 24, 2026
d13d572
fix(fs): treat mkdir root as existing
a6d9a6m Jun 24, 2026
db3e24f
fix(vfs): preserve mounted root paths
a6d9a6m Jun 24, 2026
e9890ac
fix(ipc): refine sysv shm removal semantics
a6d9a6m Jun 24, 2026
9a7f7f0
fix(time): wire clock_nanosleep syscall
a6d9a6m Jun 24, 2026
972f0ce
fix(fs): create /dev/shm for posix shm
a6d9a6m Jun 24, 2026
2b4b3a4
fix select timeout fdset semantics
a6d9a6m Jun 24, 2026
3bc8873
add musl loader symlinks for ltp
a6d9a6m Jun 24, 2026
f86dc11
Merge branch 'feat/rv-cyclictest-iozone' into ccy-dev02
a6d9a6m Jun 25, 2026
9bf2b76
调整作用域
a6d9a6m Jun 25, 2026
4546a17
fix loongarch sigreturn context restore
a6d9a6m Jun 25, 2026
cbf44ee
fix pr review edge cases
a6d9a6m Jun 25, 2026
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ testsuits-for-oskernel/

# Logs
os/loongarch.log

*.log
# Local notes
os/可能的改进.md

# Local agent guidance
**/AGENTS.md

**/CLAUDE.md
# Local planning/refactor notes
docs/
48 changes: 47 additions & 1 deletion data/loongarch_musl/etc/init.d/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ echo "--- Starting Minimal BusyBox System ---"
/bin/mount -t sysfs none /sys
# tmpfs/devtmpfs: 临时文件系统和设备文件
/bin/mount -t tmpfs none /tmp
/bin/mount -t tmpfs none /var/tmp
# /dev: 设备节点
# 说明:即使内核已经提前挂载 /dev,这里再次 mount 也不会影响后续流程;
# 且内核对 mount("/dev") 做了特殊处理:会在挂载 tmpfs 后自动 init_dev() 重建设备节点。
Expand Down Expand Up @@ -95,15 +96,57 @@ mount_official_test_image_if_present() {
return 1
}

stage_musl_tests_to_tmpfs() {
src="/tests/musl"
dst="/tmp/tests/musl"

[ -d "$src" ] || return 1

/bin/rm -rf "$dst"
/bin/mkdir -p "$dst" || return 1

echo "[Tests] staging non-LTP musl tests to $dst"
for entry in "$src"/*; do
[ -e "$entry" ] || continue

base="${entry##*/}"
case "$base" in
ltp|ltp_testcode.sh)
continue
;;
esac

if ! /bin/cp -a "$entry" "$dst/"; then
echo "[Tests] failed to stage $entry"
/bin/rm -rf "$dst"
return 1
fi
done

return 0
}

run_musl_tests_if_present() {
# 官方测试镜像挂载到 /tests 后,当前自动入口只跑 musl 分组;
# glibc 分组保留在测试镜像中,后续需要时直接调整本脚本。
mount_official_test_image_if_present || true
[ -d /tests/musl ] || return 1

staged_musl_dir=""
if stage_musl_tests_to_tmpfs; then
staged_musl_dir="/tmp/tests/musl"
else
echo "[Tests] staging failed; falling back to /tests/musl"
fi

ran=0
echo "[Tests] detected whitelisted musl test scripts; running in rcS"
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/tests/musl"
if [ -n "$staged_musl_dir" ]; then
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$staged_musl_dir:/tests/musl"
else
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/tests/musl"
fi
export TMPDIR="/tmp"
export HOME="/"

for name in \
Expand All @@ -113,6 +156,9 @@ run_musl_tests_if_present() {
iperf_testcode.sh
do
f="/tests/musl/$name"
if [ -n "$staged_musl_dir" ] && [ "$name" != "ltp_testcode.sh" ] && [ -f "$staged_musl_dir/$name" ]; then
f="$staged_musl_dir/$name"
fi
[ -f "$f" ] || continue

dir="${f%/*}"
Expand Down
2 changes: 2 additions & 0 deletions data/loongarch_musl/symlinks.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ bin/usleep busybox
bin/vi busybox
bin/watch busybox
bin/zcat busybox
lib/libc.so /tests/musl/lib/libc.so
lib64/ld-musl-loongarch-lp64d.so.1 ../lib/libc.so
linuxrc bin/busybox
sbin/acpid ../bin/busybox
sbin/adjtimex ../bin/busybox
Expand Down
1 change: 1 addition & 0 deletions data/loongarch_musl/var/tmp/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

68 changes: 63 additions & 5 deletions data/risc-v_musl/etc/init.d/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ echo "--- Starting Minimal BusyBox System ---"
/bin/mount -t sysfs none /sys
# tmpfs/devtmpfs: 临时文件系统和设备文件
/bin/mount -t tmpfs none /tmp
/bin/mount -t tmpfs none /var/tmp
# /dev: 设备节点
# 说明:即使内核已经提前挂载 /dev,这里再次 mount 也不会影响后续流程;
# 且内核对 mount("/dev") 做了特殊处理:会在挂载 tmpfs 后自动 init_dev() 重建设备节点。
Expand Down Expand Up @@ -95,23 +96,76 @@ mount_official_test_image_if_present() {
return 1
}

stage_musl_tests_to_tmpfs() {
src="/tests/musl"
dst="/tmp/tests/musl"

[ -d "$src" ] || return 1

/bin/rm -rf "$dst"
/bin/mkdir -p "$dst" || return 1

echo "[Tests] staging non-LTP musl tests to $dst"
for entry in "$src"/*; do
[ -e "$entry" ] || continue

base="${entry##*/}"
case "$base" in
ltp|ltp_testcode.sh)
continue
;;
esac

if ! /bin/cp -a "$entry" "$dst/"; then
echo "[Tests] failed to stage $entry"
/bin/rm -rf "$dst"
return 1
fi
done

return 0
}

run_musl_tests_if_present() {
# 官方测试镜像挂载到 /tests 后,自动扫描并运行 musl 下的全部测试脚本;
# glibc 分组保留在测试镜像中,后续需要时直接调整本脚本。
mount_official_test_image_if_present || true
[ -d /tests/musl ] || return 1

staged_musl_dir=""
if stage_musl_tests_to_tmpfs; then
staged_musl_dir="/tmp/tests/musl"
else
echo "[Tests] staging failed; falling back to /tests/musl"
fi

ran=0
echo "[Tests] detected musl test scripts; running directly from /tests in rcS"
echo "[Tests] detected musl test scripts; running in rcS"

export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/tests/musl"
if [ -n "$staged_musl_dir" ]; then
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$staged_musl_dir:/tests/musl"
else
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/tests/musl"
fi
export TMPDIR="/tmp"
export HOME="/"

for f in /tests/musl/*_testcode.sh; do
[ -f "$f" ] || continue
for src_f in /tests/musl/*_testcode.sh; do
[ -f "$src_f" ] || continue

base="${src_f##*/}"
case "$base" in
unixbench_testcode.sh|lmbench_testcode.sh|libcbench_testcode.sh|libctest_testcode.sh)
echo "[Tests] skipping already-validated $src_f"
continue
;;
esac

f="$src_f"
if [ -n "$staged_musl_dir" ] && [ "$base" != "ltp_testcode.sh" ] && [ -f "$staged_musl_dir/$base" ]; then
f="$staged_musl_dir/$base"
fi
dir="${f%/*}"
base="${f##*/}"
echo "[Tests] running $f"
(
cd "$dir" || exit 1
Expand All @@ -120,6 +174,10 @@ run_musl_tests_if_present() {
)
rc=$?
echo "[Tests] finished $f (rc=$rc)"
case "$rc" in
0) ;;
*) echo "[Tests] ignoring failure from $f and continuing" ;;
esac
ran=1
done
[ "$ran" -eq 1 ] || return 1
Expand Down
1 change: 1 addition & 0 deletions data/risc-v_musl/symlinks.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ bin/vi busybox
bin/watch busybox
bin/zcat busybox
lib/ld-musl-riscv64-sf.so.1 libc.so
lib/ld-musl-riscv64.so.1 libc.so
linuxrc bin/busybox
sbin/acpid ../bin/busybox
sbin/adjtimex ../bin/busybox
Expand Down
1 change: 1 addition & 0 deletions data/risc-v_musl/var/tmp/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

76 changes: 0 additions & 76 deletions docs/os-myself/big-bug-record.md

This file was deleted.

1 change: 1 addition & 0 deletions os/src/arch/loongarch/trap/sigreturn.S
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
__sigreturn_trampoline:
li.w $a7, 139 # __NR_rt_sigreturn
syscall 0
break 0 # rt_sigreturn must not return

.globl __sigreturn_trampoline_end
__sigreturn_trampoline_end:
6 changes: 4 additions & 2 deletions os/src/arch/loongarch/trap/trap_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ impl TrapFrame {
/// 将 TrapFrame 转换为 MContextT
pub fn to_mcontext(&self) -> MContextT {
let mut gregs = [0u64; 32];
for i in 0..32 {
gregs[0] = self.era as u64;
for i in 1..32 {
gregs[i] = self.regs[i] as u64;
}
MContextT {
Expand All @@ -255,7 +256,8 @@ impl TrapFrame {

/// 从 MContextT 恢复 TrapFrame
pub fn restore_from_mcontext(&mut self, mcontext: &MContextT) {
for i in 0..32 {
self.era = mcontext.gregs[0] as usize;
for i in 1..32 {
self.regs[i] = mcontext.gregs[i] as usize;
}
self.fregs.copy_from_slice(&mcontext.fpregs[..32]);
Expand Down
7 changes: 7 additions & 0 deletions os/src/arch/loongarch/trap/trap_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ fn handle_interrupt(estat: usize) {
}

fn user_panic(estat: usize, era: usize, trap_frame: &TrapFrame) {
let ecode = (estat >> 16) & 0x3f;
let badv: usize;
let badi: usize;
unsafe {
Expand All @@ -268,9 +269,15 @@ fn user_panic(estat: usize, era: usize, trap_frame: &TrapFrame) {
emergency_println!(" UNEXPECTED TRAP IN USER MODE (PLV>0)");
emergency_println!("===============================================");
emergency_println!("estat: {:#x}", estat);
emergency_println!("ecode: {:#x}", ecode);
emergency_println!("era : {:#x}", era);
emergency_println!("badv : {:#x}", badv);
emergency_println!("badi : {:#x}", badi);
emergency_println!(
"a7/sp: {:#x}/{:#x}",
trap_frame.regs[11],
trap_frame.regs[3]
);
emergency_println!("regs : {:#x?}", trap_frame.regs);
panic!(
"Unexpected trap in user mode: estat={:#x}, era={:#x}, badv={:#x}, badi={:#x}",
Expand Down
Loading
Loading