AnsweredAssumed Answered

Question about ucos III for MPC5748G

Question asked by ly K on Oct 28, 2017

Hello :

      I have a question about code of ucos iii for MPC5748G.

      I don't know how to save the sp pointer of current task when task switch,the code as below:

      when task switch happen,this code is always called first. It will save the current state of CPU


prologue: .macro
mtspr VRSAVE,r11
stwux r1,r1,r11                          
mfspr r11,VRSAVE

e_stw r0,XR0(r1)
e_stw r2,XR2(r1)
e_stw r3,XR3(r1)
e_stw r4,XR4(r1)
e_stw r5,XR5(r1)
e_stw r6,XR6(r1)
e_stw r7,XR7(r1)
e_stw r8,XR8(r1)
e_stw r9,XR9(r1)
e_stw r10,XR10(r1)
e_stw r11,XR11(r1)
e_stw r12,XR12(r1)
e_stw r13,XR13(r1)
e_stw r14,XR14(r1)
e_stw r15,XR15(r1)
e_stw r16,XR16(r1)
e_stw r17,XR17(r1)
e_stw r18,XR18(r1)
e_stw r19,XR19(r1)
e_stw r20,XR20(r1)
e_stw r21,XR21(r1)
e_stw r22,XR22(r1)
e_stw r23,XR23(r1)
e_stw r24,XR24(r1)
e_stw r25,XR25(r1)
e_stw r26,XR26(r1)
e_stw r27,XR27(r1)
e_stw r28,XR28(r1)
e_stw r29,XR29(r1)
e_stw r30,XR30(r1)
e_stw r31,XR31(r1)

mfmsr r0
e_stw r0,XMSR(r1)

mfspr r0,SPEFSCR
e_stw r0,XSPEFSCR(r1)

mfspr r0,SRR0
e_stw r0,XSRR0(r1)

mfspr r0,SRR1
e_stw r0,XSRR1(r1)

mflr r0
e_stw r0,XLR(r1)

mfctr r0
e_stw r0,XCTR(r1)

mfxer r0
e_stw r0,XXER(r1)

mfcr r0
e_stw r0,XCR(r1)

mfmsr r0