From: Wayne Xia <xiawenc@linux.vnet.ibm.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 12/12] Remove temp_buf, rename CPU_TEMP_BUF_NLONGS
Date: Mon, 27 Jun 2011 14:39:35 +0800 [thread overview]
Message-ID: <4E0825A7.2040703@linux.vnet.ibm.com> (raw)
In-Reply-To: <BANLkTimWbwkW8zsGLE3WBwKiKk7cjte3qg@mail.gmail.com>
Hi, it seems the patched TCG have some problem, I got a segment
fault.
Running condition:
qemu-system-x86_64 -L /home/xiawenc/WorkDir/Source/bios/pc-bios/
when I invoke it with --kvm-enabled, no segment fault.
qemu version:
commit f44c99607a46484c52f03aed373e3a3a194af721
Author: Blue Swirl <blauwirbel@gmail.com>
Date: Sat May 14 17:06:56 2011 +0000
> Remove now unused temp_buf from CPUState. Rename CPU_TEMP_BUF_NLONGS
> to TCG_TEMP_BUF_NLONGS.
>
> Signed-off-by: Blue Swirl<blauwirbel@gmail.com>
> ---
> cpu-defs.h | 3 ---
> tcg/arm/tcg-target.c | 6 +++---
> tcg/hppa/tcg-target.c | 2 +-
> tcg/i386/tcg-target.c | 4 ++--
> tcg/ia64/tcg-target.c | 4 ++--
> tcg/mips/tcg-target.c | 6 +++---
> tcg/ppc/tcg-target.c | 6 +++---
> tcg/ppc64/tcg-target.c | 6 +++---
> tcg/s390/tcg-target.c | 4 ++--
> tcg/sparc/tcg-target.c | 4 ++--
> tcg/tcg.h | 3 +++
> 11 files changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/cpu-defs.h b/cpu-defs.h
> index db48a7a..a76fc31 100644
> --- a/cpu-defs.h
> +++ b/cpu-defs.h
> @@ -153,7 +153,6 @@ typedef struct CPUWatchpoint {
> QTAILQ_ENTRY(CPUWatchpoint) entry;
> } CPUWatchpoint;
>
> -#define CPU_TEMP_BUF_NLONGS 128
> #define CPU_COMMON \
> struct TranslationBlock *current_tb; /* currently executing TB */ \
> /* soft mmu support */ \
> @@ -169,8 +168,6 @@ typedef struct CPUWatchpoint {
> volatile sig_atomic_t exit_request; \
> CPU_COMMON_TLB \
> struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; \
> - /* buffer for temporaries in the code generator */ \
> - long temp_buf[CPU_TEMP_BUF_NLONGS]; \
> \
> int64_t icount_extra; /* Instructions until next timer event. */ \
> /* Number of cycles left, with interrupt flag in high bit. \
> diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
> index eacda6b..c142eec 100644
> --- a/tcg/arm/tcg-target.c
> +++ b/tcg/arm/tcg-target.c
> @@ -1847,7 +1847,7 @@ static inline void tcg_out_movi(TCGContext *s,
> TCGType type,
> static void tcg_target_qemu_prologue(TCGContext *s)
> {
> tcg_set_frame(s, TCG_REG_CALL_STACK, TCG_STATIC_CALL_ARGS_SIZE,
> - CPU_TEMP_BUF_NLONGS * sizeof(long));
> + TCG_TEMP_BUF_NLONGS * sizeof(long));
>
> /* Calling convention requires us to save r4-r11 and lr;
> * save also r12 to maintain stack 8-alignment.
> @@ -1857,7 +1857,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
> tcg_out32(s, (COND_AL<< 28) | 0x092d5ff0);
>
> tcg_out_addi(s, TCG_REG_CALL_STACK, -TCG_STATIC_CALL_ARGS_SIZE -
> - CPU_TEMP_BUF_NLONGS * sizeof(long)));
> + TCG_TEMP_BUF_NLONGS * sizeof(long)));
>
> tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]);
>
> @@ -1865,7 +1865,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
> tb_ret_addr = s->code_ptr;
>
> tcg_out_addi(s, TCG_REG_CALL_STACK, TCG_STATIC_CALL_ARGS_SIZE +
> - CPU_TEMP_BUF_NLONGS * sizeof(long));
> + TCG_TEMP_BUF_NLONGS * sizeof(long));
>
> /* ldmia sp!, { r4 - r12, pc } */
> tcg_out32(s, (COND_AL<< 28) | 0x08bd9ff0);
> diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c
> index db33e79..95f3316 100644
> --- a/tcg/hppa/tcg-target.c
> +++ b/tcg/hppa/tcg-target.c
> @@ -1613,7 +1613,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
> frame_size += ARRAY_SIZE(tcg_target_callee_save_regs) * 4;
>
> /* Allocate space for the TCG temps. */
> - frame_size += CPU_TEMP_BUF_NLONGS * sizeof(long);
> + frame_size += TCG_TEMP_BUF_NLONGS * sizeof(long);
>
> /* Align the allocated space. */
> frame_size = ((frame_size + TCG_TARGET_STACK_ALIGN - 1)
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index 7529677..3e723f5 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -1923,12 +1923,12 @@ static void tcg_target_qemu_prologue(TCGContext *s)
> push_size *= TCG_TARGET_REG_BITS / 8;
>
> frame_size = push_size + TCG_STATIC_CALL_ARGS_SIZE +
> - CPU_TEMP_BUF_NLONGS * sizeof(long);
> + TCG_TEMP_BUF_NLONGS * sizeof(long);
> frame_size = (frame_size + TCG_TARGET_STACK_ALIGN - 1)&
> ~(TCG_TARGET_STACK_ALIGN - 1);
> stack_addend = frame_size - push_size;
> tcg_set_frame(s, TCG_REG_CALL_STACK, TCG_STATIC_CALL_ARGS_SIZE,
> - CPU_TEMP_BUF_NLONGS * sizeof(long));
> + TCG_TEMP_BUF_NLONGS * sizeof(long));
>
> /* Save all callee saved registers. */
> for (i = 0; i< ARRAY_SIZE(tcg_target_callee_save_regs); i++) {
> diff --git a/tcg/ia64/tcg-target.c b/tcg/ia64/tcg-target.c
> index 528ae64..97aad75 100644
> --- a/tcg/ia64/tcg-target.c
> +++ b/tcg/ia64/tcg-target.c
> @@ -2280,13 +2280,13 @@ static void tcg_target_qemu_prologue(TCGContext *s)
>
> /* reserve some stack space */
> frame_size = TCG_STATIC_CALL_ARGS_SIZE +
> - CPU_TEMP_BUF_NLONGS * sizeof(long);
> + TCG_TEMP_BUF_NLONGS * sizeof(long);
>
> frame_size = (frame_size + TCG_TARGET_STACK_ALIGN - 1)&
> ~(TCG_TARGET_STACK_ALIGN - 1);
>
> tcg_set_frame(s, TCG_REG_CALL_STACK, TCG_STATIC_CALL_ARGS_SIZE,
> - CPU_TEMP_BUF_NLONGS * sizeof(long));
> + TCG_TEMP_BUF_NLONGS * sizeof(long));
>
> /* First emit adhoc function descriptor */
> *(uint64_t *)(s->code_ptr) = (uint64_t)s->code_ptr + 16; /* entry point */
> diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
> index d536457..7c8e3c8 100644
> --- a/tcg/mips/tcg-target.c
> +++ b/tcg/mips/tcg-target.c
> @@ -1472,12 +1472,12 @@ static void tcg_target_qemu_prologue(TCGContext *s)
>
> /* reserve some stack space */
> frame_size = ARRAY_SIZE(tcg_target_callee_save_regs) * 4
> - + TCG_STATIC_CALL_ARGS_SIZE + CPU_TEMP_BUF_NLONGS * sizeof(long);
> + + TCG_STATIC_CALL_ARGS_SIZE + TCG_TEMP_BUF_NLONGS * sizeof(long);
> frame_size = (frame_size + TCG_TARGET_STACK_ALIGN - 1)&
> ~(TCG_TARGET_STACK_ALIGN - 1);
> tcg_set_frame(s, TCG_REG_CALL_STACK, frame_size
> - - CPU_TEMP_BUF_NLONGS * sizeof(long),
> - CPU_TEMP_BUF_NLONGS * sizeof(long));
> + - TCG_TEMP_BUF_NLONGS * sizeof(long),
> + TCG_TEMP_BUF_NLONGS * sizeof(long));
>
> /* TB prologue */
> tcg_out_addi(s, TCG_REG_CALL_STACK, -frame_size);
> diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
> index 100ef12..841bc9d 100644
> --- a/tcg/ppc/tcg-target.c
> +++ b/tcg/ppc/tcg-target.c
> @@ -907,13 +907,13 @@ static void tcg_target_qemu_prologue (TCGContext *s)
> + LINKAGE_AREA_SIZE
> + TCG_STATIC_CALL_ARGS_SIZE
> + ARRAY_SIZE (tcg_target_callee_save_regs) * 4
> - + CPU_TEMP_BUF_NLONGS * sizeof(long)
> + + TCG_TEMP_BUF_NLONGS * sizeof(long)
> ;
> frame_size = (frame_size + 15)& ~15;
>
> tcg_set_frame(s, TCG_REG_CALL_STACK, frame_size
> - - CPU_TEMP_BUF_NLONGS * sizeof(long),
> - CPU_TEMP_BUF_NLONGS * sizeof(long));
> + - TCG_TEMP_BUF_NLONGS * sizeof(long),
> + TCG_TEMP_BUF_NLONGS * sizeof(long));
>
> #ifdef _CALL_AIX
> {
> diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
> index 6c92d84..d7bb35b 100644
> --- a/tcg/ppc64/tcg-target.c
> +++ b/tcg/ppc64/tcg-target.c
> @@ -875,13 +875,13 @@ static void tcg_target_qemu_prologue (TCGContext *s)
> + 8 /* TOC save area */
> + TCG_STATIC_CALL_ARGS_SIZE
> + ARRAY_SIZE (tcg_target_callee_save_regs) * 8
> - + CPU_TEMP_BUF_NLONGS * sizeof(long)
> + + TCG_TEMP_BUF_NLONGS * sizeof(long)
> ;
> frame_size = (frame_size + 15)& ~15;
>
> tcg_set_frame(s, TCG_REG_CALL_STACK, frame_size
> - - CPU_TEMP_BUF_NLONGS * sizeof(long),
> - CPU_TEMP_BUF_NLONGS * sizeof(long));
> + - TCG_TEMP_BUF_NLONGS * sizeof(long),
> + TCG_TEMP_BUF_NLONGS * sizeof(long));
>
> #ifndef __APPLE__
> /* First emit adhoc function descriptor */
> diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
> index c063509..9f66cfa 100644
> --- a/tcg/s390/tcg-target.c
> +++ b/tcg/s390/tcg-target.c
> @@ -2301,10 +2301,10 @@ static void tcg_target_qemu_prologue(TCGContext *s)
>
> /* aghi %r15,-160 (stack frame) */
> tcg_out_insn(s, RI, AGHI, TCG_REG_CALL_STACK,
> - -(160 + CPU_TEMP_BUF_NLONGS * sizeof(long)));
> + -(160 + TCG_TEMP_BUF_NLONGS * sizeof(long)));
>
> tcg_set_frame(s, TCG_REG_CALL_STACK, 160,
> - CPU_TEMP_BUF_NLONGS * sizeof(long));
> + TCG_TEMP_BUF_NLONGS * sizeof(long));
> if (GUEST_BASE>= 0x80000) {
> tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, GUEST_BASE);
> tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
> diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
> index ac76e11..10b9b8c 100644
> --- a/tcg/sparc/tcg-target.c
> +++ b/tcg/sparc/tcg-target.c
> @@ -694,10 +694,10 @@ static void tcg_out_setcond2_i32(TCGContext *s,
> TCGCond cond, TCGArg ret,
> static void tcg_target_qemu_prologue(TCGContext *s)
> {
> tcg_set_frame(s, TCG_REG_I6, TCG_TARGET_CALL_STACK_OFFSET,
> - CPU_TEMP_BUF_NLONGS * (int)sizeof(long));
> + TCG_TEMP_BUF_NLONGS * (int)sizeof(long));
> tcg_out32(s, SAVE | INSN_RD(TCG_REG_O6) | INSN_RS1(TCG_REG_O6) |
> INSN_IMM13(-(TCG_TARGET_STACK_MINFRAME +
> - CPU_TEMP_BUF_NLONGS * (int)sizeof(long))));
> + TCG_TEMP_BUF_NLONGS * (int)sizeof(long))));
> tcg_out32(s, JMPL | INSN_RD(TCG_REG_G0) | INSN_RS1(TCG_REG_I1) |
> INSN_RS2(TCG_REG_G0));
> tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, TCG_REG_I0);
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index a2dd8b8..39c59ff 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -92,6 +92,9 @@ typedef struct TCGPool {
>
> #define TCG_MAX_TEMPS 512
>
> +/* buffer for temporaries */
> +#define TCG_TEMP_BUF_NLONGS 128
> +
> /* when the size of the arguments of a called function is smaller than
> this value, they are statically allocated in the TB stack frame */
> #define TCG_STATIC_CALL_ARGS_SIZE 128
--
Best Regards
Wayne Xia
mail:xiawenc@linux.vnet.ibm.com
tel:86-010-82450803
prev parent reply other threads:[~2011-06-27 6:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-26 19:25 [Qemu-devel] [PATCH 12/12] Remove temp_buf, rename CPU_TEMP_BUF_NLONGS Blue Swirl
2011-06-27 6:39 ` Wayne Xia [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E0825A7.2040703@linux.vnet.ibm.com \
--to=xiawenc@linux.vnet.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).