fix(sched): 压缩 _do_switch 注释,规避内联汇编 2047 字节静默截断

llc 报 <inline asm>:55:13 invalid operand + 孤立 mov 的真因:ViperC 的 _asm_append_cstr 只写入 ASM_TEXT_BUF_SIZE-1=2047 字节且静默丢弃后续内容。_do_switch 的 asm 模板(含 CRLF)为 2245 字节,第 2047 字节正好落在 mov [rsi + 40], rcx 的 mov 之后 ⇒ 生成的汇编串以孤立 mov 结尾,popfq/pop/ret 全部丢失。压缩块内 4 条中文注释(模板降到 1894 字节),指令与 clobber 未动。附:sha1_map 第 57 行 3e23dc8764e4a4dd:sched/sched.vp 与报错哈希一致;全仓 16 个含 asm 的 .vp、189 个模板中仅此一处超过 2047 字节。
This commit is contained in:
TermiNexus committed 2026-10-17 17:36:45 +08:00
1 parent 89385d1b42
commit e9d8024138
1 file changed
+4 -4
+4 -4
View File
@@ -336,10 +336,10 @@ def _do_switch():
push r14
push r15
pushfq
# 切栈前保存本线程 SSE/FPU 状态(rax 已压栈,可作暂存;fxsave 不动通用寄存器)
# 切栈前保存 FPU/ISR
mov rax, [rip + _switch_old_fpu]
fxsave [rax]
# 按线程保存 ISR scratch(被抢占的 ISR 会跨越其它线程的 ISR)
# 保存 ISR scratch
lea rsi, [rip + _isr_scratch]
mov eax, dword ptr [rip + _switch_old_tid]
imul rax, rax, 48
@@ -361,10 +361,10 @@ def _do_switch():
mov [rax], rsp
mov rax, [rip + _switch_new_rsp]
mov rsp, [rax]
# 换栈后恢复切入线程的 SSE/FPU 状态(不动通用寄存器;此时 rax 属新栈的保存值)
# 换栈后恢复 FPU/ISR
mov rax, [rip + _switch_new_fpu]
fxrstor [rax]
# 恢复切入线程的 scratch(不在 ISR 中时内容无意义,覆盖无害)
# 恢复 ISR scratch
lea rsi, [rip + _isr_scratch]
mov eax, dword ptr [rip + _switch_new_tid]
imul rax, rax, 48