mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-28 15:13:55 +08:00
f52bb72254
The current phys_to_virt patching mechanism works only for 32 bit physical addresses and this patch extends the idea for 64bit physical addresses. The 64bit v2p patching mechanism patches the higher 8 bits of physical address with a constant using 'mov' instruction and lower 32bits are patched using 'add'. While this is correct, in those platforms where the lowmem addressable physical memory spawns across 4GB boundary, a carry bit can be produced as a result of addition of lower 32bits. This has to be taken in to account and added in to the upper. The patched __pv_offset and va are added in lower 32bits, where __pv_offset can be in two's complement form when PA_START < VA_START and that can result in a false carry bit. e.g 1) PA = 0x80000000; VA = 0xC0000000 __pv_offset = PA - VA = 0xC0000000 (2's complement) 2) PA = 0x2 80000000; VA = 0xC000000 __pv_offset = PA - VA = 0x1 C0000000 So adding __pv_offset + VA should never result in a true overflow for (1). So in order to differentiate between a true carry, a __pv_offset is extended to 64bit and the upper 32bits will have 0xffffffff if __pv_offset is 2's complement. So 'mvn #0' is inserted instead of 'mov' while patching for the same reason. Since mov, add, sub instruction are to patched with different constants inside the same stub, the rotation field of the opcode is using to differentiate between them. So the above examples for v2p translation becomes for VA=0xC0000000, 1) PA[63:32] = 0xffffffff PA[31:0] = VA + 0xC0000000 --> results in a carry PA[63:32] = PA[63:32] + carry PA[63:0] = 0x0 80000000 2) PA[63:32] = 0x1 PA[31:0] = VA + 0xC0000000 --> results in a carry PA[63:32] = PA[63:32] + carry PA[63:0] = 0x2 80000000 The above ideas were suggested by Nicolas Pitre <nico@linaro.org> as part of the review of first and second versions of the subject patch. There is no corresponding change on the phys_to_virt() side, because computations on the upper 32-bits would be discarded anyway. Cc: Russell King <linux@arm.linux.org.uk> Reviewed-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Sricharan R <r.sricharan@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
160 lines
3.7 KiB
C
160 lines
3.7 KiB
C
/*
|
|
* linux/arch/arm/kernel/armksyms.c
|
|
*
|
|
* Copyright (C) 2000 Russell King
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#include <linux/export.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/string.h>
|
|
#include <linux/cryptohash.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/in6.h>
|
|
#include <linux/syscalls.h>
|
|
#include <linux/uaccess.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <asm/checksum.h>
|
|
#include <asm/ftrace.h>
|
|
|
|
/*
|
|
* libgcc functions - functions that are used internally by the
|
|
* compiler... (prototypes are not correct though, but that
|
|
* doesn't really matter since they're not versioned).
|
|
*/
|
|
extern void __ashldi3(void);
|
|
extern void __ashrdi3(void);
|
|
extern void __divsi3(void);
|
|
extern void __lshrdi3(void);
|
|
extern void __modsi3(void);
|
|
extern void __muldi3(void);
|
|
extern void __ucmpdi2(void);
|
|
extern void __udivsi3(void);
|
|
extern void __umodsi3(void);
|
|
extern void __do_div64(void);
|
|
|
|
extern void __aeabi_idiv(void);
|
|
extern void __aeabi_idivmod(void);
|
|
extern void __aeabi_lasr(void);
|
|
extern void __aeabi_llsl(void);
|
|
extern void __aeabi_llsr(void);
|
|
extern void __aeabi_lmul(void);
|
|
extern void __aeabi_uidiv(void);
|
|
extern void __aeabi_uidivmod(void);
|
|
extern void __aeabi_ulcmp(void);
|
|
|
|
extern void fpundefinstr(void);
|
|
|
|
/* platform dependent support */
|
|
EXPORT_SYMBOL(arm_delay_ops);
|
|
|
|
/* networking */
|
|
EXPORT_SYMBOL(csum_partial);
|
|
EXPORT_SYMBOL(csum_partial_copy_from_user);
|
|
EXPORT_SYMBOL(csum_partial_copy_nocheck);
|
|
EXPORT_SYMBOL(__csum_ipv6_magic);
|
|
|
|
/* io */
|
|
#ifndef __raw_readsb
|
|
EXPORT_SYMBOL(__raw_readsb);
|
|
#endif
|
|
#ifndef __raw_readsw
|
|
EXPORT_SYMBOL(__raw_readsw);
|
|
#endif
|
|
#ifndef __raw_readsl
|
|
EXPORT_SYMBOL(__raw_readsl);
|
|
#endif
|
|
#ifndef __raw_writesb
|
|
EXPORT_SYMBOL(__raw_writesb);
|
|
#endif
|
|
#ifndef __raw_writesw
|
|
EXPORT_SYMBOL(__raw_writesw);
|
|
#endif
|
|
#ifndef __raw_writesl
|
|
EXPORT_SYMBOL(__raw_writesl);
|
|
#endif
|
|
|
|
/* string / mem functions */
|
|
EXPORT_SYMBOL(strchr);
|
|
EXPORT_SYMBOL(strrchr);
|
|
EXPORT_SYMBOL(memset);
|
|
EXPORT_SYMBOL(memcpy);
|
|
EXPORT_SYMBOL(memmove);
|
|
EXPORT_SYMBOL(memchr);
|
|
EXPORT_SYMBOL(__memzero);
|
|
|
|
#ifdef CONFIG_MMU
|
|
EXPORT_SYMBOL(copy_page);
|
|
|
|
EXPORT_SYMBOL(__copy_from_user);
|
|
EXPORT_SYMBOL(__copy_to_user);
|
|
EXPORT_SYMBOL(__clear_user);
|
|
|
|
EXPORT_SYMBOL(__get_user_1);
|
|
EXPORT_SYMBOL(__get_user_2);
|
|
EXPORT_SYMBOL(__get_user_4);
|
|
|
|
EXPORT_SYMBOL(__put_user_1);
|
|
EXPORT_SYMBOL(__put_user_2);
|
|
EXPORT_SYMBOL(__put_user_4);
|
|
EXPORT_SYMBOL(__put_user_8);
|
|
#endif
|
|
|
|
/* gcc lib functions */
|
|
EXPORT_SYMBOL(__ashldi3);
|
|
EXPORT_SYMBOL(__ashrdi3);
|
|
EXPORT_SYMBOL(__divsi3);
|
|
EXPORT_SYMBOL(__lshrdi3);
|
|
EXPORT_SYMBOL(__modsi3);
|
|
EXPORT_SYMBOL(__muldi3);
|
|
EXPORT_SYMBOL(__ucmpdi2);
|
|
EXPORT_SYMBOL(__udivsi3);
|
|
EXPORT_SYMBOL(__umodsi3);
|
|
EXPORT_SYMBOL(__do_div64);
|
|
|
|
#ifdef CONFIG_AEABI
|
|
EXPORT_SYMBOL(__aeabi_idiv);
|
|
EXPORT_SYMBOL(__aeabi_idivmod);
|
|
EXPORT_SYMBOL(__aeabi_lasr);
|
|
EXPORT_SYMBOL(__aeabi_llsl);
|
|
EXPORT_SYMBOL(__aeabi_llsr);
|
|
EXPORT_SYMBOL(__aeabi_lmul);
|
|
EXPORT_SYMBOL(__aeabi_uidiv);
|
|
EXPORT_SYMBOL(__aeabi_uidivmod);
|
|
EXPORT_SYMBOL(__aeabi_ulcmp);
|
|
#endif
|
|
|
|
/* bitops */
|
|
EXPORT_SYMBOL(_set_bit);
|
|
EXPORT_SYMBOL(_test_and_set_bit);
|
|
EXPORT_SYMBOL(_clear_bit);
|
|
EXPORT_SYMBOL(_test_and_clear_bit);
|
|
EXPORT_SYMBOL(_change_bit);
|
|
EXPORT_SYMBOL(_test_and_change_bit);
|
|
EXPORT_SYMBOL(_find_first_zero_bit_le);
|
|
EXPORT_SYMBOL(_find_next_zero_bit_le);
|
|
EXPORT_SYMBOL(_find_first_bit_le);
|
|
EXPORT_SYMBOL(_find_next_bit_le);
|
|
|
|
#ifdef __ARMEB__
|
|
EXPORT_SYMBOL(_find_first_zero_bit_be);
|
|
EXPORT_SYMBOL(_find_next_zero_bit_be);
|
|
EXPORT_SYMBOL(_find_first_bit_be);
|
|
EXPORT_SYMBOL(_find_next_bit_be);
|
|
#endif
|
|
|
|
#ifdef CONFIG_FUNCTION_TRACER
|
|
#ifdef CONFIG_OLD_MCOUNT
|
|
EXPORT_SYMBOL(mcount);
|
|
#endif
|
|
EXPORT_SYMBOL(__gnu_mcount_nc);
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
|
|
EXPORT_SYMBOL(__pv_phys_offset);
|
|
EXPORT_SYMBOL(__pv_offset);
|
|
#endif
|