- added tests
git-svn-id: http://moon:8086/svn/mips@172 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "../libsys/utils.h"
|
||||
|
||||
#define SIZE 256
|
||||
|
||||
uint32_t _test_dcache(uint32_t *pMem)
|
||||
{
|
||||
uint32_t result;
|
||||
|
||||
__asm__
|
||||
(
|
||||
".set noreorder\n"
|
||||
".set nomacro\n"
|
||||
|
||||
"addiu $t1, $0, 0x5555\n"
|
||||
"lw $t0, 0(%[pMem])\n"
|
||||
"sw $t1, 24(%[pMem])\n"
|
||||
"addiu $t0, 8\n"
|
||||
"sw $t0, 0(%[pMem])\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"nop\n"
|
||||
"lw %[result], 24(%[pMem])\n"
|
||||
|
||||
".set macro\n"
|
||||
".set reorder\n"
|
||||
: [result] "=r" (result)
|
||||
: [pMem] "r" (pMem)
|
||||
: "t0", "t1"
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t test_dcache()
|
||||
{
|
||||
uint64_t buffer[SIZE/sizeof(uint64_t)];
|
||||
uint32_t *pPtr32 = (uint32_t*)buffer;
|
||||
|
||||
for(int i=0; i < SIZE/sizeof(uint32_t); i++)
|
||||
pPtr32[i] = i;
|
||||
|
||||
DCACHE_invalidate_all();
|
||||
|
||||
return _test_dcache(pPtr32) == 0x00005555;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef _TEST_DCACHE_H_
|
||||
#define _TEST_DCACHE_H_
|
||||
|
||||
uint32_t test_dcache();
|
||||
|
||||
#endif // _TEST_DCACHE_H__TEST_DCACHE_H_
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "../libsys/utils.h"
|
||||
|
||||
|
||||
uint32_t _test_uncached_cachemiss_bug(uint32_t* pMem)
|
||||
{
|
||||
uint32_t result;
|
||||
|
||||
pMem[0] = 0x12345678;
|
||||
pMem[1] = 0xFFFFFFFF;
|
||||
|
||||
DCACHE_invalidate_all();
|
||||
|
||||
__asm__
|
||||
(
|
||||
"move $s0, %[pMem]\n"
|
||||
"lw $a0, 32($s0)\n"
|
||||
"or $s1, $a0, $0\n"
|
||||
"or $a2, $0, $0\n"
|
||||
"addiu $a2, 1\n"
|
||||
"sw $a2, 32($s0)\n"
|
||||
// "lw $a1, 0(%[pMem])\n"
|
||||
"lw $a0, 32($s0)\n"
|
||||
"lw $a2, 4(%[pMem])\n"
|
||||
"lw $a1, 0(%[pMem])\n"
|
||||
"nop\n"
|
||||
"sw $s1, 8($s0)\n"
|
||||
"or %[result], $a0, $0\n"
|
||||
: [result] "=r" (result)
|
||||
: [pMem] "r" (pMem)
|
||||
: "a0", "a1", "a2", "s0", "s1"
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t test_uncached_cachemiss_bug()
|
||||
{
|
||||
uint32_t buf[256], res;
|
||||
|
||||
res = _test_uncached_cachemiss_bug(buf);
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef _TEST_UNCACHED_CACHEMISS_BUG_H_
|
||||
#define _TEST_UNCACHED_CACHEMISS_BUG_H_
|
||||
|
||||
uint32_t test_uncached_cachemiss_bug();
|
||||
|
||||
#endif // _TEST_UNCACHED_CACHEMISS_BUG_H_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user