Author: jchandra
Date: Fri Dec  3 19:22:18 2010
New Revision: 216157
URL: http://svn.freebsd.org/changeset/base/216157

Log:
  1. Fix off by one errors in calls to MIPS_DIRECT_MAPPABLE, reported by alc@
  2. Remove unnecessary #defines from vmparam.h
  
  Submitted by: alc (2)
  Reviewed by:  alc (1)

Modified:
  head/sys/mips/include/vmparam.h
  head/sys/mips/mips/pmap.c

Modified: head/sys/mips/include/vmparam.h
==============================================================================
--- head/sys/mips/include/vmparam.h     Fri Dec  3 18:30:55 2010        
(r216156)
+++ head/sys/mips/include/vmparam.h     Fri Dec  3 19:22:18 2010        
(r216157)
@@ -46,11 +46,6 @@
 /*
  * Machine dependent constants mips processors.
  */
-/*
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack.
- */
-#define        USRTEXT         (1*PAGE_SIZE)
 
 /*
  * Virtual memory related constants, all in bytes
@@ -94,7 +89,6 @@
 #define        VM_MAX_ADDRESS          
((vm_offset_t)(intptr_t)(int32_t)0xffffffff)
 
 #define        VM_MINUSER_ADDRESS      ((vm_offset_t)0x00000000)
-#define        VM_MAX_MMAP_ADDR        VM_MAXUSER_ADDRESS
 
 #ifdef __mips_n64
 #define        VM_MAXUSER_ADDRESS      (VM_MINUSER_ADDRESS + (NPDEPG * NBSEG))

Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c   Fri Dec  3 18:30:55 2010        (r216156)
+++ head/sys/mips/mips/pmap.c   Fri Dec  3 19:22:18 2010        (r216157)
@@ -196,14 +196,15 @@ static void pmap_update_page_action(void
 
 #ifndef __mips_n64
 /*
- * This structure is for high memory (memory above 512Meg in 32 bit)
- * This memory area does not have direct mapping, so we a mechanism to do
- * temporary per-CPU mapping to access these addresses.
- *
- * At bootup we reserve 2 virtual pages per CPU for mapping highmem pages, to 
- * access a highmem physical address on a CPU, we will disable interrupts and
- * add the mapping from the reserved virtual address for the CPU to the 
physical
- * address in the kernel pagetable.
+ * This structure is for high memory (memory above 512Meg in 32 bit) support.
+ * The highmem area does not have a KSEG0 mapping, and we need a mechanism to
+ * do temporary per-CPU mappings for pmap_zero_page, pmap_copy_page etc.
+ *
+ * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pages. To 
+ * access a highmem physical address on a CPU, we map the physical address to
+ * the reserved virtual address for the CPU in the kernel pagetable.  This is 
+ * done with interrupts disabled(although a spinlock and sched_pin would be 
+ * sufficient).
  */
 struct local_sysmaps {
        vm_offset_t     base;
@@ -520,11 +521,11 @@ again:
        }
 
                /*
-        * In 32 bit, we may have memory which cannot be mapped directly
-        * this memory will need temporary mapping before it can be
+        * In 32 bit, we may have memory which cannot be mapped directly.
+        * This memory will need temporary mapping before it can be
         * accessed.
         */
-       if (!MIPS_DIRECT_MAPPABLE(phys_avail[i - 1]))
+       if (!MIPS_DIRECT_MAPPABLE(phys_avail[i - 1] - 1))
                need_local_mappings = 1;
 
        /*
@@ -893,7 +894,7 @@ pmap_map(vm_offset_t *virt, vm_offset_t 
 {
        vm_offset_t va, sva;
 
-       if (MIPS_DIRECT_MAPPABLE(end))
+       if (MIPS_DIRECT_MAPPABLE(end - 1))
                return (MIPS_PHYS_TO_DIRECT(start));
 
        va = sva = *virt;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to