Am 11.05.2015 um 12:24 schrieb Paolo Bonzini: > On 11/05/2015 12:18, Andreas Färber wrote: >>>> + int (*cpu_mmu_index)(CPUState *cpu); >>>> + void (*cpu_get_tb_cpu_state)(CPUState *cpu, >>>> + void *pc, /* target_long * */ >>>> + void *cs_base, /* target_long */ >>>> + int *flags); >>>> + void (*gen_intermediate_code)(void *env, struct TranslationBlock *tb); >>>> + void (*gen_intermediate_code_pc)(void *env, struct TranslationBlock >>>> *tb); >>>> + void (*restore_state_to_opc)(void *env, struct TranslationBlock *tb, >>>> + int pc_pos); >>>> + void (*tlb_fill)(CPUState *cs, uint64_t addr, int is_write, int >>>> mmu_idx, >>>> + uintptr_t retaddr); >>>> } CPUClass; >>>> >>>> #ifdef HOST_WORDS_BIGENDIAN >> [snip] >> >> Paolo had objected to this when I tried it. The counter-suggestion was >> something about reworking how the cputlb code is built per target - >> please check the archives. > > Right. My point was that these functions are not polymorphic. Each > call to these should know exactly which function to call. > > cputlb.c, cpu-exec.c and parts of translate-all.c should be the moral > equivalent of C++ templates. I wouldn't mind switching to C++, but if > we want to make them polymorphic we should do it at compile time through > multiple compilation and/or inclusion from target-*.
I think we got more concrete than that, possibly on IRC only? I believe #include'ing cputlb.c from some target-* file was one of your proposed solutions? And splitting some of the inline functions that I was getting rid of into some new (or existing?) file? Andreas -- SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton; HRB 21284 (AG Nürnberg)