From 2405901bf2cd51bc9a418e21820e0d9c3ce354e7 Mon Sep 17 00:00:00 2001 From: Brennan Ashton Date: Wed, 29 Apr 2020 20:58:03 -0700 Subject: [PATCH] Use mempy to perform type punning for setting gdt entry Signed-off-by: Brennan Ashton --- 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 c45987eb71..7c343275cd 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;