root/fs/umsdos/check.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. check_one_table
  2. check_page_tables

   1 #include <asm/system.h>
   2 
   3 #include <linux/signal.h>
   4 #include <linux/sched.h>
   5 #include <linux/head.h>
   6 #include <linux/kernel.h>
   7 #include <linux/errno.h>
   8 #include <linux/string.h>
   9 #include <linux/types.h>
  10 #include <linux/ptrace.h>
  11 #include <linux/mman.h>
  12 
  13 extern unsigned long high_memory;
  14 
  15 static int check_one_table(unsigned long * page_dir)
     /* [previous][next][first][last][top][bottom][index][help] */
  16 {
  17         unsigned long pg_table = *page_dir;
  18 
  19         if (!pg_table)
  20                 return 0;
  21         if (pg_table >= high_memory || !(pg_table & PAGE_PRESENT)) {
  22                 return 1;
  23         }
  24         return 0;
  25 }
  26 
  27 /*
  28  * This function frees up all page tables of a process when it exits.
  29  */
  30 void check_page_tables(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  31 {
  32         unsigned long pg_dir;
  33         static int err = 0;
  34 
  35         int stack_level = (long)(&pg_dir)-current->kernel_stack_page;
  36         if (stack_level < 1500) printk ("** %d ** ",stack_level);
  37         pg_dir = current->tss.cr3;
  38         if (mem_map[MAP_NR(pg_dir)] > 1) {
  39                 return;
  40         }
  41         if (err == 0){
  42                 unsigned long *page_dir = (unsigned long *) pg_dir;
  43                 unsigned long *base = page_dir;
  44                 int i;
  45                 for (i = 0 ; i < PTRS_PER_PAGE ; i++,page_dir++){
  46                         int notok = check_one_table(page_dir);
  47                         if (notok){
  48                                 err++;
  49                                 printk ("|%d| ",page_dir-base);
  50                         }
  51                 }
  52                 if (err) printk ("Erreur MM %d\n",err);
  53         }
  54 }
  55 

/* [previous][next][first][last][top][bottom][index][help] */