<commit_before>/**
 * Show the kernel page table, with some information about how an address to
 * paged memory is resolved.
 *
 * Code inspired from x86 dump page implementation:
 * https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/mm/dump_pagetables.c
 *
 * Documentation:
 * * ARM:
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mm/dump.c
 *     Debug helper to dump the current kernel pagetables of the system.
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/include/asm/pgtable-3level.h
 *     Page bits for 3-level page tables
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mm/mmu.c
 *     struct mem_type mem_types[] definition
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/memory.txt
 *     Memory structure
 *
 * * x86:
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/mm/dump_pagetables.c
 *     Debug helper to dump the current kernel pagetables of the system.
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/include/asm/pgtable_types.h
 *     Page bits
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/x86/x86_64/mm.txt
 *     Memory structure
 */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/debugfs.h>
#include <linux/kallsyms.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/sched.h>
#include <linux/version.h>

#include <asm/fixmap.h>
#include <asm/pgtable.h>

/* Merge large pagetables together on x86 */
#define PAGETABLES_MERGE_LARGE 1

/* Define some macros which prevents some #ifdef */
#ifdef CONFIG_ARM
# define pud_large(pgd) false
# define pgd_large(pgd) false

/* pmd_large has been introduced in ARM in Linux 3.14 by commit 1fd15b879d00
 * ("ARM: add support to dump the kernel page tables")
 */
# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)<commit_msg>linux/modules/pagetables: document qemu "info tlb" command<commit_after>/**
 * Show the kernel page table, with some information about how an address to
 * paged memory is resolved.
 *
 * Code inspired from x86 dump page implementation:
 * https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/mm/dump_pagetables.c
 *
 * Documentation:
 * * ARM:
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mm/dump.c
 *     Debug helper to dump the current kernel pagetables of the system.
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/include/asm/pgtable-3level.h
 *     Page bits for 3-level page tables
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mm/mmu.c
 *     struct mem_type mem_types[] definition
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/memory.txt
 *     Memory structure
 *
 * * x86:
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/mm/dump_pagetables.c
 *     Debug helper to dump the current kernel pagetables of the system.
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/include/asm/pgtable_types.h
 *     Page bits
 *   - https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/x86/x86_64/mm.txt
 *     Memory structure
 *
 * In qemu monitor console, "info tlb" show the page table ("virtual to physical memory mappings")
 */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/debugfs.h>
#include <linux/kallsyms.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/sched.h>
#include <linux/version.h>

#include <asm/fixmap.h>
#include <asm/pgtable.h>

/* Merge large pagetables together on x86 */
#define PAGETABLES_MERGE_LARGE 1

/* Define some macros which prevents some #ifdef */
#ifdef CONFIG_ARM
# define pud_large(pgd) false
# define pgd_large(pgd) false

/* pmd_large has been introduced in ARM in Linux 3.14 by commit 1fd15b879d00
 * ("ARM: add support to dump the kernel page tables")
 */
# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
{'fraction_non_alphanumeric': 0.13656698846244408, 'fraction_numerical': 0.016953143395337884, 'mean_word_length': 3.663007683863886, 'pattern_counts': {'":': 2, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2236305', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1515, 'n_words': 311}