android_kernel_xiaomi_sm8350/include/asm-sh
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
..
cpu-sh2 rtc: rtc-sh: Split out the CPU defs to asm/cpu/. 2008-01-28 13:18:58 +09:00
cpu-sh2a rtc: rtc-sh: Split out the CPU defs to asm/cpu/. 2008-01-28 13:18:58 +09:00
cpu-sh3 sh: Fix DMAC base address for SH7709S 2008-05-09 19:04:12 +09:00
cpu-sh4 sh: Add support for SH7723 CPU subtype. 2008-04-18 09:50:07 -07:00
cpu-sh5 sh: Kill off more dead symbols. 2008-02-14 14:22:12 +09:00
dreamcast sh: Add maple bus support for the SEGA Dreamcast. 2007-09-21 15:55:55 +09:00
hd64465
landisk sh: landisk: Header cleanups. 2007-05-14 09:18:35 +09:00
sh03 sh: intc - remove redundant irq code for sh03, snapgear and titan 2007-09-21 11:57:47 +09:00
.gitignore
a.out.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
adc.h
addrspace.h sh: Clean up places that make 29-bit physical assumptions. 2008-01-28 13:18:59 +09:00
atomic-grb.h sh: GUSA atomic rollback support. 2008-01-28 13:18:58 +09:00
atomic-irq.h
atomic-llsc.h
atomic.h sh: GUSA atomic rollback support. 2008-01-28 13:18:58 +09:00
auxvec.h sh: Provide the FPSCR init through AT_FPUCW. 2008-01-28 13:19:00 +09:00
bitops-grb.h sh: GUSA atomic rollback support. 2008-01-28 13:18:58 +09:00
bitops-irq.h sh: GUSA atomic rollback support. 2008-01-28 13:18:58 +09:00
bitops.h generic: implement __fls on all 64-bit archs 2008-04-26 19:21:16 +02:00
bug.h sh: Fix up generic BUG build for SH-5. 2008-01-28 13:18:52 +09:00
bugs.h sh: Initial support for the MX-G CPU. 2008-04-18 09:50:01 -07:00
byteorder.h sh: Fix more user header breakage from sh64 integration. 2008-03-14 17:21:09 +09:00
cache.h sh: Split out cache status bits per-CPU family. 2008-01-28 13:18:38 +09:00
cacheflush.h sh: Fix argument page dcache flushing regression. 2008-01-07 13:50:18 +09:00
checksum_32.h sh: fix miscompilation of ip_fast_csum with gcc >= 4.3 2008-06-02 12:40:14 +09:00
checksum_64.h sh: comment tidying for sh64->sh migration. 2008-01-28 13:18:58 +09:00
checksum.h sh: Split out checksum.h in to _32 and _64 variants. 2008-01-28 13:18:45 +09:00
clock.h sh: Implement clk_round_rate() in the clock framework. 2007-07-20 13:29:09 +09:00
cmpxchg-grb.h sh: GUSA atomic rollback support. 2008-01-28 13:18:58 +09:00
cmpxchg-irq.h sh: GUSA atomic rollback support. 2008-01-28 13:18:58 +09:00
cpu-features.h sh: Add 32-bit opcode feature CPU flag. 2007-05-09 01:35:01 +00:00
cputime.h
current.h
delay.h sh: Fix up the sh64 build. 2008-03-06 17:23:15 +09:00
device.h
div64.h
dma-mapping.h sh: declared coherent memory support V2 2008-01-28 13:19:04 +09:00
dma.h sh: dma: Fix CONFIG_SYSFS=n build. 2007-09-21 11:57:53 +09:00
dmabrg.h sh: SH7760 DMABRG support. 2007-05-09 17:36:15 +09:00
edosk7705.h fix file specification in comments 2007-05-09 08:58:16 +02:00
elf.h sh: Kill off superfluous __KERNEL__ check in asm/elf.h. 2008-01-28 13:19:00 +09:00
emergency-restart.h
entry-macros.S sh: Fix up HAS_SR_RB typo in entry-macros. 2008-02-26 14:28:48 +09:00
errno.h
fb.h fbdev: detect primary display device 2007-07-17 10:23:11 -07:00
fcntl.h
fixmap.h sh: Preparation for uncached jumps through PMB. 2008-01-28 13:18:59 +09:00
flat.h sh: Fix up binfmt_flat compile warnings. 2008-01-28 13:19:00 +09:00
fpu.h sh: Fix TIF_USEDFPU clearing under FPU emulation. 2008-03-26 19:09:21 +09:00
freq.h
futex-irq.h sh: Fix up futex implementation. 2007-06-18 13:58:32 +09:00
futex.h asm-*/futex.h should include linux/uaccess.h 2008-04-30 08:29:52 -07:00
gpio.h sh: Add gpio.h stubs for PFC definitions. 2007-09-21 11:57:49 +09:00
hardirq.h
hd64461.h sh: include/asm-sh/: Spelling fixes. 2008-01-28 13:19:01 +09:00
heartbeat.h sh: heartbeat driver update. 2007-09-21 11:57:51 +09:00
hp6xx.h sh: Tidy include/asm-sh/hp6xx.h 2008-02-14 14:22:11 +09:00
hugetlb.h hugetlb: modular state for hugetlb page size 2008-07-24 10:47:17 -07:00
hw_irq.h sh: add interrupt ack code to sh3 2008-05-08 19:52:03 +09:00
i2c-sh7760.h i2c: Renesas SH7760 I2C master driver 2008-04-22 22:16:47 +02:00
ide.h ide: remove ide_default_io_ctl() macro 2008-04-18 00:46:34 +02:00
ilsel.h sh: x3proto: ILSEL IRQ support. 2007-09-21 11:57:48 +09:00
io_generic.h
io_trapped.h sh: trapped io support V2 2008-02-14 14:22:09 +09:00
io.h sh64: Fixup the nommu build. 2008-05-08 19:51:37 +09:00
ioctl.h
ioctls.h sh: termios ioctl definitions 2008-02-14 14:22:07 +09:00
ipcbuf.h
irq_regs.h
irq.h sh: asm/irq.h needs asm/cpu/irq.h. 2008-02-14 14:22:12 +09:00
irqflags_32.h sh: Split out irqflags.h in to _32 and _64 variants. 2008-01-28 13:18:40 +09:00
irqflags_64.h sh: Split out irqflags.h in to _32 and _64 variants. 2008-01-28 13:18:40 +09:00
irqflags.h sh: Split out irqflags.h in to _32 and _64 variants. 2008-01-28 13:18:40 +09:00
Kbuild sh: Fix posix_types.h userspace breakage from sh64 merge. 2008-01-28 13:19:02 +09:00
kdebug.h x86: optimize page faults like all other achitectures and kill notifier cruft 2007-10-16 09:42:50 -07:00
kexec.h kdump/kexec: calculate note size at compile time 2007-05-08 11:15:07 -07:00
kgdb.h sh: use the common ascii hex helpers 2008-05-16 15:09:08 +09:00
kmap_types.h
kvm.h kvm: provide kvm.h for all architecture: fixes headers_install 2008-04-02 15:28:18 -07:00
lboxre2.h sh: Tidy up L-BOX area5 addresses. 2007-05-07 02:11:55 +00:00
linkage.h
local.h
machvec.h remove __attribute_used__ 2008-01-28 23:21:18 +01:00
magicpanelr2.h sh: Magic Panel R2 board support. 2007-09-21 11:57:54 +09:00
mc146818rtc.h
microdev.h sh: include/asm-sh/: Spelling fixes. 2008-01-28 13:19:01 +09:00
migor.h sh: Add MigoR header file 2008-04-18 09:50:03 -07:00
mman.h
mmu_context_32.h sh: Move in the SH-5 mmu_context headers. 2008-01-28 13:18:41 +09:00
mmu_context_64.h sh: Get SH-5 caches working again post-unification. 2008-02-14 14:22:12 +09:00
mmu_context.h sh64: Fixup the nommu build. 2008-05-08 19:51:37 +09:00
mmu.h sh: Use a per-cpu ASID cache. 2007-02-13 10:54:45 +09:00
mmzone.h sh: add memory resources to /proc/iomem 2008-05-08 19:51:51 +09:00
module.h sh: Add SH-5 support to asm/module.h. 2008-01-28 13:18:39 +09:00
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 sh: Always use CONFIG_HZ for HZ. 2008-01-28 13:19:01 +09:00
parport.h sh: Add parport stub for SuperIO ports. 2007-07-07 07:28:11 +09:00
pci.h sh: Get the SH-5 PCI support building. 2008-01-28 13:18:55 +09:00
percpu.h
pgalloc.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
pgtable_32.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pgtable_64.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pgtable.h sh: Stub in page_table_range_init() on nommu. 2008-01-28 13:19:00 +09:00
pm.h
poll.h Consolidate asm/poll.h 2007-05-11 08:29:34 -07:00
posix_types_32.h sh: Fix posix_types.h userspace breakage from sh64 merge. 2008-01-28 13:19:02 +09:00
posix_types_64.h sh: Fix posix_types.h userspace breakage from sh64 merge. 2008-01-28 13:19:02 +09:00
posix_types.h sh: Fix more user header breakage from sh64 integration. 2008-03-14 17:21:09 +09:00
processor_32.h sh: Fix occasional FPU register corruption under preempt. 2008-03-26 19:02:47 +09:00
processor_64.h sh: Fix occasional FPU register corruption under preempt. 2008-03-26 19:02:47 +09:00
processor.h sh: Add support for SH7723 CPU subtype. 2008-04-18 09:50:07 -07:00
ptrace.h sh: Share bug/debug traps across _32 and _64. 2008-01-28 13:18:50 +09:00
push-switch.h
r7780rp.h sh: r7780rp: Kill off unneded ifdefs for irq setup. 2008-05-08 19:51:44 +09:00
resource.h
rtc.h rtc: rtc-sh: Split out the CPU defs to asm/cpu/. 2008-01-28 13:18:58 +09:00
rts7751r2d.h sh: trapped io support for r2d V2 2008-02-14 14:22:09 +09:00
rwsem.h sh: Warn against direct inclusion of <asm/rwsem.h>. 2007-06-08 11:56:31 +09:00
scatterlist.h sh: Kill off pgtable.h from scatterlist.h. 2008-01-28 13:19:00 +09:00
sdk7780.h sh: Add support for SDK7780 board. 2008-01-28 13:19:04 +09:00
se7206.h
se7343.h
se7721.h sh: Add support for Solution Engine SH7721 board 2008-04-18 09:50:02 -07:00
se7722.h sh: SuperH KEYSC keypad data for Solution Engine 7722 2008-04-18 09:50:01 -07:00
se7751.h Fix misspellings of "system", "controller", "interrupt" and "necessary". 2007-10-19 23:10:43 +02:00
se7780.h sh: SH7780 Solution Engine board support. 2007-05-07 02:11:55 +00:00
se.h sh: Solution Engine SH7705 board and CPU updates. 2007-05-07 02:11:56 +00:00
sections.h sh: Preparation for uncached jumps through PMB. 2008-01-28 13:18:59 +09:00
segment.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
serial.h sh: rts7751r2d board updates. 2007-02-15 18:20:52 +09:00
setup.h sh: Move zero page param defs somewhere sensible. 2007-10-30 17:32:08 +09:00
sfp-machine.h
sh_bios.h
sh_keysc.h sh: SuperH KEYSC platform driver 2008-04-18 09:50:00 -07:00
shmbuf.h
shmin.h
shmparam.h
sigcontext.h sh: SH-2A FPU support. 2008-01-28 13:18:57 +09:00
siginfo.h
signal.h
smc37c93x.h
smp.h sh: convert to generic helpers for IPI function calls 2008-06-26 11:22:58 +02:00
snapgear.h sh: intc - remove redundant irq code for sh03, snapgear and titan 2007-09-21 11:57:47 +09:00
socket.h [NET]: Introducing socket mark socket option. 2008-01-31 19:27:19 -08:00
sockios.h [NET]: Introduce SIOCGSTAMPNS ioctl to get timestamps with nanosec resolution 2007-04-25 22:24:04 -07:00
sparsemem.h sh: sparsemem support. 2007-06-08 02:43:43 +00:00
spi.h sh: add spi header and r2d platform data V3 2008-01-28 16:24:46 +09:00
spinlock_types.h sh: Overhaul spinlocks and rwlocks for SH-4A SMP. 2007-09-21 11:57:51 +09:00
spinlock.h sh: Overhaul spinlocks and rwlocks for SH-4A SMP. 2007-09-21 11:57:51 +09:00
stat.h sh: Special layout for SH-5 stat.h and user.h. 2008-01-28 13:18:53 +09:00
statfs.h
string_32.h sh: Split out asm/string.h for sh32 and sh64. 2008-01-28 13:18:40 +09:00
string_64.h sh: comment tidying for sh64->sh migration. 2008-01-28 13:18:58 +09:00
string.h sh: Split out asm/string.h for sh32 and sh64. 2008-01-28 13:18:40 +09:00
system_32.h sh: trapped io support V2 2008-02-14 14:22:09 +09:00
system_64.h sh: Preparation for uncached jumps through PMB. 2008-01-28 13:18:59 +09:00
system.h sh: Create an sh debugfs root. 2008-04-18 09:50:01 -07:00
systemh7751.h Fix misspellings of "system", "controller", "interrupt" and "necessary". 2007-10-19 23:10:43 +02:00
termbits.h sh: termios ioctl definitions 2008-02-14 14:22:07 +09:00
termios.h sh: termios ioctl definitions 2008-02-14 14:22:07 +09:00
thread_info.h remove __attribute_used__ 2008-01-28 23:21:18 +01:00
timer.h sh: clockevent/clocksource/hrtimers/nohz TMU support. 2007-05-09 17:33:24 +09:00
timex.h
titan.h
tlb_64.h sh64: Fixup the nommu build. 2008-05-08 19:51:37 +09:00
tlb.h sh: asm/tlb.h needs linux/pagemap.h for CONFIG_SWAP=n. 2008-02-14 14:22:11 +09:00
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h sh: Stub in cpu_to_node() and friends for NUMA build. 2008-05-08 13:40:17 +09:00
types.h sh: types: use <asm-generic/int-*.h> for the sh architecture 2008-05-02 16:18:40 -07:00
uaccess_32.h sh: Fix up __access_ok() check for nommu. 2008-04-18 09:50:02 -07:00
uaccess_64.h sh64: Fixup the nommu build. 2008-05-08 19:51:37 +09:00
uaccess.h sh: make copy_to/from_user() static inline 2008-02-14 14:22:09 +09:00
ubc.h sh: remove support for sh7300 and solution engine 7300 2007-07-26 15:37:57 +09:00
ucontext.h
unaligned.h kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
unistd_32.h sh: Wire up new timerfd syscalls. 2008-02-14 14:22:08 +09:00
unistd_64.h sh: Wire up new timerfd syscalls. 2008-02-14 14:22:08 +09:00
unistd.h sh: Split out syscall ABI for _32 and _64 variants. 2008-01-28 13:18:45 +09:00
user.h Sanitize the type of struct user.u_ar0 2008-02-07 08:42:30 -08:00
vga.h sh: Add a dummy vga.h. 2007-11-07 20:19:30 +09:00
watchdog.h
xor.h