Artifact ee8d1dcd38d439cda73edde30631f95db250936b2911de4b99d65875cf47c4f9:
- Executable file
r38/lisp/csl/cslbase/prefix.h
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 1673) [annotate] [blame] [check-ins using] [more...]
/* prefix.h Copyright (C) 2003-2006 Gil Dabah, http://ragestorm.net/distorm/ This library is licensed under the BSD license. See the file COPYING. */ #ifndef ___PREFIX_H__ #define ___PREFIX_H__ #include "decoder.h" #include "wstring.h" // This holds the prefixes state for the current instruction we decode. // totalPrefixes includes all specific prefixes that the instruction got. // start is a pointer to the first prefix to take into account. // last is a pointer to the last byte we scanned. // Other pointers are used to keep track of prefixes positions and help us know if they appeared already and where. typedef struct { unsigned int unusedCount, specialPrefixesSize, isREXPrefixValid; _iflags totalPrefixes, usedPrefixes; const unsigned char *lokrepPos, *segovrdPos, *opsizePos, *addrsizePos, *rexpos, *start, *last; } _PrefixState; // Describe the type of the prefix and which one it was in a flag manner. typedef enum {PRE_NONE = -1, PRE_LOKREP, PRE_SEGOVRD, PRE_OPSIZE, PRE_ADDRSIZE, PRE_REX} _PrefixType; typedef struct { _iflags flag; _PrefixType type; } _PrefixInfo; // Intel supports 4 types of prefixes, whereas AMD supports 5 types (lock is seperated from rep/nz). // REX is the fifth prefix type, this time I'm based on AMD64. #define MAX_PREFIXES (5) int is_prefix(unsigned char ch, _DecodeType dt); void decode_prefixes(const unsigned char* code, long codeLen, _PrefixState* ps, _DecodeType dt); void get_unused_prefixes_list(unsigned char unusedList[MAX_PREFIXES], _PrefixState* ps, _DecodeType dt); void str_seg_text(_WString* s, _PrefixState* ps, _DecodeType dt); #endif // ___PREFIX_H__