This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GCC proposal for "@" asm constraint


On Tue, Sep 19, 2000 at 10:40:04AM +0200, Jamie Lokier wrote:
> p is a variable.  The _address_ of p is constant, but the reload is
> not loading the address of p, it's loading the _value_.  That value can

Wrong: it's really loading the _address_. The value that is loaded into the
register is the addess of p that is stored only in the .text and that is an
immediate value embedded into the opcodes of the asm.

If you can change the address it it means it's selfmodifying code, and GCC
shouldn't really assume anything about that so GCC is _wrong_.

> Here, the saved cycle is a kernel bug.

Nope. Here it is a disassembly from after the linking of the testcase so you
can see where the value `p' cames from:

080483e0 <main>:
 80483e0:       55                      push   %ebp
 80483e1:       89 e5                   mov    %esp,%ebp
 80483e3:       83 ec 08                sub    $0x8,%esp
 80483e6:       f0 0f ba 2d b8 94 04    lock btsl $0x0,0x80494b8
 80483ed:       08 00 
 80483ef:       0f 82 77 00 00 00       jb     804846c <gcc2_compiled.>
 80483f5:       a1 a4 95 04 08          mov    0x80495a4,%eax
                   ^^^^^^^^^^^                 ^^^^^^^^^
 80483fa:       8b 10                   mov    (%eax),%edx
 80483fc:       f0 0f ba 35 b8 94 04    lock btrl $0x0,0x80494b8
 8048403:       08 00 
 8048405:       f0 0f ba 2d b8 94 04    lock btsl $0x0,0x80494b8
 804840c:       08 00 
 804840e:       0f 82 66 00 00 00       jb     804847a <gcc2_compiled.+0xe>
 8048414:       8b 00                   mov    (%eax),%eax
 8048416:       f0 0f ba 35 b8 94 04    lock btrl $0x0,0x80494b8
 804841d:       08 00 
 804841f:       83 c4 f8                add    $0xfffffff8,%esp
 8048422:       50                      push   %eax
 8048423:       52                      push   %edx
 8048424:       e8 a7 ff ff ff          call   80483d0 <dummy>
 8048429:       89 ec                   mov    %ebp,%esp
 804842b:       5d                      pop    %ebp
 804842c:       c3                      ret    
 804842d:       90                      nop    
 804842e:       90                      nop    
 804842f:       90                      nop    

Andrea

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]