> Date: Tue, 5 Apr 2011 14:50:01 -0600 (MDT)
> From: Artur Grabowski <[email protected]>
>
> Index: kern/kern_fork.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/kern_fork.c,v
> retrieving revision 1.125
> diff -u -r1.125 kern_fork.c
> --- kern/kern_fork.c 3 Apr 2011 14:56:28 -0000 1.125
> +++ kern/kern_fork.c 5 Apr 2011 20:45:08 -0000
> @@ -195,6 +195,11 @@
> /* print the 'table full' message once per 10 seconds */
> struct timeval fork_tfmrate = { 10, 0 };
>
> +struct kmem_va_mode kv_fork = {
> + .kv_map = &kernel_map,
> + .kv_align = USPACE_ALIGN
> +};
> +
> int
> fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
> void (*func)(void *), void *arg, register_t *retval,
> @@ -204,7 +209,7 @@
> uid_t uid;
> struct vmspace *vm;
> int count;
> - vaddr_t uaddr;
> + struct user *uaddr;
If you do this...
> int s;
> extern void endtsleep(void *);
> extern void realitexpire(void *);
> @@ -251,10 +256,7 @@
> return (EAGAIN);
> }
>
> - uaddr = uvm_km_kmemalloc_pla(kernel_map, uvm.kernel_object, USPACE,
> - USPACE_ALIGN, UVM_KMF_ZERO,
> - dma_constraint.ucr_low, dma_constraint.ucr_high,
> - 0, 0, USPACE/PAGE_SIZE);
> + uaddr = km_alloc(USPACE, &kv_fork, &kp_dma_zero, &kd_waitok);
> if (uaddr == 0) {
...you should use NULL in the comparison here and drop the (struct
user *) cast a bit further down.