Artifact a407a51baf00ccf650247da6c715e0ff11e81ab5:


0000: 2f 2a 20 49 6e 73 74 72 75 63 74 69 6f 6e 20 63  /* Instruction c
0010: 61 63 68 65 20 66 6c 75 73 68 69 6e 67 20 66 6f  ache flushing fo
0020: 72 20 68 70 70 61 20 2a 2f 0a 0a 2f 2a 0a 20 2a  r hppa */../*. *
0030: 20 43 6f 70 79 72 69 67 68 74 20 31 39 39 35 2d   Copyright 1995-
0040: 31 39 39 37 20 42 72 75 6e 6f 20 48 61 69 62 6c  1997 Bruno Haibl
0050: 65 2c 20 3c 62 72 75 6e 6f 40 63 6c 69 73 70 2e  e, <bruno@clisp.
0060: 6f 72 67 3e 0a 20 2a 0a 20 2a 20 54 68 69 73 20  org>. *. * This 
0070: 69 73 20 66 72 65 65 20 73 6f 66 74 77 61 72 65  is free software
0080: 20 64 69 73 74 72 69 62 75 74 65 64 20 75 6e 64   distributed und
0090: 65 72 20 74 68 65 20 47 4e 55 20 47 65 6e 65 72  er the GNU Gener
00a0: 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 63  al Public Licenc
00b0: 65 0a 20 2a 20 64 65 73 63 72 69 62 65 64 20 69  e. * described i
00c0: 6e 20 74 68 65 20 66 69 6c 65 20 43 4f 50 59 49  n the file COPYI
00d0: 4e 47 2e 20 43 6f 6e 74 61 63 74 20 74 68 65 20  NG. Contact the 
00e0: 61 75 74 68 6f 72 20 69 66 20 79 6f 75 20 64 6f  author if you do
00f0: 6e 27 74 20 68 61 76 65 20 74 68 69 73 0a 20 2a  n't have this. *
0100: 20 6f 72 20 63 61 6e 27 74 20 6c 69 76 65 20 77   or can't live w
0110: 69 74 68 20 69 74 2e 20 54 68 65 72 65 20 69 73  ith it. There is
0120: 20 41 42 53 4f 4c 55 54 45 4c 59 20 4e 4f 20 57   ABSOLUTELY NO W
0130: 41 52 52 41 4e 54 59 2c 20 65 78 70 6c 69 63 69  ARRANTY, explici
0140: 74 20 6f 72 20 69 6d 70 6c 69 65 64 2c 0a 20 2a  t or implied,. *
0150: 20 6f 6e 20 74 68 69 73 20 73 6f 66 74 77 61 72   on this softwar
0160: 65 2e 0a 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 54 68  e.. */../*. * Th
0170: 69 73 20 61 73 73 75 6d 65 73 20 74 68 61 74 20  is assumes that 
0180: 74 68 65 20 72 61 6e 67 65 20 5b 66 69 72 73 74  the range [first
0190: 5f 61 64 64 72 2e 2e 6c 61 73 74 5f 61 64 64 72  _addr..last_addr
01a0: 5d 20 6c 69 65 73 20 69 6e 20 61 74 20 6d 6f 73  ] lies in at mos
01b0: 74 20 74 77 6f 0a 20 2a 20 63 61 63 68 65 20 6c  t two. * cache l
01c0: 69 6e 65 73 2e 0a 20 2a 2f 0a 76 6f 69 64 20 5f  ines.. */.void _
01d0: 5f 54 52 5f 63 6c 65 61 72 5f 63 61 63 68 65 20  _TR_clear_cache 
01e0: 28 63 68 61 72 2a 20 66 69 72 73 74 5f 61 64 64  (char* first_add
01f0: 72 2c 20 63 68 61 72 2a 20 6c 61 73 74 5f 61 64  r, char* last_ad
0200: 64 72 29 0a 7b 0a 20 20 72 65 67 69 73 74 65 72  dr).{.  register
0210: 20 69 6e 74 20 74 6d 70 31 3b 0a 20 20 72 65 67   int tmp1;.  reg
0220: 69 73 74 65 72 20 69 6e 74 20 74 6d 70 32 3b 0a  ister int tmp2;.
0230: 20 20 2f 2a 20 46 6c 75 73 68 20 74 68 65 20 72    /* Flush the r
0240: 65 6c 65 76 61 6e 74 20 64 61 74 61 20 63 61 63  elevant data cac
0250: 68 65 20 6c 69 6e 65 73 2e 20 28 59 65 73 2c 20  he lines. (Yes, 
0260: 74 68 69 73 20 69 73 20 6e 65 65 64 65 64 2e 20  this is needed. 
0270: 49 20 74 72 69 65 64 20 69 74 2e 29 20 2a 2f 0a  I tried it.) */.
0280: 20 20 61 73 6d 20 76 6f 6c 61 74 69 6c 65 20 28    asm volatile (
0290: 22 66 64 63 20 30 28 30 2c 25 30 29 22 0a 20 20  "fdc 0(0,%0)".  
02a0: 20 20 20 20 20 20 20 22 5c 6e 5c 74 22 20 22 66         "\n\t" "f
02b0: 64 63 20 30 28 30 2c 25 31 29 22 0a 20 20 20 20  dc 0(0,%1)".    
02c0: 20 20 20 20 20 22 5c 6e 5c 74 22 20 22 73 79 6e       "\n\t" "syn
02d0: 63 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  c".             
02e0: 20 20 20 3a 0a 20 20 20 20 20 20 20 20 20 20 20     :.           
02f0: 20 20 20 20 20 3a 20 22 72 22 20 28 66 69 72 73       : "r" (firs
0300: 74 5f 61 64 64 72 29 2c 20 22 72 22 20 28 6c 61  t_addr), "r" (la
0310: 73 74 5f 61 64 64 72 29 0a 20 20 20 20 20 20 20  st_addr).       
0320: 20 20 20 20 20 20 20 20 29 3b 0a 20 20 2f 2a 20          );.  /* 
0330: 46 6c 75 73 68 20 74 68 65 20 72 65 6c 65 76 61  Flush the releva
0340: 6e 74 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 63  nt instruction c
0350: 61 63 68 65 20 6c 69 6e 65 73 2e 20 2a 2f 0a 20  ache lines. */. 
0360: 20 61 73 6d 20 76 6f 6c 61 74 69 6c 65 20 28 22   asm volatile ("
0370: 6d 66 73 70 20 25 25 73 72 30 2c 25 31 22 0a 20  mfsp %%sr0,%1". 
0380: 20 20 20 20 20 20 20 20 22 5c 6e 5c 74 22 20 22          "\n\t" "
0390: 6c 64 73 69 64 20 28 30 2c 25 34 29 2c 25 30 22  ldsid (0,%4),%0"
03a0: 0a 20 20 20 20 20 20 20 20 20 22 5c 6e 5c 74 22  .         "\n\t"
03b0: 20 22 6d 74 73 70 20 25 30 2c 25 25 73 72 30 22   "mtsp %0,%%sr0"
03c0: 0a 20 20 20 20 20 20 20 20 20 22 5c 6e 5c 74 22  .         "\n\t"
03d0: 20 22 66 69 63 20 30 28 25 25 73 72 30 2c 25 32   "fic 0(%%sr0,%2
03e0: 29 22 0a 20 20 20 20 20 20 20 20 20 22 5c 6e 5c  )".         "\n\
03f0: 74 22 20 22 66 69 63 20 30 28 25 25 73 72 30 2c  t" "fic 0(%%sr0,
0400: 25 33 29 22 0a 20 20 20 20 20 20 20 20 20 22 5c  %3)".         "\
0410: 6e 5c 74 22 20 22 73 79 6e 63 22 0a 20 20 20 20  n\t" "sync".    
0420: 20 20 20 20 20 22 5c 6e 5c 74 22 20 22 6d 74 73       "\n\t" "mts
0430: 70 20 25 31 2c 25 25 73 72 30 22 0a 20 20 20 20  p %1,%%sr0".    
0440: 20 20 20 20 20 22 5c 6e 5c 74 22 20 22 6e 6f 70       "\n\t" "nop
0450: 22 0a 20 20 20 20 20 20 20 20 20 22 5c 6e 5c 74  ".         "\n\t
0460: 22 20 22 6e 6f 70 22 0a 20 20 20 20 20 20 20 20  " "nop".        
0470: 20 22 5c 6e 5c 74 22 20 22 6e 6f 70 22 0a 20 20   "\n\t" "nop".  
0480: 20 20 20 20 20 20 20 22 5c 6e 5c 74 22 20 22 6e         "\n\t" "n
0490: 6f 70 22 0a 20 20 20 20 20 20 20 20 20 22 5c 6e  op".         "\n
04a0: 5c 74 22 20 22 6e 6f 70 22 0a 20 20 20 20 20 20  \t" "nop".      
04b0: 20 20 20 22 5c 6e 5c 74 22 20 22 6e 6f 70 22 0a     "\n\t" "nop".
04c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
04d0: 3a 20 22 3d 72 22 20 28 74 6d 70 31 29 2c 20 22  : "=r" (tmp1), "
04e0: 3d 72 22 20 28 74 6d 70 32 29 0a 20 20 20 20 20  =r" (tmp2).     
04f0: 20 20 20 20 20 20 20 20 20 20 20 3a 20 22 72 22             : "r"
0500: 20 28 66 69 72 73 74 5f 61 64 64 72 29 2c 20 22   (first_addr), "
0510: 72 22 20 28 6c 61 73 74 5f 61 64 64 72 29 2c 20  r" (last_addr), 
0520: 22 72 22 20 28 66 69 72 73 74 5f 61 64 64 72 29  "r" (first_addr)
0530: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
0540: 29 3b 0a 7d 0a                                   );.}.