[Devel] Re: [PATCH] mark read_crX() asm code as volatile
H. Peter Anvin
hpa at zytor.com
Tue Oct 2 23:18:22 PDT 2007
Nick Piggin wrote:
>>
>> This should work because the result gets used before reading again:
>>
>> read_cr3(a);
>> write_cr3(a | 1);
>> read_cr3(a);
>>
>> But this might be reordered so that b gets read before the write:
>>
>> read_cr3(a);
>> write_cr3(a | 1);
>> read_cr3(b);
>>
>> ?
>
> I don't see how, as write_cr3 clobbers memory.
Because read_cr3() doesn't depend on memory, and b could be stored in a
register.
-hpa
More information about the Devel
mailing list