Re: [Qemu-devel] [PATCH 12/12] Remove temp_buf, rename CPU_TEMP_BUF_NLONGS

2011-06-27 Thread Wayne Xia

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 blauwir...@gmail.com
Date:   Sat May 14 17:06:56 2011 +



Remove now unused temp_buf from CPUState. Rename CPU_TEMP_BUF_NLONGS
to TCG_TEMP_BUF_NLONGS.

Signed-off-by: Blue Swirlblauwir...@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

[Qemu-devel] [PATCH 12/12] Remove temp_buf, rename CPU_TEMP_BUF_NLONGS

2011-06-26 Thread Blue Swirl
Remove now unused temp_buf from CPUState. Rename CPU_TEMP_BUF_NLONGS
to TCG_TEMP_BUF_NLONGS.

Signed-off-by: Blue Swirl blauwir...@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,