|
@@ -27,11 +27,12 @@
|
|
|
#include <arch/mm.h>
|
|
#include <arch/mm.h>
|
|
|
#include <arch/string.h>
|
|
#include <arch/string.h>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/types.h>
|
|
|
|
|
+#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
-static int __init init_mapping_16m(void);
|
|
|
|
|
|
|
+static int __init init_mapping_32m(void);
|
|
|
|
|
+static __archptr_t freeptr;
|
|
|
|
|
|
|
|
|
|
|
|
|
/* the most important work is: get total size of ram,
|
|
/* the most important work is: get total size of ram,
|
|
@@ -46,11 +47,11 @@ int arch_mm_init(void) {
|
|
|
|
|
|
|
|
__archptr_t addr;
|
|
__archptr_t addr;
|
|
|
|
|
|
|
|
- init_mapping_16m();
|
|
|
|
|
|
|
+ init_mapping_32m();
|
|
|
|
|
|
|
|
/* put them there, after that, are the page structures. */
|
|
/* put them there, after that, are the page structures. */
|
|
|
z = (struct zone *) &_end;
|
|
z = (struct zone *) &_end;
|
|
|
- p = (struct page *) ((struct zone *) &_end + 2);
|
|
|
|
|
|
|
+ p = (struct page *) (z + 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(z, 0, sizeof(struct zone) * 2);
|
|
memset(z, 0, sizeof(struct zone) * 2);
|
|
@@ -69,7 +70,6 @@ int arch_mm_init(void) {
|
|
|
|
|
|
|
|
addr = PAGE_ALIGN(HIGH_AND_LOW(e->addrh, e->addrl, 32));
|
|
addr = PAGE_ALIGN(HIGH_AND_LOW(e->addrh, e->addrl, 32));
|
|
|
|
|
|
|
|
-
|
|
|
|
|
if (z[e->type].start_addr > (void *) addr)
|
|
if (z[e->type].start_addr > (void *) addr)
|
|
|
z[e->type].start_addr = (void *) addr;
|
|
z[e->type].start_addr = (void *) addr;
|
|
|
|
|
|
|
@@ -95,53 +95,49 @@ int arch_mm_init(void) {
|
|
|
|
|
|
|
|
/* for a 4gb memory space, 12m used to create struct page */
|
|
/* for a 4gb memory space, 12m used to create struct page */
|
|
|
|
|
|
|
|
-static int __init init_mapping_16m(void) {
|
|
|
|
|
|
|
+static int __init init_mapping_32m(void) {
|
|
|
#if CONFIG_64BIT
|
|
#if CONFIG_64BIT
|
|
|
|
|
+ freeptr = 0x3000;
|
|
|
|
|
+
|
|
|
/* already mapped to 1g */
|
|
/* already mapped to 1g */
|
|
|
|
|
+
|
|
|
return 0;
|
|
return 0;
|
|
|
#else
|
|
#else
|
|
|
|
|
|
|
|
__archptr_t *lvl1 = (void *) 0,
|
|
__archptr_t *lvl1 = (void *) 0,
|
|
|
*lvl2 = (void *) 4096;
|
|
*lvl2 = (void *) 4096;
|
|
|
|
|
|
|
|
- __archptr_t addr = 7;
|
|
|
|
|
|
|
+ __archptr_t addr = 4096 + 7;
|
|
|
int i, j;
|
|
int i, j;
|
|
|
|
|
|
|
|
- lvl1[0] = 4096 + 7;
|
|
|
|
|
- lvl1[1] = 8192 + 7;
|
|
|
|
|
- lvl1[2] = 4096 * 3 + 7;
|
|
|
|
|
- lvl1[3] = 4096 * 4 + 7;
|
|
|
|
|
|
|
+ for (i = 0; i < 6; i++, addr += 4096) {
|
|
|
|
|
+ lvl1[i] = addr;
|
|
|
|
|
|
|
|
- lvl1[0xc00] = 4096 + 7;
|
|
|
|
|
- lvl1[0xc01] = 8192 + 7;
|
|
|
|
|
- lvl1[0xc02] = 4096 * 3 + 7;
|
|
|
|
|
- lvl1[0xc03] = 4096 * 4 + 7;
|
|
|
|
|
|
|
+ lvl1[0x300 + i] = addr;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ addr = 7;
|
|
|
|
|
|
|
|
- for (i = 0; i < 4; i++) {
|
|
|
|
|
|
|
+ for (i = 0; i < 6; i++) {
|
|
|
lvl2 = (void *) (lvl1[i] & ~0xff);
|
|
lvl2 = (void *) (lvl1[i] & ~0xff);
|
|
|
|
|
|
|
|
for (j = 0; j < 1024; j++, addr += 4096)
|
|
for (j = 0; j < 1024; j++, addr += 4096)
|
|
|
lvl2[j] = addr;
|
|
lvl2[j] = addr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- invalidate();
|
|
|
|
|
|
|
+ freeptr = (__archptr_t) lvl2 + j;
|
|
|
|
|
+
|
|
|
|
|
+ /* no need to invalidate() */
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-/* pmap */
|
|
|
|
|
-#define START 0x3000
|
|
|
|
|
-
|
|
|
|
|
/* stack - 8192 */
|
|
/* stack - 8192 */
|
|
|
#define END 0x8e000
|
|
#define END 0x8e000
|
|
|
|
|
|
|
|
|
|
|
|
|
-__archptr_t freeptr = START;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
void *early_kmalloc(int nbytes, int align) {
|
|
void *early_kmalloc(int nbytes, int align) {
|
|
|
void *p;
|
|
void *p;
|
|
|
|
|
|