ReactOS  0.4.15-dev-1184-g23e04ae
mmuobject.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void initme (void)
 
void mmusetramsize (paddr_t size)
 
int mmuaddpage (ppc_map_info_t *info, int count)
 
void mmudelpage (ppc_map_info_t *info, int count)
 
void mmugetpage (ppc_map_info_t *info, int count)
 
void mmusetvsid (int start, int end, int vsid)
 
voidallocvsid (int)
 
void mmuallocvsid (int vsid, int mask)
 
void freevsid (int)
 
void mmufreevsid (int vsid, int mask)
 
int mmunitest (void)
 
void callkernel (void *fun_ptr, void *arg)
 

Function Documentation

◆ allocvsid()

void* allocvsid ( int  )

Definition at line 437 of file mmuobject.c.

438 {
439  ppc_map_t *map = allocpage();
440  MmuVsidInfo *info;
441  if(!map) return 0;
442  map->pte.pteh = map->pte.ptel = 0;
444  info->vsid = vsid;
445  info->next = VsidHead;
446  VsidHead = info;
447  return info;
448 }
struct _test_info info[]
Definition: SetCursorPos.c:19
#define PPC_PAGE_ADDR(x)
Definition: mmu.h:65
MmuVsidInfo * VsidHead
Definition: mmuobject.c:67
Definition: _map.h:44
ppc_map_t * allocpage()
Definition: mmuobject.c:356
#define PpcPageTable
Definition: mmu.h:63

Referenced by mmuallocvsid().

◆ callkernel()

void callkernel ( void fun_ptr,
void arg 
)

Definition at line 742 of file mmuobject.c.

743 {
744  int i;
745 
746  Booted = 1;
747 
748  for (i = 0; i < 16; i++)
749  {
750  // Patch up the vsid map. We shouldn't muck with these until we're
751  // booted.
752  mmusetvsid(i, i+1, Vsid[i]);
753  }
754 
755  void (*fun)(void *) = fun_ptr;
756  __asm__("mfmsr 3\n\t"
757  "ori 3,3,0x30\n\t"
758  "mtmsr 3\n\t"
759  "mtsdr1 %0\n\t"
760  "mr 0,%2\n\t"
761  "mtctr 0\n\t"
762  "mr 3,%1\n\t"
763  "bctrl\n\t"
764  : : "r" (HTABORG), "r" (arg), "r" (fun));
765  /* BYE ! */
766 }
#define HTABORG
Definition: mmu.h:58
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int Vsid[16]
Definition: mmuobject.c:63
int Booted
Definition: mmuobject.c:63
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__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")
void mmusetvsid(int start, int end, int vsid)
Definition: mmuobject.c:664

Referenced by _mmumain().

◆ freevsid()

void freevsid ( int  )

Definition at line 470 of file mmuobject.c.

471 {
472  int i;
473  MmuVsidInfo *info = findvsid(vsid);
474  if(!info) return;
476  for(i = 0; i < 256; i++)
477  {
478  if(info->tree[i])
479  freevsidtree(info->tree[i]);
480  }
481  freepage(map);
482 }
void freepage(ppc_map_t *PagePtr)
Definition: mmuobject.c:397
void freevsidtree(MmuVsidTree *tree)
Definition: mmuobject.c:426
MmuVsidInfo * findvsid(int vsid)
Definition: mmuobject.c:460
unsigned long paddr_t
Definition: mmu.h:89
#define PPC_PAGE_NUMBER(x)
Definition: mmu.h:66
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: _map.h:44
#define PpcPageTable
Definition: mmu.h:63

Referenced by mmufreevsid().

◆ initme()

void initme ( void  )

Definition at line 323 of file mmuobject.c.

324 {
325  int i;
326 
327  for(i = 0; i < HTABSIZ / sizeof(int); i++)
328  {
329  ((int *)HTABORG)[i] = 0;
330  }
331 
332  /* Default to hang on unknown exception */
333  for(i = 0; i < 30; i++)
334  {
336  if (i != 1) /* Preserve reset handler */
338  }
339 
340  /* Serial Interrupt */
341  callback[5] = 0; /* Do nothing until the user asks */
342 
343  /* Program Exception */
345 
346  /* Floating point exception */
347  callback[8] = fpenable;
348 
349  /* Ignore decrementer and EE */
350  callback[9] = ignore;
351 
352  /* Single Step */
354 }
#define HTABORG
Definition: mmu.h:58
int fpenable(int trapCode, ppc_trap_frame_t *trap)
Definition: mmuobject.c:301
int ignore(int trapCode, ppc_trap_frame_t *trap)
Definition: mmuobject.c:296
int(* MmuTrapHandler)(int trapid, ppc_trap_frame_t *trap)
Definition: mmu.h:118
void TakeException(int n, ppc_trap_frame_t *tf)
Definition: gdblib.c:464
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
#define HTABSIZ
Definition: mmu.h:59
void copy_trap_handler(int trap)
Definition: mmuobject.c:309
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by _mmumain().

◆ mmuaddpage()

int mmuaddpage ( ppc_map_info_t info,
int  count 
)

Definition at line 494 of file mmuobject.c.

495 {
496  int i, iva = 0, vsid, phys, virt;
497  int ptehi;
498  int ptelo, vsid_table_hi, vsid_table_lo;
499  ppc_map_t *PagePtr;
500  MmuVsidInfo *VsidInfo;
501  MmuVsidTree *VsidTree;
502 
503  for(i = 0; i < count; i++)
504  {
505  info[i].phys &= ~PPC_PAGE_MASK;
506  info[i].addr &= ~PPC_PAGE_MASK;
507 
508  virt = info[i].addr;
509  vsid = ((info[i].addr >> 28) & 15) | (info[i].proc << 4);
510  VsidInfo = findvsid(vsid);
511 
512  if(!VsidInfo) return -1;
513 
514  ptehi = (1 << 31) | (vsid << 7) | ((virt >> 22) & 0x3f);
515 
516  if(info[i].phys) {
517  PagePtr = &PpcPageTable[PPC_PAGE_NUMBER(info[i].phys)];
518  } else {
519  PagePtr = allocpage();
520  if(!PagePtr)
521  {
522  return 0;
523  }
524  }
525 
526  phys = PPC_PAGE_ADDR((PagePtr - PpcPageTable));
527  ptelo = phys & ~PPC_PAGE_MASK;
528 
529  if (phys < 0x30000)
530  {
531  /* Should not be allocating physical */
532  fmtout("Allocated physical: %x, logical %x\n", phys, virt);
533  fmtout("PagePtr %x (page %d)\n", PagePtr, i);
534  fmtout("info [ %x %x %x %x ]\n", info[i].proc, info[i].addr, info[i].flags, info[i].phys);
535  while(1);
536  }
537 
538  /* Update page data */
539  PagePtr->pte.pteh = ptehi;
540  PagePtr->pte.ptel = ptelo;
541  PagePtr->proc = info[i].proc;
542  PagePtr->addr = virt;
543 
544  vsid_table_hi = virt >> 20 & 255;
545  vsid_table_lo = virt >> 12 & 255;
546 
547  if(!VsidInfo->tree[vsid_table_hi])
548  VsidInfo->tree[vsid_table_hi] = allocvsidtree();
549  VsidTree = VsidInfo->tree[vsid_table_hi];
550  if(!VsidTree) return 0;
551  VsidTree->leaves[vsid_table_lo] = PagePtr;
552 
553  __asm__("tlbie %0\n\tsync\n\tisync" : : "r" (iva));
554  }
555  return 1;
556 }
ppc_pte_t pte
Definition: mmu.h:101
unsigned long proc
Definition: mmu.h:102
GLuint GLuint GLsizei count
Definition: gl.h:1545
MmuVsidInfo * findvsid(int vsid)
Definition: mmuobject.c:460
ppc_map_t * leaves[256]
Definition: mmuobject.c:53
static HANDLE proc()
Definition: pdb.c:32
#define PPC_PAGE_NUMBER(x)
Definition: mmu.h:66
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__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")
vaddr_t addr
Definition: mmu.h:103
#define PPC_PAGE_ADDR(x)
Definition: mmu.h:65
void fmtout(const char *fmt,...)
Definition: mmuobject.c:254
#define PPC_PAGE_MASK
Definition: mmu.h:68
MmuVsidTree * tree[256]
Definition: mmuobject.c:58
unsigned long pteh
Definition: mmu.h:93
GLbitfield flags
Definition: glext.h:7161
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned long ptel
Definition: mmu.h:93
ppc_map_t * allocpage()
Definition: mmuobject.c:356
MmuVsidTree * allocvsidtree()
Definition: mmuobject.c:405
#define PpcPageTable
Definition: mmu.h:63

Referenced by _mmumain(), and mmunitest().

◆ mmuallocvsid()

void mmuallocvsid ( int  vsid,
int  mask 
)

Definition at line 450 of file mmuobject.c.

451 {
452  int i;
453  for(i = 0; i < 16; i++)
454  {
455  if(mask & (1 << i))
456  allocvsid((vsid << 4) + i);
457  }
458 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
void * allocvsid(int vsid)
Definition: mmuobject.c:437

Referenced by _mmumain().

◆ mmudelpage()

void mmudelpage ( ppc_map_info_t info,
int  count 
)

Definition at line 590 of file mmuobject.c.

591 {
592  int i, j, k, ipa;
593  ppc_map_t *PagePtr;
594  ppc_pteg_t *PageEntry;
595  ppc_pte_t ZeroPte = { 0 };
596 
597  for(i = 0; i < count; i++)
598  {
599  if (info[i].phys)
600  {
601  ipa = info[i].phys;
602  PagePtr = &PpcPageTable[ipa];
603  info[i].proc = PagePtr->proc;
604  info[i].addr = PagePtr->addr;
605  }
606  else
607  {
608  PagePtr = mmuvirtmap(info[i].addr);
609  ipa = PPC_PAGE_ADDR(PagePtr - PpcPageTable);
610  }
611 
612  for(j = 0; j < 2; j++)
613  {
614  PageEntry = PtegFromPage(PagePtr, j);
615  for(k = 0; k < 8; k++)
616  {
617  if(PageMatch(ipa, PageEntry->block[k]))
618  {
619  if(PageEntry->block[k].ptel & 0x100)
620  info[i].flags |= MMU_PAGE_DIRTY;
621  PageEntry->block[k] = ZeroPte;
622  }
623  }
624  }
625  freepage(PagePtr);
626  __asm__("tlbie %0\n\tsync\n\tisync" : : "r" (info[i].addr));
627  }
628 }
void freepage(ppc_map_t *PagePtr)
Definition: mmuobject.c:397
Definition: mmu.h:92
unsigned long proc
Definition: mmu.h:102
GLuint GLuint GLsizei count
Definition: gl.h:1545
ppc_map_t * mmuvirtmap(vaddr_t addr)
Definition: mmuobject.c:579
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__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")
vaddr_t addr
Definition: mmu.h:103
#define MMU_PAGE_DIRTY
Definition: mmu.h:81
#define PPC_PAGE_ADDR(x)
Definition: mmu.h:65
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int PageMatch(vaddr_t addr, ppc_pte_t pte)
Definition: mmuobject.c:571
ppc_pteg_t * PtegFromPage(ppc_map_t *map, int hfun)
Definition: mmuobject.c:565
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned long ptel
Definition: mmu.h:93
#define PpcPageTable
Definition: mmu.h:63
ppc_pte_t block[8]
Definition: mmu.h:97
int k
Definition: mpi.c:3369

Referenced by _mmumain().

◆ mmufreevsid()

void mmufreevsid ( int  vsid,
int  mask 
)

Definition at line 484 of file mmuobject.c.

485 {
486  int i;
487  for(i = 0; i < 16; i++)
488  {
489  if(mask & (1 << i))
490  freevsid((vsid << 4) + i);
491  }
492 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
void freevsid(int vsid)
Definition: mmuobject.c:470

Referenced by _mmumain().

◆ mmugetpage()

void mmugetpage ( ppc_map_info_t info,
int  count 
)

Definition at line 630 of file mmuobject.c.

631 {
632  int i;
633  ppc_map_t *PagePtr;
634 
635  for( i = 0; i < count; i++ )
636  {
637  if(!info[i].addr && !info[i].proc)
638  {
639  PagePtr = &((ppc_map_t*)PAGETAB)[info[i].phys];
640  info[i].proc = PagePtr->proc;
641  info[i].addr = PagePtr->addr;
642  info[i].flags = MMU_ALL_RW;
643  } else {
644  vaddr_t addr = info[i].addr;
645  int vsid = ((addr >> 28) & 15) | (info[i].proc << 4);
646  PagePtr = mmuvirtmap(info[i].addr);
647  if(!PagePtr)
648  info[i].phys = 0;
649  else
650  {
651  info[i].phys = PPC_PAGE_ADDR(PagePtr - PpcPageTable);
652  info[i].flags = MMU_ALL_RW; // HACK
653  }
654  }
655  }
656 }
#define PAGETAB
Definition: mmu.h:60
unsigned long proc
Definition: mmu.h:102
GLuint GLuint GLsizei count
Definition: gl.h:1545
ppc_map_t * mmuvirtmap(vaddr_t addr)
Definition: mmuobject.c:579
static HANDLE proc()
Definition: pdb.c:32
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned long vaddr_t
Definition: mmu.h:90
vaddr_t addr
Definition: mmu.h:103
#define PPC_PAGE_ADDR(x)
Definition: mmu.h:65
GLenum const GLvoid * addr
Definition: glext.h:9621
#define PpcPageTable
Definition: mmu.h:63
#define MMU_ALL_RW
Definition: mmu.h:78

Referenced by _mmumain().

◆ mmunitest()

int mmunitest ( void  )

Definition at line 5 of file mmutest.c.

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
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by _mmumain().

◆ mmusetramsize()

void mmusetramsize ( paddr_t  size)

Definition at line 285 of file mmuobject.c.

286 {
287  ppc_map_t *last_map = &PpcPageTable[PPC_PAGE_NUMBER(ramsize)];
288  if(!RamSize)
289  {
290  RamSize = ramsize;
291  FirstUsablePage = (paddr_t)last_map;
293  }
294 }
paddr_t RamSize
Definition: mmuobject.c:64
paddr_t NextPage
Definition: mmuobject.c:64
unsigned long paddr_t
Definition: mmu.h:89
#define PPC_PAGE_NUMBER(x)
Definition: mmu.h:66
paddr_t FirstUsablePage
Definition: mmuobject.c:64
#define PpcPageTable
Definition: mmu.h:63

Referenced by _mmumain().

◆ mmusetvsid()

void mmusetvsid ( int  start,
int  end,
int  vsid 
)

Definition at line 664 of file mmuobject.c.

665 {
666  int i, sr, s_vsid;
667  for(i = start; i < end; i++)
668  {
669  s_vsid = (vsid << 4) | (i & 15);
670  sr = (GetSR(i) & ~PPC_VSID_MASK) | s_vsid;
671  if (Booted)
672  SetSR(i, sr);
673  Segs[i] = findvsid(s_vsid);
674  Vsid[i] = vsid;
675  }
676 }
#define PPC_VSID_MASK
Definition: mmu.h:67
MmuVsidInfo * findvsid(int vsid)
Definition: mmuobject.c:460
int Vsid[16]
Definition: mmuobject.c:63
GLuint GLuint end
Definition: gl.h:1545
int GetSR(int n)
Definition: mmu.c:136
int Booted
Definition: mmuobject.c:63
MmuVsidInfo * Segs[16]
Definition: mmuobject.c:67
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void SetSR(int n, int val)
Definition: mmuutil.c:191
GLuint start
Definition: gl.h:1545

Referenced by _mmumain(), callkernel(), and mmunitest().