|
Message
From: =?unknown-8bit?Q?Gy=F6rgy?= 'nog' Jeney<nog@s...>
Date: Sun Apr 24 11:08:08 CEST 2005
Subject: [openrisc] [or1ksim #83] Remove fixed immu pagesize
Hi,This removes the fixed page size limitation from the recompiler. Are page sizes other that 8kbyte alowed anyway? The architecture manual states: "Level 2 pages (8kbytes) translated with D/I Translation Lookaside Buffer (TLB)", which pretty much defines the pagesize to be 8kbytes. Also or1200_defines.v has this define: "`define OR1200_IMMU_PS 13 // 13 for 8KB page size", suggesting that the page size is configurable. There is also PAGE_SIZE defined to be 8192 in opcode/or32.h which is used in numberous places in the code (most notably the testbenches). Should this also go sometime?
ChangeLog: * Remove fixed pagesize limitation from the recompiler.
nog. -------------- next part -------------- diff -uPr --unidirectional-new-file ./cpu/common/abstract.h /home/nog/or1ksim-ac/cpu/common/abstract.h --- ./cpu/common/abstract.h 2005-03-31 16:28:03.000000000 +0200 +++ /home/nog/or1ksim-ac/cpu/common/abstract.h 2005-04-24 10:41:59.000000000 +0200 @@ -161,7 +161,7 @@ extern int cont_run; /* Returns the page that addr belongs to */ -#define ADDR_PAGE(addr) ((addr) & ~(ADDR_C(PAGE_SIZE) - 1)) +#define ADDR_PAGE(addr) ((addr) & ~(config.immu.pagesize - 1)) /* History of execution */ #define HISTEXEC_LEN 200 diff -uPr --unidirectional-new-file ./cpu/or32/dyn_rec.c /home/nog/or1ksim-ac/cpu/or32/dyn_rec.c --- ./cpu/or32/dyn_rec.c 2005-04-22 16:14:09.000000000 +0200 +++ /home/nog/or1ksim-ac/cpu/or32/dyn_rec.c 2005-04-24 10:45:04.000000000 +0200 @@ -55,9 +55,6 @@ /* FIXME: Optimise sorted list adding */ -/* FIXME: remove this and use config.immu.pagesize */ -#define PAGE_LEN 8192 - typedef void (*generic_gen_op)(struct op_queue *opq, int end); typedef void (*imm_gen_op)(struct op_queue *opq, int end, uorreg_t imm); @@ -386,7 +386,7 @@ struct dyn_page *dp = malloc(sizeof(struct dyn_page)); dp->or_page = ADDR_PAGE(page); - dp->locs = malloc(sizeof(void *) * (PAGE_LEN / 4)); + dp->locs = malloc(sizeof(void *) * (config.immu.pagesize / 4)); dp->host_len = 0; dp->host_page = NULL; @@ -400,7 +400,7 @@ { struct dyn_page *cur = cpu_state.dyn_pages; - addr &= ~(ADDR_C(PAGE_LEN) - 1); + addr &= ~(config.immu.pagesize - 1); while(cur) { if(cur->or_page == addr) return cur; @@ -643,7 +644,7 @@ cpu_state.opqs = NULL; /* Allocate the operation queue list (+1 for the page chaining) */ - for(i = 0; i < (PAGE_LEN / 4) + 1; i++) { + for(i = 0; i < (config.immu.pagesize / 4) + 1; i++) { if(!(opq = malloc(sizeof(struct op_queue)))) { fprintf(stderr, "OOM\n"); exit(1); @@ -909,7 +910,7 @@ void **loc; /* The start of the next page */ - rec_page += PAGE_LEN; + rec_page += config.immu.pagesize; printf("Recompileing page %"PRIxADDR"\n", rec_addr); fflush(stdout); @@ -967,7 +968,7 @@ dyn->dirty = 0; /* Store the state of the temporaries */ - dyn->ts_bound[PAGE_LEN >> 2] = dyn->ts_during[j]; + dyn->ts_bound[config.immu.pagesize >> 2] = dyn->ts_during[j]; /* Ship temporaries out to the corrisponding registers */ ship_gprs_out_t(opq->prev, 1, opq->reg_t); @@ -985,13 +986,14 @@ gen_code(cpu_state.opqs, dyn); /* Fix up the locations */ - for(loc = dyn->locs; loc < &dyn->locs[PAGE_LEN / 4]; loc++) + for(loc = dyn->locs; loc < &dyn->locs[config.immu.pagesize / 4]; loc++) *loc += (unsigned int)dyn->host_page; cpu_state.opqs->ops_param[0] += (unsigned int)dyn->host_page; /* Search for page-local jumps */ - for(opq = cpu_state.opqs, j = 0; j < (PAGE_LEN / 4); opq = opq->next, j++) { + opq = cpu_state.opqs; + for(j = 0; j < (config.immu.pagesize / 4); opq = opq->next, j++) { if(opq->jump_local != -1) opq->ops_param[opq->jump_local] = (unsigned int)dyn->locs[opq->jump_local_loc >> 2];
@@ -1114,7 +1116,7 @@
if(jump_local) {
gen_op_jmp_imm(opq, 1, 0);
opq->jump_local = opq->num_ops_param - 1;
- opq->jump_local_loc = (opq->insn_addr + (orreg_t)off) & (PAGE_LEN - 1);
+ opq->jump_local_loc = (opq->insn_addr + (orreg_t)off) & (config.immu.pagesize - 1);
} else
gen_op_do_jump(opq, 1);
}
diff -uPr --unidirectional-new-file ./cpu/or32/op.c /home/nog/or1ksim-ac/cpu/or32/op.c
--- ./cpu/or32/op.c 2005-04-22 16:14:09.000000000 +0200
+++ /home/nog/or1ksim-ac/cpu/or32/op.c 2005-04-24 10:43:30.000000000 +0200
@@ -50,9 +50,6 @@
#include "op_i386.h"
-/* FIXME: Move this */
-#define PAGE_LEN 8192
-
/*
* WARNING: Before going of and wildly editing everything in the file remember
* the following about its contents:
@@ -133,7 +130,7 @@
{
uint16_t reg;
- addr &= PAGE_SIZE - 1;
+ addr &= config.immu.pagesize - 1;
addr >>= 2;
reg = dp->ts_bound[addr];
|
 |