root.h File Reference

Root Sets. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int tm_root_add (const char *name, const void *l, const void *h)
 API: Add a root set.
void tm_root_remove (const char *name, const void *l, const void *h)
int tm_ptr_is_in_root_set (const void *ptr)

Detailed Description

Root Sets.

Definition in file root.h.


Function Documentation

int tm_ptr_is_in_root_set ( const void *  ptr  ) 

Definition at line 274 of file root.c.

References tm_root::h, tm_root::l, tm_data::nroots, tm_data::roots, and tm.

Referenced by tm_init().

00275 {
00276   int i;
00277 
00278   for ( i = 0; i < tm.nroots; ++ i ) {
00279     if ( tm.roots[i].l <= ptr && ptr < tm.roots[i].h ) {
00280       return i + 1;
00281     }
00282   }
00283 
00284   return 0;
00285 }

Here is the caller graph for this function:

int tm_root_add ( const char *  name,
const void *  l,
const void *  h 
)

API: Add a root set.

Definition at line 205 of file root.c.

00206 {
00207   tm_root a;
00208 
00209   a.name = name;
00210   a.l = l;
00211   a.h = h;
00212 
00213   tm.root_newi = -1;
00214 
00215   tm_msg("R A [%p,%p] %s PRE\n", 
00216          a.l, 
00217          a.h,
00218          a.name);
00219 
00220   _tm_root_add(&a);
00221 
00222   return tm.root_newi;
00223 }

void tm_root_remove ( const char *  name,
const void *  l,
const void *  h 
)

Definition at line 226 of file root.c.

00227 {
00228   int i;
00229   tm_root *a, *b, c[2];
00230 
00231   /* Add to anti-roots list. */
00232   b = &tm.aroots[i = tm.naroots ++];
00233   b->name = name;
00234   b->l = l;
00235   b->h = h;
00236 
00237   tm_msg("R A [%p,%p] %s ANTI-ROOT %d\n", 
00238          tm.aroots[i].l, 
00239          tm.aroots[i].h,
00240          tm.aroots[i].name,
00241          i);
00242 
00243   /* Adding a anti-root might require splitting existing roots. */
00244   /* Do not split tm.root[0], it's the machine register set! */
00245 
00246   for ( i = tm.root_datai; i < tm.nroots; ++ i ) {
00247     int j;
00248      
00249     for ( j = 0; j < tm.naroots; ++ j ) {
00250       a = &tm.roots[i];
00251       b = &tm.aroots[j];
00252       
00253       switch ( tm_root_subtract(a, b, c) ) {
00254       case -1: /* deleted */
00255         a->l = a->h = 0;
00256         j = tm.naroots;
00257         break;
00258         
00259       case 1: /* clipped */
00260         *a = *c;
00261         break;
00262         
00263       case 2: /* split */
00264         *a = *c;
00265         _tm_root_add(&c[1]);
00266         i = 1; j = -1; /* restart */
00267         break;
00268       }
00269     }
00270   }
00271 }


Generated on Mon Jan 25 06:33:12 2010 for TM(tredmill) by  doxygen 1.6.1