Search
lxdream.org :: lxdream/test/sh4/testsh4.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/testsh4.c
changeset 555:309c97260912
prev533:9764673fd4a5
next808:da414654f3fa
author nkeynes
date Sun Jul 20 11:36:48 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Initial implementation for sort-dma channel
file annotate diff log raw
1.1 --- a/test/sh4/testsh4.c Tue Nov 20 08:31:34 2007 +0000
1.2 +++ b/test/sh4/testsh4.c Sun Jul 20 11:36:48 2008 +0000
1.3 @@ -1,4 +1,5 @@
1.4 #include <stdio.h>
1.5 +#include "../lib.h"
1.6
1.7 int total_tests = 0;
1.8 int total_fails = 0;
1.9 @@ -42,6 +43,29 @@
1.10 }
1.11 }
1.12
1.13 +int assert_tlb_exception_caught( char *testname, int number, unsigned int expectedpc,
1.14 + unsigned int vpn )
1.15 +{
1.16 + if( assert_exception_caught(testname, number, expectedpc) == 1 ) {
1.17 + return 1;
1.18 + }
1.19 +
1.20 + unsigned int pteh = long_read(0xFF000000);
1.21 + if( (pteh & 0xFFFFFC00) != (vpn & 0xFFFFFC00) ) {
1.22 + fprintf(stderr, "%s: Test %d failed: Expected PTEH.VPN = %08X, but was %08X\n",
1.23 + testname, number, (vpn>>10), (pteh>>10) );
1.24 + return 1;
1.25 + }
1.26 +
1.27 + unsigned int tea = long_read(0xFF00000C);
1.28 + if( tea != vpn ) {
1.29 + fprintf(stderr, "%s: Test %d failed: Expected TEA = %08X, but was %08X\n",
1.30 + testname, number, vpn, tea );
1.31 + return 1;
1.32 + }
1.33 + return 0;
1.34 +}
1.35 +
1.36 int main()
1.37 {
1.38 fprintf( stdout, "Instruction tests...\n" );
1.39 @@ -77,6 +101,7 @@
1.40 fprintf( stdout, "Exception tests...\n" );
1.41 test_slot_illegal();
1.42 test_undefined();
1.43 + test_tlb();
1.44 remove_interrupt_handler();
1.45
1.46 fprintf( stdout, "Total: %d/%d tests passed (%d%%)\n", total_tests-total_fails,
.