registry.h 2.12 KB
/*
 * Copyright (C) 1996-1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * 
 * This file is part of the SimOS distribution. 
 * See LICENSE file for terms of the license. 
 *
 */

/*****************************************************************
 * registry.h
 *
 * Registry for backdoor areas and functions.
 * Created by: Steve Herrod
 * Revised by: Dan Teodosiu, 07/96
 *
 ****************************************************************/

#ifndef _REGISTRY_H
#define _REGISTRY_H

#include "arch_specifics.h"

#define REGISTRY_BASE_ADDR K1BASE

void RegistryInit(void);

/* Function registry */
void RegistryAddSimFunction(void *ptr, void *func);
void *RegistryGetSimFunction(VA addr);

/* Range registry */
int  RegistryAddRange(VA start,VA size, uint flag, void *data, char *name);
void RegistryComplete(void);

bool RegistryIsInRange(VA addr, void **data, uint *flag);

VA   RegistryReverseMap(void *data);
void RegistryDumpEntries(void);

/* Flags used when specifying how to treat particular ranges of memory */
#define REG_DATA 0x1
#define REG_FUNC 0x2

/* Flags passed to backdoor functions */
#define BDOOR_LOAD        0x0
#define BDOOR_STORE       0x1

#define BDOOR_IS_LOAD(x)  (((x) & 1) == BDOOR_LOAD)
#define BDOOR_IS_STORE(x) (((x) & 1) == BDOOR_STORE)

/* assigning these guys their actual size in bytes so that
   BDDOR_SIZE returns something more useful */
#define BDOOR_BYTE   0x1
#define BDOOR_HALF   0x2
#define BDOOR_WORD   0x4
#define BDOOR_DOUBLE 0x8

#define BDOOR_SIZE_SHIFT 1
#define BDOOR_SIZE(x) ((x) >> BDOOR_SIZE_SHIFT)

#define BDOOR_LOAD_BYTE ((BDOOR_BYTE<<BDOOR_SIZE_SHIFT) | BDOOR_LOAD)
#define BDOOR_LOAD_HALF ((BDOOR_HALF<<BDOOR_SIZE_SHIFT) | BDOOR_LOAD)
#define BDOOR_LOAD_WORD ((BDOOR_WORD<<BDOOR_SIZE_SHIFT) | BDOOR_LOAD)
#define BDOOR_LOAD_DOUBLE ((BDOOR_DOUBLE<<BDOOR_SIZE_SHIFT) | BDOOR_LOAD)

#define BDOOR_STORE_BYTE ((BDOOR_BYTE<<BDOOR_SIZE_SHIFT) | BDOOR_STORE)
#define BDOOR_STORE_HALF ((BDOOR_HALF<<BDOOR_SIZE_SHIFT) | BDOOR_STORE)
#define BDOOR_STORE_WORD ((BDOOR_WORD<<BDOOR_SIZE_SHIFT) | BDOOR_STORE)
#define BDOOR_STORE_DOUBLE ((BDOOR_DOUBLE<<BDOOR_SIZE_SHIFT) | BDOOR_STORE)

#endif