From 1afeed4d05932f697aa2ff552a0e9c6d24b585cf Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 29 Dec 2007 23:47:22 +0000 Subject: [PATCH] Fix comments and reg frame offsets git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@460 42af7a65-404d-4744-a932-0658087f49c3 --- arch/z80/include/z80/irq.h | 18 ++++++------- arch/z80/src/common/up_head.asm | 27 +++++++++---------- arch/z80/src/common/up_restoreusercontext.asm | 18 ++++++------- arch/z80/src/common/up_saveusercontext.asm | 20 +++++++------- 4 files changed, 41 insertions(+), 42 deletions(-) diff --git a/arch/z80/include/z80/irq.h b/arch/z80/include/z80/irq.h index 059bf04862..a187fd4c34 100644 --- a/arch/z80/include/z80/irq.h +++ b/arch/z80/include/z80/irq.h @@ -60,15 +60,15 @@ * in the TCB to many context switches. */ -#define XCPT_I (0) /* Saved I w/interrupt state in carry */ -#define XCPT_AF (1) /* Saved AF register */ -#define XCPT_BC (2) /* Saved BC register */ -#define XCPT_DE (3) /* Saved DE register */ -#define XCPT_HL (4) /* Saved HL register */ -#define XCPT_IX (5) /* Saved IX register */ -#define XCPT_IY (6) /* Saved IY register */ -#define XCPT_SP (7) /* Offset to SP at time of interrupt */ -#define XCPT_PC (8) /* Offset to PC at time of interrupt */ +#define XCPT_I (0) /* Offset 0: Saved I w/interrupt state in carry */ +#define XCPT_AF (1) /* Offset 1: Saved AF register */ +#define XCPT_BC (2) /* Offset 2: Saved BC register */ +#define XCPT_DE (3) /* Offset 3: Saved DE register */ +#define XCPT_HL (4) /* Offset 4: Saved HL register */ +#define XCPT_IX (5) /* Offset 5: Saved IX register */ +#define XCPT_IY (6) /* Offset 6: Saved IY register */ +#define XCPT_SP (7) /* Offset 7: Offset to SP at time of interrupt */ +#define XCPT_PC (8) /* Offset 8: Offset to PC at time of interrupt */ #define XCPTCONTEXT_REGS (9) #define XCPTCONTEXT_SIZE (2 * XCPTCONTEXT_REGS) diff --git a/arch/z80/src/common/up_head.asm b/arch/z80/src/common/up_head.asm index dad74d4c3c..36a145be7f 100644 --- a/arch/z80/src/common/up_head.asm +++ b/arch/z80/src/common/up_head.asm @@ -42,15 +42,15 @@ ; Register save area layout - XCPT_PC == 0 ; Offset to PC at time of interrupt - XCPT_AF == 2 ; Saved AF register - XCPT_HL == 4 ; Saved HL register - XCPT_SP == 6 ; Offset to SP at time of interrupt - XCPT_IY == 8 ; Saved IY register - XCPT_IX == 10 ; Saved IX register - XCPT_DE == 12 ; Saved DE register - XCPT_BC == 14 ; Saved BC register - XCPT_I == 16 ; Saved I w/interrupt state in carry + XCPT_I == 0 ; Offset 0: Saved I w/interrupt state in carry + XCPT_BC == 2 ; Offset 1: Saved BC register + XCPT_DE == 4 ; Offset 2: Saved DE register + XCPT_IX == 6 ; Offset 3: Saved IX register + XCPT_IY == 8 ; Offset 4: Saved IY register + XCPT_SP == 10 ; Offset 5: Offset to SP at time of interrupt + XCPT_HL == 12 ; Offset 6: Saved HL register + XCPT_AF == 14 ; Offset 7: Saved AF register + XCPT_PC == 16 ; Offset 8: Offset to PC at time of interrupt ; Default stack base (needs to be fixed) @@ -99,7 +99,7 @@ forever: ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) push hl ; Offset 6: HL - ld hl, #-(3*2) ; HL is the value of the stack pointer before + ld hl, #(3*2) ; HL is the value of the stack pointer before add hl, sp ; the interrupt occurred push hl ; Offset 5: Stack pointer push iy ; Offset 4: IY @@ -111,11 +111,10 @@ forever: push af ; Offset 0: I with interrupt state in carry di - ; Call the interrupt decode logic - ; SP points to the beggining of the reg structure + ; Call the interrupt decode logic. SP points to the beggining of the reg structure ld hl, #0 ; Argument is the beginning of the reg structure - add hl, sp - push hl + add hl, sp ; + push hl ; call _up_decodeirq ; Decode the IRQ ; Restore registers. HL points to the beginning of the reg structure to restore diff --git a/arch/z80/src/common/up_restoreusercontext.asm b/arch/z80/src/common/up_restoreusercontext.asm index 86b497426e..1840b260e1 100644 --- a/arch/z80/src/common/up_restoreusercontext.asm +++ b/arch/z80/src/common/up_restoreusercontext.asm @@ -35,15 +35,15 @@ ; Register save area layout - .globl XCPT_I ; Saved I w/interrupt state in carry - .globl XCPT_AF ; Saved AF register - .globl XCPT_BC ; Saved BC register - .globl XCPT_DE ; Saved DE register - .globl XCPT_HL ; Saved HL register - .globl XCPT_IX ; Saved IX register - .globl XCPT_IY ; Saved IY register - .globl XCPT_SP ; Offset to SP at time of interrupt - .globl XCPT_PC ; Offset to PC at time of interrupt + .globl XCPT_I ; Offset 0: Saved I w/interrupt state in carry + .globl XCPT_BC ; Offset 1: Saved BC register + .globl XCPT_DE ; Offset 2: Saved DE register + .globl XCPT_IX ; Offset 3: Saved IX register + .globl XCPT_IY ; Offset 4: Saved IY register + .globl XCPT_SP ; Offset 5: Offset to SP at time of interrupt + .globl XCPT_HL ; Offset 6: Saved HL register + .globl XCPT_AF ; Offset 7: Saved AF register + .globl XCPT_PC ; Offset 8: Offset to PC at time of interrupt ;************************************************************************** ; up_restoreusercontext diff --git a/arch/z80/src/common/up_saveusercontext.asm b/arch/z80/src/common/up_saveusercontext.asm index 707fdd5156..b5c0dbb219 100644 --- a/arch/z80/src/common/up_saveusercontext.asm +++ b/arch/z80/src/common/up_saveusercontext.asm @@ -39,15 +39,15 @@ ; Register save area layout - .globl XCPT_I ; Saved I w/interrupt state in carry - .globl XCPT_AF ; Saved AF register - .globl XCPT_BC ; Saved BC register - .globl XCPT_DE ; Saved DE register - .globl XCPT_HL ; Saved HL register - .globl XCPT_IX ; Saved IX register - .globl XCPT_IY ; Saved IY register - .globl XCPT_SP ; Offset to SP at time of interrupt - .globl XCPT_PC ; Offset to PC at time of interrupt + .globl XCPT_I ; Offset 0: Saved I w/interrupt state in carry + .globl XCPT_BC ; Offset 1: Saved BC register + .globl XCPT_DE ; Offset 2: Saved DE register + .globl XCPT_IX ; Offset 3: Saved IX register + .globl XCPT_IY ; Offset 4: Saved IY register + .globl XCPT_SP ; Offset 5: Offset to SP at time of interrupt + .globl XCPT_HL ; Offset 6: Saved HL register + .globl XCPT_AF ; Offset 7: Saved AF register + .globl XCPT_PC ; Offset 8: Offset to PC at time of interrupt ; Stack frame @@ -56,7 +56,7 @@ FRAME_RET == 4 ; Location of return address on the stack FRAME_REGS == 6 ; Location of reg save area on stack - SP_OFFSET == -6 + SP_OFFSET == 6 ;************************************************************************* ; Name: up_saveusercontext