|
@@ -1,4 +1,4 @@
|
|
|
-/* arch/x86/kernel/archx86_mm32.c
|
|
|
|
|
|
|
+/* arch/x86/kernel/arch_mm.c
|
|
|
*
|
|
*
|
|
|
* This file is part of evx.
|
|
* This file is part of evx.
|
|
|
*
|
|
*
|
|
@@ -34,6 +34,8 @@
|
|
|
static int __init init_mapping_32m(void);
|
|
static int __init init_mapping_32m(void);
|
|
|
__archptr_t freeptr;
|
|
__archptr_t freeptr;
|
|
|
|
|
|
|
|
|
|
+void *kernel_end;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/* the most important work is: get total size of ram,
|
|
/* the most important work is: get total size of ram,
|
|
|
* and initiallize page structures */
|
|
* and initiallize page structures */
|
|
@@ -45,13 +47,16 @@ int arch_mm_init(void) {
|
|
|
|
|
|
|
|
int i;
|
|
int i;
|
|
|
|
|
|
|
|
- __archptr_t addr;
|
|
|
|
|
|
|
+ __archptr_t addr, total_pages;
|
|
|
|
|
+
|
|
|
|
|
+ total_pages = 0;
|
|
|
|
|
|
|
|
init_mapping_32m();
|
|
init_mapping_32m();
|
|
|
|
|
+ kernel_end = (void *) (KERNEL_OFFSET | (__archptr_t) &_end);
|
|
|
|
|
|
|
|
/* put them there, after that, are the page structures. */
|
|
/* put them there, after that, are the page structures. */
|
|
|
- z = (struct zone *) &_end;
|
|
|
|
|
- p = (struct page *) (z + 2);
|
|
|
|
|
|
|
+ z = kmem_zones;
|
|
|
|
|
+ p = kmem_pages;
|
|
|
|
|
|
|
|
memset(z, 0, sizeof(struct zone) * 2);
|
|
memset(z, 0, sizeof(struct zone) * 2);
|
|
|
|
|
|
|
@@ -76,10 +81,12 @@ int arch_mm_init(void) {
|
|
|
npages = PAGE_NR(HIGH_AND_LOW(e->lenh, e->lenl, 32));
|
|
npages = PAGE_NR(HIGH_AND_LOW(e->lenh, e->lenl, 32));
|
|
|
z[e->type].total_pages += npages;
|
|
z[e->type].total_pages += npages;
|
|
|
|
|
|
|
|
|
|
+ /* any page */
|
|
|
|
|
+ total_pages += npages;
|
|
|
|
|
+
|
|
|
/* now initiallize page structures */
|
|
/* now initiallize page structures */
|
|
|
|
|
|
|
|
for (i = 0; i < npages; i++) {
|
|
for (i = 0; i < npages; i++) {
|
|
|
- p->pnr = PAGE_NR(addr);
|
|
|
|
|
p->count = 0;
|
|
p->count = 0;
|
|
|
p->next = p + 1;
|
|
p->next = p + 1;
|
|
|
|
|
|
|
@@ -87,6 +94,8 @@ int arch_mm_init(void) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ first_usable_ram = page_descr(PAGE_ALIGN((__archptr_t) (kmem_pages + total_pages)));
|
|
|
|
|
+
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|