aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-05-03 03:14:09 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-05-03 03:14:09 -0400
commit27b030d58c8e72fc7a95187a791bd9406e350f02 (patch)
treeab3bab7f39a5ce5bab65578a7e08fa4dfdeb198c /arch/x86_64/kernel
parent79d20b14a0d651f15b0ef9a22b6cf12d284a6d38 (diff)
parent6628465e33ca694bd8fd5c3cf4eb7ff9177bc694 (diff)
Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'arch/x86_64/kernel')
-rw-r--r--arch/x86_64/kernel/e820.c26
-rw-r--r--arch/x86_64/kernel/early_printk.c2
-rw-r--r--arch/x86_64/kernel/entry.S5
-rw-r--r--arch/x86_64/kernel/head64.c7
-rw-r--r--arch/x86_64/kernel/io_apic.c2
-rw-r--r--arch/x86_64/kernel/nmi.c9
-rw-r--r--arch/x86_64/kernel/process.c12
-rw-r--r--arch/x86_64/kernel/ptrace.c5
-rw-r--r--arch/x86_64/kernel/setup.c12
-rw-r--r--arch/x86_64/kernel/setup64.c3
-rw-r--r--arch/x86_64/kernel/sys_x86_64.c6
11 files changed, 51 insertions, 38 deletions
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 56516ac92e5d..7c154dfff64a 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -2,6 +2,12 @@
2 * Handle the memory map. 2 * Handle the memory map.
3 * The functions here do the job until bootmem takes over. 3 * The functions here do the job until bootmem takes over.
4 * $Id: e820.c,v 1.4 2002/09/19 19:25:32 ak Exp $ 4 * $Id: e820.c,v 1.4 2002/09/19 19:25:32 ak Exp $
5 *
6 * Getting sanitize_e820_map() in sync with i386 version by applying change:
7 * - Provisions for empty E820 memory regions (reported by certain BIOSes).
8 * Alex Achenbach <xela@slit.de>, December 2002.
9 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
10 *
5 */ 11 */
6#include <linux/config.h> 12#include <linux/config.h>
7#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -277,7 +283,7 @@ static int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
277 int chgidx, still_changing; 283 int chgidx, still_changing;
278 int overlap_entries; 284 int overlap_entries;
279 int new_bios_entry; 285 int new_bios_entry;
280 int old_nr, new_nr; 286 int old_nr, new_nr, chg_nr;
281 int i; 287 int i;
282 288
283 /* 289 /*
@@ -331,20 +337,24 @@ static int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
331 for (i=0; i < 2*old_nr; i++) 337 for (i=0; i < 2*old_nr; i++)
332 change_point[i] = &change_point_list[i]; 338 change_point[i] = &change_point_list[i];
333 339
334 /* record all known change-points (starting and ending addresses) */ 340 /* record all known change-points (starting and ending addresses),
341 omitting those that are for empty memory regions */
335 chgidx = 0; 342 chgidx = 0;
336 for (i=0; i < old_nr; i++) { 343 for (i=0; i < old_nr; i++) {
337 change_point[chgidx]->addr = biosmap[i].addr; 344 if (biosmap[i].size != 0) {
338 change_point[chgidx++]->pbios = &biosmap[i]; 345 change_point[chgidx]->addr = biosmap[i].addr;
339 change_point[chgidx]->addr = biosmap[i].addr + biosmap[i].size; 346 change_point[chgidx++]->pbios = &biosmap[i];
340 change_point[chgidx++]->pbios = &biosmap[i]; 347 change_point[chgidx]->addr = biosmap[i].addr + biosmap[i].size;
348 change_point[chgidx++]->pbios = &biosmap[i];
349 }
341 } 350 }
351 chg_nr = chgidx;
342 352
343 /* sort change-point list by memory addresses (low -> high) */ 353 /* sort change-point list by memory addresses (low -> high) */
344 still_changing = 1; 354 still_changing = 1;
345 while (still_changing) { 355 while (still_changing) {
346 still_changing = 0; 356 still_changing = 0;
347 for (i=1; i < 2*old_nr; i++) { 357 for (i=1; i < chg_nr; i++) {
348 /* if <current_addr> > <last_addr>, swap */ 358 /* if <current_addr> > <last_addr>, swap */
349 /* or, if current=<start_addr> & last=<end_addr>, swap */ 359 /* or, if current=<start_addr> & last=<end_addr>, swap */
350 if ((change_point[i]->addr < change_point[i-1]->addr) || 360 if ((change_point[i]->addr < change_point[i-1]->addr) ||
@@ -367,7 +377,7 @@ static int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
367 last_type = 0; /* start with undefined memory type */ 377 last_type = 0; /* start with undefined memory type */
368 last_addr = 0; /* start with 0 as last starting address */ 378 last_addr = 0; /* start with 0 as last starting address */
369 /* loop through change-points, determining affect on the new bios map */ 379 /* loop through change-points, determining affect on the new bios map */
370 for (chgidx=0; chgidx < 2*old_nr; chgidx++) 380 for (chgidx=0; chgidx < chg_nr; chgidx++)
371 { 381 {
372 /* keep track of all overlapping bios entries */ 382 /* keep track of all overlapping bios entries */
373 if (change_point[chgidx]->addr == change_point[chgidx]->pbios->addr) 383 if (change_point[chgidx]->addr == change_point[chgidx]->pbios->addr)
diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c
index 750bcd0655dc..e3a19e8ebbf8 100644
--- a/arch/x86_64/kernel/early_printk.c
+++ b/arch/x86_64/kernel/early_printk.c
@@ -60,7 +60,7 @@ static struct console early_vga_console = {
60 60
61/* Serial functions loosely based on a similar package from Klaus P. Gerlicher */ 61/* Serial functions loosely based on a similar package from Klaus P. Gerlicher */
62 62
63int early_serial_base = 0x3f8; /* ttyS0 */ 63static int early_serial_base = 0x3f8; /* ttyS0 */
64 64
65#define XMTRDY 0x20 65#define XMTRDY 0x20
66 66
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 3233a15cc4e0..1086b5fcac21 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -296,6 +296,7 @@ int_very_careful:
296 call syscall_trace_leave 296 call syscall_trace_leave
297 popq %rdi 297 popq %rdi
298 andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi 298 andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi
299 cli
299 jmp int_restore_rest 300 jmp int_restore_rest
300 301
301int_signal: 302int_signal:
@@ -307,6 +308,7 @@ int_signal:
3071: movl $_TIF_NEED_RESCHED,%edi 3081: movl $_TIF_NEED_RESCHED,%edi
308int_restore_rest: 309int_restore_rest:
309 RESTORE_REST 310 RESTORE_REST
311 cli
310 jmp int_with_check 312 jmp int_with_check
311 CFI_ENDPROC 313 CFI_ENDPROC
312 314
@@ -490,7 +492,8 @@ retint_signal:
490 call do_notify_resume 492 call do_notify_resume
491 RESTORE_REST 493 RESTORE_REST
492 cli 494 cli
493 GET_THREAD_INFO(%rcx) 495 GET_THREAD_INFO(%rcx)
496 movl $_TIF_WORK_MASK,%edi
494 jmp retint_check 497 jmp retint_check
495 498
496#ifdef CONFIG_PREEMPT 499#ifdef CONFIG_PREEMPT
diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c
index 6cad46c98a23..0f8c78dcd38c 100644
--- a/arch/x86_64/kernel/head64.c
+++ b/arch/x86_64/kernel/head64.c
@@ -29,8 +29,6 @@ static void __init clear_bss(void)
29 (unsigned long) __bss_end - (unsigned long) __bss_start); 29 (unsigned long) __bss_end - (unsigned long) __bss_start);
30} 30}
31 31
32extern char x86_boot_params[2048];
33
34#define NEW_CL_POINTER 0x228 /* Relative to real mode data */ 32#define NEW_CL_POINTER 0x228 /* Relative to real mode data */
35#define OLD_CL_MAGIC_ADDR 0x90020 33#define OLD_CL_MAGIC_ADDR 0x90020
36#define OLD_CL_MAGIC 0xA33F 34#define OLD_CL_MAGIC 0xA33F
@@ -44,7 +42,7 @@ static void __init copy_bootdata(char *real_mode_data)
44 int new_data; 42 int new_data;
45 char * command_line; 43 char * command_line;
46 44
47 memcpy(x86_boot_params, real_mode_data, 2048); 45 memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE);
48 new_data = *(int *) (x86_boot_params + NEW_CL_POINTER); 46 new_data = *(int *) (x86_boot_params + NEW_CL_POINTER);
49 if (!new_data) { 47 if (!new_data) {
50 if (OLD_CL_MAGIC != * (u16 *) OLD_CL_MAGIC_ADDR) { 48 if (OLD_CL_MAGIC != * (u16 *) OLD_CL_MAGIC_ADDR) {
@@ -93,9 +91,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
93#ifdef CONFIG_SMP 91#ifdef CONFIG_SMP
94 cpu_set(0, cpu_online_map); 92 cpu_set(0, cpu_online_map);
95#endif 93#endif
96 /* default console: */
97 if (!strstr(saved_command_line, "console="))
98 strcat(saved_command_line, " console=tty0");
99 s = strstr(saved_command_line, "earlyprintk="); 94 s = strstr(saved_command_line, "earlyprintk=");
100 if (s != NULL) 95 if (s != NULL)
101 setup_early_printk(s); 96 setup_early_printk(s);
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 29a257295484..60be58617eb9 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -1607,7 +1607,6 @@ static inline void check_timer(void)
1607 disable_8259A_irq(0); 1607 disable_8259A_irq(0);
1608 setup_nmi(); 1608 setup_nmi();
1609 enable_8259A_irq(0); 1609 enable_8259A_irq(0);
1610 check_nmi_watchdog();
1611 } 1610 }
1612 return; 1611 return;
1613 } 1612 }
@@ -1627,7 +1626,6 @@ static inline void check_timer(void)
1627 nmi_watchdog_default(); 1626 nmi_watchdog_default();
1628 if (nmi_watchdog == NMI_IO_APIC) { 1627 if (nmi_watchdog == NMI_IO_APIC) {
1629 setup_nmi(); 1628 setup_nmi();
1630 check_nmi_watchdog();
1631 } 1629 }
1632 return; 1630 return;
1633 } 1631 }
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index e00d4adec36b..61de0b34a01e 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -112,17 +112,20 @@ static __init int cpu_has_lapic(void)
112 } 112 }
113} 113}
114 114
115int __init check_nmi_watchdog (void) 115static int __init check_nmi_watchdog (void)
116{ 116{
117 int counts[NR_CPUS]; 117 int counts[NR_CPUS];
118 int cpu; 118 int cpu;
119 119
120 if (nmi_watchdog == NMI_NONE)
121 return 0;
122
120 if (nmi_watchdog == NMI_LOCAL_APIC && !cpu_has_lapic()) { 123 if (nmi_watchdog == NMI_LOCAL_APIC && !cpu_has_lapic()) {
121 nmi_watchdog = NMI_NONE; 124 nmi_watchdog = NMI_NONE;
122 return -1; 125 return -1;
123 } 126 }
124 127
125 printk(KERN_INFO "testing NMI watchdog ... "); 128 printk(KERN_INFO "Testing NMI watchdog ... ");
126 129
127 for (cpu = 0; cpu < NR_CPUS; cpu++) 130 for (cpu = 0; cpu < NR_CPUS; cpu++)
128 counts[cpu] = cpu_pda[cpu].__nmi_count; 131 counts[cpu] = cpu_pda[cpu].__nmi_count;
@@ -148,6 +151,8 @@ int __init check_nmi_watchdog (void)
148 151
149 return 0; 152 return 0;
150} 153}
154/* Have this called later during boot so counters are updating */
155late_initcall(check_nmi_watchdog);
151 156
152int __init setup_nmi_watchdog(char *str) 157int __init setup_nmi_watchdog(char *str)
153{ 158{
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 9922d2ba24a3..761b6d35e338 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -402,10 +402,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
402 p->thread.fs = me->thread.fs; 402 p->thread.fs = me->thread.fs;
403 p->thread.gs = me->thread.gs; 403 p->thread.gs = me->thread.gs;
404 404
405 asm("movl %%gs,%0" : "=m" (p->thread.gsindex)); 405 asm("mov %%gs,%0" : "=m" (p->thread.gsindex));
406 asm("movl %%fs,%0" : "=m" (p->thread.fsindex)); 406 asm("mov %%fs,%0" : "=m" (p->thread.fsindex));
407 asm("movl %%es,%0" : "=m" (p->thread.es)); 407 asm("mov %%es,%0" : "=m" (p->thread.es));
408 asm("movl %%ds,%0" : "=m" (p->thread.ds)); 408 asm("mov %%ds,%0" : "=m" (p->thread.ds));
409 409
410 if (unlikely(me->thread.io_bitmap_ptr != NULL)) { 410 if (unlikely(me->thread.io_bitmap_ptr != NULL)) {
411 p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); 411 p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
@@ -468,11 +468,11 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *
468 * Switch DS and ES. 468 * Switch DS and ES.
469 * This won't pick up thread selector changes, but I guess that is ok. 469 * This won't pick up thread selector changes, but I guess that is ok.
470 */ 470 */
471 asm volatile("movl %%es,%0" : "=m" (prev->es)); 471 asm volatile("mov %%es,%0" : "=m" (prev->es));
472 if (unlikely(next->es | prev->es)) 472 if (unlikely(next->es | prev->es))
473 loadsegment(es, next->es); 473 loadsegment(es, next->es);
474 474
475 asm volatile ("movl %%ds,%0" : "=m" (prev->ds)); 475 asm volatile ("mov %%ds,%0" : "=m" (prev->ds));
476 if (unlikely(next->ds | prev->ds)) 476 if (unlikely(next->ds | prev->ds))
477 loadsegment(ds, next->ds); 477 loadsegment(ds, next->ds);
478 478
diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
index ecbccbbf5c2a..19eba9aaedd1 100644
--- a/arch/x86_64/kernel/ptrace.c
+++ b/arch/x86_64/kernel/ptrace.c
@@ -18,6 +18,7 @@
18#include <linux/security.h> 18#include <linux/security.h>
19#include <linux/audit.h> 19#include <linux/audit.h>
20#include <linux/seccomp.h> 20#include <linux/seccomp.h>
21#include <linux/signal.h>
21 22
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
@@ -467,7 +468,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
467 case PTRACE_CONT: /* restart after signal. */ 468 case PTRACE_CONT: /* restart after signal. */
468 469
469 ret = -EIO; 470 ret = -EIO;
470 if ((unsigned long) data > _NSIG) 471 if (!valid_signal(data))
471 break; 472 break;
472 if (request == PTRACE_SYSCALL) 473 if (request == PTRACE_SYSCALL)
473 set_tsk_thread_flag(child,TIF_SYSCALL_TRACE); 474 set_tsk_thread_flag(child,TIF_SYSCALL_TRACE);
@@ -529,7 +530,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
529 530
530 case PTRACE_SINGLESTEP: /* set the trap flag. */ 531 case PTRACE_SINGLESTEP: /* set the trap flag. */
531 ret = -EIO; 532 ret = -EIO;
532 if ((unsigned long) data > _NSIG) 533 if (!valid_signal(data))
533 break; 534 break;
534 clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE); 535 clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE);
535 set_singlestep(child); 536 set_singlestep(child);
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index b18c114c7648..2129cf9ba6b2 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -977,7 +977,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c)
977 if ((xlvl & 0xffff0000) == 0x80000000) { 977 if ((xlvl & 0xffff0000) == 0x80000000) {
978 if (xlvl >= 0x80000001) { 978 if (xlvl >= 0x80000001) {
979 c->x86_capability[1] = cpuid_edx(0x80000001); 979 c->x86_capability[1] = cpuid_edx(0x80000001);
980 c->x86_capability[5] = cpuid_ecx(0x80000001); 980 c->x86_capability[6] = cpuid_ecx(0x80000001);
981 } 981 }
982 if (xlvl >= 0x80000004) 982 if (xlvl >= 0x80000004)
983 get_model_name(c); /* Default name */ 983 get_model_name(c); /* Default name */
@@ -1076,7 +1076,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1076 "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL, 1076 "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
1077 1077
1078 /* AMD-defined */ 1078 /* AMD-defined */
1079 "pni", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1079 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1080 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, 1080 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
1081 NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL, 1081 NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
1082 NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow", 1082 NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow",
@@ -1100,11 +1100,17 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1100 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1100 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1101 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1101 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1102 1102
1103 /* VIA/Cyrix/Centaur-defined */
1104 NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
1105 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1106 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1107 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1108
1103 /* AMD-defined (#2) */ 1109 /* AMD-defined (#2) */
1104 "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL, 1110 "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL,
1105 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1111 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1106 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1112 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1107 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL 1113 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1108 }; 1114 };
1109 static char *x86_power_flags[] = { 1115 static char *x86_power_flags[] = {
1110 "ts", /* temperature sensor */ 1116 "ts", /* temperature sensor */
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index b5305b04bc40..678b7ac33b8b 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -12,6 +12,7 @@
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <asm/bootsetup.h>
15#include <asm/pda.h> 16#include <asm/pda.h>
16#include <asm/pgtable.h> 17#include <asm/pgtable.h>
17#include <asm/processor.h> 18#include <asm/processor.h>
@@ -26,7 +27,7 @@
26#include <asm/mman.h> 27#include <asm/mman.h>
27#include <asm/numa.h> 28#include <asm/numa.h>
28 29
29char x86_boot_params[2048] __initdata = {0,}; 30char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
30 31
31cpumask_t cpu_initialized __initdata = CPU_MASK_NONE; 32cpumask_t cpu_initialized __initdata = CPU_MASK_NONE;
32 33
diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c
index 477d8be57d64..dbebd5ccba6b 100644
--- a/arch/x86_64/kernel/sys_x86_64.c
+++ b/arch/x86_64/kernel/sys_x86_64.c
@@ -152,12 +152,6 @@ asmlinkage long sys_uname(struct new_utsname __user * name)
152 return err ? -EFAULT : 0; 152 return err ? -EFAULT : 0;
153} 153}
154 154
155asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
156{
157 unsigned long raddr;
158 return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr;
159}
160
161asmlinkage long sys_time64(long __user * tloc) 155asmlinkage long sys_time64(long __user * tloc)
162{ 156{
163 struct timeval now; 157 struct timeval now;