]> Zhao Yanbai Git Server - minix.git/commitdiff
ioapic - missing volatiles
authorTomas Hruby <thruby@few.vu.nl>
Thu, 29 Mar 2012 07:53:38 +0000 (00:53 -0700)
committerTomas Hruby <thruby@few.vu.nl>
Thu, 29 Mar 2012 07:53:38 +0000 (00:53 -0700)
leads to a kernel panic when using clang and SMP

reported by trd <trdempsey.201201@gmail.com>

kernel/arch/i386/apic.c

index cdb601e4a696dc8fb0c59beb1988e84d60bbb87b..69f7c4d94f48c23c0f5b3c8fb4616b904dded336 100644 (file)
@@ -178,14 +178,14 @@ static u32_t lapic_bus_freq[CONFIG_MAX_CPUS];
 
 static u32_t ioapic_read(u32_t ioa_base, u32_t reg)
 {
-       *((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = (reg & 0xff);
-       return *(u32_t *)(ioa_base + IOAPIC_IOWIN);
+       *((volatile u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = (reg & 0xff);
+       return *(volatile u32_t *)(ioa_base + IOAPIC_IOWIN);
 }
 
 static void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val)
 {
-       *((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = reg;
-       *((u32_t *)(ioa_base + IOAPIC_IOWIN)) = val;
+       *((volatile u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = reg;
+       *((volatile u32_t *)(ioa_base + IOAPIC_IOWIN)) = val;
 }
 
 void lapic_microsec_sleep(unsigned count);