From: Christian Franke <Christian.Franke@t-online.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Fix eisa_mmap evaluation, add memory existence check
Date: Sat, 10 Nov 2007 20:53:40 +0100 [thread overview]
Message-ID: <47360C44.6050906@t-online.de> (raw)
In-Reply-To: <87zlxmgkhh.fsf@xs4all.nl>
Marco Gerards wrote:
> Christian Franke <Christian.Franke@t-online.de> 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
next prev parent reply other threads:[~2007-11-10 19:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-23 19:06 [PATCH] Fix eisa_mmap evaluation, add memory existence check Christian Franke
2007-10-23 20:18 ` Robert Millan
2007-10-23 20:36 ` Christian Franke
2007-11-09 14:17 ` Marco Gerards
2007-11-09 23:12 ` Christian Franke
2007-11-10 15:59 ` Marco Gerards
2007-11-10 19:53 ` Christian Franke [this message]
2007-11-09 20:51 ` Robert Millan
2007-11-09 21:53 ` Christian Franke
2007-11-09 22:51 ` Robert Millan
2007-11-18 11:09 ` Marco Gerards
2007-11-18 11:21 ` Robert Millan
2007-11-18 11:27 ` Robert Millan
2007-11-18 12:26 ` Robert Millan
2007-11-19 21:40 ` Christian Franke
2007-12-31 15:40 ` Christian Franke
2008-01-01 11:16 ` Robert Millan
2008-01-01 17:26 ` Christian Franke
2008-01-01 17:44 ` Robert Millan
2008-01-01 18:03 ` Christian Franke
2008-01-01 18:33 ` Robert Millan
2008-01-04 11:49 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47360C44.6050906@t-online.de \
--to=christian.franke@t-online.de \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox