Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@790 cc03376c-175c-47c8-b038-4cd826a8556b
45 lines
735 B
C
45 lines
735 B
C
#include "libsys.h"
|
|
|
|
int uncached_cachemiss_bug(UINT32* pMem)
|
|
{
|
|
UINT32 result;
|
|
|
|
pMem[0] = 0x12345678;
|
|
pMem[1] = 0xFFFFFFFF;
|
|
|
|
DCACHE_invalidate_all();
|
|
|
|
__asm__
|
|
(
|
|
"lui $s0, 0xA000\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 %[val], $a0, $0\n"
|
|
: [val] "=r" (result)
|
|
: [pMem] "r" (pMem)
|
|
: "a0", "a1", "a2", "s0", "s1"
|
|
);
|
|
return result;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
UINT32 volatile *pLed = (UINT32*)SYS_LED_PORT;
|
|
int buf[256], res;
|
|
|
|
res = uncached_cachemiss_bug(buf);
|
|
*pLed = res;
|
|
|
|
return res;
|
|
|
|
}
|