filename | test/sh4/mmummio.c |
changeset | 976:e57a25d9eb7d |
author | nkeynes |
date | Tue Mar 24 11:15:57 2009 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Add preliminary implementation of the GDB remote debugging server - attaches to either or both the SH4 and ARM |
file | annotate | diff | log | raw |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00001.2 +++ b/test/sh4/mmummio.c Tue Mar 24 11:15:57 2009 +00001.3 @@ -0,0 +1,61 @@1.4 +#include <assert.h>1.5 +#include <stdio.h>1.6 +#include "../lib.h"1.7 +1.8 +#define PTEH 0xFF0000001.9 +#define PTEL 0xFF0000041.10 +#define TTB 0xFF0000081.11 +#define TEA 0xFF00000C1.12 +#define MMUCR 0xFF0000101.13 +#define PTEA 0xFF0000341.14 +1.15 +#define ITLB_ADDR(entry) (0xF2000000 + (entry<<8))1.16 +#define ITLB_DATA(entry) (0xF3000000 + (entry<<8))1.17 +#define UTLB_ADDR(entry) (0xF6000000 + (entry<<8))1.18 +#define UTLB_DATA1(entry) (0xF7000000 + (entry<<8))1.19 +#define UTLB_DATA2(entry) (0xF7800000 + (entry<<8))1.20 +1.21 +/* Bang on the mmio side of the TLBs to make sure the bits1.22 + * respond appropriately (with AT disabled so we don't risk1.23 + * doing a hard crash) */1.24 +void test_tlb_mmio()1.25 +{1.26 + int entry;1.27 + for( entry=0; entry<64; entry++ ) {1.28 + long_write( UTLB_DATA1(entry), 0 );1.29 + long_write( UTLB_ADDR(entry), 0xFFFFFFFF );1.30 + assert( long_read( UTLB_ADDR(entry) ) == 0xFFFFFFFF );1.31 + assert( long_read( UTLB_DATA1(entry) ) == 0x00000104 );1.32 + long_write( UTLB_ADDR(entry), 0x00000000 );1.33 + assert( long_read( UTLB_ADDR(entry) ) == 0x00000000 );1.34 + assert( long_read( UTLB_DATA1(entry) ) == 0x00000000 );1.35 + long_write( UTLB_DATA1(entry), 0xFFFFFFFF );1.36 + assert( long_read( UTLB_DATA1(entry) ) == 0x1FFFFDFF );1.37 + assert( long_read( UTLB_ADDR(entry) ) == 0x00000300 );1.38 + long_write( UTLB_DATA1(entry), 0x00000000 );1.39 + assert( long_read( UTLB_DATA1(entry) ) == 0x00000000 );1.40 + assert( long_read( UTLB_ADDR(entry) ) == 0x00000000 );1.41 + long_write( UTLB_DATA2(entry), 0xFFFFFFFF );1.42 + assert( long_read( UTLB_DATA2(entry) ) == 0x0000000F );1.43 + long_write( UTLB_DATA2(entry), 0x00000000 );1.44 + assert( long_read( UTLB_DATA2(entry) ) == 0x00000000 );1.45 + }1.46 +1.47 + for( entry=0; entry<4; entry++ ) {1.48 + long_write( ITLB_DATA(entry), 0 );1.49 + long_write( ITLB_ADDR(entry), 0xFFFFFFFF );1.50 + assert( long_read( ITLB_ADDR(entry) ) == 0xFFFFFDFF );1.51 + assert( long_read( ITLB_DATA(entry) ) == 0x00000100 );1.52 + long_write( ITLB_ADDR(entry), 0x00000000 );1.53 + assert( long_read( ITLB_ADDR(entry) ) == 0x00000000 );1.54 + assert( long_read( ITLB_DATA(entry) ) == 0x00000000 );1.55 + long_write( ITLB_DATA(entry), 0xFFFFFFFF );1.56 + assert( long_read( ITLB_DATA(entry) ) == 0x1FFFFDDA );1.57 + assert( long_read( ITLB_ADDR(entry) ) == 0x00000100 );1.58 + long_write( ITLB_DATA(entry), 0x00000000 );1.59 + assert( long_read( ITLB_DATA(entry) ) == 0x00000000 );1.60 + assert( long_read( ITLB_ADDR(entry) ) == 0x00000000 );1.61 +1.62 + }1.63 +}1.64 +
.