/[gxemul]/trunk/src/cpus/memory_arm.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_arm.c

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

revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC revision 26 by dpavlin, Mon Oct 8 16:20:10 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-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_arm.c,v 1.33 2006/01/25 05:51:12 debug Exp $   *  $Id: memory_arm.c,v 1.35 2006/06/24 21:47:23 debug Exp $
29   *   *
30   *   *
31   *  TODO/NOTE:  The B and/or C bits could also cause the return value to   *  TODO/NOTE:  The B and/or C bits could also cause the return value to
# Line 48  extern int quiet_mode; Line 48  extern int quiet_mode;
48    
49    
50  /*  /*
51   *  arm_translate_address():   *  arm_translate_v2p():
52   *   *
53   *  Address translation with the MMU disabled.   *  Address translation with the MMU disabled. (Just treat the virtual address
54     *  as a physical address.)
55   */   */
56  int arm_translate_address(struct cpu *cpu, uint64_t vaddr64,  int arm_translate_v2p(struct cpu *cpu, uint64_t vaddr64,
57          uint64_t *return_addr, int flags)          uint64_t *return_paddr, int flags)
58  {  {
59          *return_addr = vaddr64 & 0xffffffff;          *return_paddr = vaddr64 & 0xffffffff;
60    
61          return 2;          return 2;
62  }  }
63    
# Line 101  static int arm_check_access(struct cpu * Line 103  static int arm_check_access(struct cpu *
103    
104    
105  /*  /*
106   *  arm_translate_address_mmu():   *  arm_translate_v2p_mmu():
107   *   *
108   *  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.
109   *   *
# Line 113  static int arm_check_access(struct cpu * Line 115  static int arm_check_access(struct cpu *
115   *  If this is a 1KB page access, then the return value is ORed with   *  If this is a 1KB page access, then the return value is ORed with
116   *  MEMORY_NOT_FULL_PAGE.   *  MEMORY_NOT_FULL_PAGE.
117   */   */
118  int arm_translate_address_mmu(struct cpu *cpu, uint64_t vaddr64,  int arm_translate_v2p_mmu(struct cpu *cpu, uint64_t vaddr64,
119          uint64_t *return_addr, int flags)          uint64_t *return_paddr, int flags)
120  {  {
121          unsigned char *q;          unsigned char *q;
122          uint32_t addr, d=0, d2 = (uint32_t)(int32_t)-1, ptba, vaddr = vaddr64;          uint32_t addr, d=0, d2 = (uint32_t)(int32_t)-1, ptba, vaddr = vaddr64;
# Line 198  int arm_translate_address_mmu(struct cpu Line 200  int arm_translate_address_mmu(struct cpu
200                          case 0xc000:    ap >>= 6; break;                          case 0xc000:    ap >>= 6; break;
201                          }                          }
202                          ap &= 3;                          ap &= 3;
203                          *return_addr = (d2 & 0xffff0000) | (vaddr & 0x0000ffff);                          *return_paddr = (d2 & 0xffff0000)|(vaddr & 0x0000ffff);
204                          break;                          break;
205                  case 3: if (cpu->cd.arm.cpu_type.flags & ARM_XSCALE) {                  case 3: if (cpu->cd.arm.cpu_type.flags & ARM_XSCALE) {
206                                  /*  4KB page (Xscale)  */                                  /*  4KB page (Xscale)  */
# Line 207  int arm_translate_address_mmu(struct cpu Line 209  int arm_translate_address_mmu(struct cpu
209                                  /*  1KB page  */                                  /*  1KB page  */
210                                  subpage = 1;                                  subpage = 1;
211                                  ap = (d2 >> 4) & 3;                                  ap = (d2 >> 4) & 3;
212                                  *return_addr = (d2 & 0xfffffc00) |                                  *return_paddr = (d2 & 0xfffffc00) |
213                                      (vaddr & 0x000003ff);                                      (vaddr & 0x000003ff);
214                                  break;                                  break;
215                          }                          }
# Line 231  int arm_translate_address_mmu(struct cpu Line 233  int arm_translate_address_mmu(struct cpu
233                                  if (ap0 != ap1 || ap0 != ap2 || ap0 != ap3)                                  if (ap0 != ap1 || ap0 != ap2 || ap0 != ap3)
234                                          subpage = 1;                                          subpage = 1;
235                          }                          }
236                          *return_addr = (d2 & 0xfffff000) | (vaddr & 0x00000fff);                          *return_paddr = (d2 & 0xfffff000)|(vaddr & 0x00000fff);
237                          break;                          break;
238                  }                  }
239                  access = arm_check_access(cpu, ap, dav, user);                  access = arm_check_access(cpu, ap, dav, user);
# Line 245  int arm_translate_address_mmu(struct cpu Line 247  int arm_translate_address_mmu(struct cpu
247                          fs = FAULT_DOMAIN_S;                          fs = FAULT_DOMAIN_S;
248                          goto exception_return;                          goto exception_return;
249                  }                  }
250                  *return_addr = (d & 0xfff00000) | (vaddr & 0x000fffff);                  *return_paddr = (d & 0xfff00000) | (vaddr & 0x000fffff);
251                  ap = (d >> 10) & 3;                  ap = (d >> 10) & 3;
252                  access = arm_check_access(cpu, ap, dav, user);                  access = arm_check_access(cpu, ap, dav, user);
253                  if (access > writeflag)                  if (access > writeflag)

Legend:
Removed from v.22  
changed lines
  Added in v.26

  ViewVC Help
Powered by ViewVC 1.1.26