/[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 18 by dpavlin, Mon Oct 8 16:19:11 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: memory_arm.c,v 1.27 2005/10/23 14:24:13 debug Exp $   *  $Id: memory_arm.c,v 1.33 2006/01/25 05:51:12 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 37  Line 37 
37  #include <stdlib.h>  #include <stdlib.h>
38  #include <string.h>  #include <string.h>
39    
40    #include "arm_cpu_types.h"
41  #include "cpu.h"  #include "cpu.h"
42  #include "memory.h"  #include "memory.h"
43  #include "misc.h"  #include "misc.h"
# Line 199  int arm_translate_address_mmu(struct cpu Line 200  int arm_translate_address_mmu(struct cpu
200                          ap &= 3;                          ap &= 3;
201                          *return_addr = (d2 & 0xffff0000) | (vaddr & 0x0000ffff);                          *return_addr = (d2 & 0xffff0000) | (vaddr & 0x0000ffff);
202                          break;                          break;
203                    case 3: if (cpu->cd.arm.cpu_type.flags & ARM_XSCALE) {
204                                    /*  4KB page (Xscale)  */
205                                    subpage = 0;
206                            } else {
207                                    /*  1KB page  */
208                                    subpage = 1;
209                                    ap = (d2 >> 4) & 3;
210                                    *return_addr = (d2 & 0xfffffc00) |
211                                        (vaddr & 0x000003ff);
212                                    break;
213                            }
214                            /*  NOTE: Fall-through for XScale!  */
215                  case 2: /*  4KB page:  */                  case 2: /*  4KB page:  */
216                          ap3 = (d2 >> 10) & 3;                          ap3 = (d2 >> 10) & 3;
217                          ap2 = (d2 >>  8) & 3;                          ap2 = (d2 >>  8) & 3;
# Line 210  int arm_translate_address_mmu(struct cpu Line 223  int arm_translate_address_mmu(struct cpu
223                          case 0x800: ap = ap2; break;                          case 0x800: ap = ap2; break;
224                          default:    ap = ap3;                          default:    ap = ap3;
225                          }                          }
226                          if (ap0 != ap1 || ap0 != ap2 || ap0 != ap3)                          /*  NOTE: Ugly hack for XScale:  */
227                                  subpage = 1;                          if ((d2 & 3) == 3) {
228                                    /*  Treated as 4KB page:  */
229                                    ap = ap0;
230                            } else {
231                                    if (ap0 != ap1 || ap0 != ap2 || ap0 != ap3)
232                                            subpage = 1;
233                            }
234                          *return_addr = (d2 & 0xfffff000) | (vaddr & 0x00000fff);                          *return_addr = (d2 & 0xfffff000) | (vaddr & 0x00000fff);
235                          break;                          break;
                 case 3: /*  1KB page:  */  
                         subpage = 1;  
                         ap = (d2 >> 4) & 3;  
                         *return_addr = (d2 & 0xfffffc00) | (vaddr & 0x000003ff);  
                         break;  
236                  }                  }
237                  access = arm_check_access(cpu, ap, dav, user);                  access = arm_check_access(cpu, ap, dav, user);
238                  if (access > writeflag)                  if (access > writeflag)
# Line 252  exception_return: Line 266  exception_return:
266                  fatal("{ arm memory fault: vaddr=0x%08x domain=%i dav=%i ap=%i "                  fatal("{ arm memory fault: vaddr=0x%08x domain=%i dav=%i ap=%i "
267                      "access=%i user=%i", (int)vaddr, domain, dav, ap,                      "access=%i user=%i", (int)vaddr, domain, dav, ap,
268                      access, user);                      access, user);
269                  fatal(" d=0x%08x d2=0x%08x }\n", d, d2);                  fatal(" d=0x%08x d2=0x%08x pc=0x%08x }\n", d, d2, (int)cpu->pc);
270          }          }
271    
272          if (instr)          if (instr)

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

  ViewVC Help
Powered by ViewVC 1.1.26