From 0adf212462d82b4dbe048928ca6c3fc867e8d71f Mon Sep 17 00:00:00 2001
From: Adrian Danis <Adrian.Danis@nicta.com.au>
Date: Tue, 13 Jan 2015 14:22:29 +1100
Subject: [PATCH] libsel4: Ensure the ARM syscall stubs always treat instances
 of seL4_MessageInfo as POD

A C++ compiler will attempt to interpret 'return info' as an invocation of a copy
constructor. Even though the copy constructor is auto-generated (and eventually
completely eliminated due to inlining) and just does obvious member copying it
still results in an intermediate invocation that must take a reference to 'info'.
Because 'info' is a register variable it is not permissable to take a reference
to it. Manually reconstructing a new info from the .words keeps everything as
Plain Old Data
---
 libsel4/arch_include/arm/sel4/arch/syscalls.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libsel4/arch_include/arm/sel4/arch/syscalls.h b/libsel4/arch_include/arm/sel4/arch/syscalls.h
index 5fba47955..e073d8023 100644
--- a/libsel4/arch_include/arm/sel4/arch/syscalls.h
+++ b/libsel4/arch_include/arm/sel4/arch/syscalls.h
@@ -237,7 +237,7 @@ seL4_Wait(seL4_CPtr src, seL4_Word* sender)
     if (sender) {
         *sender = src_and_badge;
     }
-    return info;
+    return (seL4_MessageInfo_t){.words = {info.words[0]}};
 }
 
 static inline seL4_MessageInfo_t
@@ -279,7 +279,7 @@ seL4_WaitWithMRs(seL4_CPtr src, seL4_Word* sender,
     if (sender) {
         *sender = src_and_badge;
     }
-    return info;
+    return (seL4_MessageInfo_t){.words = {info.words[0]}};
 }
 
 static inline seL4_MessageInfo_t
@@ -308,7 +308,7 @@ seL4_Call(seL4_CPtr dest, seL4_MessageInfo_t msgInfo)
     seL4_SetMR(2, msg2);
     seL4_SetMR(3, msg3);
 
-    return info;
+    return (seL4_MessageInfo_t){.words = {info.words[0]}};
 }
 
 static inline seL4_MessageInfo_t
@@ -359,7 +359,7 @@ seL4_CallWithMRs(seL4_CPtr dest, seL4_MessageInfo_t msgInfo,
         *mr3 = msg3;
     }
 
-    return info;
+    return (seL4_MessageInfo_t){.words = {info.words[0]}};
 }
 
 static inline seL4_MessageInfo_t
@@ -392,7 +392,7 @@ seL4_ReplyWait(seL4_CPtr src, seL4_MessageInfo_t msgInfo, seL4_Word *sender)
     if (sender) {
         *sender = src_and_badge;
     }
-    return info;
+    return (seL4_MessageInfo_t){.words = {info.words[0]}};
 }
 
 static inline seL4_MessageInfo_t
@@ -447,7 +447,7 @@ seL4_ReplyWaitWithMRs(seL4_CPtr src, seL4_MessageInfo_t msgInfo, seL4_Word *send
     if (sender) {
         *sender = src_and_badge;
     }
-    return info;
+    return (seL4_MessageInfo_t){.words = {info.words[0]}};
 }
 
 static inline void
-- 
GitLab