kernel_optimize_test/include/asm-mn10300
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
..
proc-mn103e010
unit-asb2303
unit-asb2305
.gitignore
atomic.h
auxvec.h
bitops.h
bug.h
bugs.h
busctl-regs.h
byteorder.h
cache.h
cacheflush.h
checksum.h
cpu-regs.h
cputime.h
current.h
delay.h
device.h
div64.h rename div64_64 to div64_u64 2008-05-01 08:03:58 -07:00
dma-mapping.h
dma.h
dmactl-regs.h
elf.h
emergency-restart.h
errno.h
exceptions.h
fb.h
fcntl.h
fpu.h
frame.inc
futex.h
gdb-stub.h
hardirq.h
highmem.h
hw_irq.h
ide.h
intctl-regs.h
io.h
ioctl.h
ioctls.h
ipc.h
ipcbuf.h MN10300: Fix typo in header guard 2008-05-28 07:59:06 -07:00
irq_regs.h
irq.h
Kbuild Really unexport asm/page.h 2008-03-06 08:13:47 -08:00
kdebug.h
kmap_types.h
kprobes.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
mc146818rtc.h
mman.h
mmu_context.h
mmu.h
module.h
msgbuf.h
mutex.h
namei.h
nmi.h
page_offset.h
page.h PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
param.h MN10300: define HZ as a config option 2008-02-23 17:12:13 -08:00
pci.h
percpu.h
pgalloc.h
pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pio-regs.h
poll.h
posix_types.h
processor.h MN10300: Make cpu_relax() invoke barrier() 2008-05-08 10:49:39 -07:00
ptrace.h
reset-regs.h
resource.h
rtc-regs.h
rtc.h
scatterlist.h
sections.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
serial-regs.h
serial.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
smp.h
socket.h MN10300: define SO_MARK 2008-02-23 17:12:13 -08:00
sockios.h
spinlock.h
stat.h
statfs.h
string.h
system.h
termbits.h
termios.h
thread_info.h
timer-regs.h
timex.h
tlb.h
tlbflush.h
topology.h
types.h mn10300: types: use <asm-generic/int-*.h> for the mn10300 architecture 2008-05-02 16:18:31 -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
vga.h
xor.h