[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/PTHREAD-EMBEDDED 1/2] patches: Add patch for making pte_handle a C++ structure


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Wed, 5 Jun 2019 11:01:19 +0300
  • Cc: felipe.huici@xxxxxxxxx, Teodora Serbanescu <teo.serbanescu16@xxxxxxxxx>
  • Delivery-date: Wed, 05 Jun 2019 08:02:02 +0000
  • Ironport-phdr: 9a23:flGasRecDk7VQtNP4fN5UQDelGMj4u6mDksu8pMizoh2WeGdxcW4bB7h7PlgxGXEQZ/co6odzbaP6ua5BTVLuMzf+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAiroQnLq8UbjpZuJqksxhfXo3ZDZvhby35vKV+PhRj3+92+/IRk8yReuvIh89BPXKDndKkmTrJWESorPXkt6MLkqRfMQw2P5mABUmoNiRpHHxLF7BDhUZjvtCbxq/dw1zObPc3ySrA0RCii4qJ2QxLmlCsLKzg0+3zMh8dukKxUvg6upx1nw47Vfo6VMuZ+frjAdt8eXGZNQ9pdWzBEDo66coABDfcOPfxAoof9uVUAsBWwCwqrCuztxD9FnWP60bEg3ug9CwzKwBAsEtQTu3rUttX1M6ISXPirwanP1jXDc/JW2THg44bObxAhueyMVq93fMXNzkkvDB/FjlSWqYD/OzOVy/wNs3WA4uV8TuKjkXYnqxxqrTS13McsjZDEi4QIwV7H7SV02Js5KNKlREJhYtOpEIFcuz+EO4Z0WM8vTXlktDs1x7Ebo5K2fygHxI45yxPRZfGLaZWE7x39WOuXPDx2nmhqeKiliBa36UWgz+r8WdSq31tStSpFl8XMtmgK1xzO9siLUvt98Vml2TaIzw3T9ORELlo1larfMZIu3qUwmoALsUTeBSD6gl/2jKiOekUl/Oin9fjnb637qpKTKoN4kALzP6Q0lsChH+g1MBICUmaD9eS5zrLj/En5QLtQjv0xl6nUqIzVJcMApq6lAg9V1Jwv6xKiDze+zdQVhmUILElfdBKfkojmIEvCIOr/DfunmVSjjC9rx+zaPr3mGpjNMmbMkLD7cbZm9UFc0hE8wspZ551KEbEOPO/zVlLwudHDAR85Nha7w+fjCNlnyoweXmePCLeDMKzOqV+I+v4vI+6UaY8QuTb9Lfkl5/n1jXMghFASY7ep0oUTaH2jGvRmIl6ZYWb3gtsbHmYFoAw+QPbtiF2YXj5Zf2yyUL4k5jEnFIKmCp/ORo6zj7yF3Se7BoNZanpGClCREHfna4SEVuwKaC2MPsBhliYLWqO7R4A/yBH9/DP9nr9mKOvT4WgUuIzu0PBx5vbPjlci+DoyCN6SgE+XSGQhtWQTWz4wlIRiuVE1nlyEyrR5hbpcCMROz/hSFB8nP9jGyLopWJjJRgvdc4LRGx6dSdK8DGR0F4ppzg==
  • Ironport-sdr: ID+pmOuKMoFtiETn9zIdF0g9qstZhGDcLr93E3yzUXfJ5G3MNvw8PiCJ7aMrIx7aAkfoae3gJq UJyXe6kLgWVA==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

The CXX library requires pthe_handle to be defined as a C++ structure. This
patch also adds the overloaded operators needed by the CXX library.

Signed-off-by: Teodora Serbanescu <teo.serbanescu16@xxxxxxxxx>
---
 .../0009-Make-pte_handle-a-C-structure.patch  | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 patches/0009-Make-pte_handle-a-C-structure.patch

diff --git a/patches/0009-Make-pte_handle-a-C-structure.patch 
b/patches/0009-Make-pte_handle-a-C-structure.patch
new file mode 100644
index 0000000..e1d5fb9
--- /dev/null
+++ b/patches/0009-Make-pte_handle-a-C-structure.patch
@@ -0,0 +1,66 @@
+From 1465fc0bcb52860d6077ae72a8e2364890485fd1 Mon Sep 17 00:00:00 2001
+From: Teodora Serbanescu <teo.serbanescu16@xxxxxxxxx>
+Date: Wed, 5 Jun 2019 10:45:36 +0300
+Subject: [UNIKRAFT/PTHREAD-EMBEDDED] Make pte_handle a C++ structure
+
+This patch changes the pte_handle structure to a C++ structure, also adding the
+overloaded operators needed by the cxx library.
+
+Signed-off-by: Teodora Serbanescu <teo.serbanescu16@xxxxxxxxx>
+---
+ pthread.h | 28 ++++++++++++++++++++++++++++
+ 1 file changed, 28 insertions(+)
+
+diff --git a/pthread.h b/pthread.h
+index 33df446..48625a4 100644
+--- a/pthread.h
++++ b/pthread.h
+@@ -388,10 +388,25 @@ enum
+      * that available with a simple pointer. It should scale for either
+      * IA-32 or IA-64.
+      */
++
++#ifdef __cplusplus
++    typedef struct pte_handle
++#else
+     typedef struct
++#endif
+       {
+         void * p;                   /* Pointer to actual object */
+         unsigned int x;             /* Extra information - reuse count etc */
++
++#ifdef __cplusplus
++        pte_handle() {};
++        pte_handle(int ptr_value)
++        {
++              this->p = reinterpret_cast <void *>(ptr_value);
++        }
++        inline struct pte_handle& operator=(unsigned int ptr_value);
++        inline bool operator==(int ptr_value);
++#endif
+       } pte_handle_t;
+ 
+     typedef pte_handle_t pthread_t;
+@@ -994,6 +1009,19 @@ enum
+     {
+         return ((size_t) l.p) == ((size_t) r.p);
+     }
++
++    /* Operator to compare the thread pointer with a given value */
++    bool pte_handle_t::operator==(int ptr_value)
++    {
++        return ((size_t) this->p) == ((size_t) (reinterpret_cast <void 
*>(ptr_value)));
++    }
++
++    /* Operator to assign a given value to the thread pointer */
++    pte_handle_t& pte_handle_t::operator=(unsigned int ptr_value)
++    {
++              this->p = reinterpret_cast <void *>(ptr_value);
++              return *this;
++    }
+ #endif
+ 
+ 
+-- 
+2.20.1
+
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.