lkml.org 
[lkml]   [1999]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
SubjectRe: [patch] bootmem-2.3.25-A0
FYI: In SH tree, we use following definitions for MAP_NR, pte_pagenr
and page_address to reduce the size of mem_map memory. (Where
__MEMORY_START is the physical memory start address.)

--------
#define MAP_NR(addr) ((__pa(addr)-__MEMORY_START) >> PAGE_SHIFT)
--------
#define pte_pagenr(x) ((unsigned long)(((pte_val(x) -__MEMORY_START) >> PAGE_SHIFT)))
#define page_address(page) ({ PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT) + __MEMORY_START; })
--------

Me, (NIIBE Yutaka) wrote:
> I'd like to provide a patch for the option #2, could you please take a
> look at it. Is it OK for you, Ingo?

For bootmem_map, how about the following patch? It doesn't require
for other architecuture to have __MEMORY_START, all that we need is
changing arch/XXX/kernel/setup.c adding last argument for physical
memory start address.


--- linux-2.3.26-pre2/include/linux/bootmem.h Sat Oct 23 04:47:22 1999
+++ linux-sh/include/linux/bootmem.h Sat Nov 6 10:32:18 1999
@@ -11,7 +11,7 @@

extern unsigned long max_low_pfn;

-extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend);
+extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend, unsigned long mem_start);
extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
extern void __init free_bootmem (unsigned long addr, unsigned long size);
extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
--- linux-2.3.26-pre2/mm/bootmem.c Sat Nov 6 10:31:37 1999
+++ linux-sh/mm/bootmem.c Sat Nov 6 10:33:55 1999
@@ -18,6 +18,7 @@
#include <linux/bootmem.h>
#include <linux/highmem.h>
#include <asm/dma.h>
+#include <asm/io.h>

/*
* Pointer to a bitmap - the bits represent all physical memory pages
@@ -29,15 +30,19 @@
unsigned long max_low_pfn;

static void * bootmem_map = NULL;
+static unsigned long phys_mem_start;

/*
* Called once to set up the allocator itself.
*/
-unsigned long __init init_bootmem (unsigned long start, unsigned long pages)
+unsigned long __init init_bootmem (unsigned long start,
+ unsigned long pages,
+ unsigned long memory_start)
{
unsigned long mapsize = (pages+7)/8;

- bootmem_map = phys_to_virt(start << PAGE_SHIFT);
+ phys_mem_start = memory_start;
+ bootmem_map = phys_to_virt((start << PAGE_SHIFT) + phys_mem_start);
max_low_pfn = pages;

/*
@@ -172,11 +177,11 @@
areasize = 0;
// last_pos unchanged
last_offset = offset+size;
- ret = phys_to_virt(last_pos*PAGE_SIZE + offset);
+ ret = phys_to_virt(last_pos*PAGE_SIZE + offset + phys_mem_start);
} else {
size -= remaining_size;
areasize = (size+PAGE_SIZE-1)/PAGE_SIZE;
- ret = phys_to_virt(last_pos*PAGE_SIZE + offset);
+ ret = phys_to_virt(start * PAGE_SIZE + phys_mem_start);
last_pos = start+areasize-1;
last_offset = size;
}
@@ -184,7 +189,7 @@
} else {
last_pos = start + areasize - 1;
last_offset = size & ~PAGE_MASK;
- ret = phys_to_virt(start * PAGE_SIZE);
+ ret = phys_to_virt(start * PAGE_SIZE + phys_mem_start);
}
/*
* Reserve the area now:
--
Niibe Yutaka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.069 / U:1.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site