KBUILD_CPPFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
KBUILD_AFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
- --------# KASAN_SHADOW_OFFSET = VA_START + (1 << (VA_BITS - KASAN_SHADOW_SCALE_SHIFT))
- --------# - (1 << (64 - KASAN_SHADOW_SCALE_SHIFT))
- --------# in 32-bit arithmetic
- --------KASAN_SHADOW_OFFSET := $(shell printf "0x%08x00000000\n" $$(( \
- -------- (0xffffffff & (-1 << ($(CONFIG_ARM64_VA_BITS) - 32))) \
- -------- + (1 << ($(CONFIG_ARM64_VA_BITS) - 32 - $(KASAN_SHADOW_SCALE_SHIFT))) \
- -------- - (1 << (64 - 32 - $(KASAN_SHADOW_SCALE_SHIFT))) )) )
- --------
export TEXT_OFFSET GZFLAGS
---------core-y += arch/arm64/kernel/ arch/arm64/mm/
---------core-$(CONFIG_NET) += arch/arm64/net/
---------core-$(CONFIG_KVM) += arch/arm64/kvm/
---------core-$(CONFIG_XEN) += arch/arm64/xen/
---------core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
+++++++++core-y += arch/arm64/
libs-y := arch/arm64/lib/ $(libs-y)
core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE)
#define FIXADDR_TOP (PCI_IO_START - SZ_2M)
- --------#define KERNEL_START _text
- --------#define KERNEL_END _end
+ ++++++++#if VA_BITS > 48
+ ++++++++#define VA_BITS_MIN (48)
+ ++++++++#else
+ ++++++++#define VA_BITS_MIN (VA_BITS)
+ ++++++++#endif
+ ++++++++
+ ++++++++#define _PAGE_END(va) (-(UL(1) << ((va) - 1)))
+
- -- -----#ifdef CONFIG_ARM64_USER_VA_BITS_52
+ ++++++++#define KERNEL_START _text
+ ++++++++#define KERNEL_END _end
+ ++ +++++
- #ifdef CONFIG_ARM64_USER_VA_BITS_52
+ ++++++++#ifdef CONFIG_ARM64_VA_BITS_52
#define MAX_USER_VA_BITS 52
#else
#define MAX_USER_VA_BITS VA_BITS
#define __tag_reset(addr) untagged_addr(addr)
#define __tag_get(addr) (__u8)((u64)(addr) >> 56)
#else
- #define __tag_set(addr, tag) (addr)
+ ++++++++#define __tag_shifted(tag) 0UL
+ ++ +++++#define __tag_reset(addr) (addr)
+ ++ +++++#define __tag_get(addr) 0
- #endif
+ ++++++++#endif /* CONFIG_KASAN_SW_TAGS */
+ ++++++++
+ static inline const void *__tag_set(const void *addr, u8 tag)
+ {
- -- ----- return addr;
+ ++++++++ u64 __addr = (u64)addr & ~__tag_shifted(0xff);
+ ++++++++ return (const void *)(__addr | __tag_shifted(tag));
+ }
- -- -----#define __tag_reset(addr) (addr)
- -- -----#define __tag_get(addr) 0
- -- -----#endif
- -- -----
/*
* Physical vs virtual RAM address space conversion. These are
* private definitions which should NOT be used outside memory.h
#define ARCH_PFN_OFFSET ((unsigned long)PHYS_PFN_OFFSET)
#if !defined(CONFIG_SPARSEMEM_VMEMMAP) || defined(CONFIG_DEBUG_VIRTUAL)
- --------#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
- --------#define _virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
+ ++++++++#define virt_to_page(x) pfn_to_page(virt_to_pfn(x))
#else
- --------#define __virt_to_pgoff(kaddr) (((u64)(kaddr) & ~PAGE_OFFSET) / PAGE_SIZE * sizeof(struct page))
- --------#define __page_to_voff(kaddr) (((u64)(kaddr) & ~VMEMMAP_START) * PAGE_SIZE / sizeof(struct page))
- --------
- --------#define page_to_virt(page) ({ \
- -------- unsigned long __addr = \
- -------- ((__page_to_voff(page)) | PAGE_OFFSET); \
- -- ----- const void *__addr_tag = \
- -- ----- __tag_set((void *)__addr, page_kasan_tag(page)); \
- unsigned long __addr_tag = \
- __tag_set(__addr, page_kasan_tag(page)); \
- -------- ((void *)__addr_tag); \
+ ++++++++#define page_to_virt(x) ({ \
+ ++++++++ __typeof__(x) __page = x; \
+ ++++++++ u64 __idx = ((u64)__page - VMEMMAP_START) / sizeof(struct page);\
+ ++++++++ u64 __addr = PAGE_OFFSET + (__idx * PAGE_SIZE); \
+ ++++++++ (void *)__tag_set((const void *)__addr, page_kasan_tag(__page));\
})
- --------#define virt_to_page(vaddr) ((struct page *)((__virt_to_pgoff(vaddr)) | VMEMMAP_START))
+ ++++++++#define virt_to_page(x) ({ \
+ ++++++++ u64 __idx = (__tag_reset((u64)x) - PAGE_OFFSET) / PAGE_SIZE; \
+ ++++++++ u64 __addr = VMEMMAP_START + (__idx * sizeof(struct page)); \
+ ++++++++ (struct page *)__addr; \
+ ++++++++})
+ ++++++++#endif /* !CONFIG_SPARSEMEM_VMEMMAP || CONFIG_DEBUG_VIRTUAL */
- --------#define _virt_addr_valid(kaddr) pfn_valid((((u64)(kaddr) & ~PAGE_OFFSET) \
- -------- + PHYS_OFFSET) >> PAGE_SHIFT)
- --------#endif
- --------#endif
+ ++++++++#define virt_addr_valid(addr) ({ \
+ ++++++++ __typeof__(addr) __addr = addr; \
+ ++++++++ __is_lm_address(__addr) && pfn_valid(virt_to_pfn(__addr)); \
+ ++++++++})
- --------#define _virt_addr_is_linear(kaddr) \
- -------- (__tag_reset((u64)(kaddr)) >= PAGE_OFFSET)
- --------#define virt_addr_valid(kaddr) \
- -------- (_virt_addr_is_linear(kaddr) && _virt_addr_valid(kaddr))
+ ++++++++#endif /* !ASSEMBLY */
/*
* Given that the GIC architecture permits ITS implementations that can only be