本文整理汇总了C++中emitByte函数的典型用法代码示例。如果您正苦于以下问题:C++ emitByte函数的具体用法?C++ emitByte怎么用?C++ emitByte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emitByte函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: trap
void Assembler::movsd(XMMRegister src, Indirect dest) {
int rex = 0;
int src_idx = src.regnum;
int dest_idx = dest.base.regnum;
if (src_idx >= 8) {
rex |= REX_R;
src_idx -= 8;
}
if (dest_idx >= 8) {
trap();
rex |= REX_B;
dest_idx -= 8;
}
emitByte(0xf2);
if (rex)
emitRex(rex);
emitByte(0x0f);
emitByte(0x11);
bool needssib = (dest_idx == 0b100);
int mode = getModeFromOffset(dest.offset, dest_idx);
emitModRM(mode, src_idx, dest_idx);
if (needssib)
emitSIB(0b00, 0b100, dest_idx);
if (mode == 0b01) {
emitByte(dest.offset);
} else if (mode == 0b10) {
emitInt(dest.offset, 4);
}
}
开发者ID:ChinaQuants,项目名称:pyston,代码行数:34,代码来源:assembler.cpp
示例2: assert
void Assembler::incl(Indirect mem) {
int src_idx = mem.base.regnum;
int rex = 0;
if (src_idx >= 8) {
rex |= REX_B;
src_idx -= 8;
}
assert(src_idx >= 0 && src_idx < 8);
bool needssib = (src_idx == 0b100);
if (rex)
emitRex(rex);
emitByte(0xff);
assert(-0x80 <= mem.offset && mem.offset < 0x80);
if (mem.offset == 0) {
emitModRM(0b00, 0, src_idx);
if (needssib)
emitSIB(0b00, 0b100, src_idx);
} else {
emitModRM(0b01, 0, src_idx);
if (needssib)
emitSIB(0b00, 0b100, src_idx);
emitByte(mem.offset);
}
}
开发者ID:ChinaQuants,项目名称:pyston,代码行数:29,代码来源:assembler.cpp
示例3: emitMOVZX_EAX_WORD
static void emitMOVZX_EAX_WORD( int off ) // movzx eax,off[ecx]
{
emitByte( 0x0f );
emitByte( 0xb7 );
emitByte( 0x41 );
emitByte( off );
}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:7,代码来源:cb.c
示例4: emitByte
void Assembler::decq(Immediate imm) {
emitByte(0x48);
emitByte(0xff);
emitByte(0x0c);
emitByte(0x25);
emitInt(imm.val, 4);
}
开发者ID:ChinaQuants,项目名称:pyston,代码行数:7,代码来源:assembler.cpp
示例5: RELEASE_ASSERT
void Assembler::emitArith(Immediate imm, Register r, int opcode) {
// assert(r != RSP && "This breaks unwinding, please don't use.");
int64_t amount = imm.val;
RELEASE_ASSERT((-1L << 31) <= amount && amount < (1L << 31) - 1, "");
assert(0 <= opcode && opcode < 8);
int rex = REX_W;
int reg_idx = r.regnum;
if (reg_idx >= 8) {
rex |= REX_B;
reg_idx -= 8;
}
emitRex(rex);
if (-0x80 <= amount && amount < 0x80) {
emitByte(0x83);
emitModRM(0b11, opcode, reg_idx);
emitByte(amount);
} else {
emitByte(0x81);
emitModRM(0b11, opcode, reg_idx);
emitInt(amount, 4);
}
}
开发者ID:rainwoodman,项目名称:pyston,代码行数:26,代码来源:assembler.cpp
示例6: assert
void Assembler::cmp(Indirect mem, Immediate imm) {
int64_t val = imm.val;
assert((-1L << 31) <= val && val < (1L << 31) - 1);
int src_idx = mem.base.regnum;
int rex = REX_W;
if (src_idx >= 8) {
rex |= REX_B;
src_idx -= 8;
}
assert(src_idx >= 0 && src_idx < 8);
emitRex(rex);
emitByte(0x81);
assert(-0x80 <= mem.offset && mem.offset < 0x80);
if (mem.offset == 0) {
emitModRM(0b00, 7, src_idx);
} else {
emitModRM(0b01, 7, src_idx);
emitByte(mem.offset);
}
emitInt(val, 4);
}
开发者ID:rainwoodman,项目名称:pyston,代码行数:27,代码来源:assembler.cpp
示例7: RELEASE_ASSERT
void Assembler::emitArith(Immediate imm, Register r, int opcode, MovType type) {
// assert(r != RSP && "This breaks unwinding, please don't use.");
int64_t amount = imm.val;
RELEASE_ASSERT(fitsInto<int32_t>(amount), "");
assert(0 <= opcode && opcode < 8);
assert(type == MovType::Q || type == MovType::L);
int rex = type == MovType::Q ? REX_W : 0;
int reg_idx = r.regnum;
if (reg_idx >= 8) {
rex |= REX_B;
reg_idx -= 8;
}
if (rex)
emitRex(rex);
if (-0x80 <= amount && amount < 0x80) {
emitByte(0x83);
emitModRM(0b11, opcode, reg_idx);
emitByte(amount);
} else {
emitByte(0x81);
emitModRM(0b11, opcode, reg_idx);
emitInt(amount, 4);
}
}
开发者ID:ChinaQuants,项目名称:pyston,代码行数:28,代码来源:assembler.cpp
示例8: emitWord
static void emitWord( unsigned short word )
{
char hi,lo;
hi = word >> 8;
lo = word & 0xff;
emitByte( lo );
emitByte( hi );
}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:10,代码来源:cb.c
示例9: actionsDir1
void
actionsDir1(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands)
{
#define ZERO_PAGE_ADDRESS_BIT 0x00
#define NON_ZERO_PAGE_ADDRESS_BIT 0x08
if(class==EXPRESSION_OPND && isByteAddress(operand) &&
isDefined(operand)){
emitByte(binary | ZERO_PAGE_ADDRESS_BIT);
emitByte(address);
} else if (wordCheck(address)) {
开发者ID:Museum-of-Art-and-Digital-Entertainment,项目名称:macross,代码行数:11,代码来源:actions_6502.c
示例10: assert
void Assembler::jmp(JumpDestination dest) {
assert(dest.type == JumpDestination::FROM_START);
int offset = dest.offset - (addr - start_addr) - 2;
if (offset >= -0x80 && offset < 0x80) {
emitByte(0xeb);
emitByte(offset);
} else {
offset -= 3;
emitByte(0xe9);
emitInt(offset, 4);
}
}
开发者ID:kod3r,项目名称:pyston,代码行数:13,代码来源:assembler.cpp
示例11: emitCode
/*
* emitCode - generate callback code for a specified argument list
*/
static int emitCode( int argcnt, int bytecnt, char *array,
DWORD fn, int is_cdecl )
{
int i;
int offset;
emitOffset = 0;
emitMOV_EBX_const( fn ); // 32-bit callback routine
/*
* emit code to push parms from 16-bit stack onto 32-bit stack
*/
offset = bytecnt + 6;
if( is_cdecl ) {
i = argcnt-1;
} else {
i = 0;
}
while( argcnt > 0 ) {
if( array[i] == CB_DWORD ) {
offset -= 4;
emitMOV_EAX_DWORD( offset );
} else {
offset -= 2;
emitMOVZX_EAX_WORD( offset );
}
emitByte( PUSH_EAX );
if( is_cdecl ) {
i--;
} else {
i++;
}
--argcnt;
}
emitByte( PUSH_ES );
emitByte( POP_DS );
emitByte( PUSH_CS );
emitCALL_EBX();
if( is_cdecl ) {
emitADD_ESP_const( bytecnt );
emitMOV_DL_const( 0 );
} else {
emitMOV_DL_const( bytecnt );
}
emitByte( RET );
return( emitOffset );
} /* emitCode */
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:52,代码来源:cb.c
示例12: process_org
void process_org()
{
int64_t new_address;
NextToken();
new_address = expr();
if (!rel_out) {
if (segment==bssseg || segment==tlsseg) {
bss_address = new_address;
sections[segment].address = new_address;
}
else {
if (first_org && segment==codeseg) {
code_address = new_address;
start_address = new_address;
sections[0].address = new_address;
first_org = 0;
}
else {
while(sections[0].address < new_address)
emitByte(0x00);
}
}
}
ScanToEOL();
}
开发者ID:NoSuchProcess,项目名称:Cores,代码行数:26,代码来源:main.c
示例13: assert
void Assembler::jmp(Indirect dest) {
int reg_idx = dest.base.regnum;
assert(reg_idx >= 0 && reg_idx < 8 && "not yet implemented");
emitByte(0xFF);
if (dest.offset == 0) {
emitModRM(0b00, 0b100, reg_idx);
} else if (-0x80 <= dest.offset && dest.offset < 0x80) {
emitModRM(0b01, 0b100, reg_idx);
emitByte(dest.offset);
} else {
assert((-1L << 31) <= dest.offset && dest.offset < (1L << 31) - 1);
emitModRM(0b10, 0b100, reg_idx);
emitInt(dest.offset, 4);
}
}
开发者ID:jmgc,项目名称:pyston,代码行数:16,代码来源:assembler.cpp
示例14: process_fill
void process_fill()
{
char sz = 'b';
int64_t count;
int64_t val;
int64_t nn;
if (*inptr=='.') {
inptr++;
if (strchr("bchwBCHW",*inptr)) {
sz = tolower(*inptr);
inptr++;
}
else
printf("Illegal fill size.\r\n");
}
SkipSpaces();
NextToken();
count = expr();
prevToken();
need(',');
NextToken();
val = expr();
prevToken();
for (nn = 0; nn < count; nn++)
switch(sz) {
case 'b': emitByte(val); break;
case 'c': emitChar(val); break;
case 'h': emitHalf(val); break;
case 'w': emitWord(val); break;
}
}
开发者ID:NoSuchProcess,项目名称:Cores,代码行数:32,代码来源:main.c
示例15: trap
void Assembler::movsd(Indirect src, XMMRegister dest) {
int rex = 0;
int src_idx = src.base.regnum;
int dest_idx = dest.regnum;
if (src_idx >= 8) {
trap();
rex |= REX_R;
src_idx -= 8;
}
if (dest_idx >= 8) {
trap();
rex |= REX_B;
dest_idx -= 8;
}
emitByte(0xf2);
if (rex)
emitRex(rex);
emitByte(0x0f);
emitByte(0x10);
bool needssib = (src_idx == 0b100);
int mode;
if (src.offset == 0)
mode = 0b00;
else if (-0x80 <= src.offset && src.offset < 0x80)
mode = 0b01;
else
mode = 0b10;
emitModRM(mode, dest_idx, src_idx);
if (needssib)
emitSIB(0b00, 0b100, src_idx);
if (mode == 0b01) {
emitByte(src.offset);
} else if (mode == 0b10) {
emitInt(src.offset, 4);
}
}
开发者ID:kod3r,项目名称:pyston,代码行数:43,代码来源:assembler.cpp
示例16: emitRex
void Assembler::clear_reg(Register reg) {
int reg_idx = reg.regnum;
// we don't need to generate a REX_W because 32bit instructions will clear the upper 32bits.
if (reg_idx >= 8) {
emitRex(REX_R | REX_B);
reg_idx -= 8;
}
emitByte(0x31);
emitModRM(0b11, reg_idx, reg_idx);
}
开发者ID:c-rhodes,项目名称:pyston,代码行数:10,代码来源:assembler.cpp
示例17: emitByte
void
Violet::Generator::assemble()
{
emitByte(RETURN);
for(int i = 0; i < this->scopes.size(); i++)
{
(this->scopes[i])->locals.reserve(
(this->scopes[i])->local_bytes.size()
);
}
}
开发者ID:Vandise,项目名称:Violet,代码行数:11,代码来源:violetgenerator.cpp
示例18: assert
void Assembler::emitUInt(uint64_t n, int bytes) {
assert(bytes > 0 && bytes <= 8);
if (bytes < 8)
assert(n < ((1UL << (8 * bytes))));
for (int i = 0; i < bytes; i++) {
emitByte(n & 0xff);
n >>= 8;
}
ASSERT(n == 0, "%lu", n);
}
开发者ID:c-rhodes,项目名称:pyston,代码行数:11,代码来源:assembler.cpp
示例19: emitByte
void ByteData::emitOpcode (opcode _opcode)
{
int opcodeLength = _opcode.size();
opcode::iterator opcode_it = _opcode.begin();
for (int i = 0; i < opcodeLength; i++)
{
emitByte (*opcode_it);
++opcode_it;
}
}
开发者ID:Nexx0f,项目名称:CodeExecutor,代码行数:11,代码来源:ByteData.cpp
示例20: process_db
void process_db()
{
int64_t val;
SkipSpaces();
//NextToken();
while(token!=tk_eol) {
SkipSpaces();
if (*inptr=='\n') break;
if (*inptr=='"') {
inptr++;
while (*inptr!='"') {
if (*inptr=='\\') {
inptr++;
switch(*inptr) {
case '\\': emitByte('\\'); inptr++; break;
case 'r': emitByte(0x13); inptr++; break;
case 'n': emitByte(0x0A); inptr++; break;
case 'b': emitByte('\b'); inptr++; break;
case '"': emitByte('"'); inptr++; break;
default: inptr++; break;
}
}
else {
emitByte(*inptr);
inptr++;
}
}
inptr++;
}
else if (*inptr=='\'') {
inptr++;
emitByte(*inptr);
inptr++;
if (*inptr!='\'') {
printf("Missing ' in character constant.\r\n");
}
}
else {
NextToken();
val = expr();
emitByte(val & 255);
prevToken();
}
SkipSpaces();
if (*inptr!=',')
break;
inptr++;
}
ScanToEOL();
}
开发者ID:NoSuchProcess,项目名称:Cores,代码行数:51,代码来源:main.c
注:本文中的emitByte函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论