aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/kernel')
-rw-r--r--arch/cris/kernel/asm-offsets.c1
-rw-r--r--arch/cris/kernel/irq.c7
-rw-r--r--arch/cris/kernel/module.c1
-rw-r--r--arch/cris/kernel/profile.c1
-rw-r--r--arch/cris/kernel/sys_cris.c124
-rw-r--r--arch/cris/kernel/time.c68
-rw-r--r--arch/cris/kernel/vmlinux.lds.S1
7 files changed, 9 insertions, 194 deletions
diff --git a/arch/cris/kernel/asm-offsets.c b/arch/cris/kernel/asm-offsets.c
index ddd6fbbe75de..dd7b8e983221 100644
--- a/arch/cris/kernel/asm-offsets.c
+++ b/arch/cris/kernel/asm-offsets.c
@@ -1,6 +1,5 @@
1#include <linux/sched.h> 1#include <linux/sched.h>
2#include <asm/thread_info.h> 2#include <asm/thread_info.h>
3#include <linux/autoconf.h>
4 3
5/* 4/*
6 * Generate definitions needed by assembly language modules. 5 * Generate definitions needed by assembly language modules.
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index 0ca7d9892cc6..469f7f9d62e0 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -29,7 +29,6 @@
29#include <linux/ioport.h> 29#include <linux/ioport.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/timex.h> 31#include <linux/timex.h>
32#include <linux/slab.h>
33#include <linux/random.h> 32#include <linux/random.h>
34#include <linux/init.h> 33#include <linux/init.h>
35#include <linux/seq_file.h> 34#include <linux/seq_file.h>
@@ -52,7 +51,7 @@ int show_interrupts(struct seq_file *p, void *v)
52 } 51 }
53 52
54 if (i < NR_IRQS) { 53 if (i < NR_IRQS) {
55 spin_lock_irqsave(&irq_desc[i].lock, flags); 54 raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
56 action = irq_desc[i].action; 55 action = irq_desc[i].action;
57 if (!action) 56 if (!action)
58 goto skip; 57 goto skip;
@@ -63,7 +62,7 @@ int show_interrupts(struct seq_file *p, void *v)
63 for_each_online_cpu(j) 62 for_each_online_cpu(j)
64 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 63 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
65#endif 64#endif
66 seq_printf(p, " %14s", irq_desc[i].chip->typename); 65 seq_printf(p, " %14s", irq_desc[i].chip->name);
67 seq_printf(p, " %s", action->name); 66 seq_printf(p, " %s", action->name);
68 67
69 for (action=action->next; action; action = action->next) 68 for (action=action->next; action; action = action->next)
@@ -71,7 +70,7 @@ int show_interrupts(struct seq_file *p, void *v)
71 70
72 seq_putc(p, '\n'); 71 seq_putc(p, '\n');
73skip: 72skip:
74 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 73 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
75 } 74 }
76 return 0; 75 return 0;
77} 76}
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index abc13e368b90..bcd502f74cda 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -21,6 +21,7 @@
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/slab.h>
24 25
25#if 0 26#if 0
26#define DEBUGP printk 27#define DEBUGP printk
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c
index 9aa571169bcc..b917549a7d94 100644
--- a/arch/cris/kernel/profile.c
+++ b/arch/cris/kernel/profile.c
@@ -2,6 +2,7 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/proc_fs.h> 4#include <linux/proc_fs.h>
5#include <linux/slab.h>
5#include <linux/types.h> 6#include <linux/types.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
7#include <asm/uaccess.h> 8#include <asm/uaccess.h>
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 2ad962c7e88e..7aa036ec78ff 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -26,130 +26,10 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/segment.h> 27#include <asm/segment.h>
28 28
29/* common code for old and new mmaps */
30static inline long
31do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
32 unsigned long flags, unsigned long fd, unsigned long pgoff)
33{
34 int error = -EBADF;
35 struct file * file = NULL;
36
37 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
38 if (!(flags & MAP_ANONYMOUS)) {
39 file = fget(fd);
40 if (!file)
41 goto out;
42 }
43
44 down_write(&current->mm->mmap_sem);
45 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
46 up_write(&current->mm->mmap_sem);
47
48 if (file)
49 fput(file);
50out:
51 return error;
52}
53
54asmlinkage unsigned long old_mmap(unsigned long __user *args)
55{
56 unsigned long buffer[6];
57 int err = -EFAULT;
58
59 if (copy_from_user(&buffer, args, sizeof(buffer)))
60 goto out;
61
62 err = -EINVAL;
63 if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */
64 goto out;
65
66 err = do_mmap2(buffer[0], buffer[1], buffer[2], buffer[3],
67 buffer[4], buffer[5] >> PAGE_SHIFT);
68out:
69 return err;
70}
71
72asmlinkage long 29asmlinkage long
73sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 30sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
74 unsigned long flags, unsigned long fd, unsigned long pgoff) 31 unsigned long flags, unsigned long fd, unsigned long pgoff)
75{ 32{
76 return do_mmap2(addr, len, prot, flags, fd, pgoff); 33 /* bug(?): 8Kb pages here */
77} 34 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
78
79/*
80 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
81 *
82 * This is really horribly ugly. (same as arch/i386)
83 */
84
85asmlinkage int sys_ipc (uint call, int first, int second,
86 int third, void __user *ptr, long fifth)
87{
88 int version, ret;
89
90 version = call >> 16; /* hack for backward compatibility */
91 call &= 0xffff;
92
93 switch (call) {
94 case SEMOP:
95 return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
96 case SEMTIMEDOP:
97 return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
98 (const struct timespec __user *)fifth);
99
100 case SEMGET:
101 return sys_semget (first, second, third);
102 case SEMCTL: {
103 union semun fourth;
104 if (!ptr)
105 return -EINVAL;
106 if (get_user(fourth.__pad, (void * __user *) ptr))
107 return -EFAULT;
108 return sys_semctl (first, second, third, fourth);
109 }
110
111 case MSGSND:
112 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
113 second, third);
114 case MSGRCV:
115 switch (version) {
116 case 0: {
117 struct ipc_kludge tmp;
118 if (!ptr)
119 return -EINVAL;
120
121 if (copy_from_user(&tmp,
122 (struct ipc_kludge __user *) ptr,
123 sizeof (tmp)))
124 return -EFAULT;
125 return sys_msgrcv (first, tmp.msgp, second,
126 tmp.msgtyp, third);
127 }
128 default:
129 return sys_msgrcv (first,
130 (struct msgbuf __user *) ptr,
131 second, fifth, third);
132 }
133 case MSGGET:
134 return sys_msgget ((key_t) first, second);
135 case MSGCTL:
136 return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
137
138 case SHMAT: {
139 ulong raddr;
140 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
141 if (ret)
142 return ret;
143 return put_user (raddr, (ulong __user *) third);
144 }
145 case SHMDT:
146 return sys_shmdt ((char __user *)ptr);
147 case SHMGET:
148 return sys_shmget (first, second, third);
149 case SHMCTL:
150 return sys_shmctl (first, second,
151 (struct shmid_ds __user *) ptr);
152 default:
153 return -ENOSYS;
154 }
155} 35}
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 074fe7dea96b..a05dd31f3efb 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -42,75 +42,11 @@ unsigned long loops_per_usec;
42extern unsigned long do_slow_gettimeoffset(void); 42extern unsigned long do_slow_gettimeoffset(void);
43static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; 43static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
44 44
45/* 45u32 arch_gettimeoffset(void)
46 * This version of gettimeofday has near microsecond resolution.
47 *
48 * Note: Division is quite slow on CRIS and do_gettimeofday is called
49 * rather often. Maybe we should do some kind of approximation here
50 * (a naive approximation would be to divide by 1024).
51 */
52void do_gettimeofday(struct timeval *tv)
53{
54 unsigned long flags;
55 signed long usec, sec;
56 local_irq_save(flags);
57 usec = do_gettimeoffset();
58
59 /*
60 * If time_adjust is negative then NTP is slowing the clock
61 * so make sure not to go into next possible interval.
62 * Better to lose some accuracy than have time go backwards..
63 */
64 if (unlikely(time_adjust < 0) && usec > tickadj)
65 usec = tickadj;
66
67 sec = xtime.tv_sec;
68 usec += xtime.tv_nsec / 1000;
69 local_irq_restore(flags);
70
71 while (usec >= 1000000) {
72 usec -= 1000000;
73 sec++;
74 }
75
76 tv->tv_sec = sec;
77 tv->tv_usec = usec;
78}
79
80EXPORT_SYMBOL(do_gettimeofday);
81
82int do_settimeofday(struct timespec *tv)
83{ 46{
84 time_t wtm_sec, sec = tv->tv_sec; 47 return do_gettimeoffset() * 1000;
85 long wtm_nsec, nsec = tv->tv_nsec;
86
87 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
88 return -EINVAL;
89
90 write_seqlock_irq(&xtime_lock);
91 /*
92 * This is revolting. We need to set "xtime" correctly. However, the
93 * value in this location is the value at the most recent update of
94 * wall time. Discover what correction gettimeofday() would have
95 * made, and then undo it!
96 */
97 nsec -= do_gettimeoffset() * NSEC_PER_USEC;
98
99 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
100 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
101
102 set_normalized_timespec(&xtime, sec, nsec);
103 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
104
105 ntp_clear();
106 write_sequnlock_irq(&xtime_lock);
107 clock_was_set();
108 return 0;
109} 48}
110 49
111EXPORT_SYMBOL(do_settimeofday);
112
113
114/* 50/*
115 * BUG: This routine does not handle hour overflow properly; it just 51 * BUG: This routine does not handle hour overflow properly; it just
116 * sets the minutes. Usually you'll only notice that after reboot! 52 * sets the minutes. Usually you'll only notice that after reboot!
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S
index bbfda67d2907..d49d17d2a14f 100644
--- a/arch/cris/kernel/vmlinux.lds.S
+++ b/arch/cris/kernel/vmlinux.lds.S
@@ -8,7 +8,6 @@
8 * the kernel has booted. 8 * the kernel has booted.
9 */ 9 */
10 10
11#include <linux/autoconf.h>
12#include <asm-generic/vmlinux.lds.h> 11#include <asm-generic/vmlinux.lds.h>
13#include <asm/page.h> 12#include <asm/page.h>
14 13