From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrktJ-0008E5-Td for qemu-devel@nongnu.org; Mon, 11 May 2015 06:24:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrktF-0004bU-QZ for qemu-devel@nongnu.org; Mon, 11 May 2015 06:24:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrktF-0004bN-Ii for qemu-devel@nongnu.org; Mon, 11 May 2015 06:24:49 -0400 Message-ID: <55508368.3010300@redhat.com> Date: Mon, 11 May 2015 12:24:40 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <6920fa40d097d15d0cfcaf63c26b6325ee5edc46.1431322749.git.crosthwaite.peter@gmail.com> <55508206.5040206@suse.de> In-Reply-To: <55508206.5040206@suse.de> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH 02/34] tcg+qom: QOMify core CPU defintions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= , Peter Crosthwaite , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, edgari@xilinx.com, sorenb@xilinx.com, rth@twiddle.net On 11/05/2015 12:18, Andreas F=E4rber 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 TranslationBloc= k *tb); >> > + void (*gen_intermediate_code_pc)(void *env, struct TranslationB= lock *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; >> > =20 >> > #ifdef HOST_WORDS_BIGENDIAN > [snip] >=20 > 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-*. Paolo