__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
*/
/*
* Helpers for implemenintg paging levels
*/
#ifndef _ASM_ARC_PGTABLE_LEVELS_H
#define _ASM_ARC_PGTABLE_LEVELS_H
#if CONFIG_PGTABLE_LEVELS == 2
/*
* 2 level paging setup for software walked MMUv3 (ARC700) and MMUv4 (HS)
*
* [31] 32 bit virtual address [0]
* -------------------------------------------------------
* | | <---------- PGDIR_SHIFT ----------> |
* | | | <-- PAGE_SHIFT --> |
* -------------------------------------------------------
* | | |
* | | --> off in page frame
* | ---> index into Page Table
* ----> index into Page Directory
*
* Given software walk, the vaddr split is arbitrary set to 11:8:13
* However enabling of super page in a 2 level regime pegs PGDIR_SHIFT to
* super page size.
*/
#if defined(CONFIG_ARC_HUGEPAGE_16M)
#define PGDIR_SHIFT 24
#elif defined(CONFIG_ARC_HUGEPAGE_2M)
#define PGDIR_SHIFT 21
#else
/*
* No Super page case
* Default value provides 11:8:13 (8K), 10:10:12 (4K)
* Limits imposed by pgtable_t only PAGE_SIZE long
* (so 4K page can only have 1K entries: or 10 bits)
*/
#ifdef CONFIG_ARC_PAGE_SIZE_4K
#define PGDIR_SHIFT 22
#else
#define PGDIR_SHIFT 21
#endif
#endif
#else /* CONFIG_PGTABLE_LEVELS != 2 */
/*
* A default 3 level paging testing setup in software walked MMU
* MMUv4 (8K page): <4> : <7> : <8> : <13>
* A default 4 level paging testing setup in software walked MMU
* MMUv4 (8K page): <4> : <3> : <4> : <8> : <13>
*/
#define PGDIR_SHIFT 28
#if CONFIG_PGTABLE_LEVELS > 3
#define PUD_SHIFT 25
#endif
#if CONFIG_PGTABLE_LEVELS > 2
#define PMD_SHIFT 21
#endif
#endif /* CONFIG_PGTABLE_LEVELS */
#define PGDIR_SIZE BIT(PGDIR_SHIFT)
#define PGDIR_MASK (~(PGDIR_SIZE - 1))
#define PTRS_PER_PGD BIT(32 - PGDIR_SHIFT)
#if CONFIG_PGTABLE_LEVELS > 3
#define PUD_SIZE BIT(PUD_SHIFT)
#define PUD_MASK (~(PUD_SIZE - 1))
#define PTRS_PER_PUD BIT(PGDIR_SHIFT - PUD_SHIFT)
#endif
#if CONFIG_PGTABLE_LEVELS > 2
#define PMD_SIZE BIT(PMD_SHIFT)
#define PMD_MASK (~(PMD_SIZE - 1))
#define PTRS_PER_PMD BIT(PUD_SHIFT - PMD_SHIFT)
#endif
#define PTRS_PER_PTE BIT(PMD_SHIFT - PAGE_SHIFT)
#ifndef __ASSEMBLY__
#if CONFIG_PGTABLE_LEVELS > 3
#include <asm-generic/pgtable-nop4d.h>
#elif CONFIG_PGTABLE_LEVELS > 2
#include <asm-generic/pgtable-nopud.h>
#else
#include <asm-generic/pgtable-nopmd.h>
#endif
/*
* 1st level paging: pgd
*/
#define pgd_ERROR(e) \
pr_crit("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
#if CONFIG_PGTABLE_LEVELS > 3
/* In 4 level paging, p4d_* macros work on pgd */
#define p4d_none(x) (!p4d_val(x))
#define p4d_bad(x) ((p4d_val(x) & ~PAGE_MASK))
#define p4d_present(x) (p4d_val(x))
#define p4d_clear(xp) do { p4d_val(*(xp)) = 0; } while (0)
#define p4d_pgtable(p4d) ((pud_t *)(p4d_val(p4d) & PAGE_MASK))
#define p4d_page(p4d) virt_to_page(p4d_pgtable(p4d))
#define set_p4d(p4dp, p4d) (*(p4dp) = p4d)
/*
* 2nd level paging: pud
*/
#define pud_ERROR(e) \
pr_crit("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e))
#endif
#if CONFIG_PGTABLE_LEVELS > 2
/*
* In 3 level paging, pud_* macros work on pgd
* In 4 level paging, pud_* macros work on pud
*/
#define pud_none(x) (!pud_val(x))
#define pud_bad(x) ((pud_val(x) & ~PAGE_MASK))
#define pud_present(x) (pud_val(x))
#define pud_clear(xp) do { pud_val(*(xp)) = 0; } while (0)
#define pud_pgtable(pud) ((pmd_t *)(pud_val(pud) & PAGE_MASK))
#define pud_page(pud) virt_to_page(pud_pgtable(pud))
#define set_pud(pudp, pud) (*(pudp) = pud)
/*
* 3rd level paging: pmd
*/
#define pmd_ERROR(e) \
pr_crit("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
#define pmd_pfn(pmd) ((pmd_val(pmd) & PMD_MASK) >> PAGE_SHIFT)
#define pfn_pmd(pfn,prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
#define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot)
#endif
/*
* Due to the strange way generic pgtable level folding works, the pmd_* macros
* - are valid even for 2 levels (which supposedly only has pgd - pte)
* - behave differently for 2 vs. 3
* In 2 level paging (pgd -> pte), pmd_* macros work on pgd
* In 3+ level paging (pgd -> pmd -> pte), pmd_* macros work on pmd
*/
#define pmd_none(x) (!pmd_val(x))
#define pmd_bad(x) ((pmd_val(x) & ~PAGE_MASK))
#define pmd_present(x) (pmd_val(x))
#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0)
#define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK)
#define pmd_pfn(pmd) ((pmd_val(pmd) & PAGE_MASK) >> PAGE_SHIFT)
#define pmd_page(pmd) virt_to_page((void *)pmd_page_vaddr(pmd))
#define set_pmd(pmdp, pmd) (*(pmdp) = pmd)
#define pmd_pgtable(pmd) ((pgtable_t) pmd_page(pmd))
/*
* 4th level paging: pte
*/
#define pte_ERROR(e) \
pr_crit("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
#define PFN_PTE_SHIFT PAGE_SHIFT
#define pte_none(x) (!pte_val(x))
#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
#define pte_clear(mm,addr,ptep) set_pte_at(mm, addr, ptep, __pte(0))
#define pte_page(pte) pfn_to_page(pte_pfn(pte))
#define set_pte(ptep, pte) ((*(ptep)) = (pte))
#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
#define pfn_pte(pfn, prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
#ifdef CONFIG_ISA_ARCV2
#define pmd_leaf(x) (pmd_val(x) & _PAGE_HW_SZ)
#endif
#endif /* !__ASSEMBLY__ */
#endif
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Kbuild | File | 215 B | 0644 |
|
| arcregs.h | File | 9.44 KB | 0644 |
|
| asm-offsets.h | File | 165 B | 0644 |
|
| asserts.h | File | 958 B | 0644 |
|
| atomic-llsc.h | File | 2.71 KB | 0644 |
|
| atomic-spinlock.h | File | 2.88 KB | 0644 |
|
| atomic.h | File | 658 B | 0644 |
|
| atomic64-arcv2.h | File | 5.57 KB | 0644 |
|
| barrier.h | File | 1.34 KB | 0644 |
|
| bitops.h | File | 3.69 KB | 0644 |
|
| bug.h | File | 819 B | 0644 |
|
| cache.h | File | 3.52 KB | 0644 |
|
| cacheflush.h | File | 2.38 KB | 0644 |
|
| cachetype.h | File | 185 B | 0644 |
|
| checksum.h | File | 2.32 KB | 0644 |
|
| cmpxchg.h | File | 3.24 KB | 0644 |
|
| current.h | File | 548 B | 0644 |
|
| delay.h | File | 1.85 KB | 0644 |
|
| disasm.h | File | 3.72 KB | 0644 |
|
| dma.h | File | 218 B | 0644 |
|
| dsp-impl.h | File | 3.77 KB | 0644 |
|
| dsp.h | File | 796 B | 0644 |
|
| dwarf.h | File | 1.04 KB | 0644 |
|
| elf.h | File | 1.89 KB | 0644 |
|
| entry-arcv2.h | File | 7.71 KB | 0644 |
|
| entry-compact.h | File | 9.45 KB | 0644 |
|
| entry.h | File | 4.42 KB | 0644 |
|
| exec.h | File | 264 B | 0644 |
|
| fpu.h | File | 1.1 KB | 0644 |
|
| futex.h | File | 3.53 KB | 0644 |
|
| highmem.h | File | 1.39 KB | 0644 |
|
| hugepage.h | File | 2.14 KB | 0644 |
|
| io.h | File | 5.97 KB | 0644 |
|
| irq.h | File | 737 B | 0644 |
|
| irqflags-arcv2.h | File | 3.41 KB | 0644 |
|
| irqflags-compact.h | File | 4.31 KB | 0644 |
|
| irqflags.h | File | 363 B | 0644 |
|
| jump_label.h | File | 1.91 KB | 0644 |
|
| kdebug.h | File | 254 B | 0644 |
|
| kgdb.h | File | 1.21 KB | 0644 |
|
| kprobes.h | File | 1.06 KB | 0644 |
|
| linkage.h | File | 1.45 KB | 0644 |
|
| mach_desc.h | File | 1.9 KB | 0644 |
|
| mmu-arcv2.h | File | 2.46 KB | 0644 |
|
| mmu.h | File | 486 B | 0644 |
|
| mmu_context.h | File | 5.44 KB | 0644 |
|
| module.h | File | 428 B | 0644 |
|
| page.h | File | 3.22 KB | 0644 |
|
| pci.h | File | 360 B | 0644 |
|
| perf_event.h | File | 2 KB | 0644 |
|
| pgalloc.h | File | 2.68 KB | 0644 |
|
| pgtable-bits-arcv2.h | File | 4.79 KB | 0644 |
|
| pgtable-levels.h | File | 5.44 KB | 0644 |
|
| pgtable.h | File | 780 B | 0644 |
|
| processor.h | File | 2.96 KB | 0644 |
|
| ptrace.h | File | 4.39 KB | 0644 |
|
| sections.h | File | 261 B | 0644 |
|
| serial.h | File | 498 B | 0644 |
|
| setup.h | File | 1.21 KB | 0644 |
|
| shmparam.h | File | 297 B | 0644 |
|
| smp.h | File | 3.82 KB | 0644 |
|
| spinlock.h | File | 8.38 KB | 0644 |
|
| spinlock_types.h | File | 905 B | 0644 |
|
| stacktrace.h | File | 1.15 KB | 0644 |
|
| string.h | File | 1.01 KB | 0644 |
|
| switch_to.h | File | 553 B | 0644 |
|
| syscall.h | File | 1.73 KB | 0644 |
|
| syscalls.h | File | 547 B | 0644 |
|
| thread_info.h | File | 3.35 KB | 0644 |
|
| timex.h | File | 362 B | 0644 |
|
| tlb.h | File | 262 B | 0644 |
|
| tlbflush.h | File | 1.62 KB | 0644 |
|
| uaccess.h | File | 15.54 KB | 0644 |
|
| unistd.h | File | 305 B | 0644 |
|
| unwind.h | File | 3.37 KB | 0644 |
|
| vermagic.h | File | 157 B | 0644 |
|
| vmalloc.h | File | 87 B | 0644 |
|