|
From: | Christian Franke |
Subject: | Re: [PATCH] Fix eisa_mmap evaluation, add memory existence check |
Date: | Sat, 10 Nov 2007 20:53:40 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 |
Marco Gerards wrote:
Christian Franke <address@hidden> writes:... volatile is necessary here to tell the complier that the memory address might not behave like regular memory. Otherwise, the optimizer might legitimately remove memory accesses and then constant propagation detects an unchanged value. gcc actually does a very good job here. Result with volatile removed:I think this is just normal memory, not memory mapped hardware. Or perhaps I am misunderstanding something here.
It is normal memory - but only if present :-) Like memory mapped hardware, missing memory violates the optimizers assumptions about memory accesses. Therefore, volatile is mandatory here.
$ gcc -S -O -fomit-frame-pointer init.c && cat init.s ... addr_is_valid: movl $1, %eax ret ... aka: static int addr_is_valid (grub_addr_t addr) { return 1; } This is at least a proof that the original function returns the correct result when real memory is present :-):-)
BTW: this also proves that the routine leaves memory unchanged. Christian
[Prev in Thread] | Current Thread | [Next in Thread] |