extern void ret_from_fork_krnl();
extern pid_t get_next_pid();
extern list_head_t all_tasks;
+
int do_fork(pt_regs_t *regs, unsigned long flags)
{
task_union *tsk;
}
}
+int kernel_fork()
+{
+ int pid = 0;
+
+ pt_regs_t *regs = ((pt_regs_t *)(TASK_SIZE + ((unsigned long)current))) - 1;
+ unsigned long *pedx = &(regs->edx);
+
+ asm volatile(
+ "movl $1f, %[pedx];"
+ "call do_fork;"
+ "1:"
+ : "=a"(pid)
+ : [pedx] "m"(pedx));
+
+ return pid;
+}
+
void kernel_task(void *entry)
{
pt_regs_t regs;
memset((void *)®s, 0, sizeof(regs));
regs.edx = (unsigned long)entry;
- int pid = do_fork(®s, FORK_KRNL);
+ //int pid = do_fork(®s, FORK_KRNL);
+ int pid = kernel_fork();
printk("kernel task pid is %d\n", pid);
enable_irq();
}