svn commit: r253685 - in head/sys: amd64/amd64 i386/i386

Jeff Roberson jeff at FreeBSD.org
Fri Jul 26 19:06:15 UTC 2013


Author: jeff
Date: Fri Jul 26 19:06:14 2013
New Revision: 253685
URL: http://svnweb.freebsd.org/changeset/base/253685

Log:
   - Use kmem_malloc rather than kmem_alloc() for GDT/LDT/tss allocations etc.
     This eliminates some unusual uses of that API in favor of more typical
     uses of kmem_malloc().
  
  Discussed with:	kib/alc
  Tested by:	pho
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/sys/amd64/amd64/sys_machdep.c
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- head/sys/amd64/amd64/sys_machdep.c	Fri Jul 26 19:02:17 2013	(r253684)
+++ head/sys/amd64/amd64/sys_machdep.c	Fri Jul 26 19:06:14 2013	(r253685)
@@ -356,8 +356,8 @@ amd64_set_ioperm(td, uap)
 	 */
 	pcb = td->td_pcb;
 	if (pcb->pcb_tssp == NULL) {
-		tssp = (struct amd64tss *)kmem_alloc(kernel_map,
-		    ctob(IOPAGES+1));
+		tssp = (struct amd64tss *)kmem_malloc(kernel_map,
+		    ctob(IOPAGES+1), M_WAITOK);
 		if (tssp == NULL)
 			return (ENOMEM);
 		iomap = (char *)&tssp[1];
@@ -463,8 +463,9 @@ user_ldt_alloc(struct proc *p, int force
 		return (mdp->md_ldt);
 	mtx_unlock(&dt_lock);
 	new_ldt = malloc(sizeof(struct proc_ldt), M_SUBPROC, M_WAITOK);
-	new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
-	     max_ldt_segment * sizeof(struct user_segment_descriptor));
+	new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_map,
+	     max_ldt_segment * sizeof(struct user_segment_descriptor),
+	     M_WAITOK);
 	if (new_ldt->ldt_base == NULL) {
 		FREE(new_ldt, M_SUBPROC);
 		mtx_lock(&dt_lock);

Modified: head/sys/i386/i386/sys_machdep.c
==============================================================================
--- head/sys/i386/i386/sys_machdep.c	Fri Jul 26 19:02:17 2013	(r253684)
+++ head/sys/i386/i386/sys_machdep.c	Fri Jul 26 19:06:14 2013	(r253685)
@@ -164,8 +164,9 @@ sysarch(td, uap)
 		break;
 	case I386_SET_LDT:
 		if (kargs.largs.descs != NULL) {
-			lp = (union descriptor *)kmem_alloc(kernel_map,
-			    kargs.largs.num * sizeof(union descriptor));
+			lp = (union descriptor *)kmem_malloc(kernel_map,
+			    kargs.largs.num * sizeof(union descriptor),
+			    M_WAITOK);
 			if (lp == NULL) {
 				error = ENOMEM;
 				break;
@@ -298,7 +299,8 @@ i386_extend_pcb(struct thread *td)
 		0			/* granularity */
 	};
 
-	ext = (struct pcb_ext *)kmem_alloc(kernel_map, ctob(IOPAGES+1));
+	ext = (struct pcb_ext *)kmem_malloc(kernel_map, ctob(IOPAGES+1),
+	    M_WAITOK);
 	if (ext == 0)
 		return (ENOMEM);
 	bzero(ext, sizeof(struct pcb_ext)); 
@@ -471,8 +473,8 @@ user_ldt_alloc(struct mdproc *mdp, int l
                 M_SUBPROC, M_WAITOK); 
  
         new_ldt->ldt_len = len = NEW_MAX_LD(len); 
-        new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map, 
-                round_page(len * sizeof(union descriptor))); 
+        new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_map, 
+                round_page(len * sizeof(union descriptor)), M_WAITOK);
         if (new_ldt->ldt_base == NULL) { 
                 free(new_ldt, M_SUBPROC);
 		mtx_lock_spin(&dt_lock);
@@ -511,8 +513,8 @@ user_ldt_alloc(struct mdproc *mdp, int l
 		M_SUBPROC, M_WAITOK);
 
 	new_ldt->ldt_len = len = NEW_MAX_LD(len);
-	new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map,
-		len * sizeof(union descriptor));
+	new_ldt->ldt_base = (caddr_t)kmem_malloc(kernel_map,
+		len * sizeof(union descriptor), M_WAITOK);
 	if (new_ldt->ldt_base == NULL) {
 		free(new_ldt, M_SUBPROC);
 		mtx_lock_spin(&dt_lock);


More information about the svn-src-head mailing list