Skip to content
Draft
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
37 changes: 36 additions & 1 deletion .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ jobs:
mips64r5900el-ps2-elf-nm sample/testgdb.elf | grep -q 'gdb_hw_test_word'
mips64r5900el-ps2-elf-nm sample/testgdb.elf | grep -q 'gdb_hw_test_function'
sh tests/check_hw_direct_cache_flush.sh sample/testgdb.elf
sh tests/check_fcsr_assembly.sh ee/gdb-low.o
# The test ELF has two controlled software BREAKs. This does not
# enable the asynchronous receiver or the hardware L2 comparator.
make clean
make PS2GDB_FCSR_DIAG=1 all
mips64r5900el-ps2-elf-nm sample/testgdb.elf | grep -q 'ps2gdb_fcsr_expected'
mips64r5900el-ps2-elf-nm sample/testgdb.elf | grep -q 'ps2gdb_fcsr_after'
sh tests/check_fcsr_assembly.sh ee/gdb-low.o
make clean
make all
! mips64r5900el-ps2-elf-nm sample/testgdb.elf | grep -q 'ps2gdb_fcsr_expected'

preemptive-context-probe-build:
name: EE preemptive context observation (compile-only)
Expand All @@ -66,25 +77,49 @@ jobs:
- uses: actions/checkout@v4
- name: Install build requirements
run: apk add build-base git
- name: Build VBlank context and branch-delay probes, never execute in CI
- name: Build VBlank context, branch-delay and owner-observation probes; never execute
run: |
make preemptive-probe-build
mips64r5900el-ps2-elf-nm tests/preemptive/ee_interrupt_context_probe.elf | grep -q 'ps2gdb_probe_busy_begin'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_interrupt_context_probe.elf | grep -q 'ps2gdb_probe_busy_end'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_branch_delay_probe.elf | grep -q 'ps2gdb_branch_loop_dec'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_branch_delay_probe.elf | grep -q 'ps2gdb_branch_loop_branch'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_branch_delay_probe.elf | grep -q 'ps2gdb_branch_loop_delay'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_thread_owner_probe.elf | grep -q 'ps2gdb_owner_busy_begin'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_thread_owner_probe.elf | grep -q 'ps2gdb_owner_busy_end'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_receiver_schedule_probe.elf | grep -q 'ps2gdb_sched_busy_begin'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_receiver_schedule_probe.elf | grep -q 'ps2gdb_sched_busy_end'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_thread_suspend_probe.elf | grep -q 'ps2gdb_suspend_loop_begin'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_thread_suspend_probe.elf | grep -q 'ResumeThread'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_context_candidate.o | grep -q 'ee_context_candidate_only'
mips64r5900el-ps2-elf-nm tests/preemptive/ee_stop_policy_compile_only.o | grep -q 'ps2gdb_stop_policy_compile_only'
mips64r5900el-ps2-elf-objdump -d tests/preemptive/ee_context_candidate.o > /tmp/ee_context_candidate.dis
test "$(grep -c -E '[[:space:]]sq[[:space:]].*\(k0\)' /tmp/ee_context_candidate.dis)" -eq 32
grep -q 'sq[[:space:]]*ra,496(k0)' /tmp/ee_context_candidate.dis
! mips64r5900el-ps2-elf-nm tests/preemptive/ee_interrupt_context_probe.elf | grep -q 'ee_context_candidate_only'
! mips64r5900el-ps2-elf-nm tests/preemptive/ee_branch_delay_probe.elf | grep -q 'ee_context_candidate_only'
! mips64r5900el-ps2-elf-nm tests/preemptive/ee_interrupt_context_probe.elf | grep -q 'ps2gdb_stop_policy_compile_only'
! mips64r5900el-ps2-elf-nm tests/preemptive/ee_branch_delay_probe.elf | grep -q 'ps2gdb_stop_policy_compile_only'
! mips64r5900el-ps2-elf-nm tests/preemptive/ee_thread_owner_probe.elf | grep -q 'ps2gdb_stop_policy_compile_only'
! mips64r5900el-ps2-elf-nm tests/preemptive/ee_receiver_schedule_probe.elf | grep -q 'ps2gdb_stop_policy_compile_only'
! mips64r5900el-ps2-elf-nm tests/preemptive/ee_thread_suspend_probe.elf | grep -q 'ps2gdb_stop_policy_compile_only'
# The alternative scheduling probe is a separate opt-in build;
# compile it without running it or touching a live debug target.
make -C tests/preemptive clean
make -C tests/preemptive PS2GDB_SCHED_TARGET_PRIORITY=2 ee_receiver_schedule_probe.elf
mips64r5900el-ps2-elf-nm tests/preemptive/ee_receiver_schedule_probe.elf | grep -q 'ChangeThreadPriority'
make -C tests/preemptive clean
make -C tests/preemptive PS2GDB_SCHED_OBSERVER_PRIORITY=0 ee_receiver_schedule_probe.elf
mips64r5900el-ps2-elf-nm tests/preemptive/ee_receiver_schedule_probe.elf | grep -q 'ReferThreadStatus'
# The standalone probes must be cleaned by the root clean target.
make -C tests/preemptive clean
test ! -e tests/preemptive/ee_interrupt_context_probe.elf
test ! -e tests/preemptive/ee_branch_delay_probe.elf
test ! -e tests/preemptive/ee_context_candidate.o
test ! -e tests/preemptive/ee_thread_owner_probe.elf
test ! -e tests/preemptive/ee_receiver_schedule_probe.elf
test ! -e tests/preemptive/ee_thread_suspend_probe.elf
test ! -e tests/preemptive/ee_stop_policy_compile_only.o

cooperative-ctrlc-build:
name: EE cooperative Ctrl-C compile-only
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Native C regression executables
tests/r5900_rsp_test
tests/registers_test
tests/ee_stop_state_test
tests/ee_thread_owner_observation_test
tests/mock_rsp_server
tests/rsp_protocol_test
tests/hw_breakpoint_state_test
Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ all:
$(MAKE) -C ee
$(MAKE) -C sample

check: tests/r5900_rsp_test tests/registers_test tests/ee_context_candidate_test tests/ee_bootstrap_vector_audit tests/mock_rsp_server tests/rsp_protocol_test tests/hw_breakpoint_state_test tests/ctrlc_rsp_client tests/ctrlc_receiver_state_test tests/ctrlc_receiver_transport_test
check: tests/r5900_rsp_test tests/registers_test tests/ee_context_candidate_test tests/ee_stop_state_test tests/ee_thread_owner_observation_test tests/ee_bootstrap_vector_audit tests/mock_rsp_server tests/rsp_protocol_test tests/hw_breakpoint_state_test tests/ctrlc_rsp_client tests/ctrlc_receiver_state_test tests/ctrlc_receiver_transport_test
./tests/r5900_rsp_test
./tests/registers_test
./tests/ee_context_candidate_test
./tests/ee_stop_state_test
./tests/ee_thread_owner_observation_test
./tests/ee_bootstrap_vector_audit --self-test
./tests/hw_breakpoint_state_test
./tests/ctrlc_receiver_state_test
Expand Down Expand Up @@ -63,6 +65,12 @@ tests/registers_test: tests/registers_test.c ee/r5900-registers.h ee/r5900-rsp.h
tests/ee_context_candidate_test: tests/ee_context_candidate_test.c tests/preemptive/ee_context_candidate.h ee/gdb-stub.h
$(HOST_CC) $(HOST_CFLAGS) $< -o $@

tests/ee_stop_state_test: tests/ee_stop_state_test.c tests/preemptive/ee_stop_state.h tests/preemptive/ee_context_candidate.h
$(HOST_CC) $(HOST_CFLAGS) $< -o $@

tests/ee_thread_owner_observation_test: tests/ee_thread_owner_observation_test.c tests/preemptive/ee_thread_owner_observation.h
$(HOST_CC) $(HOST_CFLAGS) $< -o $@

tests/ee_bootstrap_vector_audit: tests/ee_bootstrap_vector_audit.c
$(HOST_CC) $(HOST_CFLAGS) $< -o $@

Expand All @@ -86,4 +94,4 @@ clean:
$(MAKE) -C ee clean
$(MAKE) -C sample clean
$(MAKE) -C tests/preemptive clean
rm -f tests/r5900_rsp_test tests/registers_test tests/ee_context_candidate_test tests/ee_bootstrap_vector_audit tests/mock_rsp_server tests/rsp_protocol_test tests/hw_breakpoint_state_test tests/ctrlc_rsp_client tests/ctrlc_receiver_state_test tests/ctrlc_receiver_transport_test
rm -f tests/r5900_rsp_test tests/registers_test tests/ee_context_candidate_test tests/ee_stop_state_test tests/ee_thread_owner_observation_test tests/ee_bootstrap_vector_audit tests/mock_rsp_server tests/rsp_protocol_test tests/hw_breakpoint_state_test tests/ctrlc_rsp_client tests/ctrlc_receiver_state_test tests/ctrlc_receiver_transport_test
21 changes: 21 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,27 @@ PS2Link remained responsive to host pings after both sessions. These
smoke tests do not establish preemptive interruption or comprehensive
stepping/breakpoint coverage in arbitrary applications.

COP1 FCSR capture and resume:
The EE exception stub saves FCSR/FIR with CFC1 and restores FCSR with
CTC1 after restoring FPRs and ACC. This is part of the normal build;
there is no experimental runtime switch.

A separate opt-in sample can verify the behavior without an L2 hardware
comparator or asynchronous Ctrl-C receiver:
make clean
make PS2GDB_FCSR_DIAG=1 all
sh tests/check_fcsr_assembly.sh ee/gdb-low.o
mips64r5900el-ps2-elf-nm sample/testgdb.elf | grep ps2gdb_fcsr_

After loading that sample with PS2Link in a fresh EE user-thread slot,
connect GNU GDB and continue to the first software BREAK. Inspect FCSR
with 'maintenance packet p46' and compare its low 32 bits with
ps2gdb_fcsr_expected; continue to the second BREAK and compare
ps2gdb_fcsr_after. The sample prints PS2GDB_FCSR_DIAG status=0 when
both values match, and restores its original control value afterward.
If CU1 is disabled, the diagnostic skips its stops and logs that fact.
This test must be run manually: CI only compiles and audits it.

CI validation (no physical PS2 required):
make clean all check check-gdb check-install
make clean debug
Expand Down
Loading
Loading