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

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