[kgtp] r963 committed - Update gtp_for_review.patch

  • From: kgtp@xxxxxxxxxxxxxx
  • To: kgtp@xxxxxxxxxxxxx
  • Date: Sun, 11 Mar 2012 11:20:05 +0000

Revision: 963
Author:   teawater
Date:     Sun Mar 11 04:19:36 2012
Log:      Update gtp_for_review.patch

http://code.google.com/p/kgtp/source/detail?r=963

Modified:
 /trunk/gtp.c
 /trunk/gtp_for_review.patch

=======================================
--- /trunk/gtp.c        Sat Mar 10 20:47:12 2012
+++ /trunk/gtp.c        Sun Mar 11 04:19:36 2012
@@ -4849,7 +4849,7 @@
               (int)tpe->num);

        tpe->have_printk = 0;
-
+
 reswitch:
        while (pc < ae->u.exp.size) {
 #ifdef GTP_DEBUG
=======================================
--- /trunk/gtp_for_review.patch Fri Mar  2 06:12:17 2012
+++ /trunk/gtp_for_review.patch Sun Mar 11 04:19:36 2012
@@ -15,8 +15,10 @@
  scripts/gtp/getmod.py            |  132
  14 files changed, 12006 insertions(+), 2 deletions(-)

---- /dev/null
-+++ b/Documentation/gtp/howto.txt
+Index: linux/Documentation/gtp/howto.txt
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ linux/Documentation/gtp/howto.txt  2012-03-11 18:32:05.037712658 +0800
 @@ -0,0 +1,1519 @@
 +              Linux Kernel GDB tracepoint module (KGTP)
 +              =========================================
@@ -1537,8 +1539,10 @@
 +----------------------------------------------------
 +This way is better to work with python to parse Kernel.
 +I will introduce them in example.
---- /dev/null
-+++ b/Documentation/gtp/quickstart.txt
+Index: linux/Documentation/gtp/quickstart.txt
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ linux/Documentation/gtp/quickstart.txt 2012-03-11 18:32:05.037712658 +0800
 @@ -0,0 +1,250 @@
 +              Linux Kernel GDB tracepoint module (KGTP) quick start
 +              =====================================================
@@ -1790,8 +1794,10 @@
 +
 +Now, you can begin to rock and roll your Linux kernel with KGTP and GDB.
 +Please go to HOWTO to get more message about howto use KGTP.
---- /dev/null
-+++ b/arch/arm/include/asm/gtp.h
+Index: linux/arch/arm/include/asm/gtp.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ linux/arch/arm/include/asm/gtp.h   2012-03-11 18:32:05.047712661 +0800
 @@ -0,0 +1,13 @@
 +#ifndef _ASM_ARM_GTP_H_
 +#define _ASM_ARM_GTP_H_
@@ -1806,8 +1812,10 @@
 +#define GTP_REG_BIN_SIZE      168
 +
 +#endif
---- /dev/null
-+++ b/arch/mips/include/asm/gtp.h
+Index: linux/arch/mips/include/asm/gtp.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ linux/arch/mips/include/asm/gtp.h  2012-03-11 18:32:05.047712661 +0800
 @@ -0,0 +1,18 @@
 +#ifndef _ASM_MIPS_GTP_H_
 +#define _ASM_MIPS_GTP_H_
@@ -1827,8 +1835,10 @@
 +#endif
 +
 +#endif
---- /dev/null
-+++ b/arch/x86/include/asm/gtp.h
+Index: linux/arch/x86/include/asm/gtp.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ linux/arch/x86/include/asm/gtp.h   2012-03-11 18:32:05.047712661 +0800
 @@ -0,0 +1,18 @@
 +#ifndef _ASM_X86_GTP_H_
 +#define _ASM_X86_GTP_H_
@@ -1848,9 +1858,11 @@
 +#endif
 +
 +#endif
---- a/include/linux/perf_event.h
-+++ b/include/linux/perf_event.h
-@@ -1146,9 +1146,12 @@ extern void perf_output_copy(struct perf
+Index: linux/include/linux/perf_event.h
+===================================================================
+--- linux.orig/include/linux/perf_event.h 2012-03-06 16:42:02.557693303 +0800
++++ linux/include/linux/perf_event.h   2012-03-11 18:32:05.057712663 +0800
+@@ -1146,9 +1146,12 @@
                             const void *buf, unsigned int len);
  extern int perf_swevent_get_recursion_context(void);
  extern void perf_swevent_put_recursion_context(int rctx);
@@ -1863,9 +1875,11 @@
  #else
  static inline void
  perf_event_task_sched_in(struct task_struct *prev,
---- a/kernel/events/core.c
-+++ b/kernel/events/core.c
-@@ -1235,7 +1235,7 @@ retry:
+Index: linux/kernel/events/core.c
+===================================================================
+--- linux.orig/kernel/events/core.c    2012-03-06 16:41:37.997693395 +0800
++++ linux/kernel/events/core.c 2012-03-11 18:32:05.077712660 +0800
+@@ -1235,7 +1235,7 @@
  /*
   * Cross CPU call to disable a performance event
   */
@@ -1874,7 +1888,7 @@
  {
        struct perf_event *event = info;
        struct perf_event_context *ctx = event->ctx;
-@@ -1272,6 +1272,7 @@ static int __perf_event_disable(void *in
+@@ -1272,6 +1272,7 @@

        return 0;
  }
@@ -1882,7 +1896,7 @@

  /*
   * Disable a event.
-@@ -1683,7 +1684,7 @@ static void __perf_event_mark_enabled(st
+@@ -1683,7 +1684,7 @@
  /*
   * Cross CPU call to enable a performance event
   */
@@ -1891,7 +1905,7 @@
  {
        struct perf_event *event = info;
        struct perf_event_context *ctx = event->ctx;
-@@ -1747,6 +1748,7 @@ unlock:
+@@ -1747,6 +1748,7 @@

        return 0;
  }
@@ -1899,7 +1913,7 @@

  /*
   * Enable a event.
-@@ -3065,6 +3067,14 @@ static void perf_event_reset(struct perf
+@@ -3065,6 +3067,14 @@
        perf_event_update_userpage(event);
  }

@@ -1914,9 +1928,11 @@
  /*
   * Holding the top-level event's child_mutex means that any
   * descendant process that has inherited this event will block
---- a/lib/Kconfig.debug
-+++ b/lib/Kconfig.debug
-@@ -1268,6 +1268,16 @@ config ASYNC_RAID6_TEST
+Index: linux/lib/Kconfig.debug
+===================================================================
+--- linux.orig/lib/Kconfig.debug       2012-03-06 16:42:06.587693289 +0800
++++ linux/lib/Kconfig.debug    2012-03-11 18:32:05.087712658 +0800
+@@ -1268,6 +1268,16 @@

          If unsure, say N.

@@ -1933,9 +1949,11 @@
  source "samples/Kconfig"

  source "lib/Kconfig.kgdb"
---- a/lib/Makefile
-+++ b/lib/Makefile
-@@ -123,6 +123,8 @@ obj-$(CONFIG_SIGNATURE) += digsig.o
+Index: linux/lib/Makefile
+===================================================================
+--- linux.orig/lib/Makefile    2012-03-06 16:42:06.597693289 +0800
++++ linux/lib/Makefile 2012-03-11 18:32:05.107712660 +0800
+@@ -123,6 +123,8 @@

  obj-$(CONFIG_CLZ_TAB) += clz_tab.o

@@ -1944,15 +1962,17 @@
  hostprogs-y   := gen_crc32table
  clean-files   := crc32table.h

-@@ -133,3 +135,5 @@ quiet_cmd_crc32 = GEN     $@
+@@ -133,3 +135,5 @@

  $(obj)/crc32table.h: $(obj)/gen_crc32table
        $(call cmd,crc32)
 +
 +gtp.o: gtp_rb.c
---- /dev/null
-+++ b/lib/gtp.c
-@@ -0,0 +1,8666 @@
+Index: linux/lib/gtp.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ linux/lib/gtp.c    2012-03-11 19:03:33.137719710 +0800
+@@ -0,0 +1,8862 @@
 +/*
 + * Kernel GDB tracepoint module.
 + *
@@ -2056,12 +2076,37 @@
 +
 +#define INT2CHAR(h)           ((h) > 9 ? (h) + 'a' - 10 : (h) + '0')
 +
-+#define OP_SPECIAL_GETV               0xfa
-+#define OP_SPECIAL_SETV               0xfb
-+#define OP_SPECIAL_TRACEV     0xfc
-+#define OP_TRACE_PRINTK               0xfd
-+#define OP_TRACE_QUICK_PRINTK 0xfe
-+#define OP_TRACEV_PRINTK      0xff
++enum {
++      op_check_add = 0xe5,
++      op_check_sub,
++      op_check_mul,
++      op_check_div_signed,
++      op_check_div_unsigned,
++      op_check_rem_signed,
++      op_check_rem_unsigned,
++      op_check_lsh,
++      op_check_rsh_signed,
++      op_check_rsh_unsigned,
++      op_check_trace,
++      op_check_bit_and,
++      op_check_bit_or,
++      op_check_bit_xor,
++      op_check_equal,
++      op_check_less_signed,
++      op_check_less_unsigned,
++      op_check_pop,
++      op_check_swap,
++      op_check_if_goto,
++      op_check_printf,        /* XXX: still not used.  */
++
++      op_special_getv = 0xfa,
++      op_special_setv,
++      op_special_tracev,
++
++      op_trace_printk = 0xfd,
++      op_trace_quick_printk,
++      op_tracev_printk,
++};
 +
 +struct action_agent_exp {
 +      unsigned int    size;
@@ -2243,7 +2288,7 @@
 +      GTP_VAR_IRQ_COUNT_ID,
 +      GTP_VAR_PIPE_TRACE_ID,
 +      GTP_VAR_CURRENT_TASK_PID_ID,
-+      GTP_VAR_SPECIAL_MAX = GTP_VAR_PIPE_TRACE_ID,
++      GTP_VAR_SPECIAL_MAX = GTP_VAR_CURRENT_TASK_PID_ID,
 +};
 +
 +#define PREV_VAR      NULL
@@ -4194,96 +4239,6 @@
 +
 +      return tve->val;
 +}
-+
-+#define gtp_action_x_getv                                             \
-+      do {                                                            \
-+              struct gtp_var  *tve;                                   \
-+                                                                      \
-+              tve = gtp_gtp_var_array_find(arg);                      \
-+              if (!tve)                                               \
-+                      goto code_error_out;                            \
-+                                                                      \
-+              stack[sp++] = top;                                      \
-+                                                                      \
-+              top = gtp_get_var(gts, tve);                            \
-+      } while (0)
-+
-+#ifdef CONFIG_PERF_EVENTS
-+#define gtp_action_x_setv_pe                                          \
-+      do {                                                            \
-+              if (tve->ptid == pe_tv_en)                           \
-+                      gtp_pe_set_en(tve->pts, (int)top);           \
-+              else if (tve->ptid == pe_tv_val)                     \
-+                      perf_event_set(tve->pts->event, (u64)top);        \
-+      } while (0)
-+#else
-+#define gtp_action_x_setv_pe
-+#endif
-+
-+#define gtp_action_x_setv                             \
-+      do {                                            \
-+              struct gtp_var  *tve;                   \
-+                                                      \
-+              tve = gtp_gtp_var_array_find(arg);      \
-+              if (!tve)                               \
-+                      goto code_error_out;            \
-+              gtp_action_x_setv_pe;                   \
-+              tve->val = (uint64_t)top;            \
-+      } while (0)
-+
-+#define gtp_action_x_tracev                                           \
-+      do {                                                            \
-+              if (!gts->tpe->have_printk) {                             \
-+                      struct gtp_var  *tve;                           \
-+                                                                      \
-+                      tve = gtp_gtp_var_array_find(arg);              \
-+                      if (!tve)                                       \
-+                              goto code_error_out;                    \
-+                                                                      \
-+                      if (gtp_collect_var(gts, tve)) {                \
-+                              /* gtp_collect_var will set error       \
-+                                 status with itself if it got         \
-+                                 error. */                            \
-+                              goto out;                               \
-+                      }                                               \
-+              }                                                       \
-+      } while (0)
-+
-+#define gtp_action_x_tracev_printk                                    \
-+      do {                                                            \
-+              struct gtp_var  *tve;                                   \
-+                                                                      \
-+              tve = gtp_gtp_var_array_find(arg);                      \
-+              if (!tve)                                               \
-+                      goto code_error_out;                            \
-+                                                                      \
-+              if (gtp_action_printk(gts, gtp_get_var(gts, tve), 0)) { \
-+                      /* gtp_collect_var will set error status with   \
-+                         itself if it got error. */                   \
-+                      goto out;                                       \
-+              }                                                       \
-+      } while (0)
-+
-+#define gtp_action_x_printf                                           \
-+      do {                                                            \
-+              if (strstr((char *)(ebuf + pc), "%s")) {              \
-+                      int     i;                                      \
-+                      char    buf[50];                                \
-+                                                                      \
-+                      for (i = 0; i < 50; i++) {                   \
-+                              if (probe_kernel_read(buf + i,          \
-+                                                    argv + i, 1))     \
-+                                      goto code_error_out;            \
-+                              if (!buf[i])                            \
-+                                      break;                          \
-+                      }                                               \
-+                      snprintf(pbuf, psize, (char *)(ebuf + pc),      \
-+                               buf);                                  \
-+              } else {                                                \
-+                      snprintf(pbuf, psize, (char *)(ebuf + pc),      \
-+                               argv);                                 \
-+              }                                                       \
-+      } while (0)
 +
 +#define STACK_MAX     32
 +static DEFINE_PER_CPU(ULONGEST[STACK_MAX], action_x_stack);
@@ -4321,695 +4276,558 @@
 +      if (unlikely(ae->u.exp.need_var_lock))
 +              spin_lock(&gtp_var_lock);
 +
-+      if (ae->type == 'X') {
-+              while (pc < ae->u.exp.size) {
++      while (1) {
 +#ifdef GTP_DEBUG
-+                      printk(GTP_DEBUG "gtp_parse_x: cmd %x\n", ebuf[pc]);
++              printk(GTP_DEBUG "gtp_parse_x: cmd %x\n", ebuf[pc]);
 +#endif
 +
-+                      switch (ebuf[pc++]) {
-+                      /* add */
-+                      case 0x02:
++              switch (ebuf[pc++]) {
++              /* add */
++              case 0x02:
++                      top += stack[--sp];
++                      break;
++
++              case op_check_add:
++                      if (sp)
 +                              top += stack[--sp];
-+                              break;
-+                      /* sub */
-+                      case 0x03:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* sub */
++              case 0x03:
++                      top = stack[--sp] - top;
++                      break;
++
++              case op_check_sub:
++                      if (sp)
 +                              top = stack[--sp] - top;
-+                              break;
-+                      /* mul */
-+                      case 0x04:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* mul */
++              case 0x04:
++                      top *= stack[--sp];
++                      break;
++
++              case op_check_mul:
++                      if (sp)
 +                              top *= stack[--sp];
-+                              break;
++                      else
++                              goto code_error_out;
++                      break;
++
 +#ifndef CONFIG_MIPS
-+                      /* div_signed */
-+                      case 0x05:
-+                              if (top) {
-+                                      LONGEST l = (LONGEST) stack[--sp];
-+                                      do_div(l, (LONGEST) top);
-+                                      top = l;
-+                              } else
-+                                      goto code_error_out;
-+                              break;
-+                      /* div_unsigned */
-+                      case 0x06:
-+                              if (top) {
-+                                      ULONGEST ul = stack[--sp];
-+                                      do_div(ul, top);
-+                                      top = ul;
-+                              } else
-+                                      goto code_error_out;
-+                              break;
-+                      /* rem_signed */
-+                      case 0x07:
-+                              if (top) {
-+                                      LONGEST l1 = (LONGEST) stack[--sp];
-+                                      LONGEST l2 = (LONGEST) top;
-+                                      top = do_div(l1, l2);
-+                              } else
-+                                      goto code_error_out;
-+                              break;
-+                      /* rem_unsigned */
-+                      case 0x08:
-+                              if (top) {
-+                                      ULONGEST ul1 = stack[--sp];
-+                                      ULONGEST ul2 = top;
-+                                      top = do_div(ul1, ul2);
-+                              } else
-+                                      goto code_error_out;
-+                              break;
++              /* div_signed */
++              case 0x05:
++                      if (top) {
++                              LONGEST l = (LONGEST) stack[--sp];
++                              do_div(l, (LONGEST) top);
++                              top = l;
++                      } else
++                              goto code_error_out;
++                      break;
++
++              case op_check_div_signed:
++                      if (top && sp) {
++                              LONGEST l = (LONGEST) stack[--sp];
++                              do_div(l, (LONGEST) top);
++                              top = l;
++                      } else
++                              goto code_error_out;
++                      break;
++
++              /* div_unsigned */
++              case 0x06:
++                      if (top) {
++                              ULONGEST ul = stack[--sp];
++                              do_div(ul, top);
++                              top = ul;
++                      } else
++                              goto code_error_out;
++                      break;
++
++              case op_check_div_unsigned:
++                      if (top && sp) {
++                              ULONGEST ul = stack[--sp];
++                              do_div(ul, top);
++                              top = ul;
++                      } else
++                              goto code_error_out;
++                      break;
++
++              /* rem_signed */
++              case 0x07:
++                      if (top) {
++                              LONGEST l1 = (LONGEST) stack[--sp];
++                              LONGEST l2 = (LONGEST) top;
++                              top = do_div(l1, l2);
++                      } else
++                              goto code_error_out;
++                      break;
++
++              case op_check_rem_signed:
++                      if (top && sp) {
++                              LONGEST l1 = (LONGEST) stack[--sp];
++                              LONGEST l2 = (LONGEST) top;
++                              top = do_div(l1, l2);
++                      } else
++                              goto code_error_out;
++                      break;
++
++              /* rem_unsigned */
++              case 0x08:
++                      if (top) {
++                              ULONGEST ul1 = stack[--sp];
++                              ULONGEST ul2 = top;
++                              top = do_div(ul1, ul2);
++                      } else
++                              goto code_error_out;
++                      break;
++
++              case op_check_rem_unsigned:
++                      if (top && sp) {
++                              ULONGEST ul1 = stack[--sp];
++                              ULONGEST ul2 = top;
++                              top = do_div(ul1, ul2);
++                      } else
++                              goto code_error_out;
++                      break;
 +#endif
-+                      /* lsh */
-+                      case 0x09:
++
++              /* lsh */
++              case 0x09:
++                      top = stack[--sp] << top;
++                      break;
++
++              case op_check_lsh:
++                      if (sp)
 +                              top = stack[--sp] << top;
-+                              break;
-+                      /* rsh_signed */
-+                      case 0x0a:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* rsh_signed */
++              case 0x0a:
++                      top = ((LONGEST) stack[--sp]) >> top;
++                      break;
++
++              case op_check_rsh_signed:
++                      if (sp)
 +                              top = ((LONGEST) stack[--sp]) >> top;
-+                              break;
-+                      /* rsh_unsigned */
-+                      case 0x0b:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* rsh_unsigned */
++              case 0x0b:
++                      top = stack[--sp] >> top;
++                      break;
++
++              case op_check_rsh_unsigned:
++                      if (sp)
 +                              top = stack[--sp] >> top;
-+                              break;
-+                      /* trace */
-+                      case 0x0c:
-+                              --sp;
-+                              if (!gts->tpe->have_printk) {
-+                                      if (gtp_action_memory_read
-+                                              (gts, -1,
-+                                               (CORE_ADDR) stack[sp],
-+                                               (size_t) top))
-+                                              goto out;
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* trace */
++              case 0x0c:
++                      --sp;
++                      if (!gts->tpe->have_printk) {
++                              if (gtp_action_memory_read
++                                      (gts, -1,
++                                              (CORE_ADDR) stack[sp],
++                                              (size_t) top))
++                                      goto out;
++                      }
++                      top = stack[--sp];
++                      break;
++
++              case op_check_trace:
++                      if (sp > 1) {
++                              if (gtp_action_memory_read
++                                      (gts, -1, (CORE_ADDR) stack[--sp],
++                                      (size_t) top)) {
++                                      /* gtp_action_memory_read will
++                                              set error status with itself
++                                              if it got error. */
++                                      goto out;
 +                              }
 +                              top = stack[--sp];
-+                              break;
-+                      /* trace_printk */
-+                      case OP_TRACE_PRINTK:
-+                              if (gtp_action_printk(gts,
-+                                                    (ULONGEST)stack[--sp],
-+                                                    (size_t) top))
++                      } else
++                              goto code_error_out;
++                      break;
++
++              /* trace_printk */
++              case op_trace_printk:
++                      if (gtp_action_printk(gts,
++                                              (ULONGEST)stack[--sp],
++                                              (size_t) top))
++                              goto out;
++                      top = stack[--sp];
++                      break;
++
++              /* trace_quick */
++              case 0x0d:
++                      if (!gts->tpe->have_printk) {
++                              if (gtp_action_memory_read
++                                      (gts, -1, (CORE_ADDR) top,
++                                              (size_t) ebuf[pc]))
 +                                      goto out;
-+                              top = stack[--sp];
-+                              break;
-+                      /* trace_quick */
-+                      case 0x0d:
-+                              if (!gts->tpe->have_printk) {
-+                                      if (gtp_action_memory_read
-+                                              (gts, -1, (CORE_ADDR) top,
-+                                               (size_t) ebuf[pc]))
-+                                              goto out;
-+                              }
-+                              pc++;
-+                              break;
-+                      /* trace_quick_printk */
-+                      case OP_TRACE_QUICK_PRINTK:
-+                              if (gtp_action_printk(gts, (ULONGEST) top,
-+                                                    (size_t) ebuf[pc++]))
-+                                      goto out;
-+                              break;
-+                      /* log_not */
-+                      case 0x0e:
-+                              top = !top;
-+                              break;
-+                      /* bit_and */
-+                      case 0x0f:
++                      }
++                      pc++;
++                      break;
++
++              /* trace_quick_printk */
++              case op_trace_quick_printk:
++                      if (gtp_action_printk(gts, (ULONGEST) top,
++                                              (size_t) ebuf[pc++]))
++                              goto out;
++                      break;
++
++              /* log_not */
++              case 0x0e:
++                      top = !top;
++                      break;
++
++              /* bit_and */
++              case 0x0f:
++                      top &= stack[--sp];
++                      break;
++
++              case op_check_bit_and:
++                      if (sp)
 +                              top &= stack[--sp];
-+                              break;
-+                      /* bit_or */
-+                      case 0x10:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* bit_or */
++              case 0x10:
++                      top |= stack[--sp];
++                      break;
++
++              case op_check_bit_or:
++                      if (sp)
 +                              top |= stack[--sp];
-+                              break;
-+                      /* bit_xor */
-+                      case 0x11:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* bit_xor */
++              case 0x11:
++                      top ^= stack[--sp];
++                      break;
++
++              case op_check_bit_xor:
++                      if (sp)
 +                              top ^= stack[--sp];
-+                              break;
-+                      /* bit_not */
-+                      case 0x12:
-+                              top = ~top;
-+                              break;
-+                      /* equal */
-+                      case 0x13:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* bit_not */
++              case 0x12:
++                      top = ~top;
++                      break;
++
++              /* equal */
++              case 0x13:
++                      top = (stack[--sp] == top);
++                      break;
++
++              case op_check_equal:
++                      if (sp)
 +                              top = (stack[--sp] == top);
-+                              break;
-+                      /* less_signed */
-+                      case 0x14:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* less_signed */
++              case 0x14:
++                      top = (((LONGEST) stack[--sp])
++                              < ((LONGEST) top));
++                      break;
++
++              case op_check_less_signed:
++                      if (sp)
 +                              top = (((LONGEST) stack[--sp])
 +                                      < ((LONGEST) top));
-+                              break;
-+                      /* less_unsigned */
-+                      case 0x15:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* less_unsigned */
++              case 0x15:
++                      top = (stack[--sp] < top);
++                      break;
++
++              case op_check_less_unsigned:
++                      if (sp)
 +                              top = (stack[--sp] < top);
-+                              break;
-+                      /* ext */
-+                      case 0x16:
-+                              arg = ebuf[pc++];
-+                              if (arg < (sizeof(LONGEST)*8)) {
-+                                      LONGEST mask = 1 << (arg - 1);
-+                                      top &= ((LONGEST) 1 << arg) - 1;
-+                                      top = (top ^ mask) - mask;
-+                              }
-+                              break;
-+                      /* ref8 */
-+                      case 0x17:
-+                              if (probe_kernel_read
-+                                      (cnv.u8.bytes,
-+                                      (void *)(CORE_ADDR)top, 1))
-+                                      goto code_error_out;
-+                              top = (ULONGEST) cnv.u8.val;
-+                              break;
-+                      /* ref16 */
-+                      case 0x18:
-+                              if (probe_kernel_read
-+                                      (cnv.u16.bytes,
-+                                      (void *)(CORE_ADDR)top, 2))
-+                                      goto code_error_out;
-+                              top = (ULONGEST) cnv.u16.val;
-+                              break;
-+                      /* ref32 */
-+                      case 0x19:
-+                              if (probe_kernel_read
-+                                      (cnv.u32.bytes,
-+                                      (void *)(CORE_ADDR)top, 4))
-+                                      goto code_error_out;
-+                              top = (ULONGEST) cnv.u32.val;
-+                              break;
-+                      /* ref64 */
-+                      case 0x1a:
-+                              if (probe_kernel_read
-+                                      (cnv.u64.bytes,
-+                                      (void *)(CORE_ADDR)top, 8))
-+                                      goto code_error_out;
-+                              top = (ULONGEST) cnv.u64.val;
-+                              break;
-+                      /* if_goto */
-+                      case 0x20:
-+                              /* The not check sp code don't
-+                                 support if_goto.  */
++                      else
 +                              goto code_error_out;
-+                              break;
-+                      /* goto */
-+                      case 0x21:
-+                              pc = (ebuf[pc] << 8) + (ebuf[pc + 1]);
-+                              break;
-+                      /* const8 */
-+                      case 0x22:
-+                              stack[sp++] = top;
-+                              top = ebuf[pc++];
-+                              break;
-+                      /* const16 */
-+                      case 0x23:
-+                              stack[sp++] = top;
-+                              top = ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              break;
-+                      /* const32 */
-+                      case 0x24:
-+                              stack[sp++] = top;
-+                              top = ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              break;
-+                      /* const64 */
-+                      case 0x25:
-+                              stack[sp++] = top;
-+                              top = ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              top = (top << 8) + ebuf[pc++];
-+                              break;
-+                      /* reg */
-+                      case 0x26:
-+                              stack[sp++] = top;
-+                              arg = ebuf[pc++];
-+                              arg = (arg << 8) + ebuf[pc++];
-+                              top = gtp_action_reg_read(gts->regs, gts->tpe,
-+                                                        arg);
-+                              if (gts->tpe->reason != gtp_stop_normal)
-+                                      goto error_out;
-+                              break;
-+                      /* end */
-+                      case 0x27:
-+                              if (gts->run)
-+                                      *(gts->run) = (int)top;
-+                              goto out;
-+                              break;
-+                      /* dup */
-+                      case 0x28:
-+                              stack[sp++] = top;
-+                              break;
++                      break;
++
++              /* ext */
++              case 0x16:
++                      arg = ebuf[pc++];
++                      if (arg < (sizeof(LONGEST)*8)) {
++                              LONGEST mask = 1 << (arg - 1);
++                              top &= ((LONGEST) 1 << arg) - 1;
++                              top = (top ^ mask) - mask;
++                      }
++                      break;
++
++              /* ref8 */
++              case 0x17:
++                      if (probe_kernel_read
++                              (cnv.u8.bytes,
++                              (void *)(CORE_ADDR)top, 1))
++                              goto code_error_out;
++                      top = (ULONGEST) cnv.u8.val;
++                      break;
++
++              /* ref16 */
++              case 0x18:
++                      if (probe_kernel_read
++                              (cnv.u16.bytes,
++                              (void *)(CORE_ADDR)top, 2))
++                              goto code_error_out;
++                      top = (ULONGEST) cnv.u16.val;
++                      break;
++
++              /* ref32 */
++              case 0x19:
++                      if (probe_kernel_read
++                              (cnv.u32.bytes,
++                              (void *)(CORE_ADDR)top, 4))
++                              goto code_error_out;
++                      top = (ULONGEST) cnv.u32.val;
++                      break;
++
++              /* ref64 */
++              case 0x1a:
++                      if (probe_kernel_read
++                              (cnv.u64.bytes,
++                              (void *)(CORE_ADDR)top, 8))
++                              goto code_error_out;
++                      top = (ULONGEST) cnv.u64.val;
++                      break;
++
++              /* if_goto */
++              case 0x20:
++                      if (top)
++                              pc = (ebuf[pc] << 8)
++                                      + (ebuf[pc + 1]);
++                      else
++                              pc += 2;
 +                      /* pop */
-+                      case 0x29:
++                      top = stack[--sp];
++                      break;
++
++              case op_check_if_goto:
++                      if (top)
++                              pc = (ebuf[pc] << 8)
++                                      + (ebuf[pc + 1]);
++                      else
++                              pc += 2;
++                      /* pop */
++                      if (sp)
 +                              top = stack[--sp];
-+                              break;
-+                      /* zero_ext */
-+                      case 0x2a:
-+                              arg = ebuf[pc++];
-+                              if (arg < (sizeof(LONGEST)*8))
-+                                      top &= ((LONGEST) 1 << arg) - 1;
-+                              break;
-+                      /* swap */
-+                      case 0x2b:
++                      else
++                              goto code_error_out;
++                      break;
++
++              /* goto */
++              case 0x21:
++                      pc = (ebuf[pc] << 8) + (ebuf[pc + 1]);
++                      break;
++
++              /* const8 */
++              case 0x22:
++                      stack[sp++] = top;
++                      top = ebuf[pc++];
++                      break;
++
++              /* const16 */
++              case 0x23:
++                      stack[sp++] = top;
++                      top = ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      break;
++
++              /* const32 */
++              case 0x24:
++                      stack[sp++] = top;
++                      top = ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      break;
++
++              /* const64 */
++              case 0x25:
++                      stack[sp++] = top;
++                      top = ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      top = (top << 8) + ebuf[pc++];
++                      break;
++
++              /* reg */
++              case 0x26:
++                      stack[sp++] = top;
++                      arg = ebuf[pc++];
++                      arg = (arg << 8) + ebuf[pc++];
++                      top = gtp_action_reg_read(gts->regs, gts->tpe,
++                                                      arg);
++                      if (gts->tpe->reason != gtp_stop_normal)
++                              goto error_out;
++                      break;
++
++              /* end */
++              case 0x27:
++                      if (gts->run)
++                              *(gts->run) = (int)top;
++                      goto out;
++                      break;
++
++              /* dup */
++              case 0x28:
++                      stack[sp++] = top;
++                      break;
++
++              /* pop */
++              case 0x29:
++                      top = stack[--sp];
++                      break;
++
++              case op_check_pop:
***The diff for this file has been truncated for email.***

Other related posts:

  • » [kgtp] r963 committed - Update gtp_for_review.patch - kgtp