diff options
author | Keith Owens <kaos@ocs.com.au> | 2006-04-07 04:08:11 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2006-06-21 17:44:26 -0400 |
commit | d270acbc24f0ce451c773c214ac0e92e95396b2f (patch) | |
tree | 46fb1417fd85a4fe477afe391975bc3bc3dec1ab /arch/ia64 | |
parent | b7bb575c3fa3694811a072109f4e9c2f4705d8f5 (diff) |
[IA64] Sanitize assembler code for ia64_sal_os_state
struct ia64_sal_os_state has three semi-independent sections. The code
in mca_asm.S assumes that these three sections are contiguous, which
makes it very awkward to add new data to this structure. Remove the
assumption that the sections are contiguous. Define a macro to shorten
references to offsets in ia64_sal_os_state.
This patch does not change the way that the code behaves. It just
makes it easier to update the code in future and to add fields to
ia64_sal_os_state when debugging the MCA/INIT handlers.
Signed-off-by: Keith Owens <kaos@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/kernel/asm-offsets.c | 16 | ||||
-rw-r--r-- | arch/ia64/kernel/entry.h | 1 | ||||
-rw-r--r-- | arch/ia64/kernel/mca_asm.S | 28 |
3 files changed, 30 insertions, 15 deletions
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c index 77225659e968..16e7b6600ae6 100644 --- a/arch/ia64/kernel/asm-offsets.c +++ b/arch/ia64/kernel/asm-offsets.c | |||
@@ -217,16 +217,24 @@ void foo(void) | |||
217 | DEFINE(IA64_MCA_CPU_INIT_STACK_OFFSET, | 217 | DEFINE(IA64_MCA_CPU_INIT_STACK_OFFSET, |
218 | offsetof (struct ia64_mca_cpu, init_stack)); | 218 | offsetof (struct ia64_mca_cpu, init_stack)); |
219 | BLANK(); | 219 | BLANK(); |
220 | DEFINE(IA64_SAL_OS_STATE_COMMON_OFFSET, | ||
221 | offsetof (struct ia64_sal_os_state, sal_ra)); | ||
222 | DEFINE(IA64_SAL_OS_STATE_OS_GP_OFFSET, | 220 | DEFINE(IA64_SAL_OS_STATE_OS_GP_OFFSET, |
223 | offsetof (struct ia64_sal_os_state, os_gp)); | 221 | offsetof (struct ia64_sal_os_state, os_gp)); |
224 | DEFINE(IA64_SAL_OS_STATE_PAL_MIN_STATE_OFFSET, | ||
225 | offsetof (struct ia64_sal_os_state, pal_min_state)); | ||
226 | DEFINE(IA64_SAL_OS_STATE_PROC_STATE_PARAM_OFFSET, | 222 | DEFINE(IA64_SAL_OS_STATE_PROC_STATE_PARAM_OFFSET, |
227 | offsetof (struct ia64_sal_os_state, proc_state_param)); | 223 | offsetof (struct ia64_sal_os_state, proc_state_param)); |
224 | DEFINE(IA64_SAL_OS_STATE_SAL_RA_OFFSET, | ||
225 | offsetof (struct ia64_sal_os_state, sal_ra)); | ||
226 | DEFINE(IA64_SAL_OS_STATE_SAL_GP_OFFSET, | ||
227 | offsetof (struct ia64_sal_os_state, sal_gp)); | ||
228 | DEFINE(IA64_SAL_OS_STATE_PAL_MIN_STATE_OFFSET, | ||
229 | offsetof (struct ia64_sal_os_state, pal_min_state)); | ||
230 | DEFINE(IA64_SAL_OS_STATE_OS_STATUS_OFFSET, | ||
231 | offsetof (struct ia64_sal_os_state, os_status)); | ||
232 | DEFINE(IA64_SAL_OS_STATE_CONTEXT_OFFSET, | ||
233 | offsetof (struct ia64_sal_os_state, context)); | ||
228 | DEFINE(IA64_SAL_OS_STATE_SIZE, | 234 | DEFINE(IA64_SAL_OS_STATE_SIZE, |
229 | sizeof (struct ia64_sal_os_state)); | 235 | sizeof (struct ia64_sal_os_state)); |
236 | BLANK(); | ||
237 | |||
230 | DEFINE(IA64_PMSA_GR_OFFSET, | 238 | DEFINE(IA64_PMSA_GR_OFFSET, |
231 | offsetof (struct pal_min_state_area_s, pmsa_gr)); | 239 | offsetof (struct pal_min_state_area_s, pmsa_gr)); |
232 | DEFINE(IA64_PMSA_BANK1_GR_OFFSET, | 240 | DEFINE(IA64_PMSA_BANK1_GR_OFFSET, |
diff --git a/arch/ia64/kernel/entry.h b/arch/ia64/kernel/entry.h index 78eeb0793419..ebc3dfb88826 100644 --- a/arch/ia64/kernel/entry.h +++ b/arch/ia64/kernel/entry.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #define PT(f) (IA64_PT_REGS_##f##_OFFSET) | 24 | #define PT(f) (IA64_PT_REGS_##f##_OFFSET) |
25 | #define SW(f) (IA64_SWITCH_STACK_##f##_OFFSET) | 25 | #define SW(f) (IA64_SWITCH_STACK_##f##_OFFSET) |
26 | #define SOS(f) (IA64_SAL_OS_STATE_##f##_OFFSET) | ||
26 | 27 | ||
27 | #define PT_REGS_SAVES(off) \ | 28 | #define PT_REGS_SAVES(off) \ |
28 | .unwabi 3, 'i'; \ | 29 | .unwabi 3, 'i'; \ |
diff --git a/arch/ia64/kernel/mca_asm.S b/arch/ia64/kernel/mca_asm.S index 6dff024cd62b..c1bd1feffab0 100644 --- a/arch/ia64/kernel/mca_asm.S +++ b/arch/ia64/kernel/mca_asm.S | |||
@@ -159,7 +159,7 @@ ia64_os_mca_spin: | |||
159 | GET_IA64_MCA_DATA(r2) | 159 | GET_IA64_MCA_DATA(r2) |
160 | // Using MCA stack, struct ia64_sal_os_state, variable proc_state_param | 160 | // Using MCA stack, struct ia64_sal_os_state, variable proc_state_param |
161 | ;; | 161 | ;; |
162 | add r3=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_SOS_OFFSET+IA64_SAL_OS_STATE_PROC_STATE_PARAM_OFFSET, r2 | 162 | add r3=IA64_MCA_CPU_MCA_STACK_OFFSET+MCA_SOS_OFFSET+SOS(PROC_STATE_PARAM), r2 |
163 | ;; | 163 | ;; |
164 | ld8 r18=[r3] // Get processor state parameter on existing PALE_CHECK. | 164 | ld8 r18=[r3] // Get processor state parameter on existing PALE_CHECK. |
165 | ;; | 165 | ;; |
@@ -479,9 +479,11 @@ ia64_state_save: | |||
479 | st8 [temp2]=r11,16 // rv_rc | 479 | st8 [temp2]=r11,16 // rv_rc |
480 | mov r11=cr.iipa | 480 | mov r11=cr.iipa |
481 | ;; | 481 | ;; |
482 | st8 [temp1]=r18,16 // proc_state_param | 482 | st8 [temp1]=r18 // proc_state_param |
483 | st8 [temp2]=r19,16 // monarch | 483 | st8 [temp2]=r19 // monarch |
484 | mov r6=IA64_KR(CURRENT) | 484 | mov r6=IA64_KR(CURRENT) |
485 | add temp1=SOS(SAL_RA), regs | ||
486 | add temp2=SOS(SAL_GP), regs | ||
485 | ;; | 487 | ;; |
486 | st8 [temp1]=r12,16 // sal_ra | 488 | st8 [temp1]=r12,16 // sal_ra |
487 | st8 [temp2]=r10,16 // sal_gp | 489 | st8 [temp2]=r10,16 // sal_gp |
@@ -503,12 +505,14 @@ ia64_state_save: | |||
503 | st8 [temp2]=r11,16 // cr.iipa | 505 | st8 [temp2]=r11,16 // cr.iipa |
504 | mov r12=cr.iim | 506 | mov r12=cr.iim |
505 | ;; | 507 | ;; |
506 | st8 [temp1]=r12,16 // cr.iim | 508 | st8 [temp1]=r12 // cr.iim |
507 | (p1) mov r12=IA64_MCA_COLD_BOOT | 509 | (p1) mov r12=IA64_MCA_COLD_BOOT |
508 | (p2) mov r12=IA64_INIT_WARM_BOOT | 510 | (p2) mov r12=IA64_INIT_WARM_BOOT |
509 | mov r6=cr.iha | 511 | mov r6=cr.iha |
512 | add temp1=SOS(OS_STATUS), regs | ||
510 | ;; | 513 | ;; |
511 | st8 [temp2]=r6,16 // cr.iha | 514 | st8 [temp2]=r6 // cr.iha |
515 | add temp2=SOS(CONTEXT), regs | ||
512 | st8 [temp1]=r12 // os_status, default is cold boot | 516 | st8 [temp1]=r12 // os_status, default is cold boot |
513 | mov r6=IA64_MCA_SAME_CONTEXT | 517 | mov r6=IA64_MCA_SAME_CONTEXT |
514 | ;; | 518 | ;; |
@@ -820,8 +824,8 @@ ia64_state_restore: | |||
820 | // Restore the SAL to OS state. The previous code left regs at pt_regs. | 824 | // Restore the SAL to OS state. The previous code left regs at pt_regs. |
821 | add regs=MCA_SOS_OFFSET-MCA_PT_REGS_OFFSET, regs | 825 | add regs=MCA_SOS_OFFSET-MCA_PT_REGS_OFFSET, regs |
822 | ;; | 826 | ;; |
823 | add temp1=IA64_SAL_OS_STATE_COMMON_OFFSET, regs | 827 | add temp1=SOS(SAL_RA), regs |
824 | add temp2=IA64_SAL_OS_STATE_COMMON_OFFSET+8, regs | 828 | add temp2=SOS(SAL_GP), regs |
825 | ;; | 829 | ;; |
826 | ld8 r12=[temp1],16 // sal_ra | 830 | ld8 r12=[temp1],16 // sal_ra |
827 | ld8 r9=[temp2],16 // sal_gp | 831 | ld8 r9=[temp2],16 // sal_gp |
@@ -842,8 +846,10 @@ ia64_state_restore: | |||
842 | ;; | 846 | ;; |
843 | mov cr.itir=temp3 | 847 | mov cr.itir=temp3 |
844 | mov cr.iipa=temp4 | 848 | mov cr.iipa=temp4 |
845 | ld8 temp3=[temp1],16 // cr.iim | 849 | ld8 temp3=[temp1] // cr.iim |
846 | ld8 temp4=[temp2],16 // cr.iha | 850 | ld8 temp4=[temp2] // cr.iha |
851 | add temp1=SOS(OS_STATUS), regs | ||
852 | add temp2=SOS(CONTEXT), regs | ||
847 | ;; | 853 | ;; |
848 | mov cr.iim=temp3 | 854 | mov cr.iim=temp3 |
849 | mov cr.iha=temp4 | 855 | mov cr.iha=temp4 |
@@ -916,7 +922,7 @@ ia64_state_restore: | |||
916 | 922 | ||
917 | ia64_new_stack: | 923 | ia64_new_stack: |
918 | add regs=MCA_PT_REGS_OFFSET, r3 | 924 | add regs=MCA_PT_REGS_OFFSET, r3 |
919 | add temp2=MCA_SOS_OFFSET+IA64_SAL_OS_STATE_PAL_MIN_STATE_OFFSET, r3 | 925 | add temp2=MCA_SOS_OFFSET+SOS(PAL_MIN_STATE), r3 |
920 | mov b0=r2 // save return address | 926 | mov b0=r2 // save return address |
921 | GET_IA64_MCA_DATA(temp1) | 927 | GET_IA64_MCA_DATA(temp1) |
922 | invala | 928 | invala |
@@ -1020,7 +1026,7 @@ ia64_old_stack: | |||
1020 | 1026 | ||
1021 | ia64_set_kernel_registers: | 1027 | ia64_set_kernel_registers: |
1022 | add temp3=MCA_SP_OFFSET, r3 | 1028 | add temp3=MCA_SP_OFFSET, r3 |
1023 | add temp4=MCA_SOS_OFFSET+IA64_SAL_OS_STATE_OS_GP_OFFSET, r3 | 1029 | add temp4=MCA_SOS_OFFSET+SOS(OS_GP), r3 |
1024 | mov b0=r2 // save return address | 1030 | mov b0=r2 // save return address |
1025 | GET_IA64_MCA_DATA(temp1) | 1031 | GET_IA64_MCA_DATA(temp1) |
1026 | ;; | 1032 | ;; |