diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-21 19:57:40 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-21 19:57:40 +0000 |
commit | d9c9c81c083a76a65c6cacf8fcbc0511e2ffa489 (patch) | |
tree | cd4dfa8859a5f57124d315ff395b524d7587e1ea /sys/kern | |
parent | 5977d3e898348ce714243a4189cee906151aa522 (diff) |
Notes
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/imgact_elf.c | 4 | ||||
-rw-r--r-- | sys/kern/init_main.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_linker.c | 2 | ||||
-rw-r--r-- | sys/kern/sysv_sem.c | 2 | ||||
-rw-r--r-- | sys/kern/sysv_shm.c | 2 | ||||
-rw-r--r-- | sys/kern/vfs_bio.c | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 0bed714e7f0a0..6adf0da02dac5 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -139,8 +139,8 @@ SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_RW, &i386_read_exec, 0, static Elf_Brandinfo *elf_brand_list[MAX_BRANDS]; -#define trunc_page_ps(va, ps) ((va) & ~(ps - 1)) -#define round_page_ps(va, ps) (((va) + (ps - 1)) & ~(ps - 1)) +#define trunc_page_ps(va, ps) rounddown2(va, ps) +#define round_page_ps(va, ps) roundup2(va, ps) #define aligned(a, t) (trunc_page_ps((u_long)(a), sizeof(t)) == (u_long)(a)) static const char FREEBSD_ABI_VENDOR[] = "FreeBSD"; diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index fa1c3d0cb5053..6e54f36324728 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -787,7 +787,7 @@ start_init(void *dummy) /* * Move out the arg pointers. */ - uap = (char **)((intptr_t)ucp & ~(sizeof(intptr_t)-1)); + uap = (char **)rounddown2((intptr_t)ucp, sizeof(intptr_t)); (void)suword((caddr_t)--uap, (long)0); /* terminator */ (void)suword((caddr_t)--uap, (long)(intptr_t)arg1); (void)suword((caddr_t)--uap, (long)(intptr_t)arg0); diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index e2042914d252a..c2c75836b1997 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -1713,7 +1713,7 @@ linker_lookup_file(const char *path, int pathlen, const char *name, } #define INT_ALIGN(base, ptr) ptr = \ - (base) + (((ptr) - (base) + sizeof(int) - 1) & ~(sizeof(int) - 1)) + (base) + roundup2((ptr) - (base), sizeof(int)) /* * Lookup KLD which contains requested module in the "linker.hints" file. If diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index c9b832edd3310..38b398696f4c9 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -164,7 +164,7 @@ struct sem_undo { * SEMUSZ is properly aligned. */ -#define SEM_ALIGN(bytes) (((bytes) + (sizeof(long) - 1)) & ~(sizeof(long) - 1)) +#define SEM_ALIGN(bytes) roundup2(bytes, sizeof(long)) /* actual size of an undo structure */ #define SEMUSZ SEM_ALIGN(offsetof(struct sem_undo, un_ent[SEMUME])) diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index b426f4561ef15..eeebc47fadca7 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -370,7 +370,7 @@ kern_shmat_locked(struct thread *td, int shmid, const void *shmaddr, prot |= VM_PROT_WRITE; if (shmaddr != NULL) { if ((shmflg & SHM_RND) != 0) - attach_va = (vm_offset_t)shmaddr & ~(SHMLBA-1); + attach_va = rounddown2((vm_offset_t)shmaddr, SHMLBA); else if (((vm_offset_t)shmaddr & (SHMLBA-1)) == 0) attach_va = (vm_offset_t)shmaddr; else diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index b7b9641662bd4..640f6497c83f3 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -3865,7 +3865,7 @@ allocbuf(struct buf *bp, int size) if (bp->b_kvasize != 0 && bp->b_kvasize < size) panic("allocbuf: buffer too small"); - newbsize = (size + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1); + newbsize = roundup2(size, DEV_BSIZE); if ((bp->b_flags & B_VMIO) == 0) { if ((bp->b_flags & B_MALLOC) == 0) newbsize = round_page(newbsize); |