[PATCH] cpu-supplement/sparc_v8_stacks_regwin.rst: Complete Formatting

2018-11-19 Thread Marçal Comajoan Cara
This work was part of GCI 2018.
---
 cpu-supplement/sparc_v8_stacks_regwin.rst | 97 +++
 1 file changed, 48 insertions(+), 49 deletions(-)

diff --git a/cpu-supplement/sparc_v8_stacks_regwin.rst 
b/cpu-supplement/sparc_v8_stacks_regwin.rst
index 0efba1b..19a62ab 100644
--- a/cpu-supplement/sparc_v8_stacks_regwin.rst
+++ b/cpu-supplement/sparc_v8_stacks_regwin.rst
@@ -28,13 +28,13 @@ variable number of registers is the principal reason for 
the SPARC being
 At any given time, only one window is visible, as determined by the
 current window pointer (CWP) which is part of the processor status
 register (PSR). This is a five bit value that can be decremented or
-incremented by the SAVE and RESTORE instructions, respectively. These
+incremented by the ``save`` and ``restore`` instructions, respectively. These
 instructions are generally executed on procedure call and return
 (respectively). The idea is that the ``in`` registers contain incoming
 parameters, the ``local`` register constitutes scratch registers, the ``out``
 registers contain outgoing parameters, and the ``global`` registers contain
 values that vary little between executions. The register windows overlap
-partially, thus the ``out`` registers become renamed by SAVE to become the
+partially, thus the ``out`` registers become renamed by ``save`` to become the
 ``in`` registers of the called procedure. Thus, the memory traffic is reduced
 when going up and down the procedure call. Since this is a frequent
 operation, performance is improved.
@@ -53,18 +53,18 @@ from the architecture.)
 
 .. table:: Table 1 - Visible Registers
 
-+++---+
-|   Register |  Mnemonic  |   Register|
-|   Group||   Address |
-+++===+
-+   ``global``   +  %g0-%g7   + r[0] - r[7]   +
-+++---+
-+``out`` +  %o0-%o7   + r[8] - r[15]  +
-+++---+
-+   ``local``+  %l0-%l7   + r[16] - r[23] +
-+++---+
-+``in``  +  %i0-%i7   + r[24] - r[31] +
-+++---+
+++---++
+|   Register |  Mnemonic |   Register |
+|   Group|   |   Address  |
+++===++
++   ``global``   +  ``%g0``-``%g7``  +  r[0] - r[7]   +
+++---++
++``out`` +  ``%o0``-``%o7``  +  r[8] - r[15]  +
+++---++
++   ``local``+  ``%l0``-``%l7``  +  r[16] - r[23] +
+++---++
++``in``  +  ``%i0``-``%i7``  +  r[24] - r[31] +
+++---++
 
 
 The overlap of the registers is illustrated in figure 1. The figure
@@ -73,9 +73,9 @@ w7 in the figure). Each window corresponds to 24 registers, 
16 of which
 are shared with "neighboring" windows. The windows are arranged in a
 wrap-around manner, thus window number 0 borders window number 7. The
 common cause of changing the current window, as pointed to by CWP, is
-the RESTORE and SAVE instructions, shown in the middle. Less common is
-the supervisor RETT instruction (return from trap) and the trap event
-(interrupt, exception, or TRAP instruction).
+the ``restore`` and ``save`` instructions, shown in the middle. Less common is
+the supervisor ``rett`` instruction (return from trap) and the trap event
+(interrupt, exception, or ``trap`` instruction).
 
 .. figure:: ../images/cpu_supplement/sparcwin.png
 
@@ -154,11 +154,11 @@ Figure 2 shows a summary of register contents at any 
given time.
 
 Particular compilers are likely to vary slightly.
 
-Note that globals %g2-%g4 are reserved for the "application", which
+Note that globals ``%g2``-``%g4`` are reserved for the "application", which
 includes libraries and compiler. Thus, for example, libraries may
 overwrite these registers unless they've been compiled with suitable
 flags. Also, the "reserved" registers are presumed to be allocated
-(in the future) bottom-up, i.e. %g7 is currently the "safest" to use.
+(in the future) bottom-up, i.e. ``%g7`` is currently the "safest" to use.
 
 Optimizing linkers and interpreters are examples that use global registers.
 
@@ -166,10 +166,10 @@ Register Windows and the Stack
 --
 
 The SPARC register windows are, naturally, intimately related to the
-stack. In particular, the stack pointer (%sp or %o6) must always point
+stack. In particular, the stack pointer (``%sp`` or ``%o6``) must always point
 to a free block of 64 bytes. This area is used by the operating system
 (Solaris, SunOS, and Linux at least) to save the current ``local`` 

psxtmmutexattr01: Add new POSIX timing suite -v2 (GCI 2018)

2018-11-19 Thread Himanshu Sekhar Nayak
Hi guys,

Here is the updated patch with removing a comment.

Thanks
Himanshu
From ae6e00db59a2f7c429b9af14d8c05c0eeda4b008 Mon Sep 17 00:00:00 2001
From: Himanshu40 
Date: Tue, 20 Nov 2018 06:41:58 +0530
Subject: [PATCH] psxtmutexattr01: Added new POSIX timing suite -v2 (GCI 2018)

---
 testsuites/psxtmtests/Makefile.am |  11 +
 testsuites/psxtmtests/configure.ac|   1 +
 testsuites/psxtmtests/psxtmmutexattr01/init.c | 277 ++
 .../psxtmmutexattr01/psxtmmutexattr01.doc |  27 ++
 testsuites/psxtmtests/psxtmtests_plan.csv |  11 +
 5 files changed, 327 insertions(+)
 create mode 100644 testsuites/psxtmtests/psxtmmutexattr01/init.c
 create mode 100644 testsuites/psxtmtests/psxtmmutexattr01/psxtmmutexattr01.doc

diff --git a/testsuites/psxtmtests/Makefile.am b/testsuites/psxtmtests/Makefile.am
index 1101a5b447..920ff6e081 100644
--- a/testsuites/psxtmtests/Makefile.am
+++ b/testsuites/psxtmtests/Makefile.am
@@ -326,6 +326,17 @@ psxtmmutex07_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxtmmutex07) \
 	-DOPERATION_COUNT=$(OPERATION_COUNT)
 endif
 
+if TEST_psxtmmutexattr01
+psxtm_tests += psxtmmutexattr01
+psxtm_docs += psxtmmutexattr01/psxtmmutexattr01.doc
+psxtmmutexattr01_SOURCES = psxtmmutexattr01/init.c \
+	../tmtests/include/timesys.h ../support/src/tmtests_empty_function.c \
+	../support/src/tmtests_support.c
+psxtmmutexattr01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxtmmutexattr01) \
+	$(support_includes) -I$(top_srcdir)/../tmtests/include \
+	-DOPERATION_COUNT=$(OPERATION_COUNT)
+endif
+
 if TEST_psxtmnanosleep01
 psxtm_tests += psxtmnanosleep01
 psxtm_docs += psxtmnanosleep01/psxtmnanosleep01.doc
diff --git a/testsuites/psxtmtests/configure.ac b/testsuites/psxtmtests/configure.ac
index eff7067959..b8b50684be 100644
--- a/testsuites/psxtmtests/configure.ac
+++ b/testsuites/psxtmtests/configure.ac
@@ -58,6 +58,7 @@ RTEMS_TEST_CHECK([psxtmmutex04])
 RTEMS_TEST_CHECK([psxtmmutex05])
 RTEMS_TEST_CHECK([psxtmmutex06])
 RTEMS_TEST_CHECK([psxtmmutex07])
+RTEMS_TEST_CHECK([psxtmmutexattr01]
 RTEMS_TEST_CHECK([psxtmnanosleep01])
 RTEMS_TEST_CHECK([psxtmnanosleep02])
 RTEMS_TEST_CHECK([psxtmonce01])
diff --git a/testsuites/psxtmtests/psxtmmutexattr01/init.c b/testsuites/psxtmtests/psxtmmutexattr01/init.c
new file mode 100644
index 00..6998c16d59
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmmutexattr01/init.c
@@ -0,0 +1,277 @@
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak( GCI 2018 )
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "test_support.h"
+
+const char rtems_test_name[] = "PSXTMMUTEXATTR01";
+
+/* forward declarations to avoid warnings */
+static void *POSIX_Init(void *argument);
+
+static pthread_mutexattr_t attr;
+
+static void benchmark_create_pthread_mutexattr(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+  status = pthread_mutexattr_init(  );
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+"pthread_mutexattr_init: only case",
+end_time,
+1,/* Only executed once */
+0,
+0
+  );
+
+}
+
+static void benchmark_pthread_mutexattr_setprioceiling(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+  status = pthread_mutexattr_setprioceiling( , SCHED_FIFO);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+
+  put_time(
+"pthread_mutexattr_setprioceiling: only case",
+end_time,
+1,/* Only executed once */
+0,
+0
+  );
+
+}
+
+static void benchmark_pthread_mutexattr_getprioceiling(void)
+{
+  long end_time;
+  int  status;
+  int prioceiling;
+
+  benchmark_timer_initialize();
+  status = pthread_mutexattr_getprioceiling( , );
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+  rtems_test_assert( prioceiling == SCHED_FIFO);
+
+  put_time(
+"pthread_mutexattr_getprioceiling: only case",
+end_time,
+1,/* Only executed once */
+0,
+0
+  );
+
+}
+
+static void benchmark_pthread_mutexattr_setprotocol(void)
+{
+  long end_time;
+  int  status;
+
+  benchmark_timer_initialize();
+  status = pthread_mutexattr_setprotocol( , PTHREAD_PRIO_INHERIT );
+  end_time = benchmark_timer_read();
+  

LwIP integration - mapping RTEMS FDs to LwIP ones

2018-11-19 Thread Pavel Pisa
Hello Antonio,

I have noticed that you have tried to map
RTEMS network applications to LwIP.
You have tried to use LwIP headers instead
of NewLib provided ones. To integrate read, write,
close etc. correctly it is necessary to use
RTEMS FDs and map them to LwIP ones.

See my description in RTEMS Wiki

  https://devel.rtems.org/wiki/Packages/LWIP

I have tried to implement this mapping based on original
RETMS network stack cpukit/libnetworking/rtems/rtems_syscall.c file.
There is the result

  
https://github.com/ppisa/rtems-devel/blob/master/rtems-omk-template/applwiptest/rtems_lwip_io.c

I have been able to run RTEMS provided telnetd over this
IP stack replacement on TMS570LS3137.

See telned startup fragment at starting lines 58 and 155 of example application

  
https://github.com/ppisa/rtems-devel/blob/master/rtems-omk-template/applwiptest/init.c#L58

Because LwIP sockaddr type can in general differ and AF_XXX and PF_XXX differ 
between NewLib
and LwIP there is implemented layer to translate NewLib application types and 
defines to
from/to LwIP ones

  
​https://github.com/ppisa/rtems-devel/blob/master/rtems-omk-template/applwiptest/rtems_lwip_int.h

  
​https://github.com/ppisa/rtems-devel/blob/master/rtems-omk-template/applwiptest/rtems_lwip_sysdefs.c

I have revised actual sockaddr types and it seems that they should
compile to same fields types and offset. So that part of the
file is probably not required. I have removed RTEMS provided archives

  ar d librtemscpu.a in_proto.o ip_fw.o ip_icmp.o ip_input.o \
 main_netstats.o main_ping.o rtems_syscall.o \
 tcp_debug.o tcp_input.o tcp_output.o tcp_subr.o \
 tcp_timer.o tcp_usrreq.o udp_usrreq.o

and replaced them by

   ar r librtemscpu.a rtems_lwip_sysdefs.o rtems_lwip_io.o

I have used already described mapping to LwIP

  https://sourceforge.net/p/ulan/lwip-omk/ci/master/tree/ports/os/rtems/arch/

LwIP stack is our code with OMK build system, probably some simpler
RTEMS only build tree can be prepared

  https://sourceforge.net/p/ulan/lwip-omk/ci/master/tree/

Test application together with links to LwIP has been build
from OMK templete

  https://github.com/ppisa/rtems-devel/tree/master/rtems-omk-template

config.target:

RTEMS_MAKEFILE_PATH=/opt/rtems5.0/arm-rtems5.0/tms570ls3137_hdk_sdram


config.omk:

CONFIG_OC_APP_APPLWIPTEST=y
CONFIG_OC_APP_APPLWIPTEST_RTEMS_IO=y
CONFIG_OC_APP_APPLWIPTEST_TELNETD=y

CONFIG_LWIP_LIB=y

CONFIG_LWIP_LWIP_IPV4=y
#CONFIG_LWIP_LWIP_SNMP=y
CONFIG_LWIP_LWIP_ARP=y

CONFIG_LWIP_OS_PORT = rtems
CONFIG_LWIP_DEVICE_DRIVERS = tms570_emac

#lwipots
CONFIG_LWIP_STATIC_IP_ADDRESS=0

CONFIG_LWIP_HOST_TMR_INTERVAL=0
#CONFIG_LWIP_DYNAMIC_HTTP_HEADERS=y vypnul jsem ja

CONFIG_LWIP_SYS_LIGHTWEIGHT_PROT=1
CONFIG_LWIP_LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT=1

#CONFIG_LWIP_MEMP_OVERFLOW_CHECK=2
#CONFIG_LWIP_MEMP_SANITY_CHECK=y
CONFIG_LWIP_MEMP_SEPARATE_POOLS=y
CONFIG_LWIP_NO_SYS=0

CONFIG_LWIP_TCPIP_THREAD_PRIO=5
CONFIG_LWIP_TCPIP_THREAD_STACKSIZE=8192

CONFIG_LWIP_MEM_LIBC_MALLOC=0
#CONFIG_LWIP_MBOX_SIZE=4
CONFIG_LWIP_MEM_ALIGNMENT=4
CONFIG_LWIP_MEM_SIZE=(64*1024)
CONFIG_LWIP_MEMP_NUM_PBUF=48
CONFIG_LWIP_MEMP_NUM_TCP_PCB=32
CONFIG_LWIP_PBUF_POOL_SIZE=256
CONFIG_LWIP_MEMP_NUM_TCPIP_MSG_INPKT=50
CONFIG_LWIP_MEMP_NUM_TCPIP_MSG_API=30 

CONFIG_LWIP_IP_REASSEMBLY=0
CONFIG_LWIP_IP_FRAG=0

CONFIG_LWIP_LWIP_DHCP=1
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=0

CONFIG_LWIP_LWIP_AUTOIP=0

CONFIG_LWIP_TCP_MSS=512
CONFIG_LWIP_TCP_WND=(512*4)
CONFIG_LWIP_TCP_SND_BUF=(512*4)

CONFIG_LWIP_PBUF_LINK_HLEN=14
CONFIG_LWIP_PBUF_POOL_BUFSIZE=256

CONFIG_LWIP_ETH_PAD_SIZE=0
CONFIG_LWIP_MEMP_NUM_NETCONN=10

CONFIG_LWIP_LWIP_NETCONN=1
CONFIG_LWIP_LWIP_SOCKET=1
CONFIG_LWIP_LWIP_SO_RCVTIMEO=1

CONFIG_LWIP_TCPIP_MBOX_SIZE=100
CONFIG_LWIP_DEFAULT_RAW_RECVMBOX_SIZE=100
CONFIG_LWIP_DEFAULT_UDP_RECVMBOX_SIZE=100
CONFIG_LWIP_DEFAULT_TCP_RECVMBOX_SIZE=100
CONFIG_LWIP_DEFAULT_ACCEPTMBOX_SIZE=100

CONFIG_LWIP_LWIP_STATS_DISPLAY=y
CONFIG_LWIP_LWIP_STATS=1
CONFIG_LWIP_MEMP_STATS=y
CONFIG_LWIP_MEM_STATS=y
#CONFIG_LWIP_ALL_DBG_ON=1
CONFIG_LWIP_LWIP_NETIF_API=1


Best wishes,

Pavel Pisa

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

pthread_mutexattr_setrobust/pthread_mutexattr_getrobust didn't recognize by (GCI 2018)

2018-11-19 Thread Himanshu Sekhar Nayak
Hi guys,
Currently I am working under a new test suite "psxtmmutexattr01" where all
test cases works with  except
"pthread_mutexattr_setrobust/pthread_mutexattr_getrobust".

I had searched on internet that we have to declare a macro test for that
and I had done by giving #define _GNU_SOURCE but seems it doesn't works.
Any resolution ?

Thanks
Himanshu
/*
 *  COPYRIGHT (c) 2018.
 *  Himanshu Sekhar Nayak(GCI 2018)
 *
 *  Permission to use, copy, modify, and/or distribute this software
 *  for any purpose with or without fee is hereby granted.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
 *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
 *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
 *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
 *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#define _GNU_SOURCE

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include 
#include 
#include 
#include 
#include 
#include "test_support.h"

const char rtems_test_name[] = "PSXTMMUTEXATTR01";

/* forward declarations to avoid warnings */
static void *POSIX_Init(void *argument);

static pthread_mutexattr_t attr;

static void benchmark_create_pthread_mutexattr(void)
{
  long end_time;
  int  status;

  benchmark_timer_initialize();
  status = pthread_mutexattr_init(  );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );

  put_time(
"pthread_mutexattr_init: only case",
end_time,
1,/* Only executed once */
0,
0
  );

}

static void benchmark_pthread_mutexattr_setprioceiling(void)
{
  long end_time;
  int  status;

  benchmark_timer_initialize();
  status = pthread_mutexattr_setprioceiling( , SCHED_FIFO);
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );

  put_time(
"pthread_mutexattr_setprioceiling: only case",
end_time,
1,/* Only executed once */
0,
0
  );

}

static void benchmark_pthread_mutexattr_getprioceiling(void)
{
  long end_time;
  int  status;
  int prioceiling;

  benchmark_timer_initialize();
  status = pthread_mutexattr_getprioceiling( , );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );
  rtems_test_assert( prioceiling == SCHED_FIFO);

  put_time(
"pthread_mutexattr_getprioceiling: only case",
end_time,
1,/* Only executed once */
0,
0
  );

}

static void benchmark_pthread_mutexattr_setprotocol(void)
{
  long end_time;
  int  status;

  benchmark_timer_initialize();
  status = pthread_mutexattr_setprotocol( , PTHREAD_PRIO_INHERIT );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );

  put_time(
"pthread_mutexattr_setprotocol: only case",
end_time,
1,/* Only executed once */
0,
0
  );

}

static void benchmark_pthread_mutexattr_getprotocol(void)
{
  long end_time;
  int  status;
  int protocol;

  benchmark_timer_initialize();
  status = pthread_mutexattr_getprotocol( ,  );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );
  rtems_test_assert( protocol == PTHREAD_PRIO_INHERIT );

  put_time(
"pthread_mutexattr_getprotocol: only case",
end_time,
1,/* Only executed once */
0,
0
  );

}

static void benchmark_pthread_mutexattr_setpshared(void)
{
  long end_time;
  int  status;

  benchmark_timer_initialize();
  status = pthread_mutexattr_setpshared( , PTHREAD_PROCESS_PRIVATE );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );

  put_time(
"pthread_mutexattr_setpshared: only case",
end_time,
1,/* Only executed once */
0,
0
  );

}

static void benchmark_pthread_mutexattr_getpshared(void)
{
  long end_time;
  int  status;
  int pshared;

  benchmark_timer_initialize();
  status = pthread_mutexattr_getpshared( ,  );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );
  rtems_test_assert( pshared == PTHREAD_PROCESS_PRIVATE );

  put_time(
"pthread_mutexattr_getpshared: only case",
end_time,
1,/* Only executed once */
0,
0
  );

}

static void benchmark_pthread_mutexattr_setrobust(void)
{
  long end_time;
  int  status;

  benchmark_timer_initialize();
  status = pthread_mutexattr_setrobust( , PTHREAD_MUTEX_ROBUST );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );

  put_time(
"pthread_mutexattr_setrobust: only case",
end_time,
1,/* Only executed once */
0,
0
  );

}

static void benchmark_pthread_mutexattr_getrobust(void)
{
  long end_time;
  int  status;
  int robustness;

  benchmark_timer_initialize();
  status = pthread_mutexattr_getrobust( ,  );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );
  rtems_test_assert(