aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mm/mm-armv.c2
-rw-r--r--arch/i386/Kconfig2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c8
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c8
-rw-r--r--arch/i386/kernel/msr.c9
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c6
-rw-r--r--arch/i386/mm/pgtable.c14
-rw-r--r--arch/ia64/Kconfig5
-rw-r--r--arch/s390/appldata/appldata_base.c1
-rw-r--r--arch/s390/appldata/appldata_mem.c23
-rw-r--r--arch/sparc/kernel/sys_sunos.c2
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c2
-rw-r--r--arch/um/Makefile-x86_647
-rw-r--r--arch/um/drivers/stderr_console.c22
-rw-r--r--arch/um/kernel/skas/mmu.c2
-rw-r--r--arch/um/kernel/time.c172
-rw-r--r--arch/um/kernel/time_kern.c32
-rw-r--r--arch/um/kernel/vmlinux.lds.S2
-rw-r--r--arch/um/os-Linux/mem.c21
-rw-r--r--arch/um/sys-i386/sys_call_table.S2
-rw-r--r--arch/um/sys-x86_64/syscall_table.c6
21 files changed, 105 insertions, 243 deletions
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index 487d7ad11eb1..b0242c6ea066 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -226,7 +226,7 @@ void free_pgd_slow(pgd_t *pgd)
226 226
227 pte = pmd_page(*pmd); 227 pte = pmd_page(*pmd);
228 pmd_clear(pmd); 228 pmd_clear(pmd);
229 dec_page_state(nr_page_table_pages); 229 dec_zone_page_state(virt_to_page((unsigned long *)pgd), NR_PAGETABLE);
230 pte_lock_deinit(pte); 230 pte_lock_deinit(pte);
231 pte_free(pte); 231 pte_free(pte);
232 pmd_free(pmd); 232 pmd_free(pmd);
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 1718429286d4..27d8dddbaa47 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -176,7 +176,7 @@ endchoice
176config ACPI_SRAT 176config ACPI_SRAT
177 bool 177 bool
178 default y 178 default y
179 depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) 179 depends on ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH)
180 select ACPI_NUMA 180 select ACPI_NUMA
181 181
182config HAVE_ARCH_PARSE_SRAT 182config HAVE_ARCH_PARSE_SRAT
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index b9358e5bad24..567b39bea07e 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -417,8 +417,14 @@ acpi_cpufreq_cpu_init (
417 goto err_free; 417 goto err_free;
418 418
419 perf = data->acpi_data; 419 perf = data->acpi_data;
420 policy->cpus = perf->shared_cpu_map;
421 policy->shared_type = perf->shared_type; 420 policy->shared_type = perf->shared_type;
421 /*
422 * Will let policy->cpus know about dependency only when software
423 * coordination is required.
424 */
425 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
426 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
427 policy->cpus = perf->shared_cpu_map;
422 428
423 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { 429 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
424 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; 430 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index d91815e614cf..b77f1358bd79 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -398,8 +398,14 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
398 dprintk(PFX "obtaining ACPI data failed\n"); 398 dprintk(PFX "obtaining ACPI data failed\n");
399 return -EIO; 399 return -EIO;
400 } 400 }
401 policy->cpus = p->shared_cpu_map;
402 policy->shared_type = p->shared_type; 401 policy->shared_type = p->shared_type;
402 /*
403 * Will let policy->cpus know about dependency only when software
404 * coordination is required.
405 */
406 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
407 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
408 policy->cpus = p->shared_cpu_map;
403 409
404 /* verify the acpi_data */ 410 /* verify the acpi_data */
405 if (p->state_count <= 1) { 411 if (p->state_count <= 1) {
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
index 4eae03d3ade5..d535cdbbfd25 100644
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -250,7 +250,9 @@ static int msr_class_device_create(int i)
250 return err; 250 return err;
251} 251}
252 252
253static int msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 253#ifdef CONFIG_HOTPLUG_CPU
254static int msr_class_cpu_callback(struct notifier_block *nfb,
255 unsigned long action, void *hcpu)
254{ 256{
255 unsigned int cpu = (unsigned long)hcpu; 257 unsigned int cpu = (unsigned long)hcpu;
256 258
@@ -269,6 +271,7 @@ static struct notifier_block __cpuinitdata msr_class_cpu_notifier =
269{ 271{
270 .notifier_call = msr_class_cpu_callback, 272 .notifier_call = msr_class_cpu_callback,
271}; 273};
274#endif
272 275
273static int __init msr_init(void) 276static int __init msr_init(void)
274{ 277{
@@ -291,7 +294,7 @@ static int __init msr_init(void)
291 if (err != 0) 294 if (err != 0)
292 goto out_class; 295 goto out_class;
293 } 296 }
294 register_cpu_notifier(&msr_class_cpu_notifier); 297 register_hotcpu_notifier(&msr_class_cpu_notifier);
295 298
296 err = 0; 299 err = 0;
297 goto out; 300 goto out;
@@ -314,7 +317,7 @@ static void __exit msr_exit(void)
314 class_device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); 317 class_device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu));
315 class_destroy(msr_class); 318 class_destroy(msr_class);
316 unregister_chrdev(MSR_MAJOR, "cpu/msr"); 319 unregister_chrdev(MSR_MAJOR, "cpu/msr");
317 unregister_cpu_notifier(&msr_class_cpu_notifier); 320 unregister_hotcpu_notifier(&msr_class_cpu_notifier);
318} 321}
319 322
320module_init(msr_init); 323module_init(msr_init);
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 8a1b8824c900..6c86575ffdcb 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -1937,3 +1937,9 @@ smp_cpus_done(unsigned int max_cpus)
1937{ 1937{
1938 zap_low_mappings(); 1938 zap_low_mappings();
1939} 1939}
1940
1941void __init
1942smp_setup_processor_id(void)
1943{
1944 current_thread_info()->cpu = hard_smp_processor_id();
1945}
diff --git a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c
index a5152f174d7b..bd98768d8764 100644
--- a/arch/i386/mm/pgtable.c
+++ b/arch/i386/mm/pgtable.c
@@ -29,7 +29,6 @@ void show_mem(void)
29 struct page *page; 29 struct page *page;
30 pg_data_t *pgdat; 30 pg_data_t *pgdat;
31 unsigned long i; 31 unsigned long i;
32 struct page_state ps;
33 unsigned long flags; 32 unsigned long flags;
34 33
35 printk(KERN_INFO "Mem-info:\n"); 34 printk(KERN_INFO "Mem-info:\n");
@@ -57,12 +56,13 @@ void show_mem(void)
57 printk(KERN_INFO "%d pages shared\n", shared); 56 printk(KERN_INFO "%d pages shared\n", shared);
58 printk(KERN_INFO "%d pages swap cached\n", cached); 57 printk(KERN_INFO "%d pages swap cached\n", cached);
59 58
60 get_page_state(&ps); 59 printk(KERN_INFO "%lu pages dirty\n", global_page_state(NR_FILE_DIRTY));
61 printk(KERN_INFO "%lu pages dirty\n", ps.nr_dirty); 60 printk(KERN_INFO "%lu pages writeback\n",
62 printk(KERN_INFO "%lu pages writeback\n", ps.nr_writeback); 61 global_page_state(NR_WRITEBACK));
63 printk(KERN_INFO "%lu pages mapped\n", ps.nr_mapped); 62 printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED));
64 printk(KERN_INFO "%lu pages slab\n", ps.nr_slab); 63 printk(KERN_INFO "%lu pages slab\n", global_page_state(NR_SLAB));
65 printk(KERN_INFO "%lu pages pagetables\n", ps.nr_page_table_pages); 64 printk(KERN_INFO "%lu pages pagetables\n",
65 global_page_state(NR_PAGETABLE));
66} 66}
67 67
68/* 68/*
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index b487e227a1f7..47de9ee6bcd6 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -70,6 +70,11 @@ config DMA_IS_DMA32
70 bool 70 bool
71 default y 71 default y
72 72
73config DMA_IS_NORMAL
74 bool
75 depends on IA64_SGI_SN2
76 default y
77
73choice 78choice
74 prompt "System type" 79 prompt "System type"
75 default IA64_GENERIC 80 default IA64_GENERIC
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 8937318411aa..d0f82c995af6 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -765,7 +765,6 @@ unsigned long nr_iowait(void)
765#endif /* MODULE */ 765#endif /* MODULE */
766EXPORT_SYMBOL_GPL(si_swapinfo); 766EXPORT_SYMBOL_GPL(si_swapinfo);
767EXPORT_SYMBOL_GPL(nr_threads); 767EXPORT_SYMBOL_GPL(nr_threads);
768EXPORT_SYMBOL_GPL(get_full_page_state);
769EXPORT_SYMBOL_GPL(nr_running); 768EXPORT_SYMBOL_GPL(nr_running);
770EXPORT_SYMBOL_GPL(nr_iowait); 769EXPORT_SYMBOL_GPL(nr_iowait);
771//EXPORT_SYMBOL_GPL(nr_context_switches); 770//EXPORT_SYMBOL_GPL(nr_context_switches);
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index 7165c8f8d3dc..ab3b0765a64e 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -106,21 +106,21 @@ static void appldata_get_mem_data(void *data)
106 * serialized through the appldata_ops_lock and can use static 106 * serialized through the appldata_ops_lock and can use static
107 */ 107 */
108 static struct sysinfo val; 108 static struct sysinfo val;
109 static struct page_state ps; 109 unsigned long ev[NR_VM_EVENT_ITEMS];
110 struct appldata_mem_data *mem_data; 110 struct appldata_mem_data *mem_data;
111 111
112 mem_data = data; 112 mem_data = data;
113 mem_data->sync_count_1++; 113 mem_data->sync_count_1++;
114 114
115 get_full_page_state(&ps); 115 all_vm_events(ev);
116 mem_data->pgpgin = ps.pgpgin >> 1; 116 mem_data->pgpgin = ev[PGPGIN] >> 1;
117 mem_data->pgpgout = ps.pgpgout >> 1; 117 mem_data->pgpgout = ev[PGPGOUT] >> 1;
118 mem_data->pswpin = ps.pswpin; 118 mem_data->pswpin = ev[PSWPIN];
119 mem_data->pswpout = ps.pswpout; 119 mem_data->pswpout = ev[PSWPOUT];
120 mem_data->pgalloc = ps.pgalloc_high + ps.pgalloc_normal + 120 mem_data->pgalloc = ev[PGALLOC_HIGH] + ev[PGALLOC_NORMAL] +
121 ps.pgalloc_dma; 121 ev[PGALLOC_DMA];
122 mem_data->pgfault = ps.pgfault; 122 mem_data->pgfault = ev[PGFAULT];
123 mem_data->pgmajfault = ps.pgmajfault; 123 mem_data->pgmajfault = ev[PGMAJFAULT];
124 124
125 si_meminfo(&val); 125 si_meminfo(&val);
126 mem_data->sharedram = val.sharedram; 126 mem_data->sharedram = val.sharedram;
@@ -129,7 +129,8 @@ static void appldata_get_mem_data(void *data)
129 mem_data->totalhigh = P2K(val.totalhigh); 129 mem_data->totalhigh = P2K(val.totalhigh);
130 mem_data->freehigh = P2K(val.freehigh); 130 mem_data->freehigh = P2K(val.freehigh);
131 mem_data->bufferram = P2K(val.bufferram); 131 mem_data->bufferram = P2K(val.bufferram);
132 mem_data->cached = P2K(atomic_read(&nr_pagecache) - val.bufferram); 132 mem_data->cached = P2K(global_page_state(NR_FILE_PAGES)
133 - val.bufferram);
133 134
134 si_swapinfo(&val); 135 si_swapinfo(&val);
135 mem_data->totalswap = P2K(val.totalswap); 136 mem_data->totalswap = P2K(val.totalswap);
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index 288de276d9ff..aa0fb2efb615 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -196,7 +196,7 @@ asmlinkage int sunos_brk(unsigned long brk)
196 * simple, it hopefully works in most obvious cases.. Easy to 196 * simple, it hopefully works in most obvious cases.. Easy to
197 * fool it, but this should catch most mistakes. 197 * fool it, but this should catch most mistakes.
198 */ 198 */
199 freepages = get_page_cache_size(); 199 freepages = global_page_state(NR_FILE_PAGES);
200 freepages >>= 1; 200 freepages >>= 1;
201 freepages += nr_free_pages(); 201 freepages += nr_free_pages();
202 freepages += nr_swap_pages; 202 freepages += nr_swap_pages;
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index ae5b32f817f0..87ebdf858a3a 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -155,7 +155,7 @@ asmlinkage int sunos_brk(u32 baddr)
155 * simple, it hopefully works in most obvious cases.. Easy to 155 * simple, it hopefully works in most obvious cases.. Easy to
156 * fool it, but this should catch most mistakes. 156 * fool it, but this should catch most mistakes.
157 */ 157 */
158 freepages = get_page_cache_size(); 158 freepages = global_page_state(NR_FILE_PAGES);
159 freepages >>= 1; 159 freepages >>= 1;
160 freepages += nr_free_pages(); 160 freepages += nr_free_pages();
161 freepages += nr_swap_pages; 161 freepages += nr_swap_pages;
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index dfd88b652fbe..dffd1184c956 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -6,9 +6,11 @@ START := 0x60000000
6 6
7#We #undef __x86_64__ for kernelspace, not for userspace where 7#We #undef __x86_64__ for kernelspace, not for userspace where
8#it's needed for headers to work! 8#it's needed for headers to work!
9CFLAGS += -U__$(SUBARCH)__ -fno-builtin 9CFLAGS += -U__$(SUBARCH)__ -fno-builtin -m64
10USER_CFLAGS += -fno-builtin 10USER_CFLAGS += -fno-builtin -m64
11CHECKFLAGS += -m64 11CHECKFLAGS += -m64
12AFLAGS += -m64
13LDFLAGS += -m elf_x86_64
12 14
13ELF_ARCH := i386:x86-64 15ELF_ARCH := i386:x86-64
14ELF_FORMAT := elf64-x86-64 16ELF_FORMAT := elf64-x86-64
@@ -16,3 +18,4 @@ ELF_FORMAT := elf64-x86-64
16# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example. 18# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.
17 19
18LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64 20LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
21LINK-y += -m64
diff --git a/arch/um/drivers/stderr_console.c b/arch/um/drivers/stderr_console.c
index 429ae8e6c7e5..6d2cf32a9e8f 100644
--- a/arch/um/drivers/stderr_console.c
+++ b/arch/um/drivers/stderr_console.c
@@ -8,10 +8,7 @@
8 8
9/* 9/*
10 * Don't register by default -- as this registeres very early in the 10 * Don't register by default -- as this registeres very early in the
11 * boot process it becomes the default console. And as this isn't a 11 * boot process it becomes the default console.
12 * real tty driver init isn't able to open /dev/console then.
13 *
14 * In most cases this isn't what you want ...
15 */ 12 */
16static int use_stderr_console = 0; 13static int use_stderr_console = 0;
17 14
@@ -43,3 +40,20 @@ static int stderr_setup(char *str)
43 return 1; 40 return 1;
44} 41}
45__setup("stderr=", stderr_setup); 42__setup("stderr=", stderr_setup);
43
44/* The previous behavior of not unregistering led to /dev/console being
45 * impossible to open. My FC5 filesystem started having init die, and the
46 * system panicing because of this. Unregistering causes the real
47 * console to become the default console, and /dev/console can then be
48 * opened. Making this an initcall makes this happen late enough that
49 * there is no added value in dumping everything to stderr, and the
50 * normal console is good enough to show you all available output.
51 */
52static int __init unregister_stderr(void)
53{
54 unregister_console(&stderr_console);
55
56 return 0;
57}
58
59__initcall(unregister_stderr);
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index c5c9885a8297..624ca238d1fd 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -152,7 +152,7 @@ void destroy_context_skas(struct mm_struct *mm)
152 free_page(mmu->id.stack); 152 free_page(mmu->id.stack);
153 pte_lock_deinit(virt_to_page(mmu->last_page_table)); 153 pte_lock_deinit(virt_to_page(mmu->last_page_table));
154 pte_free_kernel((pte_t *) mmu->last_page_table); 154 pte_free_kernel((pte_t *) mmu->last_page_table);
155 dec_page_state(nr_page_table_pages); 155 dec_zone_page_state(virt_to_page(mmu->last_page_table), NR_PAGETABLE);
156#ifdef CONFIG_3_LEVEL_PGTABLES 156#ifdef CONFIG_3_LEVEL_PGTABLES
157 pmd_free((pmd_t *) mmu->last_pmd); 157 pmd_free((pmd_t *) mmu->last_pmd);
158#endif 158#endif
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
deleted file mode 100644
index 8fa2ae7f3026..000000000000
--- a/arch/um/kernel/time.c
+++ /dev/null
@@ -1,172 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdio.h>
7#include <stdlib.h>
8#include <unistd.h>
9#include <time.h>
10#include <sys/time.h>
11#include <signal.h>
12#include <errno.h>
13#include "user_util.h"
14#include "kern_util.h"
15#include "user.h"
16#include "process.h"
17#include "time_user.h"
18#include "kern_constants.h"
19#include "os.h"
20
21/* XXX This really needs to be declared and initialized in a kernel file since
22 * it's in <linux/time.h>
23 */
24extern struct timespec wall_to_monotonic;
25
26extern struct timeval xtime;
27
28struct timeval local_offset = { 0, 0 };
29
30void timer(void)
31{
32 gettimeofday(&xtime, NULL);
33 timeradd(&xtime, &local_offset, &xtime);
34}
35
36static void set_interval(int timer_type)
37{
38 int usec = 1000000/hz();
39 struct itimerval interval = ((struct itimerval) { { 0, usec },
40 { 0, usec } });
41
42 if(setitimer(timer_type, &interval, NULL) == -1)
43 panic("setitimer failed - errno = %d\n", errno);
44}
45
46void enable_timer(void)
47{
48 set_interval(ITIMER_VIRTUAL);
49}
50
51void prepare_timer(void * ptr)
52{
53 int usec = 1000000/hz();
54 *(struct itimerval *)ptr = ((struct itimerval) { { 0, usec },
55 { 0, usec }});
56}
57
58void disable_timer(void)
59{
60 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
61 if((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) ||
62 (setitimer(ITIMER_REAL, &disable, NULL) < 0))
63 printk("disnable_timer - setitimer failed, errno = %d\n",
64 errno);
65 /* If there are signals already queued, after unblocking ignore them */
66 set_handler(SIGALRM, SIG_IGN, 0, -1);
67 set_handler(SIGVTALRM, SIG_IGN, 0, -1);
68}
69
70void switch_timers(int to_real)
71{
72 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
73 struct itimerval enable = ((struct itimerval) { { 0, 1000000/hz() },
74 { 0, 1000000/hz() }});
75 int old, new;
76
77 if(to_real){
78 old = ITIMER_VIRTUAL;
79 new = ITIMER_REAL;
80 }
81 else {
82 old = ITIMER_REAL;
83 new = ITIMER_VIRTUAL;
84 }
85
86 if((setitimer(old, &disable, NULL) < 0) ||
87 (setitimer(new, &enable, NULL)))
88 printk("switch_timers - setitimer failed, errno = %d\n",
89 errno);
90}
91
92void uml_idle_timer(void)
93{
94 if(signal(SIGVTALRM, SIG_IGN) == SIG_ERR)
95 panic("Couldn't unset SIGVTALRM handler");
96
97 set_handler(SIGALRM, (__sighandler_t) alarm_handler,
98 SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
99 set_interval(ITIMER_REAL);
100}
101
102extern void ktime_get_ts(struct timespec *ts);
103#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
104
105void time_init(void)
106{
107 struct timespec now;
108
109 if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR)
110 panic("Couldn't set SIGVTALRM handler");
111 set_interval(ITIMER_VIRTUAL);
112
113 do_posix_clock_monotonic_gettime(&now);
114 wall_to_monotonic.tv_sec = -now.tv_sec;
115 wall_to_monotonic.tv_nsec = -now.tv_nsec;
116}
117
118/* Defined in linux/ktimer.h, which can't be included here */
119#define clock_was_set() do { } while (0)
120
121void do_gettimeofday(struct timeval *tv)
122{
123 unsigned long flags;
124
125 flags = time_lock();
126 gettimeofday(tv, NULL);
127 timeradd(tv, &local_offset, tv);
128 time_unlock(flags);
129 clock_was_set();
130}
131
132int do_settimeofday(struct timespec *tv)
133{
134 struct timeval now;
135 unsigned long flags;
136 struct timeval tv_in;
137
138 if ((unsigned long) tv->tv_nsec >= UM_NSEC_PER_SEC)
139 return -EINVAL;
140
141 tv_in.tv_sec = tv->tv_sec;
142 tv_in.tv_usec = tv->tv_nsec / 1000;
143
144 flags = time_lock();
145 gettimeofday(&now, NULL);
146 timersub(&tv_in, &now, &local_offset);
147 time_unlock(flags);
148
149 return(0);
150}
151
152void idle_sleep(int secs)
153{
154 struct timespec ts;
155
156 ts.tv_sec = secs;
157 ts.tv_nsec = 0;
158 nanosleep(&ts, NULL);
159}
160
161/* XXX This partly duplicates init_irq_signals */
162
163void user_time_init(void)
164{
165 set_handler(SIGVTALRM, (__sighandler_t) alarm_handler,
166 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH,
167 SIGALRM, SIGUSR2, -1);
168 set_handler(SIGALRM, (__sighandler_t) alarm_handler,
169 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH,
170 SIGVTALRM, SIGUSR2, -1);
171 set_interval(ITIMER_VIRTUAL);
172}
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index 87cdbc560d36..820fa3615a3f 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -96,11 +96,15 @@ void time_init_kern(void)
96 96
97void do_boot_timer_handler(struct sigcontext * sc) 97void do_boot_timer_handler(struct sigcontext * sc)
98{ 98{
99 unsigned long flags;
99 struct pt_regs regs; 100 struct pt_regs regs;
100 101
101 CHOOSE_MODE((void) (UPT_SC(&regs.regs) = sc), 102 CHOOSE_MODE((void) (UPT_SC(&regs.regs) = sc),
102 (void) (regs.regs.skas.is_user = 0)); 103 (void) (regs.regs.skas.is_user = 0));
104
105 write_seqlock_irqsave(&xtime_lock, flags);
103 do_timer(&regs); 106 do_timer(&regs);
107 write_sequnlock_irqrestore(&xtime_lock, flags);
104} 108}
105 109
106static DEFINE_SPINLOCK(timer_spinlock); 110static DEFINE_SPINLOCK(timer_spinlock);
@@ -125,25 +129,17 @@ irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs)
125 unsigned long long nsecs; 129 unsigned long long nsecs;
126 unsigned long flags; 130 unsigned long flags;
127 131
132 write_seqlock_irqsave(&xtime_lock, flags);
133
128 do_timer(regs); 134 do_timer(regs);
129 135
130 write_seqlock_irqsave(&xtime_lock, flags);
131 nsecs = get_time() + local_offset; 136 nsecs = get_time() + local_offset;
132 xtime.tv_sec = nsecs / NSEC_PER_SEC; 137 xtime.tv_sec = nsecs / NSEC_PER_SEC;
133 xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC; 138 xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC;
134 write_sequnlock_irqrestore(&xtime_lock, flags);
135
136 return(IRQ_HANDLED);
137}
138 139
139long um_time(int __user *tloc) 140 write_sequnlock_irqrestore(&xtime_lock, flags);
140{
141 long ret = get_time() / NSEC_PER_SEC;
142
143 if((tloc != NULL) && put_user(ret, tloc))
144 return -EFAULT;
145 141
146 return ret; 142 return IRQ_HANDLED;
147} 143}
148 144
149void do_gettimeofday(struct timeval *tv) 145void do_gettimeofday(struct timeval *tv)
@@ -174,18 +170,6 @@ static inline void set_time(unsigned long long nsecs)
174 clock_was_set(); 170 clock_was_set();
175} 171}
176 172
177long um_stime(int __user *tptr)
178{
179 int value;
180
181 if (get_user(value, tptr))
182 return -EFAULT;
183
184 set_time((unsigned long long) value * NSEC_PER_SEC);
185
186 return 0;
187}
188
189int do_settimeofday(struct timespec *tv) 173int do_settimeofday(struct timespec *tv)
190{ 174{
191 set_time((unsigned long long) tv->tv_sec * NSEC_PER_SEC + tv->tv_nsec); 175 set_time((unsigned long long) tv->tv_sec * NSEC_PER_SEC + tv->tv_nsec);
diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S
index f8aeb448aab6..72acdce205e0 100644
--- a/arch/um/kernel/vmlinux.lds.S
+++ b/arch/um/kernel/vmlinux.lds.S
@@ -1,3 +1,5 @@
1/* in case the preprocessor is a 32bit one */
2#undef i386
1#ifdef CONFIG_LD_SCRIPT_STATIC 3#ifdef CONFIG_LD_SCRIPT_STATIC
2#include "uml.lds.S" 4#include "uml.lds.S"
3#else 5#else
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index c6432e729241..560c8063c77c 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -55,7 +55,7 @@ static void __init find_tempdir(void)
55 */ 55 */
56static int next(int fd, char *buf, int size, char c) 56static int next(int fd, char *buf, int size, char c)
57{ 57{
58 int n; 58 int n, len;
59 char *ptr; 59 char *ptr;
60 60
61 while((ptr = strchr(buf, c)) == NULL){ 61 while((ptr = strchr(buf, c)) == NULL){
@@ -69,7 +69,17 @@ static int next(int fd, char *buf, int size, char c)
69 } 69 }
70 70
71 ptr++; 71 ptr++;
72 memmove(buf, ptr, strlen(ptr) + 1); 72 len = strlen(ptr);
73 memmove(buf, ptr, len + 1);
74
75 /* Refill the buffer so that if there's a partial string that we care
76 * about, it will be completed, and we can recognize it.
77 */
78 n = read(fd, &buf[len], size - len - 1);
79 if(n < 0)
80 return -errno;
81
82 buf[len + n] = '\0';
73 return 1; 83 return 1;
74} 84}
75 85
@@ -200,8 +210,11 @@ int create_tmp_file(unsigned long long len)
200 exit(1); 210 exit(1);
201 } 211 }
202 212
203 if (lseek64(fd, len, SEEK_SET) < 0) { 213 /* Seek to len - 1 because writing a character there will
204 perror("os_seek_file"); 214 * increase the file size by one byte, to the desired length.
215 */
216 if (lseek64(fd, len - 1, SEEK_SET) < 0) {
217 perror("os_seek_file");
205 exit(1); 218 exit(1);
206 } 219 }
207 220
diff --git a/arch/um/sys-i386/sys_call_table.S b/arch/um/sys-i386/sys_call_table.S
index 1ff61474b25c..2497554b7b95 100644
--- a/arch/um/sys-i386/sys_call_table.S
+++ b/arch/um/sys-i386/sys_call_table.S
@@ -7,8 +7,6 @@
7#define sys_vm86old sys_ni_syscall 7#define sys_vm86old sys_ni_syscall
8#define sys_vm86 sys_ni_syscall 8#define sys_vm86 sys_ni_syscall
9 9
10#define sys_stime um_stime
11#define sys_time um_time
12#define old_mmap old_mmap_i386 10#define old_mmap old_mmap_i386
13 11
14#include "../../i386/kernel/syscall_table.S" 12#include "../../i386/kernel/syscall_table.S"
diff --git a/arch/um/sys-x86_64/syscall_table.c b/arch/um/sys-x86_64/syscall_table.c
index 67ba024581e9..9e9ad72c2ba4 100644
--- a/arch/um/sys-x86_64/syscall_table.c
+++ b/arch/um/sys-x86_64/syscall_table.c
@@ -19,12 +19,6 @@
19/*#define sys_set_thread_area sys_ni_syscall 19/*#define sys_set_thread_area sys_ni_syscall
20#define sys_get_thread_area sys_ni_syscall*/ 20#define sys_get_thread_area sys_ni_syscall*/
21 21
22/* For __NR_time. The x86-64 name hopefully will change from sys_time64 to
23 * sys_time (since the current situation is bogus). I've sent a patch to cleanup
24 * this. Remove below the obsoleted line. */
25#define sys_time64 um_time
26#define sys_time um_time
27
28/* On UML we call it this way ("old" means it's not mmap2) */ 22/* On UML we call it this way ("old" means it's not mmap2) */
29#define sys_mmap old_mmap 23#define sys_mmap old_mmap
30/* On x86-64 sys_uname is actually sys_newuname plus a compatibility trick. 24/* On x86-64 sys_uname is actually sys_newuname plus a compatibility trick.