123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #include <linux/linkage.h>
- #include <asm/ptrace.h>
- #include <asm/asm-offsets.h>
- #include <arch/spr_def.h>
- #include <asm/processor.h>
- #include <asm/switch_to.h>
- #if CALLEE_SAVED_REGS_COUNT != 24
- # error Mismatch between <asm/switch_to.h> and kernel/entry.S
- #endif
- #define FRAME_SIZE ((2 + CALLEE_SAVED_REGS_COUNT) * 8)
- #define SAVE_REG(r) { st r12, r
- #define LOAD_REG(r) { ld r, r12
- #define FOR_EACH_CALLEE_SAVED_REG(f) \
- f(r30)
- f(r32)
- f(r40)
- f(r48)
- STD_ENTRY_SECTION(__switch_to, .sched.text)
- {
- move r10, sp
- st sp, lr
- }
- {
- addli r11, sp, -FRAME_SIZE + 8
- addli sp, sp, -FRAME_SIZE
- }
- {
- st r11, r10
- addli r4, r1, TASK_STRUCT_THREAD_KSP_OFFSET
- }
- {
- ld r13, r4
- addi r12, sp, 16
- }
- FOR_EACH_CALLEE_SAVED_REG(SAVE_REG)
- addli r3, r0, TASK_STRUCT_THREAD_KSP_OFFSET
- {
- st r3, sp
- addli r3, r0, TASK_STRUCT_THREAD_PC_OFFSET
- }
- {
- st r3, lr
- addli r4, r1, TASK_STRUCT_THREAD_PC_OFFSET
- }
- {
- ld lr, r4
- addi r12, r13, 16
- }
- {
-
- move sp, r13
- mtspr SPR_SYSTEM_SAVE_K_0, r2
- }
- FOR_EACH_CALLEE_SAVED_REG(LOAD_REG)
- .L__switch_to_pc:
- {
- addli sp, sp, FRAME_SIZE
- jrp lr
- }
- STD_ENDPROC(__switch_to)
- STD_ENTRY_SECTION(get_switch_to_pc, .sched.text)
- lnk r0
- {
- addli r0, r0, .L__switch_to_pc - .
- jrp lr
- }
- STD_ENDPROC(get_switch_to_pc)
- STD_ENTRY(get_pt_regs)
- .irp reg, r0, r1, r2, r3, r4, r5, r6, r7, \
- r8, r9, r10, r11, r12, r13, r14, r15, \
- r16, r17, r18, r19, r20, r21, r22, r23, \
- r24, r25, r26, r27, r28, r29, r30, r31, \
- r32, r33, r34, r35, r36, r37, r38, r39, \
- r40, r41, r42, r43, r44, r45, r46, r47, \
- r48, r49, r50, r51, r52, tp, sp
- {
- st r0, \reg
- addi r0, r0, 8
- }
- .endr
- {
- st r0, lr
- addi r0, r0, PTREGS_OFFSET_PC - PTREGS_OFFSET_LR
- }
- lnk r1
- {
- st r0, r1
- addi r0, r0, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC
- }
- mfspr r1, INTERRUPT_CRITICAL_SECTION
- shli r1, r1, SPR_EX_CONTEXT_1_1__ICS_SHIFT
- ori r1, r1, KERNEL_PL
- {
- st r0, r1
- addi r0, r0, PTREGS_OFFSET_FAULTNUM - PTREGS_OFFSET_EX1
- }
- {
- st r0, zero
- addi r0, r0, PTREGS_OFFSET_ORIG_R0 - PTREGS_OFFSET_FAULTNUM
- }
- {
- st r0, zero
- addli r0, r0, -PTREGS_OFFSET_ORIG_R0
- }
- jrp lr
- STD_ENDPROC(get_pt_regs)
|