Changeset 15
- Timestamp:
- 10/23/05 18:27:49 (6 years ago)
- Files:
-
- arch/i386/kernel/callgate.c (modified) (4 diffs)
- arch/i386/kernel/process.c (modified) (1 diff)
- arch/i386/kernel/signal.c (modified) (4 diffs)
- arch/i386/kernel/traps.c (modified) (2 diffs)
- kernel/exit.c (modified) (1 diff)
- kernel/fork.c (modified) (2 diffs)
- kernel/module.c (modified) (1 diff)
- kernel/signal.c (modified) (4 diffs)
- .version (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
arch/i386/kernel/callgate.c
r14 r15 51 51 #include <linux/irq.h> 52 52 #include <linux/err.h> 53 #include <linux/sched.h> 53 54 54 55 #define SAVE_SEG "pushl %ds\n\t" \ … … 258 259 return -1; 259 260 } 261 if (tsk->flags & PF_DEAD) { 262 printk("Driver thread is dead\n"); 263 return -ENODEV; 264 } 260 265 if (!tsk->available) { 261 266 printk(KERN_ERR "Thread busy...increase size of driver thread pool\n"); … … 264 269 tsk->available=0; 265 270 //Set memory map 266 if (mm) 271 if (mm) { 272 atomic_inc(&mm->mm_users); 273 atomic_inc(&mm->mm_count); 267 274 tsk->mm=mm; 275 tsk->active_mm=mm; 276 } 268 277 269 278 //Set new state for thread … … 302 311 //printk("Going...\n"); 303 312 //show_regs(regs); 304 wake_up_process(tsk); 313 /*if (tsk->state==TASK_STOPPED) { 314 printk("Waking up driver thread for first time\n"); 315 tsk->state=TASK_RUNNING; 316 }*/ 317 wake_up_process(tsk); 305 318 interruptible_sleep_on(&tsk->wait_driverfinish); 306 319 //Free any memory we allocated arch/i386/kernel/process.c
r14 r15 389 389 /* Ok, create the new process.. */ 390 390 //printk("Calling do_fork"); 391 pid=do_fork(flags | CLONE_STOPPED | CLONE_VM | CLONE_UNTRACED , (unsigned long) stack_start, ®s, 0, NULL, NULL);391 pid=do_fork(flags | CLONE_STOPPED | CLONE_VM | CLONE_UNTRACED | CLONE_PARENT, (unsigned long) stack_start, ®s, 0, NULL, NULL); 392 392 find_task_by_pid(pid)->orig_stack=orig_stack; 393 393 find_task_by_pid(pid)->available=1; arch/i386/kernel/signal.c
r1 r15 30 30 31 31 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 32 32 extern int next_signal(struct sigpending *, sigset_t*); 33 33 /* 34 34 * Atomically swap in the new signal mask, and wait for a signal. … … 559 559 * if so. 560 560 */ 561 if ((regs->xcs & 3) != 3) 561 // if ((regs->xcs & 3) != 3) 562 if ((regs->xcs & 3)==1) 563 printk("Sending signal to ring 1 driver thread!\n"); 564 if (!(regs->xcs & 3)) 562 565 return 1; 563 566 … … 602 605 return 0; 603 606 } 604 605 607 /* 606 608 * notification of userspace execution resumption … … 619 621 if (thread_info_flags & _TIF_SIGPENDING) 620 622 do_signal(regs,oldset); 621 623 624 if ((regs->xcs & 3)==1) { 625 if (next_signal(¤t->pending, ¤t->blocked)==SIGKILL) 626 BUG(); 627 } 622 628 clear_thread_flag(TIF_IRET); 623 629 } arch/i386/kernel/traps.c
r8 r15 437 437 DO_ERROR(12, SIGBUS, "stack segment", stack_segment) 438 438 DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, get_cr2()) 439 440 439 asmlinkage void do_general_protection(struct pt_regs * regs, long error_code) 441 440 { … … 446 445 goto gp_in_vm86; 447 446 448 if (!((regs->xcs & 3) ==3))447 if (!((regs->xcs & 3))) 449 448 goto gp_in_kernel; 450 449 450 if ((regs->xcs & 3)!=3) { 451 //driver thread 452 printk("General protection fault in driver thread at %x\n", regs->eip); 453 //die("general protection", regs, error_code); 454 current->thread.error_code=error_code; 455 current->thread.trap_no=13; 456 force_sig(SIGKILL, current); 457 return; 458 459 } 451 460 current->thread.error_code = error_code; 452 461 current->thread.trap_no = 13; kernel/exit.c
r8 r15 813 813 tsk->exit_code = code; 814 814 exit_notify(tsk); 815 wake_up(&tsk->wait_driverfinish); 815 816 //NEW 816 817 //wake_up(&tsk->wait_kernexit); kernel/fork.c
r8 r15 1202 1202 * We'll start up with an immediate SIGSTOP. 1203 1203 */ 1204 sigaddset(&p->pending.signal, SIGSTOP);1205 set_tsk_thread_flag(p, TIF_SIGPENDING); 1204 /* sigaddset(&p->pending.signal, SIGSTOP); 1205 set_tsk_thread_flag(p, TIF_SIGPENDING);*/ 1206 1206 } 1207 1207 1208 if (!(clone_flags & CLONE_STOPPED)) {1208 // if (!(clone_flags & CLONE_STOPPED)) { 1209 1209 /* 1210 1210 * Do the wakeup last. On SMP we treat fork() and … … 1222 1222 else 1223 1223 wake_up_forked_process(p); 1224 } else { 1224 // } else { 1225 if (clone_flags & CLONE_STOPPED) { 1225 1226 int cpu = get_cpu(); 1226 1227 kernel/module.c
r14 r15 1870 1870 return -1; 1871 1871 } 1872 printk("Invoking init method...\n"); 1872 1873 ret=calldriver((unsigned long) mod->init, NULL, 0, NULL, 0); 1873 1874 if (ret < 0) { kernel/signal.c
r1 r15 232 232 /* Given the mask, find the first available signal that should be serviced. */ 233 233 234 static int 234 //static int 235 int 235 236 next_signal(struct sigpending *pending, sigset_t *mask) 236 237 { … … 1723 1724 sigset_t *mask = ¤t->blocked; 1724 1725 int signr = 0; 1725 1726 /* if ((regs->xcs & 3)==1 || (regs->xcs & 3)==2) { 1727 printk("Sending signal to driver thread in ring %d\n", regs->xcs & 3); 1728 if (next_signal(¤t->pending, ¤t->blocked)==SIGKILL) 1729 panic("Gonna do SIGKILL now"); 1730 } 1731 */ 1726 1732 relock: 1727 1733 spin_lock_irq(¤t->sighand->siglock); … … 1790 1796 if (ka->sa.sa_handler != SIG_DFL) /* Run the handler. */ 1791 1797 break; /* will return non-zero "signr" value */ 1792 1793 1798 /* 1794 1799 * Now we are doing the default action for this signal. … … 1863 1868 * Death signals, no core dump. 1864 1869 */ 1870 if ((regs->xcs & 3)==1 || (regs->xcs & 3)==2) { 1871 do_exit(-ENODEV); 1872 } 1865 1873 do_group_exit(signr); 1866 1874 /* NOTREACHED */ .version
r13 r15 1 1 031 146
