[GSOC 2014][PATCH 2/2] printllval form util.c isolated on linux/<arch>/autil.c

Edson xcr33d at gmail.com
Thu Jun 26 18:12:09 UTC 2014


---
 linux/aarch64/autil.c    | 28 ++++++++++++++++++++++++++++
 linux/alpha/autil.c      | 19 +++++++++++++++++++
 linux/arc/autil.c        | 19 +++++++++++++++++++
 linux/arm/autil.c        | 25 +++++++++++++++++++++++++
 linux/avr32/autil.c      | 19 +++++++++++++++++++
 linux/hppa/autil.c       | 19 +++++++++++++++++++
 linux/i386/autil.c       | 19 +++++++++++++++++++
 linux/ia64/autil.c       | 19 +++++++++++++++++++
 linux/m68k/autil.c       | 19 +++++++++++++++++++
 linux/metag/autil.c      | 19 +++++++++++++++++++
 linux/microblaze/autil.c | 19 +++++++++++++++++++
 linux/mips/autil.c       | 28 ++++++++++++++++++++++++++++
 linux/or1k/autil.c       | 19 +++++++++++++++++++
 linux/powerpc/autil.c    | 40 ++++++++++++++++++++++++++++++++++++++++
 linux/s390/autil.c       | 19 +++++++++++++++++++
 linux/s390x/autil.c      | 19 +++++++++++++++++++
 linux/sh/autil.c         | 19 +++++++++++++++++++
 linux/sh64/autil.c       | 19 +++++++++++++++++++
 linux/sparc/autil.c      | 24 ++++++++++++++++++++++++
 linux/sparc64/autil.c    | 24 ++++++++++++++++++++++++
 linux/tile/autil.c       | 24 ++++++++++++++++++++++++
 linux/x32/autil.c        | 32 ++++++++++++++++++++++++++++++++
 linux/x86_64/arch.h      |  5 +++++
 linux/x86_64/autil.c     | 29 +++++++++++++++++++++++++++++
 linux/x86_64/util.c      | 24 ++++++++++++++++++++++++
 linux/x86_64/util.h      | 14 ++++++++++++++
 linux/xtensa/autil.c     | 25 +++++++++++++++++++++++++
 27 files changed, 588 insertions(+)
 create mode 100644 linux/aarch64/autil.c
 create mode 100644 linux/alpha/autil.c
 create mode 100644 linux/arc/autil.c
 create mode 100644 linux/arm/autil.c
 create mode 100644 linux/avr32/autil.c
 create mode 100644 linux/hppa/autil.c
 create mode 100644 linux/i386/autil.c
 create mode 100644 linux/ia64/autil.c
 create mode 100644 linux/m68k/autil.c
 create mode 100644 linux/metag/autil.c
 create mode 100644 linux/microblaze/autil.c
 create mode 100644 linux/mips/autil.c
 create mode 100644 linux/or1k/autil.c
 create mode 100644 linux/powerpc/autil.c
 create mode 100644 linux/s390/autil.c
 create mode 100644 linux/s390x/autil.c
 create mode 100644 linux/sh/autil.c
 create mode 100644 linux/sh64/autil.c
 create mode 100644 linux/sparc/autil.c
 create mode 100644 linux/sparc64/autil.c
 create mode 100644 linux/tile/autil.c
 create mode 100644 linux/x32/autil.c
 create mode 100644 linux/x86_64/arch.h
 create mode 100644 linux/x86_64/autil.c
 create mode 100644 linux/x86_64/util.c
 create mode 100644 linux/x86_64/util.h
 create mode 100644 linux/xtensa/autil.c

diff --git a/linux/aarch64/autil.c b/linux/aarch64/autil.c
new file mode 100644
index 0000000..1a6f049
--- /dev/null
+++ b/linux/aarch64/autil.c
@@ -0,0 +1,28 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+	if (current_wordsize > 4) {
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+	} else {
+		if (align) {
+			/* Align arg_no to the next even number. */
+			arg_no = (arg_no + 1) & 0xe;
+		}
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/alpha/autil.c b/linux/alpha/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/alpha/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/arc/autil.c b/linux/arc/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/arc/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/arm/autil.c b/linux/arm/autil.c
new file mode 100644
index 0000000..9ad05fd
--- /dev/null
+++ b/linux/arm/autil.c
@@ -0,0 +1,25 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+# if defined __ARM_EABI__ 
+	if (align) {
+		/* Align arg_no to the next even number. */
+		arg_no = (arg_no + 1) & 0xe;
+	}
+# endif
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/avr32/autil.c b/linux/avr32/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/avr32/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/hppa/autil.c b/linux/hppa/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/hppa/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/i386/autil.c b/linux/i386/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/i386/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/ia64/autil.c b/linux/ia64/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/ia64/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/m68k/autil.c b/linux/m68k/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/m68k/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/metag/autil.c b/linux/metag/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/metag/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/microblaze/autil.c b/linux/microblaze/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/microblaze/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/mips/autil.c b/linux/mips/autil.c
new file mode 100644
index 0000000..6610ee9
--- /dev/null
+++ b/linux/mips/autil.c
@@ -0,0 +1,28 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#elif defined LINUX_MIPSN32
+	tprintf(format, tcp->ext_arg[arg_no]);
+	arg_no++;
+#else
+# if defined LINUX_MIPSO32
+	if (align) {
+		/* Align arg_no to the next even number. */
+		arg_no = (arg_no + 1) & 0xe;
+	}
+# endif
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/or1k/autil.c b/linux/or1k/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/or1k/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/powerpc/autil.c b/linux/powerpc/autil.c
new file mode 100644
index 0000000..65c6396
--- /dev/null
+++ b/linux/powerpc/autil.c
@@ -0,0 +1,40 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+# if SUPPORTED_PERSONALITIES > 1
+	if (current_wordsize > 4) {
+# endif
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+# if SUPPORTED_PERSONALITIES > 1
+	} else {
+#  if defined(POWERPC64)
+		if (align) {
+			/* Align arg_no to the next even number. */
+			arg_no = (arg_no + 1) & 0xe;
+		}
+#  endif
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+# endif /* SUPPORTED_PERSONALITIES */
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+# if defined POWERPC 
+	if (align) {
+		/* Align arg_no to the next even number. */
+		arg_no = (arg_no + 1) & 0xe;
+	}
+# endif
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/s390/autil.c b/linux/s390/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/s390/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/s390x/autil.c b/linux/s390x/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/s390x/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/sh/autil.c b/linux/sh/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/sh/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/sh64/autil.c b/linux/sh64/autil.c
new file mode 100644
index 0000000..96e0719
--- /dev/null
+++ b/linux/sh64/autil.c
@@ -0,0 +1,19 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/sparc/autil.c b/linux/sparc/autil.c
new file mode 100644
index 0000000..ef3c528
--- /dev/null
+++ b/linux/sparc/autil.c
@@ -0,0 +1,24 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+	if (current_wordsize > 4) {
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+	} else {
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/sparc64/autil.c b/linux/sparc64/autil.c
new file mode 100644
index 0000000..ef3c528
--- /dev/null
+++ b/linux/sparc64/autil.c
@@ -0,0 +1,24 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+	if (current_wordsize > 4) {
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+	} else {
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/tile/autil.c b/linux/tile/autil.c
new file mode 100644
index 0000000..ef3c528
--- /dev/null
+++ b/linux/tile/autil.c
@@ -0,0 +1,24 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+	if (current_wordsize > 4) {
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+	} else {
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/x32/autil.c b/linux/x32/autil.c
new file mode 100644
index 0000000..23dfef4
--- /dev/null
+++ b/linux/x32/autil.c
@@ -0,0 +1,32 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+	if (current_wordsize > 4) {
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+	} else {
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#elif defined X32
+	if (current_personality == 0) {
+		tprintf(format, tcp->ext_arg[arg_no]);
+		arg_no++;
+	} else {
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/x86_64/arch.h b/linux/x86_64/arch.h
new file mode 100644
index 0000000..5b906d2
--- /dev/null
+++ b/linux/x86_64/arch.h
@@ -0,0 +1,5 @@
+//#include "defs.h"
+/* Include all syscall decoders that are personality dependent */
+
+#include"util.h"
+
diff --git a/linux/x86_64/autil.c b/linux/x86_64/autil.c
new file mode 100644
index 0000000..e7a2d7b
--- /dev/null
+++ b/linux/x86_64/autil.c
@@ -0,0 +1,29 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+//extern void tprintf(const char*, ...);
+//extern unsigned current_wordsize;
+//extern struct tcb;
+//extern unsigned 
+#include "util.h"
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+	if (current_wordsize > 4) {
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+	} else {
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/x86_64/util.c b/linux/x86_64/util.c
new file mode 100644
index 0000000..ef3c528
--- /dev/null
+++ b/linux/x86_64/util.c
@@ -0,0 +1,24 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+	if (current_wordsize > 4) {
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+	} else {
+		tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+		arg_no += 2;
+	}
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
diff --git a/linux/x86_64/util.h b/linux/x86_64/util.h
new file mode 100644
index 0000000..84823a3
--- /dev/null
+++ b/linux/x86_64/util.h
@@ -0,0 +1,14 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+//extern void tprintf(const char*, ...);
+//extern unsigned current_wordsize;
+//extern struct tcb;
+//extern unsigned 
+//#ifdef HAVE_STDBOOL_H
+//# include <stdbool.h>
+#include"defs.h"
+//#endif
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align);
diff --git a/linux/xtensa/autil.c b/linux/xtensa/autil.c
new file mode 100644
index 0000000..b794291
--- /dev/null
+++ b/linux/xtensa/autil.c
@@ -0,0 +1,25 @@
+/*
+ * Print 64bit argument at position arg_no and return the index of the next
+ * argument.
+ */
+int
+printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
+{
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+		tprintf(format, tcp->u_arg[arg_no]);
+		arg_no++;
+#elif SIZEOF_LONG > 4
+#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#else
+# if defined XTENSA
+	if (align) {
+		/* Align arg_no to the next even number. */
+		arg_no = (arg_no + 1) & 0xe;
+	}
+# endif
+	tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+	arg_no += 2;
+#endif
+
+	return arg_no;
+}
-- 
1.8.4





More information about the Strace-devel mailing list