
















typedef struct _bsp_registration {
  void  *local_id;
  int    global_id;  
#ifdef BSP_DRMA
  void **remote_ids;
  int   *remote_sizes;
#else
  int    local_size;
#endif
  int   lineno;
  char *filename;

  struct _bsp_registration *next_local;
  struct _bsp_registration *next_global;
} bsp_registration;

extern void*              _bsp_reg_cached_local;
extern int                _bsp_reg_cached_global;
extern bsp_registration  *_bsp_reg_cached_registration;





#define REG_TABLE_SIZE 1024

#define hash_local(addr) MOD_POW2((((long int)addr)>>2),REG_TABLE_SIZE)
#define hash_global(num) MOD_POW2(num,REG_TABLE_SIZE)

#define bsp_register_local_to_global(addr)      \
   ((_bsp_reg_cached_local==(addr))?            \
      (_bsp_reg_cached_global):\
      (_bsp_register_local_to_global(addr)))

#ifdef BSP_DRMA
#define bsp_register_global_to_local(global,pid)      \
   ((_bsp_reg_cached_global==global)?                 \
      ((char*)_bsp_reg_cached_registration->remote_ids[pid]):\
      (_bsp_register_global_to_local(global,pid)))
  
#else
#define bsp_register_global_to_local(global,pid)      \
   ((_bsp_reg_cached_global==global)?                 \
      ((char*)_bsp_reg_cached_registration->local_id):\
      (_bsp_register_global_to_local(global,pid)))
#endif

