diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 14:09:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 14:09:27 -0400 |
commit | 76d3f4c27d3c2c85e5cfe731537b6929145bf652 (patch) | |
tree | 80d6dd04ad832122f69edaad710252d771e39c1b /arch/arc/include | |
parent | c1101cbc7db316dcdc94d344727fd372622d0ce7 (diff) | |
parent | baadb8fd0c62540f2ffb2d0f12b8a47c7975562b (diff) |
Merge tag 'arc-v3.11-rc1-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull first batch of ARC changes from Vineet Gupta:
"There's a second bunch to follow next week - which depends on commits
on other trees (irq/net). I'd have preferred the accompanying ARC
change via respective trees, but it didn't workout somehow.
Highlights of changes:
- Continuation of ARC MM changes from 3.10 including
zero page optimization
Setting pagecache pages dirty by default
Non executable stack by default
Reducing dcache flushes for aliasing VIPT config
- Long overdue rework of pt_regs machinery - removing the unused word
gutters and adding ECR register to baseline (helps cleanup lot of
low level code)
- Support for ARC gcc 4.8
- Few other preventive fixes, cosmetics, usage of Kconfig helper..
The diffstat is larger than normal primarily because of arcregs.h
header split as well as beautification of macros in entry.h"
* tag 'arc-v3.11-rc1-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: (32 commits)
ARC: warn on improper stack unwind FDE entries
arc: delete __cpuinit usage from all arc files
ARC: [tlb-miss] Fix bug with CONFIG_ARC_DBG_TLB_MISS_COUNT
ARC: [tlb-miss] Extraneous PTE bit testing/setting
ARC: Adjustments for gcc 4.8
ARC: Setup Vector Table Base in early boot
ARC: Remove explicit passing around of ECR
ARC: pt_regs update #5: Use real ECR for pt_regs->event vs. synth values
ARC: stop using pt_regs->orig_r8
ARC: pt_regs update #4: r25 saved/restored unconditionally
ARC: K/U SP saved from one location in stack switching macro
ARC: Entry Handler tweaks: Simplify branch for in-kernel preemption
ARC: Entry Handler tweaks: Avoid hardcoded LIMMS for ECR values
ARC: Increase readability of entry handlers
ARC: pt_regs update #3: Remove unused gutter at start of callee_regs
ARC: pt_regs update #2: Remove unused gutter at start of pt_regs
ARC: pt_regs update #1: Align pt_regs end with end of kernel stack page
ARC: pt_regs update #0: remove kernel stack canary
ARC: [mm] Remove @write argument to do_page_fault()
ARC: [mm] Make stack/heap Non-executable by default
...
Diffstat (limited to 'arch/arc/include')
-rw-r--r-- | arch/arc/include/asm/arcregs.h | 127 | ||||
-rw-r--r-- | arch/arc/include/asm/bug.h | 5 | ||||
-rw-r--r-- | arch/arc/include/asm/cache.h | 26 | ||||
-rw-r--r-- | arch/arc/include/asm/cacheflush.h | 13 | ||||
-rw-r--r-- | arch/arc/include/asm/defines.h | 56 | ||||
-rw-r--r-- | arch/arc/include/asm/entry.h | 521 | ||||
-rw-r--r-- | arch/arc/include/asm/irq.h | 2 | ||||
-rw-r--r-- | arch/arc/include/asm/irqflags.h | 20 | ||||
-rw-r--r-- | arch/arc/include/asm/kgdb.h | 4 | ||||
-rw-r--r-- | arch/arc/include/asm/kprobes.h | 6 | ||||
-rw-r--r-- | arch/arc/include/asm/mmu.h | 44 | ||||
-rw-r--r-- | arch/arc/include/asm/page.h | 7 | ||||
-rw-r--r-- | arch/arc/include/asm/pgtable.h | 6 | ||||
-rw-r--r-- | arch/arc/include/asm/processor.h | 17 | ||||
-rw-r--r-- | arch/arc/include/asm/ptrace.h | 47 | ||||
-rw-r--r-- | arch/arc/include/asm/syscall.h | 5 | ||||
-rw-r--r-- | arch/arc/include/asm/tlb-mmu1.h | 4 | ||||
-rw-r--r-- | arch/arc/include/asm/tlb.h | 26 | ||||
-rw-r--r-- | arch/arc/include/asm/unaligned.h | 4 | ||||
-rw-r--r-- | arch/arc/include/uapi/asm/ptrace.h | 15 |
20 files changed, 363 insertions, 592 deletions
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index 1b907c465666..355cb470c2a4 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #define ARC_REG_PERIBASE_BCR 0x69 | 20 | #define ARC_REG_PERIBASE_BCR 0x69 |
21 | #define ARC_REG_FP_BCR 0x6B /* Single-Precision FPU */ | 21 | #define ARC_REG_FP_BCR 0x6B /* Single-Precision FPU */ |
22 | #define ARC_REG_DPFP_BCR 0x6C /* Dbl Precision FPU */ | 22 | #define ARC_REG_DPFP_BCR 0x6C /* Dbl Precision FPU */ |
23 | #define ARC_REG_MMU_BCR 0x6f | ||
24 | #define ARC_REG_DCCM_BCR 0x74 /* DCCM Present + SZ */ | 23 | #define ARC_REG_DCCM_BCR 0x74 /* DCCM Present + SZ */ |
25 | #define ARC_REG_TIMERS_BCR 0x75 | 24 | #define ARC_REG_TIMERS_BCR 0x75 |
26 | #define ARC_REG_ICCM_BCR 0x78 | 25 | #define ARC_REG_ICCM_BCR 0x78 |
@@ -34,22 +33,12 @@ | |||
34 | #define ARC_REG_D_UNCACH_BCR 0x6A | 33 | #define ARC_REG_D_UNCACH_BCR 0x6A |
35 | 34 | ||
36 | /* status32 Bits Positions */ | 35 | /* status32 Bits Positions */ |
37 | #define STATUS_H_BIT 0 /* CPU Halted */ | ||
38 | #define STATUS_E1_BIT 1 /* Int 1 enable */ | ||
39 | #define STATUS_E2_BIT 2 /* Int 2 enable */ | ||
40 | #define STATUS_A1_BIT 3 /* Int 1 active */ | ||
41 | #define STATUS_A2_BIT 4 /* Int 2 active */ | ||
42 | #define STATUS_AE_BIT 5 /* Exception active */ | 36 | #define STATUS_AE_BIT 5 /* Exception active */ |
43 | #define STATUS_DE_BIT 6 /* PC is in delay slot */ | 37 | #define STATUS_DE_BIT 6 /* PC is in delay slot */ |
44 | #define STATUS_U_BIT 7 /* User/Kernel mode */ | 38 | #define STATUS_U_BIT 7 /* User/Kernel mode */ |
45 | #define STATUS_L_BIT 12 /* Loop inhibit */ | 39 | #define STATUS_L_BIT 12 /* Loop inhibit */ |
46 | 40 | ||
47 | /* These masks correspond to the status word(STATUS_32) bits */ | 41 | /* These masks correspond to the status word(STATUS_32) bits */ |
48 | #define STATUS_H_MASK (1<<STATUS_H_BIT) | ||
49 | #define STATUS_E1_MASK (1<<STATUS_E1_BIT) | ||
50 | #define STATUS_E2_MASK (1<<STATUS_E2_BIT) | ||
51 | #define STATUS_A1_MASK (1<<STATUS_A1_BIT) | ||
52 | #define STATUS_A2_MASK (1<<STATUS_A2_BIT) | ||
53 | #define STATUS_AE_MASK (1<<STATUS_AE_BIT) | 42 | #define STATUS_AE_MASK (1<<STATUS_AE_BIT) |
54 | #define STATUS_DE_MASK (1<<STATUS_DE_BIT) | 43 | #define STATUS_DE_MASK (1<<STATUS_DE_BIT) |
55 | #define STATUS_U_MASK (1<<STATUS_U_BIT) | 44 | #define STATUS_U_MASK (1<<STATUS_U_BIT) |
@@ -71,6 +60,7 @@ | |||
71 | #define ECR_V_ITLB_MISS 0x21 | 60 | #define ECR_V_ITLB_MISS 0x21 |
72 | #define ECR_V_DTLB_MISS 0x22 | 61 | #define ECR_V_DTLB_MISS 0x22 |
73 | #define ECR_V_PROTV 0x23 | 62 | #define ECR_V_PROTV 0x23 |
63 | #define ECR_V_TRAP 0x25 | ||
74 | 64 | ||
75 | /* Protection Violation Exception Cause Code Values */ | 65 | /* Protection Violation Exception Cause Code Values */ |
76 | #define ECR_C_PROTV_INST_FETCH 0x00 | 66 | #define ECR_C_PROTV_INST_FETCH 0x00 |
@@ -79,94 +69,23 @@ | |||
79 | #define ECR_C_PROTV_XCHG 0x03 | 69 | #define ECR_C_PROTV_XCHG 0x03 |
80 | #define ECR_C_PROTV_MISALIG_DATA 0x04 | 70 | #define ECR_C_PROTV_MISALIG_DATA 0x04 |
81 | 71 | ||
72 | #define ECR_C_BIT_PROTV_MISALIG_DATA 10 | ||
73 | |||
74 | /* Machine Check Cause Code Values */ | ||
75 | #define ECR_C_MCHK_DUP_TLB 0x01 | ||
76 | |||
82 | /* DTLB Miss Exception Cause Code Values */ | 77 | /* DTLB Miss Exception Cause Code Values */ |
83 | #define ECR_C_BIT_DTLB_LD_MISS 8 | 78 | #define ECR_C_BIT_DTLB_LD_MISS 8 |
84 | #define ECR_C_BIT_DTLB_ST_MISS 9 | 79 | #define ECR_C_BIT_DTLB_ST_MISS 9 |
85 | 80 | ||
81 | /* Dummy ECR values for Interrupts */ | ||
82 | #define event_IRQ1 0x0031abcd | ||
83 | #define event_IRQ2 0x0032abcd | ||
86 | 84 | ||
87 | /* Auxiliary registers */ | 85 | /* Auxiliary registers */ |
88 | #define AUX_IDENTITY 4 | 86 | #define AUX_IDENTITY 4 |
89 | #define AUX_INTR_VEC_BASE 0x25 | 87 | #define AUX_INTR_VEC_BASE 0x25 |
90 | #define AUX_IRQ_LEV 0x200 /* IRQ Priority: L1 or L2 */ | ||
91 | #define AUX_IRQ_HINT 0x201 /* For generating Soft Interrupts */ | ||
92 | #define AUX_IRQ_LV12 0x43 /* interrupt level register */ | ||
93 | |||
94 | #define AUX_IENABLE 0x40c | ||
95 | #define AUX_ITRIGGER 0x40d | ||
96 | #define AUX_IPULSE 0x415 | ||
97 | |||
98 | /* Timer related Aux registers */ | ||
99 | #define ARC_REG_TIMER0_LIMIT 0x23 /* timer 0 limit */ | ||
100 | #define ARC_REG_TIMER0_CTRL 0x22 /* timer 0 control */ | ||
101 | #define ARC_REG_TIMER0_CNT 0x21 /* timer 0 count */ | ||
102 | #define ARC_REG_TIMER1_LIMIT 0x102 /* timer 1 limit */ | ||
103 | #define ARC_REG_TIMER1_CTRL 0x101 /* timer 1 control */ | ||
104 | #define ARC_REG_TIMER1_CNT 0x100 /* timer 1 count */ | ||
105 | |||
106 | #define TIMER_CTRL_IE (1 << 0) /* Interupt when Count reachs limit */ | ||
107 | #define TIMER_CTRL_NH (1 << 1) /* Count only when CPU NOT halted */ | ||
108 | |||
109 | /* MMU Management regs */ | ||
110 | #define ARC_REG_TLBPD0 0x405 | ||
111 | #define ARC_REG_TLBPD1 0x406 | ||
112 | #define ARC_REG_TLBINDEX 0x407 | ||
113 | #define ARC_REG_TLBCOMMAND 0x408 | ||
114 | #define ARC_REG_PID 0x409 | ||
115 | #define ARC_REG_SCRATCH_DATA0 0x418 | ||
116 | |||
117 | /* Bits in MMU PID register */ | ||
118 | #define MMU_ENABLE (1 << 31) /* Enable MMU for process */ | ||
119 | |||
120 | /* Error code if probe fails */ | ||
121 | #define TLB_LKUP_ERR 0x80000000 | ||
122 | |||
123 | /* TLB Commands */ | ||
124 | #define TLBWrite 0x1 | ||
125 | #define TLBRead 0x2 | ||
126 | #define TLBGetIndex 0x3 | ||
127 | #define TLBProbe 0x4 | ||
128 | |||
129 | #if (CONFIG_ARC_MMU_VER >= 2) | ||
130 | #define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */ | ||
131 | #define TLBIVUTLB 0x6 /* explicitly inv uTLBs */ | ||
132 | #else | ||
133 | #undef TLBWriteNI /* These cmds don't exist on older MMU */ | ||
134 | #undef TLBIVUTLB | ||
135 | #endif | ||
136 | 88 | ||
137 | /* Instruction cache related Auxiliary registers */ | ||
138 | #define ARC_REG_IC_BCR 0x77 /* Build Config reg */ | ||
139 | #define ARC_REG_IC_IVIC 0x10 | ||
140 | #define ARC_REG_IC_CTRL 0x11 | ||
141 | #define ARC_REG_IC_IVIL 0x19 | ||
142 | #if (CONFIG_ARC_MMU_VER > 2) | ||
143 | #define ARC_REG_IC_PTAG 0x1E | ||
144 | #endif | ||
145 | |||
146 | /* Bit val in IC_CTRL */ | ||
147 | #define IC_CTRL_CACHE_DISABLE 0x1 | ||
148 | |||
149 | /* Data cache related Auxiliary registers */ | ||
150 | #define ARC_REG_DC_BCR 0x72 | ||
151 | #define ARC_REG_DC_IVDC 0x47 | ||
152 | #define ARC_REG_DC_CTRL 0x48 | ||
153 | #define ARC_REG_DC_IVDL 0x4A | ||
154 | #define ARC_REG_DC_FLSH 0x4B | ||
155 | #define ARC_REG_DC_FLDL 0x4C | ||
156 | #if (CONFIG_ARC_MMU_VER > 2) | ||
157 | #define ARC_REG_DC_PTAG 0x5C | ||
158 | #endif | ||
159 | |||
160 | /* Bit val in DC_CTRL */ | ||
161 | #define DC_CTRL_INV_MODE_FLUSH 0x40 | ||
162 | #define DC_CTRL_FLUSH_STATUS 0x100 | ||
163 | |||
164 | /* MMU Management regs */ | ||
165 | #define ARC_REG_PID 0x409 | ||
166 | #define ARC_REG_SCRATCH_DATA0 0x418 | ||
167 | |||
168 | /* Bits in MMU PID register */ | ||
169 | #define MMU_ENABLE (1 << 31) /* Enable MMU for process */ | ||
170 | 89 | ||
171 | /* | 90 | /* |
172 | * Floating Pt Registers | 91 | * Floating Pt Registers |
@@ -293,24 +212,6 @@ struct bcr_identity { | |||
293 | #endif | 212 | #endif |
294 | }; | 213 | }; |
295 | 214 | ||
296 | struct bcr_mmu_1_2 { | ||
297 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
298 | unsigned int ver:8, ways:4, sets:4, u_itlb:8, u_dtlb:8; | ||
299 | #else | ||
300 | unsigned int u_dtlb:8, u_itlb:8, sets:4, ways:4, ver:8; | ||
301 | #endif | ||
302 | }; | ||
303 | |||
304 | struct bcr_mmu_3 { | ||
305 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
306 | unsigned int ver:8, ways:4, sets:4, osm:1, reserv:3, pg_sz:4, | ||
307 | u_itlb:4, u_dtlb:4; | ||
308 | #else | ||
309 | unsigned int u_dtlb:4, u_itlb:4, pg_sz:4, reserv:3, osm:1, sets:4, | ||
310 | ways:4, ver:8; | ||
311 | #endif | ||
312 | }; | ||
313 | |||
314 | #define EXTN_SWAP_VALID 0x1 | 215 | #define EXTN_SWAP_VALID 0x1 |
315 | #define EXTN_NORM_VALID 0x2 | 216 | #define EXTN_NORM_VALID 0x2 |
316 | #define EXTN_MINMAX_VALID 0x2 | 217 | #define EXTN_MINMAX_VALID 0x2 |
@@ -343,14 +244,6 @@ struct bcr_extn_xymem { | |||
343 | #endif | 244 | #endif |
344 | }; | 245 | }; |
345 | 246 | ||
346 | struct bcr_cache { | ||
347 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
348 | unsigned int pad:12, line_len:4, sz:4, config:4, ver:8; | ||
349 | #else | ||
350 | unsigned int ver:8, config:4, sz:4, line_len:4, pad:12; | ||
351 | #endif | ||
352 | }; | ||
353 | |||
354 | struct bcr_perip { | 247 | struct bcr_perip { |
355 | #ifdef CONFIG_CPU_BIG_ENDIAN | 248 | #ifdef CONFIG_CPU_BIG_ENDIAN |
356 | unsigned int start:8, pad2:8, sz:8, pad:8; | 249 | unsigned int start:8, pad2:8, sz:8, pad:8; |
@@ -403,7 +296,7 @@ struct cpuinfo_arc_mmu { | |||
403 | }; | 296 | }; |
404 | 297 | ||
405 | struct cpuinfo_arc_cache { | 298 | struct cpuinfo_arc_cache { |
406 | unsigned int has_aliasing, sz, line_len, assoc, ver; | 299 | unsigned int sz, line_len, assoc, ver; |
407 | }; | 300 | }; |
408 | 301 | ||
409 | struct cpuinfo_arc_ccm { | 302 | struct cpuinfo_arc_ccm { |
diff --git a/arch/arc/include/asm/bug.h b/arch/arc/include/asm/bug.h index 2ad8f9b1c54b..5b18e94c6678 100644 --- a/arch/arc/include/asm/bug.h +++ b/arch/arc/include/asm/bug.h | |||
@@ -18,9 +18,8 @@ struct task_struct; | |||
18 | void show_regs(struct pt_regs *regs); | 18 | void show_regs(struct pt_regs *regs); |
19 | void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs); | 19 | void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs); |
20 | void show_kernel_fault_diag(const char *str, struct pt_regs *regs, | 20 | void show_kernel_fault_diag(const char *str, struct pt_regs *regs, |
21 | unsigned long address, unsigned long cause_reg); | 21 | unsigned long address); |
22 | void die(const char *str, struct pt_regs *regs, unsigned long address, | 22 | void die(const char *str, struct pt_regs *regs, unsigned long address); |
23 | unsigned long cause_reg); | ||
24 | 23 | ||
25 | #define BUG() do { \ | 24 | #define BUG() do { \ |
26 | dump_stack(); \ | 25 | dump_stack(); \ |
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h index d5555fe4742a..5802849a6cae 100644 --- a/arch/arc/include/asm/cache.h +++ b/arch/arc/include/asm/cache.h | |||
@@ -18,21 +18,19 @@ | |||
18 | 18 | ||
19 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | 19 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) |
20 | 20 | ||
21 | #define ARC_ICACHE_WAYS 2 | 21 | /* For a rare case where customers have differently config I/D */ |
22 | #define ARC_DCACHE_WAYS 4 | ||
23 | |||
24 | /* Helpers */ | ||
25 | #define ARC_ICACHE_LINE_LEN L1_CACHE_BYTES | 22 | #define ARC_ICACHE_LINE_LEN L1_CACHE_BYTES |
26 | #define ARC_DCACHE_LINE_LEN L1_CACHE_BYTES | 23 | #define ARC_DCACHE_LINE_LEN L1_CACHE_BYTES |
27 | 24 | ||
28 | #define ICACHE_LINE_MASK (~(ARC_ICACHE_LINE_LEN - 1)) | 25 | #define ICACHE_LINE_MASK (~(ARC_ICACHE_LINE_LEN - 1)) |
29 | #define DCACHE_LINE_MASK (~(ARC_DCACHE_LINE_LEN - 1)) | 26 | #define DCACHE_LINE_MASK (~(ARC_DCACHE_LINE_LEN - 1)) |
30 | 27 | ||
31 | #if ARC_ICACHE_LINE_LEN != ARC_DCACHE_LINE_LEN | 28 | /* |
32 | #error "Need to fix some code as I/D cache lines not same" | 29 | * ARC700 doesn't cache any access in top 256M. |
33 | #else | 30 | * Ideal for wiring memory mapped peripherals as we don't need to do |
34 | #define is_not_cache_aligned(p) ((unsigned long)p & (~DCACHE_LINE_MASK)) | 31 | * explicit uncached accesses (LD.di/ST.di) hence more portable drivers |
35 | #endif | 32 | */ |
33 | #define ARC_UNCACHED_ADDR_SPACE 0xc0000000 | ||
36 | 34 | ||
37 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
38 | 36 | ||
@@ -57,16 +55,10 @@ | |||
57 | 55 | ||
58 | #define ARCH_DMA_MINALIGN L1_CACHE_BYTES | 56 | #define ARCH_DMA_MINALIGN L1_CACHE_BYTES |
59 | 57 | ||
60 | /* | ||
61 | * ARC700 doesn't cache any access in top 256M. | ||
62 | * Ideal for wiring memory mapped peripherals as we don't need to do | ||
63 | * explicit uncached accesses (LD.di/ST.di) hence more portable drivers | ||
64 | */ | ||
65 | #define ARC_UNCACHED_ADDR_SPACE 0xc0000000 | ||
66 | |||
67 | extern void arc_cache_init(void); | 58 | extern void arc_cache_init(void); |
68 | extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); | 59 | extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); |
69 | extern void __init read_decode_cache_bcr(void); | 60 | extern void __init read_decode_cache_bcr(void); |
70 | #endif | 61 | |
62 | #endif /* !__ASSEMBLY__ */ | ||
71 | 63 | ||
72 | #endif /* _ASM_CACHE_H */ | 64 | #endif /* _ASM_CACHE_H */ |
diff --git a/arch/arc/include/asm/cacheflush.h b/arch/arc/include/asm/cacheflush.h index ef62682e8d95..6abc4972bc93 100644 --- a/arch/arc/include/asm/cacheflush.h +++ b/arch/arc/include/asm/cacheflush.h | |||
@@ -81,16 +81,19 @@ void flush_anon_page(struct vm_area_struct *vma, | |||
81 | #endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */ | 81 | #endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */ |
82 | 82 | ||
83 | /* | 83 | /* |
84 | * A new pagecache page has PG_arch_1 clear - thus dcache dirty by default | ||
85 | * This works around some PIO based drivers which don't call flush_dcache_page | ||
86 | * to record that they dirtied the dcache | ||
87 | */ | ||
88 | #define PG_dc_clean PG_arch_1 | ||
89 | |||
90 | /* | ||
84 | * Simple wrapper over config option | 91 | * Simple wrapper over config option |
85 | * Bootup code ensures that hardware matches kernel configuration | 92 | * Bootup code ensures that hardware matches kernel configuration |
86 | */ | 93 | */ |
87 | static inline int cache_is_vipt_aliasing(void) | 94 | static inline int cache_is_vipt_aliasing(void) |
88 | { | 95 | { |
89 | #ifdef CONFIG_ARC_CACHE_VIPT_ALIASING | 96 | return IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING); |
90 | return 1; | ||
91 | #else | ||
92 | return 0; | ||
93 | #endif | ||
94 | } | 97 | } |
95 | 98 | ||
96 | #define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 1) | 99 | #define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 1) |
diff --git a/arch/arc/include/asm/defines.h b/arch/arc/include/asm/defines.h deleted file mode 100644 index 6097bb439cc5..000000000000 --- a/arch/arc/include/asm/defines.h +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __ARC_ASM_DEFINES_H__ | ||
10 | #define __ARC_ASM_DEFINES_H__ | ||
11 | |||
12 | #if defined(CONFIG_ARC_MMU_V1) | ||
13 | #define CONFIG_ARC_MMU_VER 1 | ||
14 | #elif defined(CONFIG_ARC_MMU_V2) | ||
15 | #define CONFIG_ARC_MMU_VER 2 | ||
16 | #elif defined(CONFIG_ARC_MMU_V3) | ||
17 | #define CONFIG_ARC_MMU_VER 3 | ||
18 | #endif | ||
19 | |||
20 | #ifdef CONFIG_ARC_HAS_LLSC | ||
21 | #define __CONFIG_ARC_HAS_LLSC_VAL 1 | ||
22 | #else | ||
23 | #define __CONFIG_ARC_HAS_LLSC_VAL 0 | ||
24 | #endif | ||
25 | |||
26 | #ifdef CONFIG_ARC_HAS_SWAPE | ||
27 | #define __CONFIG_ARC_HAS_SWAPE_VAL 1 | ||
28 | #else | ||
29 | #define __CONFIG_ARC_HAS_SWAPE_VAL 0 | ||
30 | #endif | ||
31 | |||
32 | #ifdef CONFIG_ARC_HAS_RTSC | ||
33 | #define __CONFIG_ARC_HAS_RTSC_VAL 1 | ||
34 | #else | ||
35 | #define __CONFIG_ARC_HAS_RTSC_VAL 0 | ||
36 | #endif | ||
37 | |||
38 | #ifdef CONFIG_ARC_MMU_SASID | ||
39 | #define __CONFIG_ARC_MMU_SASID_VAL 1 | ||
40 | #else | ||
41 | #define __CONFIG_ARC_MMU_SASID_VAL 0 | ||
42 | #endif | ||
43 | |||
44 | #ifdef CONFIG_ARC_HAS_ICACHE | ||
45 | #define __CONFIG_ARC_HAS_ICACHE 1 | ||
46 | #else | ||
47 | #define __CONFIG_ARC_HAS_ICACHE 0 | ||
48 | #endif | ||
49 | |||
50 | #ifdef CONFIG_ARC_HAS_DCACHE | ||
51 | #define __CONFIG_ARC_HAS_DCACHE 1 | ||
52 | #else | ||
53 | #define __CONFIG_ARC_HAS_DCACHE 0 | ||
54 | #endif | ||
55 | |||
56 | #endif /* __ARC_ASM_DEFINES_H__ */ | ||
diff --git a/arch/arc/include/asm/entry.h b/arch/arc/include/asm/entry.h index eb2ae53187d9..8943c028d4bb 100644 --- a/arch/arc/include/asm/entry.h +++ b/arch/arc/include/asm/entry.h | |||
@@ -50,194 +50,177 @@ | |||
50 | * Eff Addr for load = [reg2] | 50 | * Eff Addr for load = [reg2] |
51 | */ | 51 | */ |
52 | 52 | ||
53 | .macro PUSH reg | ||
54 | st.a \reg, [sp, -4] | ||
55 | .endm | ||
56 | |||
57 | .macro PUSHAX aux | ||
58 | lr r9, [\aux] | ||
59 | PUSH r9 | ||
60 | .endm | ||
61 | |||
62 | .macro POP reg | ||
63 | ld.ab \reg, [sp, 4] | ||
64 | .endm | ||
65 | |||
66 | .macro POPAX aux | ||
67 | POP r9 | ||
68 | sr r9, [\aux] | ||
69 | .endm | ||
70 | |||
53 | /*-------------------------------------------------------------- | 71 | /*-------------------------------------------------------------- |
54 | * Save caller saved registers (scratch registers) ( r0 - r12 ) | 72 | * Helpers to save/restore Scratch Regs: |
55 | * Registers are pushed / popped in the order defined in struct ptregs | 73 | * used by Interrupt/Exception Prologue/Epilogue |
56 | * in asm/ptrace.h | ||
57 | *-------------------------------------------------------------*/ | 74 | *-------------------------------------------------------------*/ |
58 | .macro SAVE_CALLER_SAVED | 75 | .macro SAVE_R0_TO_R12 |
59 | st.a r0, [sp, -4] | 76 | PUSH r0 |
60 | st.a r1, [sp, -4] | 77 | PUSH r1 |
61 | st.a r2, [sp, -4] | 78 | PUSH r2 |
62 | st.a r3, [sp, -4] | 79 | PUSH r3 |
63 | st.a r4, [sp, -4] | 80 | PUSH r4 |
64 | st.a r5, [sp, -4] | 81 | PUSH r5 |
65 | st.a r6, [sp, -4] | 82 | PUSH r6 |
66 | st.a r7, [sp, -4] | 83 | PUSH r7 |
67 | st.a r8, [sp, -4] | 84 | PUSH r8 |
68 | st.a r9, [sp, -4] | 85 | PUSH r9 |
69 | st.a r10, [sp, -4] | 86 | PUSH r10 |
70 | st.a r11, [sp, -4] | 87 | PUSH r11 |
71 | st.a r12, [sp, -4] | 88 | PUSH r12 |
89 | .endm | ||
90 | |||
91 | .macro RESTORE_R12_TO_R0 | ||
92 | POP r12 | ||
93 | POP r11 | ||
94 | POP r10 | ||
95 | POP r9 | ||
96 | POP r8 | ||
97 | POP r7 | ||
98 | POP r6 | ||
99 | POP r5 | ||
100 | POP r4 | ||
101 | POP r3 | ||
102 | POP r2 | ||
103 | POP r1 | ||
104 | POP r0 | ||
105 | |||
106 | #ifdef CONFIG_ARC_CURR_IN_REG | ||
107 | ld r25, [sp, 12] | ||
108 | #endif | ||
72 | .endm | 109 | .endm |
73 | 110 | ||
74 | /*-------------------------------------------------------------- | 111 | /*-------------------------------------------------------------- |
75 | * Restore caller saved registers (scratch registers) | 112 | * Helpers to save/restore callee-saved regs: |
113 | * used by several macros below | ||
76 | *-------------------------------------------------------------*/ | 114 | *-------------------------------------------------------------*/ |
77 | .macro RESTORE_CALLER_SAVED | 115 | .macro SAVE_R13_TO_R24 |
78 | ld.ab r12, [sp, 4] | 116 | PUSH r13 |
79 | ld.ab r11, [sp, 4] | 117 | PUSH r14 |
80 | ld.ab r10, [sp, 4] | 118 | PUSH r15 |
81 | ld.ab r9, [sp, 4] | 119 | PUSH r16 |
82 | ld.ab r8, [sp, 4] | 120 | PUSH r17 |
83 | ld.ab r7, [sp, 4] | 121 | PUSH r18 |
84 | ld.ab r6, [sp, 4] | 122 | PUSH r19 |
85 | ld.ab r5, [sp, 4] | 123 | PUSH r20 |
86 | ld.ab r4, [sp, 4] | 124 | PUSH r21 |
87 | ld.ab r3, [sp, 4] | 125 | PUSH r22 |
88 | ld.ab r2, [sp, 4] | 126 | PUSH r23 |
89 | ld.ab r1, [sp, 4] | 127 | PUSH r24 |
90 | ld.ab r0, [sp, 4] | 128 | .endm |
129 | |||
130 | .macro RESTORE_R24_TO_R13 | ||
131 | POP r24 | ||
132 | POP r23 | ||
133 | POP r22 | ||
134 | POP r21 | ||
135 | POP r20 | ||
136 | POP r19 | ||
137 | POP r18 | ||
138 | POP r17 | ||
139 | POP r16 | ||
140 | POP r15 | ||
141 | POP r14 | ||
142 | POP r13 | ||
91 | .endm | 143 | .endm |
92 | 144 | ||
145 | #define OFF_USER_R25_FROM_R24 (SZ_CALLEE_REGS + SZ_PT_REGS - 8)/4 | ||
93 | 146 | ||
94 | /*-------------------------------------------------------------- | 147 | /*-------------------------------------------------------------- |
95 | * Save callee saved registers (non scratch registers) ( r13 - r25 ) | 148 | * Collect User Mode callee regs as struct callee_regs - needed by |
96 | * on kernel stack. | 149 | * fork/do_signal/unaligned-access-emulation. |
97 | * User mode callee regs need to be saved in case of | 150 | * (By default only scratch regs are saved on entry to kernel) |
98 | * -fork and friends for replicating from parent to child | 151 | * |
99 | * -before going into do_signal( ) for ptrace/core-dump | 152 | * Special handling for r25 if used for caching Task Pointer. |
100 | * Special case handling is required for r25 in case it is used by kernel | 153 | * It would have been saved in task->thread.user_r25 already, but to keep |
101 | * for caching task ptr. Low level exception/ISR save user mode r25 | 154 | * the interface same it is copied into regular r25 placeholder in |
102 | * into task->thread.user_r25. So it needs to be retrieved from there and | 155 | * struct callee_regs. |
103 | * saved into kernel stack with rest of callee reg-file | ||
104 | *-------------------------------------------------------------*/ | 156 | *-------------------------------------------------------------*/ |
105 | .macro SAVE_CALLEE_SAVED_USER | 157 | .macro SAVE_CALLEE_SAVED_USER |
106 | st.a r13, [sp, -4] | 158 | |
107 | st.a r14, [sp, -4] | 159 | SAVE_R13_TO_R24 |
108 | st.a r15, [sp, -4] | ||
109 | st.a r16, [sp, -4] | ||
110 | st.a r17, [sp, -4] | ||
111 | st.a r18, [sp, -4] | ||
112 | st.a r19, [sp, -4] | ||
113 | st.a r20, [sp, -4] | ||
114 | st.a r21, [sp, -4] | ||
115 | st.a r22, [sp, -4] | ||
116 | st.a r23, [sp, -4] | ||
117 | st.a r24, [sp, -4] | ||
118 | 160 | ||
119 | #ifdef CONFIG_ARC_CURR_IN_REG | 161 | #ifdef CONFIG_ARC_CURR_IN_REG |
120 | ; Retrieve orig r25 and save it on stack | 162 | ; Retrieve orig r25 and save it on stack |
121 | ld r12, [r25, TASK_THREAD + THREAD_USER_R25] | 163 | ld.as r12, [sp, OFF_USER_R25_FROM_R24] |
122 | st.a r12, [sp, -4] | 164 | st.a r12, [sp, -4] |
123 | #else | 165 | #else |
124 | st.a r25, [sp, -4] | 166 | PUSH r25 |
125 | #endif | 167 | #endif |
126 | 168 | ||
127 | /* move up by 1 word to "create" callee_regs->"stack_place_holder" */ | ||
128 | sub sp, sp, 4 | ||
129 | .endm | 169 | .endm |
130 | 170 | ||
131 | /*-------------------------------------------------------------- | 171 | /*-------------------------------------------------------------- |
132 | * Save callee saved registers (non scratch registers) ( r13 - r25 ) | 172 | * Save kernel Mode callee regs at the time of Contect Switch. |
133 | * kernel mode callee regs needed to be saved in case of context switch | 173 | * |
134 | * If r25 is used for caching task pointer then that need not be saved | 174 | * Special handling for r25 if used for caching Task Pointer. |
135 | * as it can be re-created from current task global | 175 | * Kernel simply skips saving it since it will be loaded with |
176 | * incoming task pointer anyways | ||
136 | *-------------------------------------------------------------*/ | 177 | *-------------------------------------------------------------*/ |
137 | .macro SAVE_CALLEE_SAVED_KERNEL | 178 | .macro SAVE_CALLEE_SAVED_KERNEL |
138 | st.a r13, [sp, -4] | 179 | |
139 | st.a r14, [sp, -4] | 180 | SAVE_R13_TO_R24 |
140 | st.a r15, [sp, -4] | 181 | |
141 | st.a r16, [sp, -4] | ||
142 | st.a r17, [sp, -4] | ||
143 | st.a r18, [sp, -4] | ||
144 | st.a r19, [sp, -4] | ||
145 | st.a r20, [sp, -4] | ||
146 | st.a r21, [sp, -4] | ||
147 | st.a r22, [sp, -4] | ||
148 | st.a r23, [sp, -4] | ||
149 | st.a r24, [sp, -4] | ||
150 | #ifdef CONFIG_ARC_CURR_IN_REG | 182 | #ifdef CONFIG_ARC_CURR_IN_REG |
151 | sub sp, sp, 8 | ||
152 | #else | ||
153 | st.a r25, [sp, -4] | ||
154 | sub sp, sp, 4 | 183 | sub sp, sp, 4 |
184 | #else | ||
185 | PUSH r25 | ||
155 | #endif | 186 | #endif |
156 | .endm | 187 | .endm |
157 | 188 | ||
158 | /*-------------------------------------------------------------- | 189 | /*-------------------------------------------------------------- |
159 | * RESTORE_CALLEE_SAVED_KERNEL: | 190 | * Opposite of SAVE_CALLEE_SAVED_KERNEL |
160 | * Loads callee (non scratch) Reg File by popping from Kernel mode stack. | ||
161 | * This is reverse of SAVE_CALLEE_SAVED, | ||
162 | * | ||
163 | * NOTE: | ||
164 | * Ideally this shd only be called in switch_to for loading | ||
165 | * switched-IN task's CALLEE Reg File. | ||
166 | * For all other cases RESTORE_CALLEE_SAVED_FAST must be used | ||
167 | * which simply pops the stack w/o touching regs. | ||
168 | *-------------------------------------------------------------*/ | 191 | *-------------------------------------------------------------*/ |
169 | .macro RESTORE_CALLEE_SAVED_KERNEL | 192 | .macro RESTORE_CALLEE_SAVED_KERNEL |
170 | 193 | ||
171 | |||
172 | #ifdef CONFIG_ARC_CURR_IN_REG | 194 | #ifdef CONFIG_ARC_CURR_IN_REG |
173 | add sp, sp, 8 /* skip callee_reg gutter and user r25 placeholder */ | 195 | add sp, sp, 4 /* skip usual r25 placeholder */ |
174 | #else | 196 | #else |
175 | add sp, sp, 4 /* skip "callee_regs->stack_place_holder" */ | 197 | POP r25 |
176 | ld.ab r25, [sp, 4] | ||
177 | #endif | 198 | #endif |
178 | 199 | RESTORE_R24_TO_R13 | |
179 | ld.ab r24, [sp, 4] | ||
180 | ld.ab r23, [sp, 4] | ||
181 | ld.ab r22, [sp, 4] | ||
182 | ld.ab r21, [sp, 4] | ||
183 | ld.ab r20, [sp, 4] | ||
184 | ld.ab r19, [sp, 4] | ||
185 | ld.ab r18, [sp, 4] | ||
186 | ld.ab r17, [sp, 4] | ||
187 | ld.ab r16, [sp, 4] | ||
188 | ld.ab r15, [sp, 4] | ||
189 | ld.ab r14, [sp, 4] | ||
190 | ld.ab r13, [sp, 4] | ||
191 | |||
192 | .endm | 200 | .endm |
193 | 201 | ||
194 | /*-------------------------------------------------------------- | 202 | /*-------------------------------------------------------------- |
195 | * RESTORE_CALLEE_SAVED_USER: | 203 | * Opposite of SAVE_CALLEE_SAVED_USER |
196 | * This is called after do_signal where tracer might have changed callee regs | 204 | * |
197 | * thus we need to restore the reg file. | 205 | * ptrace tracer or unaligned-access fixup might have changed a user mode |
198 | * Special case handling is required for r25 in case it is used by kernel | 206 | * callee reg which is saved back to usual r25 storage location |
199 | * for caching task ptr. Ptrace would have modified on-kernel-stack value of | ||
200 | * r25, which needs to be shoved back into task->thread.user_r25 where from | ||
201 | * Low level exception/ISR return code will retrieve to populate with rest of | ||
202 | * callee reg-file. | ||
203 | *-------------------------------------------------------------*/ | 207 | *-------------------------------------------------------------*/ |
204 | .macro RESTORE_CALLEE_SAVED_USER | 208 | .macro RESTORE_CALLEE_SAVED_USER |
205 | 209 | ||
206 | add sp, sp, 4 /* skip "callee_regs->stack_place_holder" */ | ||
207 | |||
208 | #ifdef CONFIG_ARC_CURR_IN_REG | 210 | #ifdef CONFIG_ARC_CURR_IN_REG |
209 | ld.ab r12, [sp, 4] | 211 | ld.ab r12, [sp, 4] |
210 | st r12, [r25, TASK_THREAD + THREAD_USER_R25] | 212 | st.as r12, [sp, OFF_USER_R25_FROM_R24] |
211 | #else | 213 | #else |
212 | ld.ab r25, [sp, 4] | 214 | POP r25 |
213 | #endif | 215 | #endif |
214 | 216 | RESTORE_R24_TO_R13 | |
215 | ld.ab r24, [sp, 4] | ||
216 | ld.ab r23, [sp, 4] | ||
217 | ld.ab r22, [sp, 4] | ||
218 | ld.ab r21, [sp, 4] | ||
219 | ld.ab r20, [sp, 4] | ||
220 | ld.ab r19, [sp, 4] | ||
221 | ld.ab r18, [sp, 4] | ||
222 | ld.ab r17, [sp, 4] | ||
223 | ld.ab r16, [sp, 4] | ||
224 | ld.ab r15, [sp, 4] | ||
225 | ld.ab r14, [sp, 4] | ||
226 | ld.ab r13, [sp, 4] | ||
227 | .endm | 217 | .endm |
228 | 218 | ||
229 | /*-------------------------------------------------------------- | 219 | /*-------------------------------------------------------------- |
230 | * Super FAST Restore callee saved regs by simply re-adjusting SP | 220 | * Super FAST Restore callee saved regs by simply re-adjusting SP |
231 | *-------------------------------------------------------------*/ | 221 | *-------------------------------------------------------------*/ |
232 | .macro DISCARD_CALLEE_SAVED_USER | 222 | .macro DISCARD_CALLEE_SAVED_USER |
233 | add sp, sp, 14 * 4 | 223 | add sp, sp, SZ_CALLEE_REGS |
234 | .endm | ||
235 | |||
236 | /*-------------------------------------------------------------- | ||
237 | * Restore User mode r25 saved in task_struct->thread.user_r25 | ||
238 | *-------------------------------------------------------------*/ | ||
239 | .macro RESTORE_USER_R25 | ||
240 | ld r25, [r25, TASK_THREAD + THREAD_USER_R25] | ||
241 | .endm | 224 | .endm |
242 | 225 | ||
243 | /*------------------------------------------------------------- | 226 | /*------------------------------------------------------------- |
@@ -252,7 +235,7 @@ | |||
252 | ld \out, [\tsk, TASK_THREAD_INFO] | 235 | ld \out, [\tsk, TASK_THREAD_INFO] |
253 | 236 | ||
254 | /* Go to end of page where stack begins (grows upwards) */ | 237 | /* Go to end of page where stack begins (grows upwards) */ |
255 | add2 \out, \out, (THREAD_SIZE - 4)/4 /* one word GUTTER */ | 238 | add2 \out, \out, (THREAD_SIZE)/4 |
256 | 239 | ||
257 | .endm | 240 | .endm |
258 | 241 | ||
@@ -305,33 +288,28 @@ | |||
305 | * safe-keeping not really needed, but it keeps the epilogue code | 288 | * safe-keeping not really needed, but it keeps the epilogue code |
306 | * (SP restore) simpler/uniform. | 289 | * (SP restore) simpler/uniform. |
307 | */ | 290 | */ |
308 | b.d 77f | 291 | b.d 66f |
309 | 292 | mov r9, sp | |
310 | st.a sp, [sp, -12] ; Make room for orig_r0 and orig_r8 | ||
311 | 293 | ||
312 | 88: /*------Intr/Ecxp happened in user mode, "switch" stack ------ */ | 294 | 88: /*------Intr/Ecxp happened in user mode, "switch" stack ------ */ |
313 | 295 | ||
314 | GET_CURR_TASK_ON_CPU r9 | 296 | GET_CURR_TASK_ON_CPU r9 |
315 | 297 | ||
316 | #ifdef CONFIG_ARC_CURR_IN_REG | ||
317 | |||
318 | /* If current task pointer cached in r25, time to | ||
319 | * -safekeep USER r25 in task->thread_struct->user_r25 | ||
320 | * -load r25 with current task ptr | ||
321 | */ | ||
322 | st.as r25, [r9, (TASK_THREAD + THREAD_USER_R25)/4] | ||
323 | mov r25, r9 | ||
324 | #endif | ||
325 | |||
326 | /* With current tsk in r9, get it's kernel mode stack base */ | 298 | /* With current tsk in r9, get it's kernel mode stack base */ |
327 | GET_TSK_STACK_BASE r9, r9 | 299 | GET_TSK_STACK_BASE r9, r9 |
328 | 300 | ||
329 | #ifdef PT_REGS_CANARY | 301 | 66: |
330 | st 0xabcdabcd, [r9, 0] | 302 | #ifdef CONFIG_ARC_CURR_IN_REG |
303 | /* | ||
304 | * Treat r25 as scratch reg, save it on stack first | ||
305 | * Load it with current task pointer | ||
306 | */ | ||
307 | st r25, [r9, -4] | ||
308 | GET_CURR_TASK_ON_CPU r25 | ||
331 | #endif | 309 | #endif |
332 | 310 | ||
333 | /* Save Pre Intr/Exception User SP on kernel stack */ | 311 | /* Save Pre Intr/Exception User SP on kernel stack */ |
334 | st.a sp, [r9, -12] ; Make room for orig_r0 and orig_r8 | 312 | st.a sp, [r9, -16] ; Make room for orig_r0, ECR, user_r25 |
335 | 313 | ||
336 | /* CAUTION: | 314 | /* CAUTION: |
337 | * SP should be set at the very end when we are done with everything | 315 | * SP should be set at the very end when we are done with everything |
@@ -342,7 +320,7 @@ | |||
342 | /* set SP to point to kernel mode stack */ | 320 | /* set SP to point to kernel mode stack */ |
343 | mov sp, r9 | 321 | mov sp, r9 |
344 | 322 | ||
345 | 77: /* ----- Stack Switched to kernel Mode, Now save REG FILE ----- */ | 323 | /* ----- Stack Switched to kernel Mode, Now save REG FILE ----- */ |
346 | 324 | ||
347 | .endm | 325 | .endm |
348 | 326 | ||
@@ -369,7 +347,7 @@ | |||
369 | * @reg [OUT] &thread_info of "current" | 347 | * @reg [OUT] &thread_info of "current" |
370 | */ | 348 | */ |
371 | .macro GET_CURR_THR_INFO_FROM_SP reg | 349 | .macro GET_CURR_THR_INFO_FROM_SP reg |
372 | and \reg, sp, ~(THREAD_SIZE - 1) | 350 | bic \reg, sp, (THREAD_SIZE - 1) |
373 | .endm | 351 | .endm |
374 | 352 | ||
375 | /* | 353 | /* |
@@ -413,62 +391,25 @@ | |||
413 | * Note that syscalls are implemented via TRAP which is also a exception | 391 | * Note that syscalls are implemented via TRAP which is also a exception |
414 | * from CPU's point of view | 392 | * from CPU's point of view |
415 | *-------------------------------------------------------------*/ | 393 | *-------------------------------------------------------------*/ |
416 | .macro SAVE_ALL_EXCEPTION marker | 394 | .macro SAVE_ALL_SYS |
417 | 395 | ||
418 | st \marker, [sp, 8] /* orig_r8 */ | 396 | lr r9, [ecr] |
397 | st r9, [sp, 8] /* ECR */ | ||
419 | st r0, [sp, 4] /* orig_r0, needed only for sys calls */ | 398 | st r0, [sp, 4] /* orig_r0, needed only for sys calls */ |
420 | 399 | ||
421 | /* Restore r9 used to code the early prologue */ | 400 | /* Restore r9 used to code the early prologue */ |
422 | EXCPN_PROLOG_RESTORE_REG r9 | 401 | EXCPN_PROLOG_RESTORE_REG r9 |
423 | 402 | ||
424 | SAVE_CALLER_SAVED | 403 | SAVE_R0_TO_R12 |
425 | st.a r26, [sp, -4] /* gp */ | 404 | PUSH gp |
426 | st.a fp, [sp, -4] | 405 | PUSH fp |
427 | st.a blink, [sp, -4] | 406 | PUSH blink |
428 | lr r9, [eret] | 407 | PUSHAX eret |
429 | st.a r9, [sp, -4] | 408 | PUSHAX erstatus |
430 | lr r9, [erstatus] | 409 | PUSH lp_count |
431 | st.a r9, [sp, -4] | 410 | PUSHAX lp_end |
432 | st.a lp_count, [sp, -4] | 411 | PUSHAX lp_start |
433 | lr r9, [lp_end] | 412 | PUSHAX erbta |
434 | st.a r9, [sp, -4] | ||
435 | lr r9, [lp_start] | ||
436 | st.a r9, [sp, -4] | ||
437 | lr r9, [erbta] | ||
438 | st.a r9, [sp, -4] | ||
439 | |||
440 | #ifdef PT_REGS_CANARY | ||
441 | mov r9, 0xdeadbeef | ||
442 | st r9, [sp, -4] | ||
443 | #endif | ||
444 | |||
445 | /* move up by 1 word to "create" pt_regs->"stack_place_holder" */ | ||
446 | sub sp, sp, 4 | ||
447 | .endm | ||
448 | |||
449 | /*-------------------------------------------------------------- | ||
450 | * Save scratch regs for exceptions | ||
451 | *-------------------------------------------------------------*/ | ||
452 | .macro SAVE_ALL_SYS | ||
453 | SAVE_ALL_EXCEPTION orig_r8_IS_EXCPN | ||
454 | .endm | ||
455 | |||
456 | /*-------------------------------------------------------------- | ||
457 | * Save scratch regs for sys calls | ||
458 | *-------------------------------------------------------------*/ | ||
459 | .macro SAVE_ALL_TRAP | ||
460 | /* | ||
461 | * Setup pt_regs->orig_r8. | ||
462 | * Encode syscall number (r8) in upper short word of event type (r9) | ||
463 | * N.B. #1: This is already endian safe (see ptrace.h) | ||
464 | * #2: Only r9 can be used as scratch as it is already clobbered | ||
465 | * and it's contents are no longer needed by the latter part | ||
466 | * of exception prologue | ||
467 | */ | ||
468 | lsl r9, r8, 16 | ||
469 | or r9, r9, orig_r8_IS_SCALL | ||
470 | |||
471 | SAVE_ALL_EXCEPTION r9 | ||
472 | .endm | 413 | .endm |
473 | 414 | ||
474 | /*-------------------------------------------------------------- | 415 | /*-------------------------------------------------------------- |
@@ -483,28 +424,22 @@ | |||
483 | * by hardware and that is not good. | 424 | * by hardware and that is not good. |
484 | *-------------------------------------------------------------*/ | 425 | *-------------------------------------------------------------*/ |
485 | .macro RESTORE_ALL_SYS | 426 | .macro RESTORE_ALL_SYS |
427 | POPAX erbta | ||
428 | POPAX lp_start | ||
429 | POPAX lp_end | ||
430 | |||
431 | POP r9 | ||
432 | mov lp_count, r9 ;LD to lp_count is not allowed | ||
486 | 433 | ||
487 | add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ | 434 | POPAX erstatus |
488 | 435 | POPAX eret | |
489 | ld.ab r9, [sp, 4] | 436 | POP blink |
490 | sr r9, [erbta] | 437 | POP fp |
491 | ld.ab r9, [sp, 4] | 438 | POP gp |
492 | sr r9, [lp_start] | 439 | RESTORE_R12_TO_R0 |
493 | ld.ab r9, [sp, 4] | ||
494 | sr r9, [lp_end] | ||
495 | ld.ab r9, [sp, 4] | ||
496 | mov lp_count, r9 | ||
497 | ld.ab r9, [sp, 4] | ||
498 | sr r9, [erstatus] | ||
499 | ld.ab r9, [sp, 4] | ||
500 | sr r9, [eret] | ||
501 | ld.ab blink, [sp, 4] | ||
502 | ld.ab fp, [sp, 4] | ||
503 | ld.ab r26, [sp, 4] /* gp */ | ||
504 | RESTORE_CALLER_SAVED | ||
505 | 440 | ||
506 | ld sp, [sp] /* restore original sp */ | 441 | ld sp, [sp] /* restore original sp */ |
507 | /* orig_r0 and orig_r8 skipped automatically */ | 442 | /* orig_r0, ECR, user_r25 skipped automatically */ |
508 | .endm | 443 | .endm |
509 | 444 | ||
510 | 445 | ||
@@ -513,9 +448,7 @@ | |||
513 | *-------------------------------------------------------------*/ | 448 | *-------------------------------------------------------------*/ |
514 | .macro SAVE_ALL_INT1 | 449 | .macro SAVE_ALL_INT1 |
515 | 450 | ||
516 | /* restore original r9 , saved in int1_saved_reg | 451 | /* restore original r9 to be saved as part of reg-file */ |
517 | * It will be saved on stack in macro: SAVE_CALLER_SAVED | ||
518 | */ | ||
519 | #ifdef CONFIG_SMP | 452 | #ifdef CONFIG_SMP |
520 | lr r9, [ARC_REG_SCRATCH_DATA0] | 453 | lr r9, [ARC_REG_SCRATCH_DATA0] |
521 | #else | 454 | #else |
@@ -523,29 +456,19 @@ | |||
523 | #endif | 456 | #endif |
524 | 457 | ||
525 | /* now we are ready to save the remaining context :) */ | 458 | /* now we are ready to save the remaining context :) */ |
526 | st orig_r8_IS_IRQ1, [sp, 8] /* Event Type */ | 459 | st event_IRQ1, [sp, 8] /* Dummy ECR */ |
527 | st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ | 460 | st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ |
528 | SAVE_CALLER_SAVED | 461 | |
529 | st.a r26, [sp, -4] /* gp */ | 462 | SAVE_R0_TO_R12 |
530 | st.a fp, [sp, -4] | 463 | PUSH gp |
531 | st.a blink, [sp, -4] | 464 | PUSH fp |
532 | st.a ilink1, [sp, -4] | 465 | PUSH blink |
533 | lr r9, [status32_l1] | 466 | PUSH ilink1 |
534 | st.a r9, [sp, -4] | 467 | PUSHAX status32_l1 |
535 | st.a lp_count, [sp, -4] | 468 | PUSH lp_count |
536 | lr r9, [lp_end] | 469 | PUSHAX lp_end |
537 | st.a r9, [sp, -4] | 470 | PUSHAX lp_start |
538 | lr r9, [lp_start] | 471 | PUSHAX bta_l1 |
539 | st.a r9, [sp, -4] | ||
540 | lr r9, [bta_l1] | ||
541 | st.a r9, [sp, -4] | ||
542 | |||
543 | #ifdef PT_REGS_CANARY | ||
544 | mov r9, 0xdeadbee1 | ||
545 | st r9, [sp, -4] | ||
546 | #endif | ||
547 | /* move up by 1 word to "create" pt_regs->"stack_place_holder" */ | ||
548 | sub sp, sp, 4 | ||
549 | .endm | 472 | .endm |
550 | 473 | ||
551 | .macro SAVE_ALL_INT2 | 474 | .macro SAVE_ALL_INT2 |
@@ -558,30 +481,19 @@ | |||
558 | ld r9, [@int2_saved_reg] | 481 | ld r9, [@int2_saved_reg] |
559 | 482 | ||
560 | /* now we are ready to save the remaining context :) */ | 483 | /* now we are ready to save the remaining context :) */ |
561 | st orig_r8_IS_IRQ2, [sp, 8] /* Event Type */ | 484 | st event_IRQ2, [sp, 8] /* Dummy ECR */ |
562 | st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ | 485 | st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ |
563 | SAVE_CALLER_SAVED | ||
564 | st.a r26, [sp, -4] /* gp */ | ||
565 | st.a fp, [sp, -4] | ||
566 | st.a blink, [sp, -4] | ||
567 | st.a ilink2, [sp, -4] | ||
568 | lr r9, [status32_l2] | ||
569 | st.a r9, [sp, -4] | ||
570 | st.a lp_count, [sp, -4] | ||
571 | lr r9, [lp_end] | ||
572 | st.a r9, [sp, -4] | ||
573 | lr r9, [lp_start] | ||
574 | st.a r9, [sp, -4] | ||
575 | lr r9, [bta_l2] | ||
576 | st.a r9, [sp, -4] | ||
577 | |||
578 | #ifdef PT_REGS_CANARY | ||
579 | mov r9, 0xdeadbee2 | ||
580 | st r9, [sp, -4] | ||
581 | #endif | ||
582 | 486 | ||
583 | /* move up by 1 word to "create" pt_regs->"stack_place_holder" */ | 487 | SAVE_R0_TO_R12 |
584 | sub sp, sp, 4 | 488 | PUSH gp |
489 | PUSH fp | ||
490 | PUSH blink | ||
491 | PUSH ilink2 | ||
492 | PUSHAX status32_l2 | ||
493 | PUSH lp_count | ||
494 | PUSHAX lp_end | ||
495 | PUSHAX lp_start | ||
496 | PUSHAX bta_l2 | ||
585 | .endm | 497 | .endm |
586 | 498 | ||
587 | /*-------------------------------------------------------------- | 499 | /*-------------------------------------------------------------- |
@@ -595,52 +507,41 @@ | |||
595 | *-------------------------------------------------------------*/ | 507 | *-------------------------------------------------------------*/ |
596 | 508 | ||
597 | .macro RESTORE_ALL_INT1 | 509 | .macro RESTORE_ALL_INT1 |
598 | add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ | 510 | POPAX bta_l1 |
599 | 511 | POPAX lp_start | |
600 | ld.ab r9, [sp, 4] /* Actual reg file */ | 512 | POPAX lp_end |
601 | sr r9, [bta_l1] | 513 | |
602 | ld.ab r9, [sp, 4] | 514 | POP r9 |
603 | sr r9, [lp_start] | 515 | mov lp_count, r9 ;LD to lp_count is not allowed |
604 | ld.ab r9, [sp, 4] | 516 | |
605 | sr r9, [lp_end] | 517 | POPAX status32_l1 |
606 | ld.ab r9, [sp, 4] | 518 | POP ilink1 |
607 | mov lp_count, r9 | 519 | POP blink |
608 | ld.ab r9, [sp, 4] | 520 | POP fp |
609 | sr r9, [status32_l1] | 521 | POP gp |
610 | ld.ab r9, [sp, 4] | 522 | RESTORE_R12_TO_R0 |
611 | mov ilink1, r9 | ||
612 | ld.ab blink, [sp, 4] | ||
613 | ld.ab fp, [sp, 4] | ||
614 | ld.ab r26, [sp, 4] /* gp */ | ||
615 | RESTORE_CALLER_SAVED | ||
616 | 523 | ||
617 | ld sp, [sp] /* restore original sp */ | 524 | ld sp, [sp] /* restore original sp */ |
618 | /* orig_r0 and orig_r8 skipped automatically */ | 525 | /* orig_r0, ECR, user_r25 skipped automatically */ |
619 | .endm | 526 | .endm |
620 | 527 | ||
621 | .macro RESTORE_ALL_INT2 | 528 | .macro RESTORE_ALL_INT2 |
622 | add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ | 529 | POPAX bta_l2 |
623 | 530 | POPAX lp_start | |
624 | ld.ab r9, [sp, 4] | 531 | POPAX lp_end |
625 | sr r9, [bta_l2] | ||
626 | ld.ab r9, [sp, 4] | ||
627 | sr r9, [lp_start] | ||
628 | ld.ab r9, [sp, 4] | ||
629 | sr r9, [lp_end] | ||
630 | ld.ab r9, [sp, 4] | ||
631 | mov lp_count, r9 | ||
632 | ld.ab r9, [sp, 4] | ||
633 | sr r9, [status32_l2] | ||
634 | ld.ab r9, [sp, 4] | ||
635 | mov ilink2, r9 | ||
636 | ld.ab blink, [sp, 4] | ||
637 | ld.ab fp, [sp, 4] | ||
638 | ld.ab r26, [sp, 4] /* gp */ | ||
639 | RESTORE_CALLER_SAVED | ||
640 | 532 | ||
641 | ld sp, [sp] /* restore original sp */ | 533 | POP r9 |
642 | /* orig_r0 and orig_r8 skipped automatically */ | 534 | mov lp_count, r9 ;LD to lp_count is not allowed |
643 | 535 | ||
536 | POPAX status32_l2 | ||
537 | POP ilink2 | ||
538 | POP blink | ||
539 | POP fp | ||
540 | POP gp | ||
541 | RESTORE_R12_TO_R0 | ||
542 | |||
543 | ld sp, [sp] /* restore original sp */ | ||
544 | /* orig_r0, ECR, user_r25 skipped automatically */ | ||
644 | .endm | 545 | .endm |
645 | 546 | ||
646 | 547 | ||
diff --git a/arch/arc/include/asm/irq.h b/arch/arc/include/asm/irq.h index 57898a17eb82..c0a72105ee0b 100644 --- a/arch/arc/include/asm/irq.h +++ b/arch/arc/include/asm/irq.h | |||
@@ -21,6 +21,6 @@ | |||
21 | extern void __init arc_init_IRQ(void); | 21 | extern void __init arc_init_IRQ(void); |
22 | extern int __init get_hw_config_num_irq(void); | 22 | extern int __init get_hw_config_num_irq(void); |
23 | 23 | ||
24 | void __cpuinit arc_local_timer_setup(unsigned int cpu); | 24 | void arc_local_timer_setup(unsigned int cpu); |
25 | 25 | ||
26 | #endif | 26 | #endif |
diff --git a/arch/arc/include/asm/irqflags.h b/arch/arc/include/asm/irqflags.h index eac071668201..d99f79bcf865 100644 --- a/arch/arc/include/asm/irqflags.h +++ b/arch/arc/include/asm/irqflags.h | |||
@@ -19,6 +19,26 @@ | |||
19 | 19 | ||
20 | #include <asm/arcregs.h> | 20 | #include <asm/arcregs.h> |
21 | 21 | ||
22 | /* status32 Reg bits related to Interrupt Handling */ | ||
23 | #define STATUS_E1_BIT 1 /* Int 1 enable */ | ||
24 | #define STATUS_E2_BIT 2 /* Int 2 enable */ | ||
25 | #define STATUS_A1_BIT 3 /* Int 1 active */ | ||
26 | #define STATUS_A2_BIT 4 /* Int 2 active */ | ||
27 | |||
28 | #define STATUS_E1_MASK (1<<STATUS_E1_BIT) | ||
29 | #define STATUS_E2_MASK (1<<STATUS_E2_BIT) | ||
30 | #define STATUS_A1_MASK (1<<STATUS_A1_BIT) | ||
31 | #define STATUS_A2_MASK (1<<STATUS_A2_BIT) | ||
32 | |||
33 | /* Other Interrupt Handling related Aux regs */ | ||
34 | #define AUX_IRQ_LEV 0x200 /* IRQ Priority: L1 or L2 */ | ||
35 | #define AUX_IRQ_HINT 0x201 /* For generating Soft Interrupts */ | ||
36 | #define AUX_IRQ_LV12 0x43 /* interrupt level register */ | ||
37 | |||
38 | #define AUX_IENABLE 0x40c | ||
39 | #define AUX_ITRIGGER 0x40d | ||
40 | #define AUX_IPULSE 0x415 | ||
41 | |||
22 | #ifndef __ASSEMBLY__ | 42 | #ifndef __ASSEMBLY__ |
23 | 43 | ||
24 | /****************************************************************** | 44 | /****************************************************************** |
diff --git a/arch/arc/include/asm/kgdb.h b/arch/arc/include/asm/kgdb.h index 4930957ca3d3..b65fca7ffeb5 100644 --- a/arch/arc/include/asm/kgdb.h +++ b/arch/arc/include/asm/kgdb.h | |||
@@ -31,7 +31,7 @@ static inline void arch_kgdb_breakpoint(void) | |||
31 | __asm__ __volatile__ ("trap_s 0x4\n"); | 31 | __asm__ __volatile__ ("trap_s 0x4\n"); |
32 | } | 32 | } |
33 | 33 | ||
34 | extern void kgdb_trap(struct pt_regs *regs, int param); | 34 | extern void kgdb_trap(struct pt_regs *regs); |
35 | 35 | ||
36 | enum arc700_linux_regnums { | 36 | enum arc700_linux_regnums { |
37 | _R0 = 0, | 37 | _R0 = 0, |
@@ -53,7 +53,7 @@ enum arc700_linux_regnums { | |||
53 | }; | 53 | }; |
54 | 54 | ||
55 | #else | 55 | #else |
56 | #define kgdb_trap(regs, param) | 56 | #define kgdb_trap(regs) |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #endif /* __ARC_KGDB_H__ */ | 59 | #endif /* __ARC_KGDB_H__ */ |
diff --git a/arch/arc/include/asm/kprobes.h b/arch/arc/include/asm/kprobes.h index 4d9c211fce70..944dbedb38b5 100644 --- a/arch/arc/include/asm/kprobes.h +++ b/arch/arc/include/asm/kprobes.h | |||
@@ -50,11 +50,9 @@ struct kprobe_ctlblk { | |||
50 | 50 | ||
51 | int kprobe_fault_handler(struct pt_regs *regs, unsigned long cause); | 51 | int kprobe_fault_handler(struct pt_regs *regs, unsigned long cause); |
52 | void kretprobe_trampoline(void); | 52 | void kretprobe_trampoline(void); |
53 | void trap_is_kprobe(unsigned long cause, unsigned long address, | 53 | void trap_is_kprobe(unsigned long address, struct pt_regs *regs); |
54 | struct pt_regs *regs); | ||
55 | #else | 54 | #else |
56 | static void trap_is_kprobe(unsigned long cause, unsigned long address, | 55 | static void trap_is_kprobe(unsigned long address, struct pt_regs *regs) |
57 | struct pt_regs *regs) | ||
58 | { | 56 | { |
59 | } | 57 | } |
60 | #endif | 58 | #endif |
diff --git a/arch/arc/include/asm/mmu.h b/arch/arc/include/asm/mmu.h index 56b02320f1a9..7c03fe61759c 100644 --- a/arch/arc/include/asm/mmu.h +++ b/arch/arc/include/asm/mmu.h | |||
@@ -9,6 +9,40 @@ | |||
9 | #ifndef _ASM_ARC_MMU_H | 9 | #ifndef _ASM_ARC_MMU_H |
10 | #define _ASM_ARC_MMU_H | 10 | #define _ASM_ARC_MMU_H |
11 | 11 | ||
12 | #if defined(CONFIG_ARC_MMU_V1) | ||
13 | #define CONFIG_ARC_MMU_VER 1 | ||
14 | #elif defined(CONFIG_ARC_MMU_V2) | ||
15 | #define CONFIG_ARC_MMU_VER 2 | ||
16 | #elif defined(CONFIG_ARC_MMU_V3) | ||
17 | #define CONFIG_ARC_MMU_VER 3 | ||
18 | #endif | ||
19 | |||
20 | /* MMU Management regs */ | ||
21 | #define ARC_REG_MMU_BCR 0x06f | ||
22 | #define ARC_REG_TLBPD0 0x405 | ||
23 | #define ARC_REG_TLBPD1 0x406 | ||
24 | #define ARC_REG_TLBINDEX 0x407 | ||
25 | #define ARC_REG_TLBCOMMAND 0x408 | ||
26 | #define ARC_REG_PID 0x409 | ||
27 | #define ARC_REG_SCRATCH_DATA0 0x418 | ||
28 | |||
29 | /* Bits in MMU PID register */ | ||
30 | #define MMU_ENABLE (1 << 31) /* Enable MMU for process */ | ||
31 | |||
32 | /* Error code if probe fails */ | ||
33 | #define TLB_LKUP_ERR 0x80000000 | ||
34 | |||
35 | /* TLB Commands */ | ||
36 | #define TLBWrite 0x1 | ||
37 | #define TLBRead 0x2 | ||
38 | #define TLBGetIndex 0x3 | ||
39 | #define TLBProbe 0x4 | ||
40 | |||
41 | #if (CONFIG_ARC_MMU_VER >= 2) | ||
42 | #define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */ | ||
43 | #define TLBIVUTLB 0x6 /* explicitly inv uTLBs */ | ||
44 | #endif | ||
45 | |||
12 | #ifndef __ASSEMBLY__ | 46 | #ifndef __ASSEMBLY__ |
13 | 47 | ||
14 | typedef struct { | 48 | typedef struct { |
@@ -18,6 +52,16 @@ typedef struct { | |||
18 | #endif | 52 | #endif |
19 | } mm_context_t; | 53 | } mm_context_t; |
20 | 54 | ||
55 | #ifdef CONFIG_ARC_DBG_TLB_PARANOIA | ||
56 | void tlb_paranoid_check(unsigned int pid_sw, unsigned long address); | ||
57 | #else | ||
58 | #define tlb_paranoid_check(a, b) | ||
21 | #endif | 59 | #endif |
22 | 60 | ||
61 | void arc_mmu_init(void); | ||
62 | extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len); | ||
63 | void __init read_decode_mmu_bcr(void); | ||
64 | |||
65 | #endif /* !__ASSEMBLY__ */ | ||
66 | |||
23 | #endif | 67 | #endif |
diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h index ab84bf131fe1..9c8aa41e45c2 100644 --- a/arch/arc/include/asm/page.h +++ b/arch/arc/include/asm/page.h | |||
@@ -96,13 +96,8 @@ typedef unsigned long pgtable_t; | |||
96 | 96 | ||
97 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 97 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
98 | 98 | ||
99 | /* Default Permissions for page, used in mmap.c */ | 99 | /* Default Permissions for stack/heaps pages (Non Executable) */ |
100 | #ifdef CONFIG_ARC_STACK_NONEXEC | ||
101 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE) | 100 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE) |
102 | #else | ||
103 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
104 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
105 | #endif | ||
106 | 101 | ||
107 | #define WANT_PAGE_VIRTUAL 1 | 102 | #define WANT_PAGE_VIRTUAL 1 |
108 | 103 | ||
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h index c110ac87d22b..4749a0eee1cf 100644 --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h | |||
@@ -135,6 +135,12 @@ | |||
135 | /* ioremap */ | 135 | /* ioremap */ |
136 | #define PAGE_KERNEL_NO_CACHE __pgprot(_K_PAGE_PERMS) | 136 | #define PAGE_KERNEL_NO_CACHE __pgprot(_K_PAGE_PERMS) |
137 | 137 | ||
138 | /* Masks for actual TLB "PD"s */ | ||
139 | #define PTE_BITS_IN_PD0 (_PAGE_GLOBAL | _PAGE_PRESENT) | ||
140 | #define PTE_BITS_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE | \ | ||
141 | _PAGE_U_EXECUTE | _PAGE_U_WRITE | _PAGE_U_READ | \ | ||
142 | _PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ) | ||
143 | |||
138 | /************************************************************************** | 144 | /************************************************************************** |
139 | * Mapping of vm_flags (Generic VM) to PTE flags (arch specific) | 145 | * Mapping of vm_flags (Generic VM) to PTE flags (arch specific) |
140 | * | 146 | * |
diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h index 5f26b2c1cba0..15334ab66b56 100644 --- a/arch/arc/include/asm/processor.h +++ b/arch/arc/include/asm/processor.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifndef __ASSEMBLY__ | 19 | #ifndef __ASSEMBLY__ |
20 | 20 | ||
21 | #include <asm/arcregs.h> /* for STATUS_E1_MASK et all */ | 21 | #include <asm/arcregs.h> /* for STATUS_E1_MASK et all */ |
22 | #include <asm/ptrace.h> | ||
22 | 23 | ||
23 | /* Arch specific stuff which needs to be saved per task. | 24 | /* Arch specific stuff which needs to be saved per task. |
24 | * However these items are not so important so as to earn a place in | 25 | * However these items are not so important so as to earn a place in |
@@ -28,10 +29,6 @@ struct thread_struct { | |||
28 | unsigned long ksp; /* kernel mode stack pointer */ | 29 | unsigned long ksp; /* kernel mode stack pointer */ |
29 | unsigned long callee_reg; /* pointer to callee regs */ | 30 | unsigned long callee_reg; /* pointer to callee regs */ |
30 | unsigned long fault_address; /* dbls as brkpt holder as well */ | 31 | unsigned long fault_address; /* dbls as brkpt holder as well */ |
31 | unsigned long cause_code; /* Exception Cause Code (ECR) */ | ||
32 | #ifdef CONFIG_ARC_CURR_IN_REG | ||
33 | unsigned long user_r25; | ||
34 | #endif | ||
35 | #ifdef CONFIG_ARC_FPU_SAVE_RESTORE | 32 | #ifdef CONFIG_ARC_FPU_SAVE_RESTORE |
36 | struct arc_fpu fpu; | 33 | struct arc_fpu fpu; |
37 | #endif | 34 | #endif |
@@ -50,7 +47,7 @@ struct task_struct; | |||
50 | unsigned long thread_saved_pc(struct task_struct *t); | 47 | unsigned long thread_saved_pc(struct task_struct *t); |
51 | 48 | ||
52 | #define task_pt_regs(p) \ | 49 | #define task_pt_regs(p) \ |
53 | ((struct pt_regs *)(THREAD_SIZE - 4 + (void *)task_stack_page(p)) - 1) | 50 | ((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1) |
54 | 51 | ||
55 | /* Free all resources held by a thread. */ | 52 | /* Free all resources held by a thread. */ |
56 | #define release_thread(thread) do { } while (0) | 53 | #define release_thread(thread) do { } while (0) |
@@ -75,11 +72,15 @@ unsigned long thread_saved_pc(struct task_struct *t); | |||
75 | 72 | ||
76 | /* | 73 | /* |
77 | * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode. | 74 | * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode. |
78 | * These can't be derived from pt_regs as that would give correp user-mode val | 75 | * Look in process.c for details of kernel stack layout |
79 | */ | 76 | */ |
80 | #define KSTK_ESP(tsk) (tsk->thread.ksp) | 77 | #define KSTK_ESP(tsk) (tsk->thread.ksp) |
81 | #define KSTK_BLINK(tsk) (*((unsigned int *)((KSTK_ESP(tsk)) + (13+1+1)*4))) | 78 | |
82 | #define KSTK_FP(tsk) (*((unsigned int *)((KSTK_ESP(tsk)) + (13+1)*4))) | 79 | #define KSTK_REG(tsk, off) (*((unsigned int *)(KSTK_ESP(tsk) + \ |
80 | sizeof(struct callee_regs) + off))) | ||
81 | |||
82 | #define KSTK_BLINK(tsk) KSTK_REG(tsk, 4) | ||
83 | #define KSTK_FP(tsk) KSTK_REG(tsk, 0) | ||
83 | 84 | ||
84 | /* | 85 | /* |
85 | * Do necessary setup to start up a newly executed thread. | 86 | * Do necessary setup to start up a newly executed thread. |
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h index 6179de7e07c2..c9938e7a7dbd 100644 --- a/arch/arc/include/asm/ptrace.h +++ b/arch/arc/include/asm/ptrace.h | |||
@@ -17,12 +17,6 @@ | |||
17 | /* THE pt_regs: Defines how regs are saved during entry into kernel */ | 17 | /* THE pt_regs: Defines how regs are saved during entry into kernel */ |
18 | 18 | ||
19 | struct pt_regs { | 19 | struct pt_regs { |
20 | /* | ||
21 | * 1 word gutter after reg-file has been saved | ||
22 | * Technically not needed, Since SP always points to a "full" location | ||
23 | * (vs. "empty"). But pt_regs is shared with tools.... | ||
24 | */ | ||
25 | long res; | ||
26 | 20 | ||
27 | /* Real registers */ | 21 | /* Real registers */ |
28 | long bta; /* bta_l1, bta_l2, erbta */ | 22 | long bta; /* bta_l1, bta_l2, erbta */ |
@@ -50,22 +44,32 @@ struct pt_regs { | |||
50 | long sp; /* user/kernel sp depending on where we came from */ | 44 | long sp; /* user/kernel sp depending on where we came from */ |
51 | long orig_r0; | 45 | long orig_r0; |
52 | 46 | ||
53 | /*to distinguish bet excp, syscall, irq */ | 47 | /* |
48 | * To distinguish bet excp, syscall, irq | ||
49 | * For traps and exceptions, Exception Cause Register. | ||
50 | * ECR: <00> <VV> <CC> <PP> | ||
51 | * Last word used by Linux for extra state mgmt (syscall-restart) | ||
52 | * For interrupts, use artificial ECR values to note current prio-level | ||
53 | */ | ||
54 | union { | 54 | union { |
55 | struct { | ||
55 | #ifdef CONFIG_CPU_BIG_ENDIAN | 56 | #ifdef CONFIG_CPU_BIG_ENDIAN |
56 | /* so that assembly code is same for LE/BE */ | 57 | unsigned long state:8, ecr_vec:8, |
57 | unsigned long orig_r8:16, event:16; | 58 | ecr_cause:8, ecr_param:8; |
58 | #else | 59 | #else |
59 | unsigned long event:16, orig_r8:16; | 60 | unsigned long ecr_param:8, ecr_cause:8, |
61 | ecr_vec:8, state:8; | ||
60 | #endif | 62 | #endif |
61 | long orig_r8_word; | 63 | }; |
64 | unsigned long event; | ||
62 | }; | 65 | }; |
66 | |||
67 | long user_r25; | ||
63 | }; | 68 | }; |
64 | 69 | ||
65 | /* Callee saved registers - need to be saved only when you are scheduled out */ | 70 | /* Callee saved registers - need to be saved only when you are scheduled out */ |
66 | 71 | ||
67 | struct callee_regs { | 72 | struct callee_regs { |
68 | long res; /* Again this is not needed */ | ||
69 | long r25; | 73 | long r25; |
70 | long r24; | 74 | long r24; |
71 | long r23; | 75 | long r23; |
@@ -99,18 +103,20 @@ struct callee_regs { | |||
99 | /* return 1 if PC in delay slot */ | 103 | /* return 1 if PC in delay slot */ |
100 | #define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK) | 104 | #define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK) |
101 | 105 | ||
102 | #define in_syscall(regs) (regs->event & orig_r8_IS_SCALL) | 106 | #define in_syscall(regs) ((regs->ecr_vec == ECR_V_TRAP) && !regs->ecr_param) |
103 | #define in_brkpt_trap(regs) (regs->event & orig_r8_IS_BRKPT) | 107 | #define in_brkpt_trap(regs) ((regs->ecr_vec == ECR_V_TRAP) && regs->ecr_param) |
108 | |||
109 | #define STATE_SCALL_RESTARTED 0x01 | ||
104 | 110 | ||
105 | #define syscall_wont_restart(regs) (regs->event |= orig_r8_IS_SCALL_RESTARTED) | 111 | #define syscall_wont_restart(reg) (reg->state |= STATE_SCALL_RESTARTED) |
106 | #define syscall_restartable(regs) !(regs->event & orig_r8_IS_SCALL_RESTARTED) | 112 | #define syscall_restartable(reg) !(reg->state & STATE_SCALL_RESTARTED) |
107 | 113 | ||
108 | #define current_pt_regs() \ | 114 | #define current_pt_regs() \ |
109 | ({ \ | 115 | ({ \ |
110 | /* open-coded current_thread_info() */ \ | 116 | /* open-coded current_thread_info() */ \ |
111 | register unsigned long sp asm ("sp"); \ | 117 | register unsigned long sp asm ("sp"); \ |
112 | unsigned long pg_start = (sp & ~(THREAD_SIZE - 1)); \ | 118 | unsigned long pg_start = (sp & ~(THREAD_SIZE - 1)); \ |
113 | (struct pt_regs *)(pg_start + THREAD_SIZE - 4) - 1; \ | 119 | (struct pt_regs *)(pg_start + THREAD_SIZE) - 1; \ |
114 | }) | 120 | }) |
115 | 121 | ||
116 | static inline long regs_return_value(struct pt_regs *regs) | 122 | static inline long regs_return_value(struct pt_regs *regs) |
@@ -120,11 +126,4 @@ static inline long regs_return_value(struct pt_regs *regs) | |||
120 | 126 | ||
121 | #endif /* !__ASSEMBLY__ */ | 127 | #endif /* !__ASSEMBLY__ */ |
122 | 128 | ||
123 | #define orig_r8_IS_SCALL 0x0001 | ||
124 | #define orig_r8_IS_SCALL_RESTARTED 0x0002 | ||
125 | #define orig_r8_IS_BRKPT 0x0004 | ||
126 | #define orig_r8_IS_EXCPN 0x0008 | ||
127 | #define orig_r8_IS_IRQ1 0x0010 | ||
128 | #define orig_r8_IS_IRQ2 0x0020 | ||
129 | |||
130 | #endif /* __ASM_PTRACE_H */ | 129 | #endif /* __ASM_PTRACE_H */ |
diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h index 33ab3048e9b2..29de09804306 100644 --- a/arch/arc/include/asm/syscall.h +++ b/arch/arc/include/asm/syscall.h | |||
@@ -18,7 +18,7 @@ static inline long | |||
18 | syscall_get_nr(struct task_struct *task, struct pt_regs *regs) | 18 | syscall_get_nr(struct task_struct *task, struct pt_regs *regs) |
19 | { | 19 | { |
20 | if (user_mode(regs) && in_syscall(regs)) | 20 | if (user_mode(regs) && in_syscall(regs)) |
21 | return regs->orig_r8; | 21 | return regs->r8; |
22 | else | 22 | else |
23 | return -1; | 23 | return -1; |
24 | } | 24 | } |
@@ -26,8 +26,7 @@ syscall_get_nr(struct task_struct *task, struct pt_regs *regs) | |||
26 | static inline void | 26 | static inline void |
27 | syscall_rollback(struct task_struct *task, struct pt_regs *regs) | 27 | syscall_rollback(struct task_struct *task, struct pt_regs *regs) |
28 | { | 28 | { |
29 | /* XXX: I can't fathom how pt_regs->r8 will be clobbered ? */ | 29 | regs->r0 = regs->orig_r0; |
30 | regs->r8 = regs->orig_r8; | ||
31 | } | 30 | } |
32 | 31 | ||
33 | static inline long | 32 | static inline long |
diff --git a/arch/arc/include/asm/tlb-mmu1.h b/arch/arc/include/asm/tlb-mmu1.h index a5ff961b1efc..8a1ec96012ae 100644 --- a/arch/arc/include/asm/tlb-mmu1.h +++ b/arch/arc/include/asm/tlb-mmu1.h | |||
@@ -9,9 +9,9 @@ | |||
9 | #ifndef __ASM_TLB_MMU_V1_H__ | 9 | #ifndef __ASM_TLB_MMU_V1_H__ |
10 | #define __ASM_TLB_MMU_V1_H__ | 10 | #define __ASM_TLB_MMU_V1_H__ |
11 | 11 | ||
12 | #if defined(__ASSEMBLY__) && defined(CONFIG_ARC_MMU_VER == 1) | 12 | #include <asm/mmu.h> |
13 | 13 | ||
14 | #include <asm/tlb.h> | 14 | #if defined(__ASSEMBLY__) && (CONFIG_ARC_MMU_VER == 1) |
15 | 15 | ||
16 | .macro TLB_WRITE_HEURISTICS | 16 | .macro TLB_WRITE_HEURISTICS |
17 | 17 | ||
diff --git a/arch/arc/include/asm/tlb.h b/arch/arc/include/asm/tlb.h index cb0c708ca665..a9db5f62aaf3 100644 --- a/arch/arc/include/asm/tlb.h +++ b/arch/arc/include/asm/tlb.h | |||
@@ -9,18 +9,6 @@ | |||
9 | #ifndef _ASM_ARC_TLB_H | 9 | #ifndef _ASM_ARC_TLB_H |
10 | #define _ASM_ARC_TLB_H | 10 | #define _ASM_ARC_TLB_H |
11 | 11 | ||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #include <asm/pgtable.h> | ||
15 | |||
16 | /* Masks for actual TLB "PD"s */ | ||
17 | #define PTE_BITS_IN_PD0 (_PAGE_GLOBAL | _PAGE_PRESENT) | ||
18 | #define PTE_BITS_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE | \ | ||
19 | _PAGE_U_EXECUTE | _PAGE_U_WRITE | _PAGE_U_READ | \ | ||
20 | _PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ) | ||
21 | |||
22 | #ifndef __ASSEMBLY__ | ||
23 | |||
24 | #define tlb_flush(tlb) \ | 12 | #define tlb_flush(tlb) \ |
25 | do { \ | 13 | do { \ |
26 | if (tlb->fullmm) \ | 14 | if (tlb->fullmm) \ |
@@ -56,18 +44,4 @@ do { \ | |||
56 | #include <linux/pagemap.h> | 44 | #include <linux/pagemap.h> |
57 | #include <asm-generic/tlb.h> | 45 | #include <asm-generic/tlb.h> |
58 | 46 | ||
59 | #ifdef CONFIG_ARC_DBG_TLB_PARANOIA | ||
60 | void tlb_paranoid_check(unsigned int pid_sw, unsigned long address); | ||
61 | #else | ||
62 | #define tlb_paranoid_check(a, b) | ||
63 | #endif | ||
64 | |||
65 | void arc_mmu_init(void); | ||
66 | extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len); | ||
67 | void __init read_decode_mmu_bcr(void); | ||
68 | |||
69 | #endif /* __ASSEMBLY__ */ | ||
70 | |||
71 | #endif /* __KERNEL__ */ | ||
72 | |||
73 | #endif /* _ASM_ARC_TLB_H */ | 47 | #endif /* _ASM_ARC_TLB_H */ |
diff --git a/arch/arc/include/asm/unaligned.h b/arch/arc/include/asm/unaligned.h index 5dbe63f17b66..60702f3751d2 100644 --- a/arch/arc/include/asm/unaligned.h +++ b/arch/arc/include/asm/unaligned.h | |||
@@ -16,11 +16,11 @@ | |||
16 | 16 | ||
17 | #ifdef CONFIG_ARC_MISALIGN_ACCESS | 17 | #ifdef CONFIG_ARC_MISALIGN_ACCESS |
18 | int misaligned_fixup(unsigned long address, struct pt_regs *regs, | 18 | int misaligned_fixup(unsigned long address, struct pt_regs *regs, |
19 | unsigned long cause, struct callee_regs *cregs); | 19 | struct callee_regs *cregs); |
20 | #else | 20 | #else |
21 | static inline int | 21 | static inline int |
22 | misaligned_fixup(unsigned long address, struct pt_regs *regs, | 22 | misaligned_fixup(unsigned long address, struct pt_regs *regs, |
23 | unsigned long cause, struct callee_regs *cregs) | 23 | struct callee_regs *cregs) |
24 | { | 24 | { |
25 | return 0; | 25 | return 0; |
26 | } | 26 | } |
diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h index 30333cec0fef..2618cc13ba75 100644 --- a/arch/arc/include/uapi/asm/ptrace.h +++ b/arch/arc/include/uapi/asm/ptrace.h | |||
@@ -20,28 +20,31 @@ | |||
20 | * | 20 | * |
21 | * This is to decouple pt_regs from user-space ABI, to be able to change it | 21 | * This is to decouple pt_regs from user-space ABI, to be able to change it |
22 | * w/o affecting the ABI. | 22 | * w/o affecting the ABI. |
23 | * Although the layout (initial padding) is similar to pt_regs to have some | 23 | * |
24 | * optimizations when copying pt_regs to/from user_regs_struct. | 24 | * The intermediate pad,pad2 are relics of initial layout based on pt_regs |
25 | * for optimizations when copying pt_regs to/from user_regs_struct. | ||
26 | * We no longer need them, but can't be changed as they are part of ABI now. | ||
25 | * | 27 | * |
26 | * Also, sigcontext only care about the scratch regs as that is what we really | 28 | * Also, sigcontext only care about the scratch regs as that is what we really |
27 | * save/restore for signal handling. | 29 | * save/restore for signal handling. However gdb also uses the same struct |
30 | * hence callee regs need to be in there too. | ||
28 | */ | 31 | */ |
29 | struct user_regs_struct { | 32 | struct user_regs_struct { |
30 | 33 | ||
34 | long pad; | ||
31 | struct { | 35 | struct { |
32 | long pad; | ||
33 | long bta, lp_start, lp_end, lp_count; | 36 | long bta, lp_start, lp_end, lp_count; |
34 | long status32, ret, blink, fp, gp; | 37 | long status32, ret, blink, fp, gp; |
35 | long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; | 38 | long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; |
36 | long sp; | 39 | long sp; |
37 | } scratch; | 40 | } scratch; |
41 | long pad2; | ||
38 | struct { | 42 | struct { |
39 | long pad; | ||
40 | long r25, r24, r23, r22, r21, r20; | 43 | long r25, r24, r23, r22, r21, r20; |
41 | long r19, r18, r17, r16, r15, r14, r13; | 44 | long r19, r18, r17, r16, r15, r14, r13; |
42 | } callee; | 45 | } callee; |
43 | long efa; /* break pt addr, for break points in delay slots */ | 46 | long efa; /* break pt addr, for break points in delay slots */ |
44 | long stop_pc; /* give dbg stop_pc directly after checking orig_r8 */ | 47 | long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */ |
45 | }; | 48 | }; |
46 | #endif /* !__ASSEMBLY__ */ | 49 | #endif /* !__ASSEMBLY__ */ |
47 | 50 | ||