Comparing version 1.0.1 to 1.0.2
19
code.js
@@ -39,2 +39,3 @@ "use strict"; | ||
this.ClassOperands = o.Operands; | ||
this.AlignExpression = i.Align; | ||
this.littleEndian = true; | ||
@@ -69,4 +70,4 @@ this.methods = {}; | ||
var last = this.expr[this.expr.length - 1]; | ||
var all_offsets_known = last.offset !== i.OFFSET_UNKNOWN; | ||
var all_sizes_known = last.bytes() !== i.SIZE_UNKNOWN; | ||
var all_offsets_known = last.offset >= 0; | ||
var all_sizes_known = last.bytes() >= 0; | ||
if (all_offsets_known && all_sizes_known) | ||
@@ -111,2 +112,14 @@ return; | ||
}; | ||
Code.prototype.align = function (bytes, fill) { | ||
if (bytes === void 0) { bytes = 4; } | ||
if (fill === void 0) { fill = null; } | ||
var align = new this.AlignExpression(bytes); | ||
if (fill !== null) { | ||
if (typeof fill === 'number') | ||
align.templates = [[fill]]; | ||
else | ||
align.templates = fill; | ||
} | ||
return this.insert(align); | ||
}; | ||
Code.prototype.dbv = function (a, b, c) { | ||
@@ -189,3 +202,3 @@ var ops; | ||
if (typeof doubles === 'number') | ||
return this.dw([doubles]); | ||
return this.dd([doubles]); | ||
return this.db(instruction_1.Data.numbersToOctets(doubles, 4, littleEndian)); | ||
@@ -192,0 +205,0 @@ }; |
16
code.ts
@@ -29,2 +29,3 @@ import {SIZE, number64, Tnumber, Operands} from './operand'; | ||
ClassOperands = o.Operands; | ||
AlignExpression = i.Align; | ||
@@ -83,6 +84,6 @@ littleEndian = true; // Which way to encode constants by default. | ||
var last = this.expr[this.expr.length - 1]; | ||
var all_offsets_known = last.offset !== i.OFFSET_UNKNOWN; | ||
var all_offsets_known = last.offset >= 0; | ||
// Edge case when only the last Expression has variable size. | ||
var all_sizes_known = last.bytes() !== i.SIZE_UNKNOWN; | ||
var all_sizes_known = last.bytes() >= 0; | ||
@@ -142,2 +143,11 @@ if(all_offsets_known && all_sizes_known) return; // Skip 2nd pass. | ||
align(bytes = 4, fill: number|number[][] = null) { | ||
var align = new this.AlignExpression(bytes); | ||
if(fill !== null) { | ||
if(typeof fill === 'number') align.templates = [[fill]] as number[][]; | ||
else align.templates = fill; | ||
} | ||
return this.insert(align); | ||
} | ||
// DB volatile | ||
@@ -217,3 +227,3 @@ dbv(ops: o.Operands, littleEndian: boolean): i.DataVariable; | ||
dd(doubles: number|number[], littleEndian = this.littleEndian): Data { | ||
if(typeof doubles === 'number') return this.dw([doubles as number]); | ||
if(typeof doubles === 'number') return this.dd([doubles as number]); | ||
return this.db(Data.numbersToOctets(doubles as number[], 4, littleEndian)); | ||
@@ -220,0 +230,0 @@ } |
@@ -108,10 +108,12 @@ "use strict"; | ||
}; | ||
Expression.prototype.formatToString = function (margin, expression, comment) { | ||
if (comment === void 0) { comment = ''; } | ||
expression = margin + expression; | ||
var spaces = (new Array(1 + Math.max(0, Expression.commentColls - expression.length))).join(' '); | ||
return expression + spaces + ("; " + this.formatOffset() + " ") + comment; | ||
}; | ||
Expression.prototype.toString = function (margin, comment) { | ||
if (margin === void 0) { margin = ''; } | ||
if (comment === void 0) { comment = true; } | ||
var cmt = ''; | ||
if (comment) { | ||
cmt = " ; " + this.formatOffset(); | ||
} | ||
return margin + '[expression]' + cmt; | ||
return this.formatToString(margin, '[expression]'); | ||
}; | ||
@@ -370,5 +372,71 @@ Expression.commentColls = 44; | ||
}; | ||
ExpressionVolatile.prototype.getFixedSizeExpression = function () { | ||
return this; | ||
}; | ||
return ExpressionVolatile; | ||
}(ExpressionVariable)); | ||
exports.ExpressionVolatile = ExpressionVolatile; | ||
var Align = (function (_super) { | ||
__extends(Align, _super); | ||
function Align(by) { | ||
_super.call(this); | ||
this.length = exports.SIZE_UNKNOWN; | ||
this.templates = [ | ||
[0x00], | ||
]; | ||
this.octets = []; | ||
this.by = by; | ||
} | ||
Align.prototype.bytesMax = function () { | ||
return this.by - 1; | ||
}; | ||
Align.prototype.write = function (arr) { | ||
arr = arr.concat(this.octets); | ||
return arr; | ||
}; | ||
Align.prototype.generateOctets = function () { | ||
if (!this.length) | ||
return; | ||
var bytes_left = this.bytes(); | ||
var max_tpl = this.templates.length; | ||
while (bytes_left > 0) { | ||
if (bytes_left > max_tpl) { | ||
this.octets = this.octets.concat(this.templates[max_tpl - 1]); | ||
bytes_left -= max_tpl; | ||
} | ||
else { | ||
this.octets = this.octets.concat(this.templates[bytes_left - 1]); | ||
bytes_left = 0; | ||
} | ||
} | ||
}; | ||
Align.prototype.calcOffset = function () { | ||
_super.prototype.calcOffset.call(this); | ||
var mod = (this.offset % this.by); | ||
this.length = mod ? this.by - mod : 0; | ||
this.generateOctets(); | ||
}; | ||
Align.prototype.toString = function (margin, comment) { | ||
if (margin === void 0) { margin = ' '; } | ||
if (comment === void 0) { comment = true; } | ||
var cmt = ''; | ||
if (comment) { | ||
if (this.length >= 0) { | ||
var octets = ''; | ||
if (this.length) { | ||
octets = '0x' + this.octets.map(function (byte) { | ||
var str = byte.toString(16).toUpperCase(); | ||
return byte <= 0xF ? '0' + str : str; | ||
}).join(' 0x'); | ||
} | ||
cmt = this.length + ' bytes ' + octets; | ||
} | ||
else | ||
cmt = "max " + this.bytesMax() + " bytes"; | ||
} | ||
return this.formatToString(margin, 'align ' + this.by, cmt); | ||
}; | ||
return Align; | ||
}(ExpressionVolatile)); | ||
exports.Align = Align; | ||
var Instruction = (function (_super) { | ||
@@ -375,0 +443,0 @@ __extends(Instruction, _super); |
@@ -126,8 +126,10 @@ import {Def, DefMatchList} from './def'; | ||
formatToString(margin, expression, comment = '') { | ||
expression = margin + expression; | ||
var spaces = (new Array(1 + Math.max(0, Expression.commentColls - expression.length))).join(' '); | ||
return expression + spaces + `; ${this.formatOffset()} ` + comment; | ||
} | ||
toString(margin = '', comment = true): string { | ||
var cmt = ''; | ||
if(comment) { | ||
cmt = ` ; ${this.formatOffset()}`; | ||
} | ||
return margin + '[expression]' + cmt; | ||
return this.formatToString(margin, '[expression]'); | ||
} | ||
@@ -422,4 +424,2 @@ } | ||
export abstract class ExpressionVolatile extends ExpressionVariable { | ||
// If `Expression` can generate different size machine code this method forces it to pick one. | ||
abstract getFixedSizeExpression(); | ||
@@ -431,5 +431,81 @@ lengthMax = 0; | ||
} | ||
// If `Expression` can generate different size machine code this method forces it to pick one. | ||
getFixedSizeExpression() { | ||
return this; | ||
} | ||
} | ||
// Aligns data to some byte boundary. | ||
export class Align extends ExpressionVolatile { | ||
length = SIZE_UNKNOWN; | ||
// Align by 1 byte means "don't do any aligning", aligning by 2 bytes will insert at most 1 bytes. | ||
by: number; | ||
// Different size templates we use to fill in the empty bytes, templates grow sequentially by one byte in size. | ||
templates = [ | ||
[0x00], | ||
]; | ||
octets: number[] = []; | ||
constructor(by: number) { | ||
super(); | ||
this.by = by; | ||
} | ||
bytesMax() { | ||
return this.by - 1; | ||
} | ||
write(arr: number[]): number[] { | ||
arr = arr.concat(this.octets); | ||
return arr; | ||
} | ||
protected generateOctets() { | ||
if(!this.length) return; | ||
var bytes_left = this.bytes(); | ||
var max_tpl = this.templates.length; | ||
while(bytes_left > 0) { | ||
if(bytes_left > max_tpl) { | ||
this.octets = this.octets.concat(this.templates[max_tpl - 1]); | ||
bytes_left -= max_tpl; | ||
} else { | ||
this.octets = this.octets.concat(this.templates[bytes_left - 1]); | ||
bytes_left = 0; | ||
} | ||
} | ||
} | ||
calcOffset() { | ||
super.calcOffset(); | ||
var mod = (this.offset % this.by); | ||
this.length = mod ? this.by - mod : 0; | ||
this.generateOctets(); | ||
} | ||
toString(margin = ' ', comment = true) { | ||
var cmt = ''; | ||
if(comment) { | ||
if(this.length >= 0) { | ||
var octets = ''; | ||
if(this.length) { | ||
octets = '0x' + this.octets.map(function (byte) { | ||
var str = byte.toString(16).toUpperCase(); | ||
return byte <= 0xF ? '0' + str : str; | ||
}).join(' 0x'); | ||
} | ||
cmt = this.length + ' bytes ' + octets; | ||
} else cmt = `max ${this.bytesMax()} bytes`; | ||
} | ||
return this.formatToString(margin, 'align ' + this.by, cmt); | ||
} | ||
} | ||
export class Instruction extends ExpressionVolatile { | ||
@@ -436,0 +512,0 @@ def: Def = null; // Definition on how to construct this instruction. |
@@ -18,4 +18,16 @@ "use strict"; | ||
SIZE[SIZE["O"] = 128] = "O"; | ||
SIZE[SIZE["H"] = 256] = "H"; | ||
SIZE[SIZE["I"] = 512] = "I"; | ||
})(exports.SIZE || (exports.SIZE = {})); | ||
var SIZE = exports.SIZE; | ||
(function (SIZEB) { | ||
SIZEB[SIZEB["B1"] = 8] = "B1"; | ||
SIZEB[SIZEB["B2"] = 16] = "B2"; | ||
SIZEB[SIZEB["B4"] = 32] = "B4"; | ||
SIZEB[SIZEB["B8"] = 64] = "B8"; | ||
SIZEB[SIZEB["B16"] = 128] = "B16"; | ||
SIZEB[SIZEB["B32"] = 256] = "B32"; | ||
SIZEB[SIZEB["B64"] = 512] = "B64"; | ||
})(exports.SIZEB || (exports.SIZEB = {})); | ||
var SIZEB = exports.SIZEB; | ||
function isNumber64(num) { | ||
@@ -37,2 +49,18 @@ if ((num instanceof Array) && (num.length === 2) && (typeof num[0] === 'number') && (typeof num[1] === 'number')) | ||
exports.isNumber128 = isNumber128; | ||
function isNumberOfDoubles(doubles, num) { | ||
if (!(num instanceof Array) || (num.length !== doubles)) | ||
return false; | ||
for (var j = 0; j < doubles; j++) | ||
if (typeof num[j] !== 'number') | ||
return false; | ||
return true; | ||
} | ||
function isNumber256(num) { return isNumberOfDoubles(8, num); } | ||
exports.isNumber256 = isNumber256; | ||
function isNumber512(num) { return isNumberOfDoubles(16, num); } | ||
exports.isNumber512 = isNumber512; | ||
function isNumber1024(num) { return isNumberOfDoubles(32, num); } | ||
exports.isNumber1024 = isNumber1024; | ||
function isNumber2048(num) { return isNumberOfDoubles(64, num); } | ||
exports.isNumber2048 = isNumber2048; | ||
function isTnumber(num) { | ||
@@ -43,4 +71,12 @@ if (typeof num === 'number') | ||
return true; | ||
else if (isNumber128(num)) | ||
return true; | ||
else if (isNumber256(num)) | ||
return true; | ||
else if (isNumber512(num)) | ||
return true; | ||
else if (isNumber1024(num)) | ||
return true; | ||
else | ||
return isNumber128(num); | ||
return isNumber2048(num); | ||
} | ||
@@ -47,0 +83,0 @@ exports.isTnumber = isTnumber; |
@@ -9,11 +9,23 @@ import {UInt64} from './util'; | ||
NONE = 0, // Either unknown or not specified yet. | ||
B = 8, | ||
W = 16, | ||
D = 32, | ||
Q = 64, | ||
T = 80, | ||
O = 128, | ||
B = 8, // byte | ||
W = 16, // word | ||
D = 32, // double word = 2x word | ||
Q = 64, // quad word = 4x word | ||
T = 80, // ten = 10 bytes | ||
O = 128, // octa word = 8x word | ||
H = 256, // hexadeca word = 16x word | ||
I = 512, // dItriaconta word = 32x word | ||
} | ||
export enum SIZEB { | ||
B1 = SIZE.B, | ||
B2 = SIZE.W, | ||
B4 = SIZE.D, | ||
B8 = SIZE.Q, | ||
B16 = SIZE.O, | ||
B32 = SIZE.H, | ||
B64 = SIZE.I, | ||
} | ||
// 64-bit numbers | ||
@@ -35,8 +47,34 @@ export type number64 = [number, number]; | ||
function isNumberOfDoubles(doubles, num) { | ||
if(!(num instanceof Array) || (num.length !== doubles)) return false; | ||
for(var j = 0; j < doubles; j++) | ||
if(typeof num[j] !== 'number') return false; | ||
return true; | ||
} | ||
// 256-bit numbers | ||
export type number256 = [number, number, number, number, number, number, number, number]; | ||
export function isNumber256(num) { return isNumberOfDoubles(8, num); } | ||
// 512-bit numbers | ||
export type number512 = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]; | ||
export function isNumber512(num) { return isNumberOfDoubles(16, num); } | ||
// AVX-512 extension says registers will be "at least" 512 bits, so can be 1024 bits and maybe even 2048 bits. | ||
export type number1024 = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]; | ||
export type number2048 = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]; | ||
export function isNumber1024(num) { return isNumberOfDoubles(32, num); } | ||
export function isNumber2048(num) { return isNumberOfDoubles(64, num); } | ||
// Combined type of all basic "numbers". | ||
export type Tnumber = number|number64|number128; | ||
export type Tnumber = number|number64|number128|number256|number512|number1024|number2048; | ||
export function isTnumber(num) { | ||
if(typeof num === 'number') return true; | ||
else if(isNumber64(num)) return true; | ||
else return isNumber128(num); | ||
else if(isNumber64(num)) return true; | ||
else if(isNumber128(num)) return true; | ||
else if(isNumber256(num)) return true; | ||
else if(isNumber512(num)) return true; | ||
else if(isNumber1024(num)) return true; | ||
else return isNumber2048(num); | ||
} | ||
@@ -43,0 +81,0 @@ |
{ | ||
"name": "ass-js", | ||
"description": "Assembler.js", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "x86", |
@@ -158,2 +158,3 @@ # Assembler.js | ||
```js | ||
var str = 'Hello World!\n'; | ||
var str_lbl = _.label('my_string'); | ||
@@ -171,3 +172,3 @@ _.db(str); | ||
Above `_.label('my_string')` creates *and inserts* label expression with name `my_string` just before our string, now if we print | ||
our code to console we get a better lookiing output: | ||
our code to console we get a better looking output: | ||
@@ -174,0 +175,0 @@ 005 leaq rsi, [rip + <my_string = -34>] ; 00001B|00001B 0x48, 0x8D, 0x35, 0xDE, 0xFF, 0xFF, 0xFF |
@@ -19,2 +19,3 @@ "use strict"; | ||
this.ClassInstruction = i.Instruction; | ||
this.AlignExpression = i.Align; | ||
this.ClassOperands = o.Operands; | ||
@@ -21,0 +22,0 @@ } |
@@ -54,2 +54,3 @@ import * as oo from '../operand'; | ||
ClassInstruction: typeof i.Instruction = i.Instruction; | ||
AlignExpression = i.Align; | ||
ClassOperands = o.Operands; | ||
@@ -56,0 +57,0 @@ |
@@ -21,2 +21,22 @@ "use strict"; | ||
exports.Expression = Expression; | ||
var Align = (function (_super) { | ||
__extends(Align, _super); | ||
function Align() { | ||
_super.apply(this, arguments); | ||
this.templates = Align.nop; | ||
} | ||
Align.nop = [ | ||
[0x90], | ||
[0x66, 0x90], | ||
[0x0F, 0x1F, 0x00], | ||
[0x0F, 0x1F, 0x40, 0x00], | ||
[0x0F, 0x1F, 0x44, 0x00, 0x00], | ||
[0x66, 0x0F, 0x1F, 0x44, 0x00, 0x00], | ||
[0x0F, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00], | ||
[0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00], | ||
[0x66, 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00], | ||
]; | ||
return Align; | ||
}(i.Align)); | ||
exports.Align = Align; | ||
var Instruction = (function (_super) { | ||
@@ -23,0 +43,0 @@ __extends(Instruction, _super); |
@@ -14,2 +14,21 @@ import {SIZE} from '../operand'; | ||
export class Align extends i.Align { | ||
static nop = [ | ||
[0x90], // 1 byte : NOP = XCHG (E)AX, (E)AX | ||
[0x66, 0x90], // 2 : 66 NOP | ||
[0x0F, 0x1F, 0x00], // 3 : NOP DWORD ptr [EAX] | ||
[0x0F, 0x1F, 0x40, 0x00], // 4 : NOP DWORD ptr [EAX + 00H] | ||
[0x0F, 0x1F, 0x44, 0x00, 0x00], // 5 : NOP DWORD ptr [EAX + EAX*1 + 00H] | ||
[0x66, 0x0F, 0x1F, 0x44, 0x00, 0x00], // 6 : 66 NOP DWORD ptr [EAX + EAX*1 + 00H] | ||
[0x0F, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00], // 7 : NOP DWORD ptr [EAX + 00000000H] | ||
[0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00], // 8 : NOP DWORD ptr [EAX + EAX*1 + 00000000H] | ||
[0x66, 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00], // 9 : 66 NOP DWORD ptr [EAX + EAX*1 + 00000000H] | ||
]; | ||
templates = Align.nop; | ||
} | ||
export interface IInstruction { | ||
@@ -16,0 +35,0 @@ lock(): this; |
@@ -125,2 +125,26 @@ "use strict"; | ||
exports.Register64 = Register64; | ||
var Register128 = (function (_super) { | ||
__extends(Register128, _super); | ||
function Register128(id) { | ||
_super.call(this, id, operand_1.SIZE.O); | ||
} | ||
return Register128; | ||
}(Register)); | ||
exports.Register128 = Register128; | ||
var Register256 = (function (_super) { | ||
__extends(Register256, _super); | ||
function Register256(id) { | ||
_super.call(this, id, operand_1.SIZE.H); | ||
} | ||
return Register256; | ||
}(Register)); | ||
exports.Register256 = Register256; | ||
var Register512 = (function (_super) { | ||
__extends(Register512, _super); | ||
function Register512(id) { | ||
_super.call(this, id, operand_1.SIZE.I); | ||
} | ||
return Register512; | ||
}(Register)); | ||
exports.Register512 = Register512; | ||
var RegisterRip = (function (_super) { | ||
@@ -143,67 +167,85 @@ __extends(RegisterRip, _super); | ||
exports.RegisterSegment = RegisterSegment; | ||
exports.rax = new Register64(regfile_1.R64.RAX); | ||
exports.rbx = new Register64(regfile_1.R64.RBX); | ||
exports.rcx = new Register64(regfile_1.R64.RCX); | ||
exports.rdx = new Register64(regfile_1.R64.RDX); | ||
exports.rsi = new Register64(regfile_1.R64.RSI); | ||
exports.rdi = new Register64(regfile_1.R64.RDI); | ||
exports.rbp = new Register64(regfile_1.R64.RBP); | ||
exports.rsp = new Register64(regfile_1.R64.RSP); | ||
exports.r8 = new Register64(regfile_1.R64.R8); | ||
exports.r9 = new Register64(regfile_1.R64.R9); | ||
exports.r10 = new Register64(regfile_1.R64.R10); | ||
exports.r11 = new Register64(regfile_1.R64.R11); | ||
exports.r12 = new Register64(regfile_1.R64.R12); | ||
exports.r13 = new Register64(regfile_1.R64.R13); | ||
exports.r14 = new Register64(regfile_1.R64.R14); | ||
exports.r15 = new Register64(regfile_1.R64.R15); | ||
exports.rip = new RegisterRip; | ||
exports.eax = new Register32(regfile_1.R32.EAX); | ||
exports.ebx = new Register32(regfile_1.R32.EBX); | ||
exports.ecx = new Register32(regfile_1.R32.ECX); | ||
exports.edx = new Register32(regfile_1.R32.EDX); | ||
exports.esi = new Register32(regfile_1.R32.ESI); | ||
exports.edi = new Register32(regfile_1.R32.EDI); | ||
exports.ebp = new Register32(regfile_1.R32.EBP); | ||
exports.esp = new Register32(regfile_1.R32.ESP); | ||
exports.r8d = new Register32(regfile_1.R32.R8D); | ||
exports.r9d = new Register32(regfile_1.R32.R9D); | ||
exports.r10d = new Register32(regfile_1.R32.R10D); | ||
exports.r11d = new Register32(regfile_1.R32.R11D); | ||
exports.r12d = new Register32(regfile_1.R32.R12D); | ||
exports.r13d = new Register32(regfile_1.R32.R13D); | ||
exports.r14d = new Register32(regfile_1.R32.R14D); | ||
exports.r15d = new Register32(regfile_1.R32.R15D); | ||
exports.ax = new Register16(regfile_1.R16.AX); | ||
exports.bx = new Register16(regfile_1.R16.BX); | ||
exports.cx = new Register16(regfile_1.R16.CX); | ||
exports.dx = new Register16(regfile_1.R16.DX); | ||
exports.si = new Register16(regfile_1.R16.SI); | ||
exports.di = new Register16(regfile_1.R16.DI); | ||
exports.bp = new Register16(regfile_1.R16.BP); | ||
exports.sp = new Register16(regfile_1.R16.SP); | ||
exports.r8w = new Register16(regfile_1.R16.R8W); | ||
exports.r9w = new Register16(regfile_1.R16.R9W); | ||
exports.r10w = new Register16(regfile_1.R16.R10W); | ||
exports.r11w = new Register16(regfile_1.R16.R11W); | ||
exports.r12w = new Register16(regfile_1.R16.R12W); | ||
exports.r13w = new Register16(regfile_1.R16.R13W); | ||
exports.r14w = new Register16(regfile_1.R16.R14W); | ||
exports.r15w = new Register16(regfile_1.R16.R15W); | ||
exports.al = new Register8(regfile_1.R8.AL); | ||
exports.bl = new Register8(regfile_1.R8.BL); | ||
exports.cl = new Register8(regfile_1.R8.CL); | ||
exports.dl = new Register8(regfile_1.R8.DL); | ||
exports.sil = new Register8(regfile_1.R8.SIL); | ||
exports.dil = new Register8(regfile_1.R8.DIL); | ||
exports.bpl = new Register8(regfile_1.R8.BPL); | ||
exports.spl = new Register8(regfile_1.R8.SPL); | ||
exports.r8b = new Register8(regfile_1.R8.R8B); | ||
exports.r9b = new Register8(regfile_1.R8.R9B); | ||
exports.r10b = new Register8(regfile_1.R8.R10B); | ||
exports.r11b = new Register8(regfile_1.R8.R11B); | ||
exports.r12b = new Register8(regfile_1.R8.R12B); | ||
exports.r13b = new Register8(regfile_1.R8.R13B); | ||
exports.r14b = new Register8(regfile_1.R8.R14B); | ||
exports.r15b = new Register8(regfile_1.R8.R15B); | ||
var RegisterMmx = (function (_super) { | ||
__extends(RegisterMmx, _super); | ||
function RegisterMmx(id) { | ||
_super.call(this, id); | ||
this.name = 'mmx' + id; | ||
} | ||
return RegisterMmx; | ||
}(Register128)); | ||
exports.RegisterMmx = RegisterMmx; | ||
var RegisterXmm = (function (_super) { | ||
__extends(RegisterXmm, _super); | ||
function RegisterXmm(id) { | ||
_super.call(this, id); | ||
this.name = 'xmm' + id; | ||
} | ||
return RegisterXmm; | ||
}(Register128)); | ||
exports.RegisterXmm = RegisterXmm; | ||
var RegisterYmm = (function (_super) { | ||
__extends(RegisterYmm, _super); | ||
function RegisterYmm(id) { | ||
_super.call(this, id); | ||
this.name = 'ymm' + id; | ||
} | ||
return RegisterYmm; | ||
}(Register256)); | ||
exports.RegisterYmm = RegisterYmm; | ||
var RegisterZmm = (function (_super) { | ||
__extends(RegisterZmm, _super); | ||
function RegisterZmm(id) { | ||
_super.call(this, id); | ||
this.name = 'zmm' + id; | ||
} | ||
return RegisterZmm; | ||
}(Register512)); | ||
exports.RegisterZmm = RegisterZmm; | ||
function validateRegId(id, min, max, Clazz) { | ||
if (typeof id !== 'number') | ||
throw TypeError(Clazz.name + ' register ID must be a number.'); | ||
if (id < min) | ||
throw TypeError(Clazz.name + " register ID must be at least " + min + "."); | ||
if (id > max) | ||
throw TypeError(Clazz.name + " register ID must be at most " + max + "."); | ||
} | ||
function createRegisterGenerator(Clazz, min_id, max_id) { | ||
if (min_id === void 0) { min_id = 0; } | ||
if (max_id === void 0) { max_id = 15; } | ||
var cache; | ||
return function (id) { | ||
validateRegId(id, min_id, max_id, Clazz); | ||
if (!cache) | ||
cache = new Array(max_id + 1); | ||
if (!cache[id]) | ||
cache[id] = new Clazz(id); | ||
return cache[id]; | ||
}; | ||
} | ||
exports.rb = createRegisterGenerator(Register8, 0, 15); | ||
exports.rw = createRegisterGenerator(Register16, 0, 15); | ||
exports.rd = createRegisterGenerator(Register32, 0, 15); | ||
exports.rq = createRegisterGenerator(Register64, 0, 15); | ||
exports.r = exports.rq; | ||
exports.rs = createRegisterGenerator(RegisterSegment, 0, 15); | ||
exports.mmx = createRegisterGenerator(RegisterMmx, 0, 15); | ||
exports.xmm = createRegisterGenerator(RegisterXmm, 0, 31); | ||
exports.ymm = createRegisterGenerator(RegisterYmm, 0, 31); | ||
exports.zmm = createRegisterGenerator(RegisterZmm, 0, 31); | ||
exports.al = exports.rb(regfile_1.R8.AL); | ||
exports.bl = exports.rb(regfile_1.R8.BL); | ||
exports.cl = exports.rb(regfile_1.R8.CL); | ||
exports.dl = exports.rb(regfile_1.R8.DL); | ||
exports.sil = exports.rb(regfile_1.R8.SIL); | ||
exports.dil = exports.rb(regfile_1.R8.DIL); | ||
exports.bpl = exports.rb(regfile_1.R8.BPL); | ||
exports.spl = exports.rb(regfile_1.R8.SPL); | ||
exports.r8b = exports.rb(regfile_1.R8.R8B); | ||
exports.r9b = exports.rb(regfile_1.R8.R9B); | ||
exports.r10b = exports.rb(regfile_1.R8.R10B); | ||
exports.r11b = exports.rb(regfile_1.R8.R11B); | ||
exports.r12b = exports.rb(regfile_1.R8.R12B); | ||
exports.r13b = exports.rb(regfile_1.R8.R13B); | ||
exports.r14b = exports.rb(regfile_1.R8.R14B); | ||
exports.r15b = exports.rb(regfile_1.R8.R15B); | ||
exports.ah = new Register8High(regfile_1.R8H.AH); | ||
@@ -213,8 +255,57 @@ exports.bh = new Register8High(regfile_1.R8H.BH); | ||
exports.dh = new Register8High(regfile_1.R8H.DH); | ||
exports.es = new RegisterSegment(regfile_1.SEG.ES); | ||
exports.cs = new RegisterSegment(regfile_1.SEG.CS); | ||
exports.ss = new RegisterSegment(regfile_1.SEG.SS); | ||
exports.ds = new RegisterSegment(regfile_1.SEG.DS); | ||
exports.fs = new RegisterSegment(regfile_1.SEG.FS); | ||
exports.gs = new RegisterSegment(regfile_1.SEG.GS); | ||
exports.ax = exports.rw(regfile_1.R16.AX); | ||
exports.bx = exports.rw(regfile_1.R16.BX); | ||
exports.cx = exports.rw(regfile_1.R16.CX); | ||
exports.dx = exports.rw(regfile_1.R16.DX); | ||
exports.si = exports.rw(regfile_1.R16.SI); | ||
exports.di = exports.rw(regfile_1.R16.DI); | ||
exports.bp = exports.rw(regfile_1.R16.BP); | ||
exports.sp = exports.rw(regfile_1.R16.SP); | ||
exports.r8w = exports.rw(regfile_1.R16.R8W); | ||
exports.r9w = exports.rw(regfile_1.R16.R9W); | ||
exports.r10w = exports.rw(regfile_1.R16.R10W); | ||
exports.r11w = exports.rw(regfile_1.R16.R11W); | ||
exports.r12w = exports.rw(regfile_1.R16.R12W); | ||
exports.r13w = exports.rw(regfile_1.R16.R13W); | ||
exports.r14w = exports.rw(regfile_1.R16.R14W); | ||
exports.r15w = exports.rw(regfile_1.R16.R15W); | ||
exports.eax = exports.rd(regfile_1.R32.EAX); | ||
exports.ebx = exports.rd(regfile_1.R32.EBX); | ||
exports.ecx = exports.rd(regfile_1.R32.ECX); | ||
exports.edx = exports.rd(regfile_1.R32.EDX); | ||
exports.esi = exports.rd(regfile_1.R32.ESI); | ||
exports.edi = exports.rd(regfile_1.R32.EDI); | ||
exports.ebp = exports.rd(regfile_1.R32.EBP); | ||
exports.esp = exports.rd(regfile_1.R32.ESP); | ||
exports.r8d = exports.rd(regfile_1.R32.R8D); | ||
exports.r9d = exports.rd(regfile_1.R32.R9D); | ||
exports.r10d = exports.rd(regfile_1.R32.R10D); | ||
exports.r11d = exports.rd(regfile_1.R32.R11D); | ||
exports.r12d = exports.rd(regfile_1.R32.R12D); | ||
exports.r13d = exports.rd(regfile_1.R32.R13D); | ||
exports.r14d = exports.rd(regfile_1.R32.R14D); | ||
exports.r15d = exports.rd(regfile_1.R32.R15D); | ||
exports.rax = exports.rq(regfile_1.R64.RAX); | ||
exports.rcx = exports.rq(regfile_1.R64.RCX); | ||
exports.rdx = exports.rq(regfile_1.R64.RDX); | ||
exports.rbx = exports.rq(regfile_1.R64.RBX); | ||
exports.rsp = exports.rq(regfile_1.R64.RSP); | ||
exports.rbp = exports.rq(regfile_1.R64.RBP); | ||
exports.rsi = exports.rq(regfile_1.R64.RSI); | ||
exports.rdi = exports.rq(regfile_1.R64.RDI); | ||
exports.r8 = exports.rq(regfile_1.R64.R8); | ||
exports.r9 = exports.rq(regfile_1.R64.R9); | ||
exports.r10 = exports.rq(regfile_1.R64.R10); | ||
exports.r11 = exports.rq(regfile_1.R64.R11); | ||
exports.r12 = exports.rq(regfile_1.R64.R12); | ||
exports.r13 = exports.rq(regfile_1.R64.R13); | ||
exports.r14 = exports.rq(regfile_1.R64.R14); | ||
exports.r15 = exports.rq(regfile_1.R64.R15); | ||
exports.rip = new RegisterRip; | ||
exports.es = exports.rs(regfile_1.SEG.ES); | ||
exports.cs = exports.rs(regfile_1.SEG.CS); | ||
exports.ss = exports.rs(regfile_1.SEG.SS); | ||
exports.ds = exports.rs(regfile_1.SEG.DS); | ||
exports.fs = exports.rs(regfile_1.SEG.FS); | ||
exports.gs = exports.rs(regfile_1.SEG.GS); | ||
var Scale = (function (_super) { | ||
@@ -221,0 +312,0 @@ __extends(Scale, _super); |
@@ -1,2 +0,2 @@ | ||
import {R64, R32, R16, R8, R8H, SEG} from './regfile'; | ||
import {R64, R32, R16, R8, R8H, SEG, X87, XMM, YMM, ZMM} from './regfile'; | ||
import {number64, Tnumber, isTnumber, SIZE, TUiOperand, TUiOperandNormalized, | ||
@@ -123,2 +123,20 @@ Operand, Constant, Immediate, Relative, Register as RegisterBase, Memory as MemoryBase} from '../operand'; | ||
export class Register128 extends Register { | ||
constructor(id: number) { | ||
super(id, SIZE.O); | ||
} | ||
} | ||
export class Register256 extends Register { | ||
constructor(id: number) { | ||
super(id, SIZE.H); | ||
} | ||
} | ||
export class Register512 extends Register { | ||
constructor(id: number) { | ||
super(id, SIZE.I); | ||
} | ||
} | ||
export class RegisterRip extends Register64 { | ||
@@ -135,76 +153,79 @@ name = 'rip'; | ||
export class RegisterMmx extends Register128 { | ||
constructor(id: number) { | ||
super(id); | ||
this.name = 'mmx' + id; | ||
} | ||
} | ||
export var rax = new Register64(R64.RAX); | ||
export var rbx = new Register64(R64.RBX); | ||
export var rcx = new Register64(R64.RCX); | ||
export var rdx = new Register64(R64.RDX); | ||
export var rsi = new Register64(R64.RSI); | ||
export var rdi = new Register64(R64.RDI); | ||
export var rbp = new Register64(R64.RBP); | ||
export var rsp = new Register64(R64.RSP); | ||
export var r8 = new Register64(R64.R8); | ||
export var r9 = new Register64(R64.R9); | ||
export var r10 = new Register64(R64.R10); | ||
export var r11 = new Register64(R64.R11); | ||
export var r12 = new Register64(R64.R12); | ||
export var r13 = new Register64(R64.R13); | ||
export var r14 = new Register64(R64.R14); | ||
export var r15 = new Register64(R64.R15); | ||
export class RegisterXmm extends Register128 { | ||
constructor(id: number) { | ||
super(id); | ||
this.name = 'xmm' + id; | ||
} | ||
} | ||
export var rip = new RegisterRip; | ||
export class RegisterYmm extends Register256 { | ||
constructor(id: number) { | ||
super(id); | ||
this.name = 'ymm' + id; | ||
} | ||
} | ||
export class RegisterZmm extends Register512 { | ||
constructor(id: number) { | ||
super(id); | ||
this.name = 'zmm' + id; | ||
} | ||
} | ||
export var eax = new Register32(R32.EAX); | ||
export var ebx = new Register32(R32.EBX); | ||
export var ecx = new Register32(R32.ECX); | ||
export var edx = new Register32(R32.EDX); | ||
export var esi = new Register32(R32.ESI); | ||
export var edi = new Register32(R32.EDI); | ||
export var ebp = new Register32(R32.EBP); | ||
export var esp = new Register32(R32.ESP); | ||
export var r8d = new Register32(R32.R8D); | ||
export var r9d = new Register32(R32.R9D); | ||
export var r10d = new Register32(R32.R10D); | ||
export var r11d = new Register32(R32.R11D); | ||
export var r12d = new Register32(R32.R12D); | ||
export var r13d = new Register32(R32.R13D); | ||
export var r14d = new Register32(R32.R14D); | ||
export var r15d = new Register32(R32.R15D); | ||
export var ax = new Register16(R16.AX); | ||
export var bx = new Register16(R16.BX); | ||
export var cx = new Register16(R16.CX); | ||
export var dx = new Register16(R16.DX); | ||
export var si = new Register16(R16.SI); | ||
export var di = new Register16(R16.DI); | ||
export var bp = new Register16(R16.BP); | ||
export var sp = new Register16(R16.SP); | ||
export var r8w = new Register16(R16.R8W); | ||
export var r9w = new Register16(R16.R9W); | ||
export var r10w = new Register16(R16.R10W); | ||
export var r11w = new Register16(R16.R11W); | ||
export var r12w = new Register16(R16.R12W); | ||
export var r13w = new Register16(R16.R13W); | ||
export var r14w = new Register16(R16.R14W); | ||
export var r15w = new Register16(R16.R15W); | ||
function validateRegId(id: number, min, max, Clazz) { | ||
if(typeof id !== 'number') throw TypeError(Clazz.name + ' register ID must be a number.'); | ||
if(id < min) throw TypeError(`${Clazz.name} register ID must be at least ${min}.`); | ||
if(id > max) throw TypeError(`${Clazz.name} register ID must be at most ${max}.`); | ||
} | ||
function createRegisterGenerator<T>(Clazz, min_id = 0, max_id = 15) { | ||
var cache: T[]; | ||
return function(id: number): T { | ||
validateRegId(id, min_id, max_id, Clazz); | ||
if(!cache) cache = new Array(max_id + 1); | ||
if(!cache[id]) cache[id] = new Clazz(id); | ||
return cache[id]; | ||
}; | ||
} | ||
export var al = new Register8(R8.AL); | ||
export var bl = new Register8(R8.BL); | ||
export var cl = new Register8(R8.CL); | ||
export var dl = new Register8(R8.DL); | ||
export var sil = new Register8(R8.SIL); | ||
export var dil = new Register8(R8.DIL); | ||
export var bpl = new Register8(R8.BPL); | ||
export var spl = new Register8(R8.SPL); | ||
export var r8b = new Register8(R8.R8B); | ||
export var r9b = new Register8(R8.R9B); | ||
export var r10b = new Register8(R8.R10B); | ||
export var r11b = new Register8(R8.R11B); | ||
export var r12b = new Register8(R8.R12B); | ||
export var r13b = new Register8(R8.R13B); | ||
export var r14b = new Register8(R8.R14B); | ||
export var r15b = new Register8(R8.R15B); | ||
export var rb = createRegisterGenerator<Register8>(Register8, 0, 15); | ||
export var rw = createRegisterGenerator<Register16>(Register16, 0, 15); | ||
export var rd = createRegisterGenerator<Register32>(Register32, 0, 15); | ||
export var rq = createRegisterGenerator<Register64>(Register64, 0, 15); | ||
export var r = rq; | ||
export var rs = createRegisterGenerator<RegisterSegment>(RegisterSegment, 0, 15); | ||
// SSE registers are lazy-created when used using function: `xmm(3)`; instead of pre-generated objects: xmm3. | ||
export var mmx = createRegisterGenerator<RegisterMmx>(RegisterMmx, 0, 15); | ||
export var xmm = createRegisterGenerator<RegisterXmm>(RegisterXmm, 0, 31); | ||
export var ymm = createRegisterGenerator<RegisterYmm>(RegisterYmm, 0, 31); | ||
export var zmm = createRegisterGenerator<RegisterZmm>(RegisterZmm, 0, 31); | ||
export var al = rb(R8.AL); | ||
export var bl = rb(R8.BL); | ||
export var cl = rb(R8.CL); | ||
export var dl = rb(R8.DL); | ||
export var sil = rb(R8.SIL); | ||
export var dil = rb(R8.DIL); | ||
export var bpl = rb(R8.BPL); | ||
export var spl = rb(R8.SPL); | ||
export var r8b = rb(R8.R8B); | ||
export var r9b = rb(R8.R9B); | ||
export var r10b = rb(R8.R10B); | ||
export var r11b = rb(R8.R11B); | ||
export var r12b = rb(R8.R12B); | ||
export var r13b = rb(R8.R13B); | ||
export var r14b = rb(R8.R14B); | ||
export var r15b = rb(R8.R15B); | ||
export var ah = new Register8High(R8H.AH); | ||
@@ -216,10 +237,66 @@ export var bh = new Register8High(R8H.BH); | ||
export var es = new RegisterSegment(SEG.ES); | ||
export var cs = new RegisterSegment(SEG.CS); | ||
export var ss = new RegisterSegment(SEG.SS); | ||
export var ds = new RegisterSegment(SEG.DS); | ||
export var fs = new RegisterSegment(SEG.FS); | ||
export var gs = new RegisterSegment(SEG.GS); | ||
export var ax = rw(R16.AX); | ||
export var bx = rw(R16.BX); | ||
export var cx = rw(R16.CX); | ||
export var dx = rw(R16.DX); | ||
export var si = rw(R16.SI); | ||
export var di = rw(R16.DI); | ||
export var bp = rw(R16.BP); | ||
export var sp = rw(R16.SP); | ||
export var r8w = rw(R16.R8W); | ||
export var r9w = rw(R16.R9W); | ||
export var r10w = rw(R16.R10W); | ||
export var r11w = rw(R16.R11W); | ||
export var r12w = rw(R16.R12W); | ||
export var r13w = rw(R16.R13W); | ||
export var r14w = rw(R16.R14W); | ||
export var r15w = rw(R16.R15W); | ||
export var eax = rd(R32.EAX); | ||
export var ebx = rd(R32.EBX); | ||
export var ecx = rd(R32.ECX); | ||
export var edx = rd(R32.EDX); | ||
export var esi = rd(R32.ESI); | ||
export var edi = rd(R32.EDI); | ||
export var ebp = rd(R32.EBP); | ||
export var esp = rd(R32.ESP); | ||
export var r8d = rd(R32.R8D); | ||
export var r9d = rd(R32.R9D); | ||
export var r10d = rd(R32.R10D); | ||
export var r11d = rd(R32.R11D); | ||
export var r12d = rd(R32.R12D); | ||
export var r13d = rd(R32.R13D); | ||
export var r14d = rd(R32.R14D); | ||
export var r15d = rd(R32.R15D); | ||
export var rax = rq(R64.RAX); | ||
export var rcx = rq(R64.RCX); | ||
export var rdx = rq(R64.RDX); | ||
export var rbx = rq(R64.RBX); | ||
export var rsp = rq(R64.RSP); | ||
export var rbp = rq(R64.RBP); | ||
export var rsi = rq(R64.RSI); | ||
export var rdi = rq(R64.RDI); | ||
export var r8 = rq(R64.R8); | ||
export var r9 = rq(R64.R9); | ||
export var r10 = rq(R64.R10); | ||
export var r11 = rq(R64.R11); | ||
export var r12 = rq(R64.R12); | ||
export var r13 = rq(R64.R13); | ||
export var r14 = rq(R64.R14); | ||
export var r15 = rq(R64.R15); | ||
export var rip = new RegisterRip; | ||
export var es = rs(SEG.ES); | ||
export var cs = rs(SEG.CS); | ||
export var ss = rs(SEG.SS); | ||
export var ds = rs(SEG.DS); | ||
export var fs = rs(SEG.FS); | ||
export var gs = rs(SEG.GS); | ||
// # Scale | ||
@@ -393,6 +470,1 @@ // | ||
} | ||
export interface Operands { | ||
getMemoryOperand(): Memory; | ||
} |
@@ -94,2 +94,40 @@ "use strict"; | ||
var SEG = exports.SEG; | ||
(function (CR) { | ||
CR[CR["CR0"] = 0] = "CR0"; | ||
CR[CR["CR1"] = 1] = "CR1"; | ||
CR[CR["CR2"] = 2] = "CR2"; | ||
CR[CR["CR3"] = 3] = "CR3"; | ||
CR[CR["CR4"] = 4] = "CR4"; | ||
CR[CR["CR5"] = 5] = "CR5"; | ||
CR[CR["CR6"] = 6] = "CR6"; | ||
CR[CR["CR7"] = 7] = "CR7"; | ||
CR[CR["CR8"] = 8] = "CR8"; | ||
CR[CR["CR9"] = 9] = "CR9"; | ||
CR[CR["CR10"] = 10] = "CR10"; | ||
CR[CR["CR11"] = 11] = "CR11"; | ||
CR[CR["CR12"] = 12] = "CR12"; | ||
CR[CR["CR13"] = 13] = "CR13"; | ||
CR[CR["CR14"] = 14] = "CR14"; | ||
CR[CR["CR15"] = 15] = "CR15"; | ||
})(exports.CR || (exports.CR = {})); | ||
var CR = exports.CR; | ||
(function (DR) { | ||
DR[DR["DR0"] = 0] = "DR0"; | ||
DR[DR["DR1"] = 1] = "DR1"; | ||
DR[DR["DR2"] = 2] = "DR2"; | ||
DR[DR["DR3"] = 3] = "DR3"; | ||
DR[DR["DR4"] = 4] = "DR4"; | ||
DR[DR["DR5"] = 5] = "DR5"; | ||
DR[DR["DR6"] = 6] = "DR6"; | ||
DR[DR["DR7"] = 7] = "DR7"; | ||
DR[DR["DR8"] = 8] = "DR8"; | ||
DR[DR["DR9"] = 9] = "DR9"; | ||
DR[DR["DR10"] = 10] = "DR10"; | ||
DR[DR["DR11"] = 11] = "DR11"; | ||
DR[DR["DR12"] = 12] = "DR12"; | ||
DR[DR["DR13"] = 13] = "DR13"; | ||
DR[DR["DR14"] = 14] = "DR14"; | ||
DR[DR["DR15"] = 15] = "DR15"; | ||
})(exports.DR || (exports.DR = {})); | ||
var DR = exports.DR; | ||
(function (X87) { | ||
@@ -134,2 +172,18 @@ X87[X87["ST0"] = 0] = "ST0"; | ||
XMM[XMM["XMM15"] = 15] = "XMM15"; | ||
XMM[XMM["XMM16"] = 16] = "XMM16"; | ||
XMM[XMM["XMM17"] = 17] = "XMM17"; | ||
XMM[XMM["XMM18"] = 18] = "XMM18"; | ||
XMM[XMM["XMM19"] = 19] = "XMM19"; | ||
XMM[XMM["XMM20"] = 20] = "XMM20"; | ||
XMM[XMM["XMM21"] = 21] = "XMM21"; | ||
XMM[XMM["XMM22"] = 22] = "XMM22"; | ||
XMM[XMM["XMM23"] = 23] = "XMM23"; | ||
XMM[XMM["XMM24"] = 24] = "XMM24"; | ||
XMM[XMM["XMM25"] = 25] = "XMM25"; | ||
XMM[XMM["XMM26"] = 26] = "XMM26"; | ||
XMM[XMM["XMM27"] = 27] = "XMM27"; | ||
XMM[XMM["XMM28"] = 28] = "XMM28"; | ||
XMM[XMM["XMM29"] = 29] = "XMM29"; | ||
XMM[XMM["XMM30"] = 30] = "XMM30"; | ||
XMM[XMM["XMM31"] = 31] = "XMM31"; | ||
})(exports.XMM || (exports.XMM = {})); | ||
@@ -154,41 +208,54 @@ var XMM = exports.XMM; | ||
YMM[YMM["YMM15"] = 15] = "YMM15"; | ||
YMM[YMM["YMM16"] = 16] = "YMM16"; | ||
YMM[YMM["YMM17"] = 17] = "YMM17"; | ||
YMM[YMM["YMM18"] = 18] = "YMM18"; | ||
YMM[YMM["YMM19"] = 19] = "YMM19"; | ||
YMM[YMM["YMM20"] = 20] = "YMM20"; | ||
YMM[YMM["YMM21"] = 21] = "YMM21"; | ||
YMM[YMM["YMM22"] = 22] = "YMM22"; | ||
YMM[YMM["YMM23"] = 23] = "YMM23"; | ||
YMM[YMM["YMM24"] = 24] = "YMM24"; | ||
YMM[YMM["YMM25"] = 25] = "YMM25"; | ||
YMM[YMM["YMM26"] = 26] = "YMM26"; | ||
YMM[YMM["YMM27"] = 27] = "YMM27"; | ||
YMM[YMM["YMM28"] = 28] = "YMM28"; | ||
YMM[YMM["YMM29"] = 29] = "YMM29"; | ||
YMM[YMM["YMM30"] = 30] = "YMM30"; | ||
YMM[YMM["YMM31"] = 31] = "YMM31"; | ||
})(exports.YMM || (exports.YMM = {})); | ||
var YMM = exports.YMM; | ||
(function (CR) { | ||
CR[CR["CR0"] = 0] = "CR0"; | ||
CR[CR["CR1"] = 1] = "CR1"; | ||
CR[CR["CR2"] = 2] = "CR2"; | ||
CR[CR["CR3"] = 3] = "CR3"; | ||
CR[CR["CR4"] = 4] = "CR4"; | ||
CR[CR["CR5"] = 5] = "CR5"; | ||
CR[CR["CR6"] = 6] = "CR6"; | ||
CR[CR["CR7"] = 7] = "CR7"; | ||
CR[CR["CR8"] = 8] = "CR8"; | ||
CR[CR["CR9"] = 9] = "CR9"; | ||
CR[CR["CR10"] = 10] = "CR10"; | ||
CR[CR["CR11"] = 11] = "CR11"; | ||
CR[CR["CR12"] = 12] = "CR12"; | ||
CR[CR["CR13"] = 13] = "CR13"; | ||
CR[CR["CR14"] = 14] = "CR14"; | ||
CR[CR["CR15"] = 15] = "CR15"; | ||
})(exports.CR || (exports.CR = {})); | ||
var CR = exports.CR; | ||
(function (DR) { | ||
DR[DR["DR0"] = 0] = "DR0"; | ||
DR[DR["DR1"] = 1] = "DR1"; | ||
DR[DR["DR2"] = 2] = "DR2"; | ||
DR[DR["DR3"] = 3] = "DR3"; | ||
DR[DR["DR4"] = 4] = "DR4"; | ||
DR[DR["DR5"] = 5] = "DR5"; | ||
DR[DR["DR6"] = 6] = "DR6"; | ||
DR[DR["DR7"] = 7] = "DR7"; | ||
DR[DR["DR8"] = 8] = "DR8"; | ||
DR[DR["DR9"] = 9] = "DR9"; | ||
DR[DR["DR10"] = 10] = "DR10"; | ||
DR[DR["DR11"] = 11] = "DR11"; | ||
DR[DR["DR12"] = 12] = "DR12"; | ||
DR[DR["DR13"] = 13] = "DR13"; | ||
DR[DR["DR14"] = 14] = "DR14"; | ||
DR[DR["DR15"] = 15] = "DR15"; | ||
})(exports.DR || (exports.DR = {})); | ||
var DR = exports.DR; | ||
(function (ZMM) { | ||
ZMM[ZMM["ZMM0"] = 0] = "ZMM0"; | ||
ZMM[ZMM["ZMM1"] = 1] = "ZMM1"; | ||
ZMM[ZMM["ZMM2"] = 2] = "ZMM2"; | ||
ZMM[ZMM["ZMM3"] = 3] = "ZMM3"; | ||
ZMM[ZMM["ZMM4"] = 4] = "ZMM4"; | ||
ZMM[ZMM["ZMM5"] = 5] = "ZMM5"; | ||
ZMM[ZMM["ZMM6"] = 6] = "ZMM6"; | ||
ZMM[ZMM["ZMM7"] = 7] = "ZMM7"; | ||
ZMM[ZMM["ZMM8"] = 8] = "ZMM8"; | ||
ZMM[ZMM["ZMM9"] = 9] = "ZMM9"; | ||
ZMM[ZMM["ZMM10"] = 10] = "ZMM10"; | ||
ZMM[ZMM["ZMM11"] = 11] = "ZMM11"; | ||
ZMM[ZMM["ZMM12"] = 12] = "ZMM12"; | ||
ZMM[ZMM["ZMM13"] = 13] = "ZMM13"; | ||
ZMM[ZMM["ZMM14"] = 14] = "ZMM14"; | ||
ZMM[ZMM["ZMM15"] = 15] = "ZMM15"; | ||
ZMM[ZMM["ZMM16"] = 16] = "ZMM16"; | ||
ZMM[ZMM["ZMM17"] = 17] = "ZMM17"; | ||
ZMM[ZMM["ZMM18"] = 18] = "ZMM18"; | ||
ZMM[ZMM["ZMM19"] = 19] = "ZMM19"; | ||
ZMM[ZMM["ZMM20"] = 20] = "ZMM20"; | ||
ZMM[ZMM["ZMM21"] = 21] = "ZMM21"; | ||
ZMM[ZMM["ZMM22"] = 22] = "ZMM22"; | ||
ZMM[ZMM["ZMM23"] = 23] = "ZMM23"; | ||
ZMM[ZMM["ZMM24"] = 24] = "ZMM24"; | ||
ZMM[ZMM["ZMM25"] = 25] = "ZMM25"; | ||
ZMM[ZMM["ZMM26"] = 26] = "ZMM26"; | ||
ZMM[ZMM["ZMM27"] = 27] = "ZMM27"; | ||
ZMM[ZMM["ZMM28"] = 28] = "ZMM28"; | ||
ZMM[ZMM["ZMM29"] = 29] = "ZMM29"; | ||
ZMM[ZMM["ZMM30"] = 30] = "ZMM30"; | ||
ZMM[ZMM["ZMM31"] = 31] = "ZMM31"; | ||
})(exports.ZMM || (exports.ZMM = {})); | ||
var ZMM = exports.ZMM; |
@@ -94,2 +94,40 @@ | ||
export enum CR { | ||
CR0 = 0, | ||
CR1, | ||
CR2, | ||
CR3, | ||
CR4, | ||
CR5, | ||
CR6, | ||
CR7, | ||
CR8, | ||
CR9, | ||
CR10, | ||
CR11, | ||
CR12, | ||
CR13, | ||
CR14, | ||
CR15, | ||
} | ||
export enum DR { | ||
DR0 = 0, | ||
DR1, | ||
DR2, | ||
DR3, | ||
DR4, | ||
DR5, | ||
DR6, | ||
DR7, | ||
DR8, | ||
DR9, | ||
DR10, | ||
DR11, | ||
DR12, | ||
DR13, | ||
DR14, | ||
DR15, | ||
} | ||
export enum X87 { | ||
@@ -134,2 +172,18 @@ ST0 = 0, | ||
XMM15, | ||
XMM16, | ||
XMM17, | ||
XMM18, | ||
XMM19, | ||
XMM20, | ||
XMM21, | ||
XMM22, | ||
XMM23, | ||
XMM24, | ||
XMM25, | ||
XMM26, | ||
XMM27, | ||
XMM28, | ||
XMM29, | ||
XMM30, | ||
XMM31, | ||
} | ||
@@ -154,41 +208,53 @@ | ||
YMM15, | ||
YMM16, | ||
YMM17, | ||
YMM18, | ||
YMM19, | ||
YMM20, | ||
YMM21, | ||
YMM22, | ||
YMM23, | ||
YMM24, | ||
YMM25, | ||
YMM26, | ||
YMM27, | ||
YMM28, | ||
YMM29, | ||
YMM30, | ||
YMM31, | ||
} | ||
export enum CR { | ||
CR0 = 0, | ||
CR1, | ||
CR2, | ||
CR3, | ||
CR4, | ||
CR5, | ||
CR6, | ||
CR7, | ||
CR8, | ||
CR9, | ||
CR10, | ||
CR11, | ||
CR12, | ||
CR13, | ||
CR14, | ||
CR15, | ||
export enum ZMM { | ||
ZMM0 = 0, | ||
ZMM1, | ||
ZMM2, | ||
ZMM3, | ||
ZMM4, | ||
ZMM5, | ||
ZMM6, | ||
ZMM7, | ||
ZMM8, | ||
ZMM9, | ||
ZMM10, | ||
ZMM11, | ||
ZMM12, | ||
ZMM13, | ||
ZMM14, | ||
ZMM15, | ||
ZMM16, | ||
ZMM17, | ||
ZMM18, | ||
ZMM19, | ||
ZMM20, | ||
ZMM21, | ||
ZMM22, | ||
ZMM23, | ||
ZMM24, | ||
ZMM25, | ||
ZMM26, | ||
ZMM27, | ||
ZMM28, | ||
ZMM29, | ||
ZMM30, | ||
ZMM31, | ||
} | ||
export enum DR { | ||
DR0 = 0, | ||
DR1, | ||
DR2, | ||
DR3, | ||
DR4, | ||
DR5, | ||
DR6, | ||
DR7, | ||
DR8, | ||
DR9, | ||
DR10, | ||
DR11, | ||
DR12, | ||
DR13, | ||
DR14, | ||
DR15, | ||
} | ||
@@ -30,2 +30,3 @@ "use strict"; | ||
exports.table = { | ||
cpuid: [{ o: 0x0FA2 }], | ||
int: [{}, | ||
@@ -32,0 +33,0 @@ { o: 0xCC, ops: [3] }, |
@@ -65,2 +65,4 @@ import {extend} from '../util'; | ||
export var table: TableDefinition = { | ||
cpuid: [{o: 0x0FA2}], | ||
// INT Software interrupt | ||
@@ -67,0 +69,0 @@ int: [{}, |
@@ -25,2 +25,3 @@ "use strict"; | ||
Code.create = function (name) { | ||
if (name === void 0) { name = 'start'; } | ||
if (!Code._methodsAdded) { | ||
@@ -27,0 +28,0 @@ util_1.extend(Code.prototype, methods); |
@@ -19,3 +19,3 @@ import {SIZE, TUiOperand} from '../../operand'; | ||
static create(name: string) { | ||
static create(name: string = 'start') { | ||
if(!Code._methodsAdded) { | ||
@@ -22,0 +22,0 @@ extend(Code.prototype, methods); |
360835
48
9144
217