/[gxemul]/trunk/src/cpus/memory_mips_v2p.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/cpus/memory_mips_v2p.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 24 by dpavlin, Mon Oct 8 16:19:56 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: memory_mips_v2p.c,v 1.5 2006/06/16 18:31:26 debug Exp $   *  $Id: memory_mips_v2p.c,v 1.7 2006/07/16 13:32:26 debug Exp $
  *  
  *  Included from memory.c.  
29   */   */
30    
31    
32  /*  /*
33   *  translate_address():   *  translate_v2p():
34   *   *
35   *  Don't call this function is userland_emul is non-NULL, or cpu is NULL.   *  Don't call this function is userland_emul is non-NULL, or cpu is NULL.
36   *   *
# Line 44  Line 42 
42   *      2  Success, the page is read/write   *      2  Success, the page is read/write
43   */   */
44  int TRANSLATE_ADDRESS(struct cpu *cpu, uint64_t vaddr,  int TRANSLATE_ADDRESS(struct cpu *cpu, uint64_t vaddr,
45          uint64_t *return_addr, int flags)          uint64_t *return_paddr, int flags)
46  {  {
47          int writeflag = flags & FLAG_WRITEFLAG? MEM_WRITE : MEM_READ;          int writeflag = flags & FLAG_WRITEFLAG? MEM_WRITE : MEM_READ;
48          int no_exceptions = flags & FLAG_NOEXCEPTIONS;          int no_exceptions = flags & FLAG_NOEXCEPTIONS;
# Line 195  int TRANSLATE_ADDRESS(struct cpu *cpu, u Line 193  int TRANSLATE_ADDRESS(struct cpu *cpu, u
193                   *  On IP27 (and probably others), addresses such as                   *  On IP27 (and probably others), addresses such as
194                   *  0x92... and 0x96... have to do with NUMA stuff.                   *  0x92... and 0x96... have to do with NUMA stuff.
195                   */                   */
196                  *return_addr = vaddr & (((uint64_t)1 << 44) - 1);                  *return_paddr = vaddr & (((uint64_t)1 << 44) - 1);
197                  return 2;                  return 2;
198          }          }
199    
# Line 219  bugs are triggered.  */ Line 217  bugs are triggered.  */
217                          /*  kseg0, kseg1:  */                          /*  kseg0, kseg1:  */
218                          if (vaddr >= (uint64_t)0xffffffff80000000ULL &&                          if (vaddr >= (uint64_t)0xffffffff80000000ULL &&
219                              vaddr <= (uint64_t)0xffffffffbfffffffULL) {                              vaddr <= (uint64_t)0xffffffffbfffffffULL) {
220                                  *return_addr = vaddr & 0x1fffffff;                                  *return_paddr = vaddr & 0x1fffffff;
221                                  return 2;                                  return 2;
222                          }                          }
223    
# Line 335  bugs are triggered.  */ Line 333  bugs are triggered.  */
333                                  /*  debug("OK MAP 1, i=%i { vaddr=%016"PRIx64" "                                  /*  debug("OK MAP 1, i=%i { vaddr=%016"PRIx64" "
334                                      "==> paddr %016"PRIx64" v=%i d=%i "                                      "==> paddr %016"PRIx64" v=%i d=%i "
335                                      "asid=0x%02x }\n", i, (uint64_t) vaddr,                                      "asid=0x%02x }\n", i, (uint64_t) vaddr,
336                                      (uint64_t) *return_addr, v_bit?1:0,                                      (uint64_t) *return_paddr, v_bit?1:0,
337                                      d_bit?1:0, vaddr_asid);  */                                      d_bit?1:0, vaddr_asid);  */
338                                  if (v_bit) {                                  if (v_bit) {
339                                          if (d_bit || (!d_bit &&                                          if (d_bit || (!d_bit &&
# Line 347  bugs are triggered.  */ Line 345  bugs are triggered.  */
345                                                      PRIx64" ",                                                      PRIx64" ",
346                                                      writeflag, (uint64_t)vaddr,                                                      writeflag, (uint64_t)vaddr,
347                                                      d_bit?1:0, v_bit?1:0,                                                      d_bit?1:0, v_bit?1:0,
348                                                      (uint64_t) *return_addr);                                                      (uint64_t) *return_paddr);
349                                                      debug(", tlb entry %2i: ma"                                                      debug(", tlb entry %2i: ma"
350                                                      "sk=%016"PRIx64" hi=%016"                                                      "sk=%016"PRIx64" hi=%016"
351                                                      PRIx64" lo0=%016"PRIx64                                                      PRIx64" lo0=%016"PRIx64
# Line 369  bugs are triggered.  */ Line 367  bugs are triggered.  */
367                                                      (vaddr & pmask);                                                      (vaddr & pmask);
368  #endif  #endif
369    
370                                                  *return_addr = paddr;                                                  *return_paddr = paddr;
371                                                  return d_bit? 2 : 1;                                                  return d_bit? 2 : 1;
372                                          } else {                                          } else {
373                                                  /*  TLB modif. exception  */                                                  /*  TLB modif. exception  */

Legend:
Removed from v.24  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26