📄 annotations.h
字号:
/* * 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. * *//***************************************************************** * annotations.h * * * Author: $Author: bosch $ * Date: $Date: 1998/02/10 00:29:37 $ ****************************************************************/#ifndef ANNOTATIONS_H#define ANNOTATIONS_H#include "simtypes.h"/***************************************************************** * Annotation Public Declarations ****************************************************************/typedef struct AnnRec *AnnPtr;extern AnnPtr *annExcTable;extern AnnPtr annRFE;extern AnnPtr annUTLB;extern int annExcNum, annInstNum;extern bool annLoads;extern bool annStores;extern bool annPCs;extern bool annWatchpoints;/* * Setup routines common to all simulators */void AnnCommonSetup(void);/* * Annotation naming */AnnPtr AnnFind(char *typeName, char *argStr);AnnPtr AnnFindInt(char *typeName, uint64 arg);/* * interation. Use as follows: * * AnnPtr iter; * int subtype; * for (subtype = AnnFirst(type, &iter); * iter; * subtype = AnnNext(&iter)) { ... * */uint64 AnnFirst(char *typeName, AnnPtr *iter);uint64 AnnNext(AnnPtr *iter);/* * return the maximum number of builtin args * * allows cpus simulators to make optimizations * like building tables for exceptions etc. * * -1 means infinite number of args */int AnnNumArg(char *typeName);/* * Annotation execution */void AnnExec(AnnPtr ann);/* * Check for and execute a pre- or post-PC annotation */#define ANN_TAG_SHIFT_SIZE 7#define ANN_CACHE_SIZE (1 << ANN_TAG_SHIFT_SIZE)#define ANN_INDEX_MASK (ANN_CACHE_SIZE - 1)#define ANN_TAG(_pc) ((_pc) >> ANN_TAG_SHIFT_SIZE)#define ANN_INDEX(_tag) ((_tag) & ANN_INDEX_MASK)typedef struct AnnCache { VA postAnnTag; uint postAnnBitVec; VA preAnnTag; uint preAnnBitVec;} AnnCache;extern AnnCache annCache[ANN_CACHE_SIZE];bool RunPCAnnotations(VA pc, VA nPC);#define RUN_PC_ANNOTATIONS(_pc,_npc) \ if (ANN_TAG(_pc) != annCache[ANN_INDEX(ANN_TAG(_pc))].postAnnTag || \ ANN_TAG(_npc) != annCache[ANN_INDEX(ANN_TAG(_npc))].preAnnTag) { \ RunPCAnnotations(_pc,_npc); \ }/***************************************************************** * Fast Memory (FM) Annotation Lookup * * This module provides a mechanism for cpu simulators * to quickly determine if there is a memory annotation * on a range of addresses. * ****************************************************************/#define ANNFM_PC_TYPE 0x0001#define ANNFM_PRE_PC_TYPE 0x0002#define ANNFM_LD_TYPE 0x0004#define ANNFM_ST_TYPE 0x0008#define ANNFM_ALL_TYPES (ANNFM_PC_TYPE|ANNFM_PRE_PC_TYPE|ANNFM_LD_TYPE|ANNFM_ST_TYPE)void AnnFMInit(uint rangeSize);int AnnFMRangeCheck(VA addr, int types);uint AnnFMRangeVector(VA addr, int types);AnnPtr AnnFMLookup(VA addr, int type);void AnnFMExec(VA addr, int type);int AnnFMTypesExist(int type);/***************************************************************** * * Random Annotations that don't fit anywhere else * ****************************************************************/extern uint scacheAnnotation;extern void ScacheAnnotation(VA _vAddr, PA _pAddr, uint type, uint cpu);#endif /* ANNOTATIONS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -