patch-2.1.9 linux/arch/sparc/mm/generic.c
Next file: linux/arch/sparc/mm/init.c
Previous file: linux/arch/sparc/mm/fault.c
Back to the patch index
Back to the overall index
- Lines: 42
- Date:
Sat Nov 9 10:12:16 1996
- Orig file:
v2.1.8/linux/arch/sparc/mm/generic.c
- Orig date:
Thu Apr 25 13:22:05 1996
diff -u --recursive --new-file v2.1.8/linux/arch/sparc/mm/generic.c linux/arch/sparc/mm/generic.c
@@ -1,4 +1,4 @@
-/* $Id: generic.c,v 1.2 1996/04/25 06:09:30 davem Exp $
+/* $Id: generic.c,v 1.4 1996/10/27 08:36:41 davem Exp $
* generic.c: Generic Sparc mm routines that are not dependent upon
* MMU type but are Sparc specific.
*
@@ -12,13 +12,34 @@
#include <asm/pgtable.h>
#include <asm/page.h>
+
+/* Allocate a block of RAM which is aligned to its size.
+ * This procedure can be used until the call to mem_init().
+ */
+void *sparc_init_alloc(unsigned long *kbrk, unsigned long size)
+{
+ unsigned long mask = size - 1;
+ unsigned long ret;
+
+ if(!size)
+ return 0x0;
+ if(size & mask) {
+ prom_printf("panic: sparc_init_alloc botch\n");
+ prom_halt();
+ }
+ ret = (*kbrk + mask) & ~mask;
+ *kbrk = ret + size;
+ memset((void*) ret, 0, size);
+ return (void*) ret;
+}
+
static inline void forget_pte(pte_t page)
{
if (pte_none(page))
return;
if (pte_present(page)) {
unsigned long addr = pte_page(page);
- if (addr >= high_memory || PageReserved(mem_map+MAP_NR(addr)))
+ if (MAP_NR(addr) >= max_mapnr || PageReserved(mem_map+MAP_NR(addr)))
return;
free_page(addr);
if (current->mm->rss <= 0)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov