Revision 5fafdf24 dyngen.h

b/dyngen.h
1 1
/*
2 2
 * dyngen helpers
3
 * 
3
 *
4 4
 *  Copyright (c) 2003 Fabrice Bellard
5 5
 *
6 6
 * This library is free software; you can redistribute it and/or
......
51 51

  
52 52
    start &= ~(MIN_CACHE_LINE_SIZE - 1);
53 53
    stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1);
54
    
54
   
55 55
    for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) {
56 56
        asm volatile ("dcbst 0,%0" : : "r"(p) : "memory");
57 57
    }
......
148 148
}
149 149

  
150 150
static uint8_t *arm_flush_ldr(uint8_t *gen_code_ptr,
151
                              LDREntry *ldr_start, LDREntry *ldr_end, 
152
                              uint32_t *data_start, uint32_t *data_end, 
151
                              LDREntry *ldr_start, LDREntry *ldr_end,
152
                              uint32_t *data_start, uint32_t *data_end,
153 153
                              int gen_jmp)
154 154
{
155 155
    LDREntry *le;
......
158 158
    uint8_t *data_ptr;
159 159
    uint32_t insn;
160 160
    uint32_t mask;
161
 
161

  
162 162
    data_size = (data_end - data_start) << 2;
163 163

  
164 164
    if (gen_jmp) {
......
169 169
        arm_reloc_pc24((uint32_t *)gen_code_ptr, 0xeafffffe, target);
170 170
        gen_code_ptr += 4;
171 171
    }
172
   
172
  
173 173
    /* copy the data */
174 174
    data_ptr = gen_code_ptr;
175 175
    memcpy(gen_code_ptr, data_start, data_size);
176 176
    gen_code_ptr += data_size;
177
    
177
   
178 178
    /* patch the ldr to point to the data */
179 179
    for(le = ldr_start; le < ldr_end; le++) {
180 180
        ptr = (uint32_t *)le->ptr;
181
        offset = ((unsigned long)(le->data_ptr) - (unsigned long)data_start) + 
182
            (unsigned long)data_ptr - 
181
        offset = ((unsigned long)(le->data_ptr) - (unsigned long)data_start) +
182
            (unsigned long)data_ptr -
183 183
            (unsigned long)ptr - 8;
184 184
        if (offset < 0) {
185 185
            fprintf(stderr, "Negative constant pool offset\n");

Also available in: Unified diff