diff options
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r-- | arch/x86/kernel/process_32.c | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index d5462f228da..c9f28e02e86 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -265,13 +265,13 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait); | |||
265 | * New with Core Duo processors, MWAIT can take some hints based on CPU | 265 | * New with Core Duo processors, MWAIT can take some hints based on CPU |
266 | * capability. | 266 | * capability. |
267 | */ | 267 | */ |
268 | void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) | 268 | void mwait_idle_with_hints(unsigned long ax, unsigned long cx) |
269 | { | 269 | { |
270 | if (!need_resched()) { | 270 | if (!need_resched()) { |
271 | __monitor((void *)¤t_thread_info()->flags, 0, 0); | 271 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
272 | smp_mb(); | 272 | smp_mb(); |
273 | if (!need_resched()) | 273 | if (!need_resched()) |
274 | __mwait(eax, ecx); | 274 | __mwait(ax, cx); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
@@ -320,15 +320,15 @@ void __show_registers(struct pt_regs *regs, int all) | |||
320 | { | 320 | { |
321 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; | 321 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; |
322 | unsigned long d0, d1, d2, d3, d6, d7; | 322 | unsigned long d0, d1, d2, d3, d6, d7; |
323 | unsigned long esp; | 323 | unsigned long sp; |
324 | unsigned short ss, gs; | 324 | unsigned short ss, gs; |
325 | 325 | ||
326 | if (user_mode_vm(regs)) { | 326 | if (user_mode_vm(regs)) { |
327 | esp = regs->esp; | 327 | sp = regs->sp; |
328 | ss = regs->xss & 0xffff; | 328 | ss = regs->ss & 0xffff; |
329 | savesegment(gs, gs); | 329 | savesegment(gs, gs); |
330 | } else { | 330 | } else { |
331 | esp = (unsigned long) (®s->esp); | 331 | sp = (unsigned long) (®s->sp); |
332 | savesegment(ss, ss); | 332 | savesegment(ss, ss); |
333 | savesegment(gs, gs); | 333 | savesegment(gs, gs); |
334 | } | 334 | } |
@@ -341,17 +341,17 @@ void __show_registers(struct pt_regs *regs, int all) | |||
341 | init_utsname()->version); | 341 | init_utsname()->version); |
342 | 342 | ||
343 | printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", | 343 | printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", |
344 | 0xffff & regs->xcs, regs->eip, regs->eflags, | 344 | 0xffff & regs->cs, regs->ip, regs->flags, |
345 | smp_processor_id()); | 345 | smp_processor_id()); |
346 | print_symbol("EIP is at %s\n", regs->eip); | 346 | print_symbol("EIP is at %s\n", regs->ip); |
347 | 347 | ||
348 | printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", | 348 | printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", |
349 | regs->eax, regs->ebx, regs->ecx, regs->edx); | 349 | regs->ax, regs->bx, regs->cx, regs->dx); |
350 | printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", | 350 | printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", |
351 | regs->esi, regs->edi, regs->ebp, esp); | 351 | regs->si, regs->di, regs->bp, sp); |
352 | printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", | 352 | printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", |
353 | regs->xds & 0xffff, regs->xes & 0xffff, | 353 | regs->ds & 0xffff, regs->es & 0xffff, |
354 | regs->xfs & 0xffff, gs, ss); | 354 | regs->fs & 0xffff, gs, ss); |
355 | 355 | ||
356 | if (!all) | 356 | if (!all) |
357 | return; | 357 | return; |
@@ -379,12 +379,12 @@ void __show_registers(struct pt_regs *regs, int all) | |||
379 | void show_regs(struct pt_regs *regs) | 379 | void show_regs(struct pt_regs *regs) |
380 | { | 380 | { |
381 | __show_registers(regs, 1); | 381 | __show_registers(regs, 1); |
382 | show_trace(NULL, regs, ®s->esp); | 382 | show_trace(NULL, regs, ®s->sp); |
383 | } | 383 | } |
384 | 384 | ||
385 | /* | 385 | /* |
386 | * This gets run with %ebx containing the | 386 | * This gets run with %bx containing the |
387 | * function to call, and %edx containing | 387 | * function to call, and %dx containing |
388 | * the "args". | 388 | * the "args". |
389 | */ | 389 | */ |
390 | extern void kernel_thread_helper(void); | 390 | extern void kernel_thread_helper(void); |
@@ -398,16 +398,16 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | |||
398 | 398 | ||
399 | memset(®s, 0, sizeof(regs)); | 399 | memset(®s, 0, sizeof(regs)); |
400 | 400 | ||
401 | regs.ebx = (unsigned long) fn; | 401 | regs.bx = (unsigned long) fn; |
402 | regs.edx = (unsigned long) arg; | 402 | regs.dx = (unsigned long) arg; |
403 | 403 | ||
404 | regs.xds = __USER_DS; | 404 | regs.ds = __USER_DS; |
405 | regs.xes = __USER_DS; | 405 | regs.es = __USER_DS; |
406 | regs.xfs = __KERNEL_PERCPU; | 406 | regs.fs = __KERNEL_PERCPU; |
407 | regs.orig_eax = -1; | 407 | regs.orig_ax = -1; |
408 | regs.eip = (unsigned long) kernel_thread_helper; | 408 | regs.ip = (unsigned long) kernel_thread_helper; |
409 | regs.xcs = __KERNEL_CS | get_kernel_rpl(); | 409 | regs.cs = __KERNEL_CS | get_kernel_rpl(); |
410 | regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; | 410 | regs.flags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; |
411 | 411 | ||
412 | /* Ok, create the new process.. */ | 412 | /* Ok, create the new process.. */ |
413 | return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); | 413 | return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); |
@@ -470,7 +470,7 @@ void prepare_to_copy(struct task_struct *tsk) | |||
470 | unlazy_fpu(tsk); | 470 | unlazy_fpu(tsk); |
471 | } | 471 | } |
472 | 472 | ||
473 | int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, | 473 | int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, |
474 | unsigned long unused, | 474 | unsigned long unused, |
475 | struct task_struct * p, struct pt_regs * regs) | 475 | struct task_struct * p, struct pt_regs * regs) |
476 | { | 476 | { |
@@ -480,8 +480,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, | |||
480 | 480 | ||
481 | childregs = task_pt_regs(p); | 481 | childregs = task_pt_regs(p); |
482 | *childregs = *regs; | 482 | *childregs = *regs; |
483 | childregs->eax = 0; | 483 | childregs->ax = 0; |
484 | childregs->esp = esp; | 484 | childregs->sp = sp; |
485 | 485 | ||
486 | p->thread.esp = (unsigned long) childregs; | 486 | p->thread.esp = (unsigned long) childregs; |
487 | p->thread.esp0 = (unsigned long) (childregs+1); | 487 | p->thread.esp0 = (unsigned long) (childregs+1); |
@@ -508,7 +508,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, | |||
508 | */ | 508 | */ |
509 | if (clone_flags & CLONE_SETTLS) | 509 | if (clone_flags & CLONE_SETTLS) |
510 | err = do_set_thread_area(p, -1, | 510 | err = do_set_thread_area(p, -1, |
511 | (struct user_desc __user *)childregs->esi, 0); | 511 | (struct user_desc __user *)childregs->si, 0); |
512 | 512 | ||
513 | if (err && p->thread.io_bitmap_ptr) { | 513 | if (err && p->thread.io_bitmap_ptr) { |
514 | kfree(p->thread.io_bitmap_ptr); | 514 | kfree(p->thread.io_bitmap_ptr); |
@@ -527,7 +527,7 @@ void dump_thread(struct pt_regs * regs, struct user * dump) | |||
527 | /* changed the size calculations - should hopefully work better. lbt */ | 527 | /* changed the size calculations - should hopefully work better. lbt */ |
528 | dump->magic = CMAGIC; | 528 | dump->magic = CMAGIC; |
529 | dump->start_code = 0; | 529 | dump->start_code = 0; |
530 | dump->start_stack = regs->esp & ~(PAGE_SIZE - 1); | 530 | dump->start_stack = regs->sp & ~(PAGE_SIZE - 1); |
531 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; | 531 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; |
532 | dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; | 532 | dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; |
533 | dump->u_dsize -= dump->u_tsize; | 533 | dump->u_dsize -= dump->u_tsize; |
@@ -538,23 +538,23 @@ void dump_thread(struct pt_regs * regs, struct user * dump) | |||
538 | if (dump->start_stack < TASK_SIZE) | 538 | if (dump->start_stack < TASK_SIZE) |
539 | dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; | 539 | dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; |
540 | 540 | ||
541 | dump->regs.ebx = regs->ebx; | 541 | dump->regs.ebx = regs->bx; |
542 | dump->regs.ecx = regs->ecx; | 542 | dump->regs.ecx = regs->cx; |
543 | dump->regs.edx = regs->edx; | 543 | dump->regs.edx = regs->dx; |
544 | dump->regs.esi = regs->esi; | 544 | dump->regs.esi = regs->si; |
545 | dump->regs.edi = regs->edi; | 545 | dump->regs.edi = regs->di; |
546 | dump->regs.ebp = regs->ebp; | 546 | dump->regs.ebp = regs->bp; |
547 | dump->regs.eax = regs->eax; | 547 | dump->regs.eax = regs->ax; |
548 | dump->regs.ds = regs->xds; | 548 | dump->regs.ds = regs->ds; |
549 | dump->regs.es = regs->xes; | 549 | dump->regs.es = regs->es; |
550 | dump->regs.fs = regs->xfs; | 550 | dump->regs.fs = regs->fs; |
551 | savesegment(gs,dump->regs.gs); | 551 | savesegment(gs,dump->regs.gs); |
552 | dump->regs.orig_eax = regs->orig_eax; | 552 | dump->regs.orig_eax = regs->orig_ax; |
553 | dump->regs.eip = regs->eip; | 553 | dump->regs.eip = regs->ip; |
554 | dump->regs.cs = regs->xcs; | 554 | dump->regs.cs = regs->cs; |
555 | dump->regs.eflags = regs->eflags; | 555 | dump->regs.eflags = regs->flags; |
556 | dump->regs.esp = regs->esp; | 556 | dump->regs.esp = regs->sp; |
557 | dump->regs.ss = regs->xss; | 557 | dump->regs.ss = regs->ss; |
558 | 558 | ||
559 | dump->u_fpvalid = dump_fpu (regs, &dump->i387); | 559 | dump->u_fpvalid = dump_fpu (regs, &dump->i387); |
560 | } | 560 | } |
@@ -566,10 +566,10 @@ EXPORT_SYMBOL(dump_thread); | |||
566 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) | 566 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) |
567 | { | 567 | { |
568 | struct pt_regs ptregs = *task_pt_regs(tsk); | 568 | struct pt_regs ptregs = *task_pt_regs(tsk); |
569 | ptregs.xcs &= 0xffff; | 569 | ptregs.cs &= 0xffff; |
570 | ptregs.xds &= 0xffff; | 570 | ptregs.ds &= 0xffff; |
571 | ptregs.xes &= 0xffff; | 571 | ptregs.es &= 0xffff; |
572 | ptregs.xss &= 0xffff; | 572 | ptregs.ss &= 0xffff; |
573 | 573 | ||
574 | elf_core_copy_regs(regs, &ptregs); | 574 | elf_core_copy_regs(regs, &ptregs); |
575 | 575 | ||
@@ -684,7 +684,7 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, | |||
684 | * More important, however, is the fact that this allows us much | 684 | * More important, however, is the fact that this allows us much |
685 | * more flexibility. | 685 | * more flexibility. |
686 | * | 686 | * |
687 | * The return value (in %eax) will be the "prev" task after | 687 | * The return value (in %ax) will be the "prev" task after |
688 | * the task-switch, and shows up in ret_from_fork in entry.S, | 688 | * the task-switch, and shows up in ret_from_fork in entry.S, |
689 | * for example. | 689 | * for example. |
690 | */ | 690 | */ |
@@ -771,7 +771,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas | |||
771 | 771 | ||
772 | asmlinkage int sys_fork(struct pt_regs regs) | 772 | asmlinkage int sys_fork(struct pt_regs regs) |
773 | { | 773 | { |
774 | return do_fork(SIGCHLD, regs.esp, ®s, 0, NULL, NULL); | 774 | return do_fork(SIGCHLD, regs.sp, ®s, 0, NULL, NULL); |
775 | } | 775 | } |
776 | 776 | ||
777 | asmlinkage int sys_clone(struct pt_regs regs) | 777 | asmlinkage int sys_clone(struct pt_regs regs) |
@@ -780,12 +780,12 @@ asmlinkage int sys_clone(struct pt_regs regs) | |||
780 | unsigned long newsp; | 780 | unsigned long newsp; |
781 | int __user *parent_tidptr, *child_tidptr; | 781 | int __user *parent_tidptr, *child_tidptr; |
782 | 782 | ||
783 | clone_flags = regs.ebx; | 783 | clone_flags = regs.bx; |
784 | newsp = regs.ecx; | 784 | newsp = regs.cx; |
785 | parent_tidptr = (int __user *)regs.edx; | 785 | parent_tidptr = (int __user *)regs.dx; |
786 | child_tidptr = (int __user *)regs.edi; | 786 | child_tidptr = (int __user *)regs.di; |
787 | if (!newsp) | 787 | if (!newsp) |
788 | newsp = regs.esp; | 788 | newsp = regs.sp; |
789 | return do_fork(clone_flags, newsp, ®s, 0, parent_tidptr, child_tidptr); | 789 | return do_fork(clone_flags, newsp, ®s, 0, parent_tidptr, child_tidptr); |
790 | } | 790 | } |
791 | 791 | ||
@@ -801,7 +801,7 @@ asmlinkage int sys_clone(struct pt_regs regs) | |||
801 | */ | 801 | */ |
802 | asmlinkage int sys_vfork(struct pt_regs regs) | 802 | asmlinkage int sys_vfork(struct pt_regs regs) |
803 | { | 803 | { |
804 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.esp, ®s, 0, NULL, NULL); | 804 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.sp, ®s, 0, NULL, NULL); |
805 | } | 805 | } |
806 | 806 | ||
807 | /* | 807 | /* |
@@ -812,13 +812,13 @@ asmlinkage int sys_execve(struct pt_regs regs) | |||
812 | int error; | 812 | int error; |
813 | char * filename; | 813 | char * filename; |
814 | 814 | ||
815 | filename = getname((char __user *) regs.ebx); | 815 | filename = getname((char __user *) regs.bx); |
816 | error = PTR_ERR(filename); | 816 | error = PTR_ERR(filename); |
817 | if (IS_ERR(filename)) | 817 | if (IS_ERR(filename)) |
818 | goto out; | 818 | goto out; |
819 | error = do_execve(filename, | 819 | error = do_execve(filename, |
820 | (char __user * __user *) regs.ecx, | 820 | (char __user * __user *) regs.cx, |
821 | (char __user * __user *) regs.edx, | 821 | (char __user * __user *) regs.dx, |
822 | ®s); | 822 | ®s); |
823 | if (error == 0) { | 823 | if (error == 0) { |
824 | /* Make sure we don't return using sysenter.. */ | 824 | /* Make sure we don't return using sysenter.. */ |
@@ -834,24 +834,24 @@ out: | |||
834 | 834 | ||
835 | unsigned long get_wchan(struct task_struct *p) | 835 | unsigned long get_wchan(struct task_struct *p) |
836 | { | 836 | { |
837 | unsigned long ebp, esp, eip; | 837 | unsigned long bp, sp, ip; |
838 | unsigned long stack_page; | 838 | unsigned long stack_page; |
839 | int count = 0; | 839 | int count = 0; |
840 | if (!p || p == current || p->state == TASK_RUNNING) | 840 | if (!p || p == current || p->state == TASK_RUNNING) |
841 | return 0; | 841 | return 0; |
842 | stack_page = (unsigned long)task_stack_page(p); | 842 | stack_page = (unsigned long)task_stack_page(p); |
843 | esp = p->thread.esp; | 843 | sp = p->thread.esp; |
844 | if (!stack_page || esp < stack_page || esp > top_esp+stack_page) | 844 | if (!stack_page || sp < stack_page || sp > top_esp+stack_page) |
845 | return 0; | 845 | return 0; |
846 | /* include/asm-i386/system.h:switch_to() pushes ebp last. */ | 846 | /* include/asm-i386/system.h:switch_to() pushes bp last. */ |
847 | ebp = *(unsigned long *) esp; | 847 | bp = *(unsigned long *) sp; |
848 | do { | 848 | do { |
849 | if (ebp < stack_page || ebp > top_ebp+stack_page) | 849 | if (bp < stack_page || bp > top_ebp+stack_page) |
850 | return 0; | 850 | return 0; |
851 | eip = *(unsigned long *) (ebp+4); | 851 | ip = *(unsigned long *) (bp+4); |
852 | if (!in_sched_functions(eip)) | 852 | if (!in_sched_functions(ip)) |
853 | return eip; | 853 | return ip; |
854 | ebp = *(unsigned long *) ebp; | 854 | bp = *(unsigned long *) bp; |
855 | } while (count++ < 16); | 855 | } while (count++ < 16); |
856 | return 0; | 856 | return 0; |
857 | } | 857 | } |