This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e8c512942e include/nuttx/rptun: pack struct rptun_rsc_s
5e8c512942e is described below

commit 5e8c512942eb20d980a2f8a09a6fdb6c2cc3a6ec
Author: wangshaoxin <[email protected]>
AuthorDate: Thu Oct 23 11:48:13 2025 +0800

    include/nuttx/rptun: pack struct rptun_rsc_s
    
    struct rptun_rsc_s mirrors the resource table layout that the remote
    side parses through struct fw_rsc_vdev and friends, which openamp
    declares packed.  rptun_rsc_s itself was only aligned(8), so a
    compiler is free to insert padding between its members.  With the
    TASKING compiler the offset of rpmsg_vring0 seen through rptun_rsc_s
    differed from the offset seen through fw_rsc_vdev, and the remote read
    the wrong vring.
    
    Declare it packed like the structures it contains.  With GCC the
    member offsets and the size are unchanged (checked on sim and
    qemu-armv8a); only the type alignment drops from 8 to 1.
    
    Signed-off-by: wangshaoxin <[email protected]>
---
 include/nuttx/rptun/rptun.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/nuttx/rptun/rptun.h b/include/nuttx/rptun/rptun.h
index cf117461379..411c9065269 100644
--- a/include/nuttx/rptun/rptun.h
+++ b/include/nuttx/rptun/rptun.h
@@ -335,7 +335,7 @@ begin_packed_struct struct rptun_cmd_s
   uint32_t cmd_slave;
 } end_packed_struct;
 
-struct aligned_data(8) rptun_rsc_s
+begin_packed_struct struct rptun_rsc_s
 {
   struct resource_table    rsc_tbl_hdr;
   uint32_t                 offset[3];
@@ -345,7 +345,7 @@ struct aligned_data(8) rptun_rsc_s
   struct fw_rsc_vdev_vring rpmsg_vring1;
   struct fw_rsc_config     config;
   struct fw_rsc_carveout   carveout;
-};
+} end_packed_struct;
 
 struct rptun_dev_s;
 struct rptun_ops_s

Reply via email to