Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2007 17:33:06 GMT
From:      Jesper Brix Rosenkilde <jbr@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 125223 for review
Message-ID:  <200708161733.l7GHX6ku000575@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125223

Change 125223 by jbr@jbr_bob on 2007/08/16 17:32:20

	backup

Affected files ...

.. //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_exec.c#14 edit
.. //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_map.c#9 edit
.. //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_map.h#5 edit

Differences ...

==== //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_exec.c#14 (text+ko) ====

@@ -917,11 +917,15 @@
 	struct proc *p = imgp->proc;
 	vm_map_t map = &imgp->proc->p_vmspace->vm_map;
 	vm_offset_t *addr = &imgp->proc->p_usrsysshm;
+	struct sf_buf *kern_buf = p->p_kernsysshm;;
+	int test = 42;
 
 	if (p->p_kernsysshm != NULL)
 		exec_unmap_sysshm(imgp);
 
-	error = vm_map_sysshm(map, addr, 42);
+	error = vm_map_sysshm(map, addr, kern_buf, 42);
+
+	copyout((caddr_t) &test, (caddr_t) *addr, sizeof(int)); 
 
 	return(error);
 }

==== //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_map.c#9 (text+ko) ====

@@ -76,6 +76,7 @@
 #include <sys/vnode.h>
 #include <sys/resourcevar.h>
 #include <sys/file.h>
+#include <sys/sf_buf.h>
 #include <sys/sysent.h>
 #include <sys/shm.h>
 
@@ -2987,7 +2988,8 @@
  * process.
  */
 int
-vm_map_sysshm(vm_map_t map, vm_offset_t *addr, vm_size_t size)
+vm_map_sysshm(vm_map_t map, vm_offset_t *usr_addr, struct sf_buf *kern_buf, 
+		vm_size_t size)
 {
 	vm_object_t object;
 	vm_page_t sysshm_page;
@@ -2995,16 +2997,11 @@
 	size = round_page(size);
 	PROC_LOCK(curthread->td_proc);
 
-	*addr = round_page((vm_offset_t)
+	*usr_addr = round_page((vm_offset_t)
 	    curthread->td_proc->p_vmspace->vm_daddr) +
 	    lim_cur(curthread->td_proc, RLIMIT_DATA);
 	PROC_UNLOCK(curthread->td_proc);
 	
-	/*
-	error = vm_map_find(map, NULL, 0, addr, size, TRUE, VM_PROT_RW,
-			VM_PROT_RW, MAP_NOFAULT); 
-	*/
-	
 	object = vm_object_allocate(OBJT_DEFAULT, 1);
 	if (!object)
 		panic("vm_map_sysshm: cannot allocate object");
@@ -3017,22 +3014,27 @@
 	sysshm_page->valid = VM_PAGE_BITS_ALL;
 	VM_OBJECT_UNLOCK(object);
 
-	if (vm_map_findspace(map, *addr, size, addr))
+	if (vm_map_findspace(map, *usr_addr, size, usr_addr))
 		return (1);
 
-	if (vm_map_insert(map, object, 0, *addr, *addr + size, VM_PROT_RW, 
-			VM_PROT_RW, 0))
+	if (vm_map_insert(map, object, 0, *usr_addr, *usr_addr + size, 
+				VM_PROT_RW, VM_PROT_RW, 0))
 		panic("vm_map_sysshm: cannot insert object into vm_map.");
 
-	pmap_enter(map->pmap, *addr, sysshm_page, VM_PROT_RW, TRUE);
+	pmap_enter(map->pmap, *usr_addr, sysshm_page, VM_PROT_RW, TRUE);
 
 	VM_OBJECT_LOCK(object);
 	vm_page_lock_queues();
+	vm_page_wire(sysshm_page);
 	vm_page_activate(sysshm_page);
 	vm_page_unlock_queues();
 	vm_page_wakeup(sysshm_page);
 	VM_OBJECT_UNLOCK(object);
 
+	kern_buf = sf_buf_alloc(sysshm_page, SFB_NOWAIT);
+	if (!kern_buf)
+		return 1;
+
 	return (0);
 }
 

==== //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_map.h#5 (text+ko) ====

@@ -354,7 +354,7 @@
 void vm_map_simplify_entry (vm_map_t, vm_map_entry_t);
 void vm_init2 (void);
 int vm_map_stack (vm_map_t, vm_offset_t, vm_size_t, vm_prot_t, vm_prot_t, int);
-int vm_map_sysshm(vm_map_t, vm_offset_t *, vm_size_t);
+int vm_map_sysshm(vm_map_t, vm_offset_t *, struct sf_buf *, vm_size_t);
 int vm_map_growstack (struct proc *p, vm_offset_t addr);
 int vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end,
     int flags);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708161733.l7GHX6ku000575>