From 6af2316771841cd4d2770fae00d3d147aa11a5d9 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat, 23 May 2015 18:51:56 +0200 Subject: i386: avoid breaking the strict-aliasing rules * i386/i386/pcb.c (switch_ktss): Cleanly convert the value. --- i386/i386/pcb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'i386') diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c index dabe481..3a0eba0 100644 --- a/i386/i386/pcb.c +++ b/i386/i386/pcb.c @@ -193,8 +193,14 @@ void switch_ktss(pcb_t pcb) for (i=0; i < USER_GDT_SLOTS; i++) { if (memcmp(gdt_desc_p (mycpu, USER_GDT + (i << 3)), &pcb->ims.user_gdt[i], sizeof pcb->ims.user_gdt[i])) { + union { + struct real_descriptor real_descriptor; + uint64_t descriptor; + } user_gdt; + user_gdt.real_descriptor = pcb->ims.user_gdt[i]; + if (hyp_do_update_descriptor(kv_to_ma(gdt_desc_p (mycpu, USER_GDT + (i << 3))), - *(uint64_t *) &pcb->ims.user_gdt[i])) + user_gdt.descriptor)) panic("couldn't set user gdt %d\n",i); } } -- cgit v1.2.3