From 187f8c7c3dfbf5f48a4cd5c5bd48dd6d407d4d14 Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 10 Feb 1997 03:50:53 +0000 Subject: [PATCH] Remove local definitions of macros to push and pull trapframes and instead include machine/frame.h to get these definitions. --- sys/arch/arm32/arm32/cpuswitch.S | 19 +---- sys/arch/arm32/arm32/exception.S | 141 +------------------------------ sys/arch/arm32/arm32/irq.S | 83 +----------------- sys/arch/arm32/arm32/locore.S | 51 +---------- sys/arch/arm32/iomd/iomd_irq.S | 83 +----------------- 5 files changed, 13 insertions(+), 364 deletions(-) diff --git a/sys/arch/arm32/arm32/cpuswitch.S b/sys/arch/arm32/arm32/cpuswitch.S index 96ba04a0f238..71c32442a41f 100644 --- a/sys/arch/arm32/arm32/cpuswitch.S +++ b/sys/arch/arm32/arm32/cpuswitch.S @@ -1,7 +1,7 @@ -/* $NetBSD: cpuswitch.S,v 1.14 1997/02/04 07:12:30 mark Exp $ */ +/* $NetBSD: cpuswitch.S,v 1.15 1997/02/10 03:50:53 mark Exp $ */ /* - * Copyright (c) 1994-1996 Mark Brinicombe. + * Copyright (c) 1994-1997 Mark Brinicombe. * Copyright (c) 1994 Brini. * All rights reserved. * @@ -46,26 +46,13 @@ #include "assym.h" #include #include +#include #include sp .req r13 lr .req r14 pc .req r15 -/* - * PULLFRAME - macro to pull a trap frame from the stack in the current mode - * Since the current mode is used, the SVC R14 field is ignored. - */ - -#define PULLFRAME \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #0x00000004; /* Skip SVC R14 */ \ - ldr lr, [sp], #0x0004; /* Pull the return address */ - #undef IRQdisable #undef IRQenable diff --git a/sys/arch/arm32/arm32/exception.S b/sys/arch/arm32/arm32/exception.S index 256e14739b99..dddfa0d79f48 100644 --- a/sys/arch/arm32/arm32/exception.S +++ b/sys/arch/arm32/arm32/exception.S @@ -1,4 +1,4 @@ -/* $NetBSD: exception.S,v 1.9 1997/02/04 06:49:08 mark Exp $ */ +/* $NetBSD: exception.S,v 1.10 1997/02/10 03:50:54 mark Exp $ */ /* * Copyright (c) 1994-1997 Mark Brinicombe. @@ -47,146 +47,9 @@ #include "ipkdb.h" #include +#include #include "assym.h" -/* - * PUSHFRAME - macro to push a trap frame on the stack in the current mode - * Since the current mode is used, the SVC R14 field is not defined. - */ - -#if 1 - -#define PUSHFRAME \ - str lr, [sp, #-4]!; /* Push the return address */ \ - sub sp, sp, #0x00000004; /* Skip SVC R14 */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - stmia sp, {r0-r12}; /* Push the user mode registers */ \ - add r0, sp, #(4*13); /* Adjust the stack pointer */ \ - stmia r0, {r13-r14}^; /* Push the user mode registers */ \ - mov r0, r0; /* NOP for previous instruction */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]!; - -/* - * PULLFRAME - macro to pull a trap frame from the stack in the current mode - * Since the current mode is used, the SVC R14 field is ignored. - */ - -#define PULLFRAME \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; \ - ldmia sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - add sp, sp, #0x00000004; /* Skip SVC R14 */ \ - ldr lr, [sp], #0x0004; /* Pull the return address */ - -#else -#define PUSHFRAME \ - str lr, [sp, #-4]!; /* Push the return address */ \ - sub sp, sp, #0x00000004; /* Skip SVC R14 */ \ - stmdb sp, {r0-r14}^; /* Push the user mode registers */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]!; - -/* - * PULLFRAME - macro to pull a trap frame from the stack in the current mode - * Since the current mode is used, the SVC R14 field is ignored. - */ - -#define PULLFRAME \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #0x00000004; /* Skip SVC R14 */ \ - ldr lr, [sp], #0x0004; /* Pull the return address */ - -#endif - -/* - * PUSHFRAMEINSVC - macro to push a trap frame on the stack in SVC32 mode - * This should only be used if the processor is not currently in SVC32 - * mode. The processor mode is switched to SVC mode and the trap frame is - * stored. The SVC R14 field is used to store the previous value of - * R14 in SVC mode. - */ - -#if 1 - -#define PUSHFRAMEINSVC \ - stmdb sp, {r0-r3}; /* Save 4 registers */ \ - mov r0, lr; /* Save xxx32 r14 */ \ - mov r1, sp; /* Save xxx32 sp */ \ - mrs r3, spsr_all; /* Save xxx32 spsr */ \ - mrs r2, cpsr_all; /* Get the CPSR */ \ - bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \ - orr r2, r2, #(PSR_SVC32_MODE); \ - msr cpsr_all, r2; /* Punch into SVC mode */ \ - str r0, [sp, #-4]!; /* Push return address */ \ - str lr, [sp, #-4]!; /* Push SVC r14 */ \ - msr spsr_all, r3; /* Restore correct spsr */ \ - ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - stmia sp, {r0-r12}; /* Push the user mode registers */ \ - add r0, sp, #(4*13); /* Adjust the stack pointer */ \ - stmia r0, {r13-r14}^; /* Push the user mode registers */ \ - mov r0, r0; /* NOP for previous instruction */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]! - -/* - * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack - * in SVC32 mode and restore the saved processor mode and PC. - * This should be used when the SVC R14 register needs to be restored on - * exit. - */ - -#define PULLFRAMEFROMSVCANDEXIT \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; /* restore SPSR */ \ - ldmia sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmia sp!, {lr, pc}^ /* Restore lr and exit */ -#else -#define PUSHFRAMEINSVC \ - stmdb sp, {r0-r3}; /* Save 4 registers */ \ - mov r0, lr; /* Save xxx32 r14 */ \ - mov r1, sp; /* Save xxx32 sp */ \ - mrs r3, spsr_all; /* Save xxx32 spsr */ \ - mrs r2, cpsr_all; /* Get the CPSR */ \ - bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \ - orr r2, r2, #(PSR_SVC32_MODE); \ - msr cpsr_all, r2; /* Punch into SVC mode */ \ - str r0, [sp, #-4]!; /* Push return address */ \ - str lr, [sp, #-4]!; /* Push SVC r14 */ \ - msr spsr_all, r3; /* Restore correct spsr */ \ - ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \ - stmdb sp, {r0-r14}^; /* Push the user mode registers */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]! - -/* - * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack - * in SVC32 mode and restore the saved processor mode and PC. - * This should be used when the SVC R14 register needs to be restored on - * exit. - */ - -#define PULLFRAMEFROMSVCANDEXIT \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; /* restore SPSR */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - ldmia sp!, {lr, pc}^ /* Restore lr and exit */ -#endif - - sp .req r13 lr .req r14 pc .req r15 diff --git a/sys/arch/arm32/arm32/irq.S b/sys/arch/arm32/arm32/irq.S index 1f115c2dab16..dba7bc92c4e1 100644 --- a/sys/arch/arm32/arm32/irq.S +++ b/sys/arch/arm32/arm32/irq.S @@ -1,4 +1,4 @@ -/* $NetBSD: irq.S,v 1.12 1997/02/04 06:49:09 mark Exp $ */ +/* $NetBSD: irq.S,v 1.13 1997/02/10 03:50:56 mark Exp $ */ /* * Copyright (c) 1994-1997 Mark Brinicombe. @@ -45,88 +45,9 @@ #include "assym.h" #include +#include #include -/* - * PUSHFRAMEINSVC - macro to push a trap frame on the stack in SVC32 mode - * This should only be used if the processor is not currently in SVC32 - * mode. The processor mode is switched to SVC mode and the trap frame is - * stored. The SVC R14 field is used to store the previous value of - * R14 in SVC mode. - */ - -#if 1 - -#define PUSHFRAMEINSVC \ - stmdb sp, {r0-r3}; /* Save 4 registers */ \ - mov r0, lr; /* Save xxx32 r14 */ \ - mov r1, sp; /* Save xxx32 sp */ \ - mrs r3, spsr_all; /* Save xxx32 spsr */ \ - mrs r2, cpsr_all; /* Get the CPSR */ \ - bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \ - orr r2, r2, #(PSR_SVC32_MODE); \ - msr cpsr_all, r2; /* Punch into SVC mode */ \ - str r0, [sp, #-4]!; /* Push return address */ \ - str lr, [sp, #-4]!; /* Push SVC r14 */ \ - msr spsr_all, r3; /* Restore correct spsr */ \ - ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - stmia sp, {r0-r12}; /* Push the user mode registers */ \ - add r0, sp, #(4*13); /* Adjust the stack pointer */ \ - stmia r0, {r13-r14}^; /* Push the user mode registers */ \ - mov r0, r0; /* NOP for previous instruction */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]! - -/* - * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack - * in SVC32 mode and restore the saved processor mode and PC. - * This should be used when the SVC R14 register needs to be restored on - * exit. - */ - -#define PULLFRAMEFROMSVCANDEXIT \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; /* restore SPSR */ \ - ldmia sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmia sp!, {lr, pc}^ /* Restore lr and exit */ -#else -#define PUSHFRAMEINSVC \ - stmdb sp, {r0-r3}; /* Save 4 registers */ \ - mov r0, lr; /* Save xxx32 r14 */ \ - mov r1, sp; /* Save xxx32 sp */ \ - mrs r3, spsr_all; /* Save xxx32 spsr */ \ - mrs r2, cpsr_all; /* Get the CPSR */ \ - bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \ - orr r2, r2, #(PSR_SVC32_MODE); \ - msr cpsr_all, r2; /* Punch into SVC mode */ \ - str r0, [sp, #-4]!; /* Push return address */ \ - str lr, [sp, #-4]!; /* Push SVC r14 */ \ - msr spsr_all, r3; /* Restore correct spsr */ \ - ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \ - stmdb sp, {r0-r14}^; /* Push the user mode registers */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]! - -/* - * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack - * in SVC32 mode and restore the saved processor mode and PC. - * This should be used when the SVC R14 register needs to be restored on - * exit. - */ - -#define PULLFRAMEFROMSVCANDEXIT \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; /* restore SPSR */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmdb sp, {r0-r14}^; /* Restore the registers (usr mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - ldmia sp!, {lr, pc}^ /* Restore lr and exit */ -#endif - sp .req r13 lr .req r14 pc .req r15 diff --git a/sys/arch/arm32/arm32/locore.S b/sys/arch/arm32/arm32/locore.S index 4951b99d33d2..c3ce5806bd4e 100644 --- a/sys/arch/arm32/arm32/locore.S +++ b/sys/arch/arm32/arm32/locore.S @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.17 1997/02/04 06:49:10 mark Exp $ */ +/* $NetBSD: locore.S,v 1.18 1997/02/10 03:50:55 mark Exp $ */ /* * Copyright (C) 1994-1997 Mark Brinicombe @@ -35,6 +35,7 @@ #include "assym.h" #include #include +#include #include #include @@ -42,52 +43,6 @@ #define INIT_ARM_STACK_SIZE 2048 -#if 1 - -#define PUSHFRAME \ - str lr, [sp, #-4]!; /* Push the return address */ \ - sub sp, sp, #0x00000004; /* Skip SVC R14 */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - stmia sp, {r0-r12}; /* Push the user mode registers */ \ - add r0, sp, #(4*13); /* Adjust the stack pointer */ \ - stmia r0, {r13-r14}^; /* Push the user mode registers */ \ - mov r0, r0; /* NOP for previous instruction */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]!; - -/* - * PULLFRAME - macro to pull a trap frame from the stack in the current mode - * Since the current mode is used, the SVC R14 field is ignored. - */ - -#define PULLFRAME \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; \ - ldmia sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - add sp, sp, #0x00000004; /* Skip SVC R14 */ \ - ldr lr, [sp], #0x0004; /* Pull the return address */ - -#else -#define PUSHFRAME \ - str lr, [sp, #-4]!; /* Push the return address */ \ - sub sp, sp, #0x00000004; /* Skip SVC R14 */ \ - stmdb sp, {r0-r14}^; /* Push the user mode registers */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]!; - -#define PULLFRAME \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #0x00000004; /* Skip SVC R14 */ \ - ldr lr, [sp], #0x0004; /* Pull the return address */ -#endif - /* register equates */ fp .req r11 ip .req r12 @@ -614,3 +569,5 @@ _atomic_clear_bit: msr cpsr_all, r2 mov pc, lr + +/* End of locore.S */ diff --git a/sys/arch/arm32/iomd/iomd_irq.S b/sys/arch/arm32/iomd/iomd_irq.S index e610d7c6d306..fa129e05af45 100644 --- a/sys/arch/arm32/iomd/iomd_irq.S +++ b/sys/arch/arm32/iomd/iomd_irq.S @@ -1,4 +1,4 @@ -/* $NetBSD: iomd_irq.S,v 1.12 1997/02/04 06:49:09 mark Exp $ */ +/* $NetBSD: iomd_irq.S,v 1.13 1997/02/10 03:50:56 mark Exp $ */ /* * Copyright (c) 1994-1997 Mark Brinicombe. @@ -45,88 +45,9 @@ #include "assym.h" #include +#include #include -/* - * PUSHFRAMEINSVC - macro to push a trap frame on the stack in SVC32 mode - * This should only be used if the processor is not currently in SVC32 - * mode. The processor mode is switched to SVC mode and the trap frame is - * stored. The SVC R14 field is used to store the previous value of - * R14 in SVC mode. - */ - -#if 1 - -#define PUSHFRAMEINSVC \ - stmdb sp, {r0-r3}; /* Save 4 registers */ \ - mov r0, lr; /* Save xxx32 r14 */ \ - mov r1, sp; /* Save xxx32 sp */ \ - mrs r3, spsr_all; /* Save xxx32 spsr */ \ - mrs r2, cpsr_all; /* Get the CPSR */ \ - bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \ - orr r2, r2, #(PSR_SVC32_MODE); \ - msr cpsr_all, r2; /* Punch into SVC mode */ \ - str r0, [sp, #-4]!; /* Push return address */ \ - str lr, [sp, #-4]!; /* Push SVC r14 */ \ - msr spsr_all, r3; /* Restore correct spsr */ \ - ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - stmia sp, {r0-r12}; /* Push the user mode registers */ \ - add r0, sp, #(4*13); /* Adjust the stack pointer */ \ - stmia r0, {r13-r14}^; /* Push the user mode registers */ \ - mov r0, r0; /* NOP for previous instruction */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]! - -/* - * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack - * in SVC32 mode and restore the saved processor mode and PC. - * This should be used when the SVC R14 register needs to be restored on - * exit. - */ - -#define PULLFRAMEFROMSVCANDEXIT \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; /* restore SPSR */ \ - ldmia sp, {r0-r14}^; /* Restore the registers (user mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmia sp!, {lr, pc}^ /* Restore lr and exit */ -#else -#define PUSHFRAMEINSVC \ - stmdb sp, {r0-r3}; /* Save 4 registers */ \ - mov r0, lr; /* Save xxx32 r14 */ \ - mov r1, sp; /* Save xxx32 sp */ \ - mrs r3, spsr_all; /* Save xxx32 spsr */ \ - mrs r2, cpsr_all; /* Get the CPSR */ \ - bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \ - orr r2, r2, #(PSR_SVC32_MODE); \ - msr cpsr_all, r2; /* Punch into SVC mode */ \ - str r0, [sp, #-4]!; /* Push return address */ \ - str lr, [sp, #-4]!; /* Push SVC r14 */ \ - msr spsr_all, r3; /* Restore correct spsr */ \ - ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \ - stmdb sp, {r0-r14}^; /* Push the user mode registers */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - mrs r0, spsr_all; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]! - -/* - * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack - * in SVC32 mode and restore the saved processor mode and PC. - * This should be used when the SVC R14 register needs to be restored on - * exit. - */ - -#define PULLFRAMEFROMSVCANDEXIT \ - ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ - msr spsr_all, r0; /* restore SPSR */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmdb sp, {r0-r14}^; /* Restore the registers (usr mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - ldmia sp!, {lr, pc}^ /* Restore lr and exit */ -#endif - sp .req r13 lr .req r14 pc .req r15