[Kos-cvs] kos/modules/vmm Makefile,1.22,1.23 _vmm_as.c,1.27,1.28

thomas at kos.enix.org thomas at kos.enix.org
Sun Jan 30 17:11:23 CET 2005


Update of /home/kos/cvs/kos/modules/vmm
In directory the-doors:/tmp/cvs-serv3480/modules/vmm

Modified Files:
	Makefile _vmm_as.c 
Log Message:
2005-01-30  Thomas Petazzoni  <thomas at crazy.kos.nx>

	* modules/x86/mm/Makefile (DEBUG_LEVEL): 1 -> 0

	* modules/vmm/_vmm_as.c: Moved as_dump and vr_dump, create
	as_dump_unsafe.

	* modules/vmm/Makefile (DEBUG_LEVEL): 3 -> 0

	* modules/tty/_tty.c, modules/tty/_tty_kres.c: DEBUG_PRINTx
	conformance + memset().

	* modules/lib/blockfile/libblockfile.c,
	modules/lib/charfile/libcharfile.c,
	modules/lib/filemap/libfilemap.c: Added memset() needed when
	allocated buffer is poisoned. Whitespaces.

	* modules/kmem/_kvmem_free.c: DEBUG_PRINTx conformance +
	whitespaces.

	* modules/kmem/_kvmem_alloc.c (kvalloc): Poison the allocated
	memory + DEBUG_PRINTx conformance.

	* modules/kmem/_kslab_cache_free.c (__kslab_cache_free_by_slab):
	Poison the freed buffer.

	* modules/kmem/_kslab_cache_alloc.c (kslab_cache_alloc): Poison
	the allocated buffer.

	* modules/kmem/_kmem_free.c (kfree): DEBUG_PRINTx conformance.

	* modules/kmem/_kmem_alloc.c (kmalloc): Whitespaces + DEBUG_PRINTx
	conformance.

	* modules/kitc/_kmutex.c: Remove [function] as they are generated
	by DEBUG_PRINTx now.

	* modules/karm/open.c: Whitespaces.

	* modules/karm/mount.c (mount): Cleaned the way of calling
	fs->attach().

	* modules/ide/_ide_karm.c: More debugging messages.

	* modules/ide/_ide.h (ide_device_info): Correct position of packed
	attribute to make gcc happy.

	* modules/part/Makefile (DEBUG_LEVEL), modules/karm/Makefile
	(DEBUG_LEVEL), modules/ide/Makefile
	(DEBUG_LEVEL), modules/fs/devfs/Makefile
	(DEBUG_LEVEL), modules/fs/fat/Makefile
	(DEBUG_LEVEL) : New variable.

	* modules/fs/devfs/devfs.c, modules/fs/fat/_fat.c,
	modules/fs/fat/_fat_karm.c: Added memset() found using the
	poisoning stuff in kmem. More debugging messages using
	DEBUG_PRINTx.

	* modules/debug/debug.h: DEBUG_PRINTx macros now call
	DEBUG_PRINT_VERBOSE instead of __dbg_printk, so that the line
	number, function and file names are printed before the debug
	message.

	* TODO: More things to do.



Index: Makefile
===================================================================
RCS file: /home/kos/cvs/kos/modules/vmm/Makefile,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- Makefile	4 Jan 2005 22:19:19 -0000	1.22
+++ Makefile	30 Jan 2005 16:11:21 -0000	1.23
@@ -1,6 +1,6 @@
 OBJS= _vmm_as.o _vmm_map.o vmm.o _dev_zero.o
 
-DEBUG_LEVEL=3
+DEBUG_LEVEL=0
 
 all: vmm.ro
 

Index: _vmm_as.c
===================================================================
RCS file: /home/kos/cvs/kos/modules/vmm/_vmm_as.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- _vmm_as.c	4 Jan 2005 22:19:19 -0000	1.27
+++ _vmm_as.c	30 Jan 2005 16:11:21 -0000	1.28
@@ -963,6 +963,110 @@
 }
 
 /**
+ * Dump informations about a virtual region
+ *
+ * @param vr The virtual region to dump
+ *
+ * @return   None
+ */
+static void vr_dump (struct virtual_region *vr)
+{
+  vaddr_t vaddr;
+
+  DEBUG_PRINT3("Virtual region at 0x%x : [0x%x,0x%x], As=0x%x, Ures=%p,"
+	       " Sharing=%s, access rights=%c%c%c (%d)\n",
+	       (unsigned)vr, vr->node.key, vr->end, (unsigned)vr->owner_as,
+	       vr->ures,
+	       (vr->sharing_type == MAP_SHARED) ? "shared" : "private",
+	       (vr->access_right & VM_ACCESS_READ) ? 'r' : '-',
+	       (vr->access_right & VM_ACCESS_WRITE) ? 'w' : '-',
+	       (vr->access_right & VM_ACCESS_EXEC) ? 'x' : '-',
+	       vr->access_right);
+
+  for (vaddr = vr->node.key; vaddr < vr->end ; vaddr = vaddr + PAGE_SIZE)
+    {
+      paddr_t paddr;
+      vpage_status_t vpage_status;
+
+      get_paddr_at_vaddr(NULL, vaddr, & paddr);
+
+      get_virtual_page_status(NULL, vaddr, & vpage_status);
+
+      if (vpage_status == PHYS_PAGE_PRESENT)
+	{
+	  DEBUG_PRINT3(" 0x%x => 0x%x (PRESENT)\n",
+		       vaddr,
+		       paddr);
+	}
+
+      else if (vpage_status == PHYS_PAGE_SWAPPED)
+	{
+	  DEBUG_PRINT3(" 0x%x => 0x%x (SWAPPED)\n",
+		       vaddr,
+		       paddr);
+	}
+
+      else if (vpage_status == PHYS_PAGE_UNMAPPED)
+	{
+	  DEBUG_PRINT3(" 0x%x => 0x%x (UNMAPPED)\n",
+		       vaddr,
+		       paddr);
+	}
+    }
+}
+
+/**
+ * Dump informations about an address space. This function is the
+ * unsafe version of as_dump : it doesn't take the mutex on the
+ * address space, assuming its caller did.
+ *
+ * @param as The address space to dump
+ *
+ * @return   None
+ */
+static void _as_dump_unsafe (struct address_space *as)
+{
+  static bool_t visitor(struct virtual_region *vr, void *unused)
+    {
+      UNUSED(unused);
+      vr_dump(vr);
+      return FALSE;
+    }
+
+  if(DEBUG_LEVEL < 3)
+    return;
+
+  DEBUG_PRINT3 (_B_BLUE "*********** AS DUMP @0x%p ************\n", as);
+
+  if(! as->vr_tree)
+    {
+      DEBUG_PRINT3("No virtual regions\n");
+    }
+  else
+    {
+      bst_visit_in_order ( (tree_node_t*) as->vr_tree, (visitor_t) visitor, NULL);
+    }
+
+  DEBUG_PRINT3 ("**********************************\n" _B_NORM);
+}
+
+/**
+ * Dump informations about an address space. This function is the safe
+ * version of as_dump : it does take the mutex on the address space.
+ *
+ * @param as The address space to dump
+ *
+ * @return   None
+ */
+void as_dump(struct address_space *as)
+{
+  CONCEPTION_ASSERT(kmutex_lock(& as->mutex) == ESUCCESS);
+  _as_dump_unsafe(as);
+  CONCEPTION_ASSERT(kmutex_unlock(& as->mutex) == ESUCCESS);
+}
+
+
+/**
  * The top-level page fault handler. It automatically gets called when
  * a page fault occurs.
  *
@@ -1016,7 +1120,7 @@
       if(vr == NULL)
 	{
 	  DEBUG_PRINT2("Out of any region -> FAULT\n");
-	  as_dump(as);
+	  _as_dump_unsafe(as);
 	  CONCEPTION_ASSERT(kmutex_unlock(& as->mutex) == ESUCCESS);
 	  return -EFAULT;
 	}
@@ -1157,96 +1261,6 @@
 }
 
 /**
- * Dump informations about a virtual region
- *
- * @param vr The virtual region to dump
- *
- * @return   None
- */
-static void vr_dump (struct virtual_region *vr)
-{
-  vaddr_t vaddr;
-
-  DEBUG_PRINT3("Virtual region at 0x%x : [0x%x,0x%x], As=0x%x, Ures=%p,"
-	       " Sharing=%s, access rights=%c%c%c (%d)\n",
-	       (unsigned)vr, vr->node.key, vr->end, (unsigned)vr->owner_as,
-	       vr->ures,
-	       (vr->sharing_type == MAP_SHARED) ? "shared" : "private",
-	       (vr->access_right & VM_ACCESS_READ) ? 'r' : '-',
-	       (vr->access_right & VM_ACCESS_WRITE) ? 'w' : '-',
-	       (vr->access_right & VM_ACCESS_EXEC) ? 'x' : '-',
-	       vr->access_right);
-
-  for (vaddr = vr->node.key; vaddr < vr->end ; vaddr = vaddr + PAGE_SIZE)
-    {
-      paddr_t paddr;
-      vpage_status_t vpage_status;
-
-      get_paddr_at_vaddr(NULL, vaddr, & paddr);
-
-      get_virtual_page_status(NULL, vaddr, & vpage_status);
-
-      if (vpage_status == PHYS_PAGE_PRESENT)
-	{
-	  DEBUG_PRINT3(" 0x%x => 0x%x (PRESENT)\n",
-		       vaddr,
-		       paddr);
-	}
-
-      else if (vpage_status == PHYS_PAGE_SWAPPED)
-	{
-	  DEBUG_PRINT3(" 0x%x => 0x%x (SWAPPED)\n",
-		       vaddr,
-		       paddr);
-	}
-
-      else if (vpage_status == PHYS_PAGE_UNMAPPED)
-	{
-	  DEBUG_PRINT3(" 0x%x => 0x%x (UNMAPPED)\n",
-		       vaddr,
-		       paddr);
-	}
-    }
-}
-
-/**
- * Dump informations about an address space
- *
- * @param as The address space to dump
- *
- * @return   None
- */
-void as_dump (struct address_space *as)
-{
-  static bool_t visitor(struct virtual_region *vr, void *unused)
-    {
-      UNUSED(unused);
-      vr_dump(vr);
-      return FALSE;
-    }
-
-  if(DEBUG_LEVEL < 3)
-    return;
-
-  DEBUG_PRINT3 (_B_BLUE "*********** AS DUMP @0x%p ************\n", as);
-
-  CONCEPTION_ASSERT(kmutex_lock(& as->mutex) == ESUCCESS);
-
-  if(! as->vr_tree)
-    {
-      DEBUG_PRINT3("No virtual regions\n");
-    }
-  else
-    {
-      bst_visit_in_order ( (tree_node_t*) as->vr_tree, (visitor_t) visitor, NULL);
-    }
-
-  CONCEPTION_ASSERT(kmutex_unlock(& as->mutex) == ESUCCESS);
-
-  DEBUG_PRINT3 ("**********************************\n" _B_NORM);
-}
-
-/**
  * Update the start of the heap in the given address space. This is
  * used during the initialization of a new task to set the beginning
  * of the heap.



More information about the Kos-cvs mailing list