diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/h8300/Kconfig | 4 | ||||
-rw-r--r-- | arch/h8300/Makefile | 2 | ||||
-rw-r--r-- | arch/h8300/kernel/Makefile | 6 | ||||
-rw-r--r-- | arch/h8300/kernel/irq.c | 211 | ||||
-rw-r--r-- | arch/h8300/kernel/setup.c | 3 | ||||
-rw-r--r-- | arch/h8300/kernel/time.c | 2 | ||||
-rw-r--r-- | arch/h8300/mm/kmap.c | 4 | ||||
-rw-r--r-- | arch/h8300/platform/h8300h/Makefile | 2 | ||||
-rw-r--r-- | arch/h8300/platform/h8300h/entry.S | 4 | ||||
-rw-r--r-- | arch/h8300/platform/h8300h/generic/Makefile | 2 | ||||
-rw-r--r-- | arch/h8300/platform/h8300h/ints_h8300h.c | 85 | ||||
-rw-r--r-- | arch/h8300/platform/h8s/entry.S | 17 |
12 files changed, 235 insertions, 107 deletions
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 86f6ca36363f..618dbad696f6 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
@@ -49,6 +49,10 @@ config GENERIC_HWEIGHT | |||
49 | bool | 49 | bool |
50 | default y | 50 | default y |
51 | 51 | ||
52 | config GENERIC_HARDIRQS | ||
53 | bool | ||
54 | default y | ||
55 | |||
52 | config GENERIC_CALIBRATE_DELAY | 56 | config GENERIC_CALIBRATE_DELAY |
53 | bool | 57 | bool |
54 | default y | 58 | default y |
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile index 40b3f56f3666..b2d896a7e598 100644 --- a/arch/h8300/Makefile +++ b/arch/h8300/Makefile | |||
@@ -41,7 +41,7 @@ LDFLAGS += $(ldflags-y) | |||
41 | CROSS_COMPILE = h8300-elf- | 41 | CROSS_COMPILE = h8300-elf- |
42 | LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(CFLAGS) -print-libgcc-file-name) | 42 | LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(CFLAGS) -print-libgcc-file-name) |
43 | 43 | ||
44 | head-y := arch/$(ARCH)/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o | 44 | head-y := arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/crt0_$(MODEL).o |
45 | 45 | ||
46 | core-y += arch/$(ARCH)/kernel/ \ | 46 | core-y += arch/$(ARCH)/kernel/ \ |
47 | arch/$(ARCH)/mm/ | 47 | arch/$(ARCH)/mm/ |
diff --git a/arch/h8300/kernel/Makefile b/arch/h8300/kernel/Makefile index 4edbc2ef6ca2..ccc1a7fbf94b 100644 --- a/arch/h8300/kernel/Makefile +++ b/arch/h8300/kernel/Makefile | |||
@@ -4,10 +4,8 @@ | |||
4 | 4 | ||
5 | extra-y := vmlinux.lds | 5 | extra-y := vmlinux.lds |
6 | 6 | ||
7 | obj-y := process.o traps.o ptrace.o ints.o \ | 7 | obj-y := process.o traps.o ptrace.o irq.o \ |
8 | sys_h8300.o time.o semaphore.o signal.o \ | 8 | sys_h8300.o time.o semaphore.o signal.o \ |
9 | setup.o gpio.o init_task.o syscalls.o devres.o | 9 | setup.o gpio.o init_task.o syscalls.o |
10 | |||
11 | devres-y = ../../../kernel/irq/devres.o | ||
12 | 10 | ||
13 | obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o | 11 | obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o |
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c new file mode 100644 index 000000000000..43d21e93f41f --- /dev/null +++ b/arch/h8300/kernel/irq.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * linux/arch/h8300/kernel/irq.c | ||
3 | * | ||
4 | * Copyright 2007 Yoshinori Sato <ysato@users.sourceforge.jp> | ||
5 | */ | ||
6 | |||
7 | #include <linux/module.h> | ||
8 | #include <linux/types.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/kernel_stat.h> | ||
12 | #include <linux/seq_file.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/random.h> | ||
15 | #include <linux/bootmem.h> | ||
16 | #include <linux/irq.h> | ||
17 | |||
18 | #include <asm/system.h> | ||
19 | #include <asm/traps.h> | ||
20 | #include <asm/io.h> | ||
21 | #include <asm/setup.h> | ||
22 | #include <asm/errno.h> | ||
23 | |||
24 | /*#define DEBUG*/ | ||
25 | |||
26 | extern unsigned long *interrupt_redirect_table; | ||
27 | extern const int h8300_saved_vectors[]; | ||
28 | extern const unsigned long h8300_trap_table[]; | ||
29 | int h8300_enable_irq_pin(unsigned int irq); | ||
30 | void h8300_disable_irq_pin(unsigned int irq); | ||
31 | |||
32 | #define CPU_VECTOR ((unsigned long *)0x000000) | ||
33 | #define ADDR_MASK (0xffffff) | ||
34 | |||
35 | static inline int is_ext_irq(unsigned int irq) | ||
36 | { | ||
37 | return (irq >= EXT_IRQ0 && irq <= (EXT_IRQ0 + EXT_IRQS)); | ||
38 | } | ||
39 | |||
40 | static void h8300_enable_irq(unsigned int irq) | ||
41 | { | ||
42 | if (is_ext_irq(irq)) | ||
43 | IER_REGS |= 1 << (irq - EXT_IRQ0); | ||
44 | } | ||
45 | |||
46 | static void h8300_disable_irq(unsigned int irq) | ||
47 | { | ||
48 | if (is_ext_irq(irq)) | ||
49 | IER_REGS &= ~(1 << (irq - EXT_IRQ0)); | ||
50 | } | ||
51 | |||
52 | static void h8300_end_irq(unsigned int irq) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | static unsigned int h8300_startup_irq(unsigned int irq) | ||
57 | { | ||
58 | if (is_ext_irq(irq)) | ||
59 | return h8300_enable_irq_pin(irq); | ||
60 | else | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static void h8300_shutdown_irq(unsigned int irq) | ||
65 | { | ||
66 | if (is_ext_irq(irq)) | ||
67 | h8300_disable_irq_pin(irq); | ||
68 | } | ||
69 | |||
70 | /* | ||
71 | * h8300 interrupt controler implementation | ||
72 | */ | ||
73 | struct irq_chip h8300irq_chip = { | ||
74 | .name = "H8300-INTC", | ||
75 | .startup = h8300_startup_irq, | ||
76 | .shutdown = h8300_shutdown_irq, | ||
77 | .enable = h8300_enable_irq, | ||
78 | .disable = h8300_disable_irq, | ||
79 | .ack = NULL, | ||
80 | .end = h8300_end_irq, | ||
81 | }; | ||
82 | |||
83 | void ack_bad_irq(unsigned int irq) | ||
84 | { | ||
85 | printk("unexpected IRQ trap at vector %02x\n", irq); | ||
86 | } | ||
87 | |||
88 | #if defined(CONFIG_RAMKERNEL) | ||
89 | static unsigned long __init *get_vector_address(void) | ||
90 | { | ||
91 | unsigned long *rom_vector = CPU_VECTOR; | ||
92 | unsigned long base,tmp; | ||
93 | int vec_no; | ||
94 | |||
95 | base = rom_vector[EXT_IRQ0] & ADDR_MASK; | ||
96 | |||
97 | /* check romvector format */ | ||
98 | for (vec_no = EXT_IRQ1; vec_no <= EXT_IRQ0+EXT_IRQS; vec_no++) { | ||
99 | if ((base+(vec_no - EXT_IRQ0)*4) != (rom_vector[vec_no] & ADDR_MASK)) | ||
100 | return NULL; | ||
101 | } | ||
102 | |||
103 | /* ramvector base address */ | ||
104 | base -= EXT_IRQ0*4; | ||
105 | |||
106 | /* writerble check */ | ||
107 | tmp = ~(*(volatile unsigned long *)base); | ||
108 | (*(volatile unsigned long *)base) = tmp; | ||
109 | if ((*(volatile unsigned long *)base) != tmp) | ||
110 | return NULL; | ||
111 | return (unsigned long *)base; | ||
112 | } | ||
113 | |||
114 | static void __init setup_vector(void) | ||
115 | { | ||
116 | int i; | ||
117 | unsigned long *ramvec,*ramvec_p; | ||
118 | const unsigned long *trap_entry; | ||
119 | const int *saved_vector; | ||
120 | |||
121 | ramvec = get_vector_address(); | ||
122 | if (ramvec == NULL) | ||
123 | panic("interrupt vector serup failed."); | ||
124 | else | ||
125 | printk(KERN_INFO "virtual vector at 0x%08lx\n",(unsigned long)ramvec); | ||
126 | |||
127 | /* create redirect table */ | ||
128 | ramvec_p = ramvec; | ||
129 | trap_entry = h8300_trap_table; | ||
130 | saved_vector = h8300_saved_vectors; | ||
131 | for ( i = 0; i < NR_IRQS; i++) { | ||
132 | if (i == *saved_vector) { | ||
133 | ramvec_p++; | ||
134 | saved_vector++; | ||
135 | } else { | ||
136 | if ( i < NR_TRAPS ) { | ||
137 | if (*trap_entry) | ||
138 | *ramvec_p = VECTOR(*trap_entry); | ||
139 | ramvec_p++; | ||
140 | trap_entry++; | ||
141 | } else | ||
142 | *ramvec_p++ = REDIRECT(interrupt_entry); | ||
143 | } | ||
144 | } | ||
145 | interrupt_redirect_table = ramvec; | ||
146 | #ifdef DEBUG | ||
147 | ramvec_p = ramvec; | ||
148 | for (i = 0; i < NR_IRQS; i++) { | ||
149 | if ((i % 8) == 0) | ||
150 | printk(KERN_DEBUG "\n%p: ",ramvec_p); | ||
151 | printk(KERN_DEBUG "%p ",*ramvec_p); | ||
152 | ramvec_p++; | ||
153 | } | ||
154 | printk(KERN_DEBUG "\n"); | ||
155 | #endif | ||
156 | } | ||
157 | #else | ||
158 | #define setup_vector() do { } while(0) | ||
159 | #endif | ||
160 | |||
161 | void __init init_IRQ(void) | ||
162 | { | ||
163 | int c; | ||
164 | |||
165 | setup_vector(); | ||
166 | |||
167 | for (c = 0; c < NR_IRQS; c++) { | ||
168 | irq_desc[c].status = IRQ_DISABLED; | ||
169 | irq_desc[c].action = NULL; | ||
170 | irq_desc[c].depth = 1; | ||
171 | irq_desc[c].chip = &h8300irq_chip; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | asmlinkage void do_IRQ(int irq) | ||
176 | { | ||
177 | irq_enter(); | ||
178 | __do_IRQ(irq); | ||
179 | irq_exit(); | ||
180 | } | ||
181 | |||
182 | #if defined(CONFIG_PROC_FS) | ||
183 | int show_interrupts(struct seq_file *p, void *v) | ||
184 | { | ||
185 | int i = *(loff_t *) v, j; | ||
186 | struct irqaction * action; | ||
187 | unsigned long flags; | ||
188 | |||
189 | if (i == 0) | ||
190 | seq_puts(p, " CPU0"); | ||
191 | |||
192 | if (i < NR_IRQS) { | ||
193 | spin_lock_irqsave(&irq_desc[i].lock, flags); | ||
194 | action = irq_desc[i].action; | ||
195 | if (!action) | ||
196 | goto unlock; | ||
197 | seq_printf(p, "%3d: ",i); | ||
198 | seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); | ||
199 | seq_printf(p, " %14s", irq_desc[i].chip->name); | ||
200 | seq_printf(p, "-%-8s", irq_desc[i].name); | ||
201 | seq_printf(p, " %s", action->name); | ||
202 | |||
203 | for (action=action->next; action; action = action->next) | ||
204 | seq_printf(p, ", %s", action->name); | ||
205 | seq_putc(p, '\n'); | ||
206 | unlock: | ||
207 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | ||
208 | } | ||
209 | return 0; | ||
210 | } | ||
211 | #endif | ||
diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c index 313cd8081044..b2e86d0255e6 100644 --- a/arch/h8300/kernel/setup.c +++ b/arch/h8300/kernel/setup.c | |||
@@ -33,10 +33,7 @@ | |||
33 | 33 | ||
34 | #include <asm/setup.h> | 34 | #include <asm/setup.h> |
35 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
36 | |||
37 | #ifdef CONFIG_BLK_DEV_INITRD | ||
38 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
39 | #endif | ||
40 | 37 | ||
41 | #if defined(__H8300H__) | 38 | #if defined(__H8300H__) |
42 | #define CPU "H8/300H" | 39 | #define CPU "H8/300H" |
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c index 91d3b56ddc68..330638220a2e 100644 --- a/arch/h8300/kernel/time.c +++ b/arch/h8300/kernel/time.c | |||
@@ -44,7 +44,7 @@ static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs) | |||
44 | #ifndef CONFIG_SMP | 44 | #ifndef CONFIG_SMP |
45 | update_process_times(user_mode(regs)); | 45 | update_process_times(user_mode(regs)); |
46 | #endif | 46 | #endif |
47 | profile_tick(CPU_PROFILING, regs); | 47 | profile_tick(CPU_PROFILING); |
48 | } | 48 | } |
49 | 49 | ||
50 | void time_init(void) | 50 | void time_init(void) |
diff --git a/arch/h8300/mm/kmap.c b/arch/h8300/mm/kmap.c index 26ab17286a53..5c7af09ae8d1 100644 --- a/arch/h8300/mm/kmap.c +++ b/arch/h8300/mm/kmap.c | |||
@@ -24,12 +24,14 @@ | |||
24 | 24 | ||
25 | #undef DEBUG | 25 | #undef DEBUG |
26 | 26 | ||
27 | #define VIRT_OFFSET (0x01000000) | ||
28 | |||
27 | /* | 29 | /* |
28 | * Map some physical address range into the kernel address space. | 30 | * Map some physical address range into the kernel address space. |
29 | */ | 31 | */ |
30 | void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) | 32 | void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) |
31 | { | 33 | { |
32 | return (void *)physaddr; | 34 | return (void *)(physaddr + VIRT_OFFSET); |
33 | } | 35 | } |
34 | 36 | ||
35 | /* | 37 | /* |
diff --git a/arch/h8300/platform/h8300h/Makefile b/arch/h8300/platform/h8300h/Makefile index 5d42c772f75a..b24ea08aa0a7 100644 --- a/arch/h8300/platform/h8300h/Makefile +++ b/arch/h8300/platform/h8300h/Makefile | |||
@@ -4,4 +4,4 @@ | |||
4 | # Reuse any files we can from the H8/300H | 4 | # Reuse any files we can from the H8/300H |
5 | # | 5 | # |
6 | 6 | ||
7 | obj-y := entry.o ints_h8300h.o ptrace_h8300h.o | 7 | obj-y := entry.o irq_pin.o ptrace_h8300h.o |
diff --git a/arch/h8300/platform/h8300h/entry.S b/arch/h8300/platform/h8300h/entry.S index d2dea2432fb2..f86ac3b5d4de 100644 --- a/arch/h8300/platform/h8300h/entry.S +++ b/arch/h8300/platform/h8300h/entry.S | |||
@@ -30,12 +30,12 @@ | |||
30 | mov.l er0,@-sp | 30 | mov.l er0,@-sp |
31 | 31 | ||
32 | stc ccr,r0l /* check kernel mode */ | 32 | stc ccr,r0l /* check kernel mode */ |
33 | orc #0x10,ccr | ||
34 | btst #4,r0l | 33 | btst #4,r0l |
35 | bne 5f | 34 | bne 5f |
36 | 35 | ||
37 | mov.l sp,@SYMBOL_NAME(sw_usp) /* user mode */ | 36 | mov.l sp,@SYMBOL_NAME(sw_usp) /* user mode */ |
38 | mov.l @sp,er0 | 37 | mov.l @sp,er0 |
38 | orc #0x10,ccr | ||
39 | mov.l @SYMBOL_NAME(sw_ksp),sp | 39 | mov.l @SYMBOL_NAME(sw_ksp),sp |
40 | sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */ | 40 | sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */ |
41 | mov.l er0,@-sp | 41 | mov.l er0,@-sp |
@@ -165,7 +165,7 @@ SYMBOL_NAME_LABEL(interrupt_entry) | |||
165 | dec.l #1,er0 | 165 | dec.l #1,er0 |
166 | mov.l sp,er1 | 166 | mov.l sp,er1 |
167 | subs #4,er1 /* adjust ret_pc */ | 167 | subs #4,er1 /* adjust ret_pc */ |
168 | jsr @SYMBOL_NAME(process_int) | 168 | jsr @SYMBOL_NAME(do_IRQ) |
169 | mov.l @SYMBOL_NAME(irq_stat)+CPUSTAT_SOFTIRQ_PENDING,er0 | 169 | mov.l @SYMBOL_NAME(irq_stat)+CPUSTAT_SOFTIRQ_PENDING,er0 |
170 | beq 1f | 170 | beq 1f |
171 | jsr @SYMBOL_NAME(do_softirq) | 171 | jsr @SYMBOL_NAME(do_softirq) |
diff --git a/arch/h8300/platform/h8300h/generic/Makefile b/arch/h8300/platform/h8300h/generic/Makefile index b6ea7688a616..32b964a9010e 100644 --- a/arch/h8300/platform/h8300h/generic/Makefile +++ b/arch/h8300/platform/h8300h/generic/Makefile | |||
@@ -2,5 +2,5 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := crt0_$(MODEL).o | ||
5 | obj-y := timer.o | 6 | obj-y := timer.o |
6 | extra-y = crt0_$(MODEL).o | ||
diff --git a/arch/h8300/platform/h8300h/ints_h8300h.c b/arch/h8300/platform/h8300h/ints_h8300h.c deleted file mode 100644 index f1777119b871..000000000000 --- a/arch/h8300/platform/h8300h/ints_h8300h.c +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/h8300/platform/h8300h/ints_h8300h.c | ||
3 | * Interrupt handling CPU variants | ||
4 | * | ||
5 | * Yoshinori Sato <ysato@users.sourceforge.jp> | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/errno.h> | ||
11 | |||
12 | #include <asm/ptrace.h> | ||
13 | #include <asm/traps.h> | ||
14 | #include <asm/irq.h> | ||
15 | #include <asm/io.h> | ||
16 | #include <asm/gpio.h> | ||
17 | #include <asm/regs306x.h> | ||
18 | |||
19 | /* saved vector list */ | ||
20 | const int __initdata h8300_saved_vectors[]={ | ||
21 | #if defined(CONFIG_GDB_DEBUG) | ||
22 | TRAP3_VEC, | ||
23 | #endif | ||
24 | -1 | ||
25 | }; | ||
26 | |||
27 | /* trap entry table */ | ||
28 | const unsigned long __initdata h8300_trap_table[NR_TRAPS]={ | ||
29 | 0,0,0,0,0,0,0,0, | ||
30 | (unsigned long)system_call, /* TRAPA #0 */ | ||
31 | 0,0, | ||
32 | (unsigned long)trace_break, /* TRAPA #3 */ | ||
33 | }; | ||
34 | |||
35 | int h8300_enable_irq_pin(unsigned int irq) | ||
36 | { | ||
37 | int bitmask; | ||
38 | if (irq < EXT_IRQ0 || irq > EXT_IRQ5) | ||
39 | return 0; | ||
40 | |||
41 | /* initialize IRQ pin */ | ||
42 | bitmask = 1 << (irq - EXT_IRQ0); | ||
43 | switch(irq) { | ||
44 | case EXT_IRQ0: | ||
45 | case EXT_IRQ1: | ||
46 | case EXT_IRQ2: | ||
47 | case EXT_IRQ3: | ||
48 | if (H8300_GPIO_RESERVE(H8300_GPIO_P8, bitmask) == 0) | ||
49 | return -EBUSY; | ||
50 | H8300_GPIO_DDR(H8300_GPIO_P8, bitmask, H8300_GPIO_INPUT); | ||
51 | break; | ||
52 | case EXT_IRQ4: | ||
53 | case EXT_IRQ5: | ||
54 | if (H8300_GPIO_RESERVE(H8300_GPIO_P9, bitmask) == 0) | ||
55 | return -EBUSY; | ||
56 | H8300_GPIO_DDR(H8300_GPIO_P9, bitmask, H8300_GPIO_INPUT); | ||
57 | break; | ||
58 | } | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | void h8300_disable_irq_pin(unsigned int irq) | ||
64 | { | ||
65 | int bitmask; | ||
66 | if (irq < EXT_IRQ0 || irq > EXT_IRQ5) | ||
67 | return; | ||
68 | |||
69 | /* disable interrupt & release IRQ pin */ | ||
70 | bitmask = 1 << (irq - EXT_IRQ0); | ||
71 | switch(irq) { | ||
72 | case EXT_IRQ0: | ||
73 | case EXT_IRQ1: | ||
74 | case EXT_IRQ2: | ||
75 | case EXT_IRQ3: | ||
76 | *(volatile unsigned char *)IER &= ~bitmask; | ||
77 | H8300_GPIO_FREE(H8300_GPIO_P8, bitmask); | ||
78 | break ; | ||
79 | case EXT_IRQ4: | ||
80 | case EXT_IRQ5: | ||
81 | *(volatile unsigned char *)IER &= ~bitmask; | ||
82 | H8300_GPIO_FREE(H8300_GPIO_P9, bitmask); | ||
83 | break; | ||
84 | } | ||
85 | } | ||
diff --git a/arch/h8300/platform/h8s/entry.S b/arch/h8300/platform/h8s/entry.S index aeb2e9faa9b2..f3d6b8e8f959 100644 --- a/arch/h8300/platform/h8s/entry.S +++ b/arch/h8300/platform/h8s/entry.S | |||
@@ -31,12 +31,13 @@ | |||
31 | mov.l er0,@-sp | 31 | mov.l er0,@-sp |
32 | 32 | ||
33 | stc ccr,r0l /* check kernel mode */ | 33 | stc ccr,r0l /* check kernel mode */ |
34 | orc #0x10,ccr | ||
35 | btst #4,r0l | 34 | btst #4,r0l |
36 | bne 5f | 35 | bne 5f |
37 | 36 | ||
38 | mov.l sp,@SYMBOL_NAME(sw_usp) /* user mode */ | 37 | /* user mode */ |
39 | mov.l @sp,er0 | 38 | mov.l sp,@SYMBOL_NAME(sw_usp) |
39 | mov.l @sp,er0 /* restore saved er0 */ | ||
40 | orc #0x10,ccr /* switch kernel stack */ | ||
40 | mov.l @SYMBOL_NAME(sw_ksp),sp | 41 | mov.l @SYMBOL_NAME(sw_ksp),sp |
41 | sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */ | 42 | sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */ |
42 | stm.l er0-er3,@-sp | 43 | stm.l er0-er3,@-sp |
@@ -55,8 +56,9 @@ | |||
55 | mov.l er0,@(LER0-LER3:16,sp) /* copy ER0 */ | 56 | mov.l er0,@(LER0-LER3:16,sp) /* copy ER0 */ |
56 | bra 6f | 57 | bra 6f |
57 | 5: | 58 | 5: |
58 | mov.l @sp,er0 /* kernel mode */ | 59 | /* kernel mode */ |
59 | subs #2,sp /* dummy ccr */ | 60 | mov.l @sp,er0 /* restore saved er0 */ |
61 | subs #2,sp /* set dummy ccr */ | ||
60 | stm.l er0-er3,@-sp | 62 | stm.l er0-er3,@-sp |
61 | mov.w @(LRET-LER3:16,sp),r1 /* copy old ccr */ | 63 | mov.w @(LRET-LER3:16,sp),r1 /* copy old ccr */ |
62 | mov.b r1h,r1l | 64 | mov.b r1h,r1l |
@@ -94,6 +96,7 @@ | |||
94 | mov.l @sp+,er1 | 96 | mov.l @sp+,er1 |
95 | add.l #(LRET-LER1),sp /* remove LORIG - LRET */ | 97 | add.l #(LRET-LER1),sp /* remove LORIG - LRET */ |
96 | mov.l sp,@SYMBOL_NAME(sw_ksp) | 98 | mov.l sp,@SYMBOL_NAME(sw_ksp) |
99 | andc #0xef,ccr /* switch to user mode */ | ||
97 | mov.l er0,sp | 100 | mov.l er0,sp |
98 | bra 8f | 101 | bra 8f |
99 | 7: | 102 | 7: |
@@ -173,9 +176,6 @@ SYMBOL_NAME_LABEL(interrupt_entry) | |||
173 | SYMBOL_NAME_LABEL(system_call) | 176 | SYMBOL_NAME_LABEL(system_call) |
174 | subs #4,sp /* dummy LVEC */ | 177 | subs #4,sp /* dummy LVEC */ |
175 | SAVE_ALL | 178 | SAVE_ALL |
176 | mov.w @(LCCR:16,sp),r1 | ||
177 | bset #4,r1l | ||
178 | ldc r1l,ccr /* restore ccr */ | ||
179 | mov.l er0,er4 | 179 | mov.l er0,er4 |
180 | mov.l #-ENOSYS,er0 | 180 | mov.l #-ENOSYS,er0 |
181 | mov.l er0,@(LER0:16,sp) | 181 | mov.l er0,@(LER0:16,sp) |
@@ -198,6 +198,7 @@ SYMBOL_NAME_LABEL(system_call) | |||
198 | mov.l @(LER1:16,sp),er0 | 198 | mov.l @(LER1:16,sp),er0 |
199 | mov.l @(LER2:16,sp),er1 | 199 | mov.l @(LER2:16,sp),er1 |
200 | mov.l @(LER3:16,sp),er2 | 200 | mov.l @(LER3:16,sp),er2 |
201 | andc #0x7f,ccr | ||
201 | jsr @er4 | 202 | jsr @er4 |
202 | mov.l er0,@(LER0:16,sp) /* save the return value */ | 203 | mov.l er0,@(LER0:16,sp) /* save the return value */ |
203 | #if defined(CONFIG_SYSCALL_PRINT) | 204 | #if defined(CONFIG_SYSCALL_PRINT) |