kernel-ark/include/asm-v850
Andrea Righi 27ac792ca0 PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures
On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
boundary. For example:

	u64 val = PAGE_ALIGN(size);

always returns a value < 4GB even if size is greater than 4GB.

The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
example):

#define PAGE_SHIFT      12
#define PAGE_SIZE       (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK       (~(PAGE_SIZE-1))
...
#define PAGE_ALIGN(addr)       (((addr)+PAGE_SIZE-1)&PAGE_MASK)

The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
Using the ALIGN() macro seems to be the right way, because it uses
typeof(addr) for the mask.

Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
include/linux/mm.h.

See also lkml discussion: http://lkml.org/lkml/2008/6/11/237

[akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
[akpm@linux-foundation.org: fix v850]
[akpm@linux-foundation.org: fix powerpc]
[akpm@linux-foundation.org: fix arm]
[akpm@linux-foundation.org: fix mips]
[akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
[akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
[akpm@linux-foundation.org: fix powerpc]
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:21 -07:00
..
a.out.h
anna.h avoid overflows in kernel/time.c 2008-02-08 09:22:39 -08:00
as85ep1.h avoid overflows in kernel/time.c 2008-02-08 09:22:39 -08:00
asm.h
atomic.h
auxvec.h
bitops.h forbid asm/bitops.h direct inclusion 2007-10-19 11:53:41 -07:00
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
checksum.h
clinkage.h v850: fix typo in header guard 2008-06-06 11:29:12 -07:00
cputime.h
current.h
delay.h
device.h
div64.h
dma-mapping.h
dma.h
elf.h Cleanup asm/{elf,page,user}.h: #ifdef __KERNEL__ is no longer needed 2008-02-07 08:42:30 -08:00
emergency-restart.h
entry.h
errno.h
fb.h fbdev: detect primary display device 2007-07-17 10:23:11 -07:00
fcntl.h
flat.h Binfmt_flat: Add minimum support for the Blackfin relocations 2007-10-03 23:41:43 +08:00
fpga85e2c.h avoid overflows in kernel/time.c 2008-02-08 09:22:39 -08:00
futex.h
gbus_int.h
hardirq.h
highres_timer.h
hw_irq.h
io.h remove mm_{ptov,vtop}() 2008-02-06 10:41:01 -08:00
ioctl.h
ioctls.h v850: enable arbitary speed tty ioctls 2007-07-16 09:05:39 -07:00
ipcbuf.h
irq_regs.h softlockup: make asm/irq_regs.h available on every platform 2007-10-17 08:42:47 -07:00
irq.h take declarations of enable_irq() et.al. to linux/interrupt.h 2007-07-22 11:44:00 -07:00
Kbuild
kdebug.h
kmap_types.h
kvm.h kvm: provide kvm.h for all architecture: fixes headers_install 2008-04-02 15:28:18 -07:00
linkage.h
local.h
ma1.h
ma.h
machdep.h
macrology.h
me2.h
mman.h
mmu_context.h
mmu.h
module.h
msgbuf.h
mutex.h
namei.h
page.h PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
param.h asm-{alpha,h8300,um,v850,xtensa}/param.h: unbreak HZ for userspace 2008-05-14 19:11:14 -07:00
pci.h PCI: Use a weak symbol for the empty version of pcibios_add_platform_entries() 2007-07-11 16:02:07 -07:00
percpu.h
pgalloc.h
pgtable.h
poll.h Consolidate asm/poll.h 2007-05-11 08:29:34 -07:00
posix_types.h asm-*/posix_types.h: scrub __GLIBC__ 2008-02-08 09:22:34 -08:00
processor.h
ptrace.h
resource.h
rte_cb.h avoid overflows in kernel/time.c 2008-02-08 09:22:39 -08:00
rte_ma1_cb.h
rte_mb_a_pci.h
rte_me2_cb.h
rte_nb85e_cb.h
scatterlist.h Add CONFIG_DEBUG_SG sg validation 2007-10-22 21:20:03 +02:00
sections.h
segment.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
serial.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
sim85e2.h avoid overflows in kernel/time.c 2008-02-08 09:22:39 -08:00
sim85e2c.h
sim85e2s.h
sim.h avoid overflows in kernel/time.c 2008-02-08 09:22:39 -08:00
simsyscall.h
socket.h [NET]: Introducing socket mark socket option. 2008-01-31 19:27:19 -08:00
sockios.h
stat.h
statfs.h
string.h
system.h Add cmpxchg_local to v850 2008-02-07 08:42:33 -08:00
teg.h
termbits.h v850: enable arbitary speed tty ioctls 2007-07-16 09:05:39 -07:00
termios.h v850: enable arbitary speed tty ioctls 2007-07-16 09:05:39 -07:00
thread_info.h remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
timex.h
tlb.h
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h
types.h v850: types: use <asm-generic/int-*.h> for the v850 architecture 2008-05-02 16:18:41 -07:00
uaccess.h
ucontext.h
unaligned.h kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
unistd.h
user.h Sanitize the type of struct user.u_ar0 2008-02-07 08:42:30 -08:00
v850e2_cache.h
v850e2.h
v850e_cache.h
v850e_intc.h
v850e_timer_c.h
v850e_timer_d.h
v850e_uart.h
v850e_uarta.h
v850e_uartb.h
v850e_utils.h
v850e.h