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

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



Hi Costin,

This patch looks good, thanks.

-- Felipe

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On 05.06.19, 10:01, "Costin Lupu" <costin.lupu@xxxxxxxxx> wrote:

    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®.