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

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

revision 19 by dpavlin, Mon Oct 8 16:19:11 2007 UTC revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: cpu_arm_instr_loadstore.c,v 1.15 2005/10/27 14:01:13 debug Exp $   *  $Id: cpu_arm_instr_loadstore.c,v 1.19 2005/11/19 18:53:07 debug Exp $
29   *   *
30   *   *
31   *  TODO:  Many things...   *  TODO:  Many things...
# Line 110  void A__NAME__general(struct cpu *cpu, s Line 110  void A__NAME__general(struct cpu *cpu, s
110    
111          low_pc = ((size_t)ic - (size_t)cpu->cd.arm.          low_pc = ((size_t)ic - (size_t)cpu->cd.arm.
112              cur_ic_page) / sizeof(struct arm_instr_call);              cur_ic_page) / sizeof(struct arm_instr_call);
113          cpu->cd.arm.r[ARM_PC] &= ~((ARM_IC_ENTRIES_PER_PAGE-1)          cpu->pc &= ~((ARM_IC_ENTRIES_PER_PAGE-1)
114              << ARM_INSTR_ALIGNMENT_SHIFT);              << ARM_INSTR_ALIGNMENT_SHIFT);
115          cpu->cd.arm.r[ARM_PC] += (low_pc << ARM_INSTR_ALIGNMENT_SHIFT);          cpu->pc += (low_pc << ARM_INSTR_ALIGNMENT_SHIFT);
         cpu->pc = cpu->cd.arm.r[ARM_PC];  
116    
117          addr = reg(ic->arg[0])          addr = reg(ic->arg[0])
118  #ifdef A__P  #ifdef A__P
# Line 233  void A__NAME(struct cpu *cpu, struct arm Line 232  void A__NAME(struct cpu *cpu, struct arm
232           *  is_userpage array. If it is set, then we're ok. Otherwise: use the           *  is_userpage array. If it is set, then we're ok. Otherwise: use the
233           *  generic function.           *  generic function.
234           */           */
235          unsigned char x = cpu->cd.arm.is_userpage[addr >> 15];          uint32_t x = cpu->cd.arm.is_userpage[addr >> 17];
236          if (!(x & (1 << ((addr >> 12) & 7))))          if (!(x & (1 << ((addr >> 12) & 31))))
237                  A__NAME__general(cpu, ic);                  A__NAME__general(cpu, ic);
238          else          else
239  #endif  #endif
# Line 327  void A__NAME_PC(struct cpu *cpu, struct Line 326  void A__NAME_PC(struct cpu *cpu, struct
326                  uint32_t low_pc, tmp;                  uint32_t low_pc, tmp;
327                  low_pc = ((size_t)ic - (size_t) cpu->cd.arm.cur_ic_page) /                  low_pc = ((size_t)ic - (size_t) cpu->cd.arm.cur_ic_page) /
328                      sizeof(struct arm_instr_call);                      sizeof(struct arm_instr_call);
329                  tmp = cpu->cd.arm.r[ARM_PC] & ~((ARM_IC_ENTRIES_PER_PAGE-1) <<                  tmp = cpu->pc & ~((ARM_IC_ENTRIES_PER_PAGE-1) <<
330                      ARM_INSTR_ALIGNMENT_SHIFT);                      ARM_INSTR_ALIGNMENT_SHIFT);
331                  tmp += (low_pc << ARM_INSTR_ALIGNMENT_SHIFT);                  tmp += (low_pc << ARM_INSTR_ALIGNMENT_SHIFT);
332                  cpu->cd.arm.tmp_pc = tmp + 8;                  cpu->cd.arm.tmp_pc = tmp + 8;
# Line 335  void A__NAME_PC(struct cpu *cpu, struct Line 334  void A__NAME_PC(struct cpu *cpu, struct
334          A__NAME(cpu, ic);          A__NAME(cpu, ic);
335          if (ic->arg[2] == (size_t)(&cpu->cd.arm.r[ARM_PC])) {          if (ic->arg[2] == (size_t)(&cpu->cd.arm.r[ARM_PC])) {
336                  cpu->pc = cpu->cd.arm.r[ARM_PC];                  cpu->pc = cpu->cd.arm.r[ARM_PC];
337                    quick_pc_to_pointers(cpu);
338                  if (cpu->machine->show_trace_tree)                  if (cpu->machine->show_trace_tree)
339                          cpu_functioncall_trace(cpu, cpu->pc);                          cpu_functioncall_trace(cpu, cpu->pc);
                 quick_pc_to_pointers(cpu);  
340          }          }
341  #else  #else
342          /*  Store:  */          /*  Store:  */
# Line 345  void A__NAME_PC(struct cpu *cpu, struct Line 344  void A__NAME_PC(struct cpu *cpu, struct
344          /*  Calculate tmp from this instruction's PC + 12  */          /*  Calculate tmp from this instruction's PC + 12  */
345          low_pc = ((size_t)ic - (size_t) cpu->cd.arm.cur_ic_page) /          low_pc = ((size_t)ic - (size_t) cpu->cd.arm.cur_ic_page) /
346              sizeof(struct arm_instr_call);              sizeof(struct arm_instr_call);
347          tmp = cpu->cd.arm.r[ARM_PC] & ~((ARM_IC_ENTRIES_PER_PAGE-1) <<          tmp = cpu->pc & ~((ARM_IC_ENTRIES_PER_PAGE-1) <<
348              ARM_INSTR_ALIGNMENT_SHIFT);              ARM_INSTR_ALIGNMENT_SHIFT);
349          tmp += (low_pc << ARM_INSTR_ALIGNMENT_SHIFT);          tmp += (low_pc << ARM_INSTR_ALIGNMENT_SHIFT);
350          cpu->cd.arm.tmp_pc = tmp + 12;          cpu->cd.arm.tmp_pc = tmp + 12;
# Line 357  void A__NAME_PC(struct cpu *cpu, struct Line 356  void A__NAME_PC(struct cpu *cpu, struct
356  #ifndef A__NOCONDITIONS  #ifndef A__NOCONDITIONS
357  /*  Load/stores with all registers except the PC register:  */  /*  Load/stores with all registers except the PC register:  */
358  void A__NAME__eq(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__eq(struct cpu *cpu, struct arm_instr_call *ic)
359  { if (cpu->cd.arm.cpsr & ARM_FLAG_Z) A__NAME(cpu, ic); }  { if (cpu->cd.arm.flags & ARM_F_Z) A__NAME(cpu, ic); }
360  void A__NAME__ne(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__ne(struct cpu *cpu, struct arm_instr_call *ic)
361  { if (!(cpu->cd.arm.cpsr & ARM_FLAG_Z)) A__NAME(cpu, ic); }  { if (!(cpu->cd.arm.flags & ARM_F_Z)) A__NAME(cpu, ic); }
362  void A__NAME__cs(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__cs(struct cpu *cpu, struct arm_instr_call *ic)
363  { if (cpu->cd.arm.cpsr & ARM_FLAG_C) A__NAME(cpu, ic); }  { if (cpu->cd.arm.flags & ARM_F_C) A__NAME(cpu, ic); }
364  void A__NAME__cc(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__cc(struct cpu *cpu, struct arm_instr_call *ic)
365  { if (!(cpu->cd.arm.cpsr & ARM_FLAG_C)) A__NAME(cpu, ic); }  { if (!(cpu->cd.arm.flags & ARM_F_C)) A__NAME(cpu, ic); }
366  void A__NAME__mi(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__mi(struct cpu *cpu, struct arm_instr_call *ic)
367  { if (cpu->cd.arm.cpsr & ARM_FLAG_N) A__NAME(cpu, ic); }  { if (cpu->cd.arm.flags & ARM_F_N) A__NAME(cpu, ic); }
368  void A__NAME__pl(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__pl(struct cpu *cpu, struct arm_instr_call *ic)
369  { if (!(cpu->cd.arm.cpsr & ARM_FLAG_N)) A__NAME(cpu, ic); }  { if (!(cpu->cd.arm.flags & ARM_F_N)) A__NAME(cpu, ic); }
370  void A__NAME__vs(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__vs(struct cpu *cpu, struct arm_instr_call *ic)
371  { if (cpu->cd.arm.cpsr & ARM_FLAG_V) A__NAME(cpu, ic); }  { if (cpu->cd.arm.flags & ARM_F_V) A__NAME(cpu, ic); }
372  void A__NAME__vc(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__vc(struct cpu *cpu, struct arm_instr_call *ic)
373  { if (!(cpu->cd.arm.cpsr & ARM_FLAG_V)) A__NAME(cpu, ic); }  { if (!(cpu->cd.arm.flags & ARM_F_V)) A__NAME(cpu, ic); }
374    
375  void A__NAME__hi(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__hi(struct cpu *cpu, struct arm_instr_call *ic)
376  { if (cpu->cd.arm.cpsr & ARM_FLAG_C &&  { if (cpu->cd.arm.flags & ARM_F_C &&
377  !(cpu->cd.arm.cpsr & ARM_FLAG_Z)) A__NAME(cpu, ic); }  !(cpu->cd.arm.flags & ARM_F_Z)) A__NAME(cpu, ic); }
378  void A__NAME__ls(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__ls(struct cpu *cpu, struct arm_instr_call *ic)
379  { if (cpu->cd.arm.cpsr & ARM_FLAG_Z ||  { if (cpu->cd.arm.flags & ARM_F_Z ||
380  !(cpu->cd.arm.cpsr & ARM_FLAG_C)) A__NAME(cpu, ic); }  !(cpu->cd.arm.flags & ARM_F_C)) A__NAME(cpu, ic); }
381  void A__NAME__ge(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__ge(struct cpu *cpu, struct arm_instr_call *ic)
382  { if (((cpu->cd.arm.cpsr & ARM_FLAG_N)?1:0) ==  { if (((cpu->cd.arm.flags & ARM_F_N)?1:0) ==
383  ((cpu->cd.arm.cpsr & ARM_FLAG_V)?1:0)) A__NAME(cpu, ic); }  ((cpu->cd.arm.flags & ARM_F_V)?1:0)) A__NAME(cpu, ic); }
384  void A__NAME__lt(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__lt(struct cpu *cpu, struct arm_instr_call *ic)
385  { if (((cpu->cd.arm.cpsr & ARM_FLAG_N)?1:0) !=  { if (((cpu->cd.arm.flags & ARM_F_N)?1:0) !=
386  ((cpu->cd.arm.cpsr & ARM_FLAG_V)?1:0)) A__NAME(cpu, ic); }  ((cpu->cd.arm.flags & ARM_F_V)?1:0)) A__NAME(cpu, ic); }
387  void A__NAME__gt(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__gt(struct cpu *cpu, struct arm_instr_call *ic)
388  { if (((cpu->cd.arm.cpsr & ARM_FLAG_N)?1:0) ==  { if (((cpu->cd.arm.flags & ARM_F_N)?1:0) ==
389  ((cpu->cd.arm.cpsr & ARM_FLAG_V)?1:0) &&  ((cpu->cd.arm.flags & ARM_F_V)?1:0) &&
390  !(cpu->cd.arm.cpsr & ARM_FLAG_Z)) A__NAME(cpu, ic); }  !(cpu->cd.arm.flags & ARM_F_Z)) A__NAME(cpu, ic); }
391  void A__NAME__le(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME__le(struct cpu *cpu, struct arm_instr_call *ic)
392  { if (((cpu->cd.arm.cpsr & ARM_FLAG_N)?1:0) !=  { if (((cpu->cd.arm.flags & ARM_F_N)?1:0) !=
393  ((cpu->cd.arm.cpsr & ARM_FLAG_V)?1:0) ||  ((cpu->cd.arm.flags & ARM_F_V)?1:0) ||
394  (cpu->cd.arm.cpsr & ARM_FLAG_Z)) A__NAME(cpu, ic); }  (cpu->cd.arm.flags & ARM_F_Z)) A__NAME(cpu, ic); }
395    
396    
397  /*  Load/stores with the PC register:  */  /*  Load/stores with the PC register:  */
398  void A__NAME_PC__eq(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__eq(struct cpu *cpu, struct arm_instr_call *ic)
399  { if (cpu->cd.arm.cpsr & ARM_FLAG_Z) A__NAME_PC(cpu, ic); }  { if (cpu->cd.arm.flags & ARM_F_Z) A__NAME_PC(cpu, ic); }
400  void A__NAME_PC__ne(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__ne(struct cpu *cpu, struct arm_instr_call *ic)
401  { if (!(cpu->cd.arm.cpsr & ARM_FLAG_Z)) A__NAME_PC(cpu, ic); }  { if (!(cpu->cd.arm.flags & ARM_F_Z)) A__NAME_PC(cpu, ic); }
402  void A__NAME_PC__cs(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__cs(struct cpu *cpu, struct arm_instr_call *ic)
403  { if (cpu->cd.arm.cpsr & ARM_FLAG_C) A__NAME_PC(cpu, ic); }  { if (cpu->cd.arm.flags & ARM_F_C) A__NAME_PC(cpu, ic); }
404  void A__NAME_PC__cc(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__cc(struct cpu *cpu, struct arm_instr_call *ic)
405  { if (!(cpu->cd.arm.cpsr & ARM_FLAG_C)) A__NAME_PC(cpu, ic); }  { if (!(cpu->cd.arm.flags & ARM_F_C)) A__NAME_PC(cpu, ic); }
406  void A__NAME_PC__mi(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__mi(struct cpu *cpu, struct arm_instr_call *ic)
407  { if (cpu->cd.arm.cpsr & ARM_FLAG_N) A__NAME_PC(cpu, ic); }  { if (cpu->cd.arm.flags & ARM_F_N) A__NAME_PC(cpu, ic); }
408  void A__NAME_PC__pl(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__pl(struct cpu *cpu, struct arm_instr_call *ic)
409  { if (!(cpu->cd.arm.cpsr & ARM_FLAG_N)) A__NAME_PC(cpu, ic); }  { if (!(cpu->cd.arm.flags & ARM_F_N)) A__NAME_PC(cpu, ic); }
410  void A__NAME_PC__vs(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__vs(struct cpu *cpu, struct arm_instr_call *ic)
411  { if (cpu->cd.arm.cpsr & ARM_FLAG_V) A__NAME_PC(cpu, ic); }  { if (cpu->cd.arm.flags & ARM_F_V) A__NAME_PC(cpu, ic); }
412  void A__NAME_PC__vc(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__vc(struct cpu *cpu, struct arm_instr_call *ic)
413  { if (!(cpu->cd.arm.cpsr & ARM_FLAG_V)) A__NAME_PC(cpu, ic); }  { if (!(cpu->cd.arm.flags & ARM_F_V)) A__NAME_PC(cpu, ic); }
414    
415  void A__NAME_PC__hi(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__hi(struct cpu *cpu, struct arm_instr_call *ic)
416  { if (cpu->cd.arm.cpsr & ARM_FLAG_C &&  { if (cpu->cd.arm.flags & ARM_F_C &&
417  !(cpu->cd.arm.cpsr & ARM_FLAG_Z)) A__NAME_PC(cpu, ic); }  !(cpu->cd.arm.flags & ARM_F_Z)) A__NAME_PC(cpu, ic); }
418  void A__NAME_PC__ls(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__ls(struct cpu *cpu, struct arm_instr_call *ic)
419  { if (cpu->cd.arm.cpsr & ARM_FLAG_Z ||  { if (cpu->cd.arm.flags & ARM_F_Z ||
420  !(cpu->cd.arm.cpsr & ARM_FLAG_C)) A__NAME_PC(cpu, ic); }  !(cpu->cd.arm.flags & ARM_F_C)) A__NAME_PC(cpu, ic); }
421  void A__NAME_PC__ge(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__ge(struct cpu *cpu, struct arm_instr_call *ic)
422  { if (((cpu->cd.arm.cpsr & ARM_FLAG_N)?1:0) ==  { if (((cpu->cd.arm.flags & ARM_F_N)?1:0) ==
423  ((cpu->cd.arm.cpsr & ARM_FLAG_V)?1:0)) A__NAME_PC(cpu, ic); }  ((cpu->cd.arm.flags & ARM_F_V)?1:0)) A__NAME_PC(cpu, ic); }
424  void A__NAME_PC__lt(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__lt(struct cpu *cpu, struct arm_instr_call *ic)
425  { if (((cpu->cd.arm.cpsr & ARM_FLAG_N)?1:0) !=  { if (((cpu->cd.arm.flags & ARM_F_N)?1:0) !=
426  ((cpu->cd.arm.cpsr & ARM_FLAG_V)?1:0)) A__NAME_PC(cpu, ic); }  ((cpu->cd.arm.flags & ARM_F_V)?1:0)) A__NAME_PC(cpu, ic); }
427  void A__NAME_PC__gt(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__gt(struct cpu *cpu, struct arm_instr_call *ic)
428  { if (((cpu->cd.arm.cpsr & ARM_FLAG_N)?1:0) ==  { if (((cpu->cd.arm.flags & ARM_F_N)?1:0) ==
429  ((cpu->cd.arm.cpsr & ARM_FLAG_V)?1:0) &&  ((cpu->cd.arm.flags & ARM_F_V)?1:0) &&
430  !(cpu->cd.arm.cpsr & ARM_FLAG_Z)) A__NAME_PC(cpu, ic); }  !(cpu->cd.arm.flags & ARM_F_Z)) A__NAME_PC(cpu, ic); }
431  void A__NAME_PC__le(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME_PC__le(struct cpu *cpu, struct arm_instr_call *ic)
432  { if (((cpu->cd.arm.cpsr & ARM_FLAG_N)?1:0) !=  { if (((cpu->cd.arm.flags & ARM_F_N)?1:0) !=
433  ((cpu->cd.arm.cpsr & ARM_FLAG_V)?1:0) ||  ((cpu->cd.arm.flags & ARM_F_V)?1:0) ||
434  (cpu->cd.arm.cpsr & ARM_FLAG_Z)) A__NAME_PC(cpu, ic); }  (cpu->cd.arm.flags & ARM_F_Z)) A__NAME_PC(cpu, ic); }
435  #endif  #endif
436    
437    

Legend:
Removed from v.19  
changed lines
  Added in v.20

  ViewVC Help
Powered by ViewVC 1.1.26