> All,
> 
>       I'm working on the emulator for OSF1/Mach for FreeBSD/Alpha, and I need
> some help understanding how to do some things in the FreeBSD kernel--if anyone
> can answer any of the following questions, it would be greatly appreciated:
> 
> 1) How do you create a process in the kernel (i.e., you fork in
> user-space...what's the analogue for kernel-space)?
> 
fork1(), see kern_fork.c

> 2) How do you clone a process in kernel-space (i.e., in user-space, you would
> fork and then share the entire process's memory space--how would you do such a
> thing in kernel-space)?
> 
fork1() with RFMEM flag.

> 3) What needs to be done to perform a context switch (from within the kernel),
> and are there any MP considerations when doing this?
> 
Do the following,
        s = splhigh();          
        setrunqueue(p);
        p->p_stats->p_ru.ru_nivcsw++;
        mi_switch();
        splx(s);

nothing special for MP yet, but that's going to change soon...

> 4) In what files do the proc and the u-area structures reside?
> 
If you mean header files, they are <sys/proc.h> and <sys/user.h>.

> Thanks,
> Andrew Miklic
> 

-lq


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to