[CMAKE]: Make cross-build work on all systems. RosBE Already is nice and adds itself...
[reactos.git] / lib / ppcmmu / mmutest.c
1 #include "ppcmmu/mmu.h"
2 #include "ppcmmu/mmuutil.h"
3 #include "mmuobject.h"
4
5 int mmunitest()
6 {
7 int ret;
8 int (*fun)(int ret) = (void *)0x80000000;
9 ppc_map_info_t info = { 0 };
10 volatile int oldmsr, msr = 0x2030;
11 __asm__("mfmsr 0\n\tstw 0,0(%0)" : : "r" (&oldmsr));
12 mmusetvsid(8, 9, 0);
13 info.flags = MMU_ALL_RW;
14 info.proc = 0;
15 info.addr = (vaddr_t)fun;
16 mmuaddpage(&info, 1);
17 __asm__("mtmsr %0" : : "r" (msr));
18 __asm__("mtsdr1 %0" : : "r" (HTABORG));
19 *((int *)fun) = 0x4e800020;
20 ret = fun(3);
21 __asm__("mtmsr %0" : : "r" (oldmsr));
22 return ret != 3;
23 }