Ive noticed the lack of any memory barriers in some of the wiki code snippets.
Have I completely misunderstood out-of-order execution ?
for example, take the following code snipped from the IO-APIC wiki page.
Code: Select all
void write_ioapic_register(const ptr_t apic_base, const uint8_t offset, const uint32_t val)
{
/* tell IOREGSEL where we want to write to */
*(uint32_t*)(apic_base) = offset;
/* write the value to IOWIN */
*(uint32_t*)(apic_base + 0x10) = val;
}
Surely the out of order execution engine isn't clever enough to see the virtual address writes are mapped to the IOAPIC ?
Thanks.