Revision f54b3f92 tcg/tcg-dyngen.c

b/tcg/tcg-dyngen.c
465 465
#endif
466 466

  
467 467
#ifndef CONFIG_NO_DYNGEN_OP
468

  
469
#if defined __hppa__
470
struct hppa_branch_stub {
471
    uint32_t *location;
472
    long target;
473
    struct hppa_branch_stub *next;
474
};
475

  
476
#define HPPA_RECORD_BRANCH(LIST, LOC, TARGET) \
477
do { \
478
    struct hppa_branch_stub *stub = alloca(sizeof(struct hppa_branch_stub)); \
479
    stub->location = LOC; \
480
    stub->target = TARGET; \
481
    stub->next = LIST; \
482
    LIST = stub; \
483
} while (0)
484

  
485
static inline void hppa_process_stubs(struct hppa_branch_stub *stub,
486
                                      uint8_t **gen_code_pp)
487
{
488
    uint32_t *s = (uint32_t *)*gen_code_pp;
489
    uint32_t *p = s + 1;
490

  
491
    if (!stub) return;
492

  
493
    for (; stub != NULL; stub = stub->next) {
494
        unsigned long l = (unsigned long)p;
495
        /* stub:
496
         * ldil L'target, %r1
497
         * be,n R'target(%sr4,%r1)
498
         */
499
        *p++ = 0x20200000 | reassemble_21(lrsel(stub->target, 0));
500
        *p++ = 0xe0202002 | (reassemble_17(rrsel(stub->target, 0) >> 2));
501
        hppa_patch17f(stub->location, l, 0);
502
    }
503
    /* b,l,n stub,%r0 */
504
    *s = 0xe8000002 | reassemble_17((p - s) - 2);
505
    *gen_code_pp = (uint8_t *)p;
506
}
507
#endif /* __hppa__ */
508

  
468 509
const TCGArg *dyngen_op(TCGContext *s, int opc, const TCGArg *opparam_ptr)
469 510
{
470 511
    uint8_t *gen_code_ptr;
471 512

  
513
#ifdef __hppa__
514
    struct hppa_branch_stub *hppa_stubs = NULL;
515
#endif
516

  
472 517
    gen_code_ptr = s->code_ptr;
473 518
    switch(opc) {
474 519

  
......
478 523
    default:
479 524
        tcg_abort();
480 525
    }
526

  
527
#ifdef __hppa__
528
    hppa_process_stubs(hppa_stubs, &gen_code_ptr);
529
#endif
530

  
481 531
    s->code_ptr = gen_code_ptr;
482 532
    return opparam_ptr;
483 533
}

Also available in: Unified diff