[llvm-bugs] [Bug 26406] New: The direction flag in the FLAGS register may be wrong in interrupt handler
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jan 31 08:55:26 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26406
Bug ID: 26406
Summary: The direction flag in the FLAGS register may be wrong
in interrupt handler
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: hjl.tools at gmail.com
CC: a.bataev at hotmail.com, amjad.aboud at intel.com,
llvm-bugs at lists.llvm.org
Classification: Unclassified
The x86 psABI says
The direction flag DF in the FLAGS register must be clear (set to “forward”
direction) on function entry and return. Other user flags have no specified
role in the standard calling sequence and are not preserved across calls
Since the direction flag (DF) in the FLAGS register is undetermined in
interrupt handler, the result will be wrong if DF isn't cleared:
[hjl at gnu-6 bin]$ cat /tmp/x.i
extern void *a;
extern int b;
__attribute__ ((interrupt))
void
foo (void *frame)
{
__builtin_memset (a, b, 40);
}
[hjl at gnu-6 bin]$ ./clang -S -Os /tmp/x.i -m32 -mno-sse
[hjl at gnu-6 bin]$ cat x.s
.text
.file "/tmp/x.i"
.globl foo
.type foo, at function
foo: # @foo
# BB#0: # %entry
pushl %esp
pushl %edx
pushl %ecx
pushl %eax
subl $12, %esp
subl $4, %esp
pushl $40
pushl b
pushl a
calll memset
addl $16, %esp
addl $12, %esp
popl %eax
popl %ecx
popl %edx
popl %esp
iretl
.Lfunc_end0:
.size foo, .Lfunc_end0-foo
.ident "clang version 3.9.0 (http://llvm.org/git/clang.git
1f64ddbc4c5d1036b68ec896765a7535537ded85) (http://llvm.org/git/llvm.git
43b517fe4e0a181b1cf20f36fd9eb92f7b32946c)"
.section ".note.GNU-stack","", at progbits
[hjl at gnu-6 bin]$
The current interrupt spec:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66960#c4
has
Since the direction flag in the FLAGS register in interrupt (exception)
handlers is undetermined, cld instruction must be emitted in function
prologue if rep string instructions are used in interrupt (exception)
handler or interrupt (exception) handler isn't a leaf function.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160131/4f27c9d2/attachment.html>
More information about the llvm-bugs
mailing list