Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/include: Add mm.h file

Add a stubbed mm.h file with dummy page-related definitions,
memory alignment and physical to virtual address conversions,
so they can be used in testing.

Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/e8b83d96fec95f3556e80f001d9d5cbe18b8ad5f.1643796665.git.karolinadrobnik@gmail.com

authored by

Karolina Drobnik and committed by
Mike Rapoport
2473bc35 9c07af20

+42
+42
tools/include/linux/mm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _TOOLS_LINUX_MM_H 3 + #define _TOOLS_LINUX_MM_H 4 + 5 + #include <linux/mmzone.h> 6 + #include <uapi/linux/const.h> 7 + 8 + #define PAGE_SHIFT 12 9 + #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 10 + #define PAGE_MASK (~(PAGE_SIZE - 1)) 11 + 12 + #define PHYS_ADDR_MAX (~(phys_addr_t)0) 13 + 14 + #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) 15 + #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) 16 + #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) 17 + #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) 18 + 19 + #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) 20 + 21 + #define __va(x) ((void *)((unsigned long)(x))) 22 + #define __pa(x) ((unsigned long)(x)) 23 + 24 + #define pfn_to_page(pfn) ((void *)((pfn) * PAGE_SIZE)) 25 + 26 + #define phys_to_virt phys_to_virt 27 + static inline void *phys_to_virt(unsigned long address) 28 + { 29 + return __va(address); 30 + } 31 + 32 + void reserve_bootmem_region(phys_addr_t start, phys_addr_t end); 33 + 34 + static inline void totalram_pages_inc(void) 35 + { 36 + } 37 + 38 + static inline void totalram_pages_add(long count) 39 + { 40 + } 41 + 42 + #endif