From: guenther Date: Fri, 13 Jul 2018 05:56:57 +0000 (+0000) Subject: Use _ALIGN_TRAPS instead of _ALIGN_TEXT where nops aren't needed. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b8dcfd0b0b268c3e88ec6096e5493ada637efb37;p=openbsd Use _ALIGN_TRAPS instead of _ALIGN_TEXT where nops aren't needed. ok deraadt@ --- diff --git a/sys/lib/libkern/arch/amd64/ffs.S b/sys/lib/libkern/arch/amd64/ffs.S index 4acb74c4132..b6ada6cd286 100644 --- a/sys/lib/libkern/arch/amd64/ffs.S +++ b/sys/lib/libkern/arch/amd64/ffs.S @@ -13,7 +13,7 @@ ENTRY(ffs) incl %eax /* bits numbered from 1, not 0 */ jmp L2 - _ALIGN_TEXT + _ALIGN_TRAPS L1: xorl %eax,%eax /* clear result */ L2: RETGUARD_CHECK(ffs, r11) ret diff --git a/sys/lib/libkern/arch/amd64/strchr.S b/sys/lib/libkern/arch/amd64/strchr.S index a4234184b47..54d2178d017 100644 --- a/sys/lib/libkern/arch/amd64/strchr.S +++ b/sys/lib/libkern/arch/amd64/strchr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strchr.S,v 1.4 2018/07/03 23:22:48 mortimer Exp $ */ +/* $OpenBSD: strchr.S,v 1.5 2018/07/13 05:56:57 guenther Exp $ */ /* $NetBSD: strchr.S,v 1.7 2014/03/22 19:16:34 jakllsch Exp $ */ /*- @@ -90,7 +90,7 @@ ENTRY(strchr) jmp 12f /* End of string, check whether char is before NUL */ - _ALIGN_TEXT /* adds three byte nop */ + _ALIGN_TRAPS 10: bsf %rax,%rax /* count to NUL */ andq %rsi,%r11 /* check for char in last 8 bytes */ @@ -104,7 +104,7 @@ ENTRY(strchr) ret /* Source misaligned: read aligned word and make low bytes invalid */ -/* I (dsl) think a _ALIGN_TEXT here will slow things down! */ +/* I (dsl) think aligning the text here will slow things down! */ 20: xor %rcx,%rcx sub %dil,%cl /* Convert low address values 1..7 ... */ diff --git a/sys/lib/libkern/arch/amd64/strlen.S b/sys/lib/libkern/arch/amd64/strlen.S index 888f2c05d12..f17d7c78a49 100644 --- a/sys/lib/libkern/arch/amd64/strlen.S +++ b/sys/lib/libkern/arch/amd64/strlen.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strlen.S,v 1.6 2018/07/03 23:22:48 mortimer Exp $ */ +/* $OpenBSD: strlen.S,v 1.7 2018/07/13 05:56:57 guenther Exp $ */ /* $NetBSD: strlen.S,v 1.6 2014/03/22 19:16:34 jakllsch Exp $ */ /*- @@ -144,7 +144,7 @@ ENTRY(strlen) ret /* Misaligned, read aligned word and make low bytes non-zero */ - _ALIGN_TEXT + _ALIGN_TRAPS 10: mov %al,%cl mov $1,%rsi