android_kernel_xiaomi_sm8350/include/asm-m68knommu
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
anchor.h
atomic.h
auxvec.h
bitops.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
bootinfo.h
bootstd.h
bug.h
bugs.h
byteorder.h
cache.h
cachectl.h
cacheflush.h m68knommu: use tabs not spaces in cacheflush.h 2008-02-14 20:58:05 -08:00
checksum.h
coldfire.h
commproc.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
cputime.h
current.h
dbg.h
delay.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
device.h
div64.h
dma-mapping.h
dma.h m68knommu: update MAX_M68K_DMA_CHANNELS for some plattforms 2008-05-01 08:08:36 -07:00
elf.h Cleanup asm/{elf,page,user}.h: #ifdef __KERNEL__ is no longer needed 2008-02-07 08:42:30 -08:00
elia.h
emergency-restart.h
entry.h
errno.h
fb.h
fcntl.h
flat.h
fpu.h
futex.h
hardirq.h
hw_irq.h
hwtest.h
io.h remove mm_{ptov,vtop}() 2008-02-06 10:41:01 -08:00
ioctl.h
ioctls.h
ipcbuf.h
irq_regs.h
irq.h
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
m520xsim.h
m523xsim.h
m527xsim.h
m528xsim.h
m532xsim.h
m5206sim.h
m5249sim.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
m5272sim.h
m5307sim.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
m5407sim.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
m68360_enet.h
m68360_pram.h
m68360_quicc.h
m68360_regs.h include/asm-m68knommu/: Spelling fixes 2008-02-03 17:38:04 +02:00
m68360.h
machdep.h m68knommu: declare do_IRQ() 2008-03-04 08:04:11 -08:00
math-emu.h
mc146818rtc.h
MC68EZ328.h
MC68VZ328.h
MC68328.h
MC68332.h
mcfcache.h m68knommu: fix 528x ColdFire cache settings 2008-02-01 21:00:01 +11:00
mcfdma.h
mcfmbus.h
mcfne.h m68knomu: remove dead config symbols from m68knomu code 2008-02-05 09:44:21 -08:00
mcfpci.h
mcfpit.h
mcfsim.h m68knomu: remove dead config symbols from m68knomu code 2008-02-05 09:44:21 -08:00
mcfsmc.h
mcftimer.h m68knomu: remove dead config symbols from m68knomu code 2008-02-05 09:44:21 -08:00
mcfuart.h m68knomu: remove dead config symbols from m68knomu code 2008-02-05 09:44:21 -08:00
mcfwdebug.h
md.h
mman.h
mmu_context.h
mmu.h
module.h m68knommu: local module/elf definitions 2007-10-23 08:32:07 -07:00
movs.h
msgbuf.h
mutex.h
namei.h
nettel.h
openprom.h
oplib.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 m68knommu: rework definition of HZ 2008-05-01 08:08:36 -07:00
pci.h
percpu.h
pgalloc.h
pgtable.h
poll.h
posix_types.h
processor.h
ptrace.h
quicc_simple.h
resource.h
rtc.h
scatterlist.h m68knommu: remove sg_address() 2007-10-23 12:42:47 +02:00
sections.h
segment.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
setup.h
shm.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
smp.h
socket.h
sockios.h
spinlock.h
stat.h
statfs.h
string.h
system.h m68knommu: avoid unneccessary use of xchg() in set_mb() 2008-02-14 20:58:05 -08:00
termbits.h
termios.h
thread_info.h
timex.h
tlb.h
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h
traps.h
types.h
uaccess.h m68knommu: define __clear_user macro 2007-10-23 08:32:07 -07:00
ucontext.h
unaligned.h kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
unistd.h m68k{,nommu}: Wire up new timerfd syscalls 2008-03-04 08:04:11 -08:00
user.h