ReactOS  0.4.14-dev-315-gbb6fece
mmutest.c
Go to the documentation of this file.
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 }
#define HTABORG
Definition: mmu.h:58
int mmuaddpage(ppc_map_info_t *info, int count)
Definition: mmuobject.c:494
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
unsigned long vaddr_t
Definition: mmu.h:90
int ret
void mmusetvsid(int start, int end, int vsid)
Definition: mmuobject.c:664
#define MMU_ALL_RW
Definition: mmu.h:78
int mmunitest()
Definition: mmutest.c:5
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31