[PATCH] fix semaphore handling in __unregister_chrdev_region
[linux/fpc-iii.git] / include / asm-v850 / entry.h
blobd9df8ac48584ebf13e115f4fb64ec02777631ab3
1 /*
2 * include/asm-v850/entry.h -- Definitions used by low-level trap handlers
4 * Copyright (C) 2001,02,03 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
11 * Written by Miles Bader <miles@gnu.org>
14 #ifndef __V850_ENTRY_H__
15 #define __V850_ENTRY_H__
18 #include <asm/ptrace.h>
19 #include <asm/machdep.h>
22 /* These are special variables using by the kernel trap/interrupt code
23 to save registers in, at a time when there are no spare registers we
24 can use to do so, and we can't depend on the value of the stack
25 pointer. This means that they must be within a signed 16-bit
26 displacement of 0x00000000. */
28 #define KERNEL_VAR_SPACE_ADDR R0_RAM_ADDR
30 #ifdef __ASSEMBLY__
31 #define KERNEL_VAR(addr) addr[r0]
32 #else
33 #define KERNEL_VAR(addr) (*(volatile unsigned long *)(addr))
34 #endif
36 /* Kernel stack pointer, 4 bytes. */
37 #define KSP_ADDR (KERNEL_VAR_SPACE_ADDR + 0)
38 #define KSP KERNEL_VAR (KSP_ADDR)
39 /* 1 if in kernel-mode, 0 if in user mode, 1 byte. */
40 #define KM_ADDR (KERNEL_VAR_SPACE_ADDR + 4)
41 #define KM KERNEL_VAR (KM_ADDR)
42 /* Temporary storage for interrupt handlers, 4 bytes. */
43 #define INT_SCRATCH_ADDR (KERNEL_VAR_SPACE_ADDR + 8)
44 #define INT_SCRATCH KERNEL_VAR (INT_SCRATCH_ADDR)
45 /* Where the stack-pointer is saved when jumping to various sorts of
46 interrupt handlers. ENTRY_SP is used by everything except NMIs,
47 which have their own location. Higher-priority NMIs can clobber the
48 value written by a lower priority NMI, since they can't be disabled,
49 but that's OK, because only NMI0 (the lowest-priority one) is allowed
50 to return. */
51 #define ENTRY_SP_ADDR (KERNEL_VAR_SPACE_ADDR + 12)
52 #define ENTRY_SP KERNEL_VAR (ENTRY_SP_ADDR)
53 #define NMI_ENTRY_SP_ADDR (KERNEL_VAR_SPACE_ADDR + 16)
54 #define NMI_ENTRY_SP KERNEL_VAR (NMI_ENTRY_SP_ADDR)
56 #ifdef CONFIG_RESET_GUARD
57 /* Used to detect unexpected resets (since the v850 has no MMU, any call
58 through a null pointer will jump to the reset vector). We detect
59 such resets by checking for a magic value, RESET_GUARD_ACTIVE, in
60 this location. Properly resetting the machine stores zero there, so
61 it shouldn't trigger the guard; the power-on value is uncertain, but
62 it's unlikely to be RESET_GUARD_ACTIVE. */
63 #define RESET_GUARD_ADDR (KERNEL_VAR_SPACE_ADDR + 28)
64 #define RESET_GUARD KERNEL_VAR (RESET_GUARD_ADDR)
65 #define RESET_GUARD_ACTIVE 0xFAB4BEEF
66 #endif /* CONFIG_RESET_GUARD */
68 #ifdef CONFIG_V850E_HIGHRES_TIMER
69 #define HIGHRES_TIMER_SLOW_TICKS_ADDR (KERNEL_VAR_SPACE_ADDR + 32)
70 #define HIGHRES_TIMER_SLOW_TICKS KERNEL_VAR (HIGHRES_TIMER_SLOW_TICKS_ADDR)
71 #endif /* CONFIG_V850E_HIGHRES_TIMER */
73 #ifndef __ASSEMBLY__
75 #ifdef CONFIG_RESET_GUARD
76 /* Turn off reset guard, so that resetting the machine works normally.
77 This should be called in the various machine_halt, etc., functions. */
78 static inline void disable_reset_guard (void)
80 RESET_GUARD = 0;
82 #endif /* CONFIG_RESET_GUARD */
84 #endif /* !__ASSEMBLY__ */
87 /* A `state save frame' is a struct pt_regs preceded by some extra space
88 suitable for a function call stack frame. */
90 /* Amount of room on the stack reserved for arguments and to satisfy the
91 C calling conventions, in addition to the space used by the struct
92 pt_regs that actually holds saved values. */
93 #define STATE_SAVE_ARG_SPACE (6*4) /* Up to six arguments. */
96 #ifdef __ASSEMBLY__
98 /* The size of a state save frame. */
99 #define STATE_SAVE_SIZE (PT_SIZE + STATE_SAVE_ARG_SPACE)
101 #else /* !__ASSEMBLY__ */
103 /* The size of a state save frame. */
104 #define STATE_SAVE_SIZE (sizeof (struct pt_regs) + STATE_SAVE_ARG_SPACE)
106 #endif /* __ASSEMBLY__ */
109 /* Offset of the struct pt_regs in a state save frame. */
110 #define STATE_SAVE_PT_OFFSET STATE_SAVE_ARG_SPACE
113 #endif /* __V850_ENTRY_H__ */