reactos/lib/ppcmmu/mmutest.c
Cameron Gutman c2d0d784c7 [USB-BRINGUP-TRUNK]
- Create a branch to do a proper merge of USB work from a trunk base instead of from cmake-bringup
- In the future, DO NOT under any circumstances branch another branch. This leads to merge problems!

svn path=/branches/usb-bringup-trunk/; revision=55018
2012-01-20 20:58:46 +00:00

24 lines
609 B
C

#include "ppcmmu/mmu.h"
#include "ppcmmu/mmuutil.h"
#include "mmuobject.h"
int mmunitest()
{
int ret;
int (*fun)(int ret) = (void *)0x80000000;
ppc_map_info_t info = { 0 };
volatile int oldmsr, msr = 0x2030;
__asm__("mfmsr 0\n\tstw 0,0(%0)" : : "r" (&oldmsr));
mmusetvsid(8, 9, 0);
info.flags = MMU_ALL_RW;
info.proc = 0;
info.addr = (vaddr_t)fun;
mmuaddpage(&info, 1);
__asm__("mtmsr %0" : : "r" (msr));
__asm__("mtsdr1 %0" : : "r" (HTABORG));
*((int *)fun) = 0x4e800020;
ret = fun(3);
__asm__("mtmsr %0" : : "r" (oldmsr));
return ret != 3;
}