1 /* MN10300 Microcontroller core system register definitions -*- asm -*-
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
11 #ifndef _ASM_FRAME_INC
12 #define _ASM_FRAME_INC
15 #error not for use in C files
18 #ifndef __ASM_OFFSETS_H__
19 #include <asm/asm-offsets.h>
22 #include <proc/smp-regs.h>
29 ###############################################################################
31 # build a stack frame from the registers
32 # - the caller has subtracted 4 from SP before coming here
34 ###############################################################################
36 add -4,sp # next exception frame ptr save area
39 mov a1,(sp) # USP in MOVM[other] dummy slot
40 movm [d2,d3,a2,a3,exreg0,exreg1,exother],(sp)
41 mov sp,fp # FRAME pointer in A3
42 add -12,sp # allow for calls to be made
44 #ifdef CONFIG_PREEMPT /* FIXME */
54 #ifdef CONFIG_PREEMPT /* FIXME */
57 #else /* CONFIG_SMP */
61 #endif /* CONFIG_SMP */
63 and ~EPSW_FE,epsw # disable the FPU inside the kernel
65 # we may be holding current in E2
66 #ifdef CONFIG_MN10300_CURRENT_IN_E2
71 ###############################################################################
73 # restore the registers from a stack frame
75 ###############################################################################
77 # peel back the stack to the calling frame
78 # - this permits execve() to discard extra frames due to kernel syscalls
80 #ifdef CONFIG_PREEMPT /* FIXME */
89 mov (REG_NEXT,fp),d0 # userspace has regs->next == 0
91 #ifdef CONFIG_PREEMPT /* FIXME */
94 #else /* CONFIG_SMP */
97 mov (REG_NEXT,fp),d0 # userspace has regs->next == 0
99 #endif /* CONFIG_SMP */
101 #ifndef CONFIG_MN10300_USING_JTAG
113 movm (sp),[d2,d3,a2,a3,exreg0,exreg1,exother]
115 # must restore usp even if returning to kernel space,
116 # when CONFIG_PREEMPT is enabled.
117 mov (sp),a1 # USP in MOVM[other] dummy slot
127 #endif /* _ASM_FRAME_INC */