Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #126 (closed defect: fixed)

Opened 2 months ago

Last modified 1 month ago

inline asm segmented addresses with offset 0 not translated correctly

Reported by: elrood Assigned to:
Priority: major Milestone:
Component: Version:
Keywords: Cc:

Description

segmented addresses with an offset of 0 in inline assembly like FS:[0] aren't transformed correctly, the offset is missing in the emitted assembly code ( %fs: instead of %fs:0 )

Change History

11/23/08 03:25:28 changed by ChristianK

The cause for this is the 'if' at line 1929 in asm-x86-32.h. Question: is FS:0 the same as FS, i.e. would %fs suffice?

11/23/08 11:45:15 changed by elrood

nope, wouldn't. FS points to a different address than FS:0. <segment>:<offset> is resolved to <segment>*16+<offset>. moreover the x86 segment registers like FS are treated as 16 bits wide words pretty strictly by the compiler, eg. the emitted code for something like 'mov FS, 0' is translated to 'movw $0, %fs', even if you specify 'mov dword ptr FS, 0' the output is always 'movw' (probably this isn't even a bug but a feature)

11/23/08 11:48:32 changed by elrood

okay, the example probably isn't the best one ever, why should the assembler care if you move a zero into a word, dword or byte.. but you hopefully get the idea :)

11/27/08 12:31:36 changed by ChristianK

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [793].

Copyright © 2008, LDC Development Team.