pgtable-2level-types.h (1278B)
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * arch/arm/include/asm/pgtable-2level-types.h 4 * 5 * Copyright (C) 1995-2003 Russell King 6 */ 7#ifndef _ASM_PGTABLE_2LEVEL_TYPES_H 8#define _ASM_PGTABLE_2LEVEL_TYPES_H 9 10#include <asm/types.h> 11 12typedef u32 pteval_t; 13typedef u32 pmdval_t; 14 15#undef STRICT_MM_TYPECHECKS 16 17#ifdef STRICT_MM_TYPECHECKS 18/* 19 * These are used to make use of C type-checking.. 20 */ 21typedef struct { pteval_t pte; } pte_t; 22typedef struct { pmdval_t pmd; } pmd_t; 23typedef struct { pmdval_t pgd[2]; } pgd_t; 24typedef struct { pteval_t pgprot; } pgprot_t; 25 26#define pte_val(x) ((x).pte) 27#define pmd_val(x) ((x).pmd) 28#define pgd_val(x) ((x).pgd[0]) 29#define pgprot_val(x) ((x).pgprot) 30 31#define __pte(x) ((pte_t) { (x) } ) 32#define __pmd(x) ((pmd_t) { (x) } ) 33#define __pgprot(x) ((pgprot_t) { (x) } ) 34 35#else 36/* 37 * .. while these make it easier on the compiler 38 */ 39typedef pteval_t pte_t; 40typedef pmdval_t pmd_t; 41typedef pmdval_t pgd_t[2]; 42typedef pteval_t pgprot_t; 43 44#define pte_val(x) (x) 45#define pmd_val(x) (x) 46#define pgd_val(x) ((x)[0]) 47#define pgprot_val(x) (x) 48 49#define __pte(x) (x) 50#define __pmd(x) (x) 51#define __pgprot(x) (x) 52 53#endif /* STRICT_MM_TYPECHECKS */ 54 55#endif /* _ASM_PGTABLE_2LEVEL_TYPES_H */