You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/05/04 14:32:38 UTC

[incubator-nuttx] 04/05: Use mempy to perform type punning for setting gdt entry

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

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

commit 2405901bf2cd51bc9a418e21820e0d9c3ce354e7
Author: Brennan Ashton <ba...@brennanashton.com>
AuthorDate: Wed Apr 29 20:58:03 2020 -0700

    Use mempy to perform type punning for setting gdt entry
    
    Signed-off-by: Brennan Ashton <ba...@brennanashton.com>
---
 arch/x86_64/src/intel64/up_irq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86_64/src/intel64/up_irq.c b/arch/x86_64/src/intel64/up_irq.c
index c45987e..7c34327 100644
--- a/arch/x86_64/src/intel64/up_irq.c
+++ b/arch/x86_64/src/intel64/up_irq.c
@@ -190,7 +190,10 @@ static void up_ist_init(void)
   tss_h = (((uintptr_t)ist64 >> 32) & 0xffffffff);  /* High address */
 
   gdt64[X86_GDT_ISTL_SEL_NUM] = tss_l;
-  gdt64[X86_GDT_ISTH_SEL_NUM] = *((struct gdt_entry_s *)&tss_h);
+
+  /* memcpy used to handle type punning compiler warning */
+
+  memcpy((void *)&gdt64[X86_GDT_ISTH_SEL_NUM], (void *)&tss_h, sizeof(gdt64[0]));
 
   ist64->IST1 = (uintptr_t)g_interrupt_stack_end;
   ist64->IST2 = (uintptr_t)g_isr_stack_end;