diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-08 04:32:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 04:32:56 -0400 |
commit | 896395c290f902576270d84291c1f7f8bfbe339d (patch) | |
tree | 650114bff3a5f808ee1d713ecc443b0eaab2e1c3 /arch/um/os-Linux | |
parent | af1cf204ba2fd8135933a2e4df523fb1112dc0e2 (diff) | |
parent | 1b40a895df6c7d5a80e71f65674060b03d84bbef (diff) |
Merge branch 'linus' into tmp.x86.mpparse.new
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r-- | arch/um/os-Linux/helper.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/start_up.c | 25 | ||||
-rw-r--r-- | arch/um/os-Linux/sys-i386/registers.c | 4 | ||||
-rw-r--r-- | arch/um/os-Linux/sys-i386/task_size.c | 31 | ||||
-rw-r--r-- | arch/um/os-Linux/sys-x86_64/task_size.c | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/time.c | 7 |
7 files changed, 51 insertions, 21 deletions
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index 74ca7aabf4e1..30860b89ec58 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <unistd.h> | 7 | #include <unistd.h> |
8 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <sched.h> | 9 | #include <sched.h> |
10 | #include <linux/limits.h> | ||
10 | #include <sys/socket.h> | 11 | #include <sys/socket.h> |
11 | #include <sys/wait.h> | 12 | #include <sys/wait.h> |
12 | #include "kern_constants.h" | 13 | #include "kern_constants.h" |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 6be028ca1817..172ad8f72e12 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -55,7 +55,7 @@ static int ptrace_dump_regs(int pid) | |||
55 | * Signals that are OK to receive in the stub - we'll just continue it. | 55 | * Signals that are OK to receive in the stub - we'll just continue it. |
56 | * SIGWINCH will happen when UML is inside a detached screen. | 56 | * SIGWINCH will happen when UML is inside a detached screen. |
57 | */ | 57 | */ |
58 | #define STUB_SIG_MASK (1 << SIGVTALRM) | 58 | #define STUB_SIG_MASK ((1 << SIGVTALRM) | (1 << SIGWINCH)) |
59 | 59 | ||
60 | /* Signals that the stub will finish with - anything else is an error */ | 60 | /* Signals that the stub will finish with - anything else is an error */ |
61 | #define STUB_DONE_MASK (1 << SIGTRAP) | 61 | #define STUB_DONE_MASK (1 << SIGTRAP) |
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index b4b36e0f2e89..183db26d01bf 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
@@ -121,8 +121,10 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit) | |||
121 | { | 121 | { |
122 | int status, n, ret = 0; | 122 | int status, n, ret = 0; |
123 | 123 | ||
124 | if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) | 124 | if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) { |
125 | fatal_perror("stop_ptraced_child : ptrace failed"); | 125 | perror("stop_ptraced_child : ptrace failed"); |
126 | return -1; | ||
127 | } | ||
126 | CATCH_EINTR(n = waitpid(pid, &status, 0)); | 128 | CATCH_EINTR(n = waitpid(pid, &status, 0)); |
127 | if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { | 129 | if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { |
128 | int exit_with = WEXITSTATUS(status); | 130 | int exit_with = WEXITSTATUS(status); |
@@ -212,7 +214,7 @@ static void __init check_sysemu(void) | |||
212 | if (n < 0) | 214 | if (n < 0) |
213 | fatal_perror("check_sysemu : wait failed"); | 215 | fatal_perror("check_sysemu : wait failed"); |
214 | if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP)) | 216 | if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP)) |
215 | fatal("check_sysemu : expected SIGTRAP, got status = %d", | 217 | fatal("check_sysemu : expected SIGTRAP, got status = %d\n", |
216 | status); | 218 | status); |
217 | 219 | ||
218 | if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) | 220 | if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) |
@@ -254,9 +256,11 @@ static void __init check_sysemu(void) | |||
254 | 256 | ||
255 | if (WIFSTOPPED(status) && | 257 | if (WIFSTOPPED(status) && |
256 | (WSTOPSIG(status) == (SIGTRAP|0x80))) { | 258 | (WSTOPSIG(status) == (SIGTRAP|0x80))) { |
257 | if (!count) | 259 | if (!count) { |
258 | fatal("check_ptrace : SYSEMU_SINGLESTEP " | 260 | non_fatal("check_ptrace : SYSEMU_SINGLESTEP " |
259 | "doesn't singlestep"); | 261 | "doesn't singlestep"); |
262 | goto fail; | ||
263 | } | ||
260 | n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, | 264 | n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, |
261 | os_getpid()); | 265 | os_getpid()); |
262 | if (n < 0) | 266 | if (n < 0) |
@@ -266,9 +270,12 @@ static void __init check_sysemu(void) | |||
266 | } | 270 | } |
267 | else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP)) | 271 | else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP)) |
268 | count++; | 272 | count++; |
269 | else | 273 | else { |
270 | fatal("check_ptrace : expected SIGTRAP or " | 274 | non_fatal("check_ptrace : expected SIGTRAP or " |
271 | "(SIGTRAP | 0x80), got status = %d", status); | 275 | "(SIGTRAP | 0x80), got status = %d\n", |
276 | status); | ||
277 | goto fail; | ||
278 | } | ||
272 | } | 279 | } |
273 | if (stop_ptraced_child(pid, 0, 0) < 0) | 280 | if (stop_ptraced_child(pid, 0, 0) < 0) |
274 | goto fail_stopped; | 281 | goto fail_stopped; |
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c index b487cbead1bd..229f7a53d8da 100644 --- a/arch/um/os-Linux/sys-i386/registers.c +++ b/arch/um/os-Linux/sys-i386/registers.c | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | #include <errno.h> | 7 | #include <errno.h> |
8 | #include <sys/ptrace.h> | 8 | #include <sys/ptrace.h> |
9 | #include <asm/user.h> | 9 | #include <sys/user.h> |
10 | #include "kern_constants.h" | 10 | #include "kern_constants.h" |
11 | #include "longjmp.h" | 11 | #include "longjmp.h" |
12 | #include "user.h" | 12 | #include "user.h" |
@@ -76,7 +76,7 @@ int put_fp_registers(int pid, unsigned long *regs) | |||
76 | 76 | ||
77 | void arch_init_registers(int pid) | 77 | void arch_init_registers(int pid) |
78 | { | 78 | { |
79 | struct user_fxsr_struct fpx_regs; | 79 | struct user_fpxregs_struct fpx_regs; |
80 | int err; | 80 | int err; |
81 | 81 | ||
82 | err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs); | 82 | err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs); |
diff --git a/arch/um/os-Linux/sys-i386/task_size.c b/arch/um/os-Linux/sys-i386/task_size.c index ccb49b0aff59..be04c1e183bf 100644 --- a/arch/um/os-Linux/sys-i386/task_size.c +++ b/arch/um/os-Linux/sys-i386/task_size.c | |||
@@ -63,7 +63,7 @@ static int page_ok(unsigned long page) | |||
63 | return ok; | 63 | return ok; |
64 | } | 64 | } |
65 | 65 | ||
66 | unsigned long os_get_task_size(void) | 66 | unsigned long os_get_top_address(void) |
67 | { | 67 | { |
68 | struct sigaction sa, old; | 68 | struct sigaction sa, old; |
69 | unsigned long bottom = 0; | 69 | unsigned long bottom = 0; |
@@ -76,9 +76,9 @@ unsigned long os_get_task_size(void) | |||
76 | * hosts, but shouldn't hurt otherwise. | 76 | * hosts, but shouldn't hurt otherwise. |
77 | */ | 77 | */ |
78 | unsigned long top = 0xffffd000 >> UM_KERN_PAGE_SHIFT; | 78 | unsigned long top = 0xffffd000 >> UM_KERN_PAGE_SHIFT; |
79 | unsigned long test; | 79 | unsigned long test, original; |
80 | 80 | ||
81 | printf("Locating the top of the address space ... "); | 81 | printf("Locating the bottom of the address space ... "); |
82 | fflush(stdout); | 82 | fflush(stdout); |
83 | 83 | ||
84 | /* | 84 | /* |
@@ -89,16 +89,31 @@ unsigned long os_get_task_size(void) | |||
89 | sigemptyset(&sa.sa_mask); | 89 | sigemptyset(&sa.sa_mask); |
90 | sa.sa_flags = SA_NODEFER; | 90 | sa.sa_flags = SA_NODEFER; |
91 | if (sigaction(SIGSEGV, &sa, &old)) { | 91 | if (sigaction(SIGSEGV, &sa, &old)) { |
92 | perror("os_get_task_size"); | 92 | perror("os_get_top_address"); |
93 | exit(1); | 93 | exit(1); |
94 | } | 94 | } |
95 | 95 | ||
96 | if (!page_ok(bottom)) { | 96 | /* Manually scan the address space, bottom-up, until we find |
97 | fprintf(stderr, "Address 0x%x no good?\n", | 97 | * the first valid page (or run out of them). |
98 | bottom << UM_KERN_PAGE_SHIFT); | 98 | */ |
99 | for (bottom = 0; bottom < top; bottom++) { | ||
100 | if (page_ok(bottom)) | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | /* If we've got this far, we ran out of pages. */ | ||
105 | if (bottom == top) { | ||
106 | fprintf(stderr, "Unable to determine bottom of address " | ||
107 | "space.\n"); | ||
99 | exit(1); | 108 | exit(1); |
100 | } | 109 | } |
101 | 110 | ||
111 | printf("0x%x\n", bottom << UM_KERN_PAGE_SHIFT); | ||
112 | printf("Locating the top of the address space ... "); | ||
113 | fflush(stdout); | ||
114 | |||
115 | original = bottom; | ||
116 | |||
102 | /* This could happen with a 4G/4G split */ | 117 | /* This could happen with a 4G/4G split */ |
103 | if (page_ok(top)) | 118 | if (page_ok(top)) |
104 | goto out; | 119 | goto out; |
@@ -114,7 +129,7 @@ unsigned long os_get_task_size(void) | |||
114 | out: | 129 | out: |
115 | /* Restore the old SIGSEGV handling */ | 130 | /* Restore the old SIGSEGV handling */ |
116 | if (sigaction(SIGSEGV, &old, NULL)) { | 131 | if (sigaction(SIGSEGV, &old, NULL)) { |
117 | perror("os_get_task_size"); | 132 | perror("os_get_top_address"); |
118 | exit(1); | 133 | exit(1); |
119 | } | 134 | } |
120 | top <<= UM_KERN_PAGE_SHIFT; | 135 | top <<= UM_KERN_PAGE_SHIFT; |
diff --git a/arch/um/os-Linux/sys-x86_64/task_size.c b/arch/um/os-Linux/sys-x86_64/task_size.c index fad6f57f8ee3..26a0dd1f349c 100644 --- a/arch/um/os-Linux/sys-x86_64/task_size.c +++ b/arch/um/os-Linux/sys-x86_64/task_size.c | |||
@@ -1,4 +1,4 @@ | |||
1 | unsigned long os_get_task_size(unsigned long shift) | 1 | unsigned long os_get_top_address(unsigned long shift) |
2 | { | 2 | { |
3 | /* The old value of CONFIG_TOP_ADDR */ | 3 | /* The old value of CONFIG_TOP_ADDR */ |
4 | return 0x7fc0000000; | 4 | return 0x7fc0000000; |
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index bee98f466d66..dec5678fc17f 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c | |||
@@ -106,6 +106,10 @@ static void deliver_alarm(void) | |||
106 | unsigned long long this_tick = os_nsecs(); | 106 | unsigned long long this_tick = os_nsecs(); |
107 | int one_tick = UM_NSEC_PER_SEC / UM_HZ; | 107 | int one_tick = UM_NSEC_PER_SEC / UM_HZ; |
108 | 108 | ||
109 | /* Protection against the host's time going backwards */ | ||
110 | if ((last_tick != 0) && (this_tick < last_tick)) | ||
111 | this_tick = last_tick; | ||
112 | |||
109 | if (last_tick == 0) | 113 | if (last_tick == 0) |
110 | last_tick = this_tick - one_tick; | 114 | last_tick = this_tick - one_tick; |
111 | 115 | ||
@@ -148,6 +152,9 @@ static int after_sleep_interval(struct timespec *ts) | |||
148 | start_usecs = usec; | 152 | start_usecs = usec; |
149 | 153 | ||
150 | start_usecs -= skew / UM_NSEC_PER_USEC; | 154 | start_usecs -= skew / UM_NSEC_PER_USEC; |
155 | if (start_usecs < 0) | ||
156 | start_usecs = 0; | ||
157 | |||
151 | tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC, | 158 | tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC, |
152 | .tv_usec = start_usecs % UM_USEC_PER_SEC }); | 159 | .tv_usec = start_usecs % UM_USEC_PER_SEC }); |
153 | interval = ((struct itimerval) { { 0, usec }, tv }); | 160 | interval = ((struct itimerval) { { 0, usec }, tv }); |