/[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 21 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 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: cpu_arm_instr_loadstore.c,v 1.19 2005/11/19 18:53:07 debug Exp $   *  $Id: cpu_arm_instr_loadstore.c,v 1.20 2006/02/16 19:49:04 debug Exp $
29   *   *
30   *   *
31   *  TODO:  Many things...   *  TODO:  Many things...
# Line 53  Line 53 
53   */   */
54    
55    
56    #if defined(A__SIGNED) && !defined(A__H) && !defined(A__L)
57    #define A__LDRD
58    #endif
59  #if defined(A__SIGNED) && defined(A__H) && !defined(A__L)  #if defined(A__SIGNED) && defined(A__H) && !defined(A__L)
60  #define A__STRD  #define A__STRD
61  #endif  #endif
# Line 76  void A__NAME__general(struct cpu *cpu, s Line 79  void A__NAME__general(struct cpu *cpu, s
79              = (void *)(size_t)ic->arg[1];              = (void *)(size_t)ic->arg[1];
80  #endif  #endif
81    
82  #ifdef A__STRD  #if defined(A__STRD) || defined(A__LDRD)
83          unsigned char data[8];          unsigned char data[8];
84          const int datalen = 8;          const int datalen = 8;
85  #else  #else
# Line 120  void A__NAME__general(struct cpu *cpu, s Line 123  void A__NAME__general(struct cpu *cpu, s
123  #endif  #endif
124              ;              ;
125    
126  #ifdef A__L  
127    #if defined(A__L) || defined(A__LDRD)
128          /*  Load:  */          /*  Load:  */
129          if (!cpu->memory_rw(cpu, cpu->mem, addr, data, datalen,          if (!cpu->memory_rw(cpu, cpu->mem, addr, data, datalen,
130              MEM_READ, memory_rw_flags)) {              MEM_READ, memory_rw_flags)) {
131                  /*  load failed, an exception was generated  */                  /*  load failed, an exception was generated  */
132                  return;                  return;
133          }          }
134  #ifdef A__B  #if defined(A__B) && !defined(A__LDRD)
135          reg(ic->arg[2]) =          reg(ic->arg[2]) =
136  #ifdef A__SIGNED  #ifdef A__SIGNED
137              (int32_t)(int8_t)              (int32_t)(int8_t)
138  #endif  #endif
139              data[0];              data[0];
140  #else  #else
141  #ifdef A__H  #if defined(A__H) && !defined(A__LDRD)
142          reg(ic->arg[2]) =          reg(ic->arg[2]) =
143  #ifdef A__SIGNED  #ifdef A__SIGNED
144              (int32_t)(int16_t)              (int32_t)(int16_t)
145  #endif  #endif
146              (data[0] + (data[1] << 8));              (data[0] + (data[1] << 8));
147  #else  #else
148    #ifndef A__LDRD
149  #ifdef HOST_LITTLE_ENDIAN  #ifdef HOST_LITTLE_ENDIAN
150          /*  Nothing.  */          /*  Nothing.  */
151  #else  #else
152          reg(ic->arg[2]) = data[0] + (data[1] << 8) +          reg(ic->arg[2]) = data[0] + (data[1] << 8) +
153              (data[2] << 16) + (data[3] << 24);              (data[2] << 16) + (data[3] << 24);
154  #endif  #endif
155    #else
156            reg(ic->arg[2]) = data[0] + (data[1] << 8) +
157                (data[2] << 16) + (data[3] << 24);
158            reg(((uint32_t *)ic->arg[2]) + 1) = data[4] + (data[5] << 8) +
159                (data[6] << 16) + (data[7] << 24);
160    #endif
161  #endif  #endif
162  #endif  #endif
163  #else  #else
# Line 195  void A__NAME__general(struct cpu *cpu, s Line 206  void A__NAME__general(struct cpu *cpu, s
206   */   */
207  void A__NAME(struct cpu *cpu, struct arm_instr_call *ic)  void A__NAME(struct cpu *cpu, struct arm_instr_call *ic)
208  {  {
209  #ifdef A__STRD  #if defined(A__LDRD) || defined(A__STRD)
210          /*  Chicken out, let's do this unoptimized for now:  */          /*  Chicken out, let's do this unoptimized for now:  */
211          A__NAME__general(cpu, ic);          A__NAME__general(cpu, ic);
212  #else  #else
# Line 435  void A__NAME_PC__le(struct cpu *cpu, str Line 446  void A__NAME_PC__le(struct cpu *cpu, str
446  #endif  #endif
447    
448    
449    #ifdef A__LDRD
450    #undef A__LDRD
451    #endif
452    
453  #ifdef A__STRD  #ifdef A__STRD
454  #undef A__STRD  #undef A__STRD
455  #endif  #endif
456    

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

  ViewVC Help
Powered by ViewVC 1.1.26