diff options
author | pfg <pfg@FreeBSD.org> | 2016-04-21 19:57:40 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-04-21 19:57:40 +0000 |
commit | 729533413f4e97bb65852c22fb914805e2759b5a (patch) | |
tree | cd4dfa8859a5f57124d315ff395b524d7587e1ea /sys/i386 | |
parent | 0d55061d05ce55d28aff0c06bad831448d172425 (diff) | |
download | FreeBSD-src-729533413f4e97bb65852c22fb914805e2759b5a.zip FreeBSD-src-729533413f4e97bb65852c22fb914805e2759b5a.tar.gz |
sys: use our roundup2/rounddown2() macros when param.h is available.
rounddown2 tends to produce longer lines than the original code
and when the code has a high indentation level it was not really
advantageous to do the replacement.
This tries to strike a balance between readability using the macros
and flexibility of having the expressions, so not everything is
converted.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/i686_mem.c | 2 | ||||
-rw-r--r-- | sys/i386/i386/minidump_machdep.c | 2 | ||||
-rw-r--r-- | sys/i386/i386/sys_machdep.c | 2 | ||||
-rw-r--r-- | sys/i386/svr4/svr4_machdep.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/sys/i386/i386/i686_mem.c b/sys/i386/i386/i686_mem.c index d5d2251..a6ca13d 100644 --- a/sys/i386/i386/i686_mem.c +++ b/sys/i386/i386/i686_mem.c @@ -377,7 +377,7 @@ i686_mrstoreone(void *arg) /* mask/active register */ if (mrd->mr_flags & MDF_ACTIVE) { msrv = MTRR_PHYSMASK_VALID | - (~(mrd->mr_len - 1) & mtrr_physmask); + rounddown2(mtrr_physmask, mrd->mr_len); } else { msrv = 0; } diff --git a/sys/i386/i386/minidump_machdep.c b/sys/i386/i386/minidump_machdep.c index 8f78abc..6fd11f3 100644 --- a/sys/i386/i386/minidump_machdep.c +++ b/sys/i386/i386/minidump_machdep.c @@ -54,7 +54,7 @@ CTASSERT(sizeof(struct kerneldumpheader) == 512); #define SIZEOF_METADATA (64*1024) #define MD_ALIGN(x) (((off_t)(x) + PAGE_MASK) & ~PAGE_MASK) -#define DEV_ALIGN(x) (((off_t)(x) + (DEV_BSIZE-1)) & ~(DEV_BSIZE-1)) +#define DEV_ALIGN(x) roundup2((off_t)(x), DEV_BSIZE) uint32_t *vm_page_dump; int vm_page_dump_size; diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index 861cf49..4f78e29 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); #define MAX_LD 8192 #define LD_PER_PAGE 512 -#define NEW_MAX_LD(num) ((num + LD_PER_PAGE) & ~(LD_PER_PAGE-1)) +#define NEW_MAX_LD(num) rounddown2(num + LD_PER_PAGE, LD_PER_PAGE) #define SIZE_FROM_LARGEST_LD(num) (NEW_MAX_LD(num) << 3) #define NULL_LDT_BASE ((caddr_t)NULL) diff --git a/sys/i386/svr4/svr4_machdep.c b/sys/i386/svr4/svr4_machdep.c index ddc2594..31ad0ea 100644 --- a/sys/i386/svr4/svr4_machdep.c +++ b/sys/i386/svr4/svr4_machdep.c @@ -159,7 +159,7 @@ svr4_getcontext(td, uc, mask, oonstack) #if defined(DONE_MORE_SIGALTSTACK_WORK) bsd_to_svr4_sigaltstack(sf, s); #else - s->ss_sp = (void *)(((u_long) tf->tf_esp) & ~(16384 - 1)); + s->ss_sp = (void *)rounddown2((u_long)tf->tf_esp, 16384); s->ss_size = 16384; s->ss_flags = 0; #endif |