summaryrefslogtreecommitdiffstats
path: root/src/ppe
diff options
context:
space:
mode:
authorPrachi Gupta <pragupta@us.ibm.com>2017-07-17 17:43:01 -0500
committerWilliam A. Bryan <wilbryan@us.ibm.com>2017-07-21 17:51:40 -0400
commitb796b12052f5542945bf6d1a831f8d67a502a0ef (patch)
treec3eb6825606ce714b5d020b1092c5d6c05d06027 /src/ppe
parent3d71bd95e10f82ae2a96e6ebc929dc2ca7b1b63c (diff)
downloadtalos-occ-b796b12052f5542945bf6d1a831f8d67a502a0ef.tar.gz
talos-occ-b796b12052f5542945bf6d1a831f8d67a502a0ef.zip
rt_xstop_analysis: single proc fir collection is working, without pnor writes
Change-Id: Ib49d3b9d52c8f4e1054e9b0c0d609a6e13908ddb Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43245 Reviewed-by: ILYA SMIRNOV <ismirno@us.ibm.com> Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com> Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Diffstat (limited to 'src/ppe')
-rw-r--r--src/ppe/pk/ppe42/pkppe42files.mk1
-rw-r--r--src/ppe/pk/ppe42/ppe42_string.c345
-rw-r--r--src/ppe/pk/ppe42/ppe42_string.h67
-rw-r--r--src/ppe/pk/trace/pk_trace.h2
4 files changed, 414 insertions, 1 deletions
diff --git a/src/ppe/pk/ppe42/pkppe42files.mk b/src/ppe/pk/ppe42/pkppe42files.mk
index 1097f0f..55c5c4d 100644
--- a/src/ppe/pk/ppe42/pkppe42files.mk
+++ b/src/ppe/pk/ppe42/pkppe42files.mk
@@ -41,6 +41,7 @@ PPE42-C-SOURCES = ppe42_core.c \
ppe42_irq_core.c\
ppe42_gcc.c\
ppe42_scom.c\
+ ppe42_string.c\
eabi.c\
math.c
diff --git a/src/ppe/pk/ppe42/ppe42_string.c b/src/ppe/pk/ppe42/ppe42_string.c
new file mode 100644
index 0000000..1573b9f
--- /dev/null
+++ b/src/ppe/pk/ppe42/ppe42_string.c
@@ -0,0 +1,345 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: chips/p9/procedures/ppe/pk/ppe42/ppe42_string.c $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* EKB Project */
+/* */
+/* COPYRIGHT 2016 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+// Note: this code does not compile under the ppc2ppe backend.
+// It emits illegal ppe42 asm instructions.
+// __PPE42__ is set by the ppe42 compiler
+#ifdef __PPE42__
+
+#include <ppe42_string.h>
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+void* memset(void* vdest, int ch, size_t len)
+{
+ uint32_t addr = (uint32_t)vdest;
+
+ while(len && (addr & 0x7)) // not 8 byte aligned
+ {
+ uint8_t* p = (uint8_t*)addr;
+ *p = ch;
+ ++addr;
+ --len;
+ }
+
+ if(len >= sizeof(uint64_t))
+ {
+ uint64_t lch = ch & 0xff;
+ lch |= lch << 8;
+ lch |= lch << 16;
+ lch |= lch << 32;
+
+ while(len >= sizeof(uint64_t))
+ {
+ uint64_t* p = (uint64_t*)addr;
+ *p = lch;
+ len -= sizeof(uint64_t);
+ addr += sizeof(uint64_t);
+ }
+ }
+
+ while(len)
+ {
+ uint8_t* p = (uint8_t*)addr;
+ *p = ch;
+ ++addr;
+ --len;
+ }
+
+ return vdest;
+}
+
+
+void* memcpy(void* vdest, const void* vsrc, size_t len)
+{
+
+ // Loop, copying 4 bytes
+ long* ldest = (long*)vdest;
+ const long* lsrc = (const long*)vsrc;
+
+ while (len >= sizeof(long))
+ {
+ *ldest++ = *lsrc++;
+ len -= sizeof(long);
+ }
+
+ // Loop, copying 1 byte
+ char* cdest = (char*)ldest;
+ const char* csrc = (const char*)lsrc;
+ size_t i = 0;
+
+ for (; i < len; ++i)
+ {
+ cdest[i] = csrc[i];
+ }
+
+ return vdest;
+}
+
+void* memmove(void* vdest, const void* vsrc, size_t len)
+{
+ // Copy first-to-last
+ if (vdest <= vsrc)
+ {
+ return memcpy(vdest, vsrc, len);
+ }
+
+ // Copy last-to-first (TO_DO: optimize)
+ char* dest = (char*)(vdest);
+ const char* src = (const char*)(vsrc);
+ size_t i = len;
+
+ for (; i > 0;)
+ {
+ --i;
+ dest[i] = src[i];
+ }
+
+ return vdest;
+}
+
+int memcmp(const void* p1, const void* p2, size_t len)
+{
+ const char* c1 = (const char*)(p1);
+ const char* c2 = (const char*)(p2);
+
+ size_t i = 0;
+
+ for (; i < len; ++i)
+ {
+ long n = (long)(c1[i]) - (long)(c2[i]);
+
+ if (n != 0)
+ {
+ return n;
+ }
+ }
+
+ return 0;
+}
+
+void* memmem(const void* haystack, size_t haystacklen,
+ const void* needle, size_t needlelen)
+{
+ const void* result = NULL;
+
+ if (haystacklen >= needlelen)
+ {
+ const char* c_haystack = (const char*)(haystack);
+ const char* c_needle = (const char*)(needle);
+ bool match = false;
+
+ size_t i = 0;
+
+ for (; i <= (haystacklen - needlelen); i++)
+ {
+ match = true;
+
+ size_t j = 0;
+
+ for (; j < needlelen; j++)
+ {
+ if (*(c_haystack + i + j) != *(c_needle + j))
+ {
+ match = false;
+ break;
+ }
+ }
+
+ if (match)
+ {
+ result = (c_haystack + i);
+ break;
+ }
+ }
+ }
+
+ return (void*)(result);
+}
+
+
+char* strcpy(char* d, const char* s)
+{
+ char* d1 = d;
+
+ do
+ {
+ *d1 = *s;
+
+ if (*s == '\0')
+ {
+ return d;
+ }
+
+ d1++;
+ s++;
+ }
+ while(1);
+}
+
+char* strncpy(char* d, const char* s, size_t l)
+{
+ char* d1 = d;
+ size_t len = 0;
+
+ do
+ {
+ if (len++ >= l)
+ {
+ break;
+ }
+
+ *d1 = *s;
+
+ if (*s == '\0')
+ {
+ break;
+ }
+
+ d1++;
+ s++;
+ }
+ while(1);
+
+ // pad the remainder
+ while( len < l )
+ {
+ d1[len++] = '\0';
+ }
+
+ return d;
+}
+
+int strcmp(const char* a, const char* b)
+{
+ while((*a != '\0') && (*b != '\0'))
+ {
+ if (*a == *b)
+ {
+ a++;
+ b++;
+ }
+ else
+ {
+ return (*a > *b) ? 1 : -1;
+ }
+ }
+
+ if (*a == *b)
+ {
+ return 0;
+ }
+
+ if (*a == '\0')
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+size_t strlen(const char* a)
+{
+ size_t length = 0;
+
+ while(*a++)
+ {
+ length++;
+ }
+
+ return length;
+}
+
+size_t strnlen(const char* s, size_t n)
+{
+ size_t length = 0;
+
+ while((length < n) && (*s++))
+ {
+ length++;
+ }
+
+ return length;
+}
+
+char* strcat(char* d, const char* s)
+{
+ char* _d = d;
+
+ while(*_d)
+ {
+ _d++;
+ }
+
+ while(*s)
+ {
+ *_d = *s;
+ _d++;
+ s++;
+ }
+
+ *_d = '\0';
+
+ return d;
+}
+
+char* strncat(char* d, const char* s, size_t n)
+{
+ char* _d = d;
+
+ while(*_d)
+ {
+ _d++;
+ }
+
+ while((*s) && (0 != n))
+ {
+ *_d = *s;
+ _d++;
+ s++;
+ n--;
+ }
+
+ *_d = '\0';
+
+ return d;
+}
+
+
+char* strchr(const char* s, int c)
+{
+ while((*s != '\0') && (*s != c))
+ {
+ s++;
+ }
+
+ if (*s == c)
+ {
+ return (char*)s;
+ }
+
+ return NULL;
+}
+#ifdef __cplusplus
+};
+#endif
+#endif
diff --git a/src/ppe/pk/ppe42/ppe42_string.h b/src/ppe/pk/ppe42/ppe42_string.h
new file mode 100644
index 0000000..2be664d
--- /dev/null
+++ b/src/ppe/pk/ppe42/ppe42_string.h
@@ -0,0 +1,67 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: chips/p9/procedures/ppe/pk/ppe42/ppe42_string.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* EKB Project */
+/* */
+/* COPYRIGHT 2016 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __STRING_H
+#define __STRING_H
+
+#include <stdint.h>
+typedef uint32_t size_t;
+
+#ifndef NULL
+ #ifdef __cplusplus
+ #define NULL 0
+ #else
+ #define NULL ((void*)0)
+ #endif
+#endif
+
+#ifndef __cplusplus
+ typedef int bool;
+ #define false 0
+ #define true 1
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+void* memset(void* s, int c, size_t n) __attribute__ ((weak));
+// void bzero(void *vdest, size_t len); USE memset
+void* memcpy(void* dest, const void* src, size_t num) __attribute__ ((weak));
+void* memmove(void* vdest, const void* vsrc, size_t len) __attribute__ ((weak));
+int memcmp(const void* p1, const void* p2, size_t len) __attribute__((weak, pure));
+void* memmem(const void* haystack, size_t haystacklen,
+ const void* needle, size_t needlelen) __attribute__((weak, pure));
+
+char* strcpy(char* d, const char* s) __attribute__ ((weak));
+char* strncpy(char* d, const char* s, size_t l) __attribute__ ((weak));
+int strcmp(const char* s1, const char* s2) __attribute__((weak, pure));
+size_t strlen(const char* s1) __attribute__((weak, pure));
+size_t strnlen(const char* s1, size_t n) __attribute__((weak, pure));
+
+char* strcat(char* d, const char* s) __attribute__ ((weak));
+char* strncat(char* d, const char* s, size_t n) __attribute__ ((weak));
+
+char* strchr(const char* s, int c) __attribute__((weak, pure));
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/src/ppe/pk/trace/pk_trace.h b/src/ppe/pk/trace/pk_trace.h
index b93029a..49f6871 100644
--- a/src/ppe/pk/trace/pk_trace.h
+++ b/src/ppe/pk/trace/pk_trace.h
@@ -34,7 +34,7 @@
#define PK_TRACE_VERSION 2
#ifndef PK_TRACE_SZ
-#define PK_TRACE_SZ 256
+#define PK_TRACE_SZ 4096 //@pragupta_todo -- only for debug
#endif
//Fail compilation if size is not a power of 2
OpenPOWER on IntegriCloud