Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * highmem.h: virtual kernel memory mappings for high memory
0004  *
0005  * Used in CONFIG_HIGHMEM systems for memory pages which
0006  * are not addressable by direct kernel virtual addresses.
0007  *
0008  * Copyright (C) 1999 Gerhard Wichert, Siemens AG
0009  *            Gerhard.Wichert@pdb.siemens.de
0010  *
0011  *
0012  * Redesigned the x86 32-bit VM architecture to deal with
0013  * up to 16 Terabyte physical memory. With current x86 CPUs
0014  * we now support up to 64 Gigabytes physical RAM.
0015  *
0016  * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
0017  */
0018 #ifndef _ASM_HIGHMEM_H
0019 #define _ASM_HIGHMEM_H
0020 
0021 #ifdef __KERNEL__
0022 
0023 #include <linux/bug.h>
0024 #include <linux/interrupt.h>
0025 #include <linux/uaccess.h>
0026 #include <asm/cpu-features.h>
0027 #include <asm/kmap_size.h>
0028 
0029 /* declarations for highmem.c */
0030 extern unsigned long highstart_pfn, highend_pfn;
0031 
0032 extern pte_t *pkmap_page_table;
0033 
0034 /*
0035  * Right now we initialize only a single pte table. It can be extended
0036  * easily, subsequent pte tables have to be allocated in one physical
0037  * chunk of RAM.
0038  */
0039 #if defined(CONFIG_PHYS_ADDR_T_64BIT) || defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
0040 #define LAST_PKMAP 512
0041 #else
0042 #define LAST_PKMAP 1024
0043 #endif
0044 
0045 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
0046 #define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
0047 #define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
0048 
0049 #define ARCH_HAS_KMAP_FLUSH_TLB
0050 extern void kmap_flush_tlb(unsigned long addr);
0051 
0052 #define flush_cache_kmaps() BUG_ON(cpu_has_dc_aliases)
0053 
0054 #define arch_kmap_local_set_pte(mm, vaddr, ptep, ptev)  set_pte(ptep, ptev)
0055 #define arch_kmap_local_post_map(vaddr, pteval) local_flush_tlb_one(vaddr)
0056 #define arch_kmap_local_post_unmap(vaddr)   local_flush_tlb_one(vaddr)
0057 
0058 #endif /* __KERNEL__ */
0059 
0060 #endif /* _ASM_HIGHMEM_H */