kernel-ark/include/asm-blackfin
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
..
mach-bf527 Blackfin Serial Driver: Use timer to poll CTS PIN instead of workqueue. 2008-06-19 17:46:39 +08:00
mach-bf533 Blackfin Serial Driver: Use timer to poll CTS PIN instead of workqueue. 2008-06-19 17:46:39 +08:00
mach-bf537 Blackfin Serial Driver: Use timer to poll CTS PIN instead of workqueue. 2008-06-19 17:46:39 +08:00
mach-bf548 Blackfin Serial Driver: Use timer to poll CTS PIN instead of workqueue. 2008-06-19 17:46:39 +08:00
mach-bf561 Blackfin Serial Driver: Use timer to poll CTS PIN instead of workqueue. 2008-06-19 17:46:39 +08:00
mach-common [Blackfin] arch: fix gdb testing regression 2008-05-07 11:41:26 +08:00
.gitignore [Blackfin] arch: add include/boot .gitignore files 2008-04-25 08:29:11 +08:00
a.out.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
atomic.h
auxvec.h
bfin5xx_spi.h [Blackfin] arch: Encourage users to use the spidev character driver: Provide platform support 2008-02-09 01:54:09 +08:00
bfin_simple_timer.h
bfin_sport.h
bfin-global.h Blackfin arch: Remove bad and usless code 2008-05-31 15:35:40 +08:00
bitops.h forbid asm/bitops.h direct inclusion 2007-10-19 11:53:41 -07:00
blackfin.h
bug.h [Blackfin] arch: define our own BUG() so we can dump the blackfin hardware trace buffer 2008-04-24 08:58:44 +08:00
bugs.h
byteorder.h
cache.h
cacheflush.h
checksum.h [Blackfin] arch: Blackfin checksum annotations 2008-05-12 11:55:10 +08:00
cplb-mpu.h [Blackfin] arch: Initial checkin of the memory protection support. 2008-01-27 18:39:16 +08:00
cplb.h [Blackfin] arch: relocate MAX_SWITCH_{D,I}_CPLBS from the header to the file where it actually gets used. 2008-04-23 08:23:51 +08:00
cplbinit.h [Blackfin] arch: Initial checkin of the memory protection support. 2008-01-27 18:39:16 +08:00
cpumask.h
cputime.h
current.h
delay.h Blackfin arch: add support for working around anomaly 05000312 2007-11-21 16:08:58 +08:00
device.h
div64.h
dma-mapping.h [Blackfin] arch: Add dma_map_page and dma_unmap_page stub for MMC SPI compiling 2008-04-23 07:41:52 +08:00
dma.h [Blackfin] arch: Give the DMA base registers a more descriptive name 2008-04-24 05:31:18 +08:00
dpmc.h [Blackfin] arch: Functional power management support: Add CPU and platform voltage scaling support 2008-05-07 11:41:26 +08:00
early_printk.h Blackfin arch: Initial patch to add earlyprintk support 2007-10-09 17:24:49 +08:00
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 [Blackfin] arch: fix gdb testing regression 2008-05-07 11:41:26 +08:00
errno.h
fb.h
fcntl.h
fixed_code.h Blackfin arch: ensure that speculative loads of bad pointers don't cause us to do bad things. 2007-10-29 18:23:28 +08:00
flat.h
futex.h
gpio.h Blackfin arch: Add workaround to read edge triggered GPIOs 2008-05-17 16:01:51 +08:00
gptimers.h [Blackfin] arch: add support for the rest of the gptimers on the BF54x 2008-04-23 08:53:15 +08:00
hardirq.h
hw_irq.h
ide.h ide: remove ide_default_io_ctl() macro 2008-04-18 00:46:34 +02:00
io.h Blackfin arch: IO Port functions to read/write unalligned memory 2008-05-17 16:38:52 +08:00
ioctl.h
ioctls.h
ipcbuf.h
irq_handler.h Blackfin arch: Print out debug info, as early as possible 2007-10-09 17:31:46 +08:00
irq_regs.h
irq.h [Blackfin] arch: Cleanup abd Simplify: 2008-02-25 13:50:20 +08:00
Kbuild
kdebug.h
kgdb.h Blackfin arch: update kgdb patch 2007-10-10 16:47:58 +08:00
kmap_types.h
kvm.h kvm: provide kvm.h for all architecture: fixes headers_install 2008-04-02 15:28:18 -07:00
l1layout.h
linkage.h
local.h
mem_map.h
mman.h
mmu_context.h [Blackfin] arch: current_l1_stack_save is a pointer, so use NULL rather than 0 2008-03-05 19:02:23 -07:00
mmu.h [Blackfin] arch: Initial checkin of the memory protection support. 2008-01-27 18:39:16 +08:00
module.h
msgbuf.h
mutex.h
namei.h
nand.h [MTD] [NAND] Blackfin on-chip NAND Flash Controller driver 2007-10-13 14:36:49 +01:00
page_offset.h Blackfin arch: punt CONFIG_BFIN -- we already have CONFIG_BLACKFIN 2007-11-23 14:28:44 +08:00
page.h PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
param.h
pci.h
percpu.h
pgalloc.h
pgtable.h
poll.h
portmux.h [Blackfin] arch: declare list of peripherals as const since we dont modify the incoming array 2008-04-24 05:04:24 +08:00
posix_types.h asm-*/posix_types.h: scrub __GLIBC__ 2008-02-08 09:22:34 -08:00
processor.h [Blackfin] arch: This allows XIP to work with FD-PIC. 2008-04-24 03:06:15 +08:00
ptrace.h
reboot.h Blackfin arch: Workaround reboot bug, issue SSYNC at the start of bfin_reset 2007-10-11 00:29:49 +08:00
resource.h
scatterlist.h blackfin: remove sg_address() 2007-10-23 12:42:44 +02:00
sections.h
segment.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
serial.h Blackfin serial driver: add extra IRQ flag for 8250 serial driver 2008-05-17 18:21:57 +08:00
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h [Blackfin] arch: add missing __user marking to ss_sp member of signalstack and a few userspace system functions 2008-03-07 02:37:41 +08:00
socket.h [NET]: Introducing socket mark socket option. 2008-01-31 19:27:19 -08:00
sockios.h
spinlock.h
stat.h
statfs.h
string.h Blackfin arch: move EXPORT_SYMBOL() to C files where the symbol is actually defined 2007-11-21 15:34:51 +08:00
system.h Add cmpxchg_local to blackfin, replace __cmpxchg by generic cmpxchg 2008-02-07 08:42:31 -08:00
termbits.h
termios.h [Blackfin] arch: remove duplicated definitions of the line discipline numbers N_* in asm-blackfin/termios.h 2008-02-02 16:14:53 +08:00
thread_info.h [Blackfin] arch: Clean up the definition and correct the commentary for current_thread_info(). 2008-04-24 09:02:00 +08:00
time.h [Blackfin] arch: Support for CPU_FREQ and NOHZ 2008-05-07 11:41:26 +08:00
timex.h [Blackfin] arch: actually implement get_cycles function 2008-04-24 05:07:29 +08:00
tlb.h
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h
trace.h [Blackfin] arch: fix bug - when using trace buffer with CONFIG_MPU enabled. 2008-04-23 07:17:34 +08:00
traps.h [Blackfin] arch: fix bug - trap_tests fails to recover on some tests. 2008-01-27 15:38:56 +08:00
types.h blackfin: types: use <asm-generic/int-*.h> for the blackfin architecture 2008-05-02 16:18:20 -07:00
uaccess.h [Blackfin] arch: __FUNCTION__ is gcc-specific, use __func__ 2008-04-23 09:39:01 +08:00
ucontext.h
unaligned.h kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
unistd.h [Blackfin] arch: replace implied numbers with real values 2008-04-23 08:09:45 +08:00
user.h Sanitize the type of struct user.u_ar0 2008-02-07 08:42:30 -08:00