The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
cross_state_manager.c File Reference

Per-thread page table. More...

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/kprobes.h>
#include <linux/mutex.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/version.h>
#include <asm/tlbflush.h>
#include <asm/page.h>
#include <asm/cacheflush.h>
#include <linux/uaccess.h>
#include "cross_state_manager.h"
+ Include dependency graph for cross_state_manager.c:

Go to the source code of this file.

Macros

#define EXPORT_SYMTAB
 
#define AUXILIARY_FRAMES   256
 
#define SET_BIT(p, n)   ((*(ulong *)(p)) |= (1LL << (n)))
 
#define CLR_BIT(p, n)   ((*(ulong *)(p)) &= ~((1LL) << (n)))
 
#define GET_BIT(p, n)   ((*(ulong *)(p)) & (1LL << (n)))
 

Typedefs

typedef void(* do_page_fault_t) (struct pt_regs *, unsigned long)
 

Functions

static int rs_ktblmgr_init (void)
 
static void rs_ktblmgr_cleanup (void)
 
static int rs_ktblmgr_open (struct inode *, struct file *)
 
static int rs_ktblmgr_release (struct inode *, struct file *)
 
static long rs_ktblmgr_ioctl (struct file *, unsigned int, unsigned long)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Alessandro Pellegrini <pellegrini@dis.uniroma1.it>, Francesco Quaglia <quaglia@dis.uniroma1.it>")
 
 MODULE_DESCRIPTION ("ROOT-Sim Multiple Page Table Kernel Module")
 
 module_init (rs_ktblmgr_init)
 
 module_exit (rs_ktblmgr_cleanup)
 
static DEFINE_MUTEX (rs_ktblmgr_mutex)
 Only one process can access this device (before spawning threads!)
 
static DEVICE_ATTR (multimap, S_IRUSR|S_IRGRP|S_IROTH, NULL, NULL)
 
static void rootsim_load_cr3 (pgd_t *pgdir)
 
static void set_single_pte_sticky_flag (void *target_address)
 
static void set_pte_sticky_flags (ioctl_info *info)
 
static int get_pde_sticky_bit (void *target_address)
 
static int get_pte_sticky_bit (void *target_address)
 
static int get_presence_bit (void *target_address)
 
static void set_presence_bit (void *target_address)
 
static void set_page_privilege (ioctl_info *info)
 
static void set_single_page_privilege (ioctl_info *info)
 
void root_sim_page_fault (struct pt_regs *regs, long error_code, do_page_fault_t kernel_handler)
 
 EXPORT_SYMBOL (root_sim_page_fault)
 
void the_pager (void)
 

Variables

void(* rootsim_pager )(void) =NULL
 
static int major
 Device major number.
 
static struct class * dev_cl = NULL
 Device class being created.
 
static struct device * device = NULL
 Device being created.
 
struct mutex pgd_get_mutex
 
struct mm_struct * mm_struct_addr [128]
 
void * pgd_addr [128]
 
unsigned int managed_pgds = 0
 
struct mm_struct * original_view [128]
 
int stack_index = 256 - 1
 
void * auxiliary_frames [256]
 
int root_sim_processes [128] ={[0 ... ( 128 -1)] = -1}
 
fault_info_troot_sim_fault_info [128]
 
int currently_open [128][1024]
 
int open_index [128] ={[0 ... ( 128 -1)] = -1}
 
void ** ancestor_pml4
 
int restore_pml4
 
int restore_pml4_entries
 
int mapped_processes
 
ulong callback
 
struct vm_area_struct * changed_mode_mmap
 
struct vm_operations_struct * original_vm_ops
 
struct vm_operations_struct auxiliary_vm_ops_table
 
struct vm_area_struct * target_vma
 
int(* original_fault_handler )(struct vm_area_struct *vma, struct vm_fault *vmf)
 
struct file_operations fops
 File operations for the module. More...
 
void(* flush_tlb_all_lookup )(void) = NULL
 This is to access the actual flush_tlb_all using a kernel proble.
 

Detailed Description

Per-thread page table.

This Linux kernel module implements a modification to the x86_64 page table management to support event cross state dependency tracking

This file is part of ROOT-Sim (ROme OpTimistic Simulator).

ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.

ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Author
Alessandro Pellegrini
Francesco Quaglia
Date
November 15, 2013 - Initial version
September 19, 2015 - Full restyle of the module, to use dynamic scheduler patching

Definition in file cross_state_manager.c.

Variable Documentation

struct file_operations fops
Initial value:
= {
open: rs_ktblmgr_open,
unlocked_ioctl: rs_ktblmgr_ioctl,
compat_ioctl: rs_ktblmgr_ioctl,
release: rs_ktblmgr_release
}

File operations for the module.

Definition at line 133 of file cross_state_manager.c.