URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/tags/or1ksim/or1ksim-0.5.0rc1/testsuite/test-code-or1k/mmu
- from Rev 346 to Rev 347
- ↔ Reverse comparison
Rev 346 → Rev 347
/mmu.c
0,0 → 1,1316
/* mmu.c. Test of the Or1ksim MMU |
|
Copyright (C) 1999-2006 OpenCores |
Copyright (C) 2010 Embecosm Limited |
|
Contributors various OpenCores participants |
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com> |
|
This file is part of OpenRISC 1000 Architectural Simulator. |
|
This program is free software; you can redistribute it and/or modify it |
under the terms of the GNU General Public License as published by the Free |
Software Foundation; either version 3 of the License, or (at your option) |
any later version. |
|
This program is distributed in the hope that it will be useful, but WITHOUT |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
more details. |
|
You should have received a copy of the GNU General Public License along |
with this program. If not, see <http: www.gnu.org/licenses/>. */ |
|
/* ---------------------------------------------------------------------------- |
This code is commented throughout for use with Doxygen. |
--------------------------------------------------------------------------*/ |
|
/* This is MMU test for OpenRISC 1200 */ |
|
#include "spr-defs.h" |
#include "support.h" |
|
/* For shorter simulation run */ |
#define RTL_SIM 1 |
|
/* Define RAM physical location and size |
Bottom half will be used for this program, the rest |
will be used for testing */ |
#define FLASH_START 0xf0000000 |
#define FLASH_SIZE 0x00200000 |
#define RAM_START 0x00000000 |
#define RAM_SIZE 0x00200000 |
|
/* What is the last address in ram that is used by this program */ |
#define TEXT_END_ADD (FLASH_START + (FLASH_SIZE / 2)) |
#define DATA_END_ADD (RAM_START + (RAM_SIZE / 2)) |
|
#define TLB_TEXT_SET_NB 8 |
#define TLB_DATA_SET_NB 4 |
|
/* MMU page size */ |
#define PAGE_SIZE 8192 |
|
/* Number of DTLB sets used (power of 2, max is 256) */ |
#define DTLB_SETS 64 |
|
/* Number of DTLB ways (1, 2, 3 etc., max is 4). */ |
#define DTLB_WAYS 1 |
|
/* Number of ITLB sets used (power of 2, max is 256) */ |
#define ITLB_SETS 64 |
|
/* Number of ITLB ways (1, 2, 3 etc., max is 4). */ |
#define ITLB_WAYS 1 |
|
/* TLB mode codes */ |
#define TLB_CODE_ONE_TO_ONE 0x00000000 |
#define TLB_CODE_PLUS_ONE_PAGE 0x10000000 |
#define TLB_CODE_MINUS_ONE_PAGE 0x20000000 |
|
#define TLB_CODE_MASK 0xfffff000 |
#define TLB_PR_MASK 0x00000fff |
#define DTLB_PR_NOLIMIT (SPR_DTLBTR_URE | \ |
SPR_DTLBTR_UWE | \ |
SPR_DTLBTR_SRE | \ |
SPR_DTLBTR_SWE ) |
|
#define ITLB_PR_NOLIMIT (SPR_ITLBTR_SXE | \ |
SPR_ITLBTR_UXE ) |
|
#if 1 |
#define debug printf |
#else |
#define debug |
#endif |
|
/* fails if x is false */ |
#define ASSERT(x) ((x)?1: fail (__FUNCTION__, __LINE__)) |
|
//#define TEST_JUMP(x) testjump( ((x) & (RAM_SIZE/2 - 1)) + DATA_END_ADD, (x)) |
#define TEST_JUMP(x) copy_jump (((x) & (RAM_SIZE/2 - 1)) + DATA_END_ADD); call (x) |
|
/* Extern functions */ |
extern void lo_dmmu_en (void); |
extern void lo_immu_en (void); |
extern int lo_dtlb_ci_test (unsigned long, unsigned long); |
extern int lo_itlb_ci_test(unsigned long, unsigned long); |
extern void testjump(unsigned long phy_addr, unsigned long virt_addr); |
extern void (*jr)(void); |
|
/* Local functions prototypes */ |
void dmmu_disable (void); |
void immu_disable (void); |
|
/* Global variables */ |
extern unsigned long ram_end; |
|
/* DTLB mode status */ |
volatile unsigned long dtlb_val; |
|
/* ITLB mode status */ |
volatile unsigned long itlb_val; |
|
/* DTLB miss counter */ |
volatile int dtlb_miss_count; |
|
/* Data page fault counter */ |
volatile int dpage_fault_count; |
|
/* ITLB miss counter */ |
volatile int itlb_miss_count; |
|
/* Instruction page fault counter */ |
volatile int ipage_fault_count; |
|
/* EA of last DTLB miss exception */ |
unsigned long dtlb_miss_ea; |
|
/* EA of last data page fault exception */ |
unsigned long dpage_fault_ea; |
|
/* EA of last ITLB miss exception */ |
unsigned long itlb_miss_ea; |
|
/* EA of last insn page fault exception */ |
unsigned long ipage_fault_ea; |
|
void sys_call (void) |
{ |
asm("l.sys\t0"); |
} |
|
void fail (char *func, int line) |
{ |
#ifndef __FUNCTION__ |
#define __FUNCTION__ "?" |
#endif |
|
/* Trigger sys call exception to enable supervisor mode again */ |
sys_call (); |
|
immu_disable (); |
dmmu_disable (); |
|
debug("Test failed in %s:%i\n", func, line); |
report (0xeeeeeeee); |
exit (1); |
} |
|
void call(unsigned long add) |
{ |
asm("l.jalr\t\t%0" : : "r" (add) : "r9", "r11"); |
asm("l.nop" : :); |
} |
|
void jump(void) |
{ |
asm("jr:"); |
asm("l.jr\t\tr9") ; |
asm("l.nop" : :); |
} |
|
void copy_jump(unsigned long phy_add) |
{ |
memcpy((void *)phy_add, (void *)&jr, 8); |
} |
|
/* Bus error exception handler */ |
void bus_err_handler (void) |
{ |
/* This shouldn't happend */ |
debug("Test failed: Bus error\n"); |
report (0xeeeeeeee); |
exit (1); |
} |
|
/* Illegal insn exception handler */ |
void ill_insn_handler (void) |
{ |
/* This shouldn't happend */ |
debug("Test failed: Illegal insn\n"); |
report (0xeeeeeeee); |
exit (1); |
} |
|
/* Sys call exception handler */ |
void sys_call_handler (void) |
{ |
/* Set supervisor mode */ |
mtspr (SPR_ESR_BASE, mfspr (SPR_ESR_BASE) | SPR_SR_SM); |
} |
|
/* DTLB miss exception handler */ |
void dtlb_miss_handler (void) |
{ |
unsigned long ea, ta, tlbtr; |
int set, way = 0; |
int i; |
|
/* Get EA that cause the exception */ |
ea = mfspr (SPR_EEAR_BASE); |
|
/* Find TLB set and LRU way */ |
set = (ea / PAGE_SIZE) % DTLB_SETS; |
for (i = 0; i < DTLB_WAYS; i++) { |
if ((mfspr (SPR_DTLBMR_BASE(i) + set) & SPR_DTLBMR_LRU) == 0) { |
way = i; |
break; |
} |
} |
|
debug("ea = %08lx set = %d way = %d\n", ea, set, way); |
|
if (((RAM_START <= ea) && (ea < DATA_END_ADD) ) || ((FLASH_START <= ea) && (ea < TEXT_END_ADD))) { |
/* If this is acces to data of this program set one to one translation */ |
mtspr (SPR_DTLBMR_BASE(way) + set, (ea & SPR_DTLBMR_VPN) | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(way) + set, (ea & SPR_DTLBTR_PPN) | DTLB_PR_NOLIMIT); |
return; |
} |
|
/* Update DTLB miss counter and EA */ |
dtlb_miss_count++; |
dtlb_miss_ea = ea; |
|
/* Whatever access is in progress, translated address have to point to physical RAM */ |
ta = (ea & ((RAM_SIZE/2) - 1)) + RAM_START + (RAM_SIZE/2); |
tlbtr = (ta & SPR_DTLBTR_PPN) | (dtlb_val & TLB_PR_MASK); |
debug("tlbtr = %08lx dtlb_val = %08lx\n", tlbtr, dtlb_val); |
|
/* Set DTLB entry */ |
mtspr (SPR_DTLBMR_BASE(way) + set, (ea & SPR_DTLBMR_VPN) | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(way) + set, tlbtr); |
} |
|
/* Data page fault exception handler */ |
void dpage_fault_handler (void) |
{ |
unsigned long ea; |
int set, way = 0; |
int i; |
|
/* Get EA that cause the exception */ |
ea = mfspr (SPR_EEAR_BASE); |
|
/* Find TLB set and way */ |
set = (ea / PAGE_SIZE) % DTLB_SETS; |
for (i = 0; i < DTLB_WAYS; i++) { |
if ((mfspr (SPR_DTLBMR_BASE(i) + set) & SPR_DTLBMR_VPN) == (ea & SPR_DTLBMR_VPN)) { |
way = i; |
break; |
} |
} |
|
debug("ea = %08lx set = %d way = %d\n", ea, set, way); |
|
if (((RAM_START <= ea) && (ea < DATA_END_ADD) ) || ((FLASH_START <= ea) && (ea < TEXT_END_ADD))) { |
/* If this is acces to data of this program set one to one translation */ |
mtspr (SPR_DTLBTR_BASE(way) + set, (ea & SPR_DTLBTR_PPN) | DTLB_PR_NOLIMIT); |
return; |
} |
|
/* Update data page fault counter and EA */ |
dpage_fault_count++; |
dpage_fault_ea = ea; |
|
/* Give permission */ |
mtspr (SPR_DTLBTR_BASE(way) + set, (mfspr (SPR_DTLBTR_BASE(way) + set) & ~DTLB_PR_NOLIMIT) | dtlb_val); |
} |
|
|
/* ITLB miss exception handler */ |
void itlb_miss_handler (void) |
{ |
unsigned long ea, ta, tlbtr; |
int set, way = 0; |
int i; |
|
/* Get EA that cause the exception */ |
ea = mfspr (SPR_EEAR_BASE); |
|
/* Find TLB set and LRU way */ |
set = (ea / PAGE_SIZE) % ITLB_SETS; |
for (i = 0; i < ITLB_WAYS; i++) { |
if ((mfspr (SPR_ITLBMR_BASE(i) + set) & SPR_ITLBMR_LRU) == 0) { |
way = i; |
break; |
} |
} |
|
debug("ea = %08lx set = %d way = %d\n", ea, set, way); |
|
if ((FLASH_START <= ea) && (ea < TEXT_END_ADD)) { |
/* If this is acces to data of this program set one to one translation */ |
mtspr (SPR_ITLBMR_BASE(way) + set, (ea & SPR_ITLBMR_VPN) | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(way) + set, (ea & SPR_ITLBTR_PPN) | ITLB_PR_NOLIMIT); |
return; |
} |
|
/* Update ITLB miss counter and EA */ |
itlb_miss_count++; |
itlb_miss_ea = ea; |
|
/* Whatever access is in progress, translated address have to point to physical RAM */ |
ta = (ea & ((RAM_SIZE/2) - 1)) + DATA_END_ADD; |
tlbtr = (ta & SPR_ITLBTR_PPN) | (itlb_val & TLB_PR_MASK); |
|
debug("ta = %08lx\n", ta); |
|
/* Set ITLB entry */ |
mtspr (SPR_ITLBMR_BASE(way) + set, (ea & SPR_ITLBMR_VPN) | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(way) + set, tlbtr); |
} |
|
/* Intstruction page fault exception handler */ |
void ipage_fault_handler (void) |
{ |
unsigned long ea; |
int set, way = 0; |
int i; |
|
/* Get EA that cause the exception */ |
ea = mfspr (SPR_EEAR_BASE); |
|
/* Find TLB set and way */ |
set = (ea / PAGE_SIZE) % ITLB_SETS; |
for (i = 0; i < ITLB_WAYS; i++) { |
if ((mfspr (SPR_ITLBMR_BASE(i) + set) & SPR_ITLBMR_VPN) == (ea & SPR_ITLBMR_VPN)) { |
way = i; |
break; |
} |
} |
|
debug("ea = %08lx set = %d way = %d\n", ea, set, way); |
|
if ((FLASH_START <= ea) && (ea < TEXT_END_ADD)) { |
/* If this is acces to data of this program set one to one translation */ |
mtspr (SPR_DTLBTR_BASE(way) + set, (ea & SPR_DTLBTR_PPN) | ITLB_PR_NOLIMIT); |
return; |
} |
|
/* Update instruction page fault counter and EA */ |
ipage_fault_count++; |
ipage_fault_ea = ea; |
|
/* Give permission */ |
mtspr (SPR_ITLBTR_BASE(way) + set, (mfspr (SPR_ITLBTR_BASE(way) + set) & ~ITLB_PR_NOLIMIT) | itlb_val); |
} |
|
/* Invalidate all entries in DTLB and enable DMMU */ |
void dmmu_enable (void) |
{ |
/* Register DTLB miss handler */ |
excpt_dtlbmiss = (unsigned long)dtlb_miss_handler; |
|
/* Register data page fault handler */ |
excpt_dpfault = (unsigned long)dpage_fault_handler; |
|
/* Enable DMMU */ |
lo_dmmu_en (); |
} |
|
/* Disable DMMU */ |
void dmmu_disable (void) |
{ |
mtspr (SPR_SR, mfspr (SPR_SR) & ~SPR_SR_DME); |
} |
|
/* Invalidate all entries in ITLB and enable IMMU */ |
void immu_enable (void) |
{ |
/* Register ITLB miss handler */ |
excpt_itlbmiss = (unsigned long)itlb_miss_handler; |
|
/* Register instruction page fault handler */ |
excpt_ipfault = (unsigned long)ipage_fault_handler; |
|
/* Enable IMMU */ |
lo_immu_en (); |
} |
|
/* Disable IMMU */ |
void immu_disable (void) |
{ |
mtspr (SPR_SR, mfspr (SPR_SR) & ~SPR_SR_IME); |
} |
|
void write_pattern(unsigned long start, unsigned long end) |
{ |
unsigned long add; |
|
add = start; |
while (add < end) { |
REG32(add) = add; |
add += PAGE_SIZE; |
} |
|
} |
|
/* Translation address register test |
Set various translation and check the pattern */ |
int dtlb_translation_test (void) |
{ |
int i, j; |
unsigned long ea, ta; |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
/* Invalidate all entries in DTLB */ |
for (i = 0; i < DTLB_WAYS; i++) { |
for (j = 0; j < DTLB_SETS; j++) { |
mtspr (SPR_DTLBMR_BASE(i) + j, 0); |
mtspr (SPR_DTLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_DATA_SET_NB; i++) { |
ea = RAM_START + (i*PAGE_SIZE); |
ta = RAM_START + (i*PAGE_SIZE); |
mtspr (SPR_DTLBMR_BASE(0) + i, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(0) + i, ta | DTLB_PR_NOLIMIT); |
} |
|
/* Set dtlb permisions */ |
dtlb_val = DTLB_PR_NOLIMIT; |
|
/* Write test pattern */ |
for (i = 0; i < DTLB_SETS; i++) { |
REG32(RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE)) = i; |
REG32(RAM_START + (RAM_SIZE/2) + ((i + 1)*PAGE_SIZE) - 4) = 0xffffffff - i; |
} |
|
/* Set one to one translation of the last way of DTLB */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
ea = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
ta = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
mtspr (SPR_DTLBMR_BASE(DTLB_WAYS - 1) + i, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(DTLB_WAYS - 1) + i, ta | DTLB_PR_NOLIMIT); |
} |
|
/* Enable DMMU */ |
dmmu_enable(); |
|
/* Check the pattern */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
ea = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
ASSERT(REG32(ea) == i); |
ea = RAM_START + (RAM_SIZE/2) + ((i + 1)*PAGE_SIZE) - 4; |
ASSERT(REG32(ea) == (0xffffffff - i)); |
} |
|
/* Write new pattern */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
REG32(RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE)) = 0xffffffff - i; |
REG32(RAM_START + (RAM_SIZE/2) + ((i + 1)*PAGE_SIZE) - 4) = i; |
} |
|
/* Set 0 -> RAM_START + (RAM_SIZE/2) translation */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
ea = i*PAGE_SIZE; |
ta = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
mtspr (SPR_DTLBMR_BASE(DTLB_WAYS - 1) + i, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(DTLB_WAYS - 1) + i, ta | DTLB_PR_NOLIMIT); |
} |
|
/* Check the pattern */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
ea = i*PAGE_SIZE; |
ASSERT(REG32(ea) == (0xffffffff - i)); |
ea = ((i + 1)*PAGE_SIZE) - 4; |
ASSERT(REG32(ea) == i); |
} |
|
/* Write new pattern */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
REG32(i*PAGE_SIZE) = i; |
REG32(((i + 1)*PAGE_SIZE) - 4) = 0xffffffff - i; |
} |
|
/* Set hi -> lo, lo -> hi translation */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
ea = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
ta = RAM_START + (RAM_SIZE/2) + ((DTLB_SETS - i - 1 + TLB_DATA_SET_NB)*PAGE_SIZE); |
mtspr (SPR_DTLBMR_BASE(DTLB_WAYS - 1) + i, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(DTLB_WAYS - 1) + i, ta | DTLB_PR_NOLIMIT); |
} |
|
/* Check the pattern */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
ea = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
ASSERT(REG32(ea) == (DTLB_SETS - i - 1 + TLB_DATA_SET_NB)); |
ea = RAM_START + (RAM_SIZE/2) + ((i + 1)*PAGE_SIZE) - 4; |
ASSERT(REG32(ea) == (0xffffffff - DTLB_SETS + i + 1 - TLB_DATA_SET_NB)); |
} |
|
/* Write new pattern */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
REG32(RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE)) = 0xffffffff - i; |
REG32(RAM_START + (RAM_SIZE/2) + ((i + 1)*PAGE_SIZE) - 4) = i; |
} |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
/* Check the pattern */ |
for (i = TLB_DATA_SET_NB; i < DTLB_SETS; i++) { |
ea = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
ASSERT(REG32(ea) == (0xffffffff - DTLB_SETS + i + 1 - TLB_DATA_SET_NB)); |
ea = RAM_START + (RAM_SIZE/2) + ((i + 1)*PAGE_SIZE) - 4; |
ASSERT(REG32(ea) == (DTLB_SETS - i - 1 + TLB_DATA_SET_NB)); |
} |
|
return 0; |
} |
|
/* EA match register test |
Shifting one in DTLBMR and performing accesses to boundaries |
of the page, checking the triggering of exceptions */ |
int dtlb_match_test (int way, int set) |
{ |
int i, j, tmp; |
unsigned long add, t_add; |
unsigned long ea, ta; |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
/* Invalidate all entries in DTLB */ |
for (i = 0; i < DTLB_WAYS; i++) { |
for (j = 0; j < DTLB_SETS; j++) { |
mtspr (SPR_DTLBMR_BASE(i) + j, 0); |
mtspr (SPR_DTLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_DATA_SET_NB; i++) { |
ea = RAM_START + (i*PAGE_SIZE); |
ta = RAM_START + (i*PAGE_SIZE); |
mtspr (SPR_DTLBMR_BASE(0) + i, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(0) + i, ta | DTLB_PR_NOLIMIT); |
} |
|
/* Set dtlb permisions */ |
dtlb_val = DTLB_PR_NOLIMIT; |
|
/* Set pattern */ |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) - 4) = 0x00112233; |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE)) = 0x44556677; |
REG32(RAM_START + (RAM_SIZE/2) + (set + 1)*PAGE_SIZE - 4) = 0x8899aabb; |
REG32(RAM_START + (RAM_SIZE/2) + (set + 1)*PAGE_SIZE) = 0xccddeeff; |
|
/* Enable DMMU */ |
dmmu_enable(); |
|
/* Shifting one in DTLBMR */ |
i = 0; |
add = (PAGE_SIZE*DTLB_SETS); |
t_add = add + (set*PAGE_SIZE); |
while (add != 0x00000000) { |
mtspr (SPR_DTLBMR_BASE(way) + set, t_add | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(way) + set, (RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE)) | DTLB_PR_NOLIMIT); |
|
/* Reset DTLB miss counter and EA */ |
dtlb_miss_count = 0; |
dtlb_miss_ea = 0; |
|
if (((t_add < RAM_START) || (t_add >= DATA_END_ADD)) && ((t_add < FLASH_START) || (t_add >= TEXT_END_ADD))) { |
|
/* Read last address of previous page */ |
tmp = REG32(t_add - 4); |
ASSERT(tmp == 0x00112233); |
ASSERT(dtlb_miss_count == 1); |
|
/* Read first address of the page */ |
tmp = REG32(t_add); |
ASSERT(tmp == 0x44556677); |
ASSERT(dtlb_miss_count == 1); |
|
/* Read last address of the page */ |
tmp = REG32(t_add + PAGE_SIZE - 4); |
ASSERT(tmp == 0x8899aabb); |
ASSERT(dtlb_miss_count == 1); |
|
/* Read first address of next page */ |
tmp = REG32(t_add + PAGE_SIZE); |
ASSERT(tmp == 0xccddeeff); |
ASSERT(dtlb_miss_count == 2); |
} |
|
i++; |
add = (PAGE_SIZE*DTLB_SETS) << i; |
t_add = add + (set*PAGE_SIZE); |
|
for (j = 0; j < DTLB_WAYS; j++) { |
mtspr (SPR_DTLBMR_BASE(j) + ((set - 1) & (DTLB_SETS - 1)), 0); |
mtspr (SPR_DTLBMR_BASE(j) + ((set + 1) & (DTLB_SETS - 1)), 0); |
} |
} |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
return 0; |
} |
|
/* Valid bit test |
Set all ways of one set to be invalid, perform |
access so miss handler will set them to valid, |
try access again - there should be no miss exceptions */ |
int dtlb_valid_bit_test (int set) |
{ |
int i, j; |
unsigned long ea, ta; |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
/* Invalidate all entries in DTLB */ |
for (i = 0; i < DTLB_WAYS; i++) { |
for (j = 0; j < DTLB_SETS; j++) { |
mtspr (SPR_DTLBMR_BASE(i) + j, 0); |
mtspr (SPR_DTLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_DATA_SET_NB; i++) { |
ea = RAM_START + (i*PAGE_SIZE); |
ta = RAM_START + (i*PAGE_SIZE); |
mtspr (SPR_DTLBMR_BASE(0) + i, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(0) + i, ta | DTLB_PR_NOLIMIT); |
} |
|
/* Reset DTLB miss counter and EA */ |
dtlb_miss_count = 0; |
dtlb_miss_ea = 0; |
|
/* Set dtlb permisions */ |
dtlb_val = DTLB_PR_NOLIMIT; |
|
/* Resetv DTLBMR for every way */ |
for (i = 0; i < DTLB_WAYS; i++) { |
mtspr (SPR_DTLBMR_BASE(i) + set, 0); |
} |
|
/* Enable DMMU */ |
dmmu_enable(); |
|
/* Perform writes to address, that is not in DTLB */ |
for (i = 0; i < DTLB_WAYS; i++) { |
REG32(RAM_START + RAM_SIZE + (i*DTLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE)) = i; |
|
/* Check if there was DTLB miss */ |
ASSERT(dtlb_miss_count == (i + 1)); |
ASSERT(dtlb_miss_ea == (RAM_START + RAM_SIZE + (i*DTLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE))); |
} |
|
/* Reset DTLB miss counter and EA */ |
dtlb_miss_count = 0; |
dtlb_miss_ea = 0; |
|
/* Perform reads to address, that is now in DTLB */ |
for (i = 0; i < DTLB_WAYS; i++) { |
ASSERT(REG32(RAM_START + RAM_SIZE + (i*DTLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE)) == i); |
|
/* Check if there was DTLB miss */ |
ASSERT(dtlb_miss_count == 0); |
} |
|
/* Reset valid bits */ |
for (i = 0; i < DTLB_WAYS; i++) { |
mtspr (SPR_DTLBMR_BASE(i) + set, mfspr (SPR_DTLBMR_BASE(i) + set) & ~SPR_DTLBMR_V); |
} |
|
/* Perform reads to address, that is now in DTLB but is invalid */ |
for (i = 0; i < DTLB_WAYS; i++) { |
ASSERT(REG32(RAM_START + RAM_SIZE + (i*DTLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE)) == i); |
|
/* Check if there was DTLB miss */ |
ASSERT(dtlb_miss_count == (i + 1)); |
ASSERT(dtlb_miss_ea == (RAM_START + RAM_SIZE + (i*DTLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE))); |
} |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
return 0; |
} |
|
/* Permission test |
Set various permissions, perform r/w access |
in user and supervisor mode and chack triggering |
of page fault exceptions */ |
int dtlb_premission_test (int set) |
{ |
int i, j; |
unsigned long ea, ta, tmp; |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
/* Invalidate all entries in DTLB */ |
for (i = 0; i < DTLB_WAYS; i++) { |
for (j = 0; j < DTLB_SETS; j++) { |
mtspr (SPR_DTLBMR_BASE(i) + j, 0); |
mtspr (SPR_DTLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_DATA_SET_NB; i++) { |
ea = RAM_START + (i*PAGE_SIZE); |
ta = RAM_START + (i*PAGE_SIZE); |
mtspr (SPR_DTLBMR_BASE(0) + i, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(0) + i, ta | DTLB_PR_NOLIMIT); |
} |
|
/* Testing page */ |
ea = RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE); |
|
/* Set match register */ |
mtspr (SPR_DTLBMR_BASE(DTLB_WAYS - 1) + set, ea | SPR_DTLBMR_V); |
|
/* Reset page fault counter and EA */ |
dpage_fault_count = 0; |
dpage_fault_ea = 0; |
|
/* Enable DMMU */ |
dmmu_enable(); |
|
/* Write supervisor */ |
dtlb_val = DTLB_PR_NOLIMIT | SPR_DTLBTR_SWE; |
mtspr (SPR_DTLBTR_BASE(DTLB_WAYS - 1) + set, ea | (DTLB_PR_NOLIMIT & ~SPR_DTLBTR_SWE)); |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 0) = 0x00112233; |
ASSERT(dpage_fault_count == 1); |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 4) = 0x44556677; |
ASSERT(dpage_fault_count == 1); |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 8) = 0x8899aabb; |
ASSERT(dpage_fault_count == 1); |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 12) = 0xccddeeff; |
ASSERT(dpage_fault_count == 1); |
|
/* Read supervisor */ |
dtlb_val = DTLB_PR_NOLIMIT | SPR_DTLBTR_SRE; |
mtspr (SPR_DTLBTR_BASE(DTLB_WAYS - 1) + set, ea | (DTLB_PR_NOLIMIT & ~SPR_DTLBTR_SRE)); |
tmp = REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 0); |
ASSERT(dpage_fault_count == 2); |
ASSERT(tmp == 0x00112233); |
tmp = REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 4); |
ASSERT(dpage_fault_count == 2); |
ASSERT(tmp == 0x44556677); |
tmp = REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 8); |
ASSERT(dpage_fault_count == 2); |
ASSERT(tmp == 0x8899aabb); |
tmp = REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 12); |
ASSERT(dpage_fault_count == 2); |
ASSERT(tmp == 0xccddeeff); |
|
/* Write user */ |
dtlb_val = DTLB_PR_NOLIMIT | SPR_DTLBTR_UWE; |
mtspr (SPR_DTLBTR_BASE(DTLB_WAYS - 1) + set, ea | (DTLB_PR_NOLIMIT & ~SPR_DTLBTR_UWE)); |
|
/* Set user mode */ |
mtspr (SPR_SR, mfspr (SPR_SR) & ~SPR_SR_SM); |
|
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 0) = 0xffeeddcc; |
ASSERT(dpage_fault_count == 3); |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 4) = 0xbbaa9988; |
ASSERT(dpage_fault_count == 3); |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 8) = 0x77665544; |
ASSERT(dpage_fault_count == 3); |
REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 12) = 0x33221100; |
ASSERT(dpage_fault_count == 3); |
|
/* Trigger sys call exception to enable supervisor mode again */ |
sys_call (); |
|
/* Read user mode */ |
dtlb_val = DTLB_PR_NOLIMIT | SPR_DTLBTR_URE; |
mtspr (SPR_DTLBTR_BASE(DTLB_WAYS - 1) + set, ea | (DTLB_PR_NOLIMIT & ~SPR_DTLBTR_URE)); |
|
/* Set user mode */ |
mtspr (SPR_SR, mfspr (SPR_SR) & ~SPR_SR_SM); |
|
tmp = REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 0); |
ASSERT(dpage_fault_count == 4); |
ASSERT(tmp == 0xffeeddcc); |
tmp = REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 4); |
ASSERT(dpage_fault_count == 4); |
ASSERT(tmp == 0xbbaa9988); |
tmp = REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 8); |
ASSERT(dpage_fault_count == 4); |
ASSERT(tmp == 0x77665544); |
tmp = REG32(RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) + 12); |
ASSERT(dpage_fault_count == 4); |
ASSERT(tmp == 0x33221100); |
|
/* Trigger sys call exception to enable supervisor mode again */ |
sys_call (); |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
return 0; |
} |
|
/* Data cache inhibit bit test |
Set and clear CI bit and check the pattern. */ |
int dtlb_ci_test (void) |
{ |
int i, j; |
unsigned long ea, ta, ret; |
|
/* Disable DMMU */ |
dmmu_disable(); |
|
/* Invalidate all entries in DTLB */ |
for (i = 0; i < DTLB_WAYS; i++) { |
for (j = 0; j < DTLB_SETS; j++) { |
mtspr (SPR_DTLBMR_BASE(i) + j, 0); |
mtspr (SPR_DTLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_DATA_SET_NB; i++) { |
ea = RAM_START + (i*PAGE_SIZE); |
ta = RAM_START + (i*PAGE_SIZE); |
mtspr (SPR_DTLBMR_BASE(0) + i, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(0) + i, ta | DTLB_PR_NOLIMIT | SPR_DTLBTR_CI); |
} |
|
/* Testing page */ |
ea = RAM_START + (RAM_SIZE/2) + (TLB_DATA_SET_NB*PAGE_SIZE); |
ta = RAM_START + (RAM_SIZE/2) + (TLB_DATA_SET_NB*PAGE_SIZE); |
|
/* Write test pattern */ |
REG32(ea) = 0x01234567; |
REG32(ea + PAGE_SIZE - 4) = 0x9abcdef; |
|
/* Set one to one translation with CI bit for testing area */ |
mtspr (SPR_DTLBMR_BASE(0) + TLB_DATA_SET_NB, ea | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(0) + TLB_DATA_SET_NB, ta | DTLB_PR_NOLIMIT | SPR_DTLBTR_CI); |
|
ret = lo_dtlb_ci_test(ea, TLB_DATA_SET_NB); |
ASSERT(ret == 0); |
|
return 0; |
} |
|
/* Translation address register test |
Set various translation and check the pattern */ |
int itlb_translation_test (void) |
{ |
int i, j; |
unsigned long ea, ta; |
|
/* Disable IMMU */ |
immu_disable(); |
|
/* Invalidate all entries in ITLB */ |
for (i = 0; i < ITLB_WAYS; i++) { |
for (j = 0; j < ITLB_SETS; j++) { |
mtspr (SPR_ITLBMR_BASE(i) + j, 0); |
mtspr (SPR_ITLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_TEXT_SET_NB; i++) { |
ea = FLASH_START + (i*PAGE_SIZE); |
ta = FLASH_START + (i*PAGE_SIZE); |
mtspr (SPR_ITLBMR_BASE(0) + i, ea | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(0) + i, ta | ITLB_PR_NOLIMIT); |
} |
|
/* Set itlb permisions */ |
itlb_val = ITLB_PR_NOLIMIT; |
|
/* Write test program */ |
for (i = TLB_TEXT_SET_NB; i < ITLB_SETS; i++) { |
copy_jump (RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE) + (i*0x10)); |
} |
|
/* Set one to one translation of the last way of ITLB */ |
for (i = TLB_TEXT_SET_NB; i < ITLB_SETS; i++) { |
ea = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
ta = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
mtspr (SPR_ITLBMR_BASE(ITLB_WAYS - 1) + i, ea | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(ITLB_WAYS - 1) + i, ta | ITLB_PR_NOLIMIT); |
} |
|
/* Enable IMMU */ |
immu_enable(); |
|
/* Check the pattern */ |
for (i = TLB_TEXT_SET_NB; i < ITLB_SETS; i++) { |
call (RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE) + (i*0x10)); |
} |
|
/* Set FLASH_END -> RAM_START + (RAM_SIZE/2) translation */ |
for (i = TLB_TEXT_SET_NB; i < ITLB_SETS; i++) { |
ea = FLASH_START + FLASH_SIZE + i*PAGE_SIZE; |
ta = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
mtspr (SPR_ITLBMR_BASE(ITLB_WAYS - 1) + i, ea | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(ITLB_WAYS - 1) + i, ta | ITLB_PR_NOLIMIT); |
} |
|
/* Check the pattern */ |
for (i = TLB_TEXT_SET_NB; i < ITLB_SETS; i++) { |
call (FLASH_START + FLASH_SIZE + (i*PAGE_SIZE) + (i*0x10)); |
} |
|
/* Set hi -> lo, lo -> hi translation */ |
for (i = TLB_TEXT_SET_NB; i < ITLB_SETS; i++) { |
ea = RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE); |
ta = RAM_START + (RAM_SIZE/2) + ((ITLB_SETS - i - 1 + TLB_TEXT_SET_NB)*PAGE_SIZE); |
mtspr (SPR_ITLBMR_BASE(ITLB_WAYS - 1) + i, ea | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(ITLB_WAYS - 1) + i, ta | ITLB_PR_NOLIMIT); |
} |
|
/* Check the pattern */ |
for (i = TLB_TEXT_SET_NB; i < ITLB_SETS; i++) { |
call (RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE) + ((ITLB_SETS - i - 1 + TLB_TEXT_SET_NB)*0x10)); |
} |
|
/* Disable IMMU */ |
immu_disable (); |
|
/* Check the pattern */ |
for (i = TLB_TEXT_SET_NB; i < ITLB_SETS; i++) { |
call (RAM_START + (RAM_SIZE/2) + (i*PAGE_SIZE) + (i*0x10)); |
} |
|
return 0; |
} |
|
/* EA match register test |
Shifting one in ITLBMR and performing accesses to boundaries |
of the page, checking the triggering of exceptions */ |
int itlb_match_test (int way, int set) |
{ |
int i, j; |
unsigned long add, t_add; |
unsigned long ea, ta; |
|
/* Disable IMMU */ |
immu_disable(); |
|
/* Invalidate all entries in ITLB */ |
for (i = 0; i < ITLB_WAYS; i++) { |
for (j = 0; j < ITLB_SETS; j++) { |
mtspr (SPR_ITLBMR_BASE(i) + j, 0); |
mtspr (SPR_ITLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_TEXT_SET_NB; i++) { |
ea = FLASH_START + (i*PAGE_SIZE); |
ta = FLASH_START + (i*PAGE_SIZE); |
mtspr (SPR_ITLBMR_BASE(0) + i, ea | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(0) + i, ta | ITLB_PR_NOLIMIT); |
} |
|
/* Set dtlb permisions */ |
itlb_val = ITLB_PR_NOLIMIT; |
|
/* Set pattern */ |
copy_jump (RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE) - 8); |
copy_jump (RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE)); |
copy_jump (RAM_START + (RAM_SIZE/2) + (set + 1)*PAGE_SIZE - 8); |
copy_jump (RAM_START + (RAM_SIZE/2) + (set + 1)*PAGE_SIZE); |
|
/* Enable IMMU */ |
immu_enable(); |
|
/* Shifting one in ITLBMR */ |
i = 0; |
add = (PAGE_SIZE*ITLB_SETS); |
t_add = add + (set*PAGE_SIZE); |
while (add != 0x00000000) { |
mtspr (SPR_ITLBMR_BASE(way) + set, t_add | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(way) + set, (RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE)) | ITLB_PR_NOLIMIT); |
|
/* Reset ITLB miss counter and EA */ |
itlb_miss_count = 0; |
itlb_miss_ea = 0; |
|
if (((t_add < RAM_START) || (t_add >= DATA_END_ADD)) && ((t_add < FLASH_START) || (t_add >= TEXT_END_ADD))) { |
|
/* Jump on last address of previous page */ |
call (t_add - 8); |
ASSERT(itlb_miss_count == 1); |
|
/* Jump on first address of the page */ |
call (t_add); |
ASSERT(itlb_miss_count == 1); |
|
/* Jump on last address of the page */ |
call (t_add + PAGE_SIZE - 8); |
ASSERT(itlb_miss_count == 1); |
|
/* Jump on first address of next page */ |
call (t_add + PAGE_SIZE); |
ASSERT(itlb_miss_count == 2); |
} |
|
i++; |
add = (PAGE_SIZE*ITLB_SETS) << i; |
t_add = add + (set*PAGE_SIZE); |
|
for (j = 0; j < ITLB_WAYS; j++) { |
mtspr (SPR_ITLBMR_BASE(j) + ((set - 1) & (ITLB_SETS - 1)), 0); |
mtspr (SPR_ITLBMR_BASE(j) + ((set + 1) & (ITLB_SETS - 1)), 0); |
} |
} |
|
/* Disable IMMU */ |
immu_disable(); |
|
return 0; |
} |
|
/* Valid bit test |
Set all ways of one set to be invalid, perform |
access so miss handler will set them to valid, |
try access again - there should be no miss exceptions */ |
int itlb_valid_bit_test (int set) |
{ |
int i, j; |
unsigned long ea, ta; |
|
/* Disable IMMU */ |
immu_disable(); |
|
/* Invalidate all entries in ITLB */ |
for (i = 0; i < ITLB_WAYS; i++) { |
for (j = 0; j < ITLB_SETS; j++) { |
mtspr (SPR_ITLBMR_BASE(i) + j, 0); |
mtspr (SPR_ITLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_TEXT_SET_NB; i++) { |
ea = FLASH_START + (i*PAGE_SIZE); |
ta = FLASH_START + (i*PAGE_SIZE); |
mtspr (SPR_ITLBMR_BASE(0) + i, ea | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(0) + i, ta | ITLB_PR_NOLIMIT); |
} |
|
/* Reset ITLB miss counter and EA */ |
itlb_miss_count = 0; |
itlb_miss_ea = 0; |
|
/* Set itlb permisions */ |
itlb_val = ITLB_PR_NOLIMIT; |
|
/* Resetv ITLBMR for every way */ |
for (i = 0; i < ITLB_WAYS; i++) { |
mtspr (SPR_ITLBMR_BASE(i) + set, 0); |
} |
|
/* Enable IMMU */ |
immu_enable(); |
|
/* Perform jumps to address, that is not in ITLB */ |
for (i = 0; i < ITLB_WAYS; i++) { |
TEST_JUMP(RAM_START + RAM_SIZE + (i*ITLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE)); |
|
/* Check if there was ITLB miss */ |
ASSERT(itlb_miss_count == (i + 1)); |
ASSERT(itlb_miss_ea == (RAM_START + RAM_SIZE + (i*ITLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE))); |
} |
|
/* Reset ITLB miss counter and EA */ |
itlb_miss_count = 0; |
itlb_miss_ea = 0; |
|
/* Perform jumps to address, that is now in ITLB */ |
for (i = 0; i < ITLB_WAYS; i++) { |
TEST_JUMP(RAM_START + RAM_SIZE + (i*ITLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE)); |
|
/* Check if there was ITLB miss */ |
ASSERT(itlb_miss_count == 0); |
} |
|
/* Reset valid bits */ |
for (i = 0; i < ITLB_WAYS; i++) { |
mtspr (SPR_ITLBMR_BASE(i) + set, mfspr (SPR_ITLBMR_BASE(i) + set) & ~SPR_ITLBMR_V); |
} |
|
/* Perform jumps to address, that is now in ITLB but is invalid */ |
for (i = 0; i < ITLB_WAYS; i++) { |
TEST_JUMP(RAM_START + RAM_SIZE + (i*ITLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE)); |
|
/* Check if there was ITLB miss */ |
ASSERT(itlb_miss_count == (i + 1)); |
ASSERT(itlb_miss_ea == (RAM_START + RAM_SIZE + (i*ITLB_SETS*PAGE_SIZE) + (set*PAGE_SIZE))); |
} |
|
/* Disable IMMU */ |
immu_disable (); |
|
return 0; |
} |
|
/* Permission test |
Set various permissions, perform r/w access |
in user and supervisor mode and check triggering |
of page fault exceptions */ |
int itlb_premission_test (int set) |
{ |
int i, j; |
unsigned long ea, ta; |
|
/* Disable IMMU */ |
immu_disable(); |
|
/* Invalidate all entries in ITLB */ |
for (i = 0; i < ITLB_WAYS; i++) { |
for (j = 0; j < ITLB_SETS; j++) { |
mtspr (SPR_ITLBMR_BASE(i) + j, 0); |
mtspr (SPR_ITLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_TEXT_SET_NB; i++) { |
ea = FLASH_START + (i*PAGE_SIZE); |
ta = FLASH_START + (i*PAGE_SIZE); |
mtspr (SPR_ITLBMR_BASE(0) + i, ea | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(0) + i, ta | ITLB_PR_NOLIMIT); |
} |
|
/* Testing page */ |
ea = RAM_START + (RAM_SIZE/2) + (set*PAGE_SIZE); |
|
/* Set match register */ |
mtspr (SPR_ITLBMR_BASE(ITLB_WAYS - 1) + set, ea | SPR_ITLBMR_V); |
|
/* Reset page fault counter and EA */ |
ipage_fault_count = 0; |
ipage_fault_ea = 0; |
|
/* Copy the code */ |
copy_jump (ea); |
copy_jump (ea + 8); |
|
/* Enable IMMU */ |
immu_enable (); |
|
/* Execute supervisor */ |
itlb_val = SPR_ITLBTR_CI | SPR_ITLBTR_SXE; |
mtspr (SPR_ITLBTR_BASE(ITLB_WAYS - 1) + set, ea | (ITLB_PR_NOLIMIT & ~SPR_ITLBTR_SXE)); |
|
call (ea); |
ASSERT(ipage_fault_count == 1); |
call (ea + 8); |
ASSERT(ipage_fault_count == 1); |
|
/* Execute user */ |
itlb_val = SPR_ITLBTR_CI | SPR_ITLBTR_UXE; |
mtspr (SPR_ITLBTR_BASE(ITLB_WAYS - 1) + set, ea | (ITLB_PR_NOLIMIT & ~SPR_ITLBTR_UXE)); |
|
/* Set user mode */ |
mtspr (SPR_SR, mfspr (SPR_SR) & ~SPR_SR_SM); |
|
call (ea); |
ASSERT(ipage_fault_count == 2); |
call (ea + 8); |
ASSERT(ipage_fault_count == 2); |
|
/* Trigger sys call exception to enable supervisor mode again */ |
sys_call (); |
|
/* Disable IMMU */ |
immu_disable (); |
|
return 0; |
} |
|
/* Instruction cache inhibit bit test |
Set and clear CI bit and check the pattern. */ |
int itlb_ci_test(void) |
{ |
int i, j; |
unsigned long ea, ta, ret; |
|
/* Disable IMMU */ |
immu_disable(); |
|
/* Invalidate all entries in DTLB */ |
for (i = 0; i < ITLB_WAYS; i++) { |
for (j = 0; j < ITLB_SETS; j++) { |
mtspr (SPR_ITLBMR_BASE(i) + j, 0); |
mtspr (SPR_ITLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Set one to one translation for the use of this program */ |
for (i = 0; i < TLB_TEXT_SET_NB; i++) { |
ea = FLASH_START + (i*PAGE_SIZE); |
ta = FLASH_START + (i*PAGE_SIZE); |
mtspr (SPR_ITLBMR_BASE(0) + i, ea | SPR_ITLBMR_V); |
mtspr (SPR_ITLBTR_BASE(0) + i, ta | ITLB_PR_NOLIMIT); |
} |
|
/* Testing page */ |
ea = RAM_START + (RAM_SIZE/2) + (TLB_TEXT_SET_NB*PAGE_SIZE); |
|
ret = lo_itlb_ci_test (ea, TLB_TEXT_SET_NB); |
ASSERT(ret == 0); |
|
return 0; |
} |
|
int main (void) |
{ |
int i, j; |
|
i = j = 0; /* Get rid of warnings */ |
|
/* Register bus error handler */ |
excpt_buserr = (unsigned long)bus_err_handler; |
|
/* Register illegal insn handler */ |
excpt_illinsn = (unsigned long)ill_insn_handler; |
|
/* Register illegal insn handler */ |
excpt_syscall = (unsigned long)sys_call_handler; |
|
#if 1 |
/* Translation test */ |
dtlb_translation_test (); |
|
/* Virtual address match test */ |
#ifndef RTL_SIM |
for (j = 0; j < DTLB_WAYS; j++) { |
for (i = TLB_DATA_SET_NB; i < (DTLB_SETS - 1); i++) |
dtlb_match_test (j, i); |
} |
#else |
dtlb_match_test (0, DTLB_SETS - 2); |
#endif |
|
/* Valid bit testing */ |
#ifndef RTL_SIM |
for (i = TLB_DATA_SET_NB; i < (DTLB_SETS - 1); i++) |
dtlb_valid_bit_test (i); |
#else |
dtlb_valid_bit_test (DTLB_SETS - 2); |
#endif |
|
/* Permission test */ |
#ifndef RTL_SIM |
for (i = TLB_DATA_SET_NB; i < (DTLB_SETS - 1); i++) |
dtlb_premission_test (i); |
#else |
dtlb_premission_test (DTLB_SETS - 2); |
#endif |
|
dtlb_ci_test(); |
#endif |
|
#if 1 |
/* Translation test */ |
itlb_translation_test (); |
|
/* Virtual address match test */ |
#ifndef RTL_SIM |
for (j = 0; j < DTLB_WAYS; j++) { |
for (i = TLB_TEXT_SET_NB + 1; i < (DTLB_SETS - 1); i++) |
itlb_match_test (j, i); |
} |
#else |
itlb_match_test (0, DTLB_SETS - 2); |
#endif |
|
/* Valid bit testing */ |
#ifndef RTL_SIM |
for (i = TLB_TEXT_SET_NB; i < (ITLB_SETS); i++) |
itlb_valid_bit_test (i); |
#else |
itlb_valid_bit_test (ITLB_SETS-1); |
#endif |
|
/* Permission test */ |
#ifndef RTL_SIM |
for (i = TLB_TEXT_SET_NB; i < (ITLB_SETS - 1); i++) |
itlb_premission_test (i); |
#else |
itlb_premission_test (ITLB_SETS - 2); |
#endif |
|
itlb_ci_test(); |
#endif |
|
report (0xdeaddead); |
exit (0); |
return 0; |
} |
|
mmu.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Makefile.in
===================================================================
--- Makefile.in (nonexistent)
+++ Makefile.in (revision 347)
@@ -0,0 +1,532 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Makefile.am for or1ksim testsuite CPU test program: mmu
+
+# Copyright (C) Embecosm Limited, 2010
+
+# Contributor Jeremy Bennett
+
+# This file is part of OpenRISC 1000 Architectural Simulator.
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see . */
+
+# -----------------------------------------------------------------------------
+# This code is commented throughout for use with Doxygen.
+# -----------------------------------------------------------------------------
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = mmu$(EXEEXT)
+subdir = mmu
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am_mmu_OBJECTS = mmu.$(OBJEXT) mmu-asm.$(OBJEXT)
+mmu_OBJECTS = $(am_mmu_OBJECTS)
+mmu_DEPENDENCIES = ../except/except.lo ../support/libsupport.la
+mmu_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(mmu_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/../../depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(mmu_SOURCES)
+DIST_SOURCES = $(mmu_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIM = @SIM@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+mmu_SOURCES = mmu.c \
+ mmu-asm.S
+
+mmu_LDFLAGS = -T$(srcdir)/../default.ld
+mmu_LDADD = ../except/except.lo \
+ ../support/libsupport.la
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mmu/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu mmu/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+mmu$(EXEEXT): $(mmu_OBJECTS) $(mmu_DEPENDENCIES)
+ @rm -f mmu$(EXEEXT)
+ $(mmu_LINK) $(mmu_OBJECTS) $(mmu_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmu-asm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmu.Po@am__quote@
+
+.S.o:
+@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $<
+
+.S.obj:
+@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.S.lo:
+@am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $<
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: mmu-asm.S
===================================================================
--- mmu-asm.S (nonexistent)
+++ mmu-asm.S (revision 347)
@@ -0,0 +1,537 @@
+/* mmu-asm.S. Machine code to support Or1ksim MMU test
+
+ Copyright (C) 1999-2006 OpenCores
+ Copyright (C) 2010 Embecosm Limited
+
+ Contributors various OpenCores participants
+ Contributor Jeremy Bennett
+
+ This file is part of OpenRISC 1000 Architectural Simulator.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program. If not, see . */
+
+/* ----------------------------------------------------------------------------
+ This code is commented throughout for use with Doxygen.
+ --------------------------------------------------------------------------*/
+#include "spr-defs.h"
+
+#define PAGE_SIZE 8192
+#define DTLB_PR_NOLIMIT (SPR_DTLBTR_URE | \
+ SPR_DTLBTR_UWE | \
+ SPR_DTLBTR_SRE | \
+ SPR_DTLBTR_SWE )
+#define ITLB_PR_NOLIMIT (SPR_ITLBTR_SXE | \
+ SPR_ITLBTR_UXE )
+ .global lo_dmmu_en
+ .global lo_immu_en
+ .global lo_dtlb_ci_test
+ .global lo_itlb_ci_test
+ .global testjump
+ .global ic_enable
+ .global ic_disable
+ .global dc_enable
+ .global dc_disable
+
+lo_dmmu_en:
+ l.mfspr r11,r0,SPR_SR
+ l.ori r11,r11,SPR_SR_DME
+ l.mtspr r0,r11,SPR_ESR_BASE
+ l.mtspr r0,r9,SPR_EPCR_BASE
+ l.rfe
+ l.nop
+
+lo_dmmu_dis:
+ l.addi r13,r0,-1
+ l.xori r13,r13,SPR_SR_DME
+ l.mfspr r11,r0,SPR_SR
+ l.and r11,r11,r13
+ l.mtspr r0,r11,SPR_SR
+ l.jr r9
+ l.nop
+
+lo_immu_en:
+ l.mfspr r11,r0,SPR_SR
+ l.ori r11,r11,SPR_SR_IME
+ l.mtspr r0,r11,SPR_ESR_BASE
+ l.mtspr r0,r9,SPR_EPCR_BASE
+ l.rfe
+ l.nop
+
+lo_immu_dis:
+ l.addi r13,r0,-1
+ l.xori r13,r13,SPR_SR_IME
+ l.mfspr r11,r0,SPR_SR
+ l.and r11,r11,r13
+ l.mtspr r0,r11,SPR_SR
+ l.jr r9
+ l.nop
+
+testjump:
+ l.movhi r5,0x4800
+ l.ori r5,r5,0x4800
+ l.sw 0x0(r3),r5
+ l.movhi r5,0x1500
+ l.ori r5,r5,0x0000
+ l.sw 0x4(r3),r5
+ l.or r5,r0,r9
+ l.jalr r4
+ l.nop
+ l.or r9,r0,r5
+ l.jr r9
+ l.nop
+
+ic_enable:
+ /* Disable IC */
+ l.mfspr r13,r0,SPR_SR
+ l.addi r11,r0,-1
+ l.xori r11,r11,SPR_SR_ICE
+ l.and r11,r13,r11
+ l.mtspr r0,r11,SPR_SR
+
+ /* Invalidate IC */
+ l.addi r13,r0,0
+ l.addi r11,r0,8192
+1:
+ l.mtspr r0,r13,SPR_ICBIR
+ l.sfne r13,r11
+ l.bf 1b
+ l.addi r13,r13,16
+
+ /* Enable IC */
+ l.mfspr r13,r0,SPR_SR
+ l.ori r13,r13,SPR_SR_ICE
+ l.mtspr r0,r13,SPR_SR
+ l.nop
+ l.nop
+ l.nop
+ l.nop
+ l.nop
+
+ l.jr r9
+ l.nop
+
+ic_disable:
+ /* Disable IC */
+ l.mfspr r13,r0,SPR_SR
+ l.addi r11,r0,-1
+ l.xori r11,r11,SPR_SR_ICE
+ l.and r11,r13,r11
+ l.mtspr r0,r11,SPR_SR
+
+ l.jr r9
+ l.nop
+
+dc_enable:
+ /* Disable DC */
+ l.mfspr r13,r0,SPR_SR
+ l.addi r11,r0,-1
+ l.xori r11,r11,SPR_SR_DCE
+ l.and r11,r13,r11
+ l.mtspr r0,r11,SPR_SR
+
+ /* Flush DC */
+ l.addi r13,r0,0
+ l.addi r11,r0,8192
+1:
+ l.mtspr r0,r13,SPR_DCBIR
+ l.sfne r13,r11
+ l.bf 1b
+ l.addi r13,r13,16
+
+ /* Enable DC */
+ l.mfspr r13,r0,SPR_SR
+ l.ori r13,r13,SPR_SR_DCE
+ l.mtspr r0,r13,SPR_SR
+
+ l.jr r9
+ l.nop
+
+dc_disable:
+ /* Disable DC */
+ l.mfspr r13,r0,SPR_SR
+ l.addi r11,r0,-1
+ l.xori r11,r11,SPR_SR_DCE
+ l.and r11,r13,r11
+ l.mtspr r0,r11,SPR_SR
+
+ l.jr r9
+ l.nop
+
+ /* dtlb_ic_test(unsigned long add, unsigned long set) */
+lo_dtlb_ci_test:
+ l.addi r1,r1,-4
+ l.sw 0(r1),r9
+
+ l.addi r8,r0,0
+
+ l.movhi r5,hi(0x01234567)
+ l.ori r5,r5,lo(0x01234567)
+ l.sw 0(r3),r5
+ l.movhi r5,hi(0x89abcdef)
+ l.ori r5,r5,lo(0x89abcdef)
+ l.sw (PAGE_SIZE - 4)(r3),r5
+
+ l.ori r5,r3,SPR_DTLBMR_V
+ l.mtspr r4,r5,SPR_DTLBMR_BASE(0)
+
+ l.ori r5,r3,(DTLB_PR_NOLIMIT | SPR_DTLBTR_CI)
+ l.mtspr r4,r5,SPR_DTLBTR_BASE(0)
+
+ l.addi r5,r3,PAGE_SIZE
+ l.ori r5,r5,SPR_DTLBMR_V
+ l.addi r6,r4,1
+ l.mtspr r6,r5,SPR_DTLBMR_BASE(0)
+
+ l.addi r5,r3,PAGE_SIZE
+ l.ori r5,r5,(DTLB_PR_NOLIMIT | SPR_DTLBTR_CI)
+ l.addi r6,r4,1
+ l.mtspr r6,r5,SPR_DTLBTR_BASE(0)
+
+ l.jal lo_dmmu_en
+ l.nop
+ l.jal dc_enable
+ l.nop
+
+ l.movhi r6,hi(0x01234567)
+ l.ori r6,r6,lo(0x01234567)
+ l.lwz r5,0(r3)
+ l.sfeq r6,r5
+ l.bnf 11f
+ l.nop
+ l.movhi r6,hi(0x89abcdef)
+ l.ori r6,r6,lo(0x89abcdef)
+ l.lwz r5,(PAGE_SIZE - 4)(r3)
+ l.sfeq r6,r5
+ l.bnf 12f
+ l.nop
+
+ l.movhi r5,hi(0x76543210)
+ l.ori r5,r5,lo(0x76543210)
+ l.sw 0(r3),r5
+ l.movhi r5,hi(0xfedcba9)
+ l.ori r5,r5,lo(0xfedcba9)
+ l.sw (PAGE_SIZE - 4)(r3),r5
+
+ l.jal lo_dmmu_dis
+ l.nop
+ l.ori r5,r3,(DTLB_PR_NOLIMIT)
+ l.mtspr r4,r5,SPR_DTLBTR_BASE(0)
+ l.jal lo_dmmu_en
+ l.nop
+
+ l.movhi r6,hi(0x76543210)
+ l.ori r6,r6,lo(0x76543210)
+ l.lwz r5,0(r3)
+ l.sfeq r6,r5
+ l.bnf 13f
+ l.nop
+ l.movhi r6,hi(0xfedcba9)
+ l.ori r6,r6,lo(0xfedcba9)
+ l.lwz r5,(PAGE_SIZE - 4)(r3)
+ l.sfeq r6,r5
+ l.bnf 14f
+ l.nop
+
+ l.jal lo_dmmu_dis
+ l.nop
+ l.ori r5,r3,(DTLB_PR_NOLIMIT | SPR_DTLBTR_CI)
+ l.mtspr r4,r5,SPR_DTLBTR_BASE(0)
+ l.jal lo_dmmu_en
+ l.nop
+
+ l.movhi r5,hi(0x00112233)
+ l.ori r5,r5,lo(0x00112233)
+ l.sw 0(r3),r5
+#if 1
+ l.movhi r5,hi(0x44556677)
+ l.ori r5,r5,lo(0x44556677)
+ l.sw 4(r3),r5
+ l.movhi r5,hi(0x8899aabb)
+ l.ori r5,r5,lo(0x8899aabb)
+ l.sw 8(r3),r5
+ l.movhi r5,hi(0xccddeeff)
+ l.ori r5,r5,lo(0xccddeeff)
+ l.sw 12(r3),r5
+#endif
+ l.movhi r5,hi(0x44556677)
+ l.ori r5,r5,lo(0x44556677)
+ l.sw (PAGE_SIZE - 4)(r3),r5
+
+ l.movhi r6,hi(0x00112233)
+ l.ori r6,r6,lo(0x00112233)
+ l.lwz r5,0(r3)
+ l.sfeq r6,r5
+ l.bnf 15f
+ l.nop
+ l.movhi r6,hi(0x44556677)
+ l.ori r6,r6,lo(0x44556677)
+ l.lwz r5,(PAGE_SIZE - 4)(r3)
+ l.sfeq r6,r5
+ l.bnf 16f
+ l.nop
+
+ l.jal lo_dmmu_dis
+ l.nop
+ l.ori r5,r3,(DTLB_PR_NOLIMIT)
+ l.mtspr r4,r5,SPR_DTLBTR_BASE(0)
+ l.jal lo_dmmu_en
+ l.nop
+
+ l.movhi r6,hi(0x76543210)
+ l.ori r6,r6,lo(0x76543210)
+ l.lwz r5,0(r3)
+ l.sfeq r6,r5
+ l.bnf 17f
+ l.nop
+
+ l.movhi r6,hi(0xfedcba9)
+ l.ori r6,r6,lo(0xfedcba9)
+ l.lwz r5,(PAGE_SIZE - 4)(r3)
+ l.sfeq r6,r5
+ l.bnf 18f
+ l.nop
+
+ /* Invalidate cache */
+ l.jal dc_disable
+ l.nop
+
+ l.movhi r5,hi(0x00112233)
+ l.ori r5,r5,lo(0x00112233)
+ l.sw 12(r3),r5
+ l.movhi r5,hi(0x44556677)
+ l.ori r5,r5,lo(0x44556677)
+ l.sw 8(r3),r5
+ l.movhi r5,hi(0x8899aabb)
+ l.ori r5,r5,lo(0x8899aabb)
+ l.sw 4(r3),r5
+ l.movhi r5,hi(0xccddeeff)
+ l.ori r5,r5,lo(0xccddeeff)
+ l.sw 0(r3),r5
+ l.movhi r5,hi(0x44556677)
+ l.ori r5,r5,lo(0x44556677)
+ l.sw (PAGE_SIZE - 4)(r3),r5
+
+ l.jal dc_enable
+ l.nop
+
+ /* I want this part to execute as fast as possible */
+ l.jal ic_enable
+ l.nop
+
+ l.addi r5,r3,PAGE_SIZE
+
+ /* This jump is just to be shure that the following
+ instructions will get into IC */
+ l.j 1f
+ l.nop
+ /* This shuld trigger cahe line refill */
+2: l.lwz r6,0(r3)
+ l.j 2f
+ /* This load is from non cached area and may cause some problems
+ in previuos refill, which is probably still in progress */
+ l.lwz r6,0(r5)
+1: l.j 2b
+ l.nop
+2:
+ /* Check the line that was previosly refilled */
+ l.movhi r6,hi(0x00112233)
+ l.ori r6,r6,lo(0x00112233)
+ l.lwz r5,12(r3)
+ l.sfeq r6,r5
+ l.bnf 19f
+ l.nop
+ l.movhi r6,hi(0x44556677)
+ l.ori r6,r6,lo(0x44556677)
+ l.lwz r5,8(r3)
+ l.sfeq r6,r5
+ l.bnf 19f
+ l.nop
+ l.movhi r6,hi(0x8899aabb)
+ l.ori r6,r6,lo(0x8899aabb)
+ l.lwz r5,4(r3)
+ l.sfeq r6,r5
+ l.bnf 19f
+ l.nop
+ l.movhi r6,hi(0xccddeeff)
+ l.ori r6,r6,lo(0xccddeeff)
+ l.lwz r5,0(r3)
+ l.sfeq r6,r5
+ l.bnf 19f
+ l.nop
+
+ l.jal dc_disable
+ l.nop
+
+ l.jal lo_dmmu_dis
+ l.nop
+
+ l.j 10f
+ l.nop
+
+19: l.addi r8,r8,1
+18: l.addi r8,r8,1
+17: l.addi r8,r8,1
+16: l.addi r8,r8,1
+15: l.addi r8,r8,1
+14: l.addi r8,r8,1
+13: l.addi r8,r8,1
+12: l.addi r8,r8,1
+11: l.addi r8,r8,1
+
+10: l.jal dc_disable
+ l.nop
+
+ l.jal ic_disable
+ l.nop
+
+ l.jal lo_dmmu_dis
+ l.nop
+
+ l.addi r11,r8,0
+ l.sw 0(r0),r8
+ l.sw 4(r0),r5
+
+ l.lwz r9,0(r1)
+ l.jr r9
+ l.addi r1,r1,4
+
+ /* itlb_ic_test(unsigned long add, unsigned long set) */
+lo_itlb_ci_test:
+ l.addi r1,r1,-4
+ l.sw 0(r1),r9
+
+ l.addi r8,r0,0
+
+ /* Copy the code to the prepeared location */
+ l.addi r7,r0,88
+ l.movhi r5,hi(ci_test)
+ l.ori r5,r5,lo(ci_test)
+ l.addi r6,r3,0
+1: l.lwz r11,0(r5)
+ l.sw 0(r6),r11
+ l.addi r5,r5,4
+ l.addi r6,r6,4
+ l.addi r7,r7,-4
+ l.sfeqi r7,0
+ l.bnf 1b
+ l.nop
+
+ l.ori r5,r3,SPR_ITLBMR_V
+ l.mtspr r4,r5,SPR_ITLBMR_BASE(0)
+
+ l.ori r5,r3,ITLB_PR_NOLIMIT
+ l.mtspr r4,r5,SPR_ITLBTR_BASE(0)
+
+ l.jal lo_immu_en
+ l.nop
+ l.jal ic_enable
+ l.nop
+
+ l.addi r5,r0,0
+ l.addi r6,r0,0
+ l.jalr r3
+ l.nop
+
+ l.sfeqi r5,5
+ l.bnf 11f
+ l.nop
+
+ /* Copy the code to the prepeared location */
+ l.addi r7,r0,20
+ l.movhi r5,hi(ic_refill_test)
+ l.ori r5,r5,lo(ic_refill_test)
+ l.addi r6,r3,12
+1: l.lwz r11,0(r5)
+ l.sw 0(r6),r11
+ l.addi r5,r5,4
+ l.addi r6,r6,4
+ l.addi r7,r7,-4
+ l.sfeqi r7,0
+ l.bnf 1b
+ l.nop
+
+ l.jal ic_disable
+ l.nop
+ l.jal ic_enable
+ l.nop
+
+ l.addi r5,r0,0
+ l.addi r6,r3,12
+ l.jalr r6
+ l.nop
+ l.addi r6,r3,16
+ l.jalr r6
+ l.nop
+
+ l.sfeqi r5,4
+ l.bnf 12f
+ l.nop
+
+ l.j 10f
+ l.nop
+
+12: l.addi r8,r8,1
+11: l.addi r8,r8,1
+
+10: l.jal ic_disable
+ l.nop
+
+ l.jal lo_dmmu_dis
+ l.nop
+
+ l.addi r11,r8,0
+ l.sw 0(r0),r11
+ l.sw 4(r0),r5
+
+ l.lwz r9,0(r1)
+ l.jr r9
+ l.addi r1,r1,4
+
+ci_test:
+3: l.addi r5,r5,1
+
+ l.sfeqi r6,0x01
+ l.bnf 1f
+ l.nop
+
+ l.addi r13,r0,-1
+ l.xori r13,r13,SPR_SR_IME
+ l.mfspr r11,r0,SPR_SR
+ l.and r13,r11,r13
+ l.mtspr r0,r13,SPR_SR
+
+ l.ori r7,r3,(ITLB_PR_NOLIMIT | SPR_ITLBTR_CI)
+ l.mtspr r4,r7,SPR_ITLBTR_BASE(0)
+
+ l.mtspr r0,r11,SPR_SR
+
+1: l.lwz r7,0(r3)
+ l.addi r7,r7,1
+ l.sw 0(r3),r7
+
+2: l.addi r6,r6,1
+ l.sfeqi r6,3
+ l.bnf 3b
+ l.nop
+
+ l.jr r9
+ l.nop
+
+
+ic_refill_test:
+ l.jr r9
+ l.addi r5,r5,1
+ l.addi r5,r5,1
+ l.jr r9
+ l.addi r5,r5,1
mmu-asm.S
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Makefile.am
===================================================================
--- Makefile.am (nonexistent)
+++ Makefile.am (revision 347)
@@ -0,0 +1,36 @@
+# Makefile.am for or1ksim testsuite CPU test program: mmu
+
+# Copyright (C) Embecosm Limited, 2010
+
+# Contributor Jeremy Bennett
+
+# This file is part of OpenRISC 1000 Architectural Simulator.
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see . */
+
+# -----------------------------------------------------------------------------
+# This code is commented throughout for use with Doxygen.
+# -----------------------------------------------------------------------------
+
+
+# A test program of the OR1K MMU
+check_PROGRAMS = mmu
+
+mmu_SOURCES = mmu.c \
+ mmu-asm.S
+
+mmu_LDFLAGS = -T$(srcdir)/../default.ld
+
+mmu_LDADD = ../except/except.lo \
+ ../support/libsupport.la
Makefile.am
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property