[rtems-central commit] spec: Specify thread-local storage

Sebastian Huber sebh at rtems.org
Thu Aug 12 06:30:36 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    c2e657b9bb348b5e98049df558d28829a52952e6
Changeset: http://git.rtems.org/rtems-central/commit/?id=c2e657b9bb348b5e98049df558d28829a52952e6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Aug 11 10:48:12 2021 +0200

spec: Specify thread-local storage

---

 spec/constraint/tls-alignment-power-of-2.yml       | 11 ++++
 spec/score/thread/req/tls-big-alignment.yml        | 15 ++++++
 spec/score/thread/req/tls-initialized-data.yml     | 15 ++++++
 .../score/thread/req/tls-zero-initialized-data.yml | 15 ++++++
 spec/score/thread/val/tls.yml                      | 63 ++++++++++++++++++++++
 spec/testsuites/validation-tls-0.yml               | 22 ++++++++
 6 files changed, 141 insertions(+)

diff --git a/spec/constraint/tls-alignment-power-of-2.yml b/spec/constraint/tls-alignment-power-of-2.yml
new file mode 100644
index 0000000..1b90213
--- /dev/null
+++ b/spec/constraint/tls-alignment-power-of-2.yml
@@ -0,0 +1,11 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: /req/usage-constraints
+rationale: null
+text: |
+  The alignment of thread-local storage objects shall be a power of two.
+type: constraint
diff --git a/spec/score/thread/req/tls-big-alignment.yml b/spec/score/thread/req/tls-big-alignment.yml
new file mode 100644
index 0000000..43f7aca
--- /dev/null
+++ b/spec/score/thread/req/tls-big-alignment.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: ../if/group
+functional-type: capability
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  The alignment of thread-local storage objects may be greater than
+  ${../../cpu/if/stack-alignment:/name}.
+type: requirement
diff --git a/spec/score/thread/req/tls-initialized-data.yml b/spec/score/thread/req/tls-initialized-data.yml
new file mode 100644
index 0000000..afe17ef
--- /dev/null
+++ b/spec/score/thread/req/tls-initialized-data.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: ../if/group
+functional-type: capability
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  While the thread entry execution begins, the value of non-zero initialized
+  thread-local storage objects shall be the initialization value.
+type: requirement
diff --git a/spec/score/thread/req/tls-zero-initialized-data.yml b/spec/score/thread/req/tls-zero-initialized-data.yml
new file mode 100644
index 0000000..91d01e8
--- /dev/null
+++ b/spec/score/thread/req/tls-zero-initialized-data.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: ../if/group
+functional-type: capability
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  While the thread entry execution begins, the storage space of zero
+  initialized thread-local storage objects shall be cleared to zero.
+type: requirement
diff --git a/spec/score/thread/val/tls.yml b/spec/score/thread/val/tls.yml
new file mode 100644
index 0000000..35d8e8a
--- /dev/null
+++ b/spec/score/thread/val/tls.yml
@@ -0,0 +1,63 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links: []
+test-actions:
+- action-brief: |
+    The test action is carried out by the thread-local objects definition.
+  action-code: |
+    /* Nothing to do */
+  checks:
+  - brief: |
+      Check that the initial value of the zero initialized thread-local
+      object has the expected value.
+    code: |
+      T_step_eq_int( ${step}, tls_object_0, 0 );
+    links:
+    - role: validation
+      uid: ../req/tls-zero-initialized-data
+  - brief: |
+      Check that the alignment of the zero initialized thread-local
+      object has the expected value.
+    code: |
+      T_step_eq_uptr( ${step}, ( (uintptr_t) &tls_object_0 ) % 256, 0 );
+    links:
+    - role: validation
+      uid: ../req/tls-big-alignment
+  - brief: |
+      Check that the initial value of the non-zero initialized thread-local
+      object has the expected value.
+    code: |
+      T_step_eq_int( ${step}, tls_object_1, 123 );
+    links:
+    - role: validation
+      uid: ../req/tls-initialized-data
+  - brief: |
+      Check that the alignment of the non-zero initialized thread-local object
+      has the expected value.
+    code: |
+      T_step_eq_uptr( ${step}, ( (uintptr_t) &tls_object_1 ) % 256, 0 );
+    links:
+    - role: validation
+      uid: ../req/tls-big-alignment
+  links: []
+test-brief: |
+  Tests properties of thread-local objects.
+test-context: []
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes:
+- tx-support.h
+test-setup: null
+test-stop: null
+test-support: |
+  static RTEMS_ALIGNED( 256 ) _Thread_local int volatile tls_object_0;
+
+  static RTEMS_ALIGNED( 256 ) _Thread_local int volatile tls_object_1 = 123;
+test-target: testsuites/validation/tc-score-thread-tls.c
+test-teardown: null
+type: test-case
diff --git a/spec/testsuites/validation-tls-0.yml b/spec/testsuites/validation-tls-0.yml
new file mode 100644
index 0000000..1c2e5cf
--- /dev/null
+++ b/spec/testsuites/validation-tls-0.yml
@@ -0,0 +1,22 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: /req/test-suites
+test-brief: |
+  This validation test suite contains test cases related to the thread-local
+  storage support.
+test-code: |
+  const char rtems_test_name[] = "${.:/test-suite-name}";
+
+  #define MAX_TLS_SIZE 1024
+
+  #include "ts-default.h"
+test-description: null
+test-includes: []
+test-local-includes: []
+test-suite-name: ValidationTls0
+test-target: testsuites/validation/ts-validation-tls-0.c
+type: test-suite



More information about the vc mailing list