Revision b769d8fe softmmu_template.h

b/softmmu_template.h
39 39
#error unsupported data size
40 40
#endif
41 41

  
42
#ifdef SOFTMMU_CODE_ACCESS
43
#define READ_ACCESS_TYPE 2
44
#else
45
#define READ_ACCESS_TYPE 0
46
#endif
47

  
42 48
static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(unsigned long addr, 
43 49
                                                        int is_user,
44 50
                                                        void *retaddr);
45
static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(unsigned long addr, 
46
                                                   DATA_TYPE val, 
47
                                                   int is_user,
48
                                                   void *retaddr);
49

  
50 51
static inline DATA_TYPE glue(io_read, SUFFIX)(unsigned long physaddr, 
51 52
                                              unsigned long tlb_addr)
52 53
{
......
68 69
    return res;
69 70
}
70 71

  
71
static inline void glue(io_write, SUFFIX)(unsigned long physaddr, 
72
                                          DATA_TYPE val,
73
                                          unsigned long tlb_addr,
74
                                          void *retaddr)
75
{
76
    int index;
77

  
78
    index = (tlb_addr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
79
    env->mem_write_vaddr = tlb_addr;
80
    env->mem_write_pc = (unsigned long)retaddr;
81
#if SHIFT <= 2
82
    io_mem_write[index][SHIFT](io_mem_opaque[index], physaddr, val);
83
#else
84
#ifdef TARGET_WORDS_BIGENDIAN
85
    io_mem_write[index][2](io_mem_opaque[index], physaddr, val >> 32);
86
    io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val);
87
#else
88
    io_mem_write[index][2](io_mem_opaque[index], physaddr, val);
89
    io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val >> 32);
90
#endif
91
#endif /* SHIFT > 2 */
92
}
93

  
94 72
/* handle all cases except unaligned access which span two pages */
95 73
DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(unsigned long addr,
96 74
                                                         int is_user)
......
125 103
    } else {
126 104
        /* the page is not in the TLB : fill it */
127 105
        retaddr = GETPC();
128
        tlb_fill(addr, 0, is_user, retaddr);
106
        tlb_fill(addr, READ_ACCESS_TYPE, is_user, retaddr);
129 107
        goto redo;
130 108
    }
131 109
    return res;
......
172 150
        }
173 151
    } else {
174 152
        /* the page is not in the TLB : fill it */
175
        tlb_fill(addr, 0, is_user, retaddr);
153
        tlb_fill(addr, READ_ACCESS_TYPE, is_user, retaddr);
176 154
        goto redo;
177 155
    }
178 156
    return res;
179 157
}
180 158

  
159
#ifndef SOFTMMU_CODE_ACCESS
160

  
161
static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(unsigned long addr, 
162
                                                   DATA_TYPE val, 
163
                                                   int is_user,
164
                                                   void *retaddr);
165

  
166
static inline void glue(io_write, SUFFIX)(unsigned long physaddr, 
167
                                          DATA_TYPE val,
168
                                          unsigned long tlb_addr,
169
                                          void *retaddr)
170
{
171
    int index;
172

  
173
    index = (tlb_addr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
174
    env->mem_write_vaddr = tlb_addr;
175
    env->mem_write_pc = (unsigned long)retaddr;
176
#if SHIFT <= 2
177
    io_mem_write[index][SHIFT](io_mem_opaque[index], physaddr, val);
178
#else
179
#ifdef TARGET_WORDS_BIGENDIAN
180
    io_mem_write[index][2](io_mem_opaque[index], physaddr, val >> 32);
181
    io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val);
182
#else
183
    io_mem_write[index][2](io_mem_opaque[index], physaddr, val);
184
    io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val >> 32);
185
#endif
186
#endif /* SHIFT > 2 */
187
}
181 188

  
182 189
void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(unsigned long addr, 
183 190
                                                    DATA_TYPE val,
......
257 264
    }
258 265
}
259 266

  
267
#endif /* !defined(SOFTMMU_CODE_ACCESS) */
268

  
269
#undef READ_ACCESS_TYPE
260 270
#undef SHIFT
261 271
#undef DATA_TYPE
262 272
#undef SUFFIX

Also available in: Unified diff