diff options
author | kib <kib@FreeBSD.org> | 2010-06-23 20:44:07 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-06-23 20:44:07 +0000 |
commit | 8dcd1daee8fe0803727673a014545c545bf684e4 (patch) | |
tree | 6f2a6ce8d3aa678205f3ae8e8fe722441473ab3e /sys/amd64 | |
parent | 1cd81ae69301b363e554de070b5f1f28f5b93d17 (diff) | |
download | FreeBSD-src-8dcd1daee8fe0803727673a014545c545bf684e4.zip FreeBSD-src-8dcd1daee8fe0803727673a014545c545bf684e4.tar.gz |
Clear DF bit in eflags/rflags on the kernel entry. The i386 and amd64
ABI specifies the DF should be zero, and newer compilers do not clear
DF before using DF-sensitive instructions.
The DF clearing for signal handlers was done some time ago.
MFC after: 1 week
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/exception.S | 4 | ||||
-rw-r--r-- | sys/amd64/ia32/ia32_exception.S | 1 | ||||
-rw-r--r-- | sys/amd64/include/asmacros.h | 3 |
3 files changed, 7 insertions, 1 deletions
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S index d18fb0d..c18f27f 100644 --- a/sys/amd64/amd64/exception.S +++ b/sys/amd64/amd64/exception.S @@ -191,6 +191,7 @@ alltraps_pushregs_no_rdi: movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) movl $TF_HASSEGS,TF_FLAGS(%rsp) + cld FAKE_MCOUNT(TF_RIP(%rsp)) #ifdef KDTRACE_HOOKS /* @@ -270,6 +271,7 @@ IDTVEC(dblfault) movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) movl $TF_HASSEGS,TF_FLAGS(%rsp) + cld testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 1f /* already running with kernel GS.base */ swapgs @@ -369,6 +371,7 @@ IDTVEC(fast_syscall) movq %r14,TF_R14(%rsp) /* C preserved */ movq %r15,TF_R15(%rsp) /* C preserved */ movl $TF_HASSEGS,TF_FLAGS(%rsp) + cld FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp,%rdi call syscall @@ -434,6 +437,7 @@ IDTVEC(nmi) movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) movl $TF_HASSEGS,TF_FLAGS(%rsp) + cld xorl %ebx,%ebx testb $SEL_RPL_MASK,TF_CS(%rsp) jnz nmi_fromuserspace diff --git a/sys/amd64/ia32/ia32_exception.S b/sys/amd64/ia32/ia32_exception.S index 341f00e..6ca7afc 100644 --- a/sys/amd64/ia32/ia32_exception.S +++ b/sys/amd64/ia32/ia32_exception.S @@ -67,6 +67,7 @@ IDTVEC(int0x80_syscall) movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) movl $TF_HASSEGS,TF_FLAGS(%rsp) + cld FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi call ia32_syscall diff --git a/sys/amd64/include/asmacros.h b/sys/amd64/include/asmacros.h index 0bf0029..1fb592a 100644 --- a/sys/amd64/include/asmacros.h +++ b/sys/amd64/include/asmacros.h @@ -166,7 +166,8 @@ movw %gs,TF_GS(%rsp) ; \ movw %es,TF_ES(%rsp) ; \ movw %ds,TF_DS(%rsp) ; \ - movl $TF_HASSEGS,TF_FLAGS(%rsp) + movl $TF_HASSEGS,TF_FLAGS(%rsp) ; \ + cld #define POP_FRAME \ movq TF_RDI(%rsp),%rdi ; \ |