root/arch/sparc/mm/vac-flush.c

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

DEFINITIONS

This source file includes following definitions.
  1. flush_vac_context
  2. flush_vac_segment
  3. flush_vac_page

   1 /* vac.c:   Routines for flushing various amount of the Sparc VAC
   2             (virtual address cache).
   3 
   4    Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
   5 */
   6 
   7 #include <asm/vac-ops.h>
   8 
   9 /* Flush all VAC entries for the current context */
  10 
  11 extern int do_hw_vac_flushes, vac_size, vac_linesize;
  12 extern int vac_entries_per_context, vac_entries_per_segment;
  13 extern int vac_entries_per_page;
  14 
  15 void
  16 flush_vac_context()
     /* [previous][next][first][last][top][bottom][index][help] */
  17 {
  18   register int entries_left, offset;
  19   register char* address;
  20 
  21   entries_left = vac_entries_per_context;
  22   address = (char *) 0;
  23 
  24   if(do_hw_vac_flushes)
  25     {
  26       while(entries_left-- >=0)
  27         {
  28           hw_flush_vac_context_entry(address);
  29           address += 4096;
  30         }
  31     }
  32   else
  33     {
  34       offset = vac_linesize;
  35       while(entries_left-- >=0)
  36         {
  37           sw_flush_vac_context_entry(address);
  38           address += offset;
  39         }
  40     }
  41 }
  42 
  43 void
  44 flush_vac_segment(register unsigned int segment)
     /* [previous][next][first][last][top][bottom][index][help] */
  45 {
  46   register int entries_left, offset;
  47   register char* address;
  48   
  49   entries_left = vac_entries_per_segment;
  50   __asm__ __volatile__("sll %0, 18, %1\n\t"
  51                        "sra %1, 0x2, %1\n\t"
  52                        : "=r" (segment) : "0" (address));
  53 
  54   if(do_hw_vac_flushes)
  55     {
  56       while(entries_left-- >=0)
  57         {
  58           hw_flush_vac_segment_entry(address);
  59           address += 4096;
  60         }
  61     }
  62   else
  63     {
  64       offset = vac_linesize;
  65       while(entries_left-- >=0)
  66         {
  67           sw_flush_vac_segment_entry(address);
  68           address += offset;
  69         }
  70     }
  71 }
  72 
  73 void
  74 flush_vac_page(register unsigned int addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  75 {
  76   register int entries_left, offset;
  77 
  78   if(do_hw_vac_flushes)
  79     {
  80       hw_flush_vac_page_entry(addr);
  81     }
  82   else
  83     {
  84       entries_left = vac_entries_per_page;
  85       offset = vac_linesize;
  86       while(entries_left-- >=0)
  87         {
  88           sw_flush_vac_page_entry(addr);
  89           addr += offset;
  90         }
  91     }
  92 }
  93   

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