在linux中切换arm32的汇编是这样的:你可以看到没有cpsr reigister备份,比较其他arch,如mips或riscv,其对应的mstatus和status寄存器都是_switch_to期间的备份和恢复,所以,为什么会有差异?
12948 8010d328 <__switch_to>:
12949 8010d328: e281c018 add ip, r1, #24
12950 8010d32c: e8ac6ff0 stmia ip!, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr}
12951 8010d330: e592405c ldr r4, [r2, #92] ; 0x5c
12952 8010d334: e5925060 ldr r5, [r2, #96] ; 0x60
12953 8010d338: ee1d7f50 mrc 15, 0, r7, cr13, cr0, {2}
12954 8010d33c: ee0d4f70 mcr 15, 0, r4, cr13, cr0, {3}
12955 8010d340: ee0d5f50 mcr 15, 0, r5, cr13, cr0, {2}
12956 8010d344: e5817060 str r7, [r1, #96] ; 0x60
12957 8010d348: e1a05000 mov r5, r0
12958 8010d34c: e2824018 add r4, r2, #24
12959 8010d350: e59f000c ldr r0, [pc, #12] ; 8010d364 <__switch_to+0x3c>
12960 8010d354: e3a01002 mov r1, #2
12961 8010d358: eb00c813 bl 8013f3ac <atomic_notifier_call_chain>
12962 8010d35c: e1a00005 mov r0, r5
12963 8010d360: e894aff0 ldm r4, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}
12964 8010d364: 80b61200 .word 0x80b61200
12965 8010d368: e58d403c str r4, [sp, #60] ; 0x3c
12966 8010d36c: e1a0f009 mov pc, r9