Files
ThreadX4TGFS/test/smp/vp_smp_context_fp.S
T
alex 054251f810 Test upstream RISC-V SMP candidates on HERE VP
Build the SMP library and Moonlight board support against a selectable ThreadX source tree. Keep the pinned regression matrix and add RV32GC and RV64GC context tests. Adapt the direct timeout fixture to the RV64 timer extension and give timing-sensitive cases more phase coverage on HERE VP.
2026-11-27 11:13:06 +01:00

102 lines
2.0 KiB
ArmAsm

/* SPDX-License-Identifier: MIT */
.section .text
.balign 4
.global vp_fp_context_sleep
.type vp_fp_context_sleep, @function
vp_fp_context_sleep:
li a1, 0
j .Lcheck_context
.global vp_fp_context_migrate
.type vp_fp_context_migrate, @function
vp_fp_context_migrate:
li a1, 1
.Lcheck_context:
addi sp, sp, -48
#if __riscv_xlen == 64
sd ra, 40(sp)
#else
sw ra, 40(sp)
#endif
fsd fs0, 16(sp)
fsd fs11, 24(sp)
frcsr t0
sw t0, 32(sp)
la t0, .Lpatterns
fld fs0, 0(t0)
fld fs11, 8(t0)
fld ft0, 16(t0)
fld ft11, 24(t0)
li t0, 0x65
fscsr t0
bnez a1, .Linterrupt_switch
li a0, 2
call _tx_thread_sleep
bnez a0, .Lreturn
j .Lcheck_preserved
.Linterrupt_switch:
fence rw, w
sw a1, 0(a0)
.Lwait_for_migration:
csrr t0, mhartid
li t1, 2
bne t0, t1, .Lwait_for_migration
fsd ft0, 0(sp)
fsd ft11, 8(sp)
la t0, .Lpatterns
addi t0, t0, 16
mv t1, sp
li t2, 4
jal t3, .Lcompare_words
.Lcheck_preserved:
frcsr t0
li t1, 0x65
bne t0, t1, .Lbad_context
fsd fs0, 0(sp)
fsd fs11, 8(sp)
la t0, .Lpatterns
mv t1, sp
li t2, 4
jal t3, .Lcompare_words
li a0, 0
j .Lreturn
.Lcompare_words:
lw t4, 0(t0)
lw t5, 0(t1)
bne t4, t5, .Lbad_context
addi t0, t0, 4
addi t1, t1, 4
addi t2, t2, -1
bnez t2, .Lcompare_words
jr t3
.Lbad_context:
li a0, 1
.Lreturn:
fld fs0, 16(sp)
fld fs11, 24(sp)
lw t0, 32(sp)
fscsr t0
#if __riscv_xlen == 64
ld ra, 40(sp)
#else
lw ra, 40(sp)
#endif
addi sp, sp, 48
ret
.section .rodata
.balign 8
.Lpatterns:
.dword 0x3ff0123456789abc, 0x40023456789abcde
.dword 0x401456789abcdef0, 0x4026789abcdef012