diff options
Diffstat (limited to 'arch/x86/ia32')
-rw-r--r-- | arch/x86/ia32/ia32_aout.c | 11 | ||||
-rw-r--r-- | arch/x86/ia32/ia32_signal.c | 21 |
2 files changed, 17 insertions, 15 deletions
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index a0e1dbe67dc1..127ec3f07214 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -85,8 +85,10 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump) | |||
85 | dump->regs.ax = regs->ax; | 85 | dump->regs.ax = regs->ax; |
86 | dump->regs.ds = current->thread.ds; | 86 | dump->regs.ds = current->thread.ds; |
87 | dump->regs.es = current->thread.es; | 87 | dump->regs.es = current->thread.es; |
88 | asm("movl %%fs,%0" : "=r" (fs)); dump->regs.fs = fs; | 88 | savesegment(fs, fs); |
89 | asm("movl %%gs,%0" : "=r" (gs)); dump->regs.gs = gs; | 89 | dump->regs.fs = fs; |
90 | savesegment(gs, gs); | ||
91 | dump->regs.gs = gs; | ||
90 | dump->regs.orig_ax = regs->orig_ax; | 92 | dump->regs.orig_ax = regs->orig_ax; |
91 | dump->regs.ip = regs->ip; | 93 | dump->regs.ip = regs->ip; |
92 | dump->regs.cs = regs->cs; | 94 | dump->regs.cs = regs->cs; |
@@ -430,8 +432,9 @@ beyond_if: | |||
430 | current->mm->start_stack = | 432 | current->mm->start_stack = |
431 | (unsigned long)create_aout_tables((char __user *)bprm->p, bprm); | 433 | (unsigned long)create_aout_tables((char __user *)bprm->p, bprm); |
432 | /* start thread */ | 434 | /* start thread */ |
433 | asm volatile("movl %0,%%fs" :: "r" (0)); \ | 435 | loadsegment(fs, 0); |
434 | asm volatile("movl %0,%%es; movl %0,%%ds": :"r" (__USER32_DS)); | 436 | loadsegment(ds, __USER32_DS); |
437 | loadsegment(es, __USER32_DS); | ||
435 | load_gs_index(0); | 438 | load_gs_index(0); |
436 | (regs)->ip = ex.a_entry; | 439 | (regs)->ip = ex.a_entry; |
437 | (regs)->sp = current->mm->start_stack; | 440 | (regs)->sp = current->mm->start_stack; |
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index f25a10124005..8d64c1bc8474 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -207,7 +207,7 @@ struct rt_sigframe | |||
207 | { unsigned int cur; \ | 207 | { unsigned int cur; \ |
208 | unsigned short pre; \ | 208 | unsigned short pre; \ |
209 | err |= __get_user(pre, &sc->seg); \ | 209 | err |= __get_user(pre, &sc->seg); \ |
210 | asm volatile("movl %%" #seg ",%0" : "=r" (cur)); \ | 210 | savesegment(seg, cur); \ |
211 | pre |= mask; \ | 211 | pre |= mask; \ |
212 | if (pre != cur) loadsegment(seg, pre); } | 212 | if (pre != cur) loadsegment(seg, pre); } |
213 | 213 | ||
@@ -236,7 +236,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, | |||
236 | */ | 236 | */ |
237 | err |= __get_user(gs, &sc->gs); | 237 | err |= __get_user(gs, &sc->gs); |
238 | gs |= 3; | 238 | gs |= 3; |
239 | asm("movl %%gs,%0" : "=r" (oldgs)); | 239 | savesegment(gs, oldgs); |
240 | if (gs != oldgs) | 240 | if (gs != oldgs) |
241 | load_gs_index(gs); | 241 | load_gs_index(gs); |
242 | 242 | ||
@@ -342,14 +342,13 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
342 | { | 342 | { |
343 | int tmp, err = 0; | 343 | int tmp, err = 0; |
344 | 344 | ||
345 | tmp = 0; | 345 | savesegment(gs, tmp); |
346 | __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); | ||
347 | err |= __put_user(tmp, (unsigned int __user *)&sc->gs); | 346 | err |= __put_user(tmp, (unsigned int __user *)&sc->gs); |
348 | __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp)); | 347 | savesegment(fs, tmp); |
349 | err |= __put_user(tmp, (unsigned int __user *)&sc->fs); | 348 | err |= __put_user(tmp, (unsigned int __user *)&sc->fs); |
350 | __asm__("movl %%ds,%0" : "=r"(tmp): "0"(tmp)); | 349 | savesegment(ds, tmp); |
351 | err |= __put_user(tmp, (unsigned int __user *)&sc->ds); | 350 | err |= __put_user(tmp, (unsigned int __user *)&sc->ds); |
352 | __asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp)); | 351 | savesegment(es, tmp); |
353 | err |= __put_user(tmp, (unsigned int __user *)&sc->es); | 352 | err |= __put_user(tmp, (unsigned int __user *)&sc->es); |
354 | 353 | ||
355 | err |= __put_user((u32)regs->di, &sc->di); | 354 | err |= __put_user((u32)regs->di, &sc->di); |
@@ -491,8 +490,8 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
491 | regs->dx = 0; | 490 | regs->dx = 0; |
492 | regs->cx = 0; | 491 | regs->cx = 0; |
493 | 492 | ||
494 | asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); | 493 | loadsegment(ds, __USER32_DS); |
495 | asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); | 494 | loadsegment(es, __USER32_DS); |
496 | 495 | ||
497 | regs->cs = __USER32_CS; | 496 | regs->cs = __USER32_CS; |
498 | regs->ss = __USER32_DS; | 497 | regs->ss = __USER32_DS; |
@@ -588,8 +587,8 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
588 | regs->dx = (unsigned long) &frame->info; | 587 | regs->dx = (unsigned long) &frame->info; |
589 | regs->cx = (unsigned long) &frame->uc; | 588 | regs->cx = (unsigned long) &frame->uc; |
590 | 589 | ||
591 | asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); | 590 | loadsegment(ds, __USER32_DS); |
592 | asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); | 591 | loadsegment(es, __USER32_DS); |
593 | 592 | ||
594 | regs->cs = __USER32_CS; | 593 | regs->cs = __USER32_CS; |
595 | regs->ss = __USER32_DS; | 594 | regs->ss = __USER32_DS; |