diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2013-07-12 04:08:27 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2013-07-12 04:08:27 +0000 |
commit | c2f4bafec1c6b5eb4aa6a7d218ec147ba8abe613 (patch) | |
tree | e0050652b8427e50f37811a704cdfc76799abf75 /sys/arch | |
parent | fd611b0219f5d6437512b36e8b284015c10fc905 (diff) |
replace fls functions with calls to the libkern versions
found the hard way by deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hppa/hppa/intr.c | 38 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/intr.c | 44 |
2 files changed, 3 insertions, 79 deletions
diff --git a/sys/arch/hppa/hppa/intr.c b/sys/arch/hppa/hppa/intr.c index 424d9bf37df..b685b069e8f 100644 --- a/sys/arch/hppa/hppa/intr.c +++ b/sys/arch/hppa/hppa/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.40 2011/05/12 12:54:38 kettenis Exp $ */ +/* $OpenBSD: intr.c,v 1.41 2013/07/12 04:08:26 jsg Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -235,42 +235,6 @@ cpu_intr_establish(int pri, int irq, int (*handler)(void *), void *arg, return (iv); } -int fls(u_int mask); - -int -fls(u_int mask) -{ - int bit; - - bit = 32; - if (!(mask & 0xffff0000)) { - bit -= 16; - mask <<= 16; - } - - if (!(mask & 0xff000000)) { - bit -= 8; - mask <<= 8; - } - - if (!(mask & 0xf0000000)) { - bit -= 4; - mask <<= 4; - } - - if (!(mask & 0xc0000000)) { - bit -= 2; - mask <<= 2; - } - - if (!(mask & 0x80000000)) { - bit -= 1; - mask <<= 1; - } - - return mask? bit : 0; -} - void cpu_intr(void *v) { diff --git a/sys/arch/hppa64/hppa64/intr.c b/sys/arch/hppa64/hppa64/intr.c index 333277a0922..fd563137dea 100644 --- a/sys/arch/hppa64/hppa64/intr.c +++ b/sys/arch/hppa64/hppa64/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.7 2011/09/22 12:53:00 jsing Exp $ */ +/* $OpenBSD: intr.c,v 1.8 2013/07/12 04:08:26 jsg Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -190,46 +190,6 @@ cpu_intr_establish(int pri, int irq, int (*handler)(void *), void *arg, return (iv); } -int fls(u_long mask); - -int -fls(u_long mask) -{ - int bit = 64; - - if (!(mask & 0xffffffff00000000)) { - bit -= 32; - mask <<= 32; - } - - if (!(mask & 0xffff000000000000)) { - bit -= 16; - mask <<= 16; - } - - if (!(mask & 0xff00000000000000)) { - bit -= 8; - mask <<= 8; - } - - if (!(mask & 0xf000000000000000)) { - bit -= 4; - mask <<= 4; - } - - if (!(mask & 0xc000000000000000)) { - bit -= 2; - mask <<= 2; - } - - if (!(mask & 0x8000000000000000)) { - bit -= 1; - mask <<= 1; - } - - return mask ? bit : 0; -} - void cpu_intr(void *v) { @@ -253,7 +213,7 @@ cpu_intr(void *v) while (ci->ci_ipending & mask) { - bit = fls(ci->ci_ipending & mask) - 1; + bit = flsl(ci->ci_ipending & mask) - 1; iv = &intr_table[bit]; #ifdef INTRDEBUG |