Needs same fixes as for up_head.asm

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@465 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-12-30 21:21:19 +00:00
parent ba851701b2
commit d4e294e617

View File

@ -64,27 +64,33 @@ _up_restoreusercontext:
pop hl ; BC = Address of save structure pop hl ; BC = Address of save structure
ld sp, hl ; SP points to top of storage area ld sp, hl ; SP points to top of storage area
; Disable interrupts while we muck with the alternative registers ; Disable interrupts while we muck with the alternative registers. The
; Correct interrupt state will be restore below
di
; Restore registers. HL points to the beginning of the reg structure to restore ; Restore registers. HL points to the beginning of the reg structure to restore
ex af, af' ; Select alternate AF ex af, af' ; Select alternate AF
pop af ; Offset 0: AF' = I with interrupt state in carry pop af ; Offset 0: AF' = I with interrupt state in carry
ex af, af' ; Restore original AF
pop bc ; Offset 1: BC pop bc ; Offset 1: BC
pop de ; Offset 2: DE pop de ; Offset 2: DE
pop ix ; Offset 3: IX pop ix ; Offset 3: IX
pop iy ; Offset 4: IY pop iy ; Offset 4: IY
exx ; Use alternate BC/DE/HL exx ; Use alternate BC/DE/HL
pop hl ; Offset 5: HL' = Stack pointer at time of interrupt ld hl, #-2 ; Offset of SP to account for ret addr on stack
exx pop de ; Offset 5: HL' = Stack pointer after return
add hl, de ; HL = Stack pointer value before return
exx ; Restore original BC/DE/HL
pop hl ; Offset 6: HL pop hl ; Offset 6: HL
pop af ; Offset 7: AF pop af ; Offset 7: AF
; Restore the stack pointer ; Restore the stack pointer
exx exx ; Use alternate BC/DE/HL
ld sp, hl ld sp, hl ; Set SP = saved stack pointer value before return
exx exx ; Restore original BC/DE/HL
; Restore interrupt state ; Restore interrupt state