cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

mm.h (1031B)


      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
     27static inline void *phys_to_virt(unsigned long address)
     28{
     29	return __va(address);
     30}
     31
     32void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
     33
     34static inline void totalram_pages_inc(void)
     35{
     36}
     37
     38static inline void totalram_pages_add(long count)
     39{
     40}
     41
     42#endif