From b34f9856cb492607808b27d15b5b83921575dd5d Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 2 Dec 2021 17:13:25 +0000 Subject: [PATCH] upload koldbg by CandyMan git-svn-id: svn://kolibrios.org@9353 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/koldbg/Tupfile.lua | 2 + programs/develop/koldbg/assemble.inc | 50 + programs/develop/koldbg/cmdhist.inc | 564 ++ programs/develop/koldbg/compress.bat | 1 + programs/develop/koldbg/disasm/disasm.asm | 8191 +++++++++++++++++++ programs/develop/koldbg/disasm/disasm32.asm | 187 + programs/develop/koldbg/disasm/disasm64.asm | 26 + programs/develop/koldbg/disasm/far-code.inc | 693 ++ programs/develop/koldbg/disasm/qopcodes.bin | Bin 0 -> 11077 bytes programs/develop/koldbg/disasm/qopcodes.inc | 1640 ++++ programs/develop/koldbg/disasm/rtn-62xx.inc | 556 ++ programs/develop/koldbg/disasm/rtn-c4c5.inc | 975 +++ programs/develop/koldbg/disasm/scanitem.inc | 50 + programs/develop/koldbg/disasm/selbat.inc | 2375 ++++++ programs/develop/koldbg/disasm/tables.inc | 1800 ++++ programs/develop/koldbg/fasm/assemble.inc | 2240 +++++ programs/develop/koldbg/fasm/avx.inc | 3425 ++++++++ programs/develop/koldbg/fasm/errors.inc | 194 + programs/develop/koldbg/fasm/exprcalc.inc | 2270 +++++ programs/develop/koldbg/fasm/exprpars.inc | 1280 +++ programs/develop/koldbg/fasm/fasm.asm | 155 + programs/develop/koldbg/fasm/formats.inc | 4194 ++++++++++ programs/develop/koldbg/fasm/messages.inc | 52 + programs/develop/koldbg/fasm/parser.inc | 1470 ++++ programs/develop/koldbg/fasm/preproce.inc | 2899 +++++++ programs/develop/koldbg/fasm/symbdump.inc | 450 + programs/develop/koldbg/fasm/tables.inc | 4374 ++++++++++ programs/develop/koldbg/fasm/variable.inc | 155 + programs/develop/koldbg/fasm/version.inc | 39 + programs/develop/koldbg/fasm/x86_64.inc | 7384 +++++++++++++++++ programs/develop/koldbg/font.inc | 132 + programs/develop/koldbg/font8x9.bmp | Bin 0 -> 2366 bytes programs/develop/koldbg/globals!.inc | 118 + programs/develop/koldbg/kernel.inc | 3316 ++++++++ programs/develop/koldbg/koldbg.asm | 2911 +++++++ programs/develop/koldbg/kosfuncs.inc | 298 + programs/develop/koldbg/loadmap.inc | 43 + programs/develop/koldbg/make.bat | 1 + programs/develop/koldbg/message.inc | 120 + programs/develop/koldbg/parser.inc | 396 + programs/develop/koldbg/readme.txt | 119 + programs/develop/koldbg/sort.inc | 68 + programs/develop/koldbg/symbols.inc | 415 + programs/develop/koldbg/tools.inc | 22 + 44 files changed, 55650 insertions(+) create mode 100644 programs/develop/koldbg/Tupfile.lua create mode 100644 programs/develop/koldbg/assemble.inc create mode 100644 programs/develop/koldbg/cmdhist.inc create mode 100644 programs/develop/koldbg/compress.bat create mode 100644 programs/develop/koldbg/disasm/disasm.asm create mode 100644 programs/develop/koldbg/disasm/disasm32.asm create mode 100644 programs/develop/koldbg/disasm/disasm64.asm create mode 100644 programs/develop/koldbg/disasm/far-code.inc create mode 100644 programs/develop/koldbg/disasm/qopcodes.bin create mode 100644 programs/develop/koldbg/disasm/qopcodes.inc create mode 100644 programs/develop/koldbg/disasm/rtn-62xx.inc create mode 100644 programs/develop/koldbg/disasm/rtn-c4c5.inc create mode 100644 programs/develop/koldbg/disasm/scanitem.inc create mode 100644 programs/develop/koldbg/disasm/selbat.inc create mode 100644 programs/develop/koldbg/disasm/tables.inc create mode 100644 programs/develop/koldbg/fasm/assemble.inc create mode 100644 programs/develop/koldbg/fasm/avx.inc create mode 100644 programs/develop/koldbg/fasm/errors.inc create mode 100644 programs/develop/koldbg/fasm/exprcalc.inc create mode 100644 programs/develop/koldbg/fasm/exprpars.inc create mode 100644 programs/develop/koldbg/fasm/fasm.asm create mode 100644 programs/develop/koldbg/fasm/formats.inc create mode 100644 programs/develop/koldbg/fasm/messages.inc create mode 100644 programs/develop/koldbg/fasm/parser.inc create mode 100644 programs/develop/koldbg/fasm/preproce.inc create mode 100644 programs/develop/koldbg/fasm/symbdump.inc create mode 100644 programs/develop/koldbg/fasm/tables.inc create mode 100644 programs/develop/koldbg/fasm/variable.inc create mode 100644 programs/develop/koldbg/fasm/version.inc create mode 100644 programs/develop/koldbg/fasm/x86_64.inc create mode 100644 programs/develop/koldbg/font.inc create mode 100644 programs/develop/koldbg/font8x9.bmp create mode 100644 programs/develop/koldbg/globals!.inc create mode 100644 programs/develop/koldbg/kernel.inc create mode 100644 programs/develop/koldbg/koldbg.asm create mode 100644 programs/develop/koldbg/kosfuncs.inc create mode 100644 programs/develop/koldbg/loadmap.inc create mode 100644 programs/develop/koldbg/make.bat create mode 100644 programs/develop/koldbg/message.inc create mode 100644 programs/develop/koldbg/parser.inc create mode 100644 programs/develop/koldbg/readme.txt create mode 100644 programs/develop/koldbg/sort.inc create mode 100644 programs/develop/koldbg/symbols.inc create mode 100644 programs/develop/koldbg/tools.inc diff --git a/programs/develop/koldbg/Tupfile.lua b/programs/develop/koldbg/Tupfile.lua new file mode 100644 index 0000000000..c2da13db4e --- /dev/null +++ b/programs/develop/koldbg/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule({"koldbg.asm"}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "koldbg") diff --git a/programs/develop/koldbg/assemble.inc b/programs/develop/koldbg/assemble.inc new file mode 100644 index 0000000000..6d18df2866 --- /dev/null +++ b/programs/develop/koldbg/assemble.inc @@ -0,0 +1,50 @@ +;----------------------------------------------------------------------------- +; Assemble instruction event +OnAsm: mov esi,[CurArg] + mov edi,esi + mov ecx,255 + xor eax,eax + repnz scasb + stc + sbb edi,esi + jz .Exit + ; + mov eax,[CPUYPos] + mov rax,[AddrBuffer+(rax-1)*sizeof.dq] + mov [OriginPtr],rax + mov al,[CodeType] + mov [code_type],al + ; + call Assemble + or esi,esi + jz .Move + ; +if 1 + mov ecx,MSG_WIDTH-1 + mov edi,ErrorLine + push rdi +.Loop: lodsb + stosb + or al,al + loopnz .Loop + mov [rdi-1],word 10 + pop rsi + and byte [rsi],0xDF +end if + ; + call PutMessageNoDraw + jmp .Exit +.Move: mov eax,[CPUYPos] + mov rsi,[AddrBuffer+(rax-1)*sizeof.dq] + lea edi,[output_data] + mcall 69,7,[DebuggeePID],[output_size] +.Exit: call PrintCmdLine + mov [AfterKey],1 + call ShowImage + ret +;----------------------------------------------------------------------------- +uglobal +if used ErrorLine +ErrorLine rb MSG_WIDTH +end if +endg \ No newline at end of file diff --git a/programs/develop/koldbg/cmdhist.inc b/programs/develop/koldbg/cmdhist.inc new file mode 100644 index 0000000000..4585dcb596 --- /dev/null +++ b/programs/develop/koldbg/cmdhist.inc @@ -0,0 +1,564 @@ +InitCmdHistBuffer: +;------------------------------------------------------------------------------- + push eax ebx ecx + + mcall 68,12,4096 ;allocate 4KB block + mov [CmdHistBuffer.Ptr],eax + mov [CmdHistBuffer.Size],ecx + + mov edi,eax + xor eax,eax + stosd + stosd + mov [CmdHistBuffer.NewNodeOffset],eax + mov [CmdHistBuffer.LastNodeOffset],eax + mov [CmdHistBuffer.CurNodeOffset],eax + mov [CmdHistBuffer.TmpLineFlag],al + mov [CmdHistBuffer.NFlag],al + + pop ecx ebx eax + ret +;------------------------------------------------------------------------------- + +EnlargeCmdHistBuffer: +;------------------------------------------------------------------------------- + pusha + + mov ecx,[CmdHistBuffer.Size] + add ecx,4096 + mov edx,[CmdHistBuffer.Ptr] + mcall 68,20 ;reallocate the buffer (prev. size + 4KB) + test eax,eax + jz .Err + mov [CmdHistBuffer.Ptr],eax + mov [CmdHistBuffer.Size],ecx +.OK: + clc + popa + ret +.Err: + stc + popa + ret +;------------------------------------------------------------------------------- + +AddCmdHistLine: +;------------------------------------------------------------------------------- +;in: +;eax = ptr to ASCIIZ string of line +;------------------------------------------------------------------------------- + pusha + + mov esi,eax + mov edx,eax + xor ecx,ecx +@@: + inc ecx + lodsb + test al,al + jz @F + jmp @B +@@: + dec ecx + jz .OK + + inc ecx + + mov eax,[CmdHistBuffer.NewNodeOffset] + lea eax,[eax+ecx+2*4] + cmp [CmdHistBuffer.Size],eax + jae @F + call EnlargeCmdHistBuffer + jc .Err +@@: + mov edi,[CmdHistBuffer.NewNodeOffset] + mov eax,[CmdHistBuffer.Ptr] + add edi,eax + cmp eax,edi ;if eax = edi, then it's the first node + jne @F + xor eax,eax + dec eax + stosd ;save previous node link = -1 for the first node + stosd ;save next node link = -1 for the first node + jmp .CPStr +@@: + mov ebx,[CmdHistBuffer.LastNodeOffset] + mov [edi],ebx ;save previous node link for a new node + add ebx,eax + mov eax,[CmdHistBuffer.NewNodeOffset] + mov [ebx+4],eax ;update next node link for a last node + mov [CmdHistBuffer.LastNodeOffset],eax + mov [CmdHistBuffer.CurNodeOffset],eax + add edi,4 + xor eax,eax + dec eax + stosd +.CPStr: + mov esi,edx + + push ecx + rep movsb + pop ecx + + add ecx,2*4 + add [CmdHistBuffer.NewNodeOffset],ecx +.OK: + clc +.Err: + mov [CmdHistBuffer.TmpLineFlag],0 + popa + ret +;------------------------------------------------------------------------------- + +AddCmdHistTmpLine: +;------------------------------------------------------------------------------- +;in: +;eax = ptr to ASCIIZ string of line +;------------------------------------------------------------------------------- + pusha + + mov esi,eax + mov edx,eax + xor ecx,ecx +@@: + inc ecx + lodsb + test al,al + jz @F + jmp @b +@@: + mov eax,[CmdHistBuffer.NewNodeOffset] + lea eax,[eax+ecx+2*4] + cmp [CmdHistBuffer.Size],eax + jae @F + call EnlargeCmdHistBuffer + jc .Err +@@: + mov edi,[CmdHistBuffer.NewNodeOffset] + mov [CmdHistBuffer.TmpLineFlag],1 + mov eax,[CmdHistBuffer.Ptr] + add edi,eax + xor eax,eax + stosd + stosd ;two zeroes - marker (prefix) of tmp line +.CPStr: + mov esi,edx + rep movsb +.OK: + clc +.Err: + popa + ret +;------------------------------------------------------------------------------- + +GetCmdHistLine: +;------------------------------------------------------------------------------- +;out: +;eax = ptr to ASCIIZ string of current line +;------------------------------------------------------------------------------- + push ebx + + mov eax,[CmdHistBuffer.Ptr] + mov ebx,[CmdHistBuffer.CurNodeOffset] + + lea eax,[eax+ebx+2*4] + + pop ebx + ret +;------------------------------------------------------------------------------- + +GetCmdHistTmpLine: +;------------------------------------------------------------------------------- +;out: +;eax = ptr to ASCIIZ string of current line or 0 (no tmp line) +;------------------------------------------------------------------------------- + cmp [CmdHistBuffer.TmpLineFlag],0 + je @F + + mov eax,[CmdHistBuffer.NewNodeOffset] + add eax,[CmdHistBuffer.Ptr] + add eax,2*4 +@@: + ret +;------------------------------------------------------------------------------- + +PrevCmdHistLine: +;------------------------------------------------------------------------------- +;out: +;CF = 0 - OK, CF = 1 (no previous lines) +;------------------------------------------------------------------------------- + push eax ebx + + mov eax,[CmdHistBuffer.Ptr] + mov ebx,[CmdHistBuffer.CurNodeOffset] + + lea eax,[eax+ebx] + mov eax,[eax] + inc eax + jz .RetCF + dec eax + mov [CmdHistBuffer.CurNodeOffset],eax + + clc + pop ebx eax + ret +.RetCF: + stc + pop ebx eax + ret +;------------------------------------------------------------------------------- + +NextCmdHistLine: +;------------------------------------------------------------------------------- +;out: +;CF = 0 - OK, CF = 1 (no next lines) +;------------------------------------------------------------------------------- + push eax ebx + + mov eax,[CmdHistBuffer.Ptr] + mov ebx,[CmdHistBuffer.CurNodeOffset] + + lea eax,[eax+ebx] + mov eax,[eax+4] + inc eax + jz .RetCF + dec eax + mov [CmdHistBuffer.CurNodeOffset],eax + + clc + pop ebx eax + ret +.RetCF: + stc + pop ebx eax +ClearCmdLineEnd: + ret +;------------------------------------------------------------------------------- + +DrawCmdLine: + pushad + xor ebx,ebx + jmp @F + +DrawCmdLineEnd: + pushad + mov ebx,[CmdLinePos] + @@: + call ClearCmdLine + + mov [XPos],1 + mov [YPos],MinHeight-1 + mov [Color],15 + mov al,'>' + call PrintC + mov ecx,[CmdLineLen] + sub ecx,ebx + jbe .Skip + lea esi,[CmdLine+ebx] + .Loop: + lodsb + call PrintC + loop .Loop + .Skip: + popad + ret + +DrawCursor: + pushad + mov eax,[CmdLinePos] +times 2 inc eax + mov [CursorX],eax + mov [CursorY],MinHeight-1 + mov [AfterKey],1 + call ShowImage + popad + ret + +HideCursor: + pushad + or [CursorX],-1 + or [CursorY],-1 + mov [AfterKey],1 + call ShowImage + popad + ret + +;----------------------------------------------------------------------------- +; Find command in list +FindCmd: +; all commands are case-insensitive + push edi + .X4: + mov al,[edi] + cmp al,0 + jz .X5 + cmp al,'A' + jb @F + cmp al,'Z' + ja @F + or al,20h + @@: + stosb + jmp .X4 + + ; find command + .X5: + pop edi + .X6: + cmp dword [esi],0 + jz .X7 + push esi + mov esi,[esi] + lodsb + movzx ecx,al + push edi + repz cmpsb + pop edi + pop esi + jz .X8 + add esi,17 + jmp .X6 + .X7: + stc + .X8: + ret + +HelpGroups: + dd aControl,0,0,HelpControlMsg + db 0 + dd aData,0,0,HelpDataMsg + db 0 + dd aBreakpoints,0,0,HelpBreaksMsg + db 0 +; flags field: +; &1: command may be called without parameters +; &2: command may be called with parameters +; &4: command may be called without loaded program +; &8: command may be called with loaded program +Commands: + dd aHlp,OnHelp,HelpSyntax,HelpHelp + db 0Fh + dd aHelp,OnHelp,HelpSyntax,HelpHelp + db 0Fh + dd aQuit,OnQuit,QuitSyntax,QuitHelp + db 0Dh + dd aExit,OnQuit,ExitSyntax,ExitHelp + db 0Dh + dd aLoad,OnLoad,LoadSyntax,LoadHelp + db 6 + dd aReload,OnReLoad,ReloadSyntax,ReloadHelp + db 0Dh + dd aTerminate,OnTerminate,TerminateSyntax,TerminateHelp + db 9 + dd aDetach,OnDetach,DetachSyntax,DetachHelp + db 9 + dd aSuspend,OnSuspend,SuspendSyntax,SuspendHelp + db 9 + dd aResume,OnResume,ResumeSyntax,ResumeHelp + db 0Bh + dd aStep,OnStepMultiple,StepSyntax,StepHelp + db 0Bh + dd aProceed,OnProceedMultiple,ProceedSyntax,ProceedHelp + db 0Bh + dd aCalc,OnCalc,CalcSyntax,CalcHelp + db 0Eh + dd aDump,OnDump,DumpSyntax,DumpHelp + db 0Bh + ;dd aUnassemble,OnUnassemble,UnassembleSyntax,UnassembleHelp + ;db 0Bh + dd aBp,OnBp,BpSyntax,BpHelp + db 0Ah + dd aBpm,OnBpmb,BpmSyntax,BpmHelp + db 0Ah + dd aBpmb,OnBpmb,BpmSyntax,BpmHelp + db 0Ah + dd aBpmw,OnBpmw,BpmSyntax,BpmHelp + db 0Ah + dd aBpmd,OnBpmd,BpmSyntax,BpmHelp + db 0Ah + dd aBl,OnBl,BlSyntax,BlHelp + db 0Bh + dd aBc,OnBc,BcSyntax,BcHelp + db 0Ah + dd aBd,OnBd,BdSyntax,BdHelp + db 0Ah + dd aBe,OnBe,BeSyntax,BeHelp + db 0Ah + dd aReg,OnReg,RSyntax,RHelp + db 0Ah + dd aUnpack,OnUnpack,UnpackSyntax,UnpackHelp + db 9 + dd aLoadSymbols,OnLoadSymbols,LoadSymbolsSyntax,LoadSymbolsHelp + db 0Ah + ; + dd aAsm,OnAsm,AsmSyntax,AsmHelp + db 2+8 + dd aJump,OnJump,JumpSyntax,JumpHelp + db 2+8 + dd aDoLoad,DoLoad,DoLoadSyntax,DoLoadHelp + db 1+4 + ; + dd 0 + +aHelp db 5,'help',0 +aHlp db 2,'h',0 +HelpHelp db 'Help on specified function',10 +HelpSyntax db 'Usage: h or help [group | command]',10,0 + +HelpMsg db 'List of known command groups:',10 + db '"help control" - display list of control commands',10 + db '"help data" - display list of commands concerning data',10 + db '"help breakpoints" - display list of commands concerning breakpoints',10,0 + +aAsm db 2,'a',0 +AsmHelp db 'Assemble instruction at current position',10 +AsmSyntax db 'Usage: a instruction (',8,8Ah,'mov al,[ebx+12h]',8,8Fh,')',10,0 + +aJump db 2,'j',0 +JumpHelp db 'Sets current window or current register new address',10 +JumpSyntax db 'Usage: Jump ',10,0 + +aDetach db 7,'detach',0 +DetachHelp db 'Detach from debugged program',10 +DetachSyntax db 'Usage: detach',10,0 + +aSuspend db 5,'stop',0 +SuspendHelp db 'Suspend execution of debugged program',10 +SuspendSyntax db 'Usage: stop',10,0 + +aQuit db 5,'quit',0 +QuitHelp db 'Quit from debugger',10 +QuitSyntax db 'Usage: quit',10,0 + +aExit db 5,'exit',0 +ExitHelp db 'Exit from debugger',10 +ExitSyntax db 'Usage: exit',10,0 + +aLoad db 5,'load',0 +LoadHelp db 'Load program for debugging',10 +LoadSyntax db 'Usage: load [parameters]',10,0 + +aDoLoad db 7,'doload',0 +DoLoadHelp db 'Load test program for debugging',10 +DoLoadSyntax db 'Usage: doload',10,0 + +aReload db 7,'reload',0 +ReloadHelp db 'Reload debugging program (restart debug session)',10 +ReloadSyntax db 'Usage: reload',10,0 + +aTerminate db 10,'terminate',0 +TerminateHelp db 'Terminate debugged program',10 +TerminateSyntax db 'Usage: terminate',10,0 + +aResume db 2,'g',0 +ResumeHelp db 'Go (resume execution of debugged program)',10 +ResumeSyntax db 'Usage: g',10 + db ' or: g - wait until specified address is reached',10,0 + +aStep db 2,'s',0 +StepHelp db 'Make step in debugged program',10 +StepSyntax db 'Usage: s []',10,0 + +aProceed db 2,'p',0 +ProceedHelp db 'Make wide step in debugged program (step over CALL, REPxx, LOOP)',10 +ProceedSyntax db 'Usage: p []',10,0 + +aDump db 2,'d',0 +DumpHelp db 'Dump data of debugged program',10 +DumpSyntax db 'Usage: d - dump data at specified address',10 + db ' or: d - continue current dump',10,0 + +aCalc db 2,'?',0 +CalcHelp db 'Calculate value of expression',10 +CalcSyntax db 'Usage: ? ',10,0 + +aReg db 2,'r',0 +RHelp db 'Set register value',10 +RSyntax db 'Usage: r ',10 + db ' or: r = - set value of to ',10,0 + +aBp db 3,'bp',0 +BpHelp db 'set BreakPoint on execution',10 +BpSyntax db 'Usage: bp ',10,0 + +aBpm db 4,'bpm',0 +aBpmb db 5,'bpmb',0 +aBpmw db 5,'bpmw',0 +aBpmd db 5,'bpmd',0 +BpmHelp db 'set BreakPoint on Memory access',10 + db 'Maximum 4 breakpoints of this type are allowed',10 + db 'Note that for this breaks debugger is activated after access',10 +BpmSyntax db 'Usage: bpmb [w] ',10 + db ' bpmw [w] ',10 + db ' bpmd [w] ',10 + db ' bpm is synonym for bpmd',10 + db '"w" means break only on writes (default is on read/write)',10,0 + +aBl db 3,'bl',0 +BlHelp db 'Breakpoint List',10 +BlSyntax db 'Usage: bl - list all breakpoints',10 + db ' bl - display info on particular breakpoint',10,0 + +aBc db 3,'bc',0 +BcHelp db 'Breakpoint Clear',10 +BcSyntax db 'Usage: bc ',10 + db 'Examples: bc 2',10 + db ' bc 1 3 4 A',10,0 + +aBd db 3,'bd',0 +BdHelp db 'Breakpoint Disable',10 +BdSyntax db 'Usage: bd ',10 + db 'Examples: bd 2',10 + db ' bd 1 3 4 A',10,0 + +aBe db 3,'be',0 +BeHelp db 'Breakpoint Enable',10 +BeSyntax db 'Usage: be ',10 + db 'Examples: be 2',10 + db ' be 1 3 4 A',10,0 + +aUnpack db 7,'unpack',0 +UnpackHelp db 'Try to bypass unpacker code',10 +UnpackSyntax db 'Usage: unpack',10,0 + +aLoadSymbols db 13,'load-symbols',0 +LoadSymbolsHelp db 'Load symbolic information for executable',10 +LoadSymbolsSyntax db 'Usage: load-symbols ',10,0 + +; Control commands group +aControl db 8,'control',0 +HelpControlMsg db 'List of control commands:',10 + db 'h = help - help',10 + db 'exit/quit - exit from debugger',10 + db 'load [params] - load program for debugging',10 + db 'reload - reload debugging program',10 + db 'load-symbols - load information on symbols for program',10 + db 'terminate - terminate loaded program',10 + db 'detach - detach from debugging program',10 + db 'stop - suspend execution of debugging program',10 + db 'a - assemble instruction at current position',10 + db 'g [] - go on (resume execution of debugging program)',10 + db 's [] - program step, also ',10 + db 'p [] - program wide step, also ',10 + db 'unpack - try to bypass unpacker code (heuristic)',10,0 + +; Data commands group +aData db 5,'data',0 +HelpDataMsg db 'List of data commands:',10 + db '? - calculate value of expression',10 + db 'd [] - dump data at given address',10 + db 'j - jump, current window or current register new address',10 + ;db 'u [] - unassemble instructions at given address',10 + db 'r or',10 + db 'r = - set register value',10,0 + +; Breakpoints commands group +aBreakpoints db 12,'breakpoints',0 +HelpBreaksMsg db 'List of breakpoints commands:',10 + db 'bp - set breakpoint on execution',10 + db 'bpm[b|w|d] - set breakpoint on memory access',10 + db 'bl [] - breakpoint(s) info',10 + db 'bc ... - clear breakpoint',10 + db 'bd ... - disable breakpoint',10 + db 'be ... - enable breakpoint',10,0 +; \ No newline at end of file diff --git a/programs/develop/koldbg/compress.bat b/programs/develop/koldbg/compress.bat new file mode 100644 index 0000000000..3c1d0c3ec4 --- /dev/null +++ b/programs/develop/koldbg/compress.bat @@ -0,0 +1 @@ +uharc a -m3 -mx -md32768 -r koldbg !old\*.* !*.dbg diff --git a/programs/develop/koldbg/disasm/disasm.asm b/programs/develop/koldbg/disasm/disasm.asm new file mode 100644 index 0000000000..d8a7fcb373 --- /dev/null +++ b/programs/develop/koldbg/disasm/disasm.asm @@ -0,0 +1,8191 @@ + +;----------------------------------------------------------------------------- +match =32,Bitness { +rax equ eax +rbx equ ebx +rcx equ ecx +rdx equ edx +rsi equ esi +rdi equ edi +rbp equ ebp +rsp equ esp +r9 equ [r9v] +r15d equ [r5v] +r15 equ [r5v] +r10 equ [r1v] +dq equ dd +_8_ equ 4 +} +;----------------------------------------------------------------------------- +match =64,Bitness { +_8_ equ 8 +} +;----------------------------------------------------------------------------- +macro jrcxz Dst +{ +if %B=32 + jecxz Dst +else + jrcxz Dst +end if +} +;----------------------------------------------------------------------------- +; REX.W = 0 - CS.D, 1 - 64bit +; REX.R = ModR/M reg field (GPR, SSE, CRx, DRx) +; REX.X = SIB index field +; REX.B = ModR/M r/m field, SIB base field, opcode reg field +;----------------------------------------------------------------------------- +; In 64Bits +; REX.W = 1 & 66h -> 66h is ignored if not mandatory +;----------------------------------------------------------------------------- +; Prefixes VEX Opc3 ModRM SIB DISP IMM +; +; REX & VEX -> #UD +; LOCK & VEX -> #UD +; 66/F2/F3 & VEX -> #UD +; +; VEX3 - 0F / 0F 38 / 0F 3A +; 11000100 RXBmmmmm WvvvvLpp +; +; VEX2 - 0F +; 11000101 RvvvvLpp +; +; REX.R = !VEX.R +;VEX.R=0: Same as REX.R=1 (64-bit mode only) +;VEX.R=1: Same as REX.R=0 (must be 1 in 32-bit mode) +; REX.X = !VEX.X +;VEX.X=0: Same as REX.X=1 (64-bit mode only) +;VEX.X=1: Same as REX.X=0 (must be 1 in 32-bit mode +; REX.B = !VEX.B +;VEX.B=0: Same as REX.B=1 (64-bit mode only) +;VEX.B=1: Same as REX.B=0 (Ignored in 32-bit mode) +; +; REX.W = VEX.W, 4 operands +; In 32-bit VEX.W is silently ignored. +; +; mmmmm = 01b - 0F +; 10b - 0F 38 +; 11b - 0F 3A +; vvvv = register specifier / 1111 - unused +; L = 0 - vector 128bit or scalar / 1 - 256bit vector +; pp = opcode extension - 00b - None +; 01b - 66 +; 10b - F3 +; 11b - F2 +; +;NDS, NDD, DDS: specifies that VEX.vvvv field is valid for the encoding of a +;register operand: +; VEX.NDS: VEX.vvvv encodes the first source register in an instruction +;syntax where the content of source registers will be preserved. +; VEX.NDD: VEX.vvvv encodes the destination register that cannot be +;encoded by ModR/M:reg field. +; VEX.DDS: VEX.vvvv encodes the second source register in a three- +;operand instruction syntax where the content of first source register will +;be overwritten by the result. +; If none of NDS, NDD, and DDS is present, VEX.vvvv must be 1111b (i.e. +;VEX.vvvv does not encode an operand). The VEX.vvvv field can be +;encoded using either the 2-byte or 3-byte form of the VEX prefix. +; /is4: An 8-bit immediate byte is present containing a source register +;specifier in imm[7:4] and instruction-specific payload in imm[3:0]. +; imz2: Part of the is4 immediate byte providing control functions that +;apply to two-source permute instructions +;----------------------------------------------------------------------------- +; EVEX 62h P0 P1 P2 +; +;P0: 7 6 5 4 3 2 0 1 +; R X B R' 0 0 m m P[7:0] +;P1 7 6 5 4 3 2 0 1 +; W v v v v 1 p p P[15:8] +;P2 7 6 5 4 3 2 0 1 +; z L' L b V' a a a P[23:16] +;EVEX.mm Compressed legacy escape P[1:0] Identical to low two bits of VEX.mmmmm +;EVEX.pp Compressed legacy prefix P[9:8] Identical to VEX.pp +;EVEX.RXB Next-8 register specifier modifier P[7:5] Combine with ModR/M.reg, ModR/M.rm (base, index/vidx) +;EVEX.R' High-16 register specifier modifier P[4] Combine with EVEX.R and ModR/M.reg +;EVEX.X High-16 register specifier modifier P[6] Combine with EVEX.B and ModR/M.rm, when SIB/VSIB absent +;EVEX.vvvv NDS register specifier P[14:11] Same as VEX.vvvv +;EVEX.V' High-16 NDS/VIDX register specifier P[19] Combine with EVEX.vvvv or when VSIB present +;EVEX.aaa Embedded opmask register specifier P[18:16] +;EVEX.W Osize promotion/Opcode extension P[15] +;EVEX.z Zeroing/Merging P[23] +;EVEX.b Broadcast/RC/SAE Context P[20] +;EVEX.L'L Vector length/RC P[22:21] +;------------------------------------------------------------------------------------------------------- +;Addressing mode Bit 4 Bit 3 Bits [2:0] Register type Common usage +;------------------------------------------------------------------------------------------------------- +;REG EVEX.R' EVEX.R ModRM.reg General purpose, Vector Destination or Source +;NDS/NDD EVEX.V' EVEX.v3v2v1v0 GPR, Vector 2nd Source or Destination +;RM EVEX.X EVEX.B ModRM.r/m GPR, Vector 1st Source or Destination +;BASE 0 EVEX.B ModRM.r/m GPR Memory addressing +;INDEX 0 EVEX.X SIB.index GPR Memory addressing +;VIDX EVEX.V' EVEX.X SIB.index Vector VSIB memory addressing +;IS4 Imm8[3] Imm8[7:4] Vector 3rd Source +;------------------------------------------------------------------------------------------------------- +;XOP Bit Mnemonic Description +;Byte 0: +;7-0 8Fh XOP Prefix Byte for 3-byte XOP Prefix +;Byte 1: +;7 R Inverted one bit extension to ModRM.reg field +;6 X Inverted one bit extension of the SIB index field +;5 B Inverted one bit extension of the ModRM r/m field or the SIB base field +;4-0 mmmmm +;XOP opcode map select: +;08h-instructions with immediate byte; +;09h-instructions with no immediate; +;Byte 2: +;7 W Default operand size override for a general pur- +;pose register to 64-bit size in 64-bit mode; oper- +;and configuration specifier for certain XMM/YMM-based operations. +;6-3 vvvv Source or destination register specifier +;2 L Vector length for XMM/YMM-based operations. +;1-0 pp +;Specifies whether there's an implied 66, F2, or F3 opcode extension +;----------------------------------------------------------------------------- +RXB = 1 ;REX.B (extension to the Base) +RXX = 2 ;REX.X (extension to the SIB indeX) +RXR = 4 ;REX.R (extension to the ModRM/REG) +RXW = 8 ;REX.W (operand Width; 0 = default, 1 = 64bit) +RXP = 40h ;REX prefix +;----------------------------------------------------------------------------- + +MaxInstructionLength = 15 + +MnemonicLength = 17 ;maximum length of instruction name + +;Unsigned Minimum eax,edx to eax +macro MinU +{ + cmp rax,rdx + sbb rcx,rcx + and rax,rcx + not rcx + and rdx,rcx + or rax,rdx +} +;Unsigned Maximum eax,edx to eax +macro MaxU +{ + cmp rdx,rax + sbb rcx,rcx + and rax,rcx + not rcx + and rdx,rcx + or rax,rdx +} +;----------------------------------------------------------------------------- +; I/O: eax - size +macro Compress +{ + push rbx rcx rdx rsi rdi + mov rbx,[TheBufferO] + mov ecx,eax + xor edi,edi + xor esi,esi + mov [TheK],rdi +.1: mov ah,[TabSize] + xor edx,edx +.2: mov al,[rbx+rsi] + mov [rbx+rdi],al + inc rsi + cmp rsi,rcx + ja .6 + inc rdi + inc [TheK] + cmp al,32 + jne .3 + inc dl + jmp .4 +.3: xor dl,dl +.4: dec ah + jnz .2 + or dl,dl + jz .5 + dec dl + jz .5 + sub rdi,rdx + sub [TheK],rdx + mov al,9 + mov [rbx+rdi-1],al +.5: jmp .1 +.6: mov rax,[TheK] + pop rdi rsi rdx rcx rbx +} + +Names: file "qopcodes.bin" +include "qopcodes.inc" + +TNULL = ($-1-Names) + +False = 0 +True = 1 + +NIA = 1 ;Not Intel/AMD +UND = 2 ;Undocumented or abandon + +RACC = RRAX + +RRAX = 0 +RRCX = 1 +RRDX = 2 +RRBX = 3 +RRSP = 4 +RRBP = 5 +RRSI = 6 +RRDI = 7 +RR8 = 8 +RR9 = 9 +RR10 = 10 +RR11 = 11 +RR12 = 12 +RR13 = 13 +RR14 = 14 +RR15 = 15 + +RES = 0 +RCS = 1 +RSS = 2 +RDS = 3 +RFS = 4 +RGS = 5 + +VES = 26h +VCS = 2Eh +VSS = 36h +VDS = 3Eh +VFS = 64h +VGS = 65h + +VNONE = 0 +VBYTE = 1 +VWORD = 2 +VDWORD = 3 +VQWORD = 4 +VOWORD = 5 +VXWORD = 5 +VYWORD = 6 +VZWORD = 7 +VFWORD = 8 +VTWORD = 9 +;----------------------------------------------------------------------------- +xN = VNONE +xB = VBYTE +xW = VWORD +xD = VDWORD +xQ = VQWORD +xO = VOWORD +xX = VXWORD +xY = VYWORD +xZ = VZWORD +xF = VFWORD +xT = VTWORD +;----------------------------------------------------------------------------- +CPUX16 = 0 +CPUX32 = 1 +CPUX64 = 2 + +AD16 = 0 +AD32 = 1 +AD64 = 2 +ADXX = 3 +ADYY = 4 +ADZZ = 5 + +;kolejno˜† ma znaczenie/the order is significant +PF3 = 0 +PF2 = 1 +P66 = 2 + +P67 = 3 +P4X = 4 +P9B = 5 +PF0 = 6 +PSEG = 7 + +GPR08 = 1 +GPR16 = 2 +GPR32 = 3 +GPR64 = 4 +SEGRG = 5 +STXRG = 6 +CTRRG = 7 +DBGRG = 8 +MMXRG = 9 +XMMRG = 10 +YMMRG = 11 +ZMMRG = 12 +BNDRG = 13 +TRXRG = 14 +KXXRG = 15 +;----------------------------------------------------------------------------- +_R = 1 ;Clear 66h prefix +_R64 = 2 ;Clear 66h prefix if CPUX64 +_O = 4 ;Do not show memory operand size +_R48 = 8 ;Clear 48h prefix +_J = 10h ;Show Branch Hint +_A = 20h ;Always call 3rd procedure +_T = 40h ;Extended = Table +_E = 80h ;Extended Table +_3 = 100h ;MOD3 (I.Mod=3, CL=3 next 4 names in TABle) +_S = 8000h ;add "S"uffix in ATT +_XA = 4000h ;XACQUIRE +_XR = 2000h ;XRELEASE +_L = 1000h ;LOCK unnecessary +_B = 800h ;BND prefix instruction +;----------------------------------------------------------------------------- +VEXF = 8000h ;without third opcode +VEX2 = 4000h ;2nd operand always = xmm +VEX1 = 2000h ;1st operand always = xmm +VEXH = 1000h ;MoveName instead MoveNameV +VEXG = 800h ;operands - GPR32, VEXW - GPR64 +VEXC = 400h ;VEXW=1 = no error +VEXS = 200h ;encoded NDS +VEXR = 100h ;only register operands +VEXW = 80h ;if W=1 then error +VEXI = 40h ;imm8 +VEX4 = 20h ;is4 +VEXV = 10h ;must be vvvv=1111b +VEX8 = 08h ;imm8=opcode's new name +VEXL = 04h ;if L=1 then error +VEXN = 02h ;if L=0 then error +VEXM = 01h ;only memory operands +VEX0 = 00h ;undefined +;----------------------------------------------------------------------------- +XOPO = 80h ;00h=RM?R?,80h=R?RM? +XOP2 = 40h ;2nd operand always = xmm +XOP1 = 20h ;1st operand always = xmm +XOPV = 10h ;must be vvvv=1111b +XOPI = 08h ;imm8 +;----------------------------------------------------------------------------- +XOPL = 04h ;if L=1 then error & flag like VEX.L +XOPW = 80h ;if W=1 then error & flag like REX.W +;----------------------------------------------------------------------------- +EVEXAA = 10000h ;for decorator +EVEXQ1 = 08000h ;add suffix Q1 when W=1 +EVEXD1 = 04000h ;add suffix D1 when W=1 +EVEXE = (EVEXQ1+EVEXD1) ;name points to two names +EVEXI = 02000h ;imm8 +EVEXM = 01000h ;call GetVectorAndMUL +EVEXB = 00800h ;inc MemorySize & MULT when (W=1 & BB!=0) +EVEXU = 00400h ;inc MemorySize & MULT when W=1 +EVEXL0 = 00200h ;if L'L=00b then error +EVEXLL = 00100h ;if L'L<10b then error +EVEXLX = (EVEXL0+EVEXLL) ;if L'L>00b then error +;----------------------------------------------------------------------------- +EVEXW0 = (EVEXYW+EVEXNW) ;ignore W1 in non 64-bits +EVEXYW = 00080h ;if W=1 then error +EVEXNW = 00040h ;if W=0 then error +EVEXV = 00020h ;if VVVV!=1111b then error +EVEX2 = 00010h ;proc points to two procs +;----------------------------------------------------------------------------- +EVEXS = 00008h ;skip {K1} +EVEXR = 00004h ;indicates support for embedded rounding control, which is only applicable to the register-register form of the instruction +EVEXO = 00002h ;EVEXR Only if W=1 +EVEXX = 00001h ;always XMM, L'L ignore +;----------------------------------------------------------------------------- +EVEX0 = 00000h ;undefined +;----------------------------------------------------------------------------- +include "scanitem.inc" +;----------------------------------------------------------------------------- +macro xx Name,Rtn,Rand=0,DefReg=0,Flags=0 +{ +local Temp +if Rtn-RtnXX<0 + err invalid procedure address +end if + dw Name +virtual at 0 +Temp:: + dw Rtn-RtnXX +if (Flags) and _E = _E + if DefReg-EXT80<0 + err invalid table address + end if + dw DefReg-EXT80 +else if (Flags) and _T = _T + if DefReg-TTXXXX<0 + err invalid table address + end if + dw DefReg-TTXXXX +else + db Rand shl 4+DefReg,? +end if + dw Flags +end virtual + AddElement Temp: +} + +virtual at 0 +xxh: +.Rtn dw ? +.NxtTab rw 0 +.DefReg db ?,? +.Flags dw ? +.Size: +end virtual + +virtual at 0 +yyh: +.Name: dw ? +.Addr: dw ? +.Size: +end virtual +;----------------------------------------------------------------------------- +virtual at 0 ;XOP +XOP: +.Imm db ? +.Flags db ? +.MOS db ?,? +.Rtn dw ? +.Name dw ? +.Size: +end virtual +;----------------------------------------------------------------------------- +macro XOPc Imm,MOS0,MOS1,Flags,Rtn,NameV +{ + db Imm + db Flags + db MOS0,MOS1 + dw Rtn-RtnXX + dw NameV +} +;----------------------------------------------------------------------------- +virtual at 0 ;xC +CXX: +.Rtn dw ? +.Flags dw ? +.Imm db ? +.MOS db ? +.Name dw ? +.Size: +end virtual +;----------------------------------------------------------------------------- +macro xC Routine,Flags,Imm,MOS0,MOS1,NameV +{ + dw Routine-RtnXX + dw Flags + db Imm + db (MOS1)*16+MOS0 + dw NameV +} +;----------------------------------------------------------------------------- +virtual at 0 +X62: +.Rtn dw ? +.Name dw ? +.Flags dw ? +.Imm db ? +.MOS db ? +.Size: +end virtual +;----------------------------------------------------------------------------- +macro T62 Routine,Imm,Name,Flags,MemSizeH,MemSizeL +{ + dw Routine-RtnXX + if ((Flags) and EVEXE = EVEXE) + dw Name-T62Names + else + dw Name + end if + dw Flags + db Imm + db (MemSizeH*16)+MemSizeL +} +;----------------------------------------------------------------------------- +macro FetchB +{ + lodsb +} + +macro FetchW +{ + lodsw +} + +macro FetchD +{ + lodsd +} + +macro FetchUD +{ + lodsd + or [I.MainFlags],80h +} + +macro FetchSB +{ + FetchB + movsx rax,al +} + +macro FetchSW +{ + FetchW + movsx rax,ax +} + +macro FetchSD +{ + FetchD +if %B=64 + movsxd rax,eax +end if +} + +macro FetchQ +{ +if %B=64 + lodsq +else + lodsd + mov edx,eax + lodsd + xchg edx,eax +end if +} + +macro BitT Mem,Val +{ + bt dword [Mem+Val/8],Val and 7 +} + +macro BitTS Mem,Val +{ + bts dword [Mem+Val/8],Val and 7 +} + +macro BitTR Mem,Val +{ + btr dword [Mem+Val/8],Val and 7 +} + +;Type2nd= +InNONE = 0 +InRM = 1 +InReg = 2 +InVVVV = 3 +Is1 = 4 + +struct TArg +Type db ? +Type2nd db ? +Reg db ? +Mem db ? +ImmB rb 0 +Imm dq ? +if %B=32 + dd ? +end if +ends + +struct TInstruction +; +Addr dq ? +SaveRSP dq ? +SaveRSI dq ? +Size dq ? +Item dd ? +Table dd ? +; +Arch db ? +Only db ? +NextByte db ? +NewTable db ? +; +NotR db ? +NotX db ? +NotB db ? +NotW db ? +NotP db ? +; +Is62 db ? +; +R db ? +X db ? +B db ? +W db ? +P db ? +V db ? +Z db ? +BB db ? +PP db ? +LL db ? +XX db ? +AAAA db ? +MULT db ? +; +XOP db ? +VEX db ? +VVVV db ? +MMMMM db ? +; +FlagsVEX rb 0 +FlagsXOP db ?,? +FlagsEVEX db ?,?,? +; +VT db ? +AfterVEX db ? +; +Fasm db ? +Medium db ? +UseDB db ? +NoREX db ? +FullHex db ? +Dollar db ? +HexPrefix db ? +Negate db ? +ShowRand db ? ;Always show operand size +ShowSize db ? +RandSize db ? +ShowScale db ? +NoAddress db ? +HideRIP db ? +IsShort db ? +Emulated db ? +IsAddress db ? +Sensitive db ? +NoShowRand db ? +DisplayHint db ? +PossibleLOCK db ? +PossibleF2F3 db ? +Compression db ? +Intelligent db ? +IsCALLJMP db ? +Prefix db ? +LastByte db ? +; +Operand db ? +Address db ? +CurSeg db ? +DefSeg db ? +PreREX db ? +IsFloat db ? +IsRET db ? +Syntax db ? +; +ModRM db ? +SIB db ? +Flags dw ? +Point dw ? +; +RM db ? +Reg db ? +Mod db ? +Relative db ? +; +Base db ? +Indx db ? +Scale db ? +DispSize db ? +; +Pos66 db ? +Pos67 db ? +Pos4X db ? +Pos9B db ? +PosF0 db ? +PosF2 db ? +PosF3 db ? +PosSEG db ? +; +Disp dq ? +if %B=32 + dd ? +end if +; +IsLEA db ? +PrefixByte db ? +Mandatory66 db ? +MemSeparator db ? +MainFlags db ? +; +Name dw ? +AltName dw ? +SegmName dw ? +; +Arg1 TArg +Arg2 TArg +Arg3 TArg +Arg4 TArg +Arg5 TArg +; +Suffix rb 4 +Suffix2nd rb 4 +Suffix3rd rb 4 +LastArg dq ? +; +Prefixes dd ? +PrefixesCpy dd ? +PrefixNames rw 16 +PrefixBites rb 16 +PrefixCount db ? +; +ends + +virtual at rbp-128 ;maximum lower address +I TInstruction +end virtual + +macro HexString +{ +local A +virtual at 0 +HexVal::db '0123456789ABCDEF' +end virtual +even 4 +HexString: +rept 256 n:0 {\ + load A byte from HexVal:(n shr 4) + db A + load A byte from HexVal:(n and 15) + db A + \} +} + +HexString +Scales db '1248' +Suffixes db 0,'bwlq' +;----------------------------------------------------------------------------- +TSAE dw T?RN?SAE? + dw T?RD?SAE? + dw T?RU?SAE? + dw T?RZ?SAE? +;----------------------------------------------------------------------------- +T1TO dw T?1TO2? + dw T?1TO4? + dw T?1TO8? + dw T?1TO16? +;----------------------------------------------------------------------------- +NGPR08 dw TAL,\ + TCL,\ + TDL,\ + TBL,\ + TAH,\ + TCH,\ + TDH,\ + TBH,\ + TAL,\ + TCL,\ + TDL,\ + TBL,\ + TAH,\ + TCH,\ + TDH,\ + TBH + +NGPRX8 dw TAL,\ + TCL,\ + TDL,\ + TBL,\ + TSPL,\ + TBPL,\ + TSIL,\ + TDIL,\ + TR8B,\ + TR9B,\ + TR10B,\ + TR11B,\ + TR12B,\ + TR13B,\ + TR14B,\ + TR15B + +NGPRL8 dw TAL,\ + TCL,\ + TDL,\ + TBL,\ + TSPL,\ + TBPL,\ + TSIL,\ + TDIL,\ + TR8L,\ + TR9L,\ + TR10L,\ + TR11L,\ + TR12L,\ + TR13L,\ + TR14L,\ + TR15L + +NGPR16 dw TAX,\ + TCX,\ + TDX,\ + TBX,\ + TSP,\ + TBP,\ + TSI,\ + TDI,\ + TR8W,\ + TR9W,\ + TR10W,\ + TR11W,\ + TR12W,\ + TR13W,\ + TR14W,\ + TR15W + +NGPR32 dw TEAX,\ + TECX,\ + TEDX,\ + TEBX,\ + TESP,\ + TEBP,\ + TESI,\ + TEDI,\ + TR8D,\ + TR9D,\ + TR10D,\ + TR11D,\ + TR12D,\ + TR13D,\ + TR14D,\ + TR15D,\ + TEIP? + +NGPR64 dw TRAX,\ + TRCX,\ + TRDX,\ + TRBX,\ + TRSP,\ + TRBP,\ + TRSI,\ + TRDI,\ + TR8,\ + TR9,\ + TR10,\ + TR11,\ + TR12,\ + TR13,\ + TR14,\ + TR15,\ + TRIP? + +NSTRXX dw TST0,\ + TST1,\ + TST2,\ + TST3,\ + TST4,\ + TST5,\ + TST6,\ + TST7 + +NSTRYY dw TST?0?,\ + TST?1?,\ + TST?2?,\ + TST?3?,\ + TST?4?,\ + TST?5?,\ + TST?6?,\ + TST?7? + +NCTRXX dw TCR0,\ + TCR1,\ + TCR2,\ + TCR3,\ + TCR4,\ + TCR5,\ + TCR6,\ + TCR7,\ + TCR8,\ + TCR9,\ + TCR10,\ + TCR11,\ + TCR12,\ + TCR13,\ + TCR14,\ + TCR15 + +NDBGXX dw TDR0,\ + TDR1,\ + TDR2,\ + TDR3,\ + TDR4,\ + TDR5,\ + TDR6,\ + TDR7,\ + TDR8,\ + TDR9,\ + TDR10,\ + TDR11,\ + TDR12,\ + TDR13,\ + TDR14,\ + TDR15 + +NDBGYY dw TDB0,\ + TDB1,\ + TDB2,\ + TDB3,\ + TDB4,\ + TDB5,\ + TDB6,\ + TDB7,\ + TDB8,\ + TDB9,\ + TDB10,\ + TDB11,\ + TDB12,\ + TDB13,\ + TDB14,\ + TDB15 + +NXMMXX dw TXMM0,\ + TXMM1,\ + TXMM2,\ + TXMM3,\ + TXMM4,\ + TXMM5,\ + TXMM6,\ + TXMM7,\ + TXMM8,\ + TXMM9,\ + TXMM10,\ + TXMM11,\ + TXMM12,\ + TXMM13,\ + TXMM14,\ + TXMM15,\ + TXMM16,\ + TXMM17,\ + TXMM18,\ + TXMM19,\ + TXMM20,\ + TXMM21,\ + TXMM22,\ + TXMM23,\ + TXMM24,\ + TXMM25,\ + TXMM26,\ + TXMM27,\ + TXMM28,\ + TXMM29,\ + TXMM30,\ + TXMM31 + +NYMMXX dw TYMM0,\ + TYMM1,\ + TYMM2,\ + TYMM3,\ + TYMM4,\ + TYMM5,\ + TYMM6,\ + TYMM7,\ + TYMM8,\ + TYMM9,\ + TYMM10,\ + TYMM11,\ + TYMM12,\ + TYMM13,\ + TYMM14,\ + TYMM15,\ + TYMM16,\ + TYMM17,\ + TYMM18,\ + TYMM19,\ + TYMM20,\ + TYMM21,\ + TYMM22,\ + TYMM23,\ + TYMM24,\ + TYMM25,\ + TYMM26,\ + TYMM27,\ + TYMM28,\ + TYMM29,\ + TYMM30,\ + TYMM31 + +NZMMXX dw TZMM0,\ + TZMM1,\ + TZMM2,\ + TZMM3,\ + TZMM4,\ + TZMM5,\ + TZMM6,\ + TZMM7,\ + TZMM8,\ + TZMM9,\ + TZMM10,\ + TZMM11,\ + TZMM12,\ + TZMM13,\ + TZMM14,\ + TZMM15,\ + TZMM16,\ + TZMM17,\ + TZMM18,\ + TZMM19,\ + TZMM20,\ + TZMM21,\ + TZMM22,\ + TZMM23,\ + TZMM24,\ + TZMM25,\ + TZMM26,\ + TZMM27,\ + TZMM28,\ + TZMM29,\ + TZMM30,\ + TZMM31 +;----------------------------------------------------------------------------- +NBNDX dw TBND0,TBND1,TBND2,TBND3,TBND4?,TBND5?,TBND6?,TBND7? +;----------------------------------------------------------------------------- +NSEGR dw TES,TCS,TSS,TDS,TFS,TGS,TS6,TS7 +NKXXX dw TK0,TK1,TK2,TK3,TK4,TK5,TK6,TK7 +;----------------------------------------------------------------------------- +NMMXXX dw TMM0,TMM1,TMM2,TMM3,TMM4,TMM5,TMM6,TMM7 +NTRXXX dw TTR0,TTR1,TTR2,TTR3,TTR4,TTR5,TTR6,TTR7 +;----------------------------------------------------------------------------- +NSEGX dw TSEGES,TSEGCS,TSEGSS,TSEGDS,TSEGFS,TSEGGS +;----------------------------------------------------------------------------- +DefCPU2AD db AD16,AD32,AD64 +XorCPU2AD db AD32,AD16,AD32 +DefCPU2OS db 0,1,1 +XorCPU2OS db 1,0,0 +;----------------------------------------------------------------------------- +if used DefArgSize +DefArgSize db VWORD,GPR16,VDWORD,GPR32,VQWORD,GPR64 +end if +;----------------------------------------------------------------------------- +NotP4X dd not (bit P4X) +;----------------------------------------------------------------------------- +SZ2Mems dw TBYTE,TWORD,TDWORD,TQWORD +SZ2Name dw TNULL,TBYTE,TWORD,TDWORD,TQWORD,TXWORD,TYWORD,TZWORD,\ + TFWORD,TTWORD +;----------------------------------------------------------------------------- +AD2Regs dd NGPR16,NGPR32,NGPR64,NXMMXX,NYMMXX,NZMMXX +;----------------------------------------------------------------------------- +IntelName dd NGPRX8 +SZ2Regs dd NGPR08,NGPR16,NGPR32,NGPR64,NSEGR,NSTRXX,NCTRXX,NDBGXX,\ + NMMXXX,NXMMXX,NYMMXX,NZMMXX,NBNDX,NTRXXX,NKXXX +;----------------------------------------------------------------------------- +TBIT dd 1 shl GPR08+\ + 1 shl GPR16+\ + 1 shl GPR32+\ + 1 shl GPR64+\ + 0 shl SEGRG+\ + 0 shl STXRG+\ + 1 shl CTRRG+\ + 1 shl DBGRG+\ + 0 shl MMXRG+\ + 1 shl XMMRG+\ + 1 shl YMMRG+\ + 1 shl ZMMRG+\ + 0 shl BNDRG+\ + 0 shl TRXRG+\ + 0 shl KXXRG +;----------------------------------------------------------------------------- +SZ2Mask dq 0x00,0xFF,0xFFFF,0xFFFFFFFF +;----------------------------------------------------------------------------- +;One Table 0F (X0-XF) +EXTBITS dd 0 shl 0+\ ;- 0 + 0 shl 1+\ ;- 1 + 1 shl 2+\ ;+ 2 + 1 shl 3+\ ;+ 3 + 0 shl 4+\ ;- 4 + 1 shl 5+\ ;+ 5 + 1 shl 6+\ ;+ 6 + 1 shl 7+\ ;+ 7 + 1 shl 8+\ ;+ 8 + 1 shl 9+\ ;+ 9 + 0 shl 10+\ ;- A + 0 shl 11+\ ;- B + 0 shl 12+\ ;- C + 1 shl 13+\ ;+ D + 1 shl 14+\ ;+ E + 1 shl 15 ;+ F +;----------------------------------------------------------------------------- +EXT0F dd EXT0F00,EXT0F10,EXT0F20,EXT0F30,EXT0F40,EXT0F50,EXT0F60,EXT0F70 + dd EXT0F80,EXT0F90,EXT0FA0,EXT0FB0,EXT0FC0,EXT0FD0,EXT0FE0,EXT0FF0 +;----------------------------------------------------------------------------- +TFLDXTable: dw TFLD1 + dw TFLDL2T + dw TFLDL2E + dw TFLDPI + dw TFLDLG2 + dw TFLDLN2 + dw TFLDZ + dw 0 + +TE110Table: dw TF2XM1 + dw TFYL2X + dw TFPTAN + dw TFPATAN + dw TFXTRACT + dw TFPREM1 + dw TFDECSTP + dw TFINCSTP + +TE111Table: dw TFPREM + dw TFYL2XP1 + dw TFSQRT + dw TFSINCOS + dw TFRNDINT + dw TFSCALE + dw TFSIN + dw TFCOS + +TVMXXTable: dw TVMRUN + dw TVMMCALL + dw TVMLOAD + dw TVMSAVE + dw TSTGI + dw TCLGI + dw TSKINIT + dw TINVLPGA +;----------------------------------------------------------------------------- +Now3D: dv 0Ch,TPI2FW + dv 0Dh,TPI2FD + dv 1Ch,TPF2IW + dv 1Dh,TPF2ID + dv 8Ah,TPFNACC + dv 8Eh,TPFPNACC + dv 90h,TPFCMPGE + dv 94h,TPFMIN + dv 96h,TPFRCP + dv 97h,TPFRSQRT + dv 9Ah,TPFSUB + dv 9Eh,TPFADD + dv $A0,TPFCMPGT + dv $A4,TPFMAX + dv $A6,TPFRCPIT1 + dv $A7,TPFRSQIT1 + dv $AA,TPFSUBR + dv $AE,TPFACC + dv $B0,TPFCMPEQ + dv $B4,TPFMUL + dv $B6,TPFRCPIT2 + dv $B7,TPMULHRW + dv $BB,TPSWAPD + dv $BF,TPAVGUSB + ; + dv $86,TPFRCPV ;Cyrix + dv $87,TPFRSQRTV;Cyrix + ; +End3D: +;----------------------------------------------------------------------------- +TabSSE4 rb 0 + dv $00,TPSHUFB + dv $01,TPHADDW + dv $02,TPHADDD + dv $03,TPHADDSW + dv $04,TPMADDUBSW + dv $05,TPHSUBW + dv $06,TPHSUBD + dv $07,TPHSUBSW + dv $08,TPSIGNB + dv $09,TPSIGNW + dv $0A,TPSIGND + dv $0B,TPMULHRSW + dv $1C,TPABSB + dv $1D,TPABSW + dv $1E,TPABSD +EndSSE4 rb 0 +;----------------------------------------------------------------------------- +NxtSSE4 rb 0 + dy $10,VXWORD+80h,TPBLENDVB + dy $14,VXWORD+80h,TBLENDVPS + dy $15,VXWORD+80h,TBLENDVPD + dy $17,VXWORD+80h,TPTEST + dy $20,VQWORD+80h,TPMOVSXBW + dy $21,VDWORD+80h,TPMOVSXBD + dy $22, VWORD+80h,TPMOVSXBQ + dy $23,VQWORD+80h,TPMOVSXWD + dy $24,VDWORD+80h,TPMOVSXWQ + dy $25,VQWORD+80h,TPMOVSXDQ + dy $28,VXWORD+80h,TPMULDQ + dy $29,VXWORD+80h,TPCMPEQQ + dy $2A,VXWORD+80h,TMOVNTDQA + dy $2B,VXWORD+80h,TPACKUSDW + dy $30,VQWORD+80h,TPMOVZXBW + dy $31,VDWORD+80h,TPMOVZXBD + dy $32, VWORD+80h,TPMOVZXBQ + dy $33,VQWORD+80h,TPMOVZXWD + dy $34,VDWORD+80h,TPMOVZXWQ + dy $35,VQWORD+80h,TPMOVZXDQ + dy $37,VXWORD+80h,TPCMPGTQ + dy $38,VXWORD+80h,TPMINSB + dy $39,VXWORD+80h,TPMINSD + dy $3A,VXWORD+80h,TPMINUW + dy $3B,VXWORD+80h,TPMINUD + dy $3C,VXWORD+80h,TPMAXSB + dy $3D,VXWORD+80h,TPMAXSD + dy $3E,VXWORD+80h,TPMAXUW + dy $3F,VXWORD+80h,TPMAXUD + dy $40,VXWORD+80h,TPMULLD + dy $41,VXWORD+80h,TPHMINPOSUW + dy $CF,VXWORD+80h,TGF2P8MULB + dy $DB,VXWORD+80h,TAESIMC + dy $DC,VXWORD+80h,TAESENC + dy $DD,VXWORD+80h,TAESENCLAST + dy $DE,VXWORD+80h,TAESDEC + dy $DF,VXWORD+80h,TAESDECLAST +EndNxtSSE4: +;----------------------------------------------------------------------------- +TableSXSSE: + dy $08,VOWORD+80h,TROUNDPS + dy $09,VOWORD+80h,TROUNDPD + dy $0A,VDWORD+80h,TROUNDSS + dy $0B,VQWORD+80h,TROUNDSD + dy $0C,VOWORD+80h,TBLENDPS + dy $0D,VOWORD+80h,TBLENDPD + dy $0E,VOWORD+80h,TPBLENDW + dy $0F,VOWORD+80h,TPALIGNR + dy $40,VOWORD+80h,TDPPS + dy $41,VOWORD+80h,TDPPD + dy $42,VOWORD+80h,TMPSADBW + dy $60,VOWORD+80h,TPCMPESTRM + dy $61,VOWORD+80h,TPCMPESTRI + dy $62,VOWORD+80h,TPCMPISTRM + dy $63,VOWORD+80h,TPCMPISTRI + dy $CE,VOWORD+80h,TGF2P8AFFINEQB + dy $CF,VOWORD+80h,TGF2P8AFFINEINVQB + dy $DF,VOWORD+80h,TAESKEYGENASSIST +TableEXSSE: +;----------------------------------------------------------------------------- +TabCLMUL: + dw TPCLMULLQLQDQ ;0000_0000b + dw TPCLMULHQLQDQ ;0000_0001b + rw 14 + dw TPCLMULLQHQDQ ;0001_0000b + dw TPCLMULHQHQDQ ;0001_0001b +;----------------------------------------------------------------------------- +T0F71Names: + dw 0 ;/0 + dw 0 ;/1 + dw TPSRLW ;/2 + dw 0 ;/3 + dw TPSRAW ;/4 + dw 0 ;/5 + dw TPSLLW ;/6 + dw 0 ;/7 +;----------------------------------------------------------------------------- +T0F72Names: + dw 0 ;/0 + dw 0 ;/1 + dw TPSRLD ;/2 + dw 0 ;/3 + dw TPSRAD ;/4 + dw 0 ;/5 + dw TPSLLD ;/6 + dw 0 ;/7 +;----------------------------------------------------------------------------- +T0F73Names: + dw 0 ;/0 + dw 0 ;/1 + dw TPSRLQ ;/2 + dw TPSRLDQ ;/3 + dw 0 ;/4 + dw 0 ;/5 + dw TPSLLQ ;/6 + dw TPSLLDQ ;/7 +;----------------------------------------------------------------------------- +TCentTable: + dw TMONTMUL ;C0 + dw TXSHA1 ;C8 + dw TXSHA256 ;D0 +;----------------------------------------------------------------------------- +TCRYPTable: + dw 0 ;C0 + dw TXCRYPTECB ;C8 + dw TXCRYPTCBC ;D0 + dw TXCRYPTCTR ;D8 + dw TXCRYPTCFB ;E0 + dw TXCRYPTOFB ;E8 + dw 0 ;F0 + dw 0 ;F8 +;----------------------------------------------------------------------------- +T0FAETable: + dw TFXSAVE + dw TFXRSTOR + dw TLDMXCSR + dw TSTMXCSR + dw TXSAVE + dw TXRSTOR + dw TXSAVEOPT + dw TCLFLUSH +;----------------------------------------------------------------------------- +T0FAETab64: + dw TFXSAVE64 + dw TFXRSTOR64 + dw 0 + dw 0 + dw TXSAVE64 + dw TXRSTOR64 + dw TXSAVEOPT64 + dw 0 +;----------------------------------------------------------------------------- +TF30FAETable: + dw TRDFSBASE + dw TRDGSBASE + dw TWRFSBASE + dw TWRGSBASE + dw TPTWRITE + dw TINCSSPD + dw TUMONITOR + dw 0 +;----------------------------------------------------------------------------- +T660FAETable0: + dw 0 + dw 0 + dw 0 + dw 0 + dw 0 + dw 0 + dw TCLWB + dw TCLFLUSHOPT +;----------------------------------------------------------------------------- +T660FAETable3: + dw 0 + dw 0 + dw 0 + dw 0 + dw 0 + dw 0 + dw TTPAUSE + dw TPCOMMIT +;----------------------------------------------------------------------------- +T0FC7Table: + dw 0 + dw 0 + dw 0 + dw TXRSTORS + dw TXSAVEC + dw TXSAVES + dw 0 + dw 0 +;----------------------------------------------------------------------------- +T0FC7Tab64: + dw 0 + dw 0 + dw 0 + dw TXRSTORS64 + dw TXSAVEC64 + dw TXSAVES64 + dw 0 + dw 0 +;----------------------------------------------------------------------------- +TablePCOM: + dw TPCOMLT ;0 + dw TPCOMLE ;1 + dw TPCOMGT ;2 + dw TPCOMGE ;3 + dw TPCOMEQ ;4 + dw TPCOMNEQ ;5 + dw TPCOMFALSE ;6 + dw TPCOMTRUE ;7 +;----------------------------------------------------------------------------- +CMPSuffixesY: + db 'ps',VXWORD+80h;00 + db 'pd',VXWORD+80h;66 + db 'sd',VQWORD+80h;F2 + db 'ss',VDWORD+80h;F3 +;----------------------------------------------------------------------------- +CMPSuffixesX: + db 'ps',VXWORD+80h;00 + db 'pd',VXWORD+80h;66 + db 'ss',VDWORD+80h;F3 + db 'sd',VQWORD+80h;F2 +;----------------------------------------------------------------------------- +CMPxxNames: + dw TCMPEQ ;0 + dw TCMPLT ;1 + dw TCMPLE ;2 + dw TCMPUNORD ;3 + dw TCMPNEQ ;4 + dw TCMPNLT ;5 + dw TCMPNLE ;6 + dw TCMPORD ;7 + dw TCMPEQ?UQ ;8 + dw TCMPNGE ;9 + dw TCMPNGT ;A + dw TCMPFALSE ;B + dw TCMPNEQ?OQ ;C + dw TCMPGE ;D + dw TCMPGT ;E + dw TCMPTRUE ;F + dw TCMPEQ?OS ;10 + dw TCMPLT?OQ ;11 + dw TCMPLE?OQ ;12 + dw TCMPUNORD?S ;13 + dw TCMPNEQ?US ;14 + dw TCMPNLT?UQ ;15 + dw TCMPNLE?UQ ;16 + dw TCMPORD?S ;17 + dw TCMPEQ?US ;18 + dw TCMPNGE?UQ ;19 + dw TCMPNGT?UQ ;1A + dw TCMPFALSE?OS ;1B + dw TCMPNEQ?OS ;1C + dw TCMPGE?OQ ;1D + dw TCMPGT?OQ ;1E + dw TCMPTRUE?US ;1F +;----------------------------------------------------------------------------- +TBM1Table: + dw 0 ;/0 + dw 0 ;/1 + dw TBLSFILL ;/2 + dw TBLCS ;/3 + dw TTZMSK ;/4 + dw TBLCIC ;/5 + dw TBLSIC ;/6 + dw TT1MSKC ;/7 +;----------------------------------------------------------------------------- +TBM2Table: + dw 0 ;/0 + dw TBLCMSK ;/1 + dw 0 ;/2 + dw 0 ;/3 + dw 0 ;/4 + dw 0 ;/5 + dw TBLCI ;/6 + dw 0 ;/7 +;----------------------------------------------------------------------------- +TPERMIL2PDX: + dw TPERMILTD2PD + dw TPERMILTD2PD + dw TPERMILMO2PD + dw TPERMILMZ2PD +;----------------------------------------------------------------------------- +TPERMIL2PSX: + dw TPERMILTD2PS + dw TPERMILTD2PS + dw TPERMILMO2PS + dw TPERMILMZ2PS +;----------------------------------------------------------------------------- +BMI1: dw 0 + dw TBLSR + dw TBLSMSK + dw TBLSI + dw 0 + dw 0 + dw 0 + dw 0 +;----------------------------------------------------------------------------- +T0F71N: dw 0 ;/0 + dw 0 ;/1 + dw TPSRLW ;/2 + dw 0 ;/3 + dw TPSRAW ;/4 + dw 0 ;/5 + dw TPSLLW ;/6 + dw 0 ;/7 +;----------------------------------------------------------------------------- +T0F72N: dw TPRORD ;/0 + dw TPROLD ;/1 + dw TPSRLD ;/2 + dw 0 ;/3 + dw TPSRAD ;/4 + dw 0 ;/5 + dw TPSLLD ;/6 + dw 0 ;/7 +;W1 + dw TPRORQ ;/0 + dw TPROLQ ;/1 + dw 0 ;/2 + dw 0 ;/3 + dw TPSRAQ ;/4 + dw 0 ;/5 + dw 0 ;/6 + dw 0 ;/7 +;----------------------------------------------------------------------------- +T0F73N: dw 0 ;/0 + dw 0 ;/1 + dw 0 ;/2 + dw TPSRLDQ ;/3 + dw 0 ;/4 + dw 0 ;/5 + dw 0 ;/6 + dw TPSLLDQ ;/7 +;W1 + dw 0 ;/0 + dw 0 ;/1 + dw TPSRLQ ;/2 + dw TPSRLDQ ;/3 + dw 0 ;/4 + dw 0 ;/5 + dw TPSLLQ ;/6 + dw TPSLLDQ ;/7 +;----------------------------------------------------------------------------- +T??C6N: dw 0 ;/0 + dw TGATHERPF0DPS ;/1 + dw TGATHERPF1DPS ;/2 + dw 0 ;/3 + dw 0 ;/4 + dw TSCATTERPF0DPS ;/5 + dw TSCATTERPF1DPS ;/6 + dw 0 ;/7 +;W1 + dw 0 ;/0 + dw TGATHERPF0DPD ;/1 + dw TGATHERPF1DPD ;/2 + dw 0 ;/3 + dw 0 ;/4 + dw TSCATTERPF0DPD ;/5 + dw TSCATTERPF1DPD ;/6 + dw 0 ;/7 +;----------------------------------------------------------------------------- +T??C7N: dw 0 ;/0 + dw TGATHERPF0QPS ;/1 + dw TGATHERPF1QPS ;/2 + dw 0 ;/3 + dw 0 ;/4 + dw TSCATTERPF0QPS ;/5 + dw TSCATTERPF1QPS ;/6 + dw 0 ;/7 +;W1 + dw 0 ;/0 + dw TGATHERPF0QPD ;/1 + dw TGATHERPF1QPD ;/2 + dw 0 ;/3 + dw 0 ;/4 + dw TSCATTERPF0QPD ;/5 + dw TSCATTERPF1QPD ;/6 + dw 0 ;/7 +;----------------------------------------------------------------------------- +C4C5Tab dd C4C500,C4C566,C4C5F3,C4C5F2 +C438Tab dd C43800,C43866,C438F3,C438F2 +C43ATab dd C43A00,C43A66,C43AF3,C43AF2 +;----------------------------------------------------------------------------- +T6200Tab dd T620000,T620066,T6200F3,T6200F2 +T6238Tab dd T623800,T623866,T6238F3,T6238F2 +T623ATab dd T623A00,T623A66,T623AF3,T623AF2 +;----------------------------------------------------------------------------- +if used StrLen +StrLen: + push rbx + mov edx,7 + add rdx,rax + mov ebx,[rax] + add rax,4 +.1: lea ecx,[rbx-01010101h] + xor ebx,-1 + and ecx,ebx + mov ebx,[rax] + add rax,4 + and ecx,80808080h + jz .1 + test ecx,00008080h + jnz .2 + shr ecx,16 + add rax,2 +.2: shl cl,1 + sbb rax,rdx + pop rbx + ret +end if + +DisAsm: + mov [I.SaveRSP],rsp + + mov rsi,[I.Addr] + mov rdx,[I.Size] + mov eax,MaxInstructionLength + cmp rdx,rax + cmova rdx,rax + add rdx,rsi + mov r9,rdx + + movzx edx,[I.Arch] + + mov al,[rdx+DefCPU2AD] + mov [I.Address],al + mov al,[rdx+DefCPU2OS] + mov [I.Operand],al + + mov [I.Table],InstTab + + call ClrMagicBytes + +.NextByte: + + FetchB + cmp rsi,r9 + ja ErrorDec + mov [LastByte],al + +.NewTable: + + mov ebx,[I.Table] + + movzx eax,al +if bsf yyh.Size = bsr yyh.Size + shl eax,bsf yyh.Size +else + imul eax,yyh.Size +end if + xor ecx,ecx + + cmp [I.Only],0 ;only one table? + jnz .SkipAdd + cmp [I.Operand],0 + jz .SkipBBBB + mov ecx,1*yyh.Size +.SkipBBBB: + lea eax,[rax*3] + cmp [I.Arch],CPUX64 + jnz .SkipX64 + mov ecx,2*yyh.Size + test [I.PreREX],8 ;REX.W + jnz .SkipX64 + xor ecx,ecx + cmp [I.Operand],0 + jz .SkipAAA + mov ecx,1*yyh.Size +.SkipAAA: + lea edx,[rcx+rax] + movzx edx,word [rbx+rdx+yyh.Addr] + add edx,NextTab + test [rdx+xxh.Flags],_A + jz .SkipX64 + mov ecx,2*yyh.Size +.SkipX64: + add eax,ecx +.SkipAdd: + add ebx,eax + + movzx edx,word [rbx+yyh.Addr] + add edx,NextTab + xchg edx,ebx + + mov [I.Item],ebx + + test [rbx+xxh.Flags],_E+_T + jnz .SkipValue + mov al,[rbx+xxh.DefReg] + mov ah,al + and al,0xF + mov [I.Arg1.Reg],al + shr ah,4 + mov [I.RandSize],ah +.SkipValue: +if 0 + test [rbx+xxh.Flags+1],_D shr 8 + jz .SkipDetect + movzx eax,[I.Operand] + add al,[I.W] + mov ax,word [rax*2+DefArgSize] + mov [I.Arg1.Type],al + mov [I.RandSize],ah +.SkipDetect: +end if + mov [I.SaveRSI],rsi + + or eax,0xFFFFFFFF + mov ax,[rdx+yyh.Name] + mov dword [I.Name],eax + + movzx eax,[rbx+xxh.Flags] + mov [I.Flags],ax + + test al,_T + jz .SkipTableAddress + mov edx,[I.Item] + movzx edx,[rdx+xxh.NxtTab] + add edx,TTXXXX +.SkipTableAddress: + + movzx eax,[rbx+xxh.Rtn] + add eax,RtnXX + call rax + + xor cl,cl + xchg [I.NextByte],cl + or cl,cl + jnz .NextByte + + xor cl,cl + xchg [I.NewTable],cl + or cl,cl + jnz .NewTable + + cmp rsi,r9 + ja ErrorDec + + cmp [I.Mandatory66],0 + jnz .IsMandatory66 + test [I.PreREX],8 ;REX.W + jz .NoRXW + BitT I.Prefixes,P66 + jc ErrorDec +.NoRXW: +.IsMandatory66: +if 1 + mov al,[I.CurSeg] + or al,al + jz .SkipSegm + cmp al,[I.DefSeg] + jnz .SkipSegm + BitTS I.Prefixes,PSEG + cmp [I.PosSEG],0 + jz ErrorDec +.SkipSegm: +end if + call SetArguments + + mov al,[I.Arch] + cmp al,CPUX64 + jz .SkipRand + test [I.Flags],_R + jz .SkipRand + BitTR I.Prefixes,P66 +.SkipRand: + cmp al,CPUX64 + jnz .SkipRand64 + test [I.Flags],_R48 + jz .SkipREX48 + mov al,[I.NotW] + and byte [I.Prefixes],al + .SkipREX48: + test [I.Flags],_R64 + jz .SkipRand64 + BitTR I.Prefixes,P66 +.SkipRand64: + + BitT I.Prefixes,PF0 + jnc .SkipLOCK + cmp [I.PossibleLOCK],0 + jnz .SkipLOCK + cmp [I.PrefixNames],TLOCK + jz ErrorDec +.SkipLOCK: + + BitT I.Prefixes,P4X + jnc .Skip4X + cmp [I.PrefixNames],TREX?? + jz ErrorDec +.Skip4X: + + BitT I.Prefixes,P66 + jnc .Skip66 + cmp [I.PrefixNames],TRAND + jz ErrorDec +.Skip66: + + BitT I.Prefixes,P67 + jnc .Skip67 + cmp [I.PrefixNames],TADDR + jz ErrorDec +.Skip67: + + BitT I.Prefixes,P9B + jnc .SkipWAIT + cmp [I.PrefixNames],TWAIT + jz ErrorDec +.SkipWAIT: + + test [I.Flags],_B + jz .SkipBND + BitT I.Prefixes,PF2 + jnc .SkipBND + movzx eax,[I.PosF2] + mov [rax*2+I.PrefixNames],TBND + mov [I.PossibleF2F3],True +.SkipBND: + + test [I.Flags],_XA+_XR + jz .SkipXAXR + + mov al,00h + test [I.Flags],_XA + jz .SkipXA + BitT I.Prefixes,PF2 + setc al +.SkipXA: + mov ah,00h + test [I.Flags],_XR + jz .SkipXR + BitT I.Prefixes,PF3 + setc ah +.SkipXR: + mov cl,[I.PosF2] + mov dx,TXACQUIRE + cmp ax,0001h + jz .IsF2 + mov cl,[I.PosF3] + mov dx,TXRELEASE + cmp ax,0100h + jz .IsF3 + cmp ax,0101h + jnz .SkipXAXR + mov cl,[I.PosF2] + mov ch,[I.PosF3] + mov dx,TXACQUIRE + cmp cl,ch + ja .IsF2F3 + mov cl,ch + mov dx,TXRELEASE + jmp .IsF2F3 +.IsF2: .IsF3: + mov eax,[I.Prefixes] + and al,11b + cmp al,11b + jnz .IsF2F3 + mov [I.PossibleF2F3],True +.IsF2F3: + test [I.Flags],_L + jnz .SkipTestF0 + BitT I.Prefixes,PF0 + jnc .SkipXAXR +.SkipTestF0: + movzx eax,cl + mov [rax*2+I.PrefixNames],dx +.SkipXAXR: + + BitT I.Prefixes,PF2 + jnc .SkipF2 + cmp [I.PossibleF2F3],0 + jnz .SkipF2 + cmp [I.PrefixNames],TREPNE + jz ErrorDec +.SkipF2: + + BitT I.Prefixes,PF3 + jnc .SkipF3 + cmp [I.PossibleF2F3],0 + jnz .SkipF3 + cmp [I.PrefixNames],TREP + jz ErrorDec +.SkipF3: + + cmp [I.DisplayHint],0 + jz .SkipHint + test [I.Flags],_J + jz .SkipHint + cmp [I.Arch],CPUX64 + jz .SkipHint + mov al,[I.CurSeg] + cmp al,3Eh + jz .IsHint + cmp al,2Eh + jz .IsHint + cmp al,64h + jnz .SkipHint + .IsHint: + BitTR I.Prefixes,PSEG + .SkipHint: + + BitT I.Prefixes,PSEG + jnc .SkipPSEG + cmp [I.PosSEG],0 + jz ErrorDec +.SkipPSEG: + + mov rax,rsi + sub rax,[I.Addr] +RtnXX: ret + +ErrorDec: + mov rsp,[I.SaveRSP] + + mov eax,[I.PrefixesCpy] + mov [I.Prefixes],eax + + mov [I.PrefixCount],1 + + cmp [I.Syntax],0 + jnz .ForceDB + cmp [I.UseDB],0 + jnz .ForceDB + movzx eax,[I.PrefixNames+0*2] + or eax,eax + jnz .Prefix +.ForceDB: + + mov dword [I.Name],T?BYTE shl 16+TDB + + mov [I.RandSize],0 + mov [I.PrefixCount],0 + + mov rax,[I.Addr] + mov al,[rax] + mov [I.Arg1.ImmB],al + mov [I.Arg1.Type],80h+1 + jmp .Continue + +.Prefix:mov [I.Name],TNULL + mov [I.Arg1.Type],0 +.Continue: + xor eax,eax + + mov [I.Arg2.Type],al + mov [I.Arg3.Type],al + mov [I.Arg4.Type],al + mov [I.Arg5.Type],al + + mov [I.Arg1.Mem],al + mov [I.Arg2.Mem],al + mov [I.Arg3.Mem],al + mov [I.Arg4.Mem],al + mov [I.Arg5.Mem],al + + mov [I.Prefix],al + mov [I.LastByte],al + and dword [I.Suffix],eax + and dword [I.Suffix2nd],eax + + mov [I.AAAA],al + mov [I.Z],al + + mov [I.Relative],al ;* 23-06-2017 + mov [I.IsAddress],al ;* 23-06-2017 + + mov [I.RandSize],al + mov [I.Point],ax + + mov eax,1 + ret + +SetArguments: + + call DetectMULT + + cmp [I.VT],0 + jz .L1 + cmp [I.Indx],-1 + jnz .L1 + mov [I.Indx],4 ;fix for EVEX +.L1: + lea rdi,[I.Arg1] + call SetArgument + lea rdi,[I.Arg2] + call SetArgument + lea rdi,[I.Arg3] + call SetArgument + lea rdi,[I.Arg4] + call SetArgument + lea rdi,[I.Arg5] +SetArgument: + movzx eax,[rdi+TArg.Type2nd] + and al,7Fh + mov eax,[rax*4+SetArg] + jmp rax + +SetArg dd .Exit,.RM,.Reg,.VVVV,.Exit + +.RM: + cmp [I.Mod],3 + setnz [rdi+TArg.Mem] + + mov dl,[I.RM] + + mov al,[rdi+TArg.Type] + and eax,0Fh + bt [TBIT],eax + jnc .XXXX + + add dl,[I.B] + add dl,[I.XX] + + cmp al,GPR08 + jnz .NoB8 + call ClearPRM + jmp .XXXX +.NoB8: call ClearBRM + jmp .XXXX + +.Reg: mov dl,[I.Reg] + + mov al,[rdi+TArg.Type] + and eax,0Fh + bt [TBIT],eax + jnc .XXXX + + add dl,[I.R] + + cmp al,GPR08 + jnz .NoR8 + call ClearP + jmp .XXXX +.NoR8: call ClearR + jmp .XXXX + +.VVVV: mov dl,[I.VVVV] +.XXXX: add [rdi+TArg.Reg],dl + +.Exit: ret + +ClearR: mov al,[I.NotR] + and byte [I.Prefixes],al + ret + +ClearPRM: + cmp [I.Mod],3 + jnz ClearP.NoClear +ClearP: cmp dl,4 + jb .NoClear + mov al,[I.NotP] + and byte [I.Prefixes],al +.NoClear: + ret + +ClearBRM: + cmp [I.Mod],3 + jnz ClearB.NoClear +ClearB: mov al,[I.NotB] + and byte [I.Prefixes],al +.NoClear: + ret + +ClearW: mov al,[I.NotW] + and byte [I.Prefixes],al + ret + +MakeSpace: + cmp r10,0 + jnz .SkipFill + inc r10 + push rdx + mov rdx,rdi + sub rdx,r9 + mov r9,rcx + mov ecx,[SpaceSize] + sub rcx,rdx + pop rdx + ja .DoFill + mov ecx,1 + cmp byte [rdi-1],32 + jz .ZeroFill +.DoFill: + mov al,32 + rep stosb +.ZeroFill: + mov rcx,r9 +.SkipFill: + ret + +ShowHint: + cmp [I.DisplayHint],0 + jz .SkipHint + test [I.Flags],_J + jz .SkipHint + cmp [I.Arch],CPUX64 + jz .SkipHint + mov si,TJ? + cmp [I.CurSeg],3Eh + jz .IsHint + mov si,TN? + cmp [I.CurSeg],2Eh + jz .IsHint + mov si,TA? + cmp [I.CurSeg],64h + jnz .SkipHint + .IsHint: + call MoveStringData + .SkipHint: + ret + +PrnAsm: + mov rdi,[TheBufferO] + + add [DefInst.Addr],rax + + mov rsi,rax + mov rax,[Origin] + add [Origin],rsi + cmp [I.NoAddress],0 + jnz .SkipAddr + + cmp [TheL],0 + jz .SkipL + mov byte [rdi],'L' + scasb +.SkipL: +if 0 + or ecx,0xFFFFFFFF + cmp rax,rcx + setbe cl + mov ch,16 + shr ch,cl + mov cl,ch +else + if %B=32 + mov cl,8 + else + mov cl,16 + end if +end if +if ~OS + push rdi +end if + call Hex +if ~OS + push [LastNames] +end if + mov word [rdi],': ' + scasw +.SkipAddr: + mov rax,rsi + + cmp [I.ShowSize],0 + jz .NoShowSize + mov byte [rdi],'(' + scasb + mov bl,10 + div bl + add ax,'00' + stosw + mov ax,') ' + stosw + mov rax,rsi + .NoShowSize: + + cmp [I.Medium],0 + jnz .SkipCodeStr + mov edx,MaxInstructionLength+1 + sub edx,eax + jc .SkipCodeStr + mov ecx,eax + or ecx,ecx + jz .Skip + mov r10,rcx + mov rsi,[I.Addr] +.Loop: + lodsb + mov ecx,[rax*2+HexString] + mov [rdi],cx + scasw + + dec r10 + jnz .Loop + + lea ecx,[rdx*2+1] + mov al,32 + rep stosb +.SkipCodeStr: +if ~OS + pop [LastNames] + xchg rdi,[rsp] + mov rsi,[LastNames] + or rsi,rsi + jz .SkipEmptyName +.LoopEmptyName: + mov al,[rsi] + or al,al + jz .LastEmptyName + mov [rdi],al + inc esi + inc edi + jmp .LoopEmptyName +.LastEmptyName: +if 1 + mov [rdi],byte 32 + inc edi +end if +.SkipEmptyName: + pop rdi +end if + xor edx,edx + mov r10,rdx ;no space + movzx ecx,[I.PrefixCount] + jrcxz .ZeroPrefixes +.LoopPrefixes: + movzx eax,[rdx*1+I.PrefixBites] + mov esi,dword [rdx*2+I.PrefixNames] + + cmp [I.Syntax],0 + jz .SkipSyn + mov ebx,dword [I.SegmName] + cmp al,PSEG + jz .MoveToESI + mov bx,TDATA + cmp al,P66 + jz .MoveToESI + mov bx,TADDR + cmp al,P67 + jz .MoveToESI + cmp al,PF0 + jz .SkipSyn + cmp al,PF2 + jz .SkipSyn + cmp al,PF3 + jz .SkipSyn + jmp .SkipThisPrefix + .MoveToESI: + mov esi,ebx + .SkipSyn: + + cmp al,P4X + jnz .SkipCheckREX + cmp [I.NoREX],0 + jnz .SkipThisPrefix + .SkipCheckREX: + + call ShowHint + + bt [I.Prefixes],eax + jnc .SkipThisPrefix + mov r9,rdi + call MoveStringData + call MakeSpace + .SkipThisPrefix: + inc edx + loop .LoopPrefixes +.ZeroPrefixes: + + movzx eax,[I.Syntax] + mov esi,dword [I.Name+rax*2] + cmp si,-1 + cmovz esi,dword [I.Name] + mov r9,rdi + + mov al,[I.Prefix] + or al,al + jz .SkipPrefix + stosb +.SkipPrefix: + call MoveStringData + + mov eax,dword [I.Suffix2nd] + or eax,eax + jnz .SyntaxSuffix + mov eax,dword [I.Suffix] + cmp [I.Syntax],0 + jz .SyntaxSuffix + test [I.Flags],_S + jz .SyntaxSuffix + movzx eax,[I.RandSize] + + cmp [I.IsFloat],0 + jz .NoFloat + and al,7Fh + mov ah,al + mov al,'s' + cmp ah,VDWORD + jz .SyntaxSuffix + mov al,'l' + cmp ah,VQWORD + jz .SyntaxSuffix + mov al,'t' + cmp ah,VTWORD + jz .SyntaxSuffix + xor ah,ah + .NoFloat: + + or al,al + jz .SyntaxIntel + .SelectPoint: + cmp al,VQWORD + ja .SyntaxIntel + mov al,[rax+Suffixes] + .SyntaxSuffix: + or al,al + jz .SyntaxIntel + .StoreChar: + stosb + shr eax,8 + cmp al,32 + jae .StoreChar +.SyntaxIntel: + + mov al,[I.LastByte] + or al,al + jz .NoModify + mov [rdi-1],al +.NoModify: + + push r10 + call MakeSpace + pop r10 + cmp r10,0 + jz .SkipSpace + mov al,32 + stosb +.SkipSpace: + + cmp [I.Syntax],0 + jnz .SkipPoint + movzx esi,[I.Point] + or esi,esi + jz .SkipPoint + call MoveStringData +.SkipPoint: + +r8 equ rbx + + cmp [I.Syntax],0 + jnz .SyntaxATT + lea r8,[I.Arg1] + call ParseArg + call MoveKandZ + lea r8,[I.Arg2] + call ParseArg + lea r8,[I.Arg3] + call ParseArg + lea r8,[I.Arg4] + call ParseArg + lea r8,[I.Arg5] + call ParseArg + test [I.MainFlags],00000001b + jnz .SkipSAE + call MoveSAE1 +.SkipSAE: + jmp .Print + +.SyntaxATT: + call MoveSAE2 + lea r8,[I.Arg5] + call ParseArgATT + lea r8,[I.Arg4] + call ParseArgATT + lea r8,[I.Arg3] + call ParseArgATT + lea r8,[I.Arg2] + call ParseArgATT + lea r8,[I.Arg1] + call ParseArgATT + call MoveKandZ +.Print: + +.ScanBack: + dec rdi + cmp byte [rdi],32 + jz .ScanBack + scasb + + lea rsi,[CrLf] + call MoveStringDataRSI + + mov byte [rdi],0 +if 1 + mov rax,rdi + sub rax,[TheBufferO] +else + mov rax,[TheBufferO] + call StrLen +end if +if 0 + cmp [I.Compression],0 + jz .NoComp + Compress + .NoComp: + add [TheBufferO],rax + + mov rdi,[TheBufferO] + cmp rdi,Buffer+BufferSizeO-255 + jb .Skip + call PrintBuffer + mov [TheBufferO],Buffer +end if +.Skip: + ret +if 0 +PrintBuffer: + mov edi,Buffer + mov rcx,[TheBufferO] + sub rcx,rdi + jbe .DoNotWrite + mov rdx,rdi + call WriteBlock + jc WriteErr +.DoNotWrite: + ret +end if +MoveStringData: + movzx esi,si + add esi,Names +MoveStringDataRSI: + @@: + movsb + cmp byte [rdi-1],0 + jnz @B + dec rdi + ret + +AddVT: + cmp [I.VT],0 + jz .Old + + movzx edx,[I.VT] + mov edx,[rdx*4+AD2Regs] +.Old: + cmp [I.VT],0 + jz .TTTT + add al,[I.V] +.TTTT: + cmp [I.Arch],CPUX64 + jz .VVVV + and al,00111b +.VVVV: + ret + +StoreSegment: + cmp [I.IsLEA],0 + jnz .SkipSegm + mov al,[I.CurSeg] + or al,al + jz .SkipSegm + cmp al,[I.DefSeg] + jz .SkipSegm + mov si,[I.SegmName] + cmp si,TNULL + jz .SkipSegm + + cmp [I.Syntax],0 + jz .SkipPercent + mov al,'%' + stosb +.SkipPercent: + + call MoveStringData + mov al,':' + stosb +.SkipSegm: + ret + +ParseArgATT: + mov [I.HexPrefix],True + + cmp [r8+TArg.Mem],0 + jnz .SkipType + cmp [r8+TArg.Type],0 + jz ParseArg.SkipArg +.SkipType: + + cmp [I.IsCALLJMP],0 + jz .No + mov al,'*' + stosb +.No: + mov rax,r8 + xchg [I.LastArg],rax + or rax,rax + jz .Arg1st + mov al,',' + stosb +.Arg1st: + + cmp [r8+TArg.Type2nd],Is1 + jz .Put1 + test [r8+TArg.Type],10h + jnz .PtrATT + test [r8+TArg.Type],80h + jnz ParseArg.ImmATT + cmp [r8+TArg.Mem],0 + jz .Reg +.Mem: + call StoreSegment + + mov cl,[I.MULT] + cmp [I.DispSize],1 + jnz .NoMULT + mov ch,byte [I.Disp+1] + sal [I.Disp],cl + cmp ch,byte [I.Disp+1] + jz .NoMULT + inc [I.DispSize] +.NoMULT: + + mov al,[I.DispSize] + or al,al + jz .SkipDisp + + mov rax,[I.Disp] +if %B=32 + mov edx,[I.Disp+4] + test [I.MainFlags],80h + jnz .SkipCDQ + cmp [I.DispSize],4 + ja .SkipCDQ + cdq +.SkipCDQ: +end if + cmp byte [rdi-1],'[' + jz .SkipNegate + cmp [I.Negate],0 + jz .SkipNegate +if %B=64 + or rax,rax +else + cmp [I.Arch],CPUX64 + jz .Arch64 +.Arch64:or eax,eax + jmp .ArchXX + or edx,edx +.ArchXX: +end if + jns .SkipNegate + mov byte [rdi],'-' + scasb +.NoPlus: + neg rax +if %B=32 + adc edx,0 + neg edx +end if +.SkipNegate: + + mov cl,[I.DispSize] + add cl,cl +if %B=32 + cmp cl,8 + jbe .SkipHigh + push eax + mov eax,edx + mov cl,8 + call Bin2Hex32 + pop eax + mov cl,8 + call Hex + jmp .SkipDisp +.SkipHigh: +end if + call Bin2Hex +.SkipDisp: + + cmp [I.Relative],0 + jnz .SkipCheck + mov al,[I.Base] + and al,[I.Indx] + cmp al,-1 + jz .SkipBaseIndx +.SkipCheck: + + mov al,'(' + stosb + + movzx eax,[I.Address] + mov edx,[rax*4+AD2Regs] + + cmp [I.Relative],0 + jz .SkipRels + mov byte [rdi],'%' + scasb + mov esi,[16*2+rdx] + call MoveStringData + dec rdi +.SkipRels: + + mov al,[I.Base] + cmp al,-1 + jz .SkipBase + + call AddVT.TTTT + + mov byte [rdi],'%' + scasb + mov esi,[rax*2+rdx] + call MoveStringData +.SkipBase: + + mov al,[I.Indx] + cmp al,-1 + jz .SkipIndx + + call AddVT + + mov word [rdi],',%' + scasw + mov esi,[rax*2+rdx] + call MoveStringData + mov al,',' + stosb + mov al,[I.Scale] + cmp al,-1 + jz .SkipScale + mov al,[rax+Scales] + stosb +.SkipScale: + +.SkipIndx: + mov al,')' + stosb + +.SkipBaseIndx: + + call MoveXtoX + + ret +.Reg: + mov al,'%' + stosb + jmp ParseArg.Reg + +.PtrATT: + mov ax,'(%' + stosw + + movzx eax,[I.Address] + mov edx,[rax*4+AD2Regs] + + mov al,[r8+TArg.Reg] + mov esi,dword [rax*2+rdx] + call MoveStringData + + jmp .SkipIndx + +ParseArg.SkipArg: + ret + +ParseArgATT.Put1: + mov al,'$' + stosb +ParseArg.Put1: + mov al,'1' + stosb + ret + +ParseArg: + test [r8+TArg.Type],80h + jz .NoIMM + or [I.MainFlags],00000001b + call MoveSAE1 +.NoIMM: + cmp [r8+TArg.Mem],0 + jnz .SkipType + cmp [r8+TArg.Type],0 + jz .SkipArg +.SkipType: + lea rax,[I.Arg1] + cmp r8,rax + jz .Arg1st + test [r8+TArg.Type2nd],80h + jz .NoPlusReg + mov ax,'+3' + stosw +.NoPlusReg: + mov al,',' + cmp [I.MemSeparator],0 + jz .NoSeparate + mov al,':' + .NoSeparate: + stosb +.Arg1st: + + cmp [r8+TArg.Type2nd],Is1 + jz .Put1 + test [r8+TArg.Type],10h + jnz .Ptr + test [r8+TArg.Type],80h + jnz .Imm + + cmp [r8+TArg.Mem],0 + jz .Reg +.Mem: + movzx eax,[I.Address] + mov edx,[rax*4+AD2Regs] + + movzx eax,[I.RandSize] + + cmp [I.NoShowRand],0 + jnz .SkipRand + cmp [I.ShowRand],0 + jnz .DoShowIt + test [I.Flags],_O + jnz .SkipRand + bt eax,7 + jc .SkipRand +.DoShowIt: + and al,7Fh + mov esi,dword [rax*2+SZ2Name] + call MoveStringData +.SkipRand: + + cmp [I.Fasm],0 + jnz .SkipSegm + call StoreSegment +.SkipSegm: + + mov al,'[' + stosb + + cmp [I.Fasm],0 + jz .SegmSkip + call StoreSegment +.SegmSkip: + + cmp [I.Fasm],0 + jz .SkipSizeOvr + BitT I.PrefixesCpy,P67 + jnc .NoAddress + cmp [I.Relative],0 + jnz .NoAddress + mov al,[I.Base] + and al,[I.Indx] + cmp al,-1 + jnz .NoAddress + movzx eax,[I.DispSize] + bsf eax,eax + mov esi,dword [rax*2+SZ2Mems] + call MoveStringData + jmp .SkipSizeOvr +.NoAddress: + movzx eax,[I.DispSize] + or al,al + jz .SkipSizeOvr + mov rcx,[I.Disp] + bsf eax,eax + cmp rcx,[rax*_8_+SZ2Mask] + ja .SkipSizeOvr +if %B=32 + cmp eax,3 + jnz .SkipSizeQWs + cmp [I.Disp+4],0 + ja .SkipSizeOvr +.SkipSizeQWs: +end if + mov esi,dword [rax*2+SZ2Mems] + call MoveStringData +.SkipSizeOvr: + + mov al,[I.Base] + cmp al,-1 + jz .SkipBase + call AddVT.TTTT + mov esi,[rax*2+rdx] + call MoveStringData +.SkipBase: + mov al,[I.Indx] + cmp al,-1 + jz .SkipIndx + + cmp [I.Base],-1 + jz .Skip1 + mov byte [rdi],'+' + scasb + .Skip1: + + call AddVT + + mov esi,[rax*2+rdx] + call MoveStringData +.SkipIndx: + mov al,[I.Indx] + cmp al,-1 + jz .SkipScale + mov al,[I.Scale] + cmp al,-1 + jz .SkipScale + cmp [I.ShowScale],0 + jnz .DoShowScale + or al,al + jz .SkipScale +.DoShowScale: + mov ah,[rax+Scales] + mov al,'*' + stosw +.SkipScale: + + mov cl,[I.MULT] + cmp [I.DispSize],1 + jnz .NoMULT + mov ch,byte [I.Disp+1] + sal [I.Disp],cl + cmp ch,byte [I.Disp+1] + jz .NoMULT + inc [I.DispSize] +.NoMULT: + + mov al,[I.DispSize] + or al,al + jz .SkipDisp + + mov al,[I.Base] + and al,[I.Indx] + cmp al,-1 + jz .Skip2 + mov byte [rdi],'+' + scasb + .Skip2: + + cmp [I.Relative],0 + jz .SkipRels + cmp [I.HideRIP],0 + jnz .HideRels + mov esi,[16*2+rdx] + call MoveStringData + jmp .SkipRels +.HideRels: + mov [I.DispSize],8 + mov rax,[I.Disp] + add rax,[Origin] +if %B=32 + mov edx,[I.Disp+4] + adc edx,0 +end if + cmp [I.Address],AD64 + jz .SkipCut + mov eax,eax + mov [I.DispSize],4 + .SkipCut: + mov [I.Disp],rax +if %B=32 + mov [I.Disp+4],edx +end if +.SkipRels: + mov rax,[I.Disp] +if %B=32 + mov edx,[I.Disp+4] + test [I.MainFlags],80h + jnz .SkipCDQ + cmp [I.DispSize],4 + ja .SkipCDQ + cdq +.SkipCDQ: +end if + cmp [TheL],0 + jz .SkipL + cmp [I.DispSize],4 + jb .SkipL + cmp byte [rdi-1],'+' + jz .SkipL + mov byte [rdi],'L' + scasb + jmp .SkipNegate +.SkipL: + + cmp byte [rdi-1],'[' + jz .SkipNegate + cmp [I.Negate],0 + jz .SkipNegate + cmp [I.DispSize],8 + jz .SkipNegate +if %B=64 + or rax,rax +else + cmp [I.Arch],CPUX64 + jz .Arch64 +.Arch64:or eax,eax + jmp .ArchXX + or edx,edx +.ArchXX: +end if + jns .SkipNegate + cmp byte [rdi-1],'+' + jnz .NoPlus + mov byte [rdi-1],'-' +.NoPlus: + neg rax +if %B=32 + adc edx,0 + neg edx +end if +.SkipNegate: + + mov cl,[I.DispSize] + add cl,cl +if %B=32 + cmp cl,8 + jbe .SkipHigh + push eax + mov eax,edx + mov cl,8 + call Bin2Hex32 + pop eax + mov cl,8 + call Hex + jmp .SkipDisp +.SkipHigh: +end if + call Bin2Hex +.SkipDisp: + + mov al,']' + stosb + + call MoveXtoX + + ret + +.Ptr: + test [r8+TArg.Type],20h + jz .RandSkip + movzx eax,[I.RandSize] + mov esi,dword [rax*2+SZ2Name] + call MoveStringData + .RandSkip: + + mov al,'[' + stosb + + movzx eax,[I.Address] + mov edx,[rax*4+AD2Regs] + + mov al,[r8+TArg.Reg] + mov esi,dword [rax*2+rdx] + call MoveStringData +.SkipAddr: + + jmp .SkipDisp + +.Reg: + movzx eax,[r8+TArg.Type] + mov edx,[(rax-1)*4+SZ2Regs] + + cmp al,GPR08 + jnz .SkipByte + cmp [I.P],0 + jz .SkipByte + mov edx,[IntelName] +.SkipByte: + + movzx eax,[r8+TArg.Reg] + mov esi,[rax*2+rdx] + call MoveStringData + ret + +.ImmATT: + mov [I.Dollar],0 + cmp [I.IsAddress],0 + jnz .ImmContinue + mov byte [rdi],'$' + scasb + jmp .ImmContinue +.Imm: + cmp [I.IsShort],0 + jz .NoShort + mov si,TSHORT + call MoveStringData + .NoShort: + + mov cl,[r8+TArg.Type] + test cl,20h + jz .ImmContinue + and ecx,0Fh + bsf ecx,ecx + mov esi,dword [(rcx+1)*2+SZ2Name] + call MoveStringData +.ImmContinue: + mov rax,[r8+TArg.Imm] +if %B=32 + mov edx,[r8+TArg.Imm+4] + test [r8+TArg.Type],8 + jnz .SkipImmCDQ + cdq +.SkipImmCDQ: +end if + mov cl,[r8+TArg.Type] + test cl,40h + jz .SkipNeg +if %B=64 + or rax,rax +else + or edx,edx +end if + jns .SkipNeg + mov byte [rdi],'-' + scasb + neg rax +if %B=32 + adc edx,0 + neg edx +end if +.SkipNeg: + cmp [I.IsAddress],0 +if %B=32 + jnz .Hex32 +else + jnz .Hex +end if + and cl,0Fh + add cl,cl +if %B=32 + cmp cl,8 + jbe .SkipHigh32 + push eax + mov eax,edx + mov cl,8 + call Bin2Hex32 + pop eax + mov cl,8 + call Hex + jmp .SkipDisp32 +.SkipHigh32: +end if + call Bin2Hex +.SkipDisp32: + ret +if %B=32 +.Hex32: or edx,edx + jz .Hex + push eax + mov eax,edx + call .Hex + pop eax + mov cl,8 + jmp Hex +end if +.Hex: mov cl,16 + mov edx,-1 + cmp rax,rdx + ja .DoHex + mov cl,8 +.DoHex: + cmp [I.HexPrefix],0 + je .L1 + mov word [rdi],'0x' + scasw +if 1 + cmp [I.IsAddress],0 + jz .L2 + cmp [TheL],0 + jz .L2 + dec rdi + mov byte [rdi-1],'L' +end if + jmp .L2 +.L1: + cmp [I.Dollar],0 + jne .L2 + mov byte [rdi],'$' + scasb +if 1 + cmp [I.IsAddress],0 + jz .L2 + cmp [TheL],0 + jz .L2 + mov byte [rdi-1],'L' +end if +.L2: + call Hex + ret + +PrefixErrorDec: + cmp [I.PosSEG],0 + jz ErrorDec + mov [I.SegmName],TNULL ;ignore this prefix + ret + +Rtn6465: + movzx eax,byte [rsi-1] + mov [I.CurSeg],al + + mov dx,[(rax-60h)*2+NSEGR] + mov [I.SegmName],dx + mov dx,[(rax-60h)*2+NSEGX] + jmp Rtn262E363E.C6464 + +Rtn262E363E64: + push PrefixErrorDec +Rtn262E363E: + movzx eax,byte [rsi-1] + mov [I.CurSeg],al + + shr al,3 + mov dx,[(rax-4)*2+NSEGR] + mov [I.SegmName],dx + mov dx,[(rax-4)*2+NSEGX] +.C6464: + movzx eax,[I.PrefixCount] + mov [rax*2+I.PrefixNames],dx + mov [rax+I.PrefixBites],PSEG + inc [I.PrefixCount] + + BitTS I.PrefixesCpy,PSEG + BitTS I.Prefixes,PSEG + jnc @F + cmp [I.PosSEG],0 + jz ErrorDec + @@: + mov [I.PosSEG],al + + call ClrMagicBytes + + mov [I.NextByte],1 + ret + +Rtn4X: + mov al,[rsi-1] + mov [I.PreREX],al + + call SetMagicBytes + + movzx eax,[I.PrefixCount] + mov [rax*2+I.PrefixNames],TREX?? + mov [rax+I.PrefixBites],P4X + inc [I.PrefixCount] + mov [I.Name],TNULL + + BitTS I.PrefixesCpy,P4X + BitTS I.Prefixes,P4X + jnc @F + cmp [I.Pos4X],0 + jz ErrorDec + @@: + mov [I.Pos4X],al + + mov al,[rsi-1] + mov ax,[rax*2+HexString] + mov word [Names+TREX??+3],ax + + mov [I.NextByte],1 + ret +Rtn66: + movzx eax,[I.Arch] + mov al,[rax+XorCPU2OS] + mov [I.Operand],al + + movzx eax,[I.PrefixCount] + mov [rax*2+I.PrefixNames],TRAND + mov [rax+I.PrefixBites],P66 + inc [I.PrefixCount] + + mov [I.Name],TNULL + + BitTS I.PrefixesCpy,P66 + BitTS I.PrefixByte,P66 + BitTS I.Prefixes,P66 + jnc @F + cmp [I.Pos66],0 + jz ErrorDec + @@: + mov [I.Pos66],al + + call ClrMagicBytes + + mov [I.NextByte],1 + ret +Rtn67: + movzx eax,[I.Arch] + mov al,[rax+XorCPU2AD] + mov [I.Address],al + + movzx eax,[I.PrefixCount] + mov [rax*2+I.PrefixNames],TADDR + mov [rax+I.PrefixBites],P67 + inc [I.PrefixCount] + + mov [I.Name],TNULL + + BitTS I.PrefixesCpy,P67 + BitTS I.Prefixes,P67 + jnc @F + cmp [I.Pos67],0 + jz ErrorDec + @@: + mov [I.Pos67],al + + call ClrMagicBytes + + mov [I.NextByte],1 + ret +Rtn9B: + movzx eax,[I.PrefixCount] + mov [rax*2+I.PrefixNames],TWAIT + mov [rax+I.PrefixBites],P9B + inc [I.PrefixCount] + + mov [I.Name],TNULL + + BitTS I.PrefixesCpy,P9B + BitTS I.Prefixes,P9B + jnc @F + cmp [I.Pos9B],0 + jz ErrorDec + @@: + mov [I.Pos9B],al + + mov [I.NextByte],1 + ret + +RtnF0: + movzx eax,[I.PrefixCount] + mov [rax*2+I.PrefixNames],TLOCK + mov [rax+I.PrefixBites],PF0 + inc [I.PrefixCount] + + mov [I.Name],TNULL + + BitTS I.PrefixesCpy,PF0 + BitTS I.Prefixes,PF0 + jnc @F + cmp [I.PosF0],0 + jz ErrorDec + @@: + mov [I.PosF0],al + + call ClrMagicBytes + + mov [I.NextByte],1 + ret +RtnF2: + movzx eax,[I.PrefixCount] + mov [rax*2+I.PrefixNames],TREPNE + mov [rax+I.PrefixBites],PF2 + inc [I.PrefixCount] + + mov [I.Name],TNULL + + BitTS I.PrefixesCpy,PF2 + BitTS I.PrefixByte,PF2 + BitTS I.Prefixes,PF2 + jnc @F + cmp [I.PosF2],0 + jz ErrorDec + @@: + mov [I.PosF2],al + + call ClrMagicBytes + + mov [I.NextByte],1 + ret +RtnF3: + movzx eax,[I.PrefixCount] + mov [rax*2+I.PrefixNames],TREP + mov [rax+I.PrefixBites],PF3 + inc [I.PrefixCount] + + mov [I.Name],TNULL + + BitTS I.PrefixesCpy,PF3 + BitTS I.PrefixByte,PF3 + BitTS I.Prefixes,PF3 + jnc @F + cmp [I.PosF3],0 + jz ErrorDec + @@: + mov [I.PosF3],al + + call ClrMagicBytes + + mov [I.NextByte],1 + ret + +RtnF1: cmp [I.Syntax],0 + jz .2 + mov [I.Name],TICEBP +.2: + test [I.Sensitive],UND + jz .1 + mov [I.Name],TSMI +.1: ret + +r8b equ cl +r8 equ rcx + +Rtn8F: mov al,[rsi] + and al,38h + shr al,3 + jz EXTINST + + cmp [I.PreREX],0 + jnz ErrorDec + + FetchB + mov ah,al + ;and al,11100000b ;XOP.RXB + xor al,11100000b + shr al,5 + mov [I.PreREX],al + + call SetMagicBytes + + mov [I.P],1 + + mov al,ah + and al,11111b + mov edx,StrTabXOP8 + cmp al,8 + jb ErrorDec + je .Z1 + mov edx,StrTabXOP9 + cmp al,9 + je .Z1 + mov edx,StrTabXOPA + cmp al,0Ah + ja ErrorDec +.Z1: mov [I.MMMMM],al + + FetchB + mov ah,al + and al,01111000b + xor al,01111000b + shr al,3 + mov [I.VVVV],al + + mov al,ah + test al,11b + jnz ErrorDec + + and al,10000100b ;Mask XOP.W & XOP.L + mov [I.XOP],al + + FetchB + mov [I.SaveRSI],rsi + +.Z2: cmp dword [rdx],-1 + je ErrorDec + cmp al,[rdx+XOP.Imm] + jz .Z3 + add edx,XOP.Size + jmp .Z2 +.Z3: + mov [I.Prefix],'v' + + mov al,[rdx+XOP.Flags] + mov [I.FlagsXOP],al + test al,XOPV + jz .Z4 + cmp [I.VVVV],0 + jnz ErrorDec +.Z4: + and al,XOPW+XOPL + test [I.XOP],al + jnz ErrorDec + + mov r8b,XMMRG shl 4+XMMRG + + mov eax,dword [rdx+XOP.MOS] + test [I.XOP],XOPL + jz .Z5 + mov r8b,YMMRG shl 4+YMMRG + shr eax,8 +.Z5: mov [I.RandSize],al + + movzx ebx,[rdx+XOP.Rtn] + add ebx,RtnXX + + mov edx,dword [rdx+XOP.Name] + mov [I.Name],dx + + push r8 + call .Arg + call rbx + pop r8 +.Arg: + test [I.FlagsXOP],XOP2 + jz .Z6 + and r8b,0x0F + or r8b,XMMRG shl 4 +.Z6: + test [I.FlagsXOP],XOP1 + jz .Z7 + and r8b,0xF0 + or r8b,XMMRG +.Z7: + mov al,r8b + and al,0Fh + mov [I.Arg1.Type],al + shr r8b,4 + mov [I.Arg2.Type],r8b + ret +;----------------------------------------------------------------------------- +XOP3Rtn:call FetchModRM + mov [I.Arg1.Type2nd],InReg + mov [I.Arg3.Type],XMMRG + test [I.XOP],XOPW + jz .L1 + ;cmp [I.Mod],3 + ;setnz [I.Arg3.Mem] + mov [I.Arg2.Type2nd],InVVVV + mov [I.Arg3.Type2nd],InRM + ret +.L1: ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg3.Type2nd],InVVVV + mov [I.Arg2.Type2nd],InRM + ret +;----------------------------------------------------------------------------- +;encoded bh,vvvv,bl,imm7:4 / bh,vvvv,bl,imm7:4 - W0 / W1 +;----------------------------------------------------------------------------- +XOP4Rtn: + call FetchModRM + mov [I.Arg1.Type2nd],InReg + mov [I.Arg2.Type2nd],InVVVV + mov al,[I.Arg1.Type] + mov [I.Arg3.Type],al + mov [I.Arg4.Type],al + + test [I.XOP],XOPW + jnz .L1 + + ;cmp [I.Mod],3 + ;setnz [I.Arg3.Mem] + mov [I.Arg3.Type2nd],InRM + test [I.FlagsXOP],XOPI + jnz .I1 + ret +.I1: + FetchB + shr al,4 + mov [I.Arg4.Reg],al + ret +.L1: + ;cmp [I.Mod],3 + ;setnz [I.Arg4.Mem] + mov [I.Arg4.Type2nd],InRM + test [I.FlagsXOP],XOPI + jnz .I2 + ret +.I2: + FetchB + shr al,4 + mov [I.Arg3.Reg],al + ret +;----------------------------------------------------------------------------- +XOPImm8:call RtnXOP + FetchB + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al + ret +;----------------------------------------------------------------------------- +SuffixCOMUQ: + mov bx,'uq' + jmp SuffixCOMB.1 +;----------------------------------------------------------------------------- +SuffixCOMUD: + mov bx,'ud' + jmp SuffixCOMB.1 +;----------------------------------------------------------------------------- +SuffixCOMUW: + mov bx,'uw' + jmp SuffixCOMB.1 +;----------------------------------------------------------------------------- +SuffixCOMUB: + mov bx,'ub' + jmp SuffixCOMB.1 +;----------------------------------------------------------------------------- +SuffixCOMQ: + mov bx,'q' + jmp SuffixCOMB.1 +;----------------------------------------------------------------------------- +SuffixCOMD: + mov bx,'d' + jmp SuffixCOMB.1 +;----------------------------------------------------------------------------- +SuffixCOMW: + mov bx,'w' + jmp SuffixCOMB.1 +;----------------------------------------------------------------------------- +SuffixCOMB: + mov bx,'b' +.1: + mov word [I.Suffix2nd],bx + call XOP4Rtn + xor eax,eax + FetchB + cmp al,7 + jbe .L1 +.L0: mov [I.Arg4.Type],80h+1 + mov [I.Arg4.ImmB],al + ret +.L1: mov eax,[rax*2+TablePCOM] + mov [I.Name],ax + mov [I.Arg4.Type],0 ;delete + ret +;----------------------------------------------------------------------------- +RtnTBM0: + add rsp,2*_8_ ;remove r8 & return + + mov [I.RandSize],VDWORD+80h + mov ebx,R32RM32 + test [I.XOP],XOPW + jz .L1 + cmp [I.Arch],CPUX64 + jne .L1 + mov [I.RandSize],VQWORD+80h + mov ebx,R64RM64 +.L1: + cmp [I.Arch],CPUX64 + je .L2 + mov [I.B],0 + mov [I.R],0 + mov [I.X],0 +.L2: + mov [I.Prefix],0 + mov [I.Name],TBEXTR + call rbx + FetchD + mov [I.Arg3.Type],80h+4 + mov [I.Arg3.Imm],rax + ret +;----------------------------------------------------------------------------- +RtnLWPCB: + add rsp,2*_8_ ;remove r8 & return + + call FetchModRM + cmp [I.Mod],3 + jne ErrorDec + mov [I.Arg1.Type2nd],InRM + mov [I.Arg1.Type],GPR32 + test [I.XOP],XOPW + jz .1 + mov [I.Arg1.Type],GPR64 +.1: + mov dx,TSLWPCB + cmp [I.Reg],1 + je .2 + ja ErrorDec + mov dx,TLLWPCB +.2: mov [I.Name],dx + mov [I.Arg2.Type],0 ;delete + mov [I.Prefix],0 + ret +;----------------------------------------------------------------------------- +RtnLWPxx: + add rsp,2*_8_ ;remove r8 & return + + call FetchModRM + + mov [I.RandSize],VDWORD+80h + + mov dx,TLWPVAL + cmp [I.Reg],1 + je .2 + ja ErrorDec + mov dx,TLWPINS +.2: mov [I.Name],dx + mov [I.Prefix],0 + + mov [I.Arg1.Type],GPR32 + mov [I.Arg2.Type],GPR32 + test [I.XOP],XOPW + jz .1 + mov [I.Arg1.Type],GPR64 +.1: + mov [I.Arg1.Type2nd],InVVVV + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type2nd],InRM + + FetchD + mov [I.Arg3.Type],80h+4 + mov [I.Arg3.Imm],rax + ret +;----------------------------------------------------------------------------- +r8d equ edi +r8 equ rdi +RtnTBM2:mov r15d,TBM2Table + jmp RtnTBM1.L0 +RtnTBM1:mov r15d,TBM1Table +.L0: + add rsp,2*_8_ ;remove r8 & return + + mov [I.RandSize],VDWORD+80h + mov r8d,R32RM32 + test [I.XOP],XOPW + jz .L1 + cmp [I.Arch],CPUX64 + jne .L1 + mov [I.RandSize],VQWORD+80h + mov r8d,R64RM64 +.L1: + cmp [I.Arch],CPUX64 + je .L2 + mov [I.B],0 + mov [I.R],0 + mov [I.X],0 + and [I.VVVV],111b +.L2: + call FetchModRM + mov rsi,[I.SaveRSI] + + movzx eax,[I.Reg] +if %B=32 + mov rdx,r15 + mov edx,[rax*2+rdx] +else + mov edx,[rax*2+r15] +end if + or dx,dx + jz ErrorDec + mov [I.Prefix],0 + mov [I.Name],dx + + call r8 + mov [I.Arg1.Type2nd],InVVVV + ret +;----------------------------------------------------------------------------- +RtnC6: mov al,[rsi] + and al,38h + shr al,3 + jz EXTINSONE + FetchB + cmp al,0xF8 + jnz ErrorDec + mov [I.Name],TXABORT + FetchB + mov [I.Arg1.Type],80h+1 + mov [I.Arg1.Imm],rax + ret + +RtnC7: mov al,[rsi] + and al,38h + shr al,3 + jz EXTINST + FetchB + cmp al,0xF8 + jnz ErrorDec + BitTR I.Prefixes,P66 + mov [I.Name],TXBEGIN +DODISPWD: + cmp [I.Operand],0 + jnz DODISPD + jmp DODISPW + +EXTINSTFF: + mov al,[rsi] + and al,38h + shr al,3 + ; + cmp al,2 + jb EXTINST + cmp al,5 + ja EXTINST + ; + mov [I.IsCALLJMP],True + jmp EXTINST + +EXTINSONEFLT: + mov [I.IsFloat],1 +EXTINSONE: + mov [I.Only],1 +EXTINST: + mov eax,[I.Item] + movzx eax,[rax+xxh.NxtTab] + add eax,EXT80 + mov [I.Table],eax + + mov al,[rsi] + and al,38h + shr al,3 + mov [I.NewTable],1 + ret + +Rtn0F: movzx eax,byte [rsi] + shr al,4 ;Lose low nibble. + + bt [EXTBITS],eax + setc [I.Only] + + mov eax,[rax*4+EXT0F] ;Get new table address. + mov [I.Table],eax + + FetchB + and al,0Fh ;Make sure only lower nibble counts. + mov [I.NewTable],1 + ret + +Rtn9X16: + mov [I.Arg1.Type],GPR16 + mov [I.Arg2.Type],GPR16 + jmp Rtn9XXX +Rtn9X32: + mov [I.Arg1.Type],GPR32 + mov [I.Arg2.Type],GPR32 + jmp Rtn9XXX +Rtn9X64: + mov [I.Arg1.Type],GPR64 + mov [I.Arg2.Type],GPR64 +Rtn9XXX: + mov al,[rsi-1] + and al,0Fh + jnz .No90 + + cmp [I.PrefixByte],bit PF3 + jz .IsPause + + cmp [I.PrefixByte],0 + jnz .No90 + cmp [I.B],0 + jnz .No90 + mov [I.Name],TNOP + jmp .PauseNOP +.IsPause: + BitTR I.Prefixes,PF3 + mov [I.Name],TPAUSE +.PauseNOP: + and [I.Flags],not _S + mov [I.Arg1.Type],0 + mov [I.Arg2.Type],0 + ret + +.No90: + add al,[I.B] + mov [I.Arg1.Reg],al + call ClearB + ret + +Rtn9864:mov [I.AltName],TCLTQ + ret +Rtn9816:mov [I.AltName],TCBTW + ret +Rtn9832:mov [I.AltName],TCWTL + ret + +Rtn9964:mov [I.AltName],TCQTO + ret +Rtn9916:mov [I.AltName],TCWTD + ret +Rtn9932:mov [I.AltName],TCLTD + ret + +RtnEA: mov [I.AltName],TLJMP + jmp RtnXA +Rtn9A: mov [I.AltName],TLCALL +RtnXA: +r10 equ rbx + mov [I.MemSeparator],True + lea r10,[I.Arg1] + lea rax,[I.Arg2] + mov r8,rax + xor r8,r10 + + cmp [I.Syntax],0 + jnz .ATT + xor r10,r8 +.ATT: + mov al,[I.Operand] + or al,al + jz .W + jmp .D +.W: mov [I.RandSize],VWORD + mov [I.Point],TDWORD + FetchW + movzx eax,ax + mov [r10+TArg.Type],80h+2 + jmp .X +.D: mov [I.RandSize],VDWORD + mov [I.Point],TFWORD + FetchD + mov [r10+TArg.Type],80h+4 +.X: mov [r10+TArg.Imm],rax + FetchW + movzx eax,ax + xor r10,r8 + mov [r10+TArg.Type],80h+2 + mov [r10+TArg.Imm],rax + ret + +RtnF16: mov [I.Suffix],'w' + ret + +RtnF32: mov [I.Suffix],'d' + ret + +RtnF64: mov [I.Suffix],'q' + ret + +RtnA0: mov al,[I.Arch] + cmp al,CPUX16 + jz RtnA016 + cmp al,CPUX32 + jz RtnA032 + jmp RtnA064 + +RtnA016: + mov [I.Arg1.Type],GPR08 + + BitTR I.Prefixes,P67 + jc .D + mov [I.DispSize],2 + FetchW + movzx eax,ax + jmp .X +.D: mov [I.DispSize],4 + FetchUD +.X: + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA032: + mov [I.Arg1.Type],GPR08 + + BitTR I.Prefixes,P67 + jc .W + mov [I.DispSize],4 + FetchUD + jmp .X +.W: mov [I.DispSize],2 + FetchW + movzx eax,ax +.X: + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA064: + mov [I.Arg1.Type],GPR08 + + BitTR I.Prefixes,P67 + jc .D + mov [I.DispSize],8 + FetchQ +if %B=32 + mov [I.Disp+4],edx +end if + jmp .X +.D: mov [I.DispSize],4 + FetchUD +.X: + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA1: mov al,[I.Arch] + cmp al,CPUX16 + jz RtnA116 + cmp al,CPUX32 + jz RtnA132 + jmp RtnA164 + +RtnA116: + mov al,GPR16 + mov [I.RandSize],VWORD + BitTR I.Prefixes,P66 + jnc .16 + mov al,GPR32 + mov [I.RandSize],VDWORD +.16: + mov [I.Arg1.Type],al + mov [I.Arg2.Type],al + + BitTR I.Prefixes,P67 + jc .D + mov [I.DispSize],2 + FetchW + movzx eax,ax + jmp .X +.D: mov [I.DispSize],4 + FetchUD +.X: + mov [I.Arg2.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA132: + mov al,GPR16 + mov [I.RandSize],VWORD + BitTR I.Prefixes,P66 + jc .16 + mov al,GPR32 + mov [I.RandSize],VDWORD +.16: + mov [I.Arg1.Type],al + mov [I.Arg2.Type],al + + BitTR I.Prefixes,P67 + jc .W + mov [I.DispSize],4 + FetchUD + jmp .X +.W: mov [I.DispSize],2 + FetchW + movzx eax,ax +.X: + mov [I.Arg2.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA164: + mov al,GPR16 + mov [I.RandSize],VWORD + BitTR I.Prefixes,P66 + jc .16 + mov al,GPR32 + mov [I.RandSize],VDWORD +.16: + cmp [I.W],0 + jz .XX + mov al,GPR64 + mov [I.RandSize],VQWORD +.XX: + mov [I.Arg1.Type],al + mov [I.Arg2.Type],al + + BitTR I.Prefixes,P67 + jc .D + mov [I.DispSize],8 + FetchQ +if %B=32 + mov [I.Disp+4],edx +end if + jmp .X +.D: mov [I.DispSize],4 + FetchUD +.X: + mov [I.Arg2.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA2: mov al,[I.Arch] + cmp al,CPUX16 + jz RtnA216 + cmp al,CPUX32 + jz RtnA232 + jmp RtnA264 + ret + +RtnA216: + mov [I.Arg2.Type],GPR08 + + BitTR I.Prefixes,P67 + jc .D + mov [I.DispSize],2 + FetchW + movzx eax,ax + jmp .X +.D: mov [I.DispSize],4 + FetchUD +.X: + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA232: + mov [I.Arg2.Type],GPR08 + + BitTR I.Prefixes,P67 + jc .W + mov [I.DispSize],4 + FetchUD + jmp .X +.W: mov [I.DispSize],2 + FetchW + movzx eax,ax +.X: + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA264: + mov [I.Arg2.Type],GPR08 + + BitTR I.Prefixes,P67 + jc .D + mov [I.DispSize],8 + FetchQ +if %B=32 + mov [I.Disp+4],edx +end if + jmp .X +.D: mov [I.DispSize],4 + FetchUD +.X: + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA3: mov al,[I.Arch] + cmp al,CPUX16 + jz RtnA316 + cmp al,CPUX32 + jz RtnA332 + jmp RtnA364 + ret + +RtnA316: + mov al,GPR16 + mov [I.RandSize],VWORD + BitTR I.Prefixes,P66 + jnc .16 + mov al,GPR32 + mov [I.RandSize],VDWORD +.16: + mov [I.Arg1.Type],al + mov [I.Arg2.Type],al + + BitTR I.Prefixes,P67 + jc .D + mov [I.DispSize],2 + FetchW + movzx eax,ax + jmp .X +.D: mov [I.DispSize],4 + FetchUD +.X: + mov [I.Arg1.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA332: + mov al,GPR16 + mov [I.RandSize],VWORD + BitTR I.Prefixes,P66 + jc .16 + mov al,GPR32 + mov [I.RandSize],VDWORD +.16: + mov [I.Arg1.Type],al + mov [I.Arg2.Type],al + + BitTR I.Prefixes,P67 + jc .W + mov [I.DispSize],4 + FetchUD + jmp .X +.W: mov [I.DispSize],2 + FetchW + movzx eax,ax +.X: + mov [I.Arg1.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnA364: + mov al,GPR16 + mov [I.RandSize],VWORD + BitTR I.Prefixes,P66 + jc .16 + mov al,GPR32 + mov [I.RandSize],VDWORD +.16: + cmp [I.W],0 + jz .XX + mov al,GPR64 + mov [I.RandSize],VQWORD +.XX: + mov [I.Arg1.Type],al + mov [I.Arg2.Type],al + + BitTR I.Prefixes,P67 + jc .D + mov [I.DispSize],8 + FetchQ +if %B=32 + mov [I.Disp+4],edx +end if + jmp .X +.D: mov [I.DispSize],4 + FetchUD +.X: + mov [I.Arg1.Mem],True + mov [I.Disp],rax + call ClearSeg + mov [I.PossibleLOCK],True + ret + +RtnMOVX: + mov [I.PossibleF2F3],True + + mov [I.AltName],TMOVS + + test byte [I.Prefixes],bit PSEG+bit P67 + jz .SkipATT + + BitTR I.Prefixes,P67 + + mov [I.Name],TMOVS + mov [I.NoShowRand],True + + mov [I.Base],RRSI + + mov [I.Arg1.Type],10h+20h + mov [I.Arg1.Reg],RRDI + + mov [I.Arg2.Type],1 + mov [I.Arg2.Mem],True + + call ClearSeg +.SkipATT: + ret + +RtnCMPX: + mov [I.PossibleF2F3],True + + mov [I.AltName],TCMPS + + test byte [I.Prefixes],bit PSEG+bit P67 + jz .SkipATT + + BitTR I.Prefixes,P67 + + mov [I.Name],TCMPS + + mov [I.Base],RRSI + + mov [I.Arg2.Type],10h + mov [I.Arg2.Reg],RRDI + + mov [I.Arg1.Type],1 + mov [I.Arg1.Mem],True + + call ClearSeg +.SkipATT: + ret + +RtnSTOX: + mov [I.PossibleF2F3],True + + mov [I.AltName],TSTOS + + BitTR I.Prefixes,P67 + jnc .SkipATT + + mov [I.Name],TSTOS + + mov [I.Arg1.Reg],RRDI + mov [I.Arg1.Type],10h+20h +.SkipATT: + ret + +RtnLODX: + mov [I.PossibleF2F3],True + + mov [I.AltName],TLODS + + test byte [I.Prefixes],bit PSEG+bit P67 + jz .SkipATT + + BitTR I.Prefixes,P67 + + mov [I.Name],TLODS + + mov [I.Base],RRSI + + mov [I.Arg1.Type],1 + mov [I.Arg1.Mem],True + + call ClearSeg +.SkipATT: + ret + +RtnSCAX: + mov [I.PossibleF2F3],True + + mov [I.AltName],TSCAS + + BitTR I.Prefixes,P67 + jnc .SkipATT + + mov [I.Name],TSCAS + + mov [I.Arg1.Reg],RRDI + mov [I.Arg1.Type],10h+20h +.SkipATT: + ret + +R8IMM8: + mov al,[rsi-1] + and al,0Fh + add al,[I.B] + mov [I.Arg1.Reg],al + call ClearB + + mov [I.Arg1.Type],GPR08 + + FetchSB + mov [I.Arg2.Type],80h+1 + mov [I.Arg2.Imm],rax + ret + +R16IMM16: + mov al,[rsi-1] + sub al,0xB8 + add al,[I.B] + mov [I.Arg1.Reg],al + call ClearB + + mov [I.Arg1.Type],GPR16 + + FetchSW + mov [I.Arg2.Type],80h+2 + mov [I.Arg2.Imm],rax + ret + +R32IMM32: + mov al,[rsi-1] + sub al,0xB8 + add al,[I.B] + mov [I.Arg1.Reg],al + call ClearB + + mov [I.Arg1.Type],GPR32 + + FetchSD + mov [I.Arg2.Type],80h+4 + mov [I.Arg2.Imm],rax + ret + +R64IMM64: + mov al,[rsi-1] + sub al,0xB8 + add al,[I.B] + mov [I.Arg1.Reg],al + call ClearB + + mov [I.Arg1.Type],GPR64 + + FetchQ +if %B=32 + mov [I.Arg2.Imm+4],edx +end if + mov [I.Arg2.Type],80h+8 + mov [I.Arg2.Imm],rax + ret + +RM8R8: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Type2nd],InReg + ret + +RM8IMM8:call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Type2nd],InRM + + FetchB + mov [I.Arg2.Type],80h+1 + mov [I.Arg2.Imm],rax + ret + +RM16IMM16: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + + FetchSW + mov [I.Arg2.Type],80h+2 + mov [I.Arg2.Imm],rax + ret + +RM32IMM32: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + + FetchSD + mov [I.Arg2.Type],80h+4 + mov [I.Arg2.Imm],rax + ret + +RM64IMM32: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + + FetchSD + mov [I.Arg2.Type],80h+40h+4 + mov [I.Arg2.Imm],rax + ret + +RM16IMMS8: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + + FetchSB + mov [I.Arg2.Type],80h+40h+20h+1 + mov [I.Arg2.Imm],rax + ret + +RM32IMMS8: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + + FetchSB + mov [I.Arg2.Type],80h+40h+20h+1 + mov [I.Arg2.Imm],rax + ret + +RM64IMMS8: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + + FetchSB + mov [I.Arg2.Type],80h+40h+20h+1 + mov [I.Arg2.Imm],rax + ret + +RM16R16CL: + push SetArg3CL + jmp RM16R16 + +RM16R16I8: + push SetArg3Imm +RM16R16: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Type2nd],InReg + ret + +RM32R32CL: + push SetArg3CL + jmp RM32R32 + +RM32R32I8: + push SetArg3Imm + jmp RM32R32 + +RM32R32X: + push SetArg12X +RM32R32: + call FetchModRM +RM32R32M: + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Type2nd],InReg + ret + +RM64R64CL: + push SetArg3CL + jmp RM64R64 +RM64R64I8: + push SetArg3Imm +RM64R64: + call FetchModRM +RM64R64M: + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR64 + mov [I.Arg2.Type2nd],InReg + ret + +R8RM8: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Type2nd],InReg + ret + +RM8: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Type2nd],InRM + ret + +R16RM16LZ: + BitTR I.Prefixes,PF3 + jnc .L1 + mov [I.Name],TLZCNT +.L1: jmp R16RM16 +R16RM16TZ: + BitTR I.Prefixes,PF3 + jnc .L1 + mov [I.Name],TTZCNT +.L1: jmp R16RM16 + +R16RM16W: +R16RM16: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InReg + ret + +R32RM32LZ: + BitTR I.Prefixes,PF3 + jnc .L1 + mov [I.Name],TLZCNT +.L1: jmp R32RM32 +R32RM32TZ: + BitTR I.Prefixes,PF3 + jnc .L1 + mov [I.Name],TTZCNT +.L1: jmp R32RM32 + +R32RM32X: + push SetArg12X + jmp R32RM32 +R32RM32W: + push SetArg2W +R32RM32: + call FetchModRM +R32RM32M: + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InReg + ret + +R64RM64LZ: + BitTR I.Prefixes,PF3 + jnc .L1 + mov [I.Name],TLZCNT +.L1: jmp R64RM64 +R64RM64TZ: + BitTR I.Prefixes,PF3 + jnc .L1 + mov [I.Name],TTZCNT +.L1: jmp R64RM64 + +R64RM64W: + push SetArg2W +R64RM64: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR64 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InReg + ret + +R3264RM3264: + cmp [I.W],0 + jz R32RM32 + mov [I.RandSize],VQWORD + jmp R64RM64 + +R16RM16L: + mov [I.IsLEA],True +R16RM163: + call FetchModRM + + cmp [I.Mod],3 + jz ErrorDec + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InReg + ret + +R32RM32L: + mov [I.IsLEA],True +R32RM323: + call FetchModRM + + cmp [I.Mod],3 + jz ErrorDec + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InReg + ret + +R64RM64L: + mov [I.IsLEA],True +R64RM643: + call FetchModRM + + cmp [I.Mod],3 + jz ErrorDec + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR64 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InReg + ret + +RM16R163: + call FetchModRM + + cmp [I.Mod],3 + jz ErrorDec + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Type2nd],InReg + ret + +RM32R323: + call FetchModRM + + cmp [I.Mod],3 + jz ErrorDec + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Type2nd],InReg + ret + +RM64R643: + call FetchModRM + + cmp [I.Mod],3 + jz ErrorDec + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR64 + mov [I.Arg2.Type2nd],InReg + ret + +RM16SEG: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],SEGRG + mov [I.Arg2.Type2nd],InReg + ret + +RM32SEG: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],SEGRG + mov [I.Arg2.Type2nd],InReg + ret + +RM64SEG: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],SEGRG + mov [I.Arg2.Type2nd],InReg + ret + +SEGRM16: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],SEGRG + mov [I.Arg1.Type2nd],InReg + ret + +SEGRM32: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],SEGRG + mov [I.Arg1.Type2nd],InReg + ret + +SEGRM64: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR64 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],SEGRG + mov [I.Arg1.Type2nd],InReg + ret + +RM16N: mov [I.Point],TNEAR +RM16: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + ret + +RM32N: mov [I.Point],TNEAR +RM32: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + ret + +RM64N: mov [I.Point],TNEAR +RM64: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + ret + +RM163264W: + call FetchModRM + + cmp [I.Mod],3 + jnz .No3 + BitTR I.Prefixes,P66 +.No3: + cmp [I.Syntax],0 + jz .SkipIntel + mov [I.RandSize],0 +.SkipIntel: + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + + mov [I.Arg1.Type],GPR16 + cmp [I.Operand],0 + jz .XX + mov [I.Arg1.Type],GPR32 +.XX: + cmp [I.W],0 + jz .64 + BitTR I.Prefixes,P4X + mov [I.Arg1.Type],GPR64 +.64: + mov [I.Arg1.Type2nd],InRM + ret + +RMDW: call FetchModRM + + cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + jnz .No3 + BitTR I.Prefixes,P66 +.No3: + mov [I.Arg1.Type],GPR16 + cmp [I.Operand],0 + jz .XX + mov [I.RandSize],VDWORD + mov [I.Arg1.Type],GPR32 +.XX: + mov [I.Arg1.Type2nd],InRM + ret + +RMW0100:call FetchModRM + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + jnz .Exit + mov dx,TENCLV + cmp al,$C0 + jz .L1 + mov dx,TVMCALL + cmp al,$C1 + jz .L1 + mov dx,TVMLAUNCH + cmp al,$C2 + jz .L1 + mov dx,TVMRESUME + cmp al,$C3 + jz .L1 + mov dx,TVMXOFF + cmp al,$C4 + jz .L1 + mov dx,TPCONFIG + cmp al,$C5 + jnz ErrorDec +.L1: mov [I.Name],dx +.Exit: ret + +RMW0101:call FetchModRM + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + jnz .Exit + mov dx,TMONITOR + cmp al,$C8 + je .L1 + mov dx,TMWAIT + cmp al,$C9 + je .L1 + mov dx,TCLAC + cmp al,$CA + je .L1 + mov dx,TSTAC + cmp al,$CB + jz .L1 + mov dx,TENCLS + cmp al,$CF + jne ErrorDec +.L1: mov [I.Name],dx + ret +.Exit: call TWorFW + ret + +RMW0102:call FetchModRM + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + jnz .Exit + mov dx,TENCLU + cmp al,$D7 + je .L1 + mov dx,TXTEST + cmp al,$D6 + je .L1 + mov dx,TXEND + cmp al,$D5 + je .L1 + mov dx,TVMFUNC + cmp al,$D4 + je .L1 + mov dx,TXGETBV + cmp al,$D0 + je .L1 + mov dx,TXSETBV + cmp al,$D1 + jne ErrorDec +.L1: mov [I.Name],dx + ret +.Exit: call TWorFW + ret + +RMW0103:call FetchModRM + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + jnz .Quit + movzx eax,byte [rsi-1] + mov edx,[rax*2+TVMXXTable-$D8*2] + mov [I.Name],dx + cmp al,$D9 + je .Exit + cmp al,$DC + je .Exit + cmp al,$DD + je .Exit + ; + cmp [I.Syntax],0 + jz .YY + cmp al,$DF + je .Exit +.YY: ; + mov al,[I.Arch] + cmp al,CPUX16 + jz .16 + cmp al,CPUX32 + jz .32 + +.64: mov [I.Arg1.Type],GPR64 + BitTR I.Prefixes,P67 + jnc @F + mov [I.Arg1.Type],GPR32 + @@: + jmp .XX +.16: mov [I.Arg1.Type],GPR16 + BitTR I.Prefixes,P67 + jnc @F + mov [I.Arg1.Type],GPR32 + @@: + jmp .XX +.32: mov [I.Arg1.Type],GPR32 + BitTR I.Prefixes,P67 + jnc @F + mov [I.Arg1.Type],GPR16 + @@: +.XX: cmp dx,TINVLPGA + jnz @F + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Reg],RRCX + @@: +.Exit: ret + +.Quit: call TWorFW + ret + +RMW0104:call FetchModRM + + cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + jnz .Exit + + mov [I.Arg1.Type],GPR16 + mov al,[I.Operand] + add [I.Arg1.Type],al + + mov [I.Arg1.Type2nd],InRM + + cmp [I.W],0 + jz .W0 + BitTR I.Prefixes,P4X + mov [I.Arg1.Type],GPR64 +.W0: + BitTR I.Prefixes,P66 +.Exit: ret + +RtnPKRU:cmp byte [rsi],0xC0 + jb .IsRSTORSSP + FetchB + mov dx,TSETSSBSY + cmp al,0xE8 + jz .IsEA + mov dx,TSAVEPREVSSP + cmp al,0xEA + jz .IsEA + mov dx,TRDPKRU + cmp al,0xEE + jz .MoveName + mov dx,TWRPKRU + cmp al,0xEF + jnz ErrorDec +.MoveName: + mov [I.Name],dx + ret +.IsEA: BitTR I.Prefixes,PF3 + jc .MoveName + jmp ErrorDec +.IsRSTORSSP: + BitTR I.Prefixes,PF3 + jnc ErrorDec + setc [I.Arg1.Mem] + mov [I.Name],TRSTORSSP + jmp FetchModRM + +RMW0107:call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + jnz .Exit + + mov dx,TRDPRU + cmp al,$FD + je .L1 + mov dx,TCLZERO + cmp al,$FC + je .L1 + mov dx,TMWAITX + cmp al,$FB + je .L1 + mov dx,TMONITORX + cmp al,$FA + je .L1 + mov dx,TRDTSCP + cmp al,$F9 + je .L1 + cmp [I.Arch],CPUX64 + jne ErrorDec + mov dx,TSWAPGS + cmp al,$F8 + jne ErrorDec +.L1: mov [I.Name],dx +.Exit: ret + +LOADALL2: + test [I.Sensitive],UND + jz .L1 + mov [I.Name],TLOADALL286 +.L1: ret + +Rtn0F07: + test [I.Sensitive],UND + jz .L1 + mov [I.Name],TLOADALL +.L1: ret + +PREFETCHRTN: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + jz .Exit + + mov al,[I.Reg] + mov dx,TPREFETCHWT1 + cmp al,2 + jz .L1 + cmp al,1 + jne .Exit + mov dx,TPREFETCHW +.L1: mov [I.Name],dx +.Exit: ret + +RtnMM4MM: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],MMXRG + mov [I.Arg2.Type],MMXRG + + mov [I.Arg1.Type2nd],InRM + mov [I.Arg2.Type2nd],InReg + ret + +RtnMM2MM: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],MMXRG + mov [I.Arg1.Type],MMXRG + + mov [I.Arg2.Type2nd],InRM + mov [I.Arg1.Type2nd],InReg + ret + +Rtn0F0F:call RtnMM2MM + mov ecx,(End3D-Now3D)/3 + mov edx,Now3D + FetchB +.L1: cmp [rdx],al + je .L2 + add edx,3 + loop .L1 + jmp ErrorDec +.L2: mov eax,[rdx+1] + mov [I.Name],ax + ret +;----------------------------------------------------------------------------- +Rtn0F22:push R32RM32C + jmp Rtn0F20.L1 +;----------------------------------------------------------------------------- +Rtn0F20:push RM32R32C +.L1: call FetchModRM + cmp [I.Mod],3 + jne ErrorDec + ret +;----------------------------------------------------------------------------- +Rtn0F23:push R32RM32D + jmp Rtn0F21.L1 +;----------------------------------------------------------------------------- +Rtn0F21:push RM32R32D +.L1: call FetchModRM + cmp [I.Mod],3 + jne ErrorDec + ret +;----------------------------------------------------------------------------- +Rtn0F26:push R32RM32T + jmp Rtn0F24.L1 +;----------------------------------------------------------------------------- +Rtn0F24:push RM32R32T +.L1: call FetchModRM + cmp [I.Mod],3 + jne ErrorDec + ret +;----------------------------------------------------------------------------- +Rtn0F37:test [I.Sensitive],NIA +ifz ret + mov [I.Name],TWRSHR +Rtn0F36:test [I.Sensitive],NIA + jz ErrorDec + cmp [I.Arch],CPUX64 + jz ErrorDec + call FetchModRM + cmp [I.Reg],0 + jnz ErrorDec + BitTR I.Prefixes,P66 + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + ret +;----------------------------------------------------------------------------- +Rtn0F3800: + test [I.Sensitive],NIA + jz .L1 + mov [I.Name],TSMINT + ret +.L1: FetchB + cmp al,0xF0 + jb .L0 + cmp al,0xF1 + jbe RtnMOVBE + cmp al,0xF6 + jz RtnWRSSX +.L0: + mov dx,TSHA1NEXTE + cmp al,0xC8 + jz .0F38XX + mov dx,TSHA1MSG1 + cmp al,0xC9 + jz .0F38XX + mov dx,TSHA1MSG2 + cmp al,0xCA + jz .0F38XX + mov dx,TSHA256RNDS2 + cmp al,0xCB + jz .0F38XX + mov dx,TSHA256MSG1 + cmp al,0xCC + jz .0F38XX + mov dx,TSHA256MSG2 + cmp al,0xCD + jnz .FUCK +.0F38XX:mov [I.Name],dx + mov [I.RandSize],VXWORD+80h + cmp al,0xCB +ifz mov [I.Arg3.Type],XMMRG + jmp R32RM32X +.FUCK: mov ebx,RtnMM2MM + call CheckPrevSSE4 + jc ErrorDec + ret +;----------------------------------------------------------------------------- +RtnWRSSX: + mov [I.Name],TWRSSD + test [I.PreREX],8 ;REX.W + jz RM32R32 + call ClearW + mov [I.Name],TWRSSQ + jmp RM64R64 +;----------------------------------------------------------------------------- +Rtn0F3X:test [I.Sensitive],NIA + jz ErrorDec + ret +;----------------------------------------------------------------------------- +Rtn0F50:test [I.Sensitive],NIA + jz Rtn0066F2F3X +.L0: mov [I.RandSize],VQWORD+80h + jmp RtnMM2MM +;----------------------------------------------------------------------------- +RtnIAMM:test [I.Sensitive],NIA + jz Rtn0066F2F3 + jmp Rtn0F50.L0 +;----------------------------------------------------------------------------- +RtnIAM3:test [I.Sensitive],NIA + jz Rtn0066F2F3 + cmp byte [rsi],0xC0 + jae ErrorDec + jmp Rtn0F50.L0 +;----------------------------------------------------------------------------- +Rtn0F6X:cmp [I.PrefixByte],bit P66 + jnz .L1 + and byte [I.Prefixes],not (bit P66) + mov [I.Mandatory66],1 + mov [I.RandSize],VXWORD+80h + jmp R32RM32X +.L1: cmp [I.PrefixByte],0 + jnz ErrorDec + cmp byte [rsi-1],6Ch + jae ErrorDec + jmp RtnMM2MM +;----------------------------------------------------------------------------- +Rtn0F72:mov r8d,T0F72Names + jmp Rtn0F71.L0 +;----------------------------------------------------------------------------- +Rtn0F71:mov r8d,T0F71Names +.L0: call FetchModRM +.0L: movzx eax,[I.Reg] + mov edx,[rax*2+r8] + or dx,dx + jz .L5 +.L1: cmp [I.Mod],3 + jne .L5 + mov [I.Name],dx + mov al,[I.PrefixByte] + cmp al,bit P66 + jnz .L4 + and byte [I.Prefixes],not (bit P66) + mov [I.Mandatory66],1 +.L2: mov [I.Arg1.Type],XMMRG +.L3: mov [I.Arg1.Type2nd],InRM + FetchB + mov [I.Arg2.Type],80h+1 + mov [I.Arg2.ImmB],al + ret +.L4: mov [I.Arg1.Type],MMXRG + or al,al + jz .L3 +.L5: jmp ErrorDec +;----------------------------------------------------------------------------- +Rtn0F73:mov r8d,T0F73Names + call FetchModRM + cmp [I.PrefixByte],0 + jnz Rtn0F71.0L + ;MMX /2 /6 + cmp [I.Reg],2 + je Rtn0F71.0L + cmp [I.Reg],6 + je Rtn0F71.0L + jmp ErrorDec +;----------------------------------------------------------------------------- +RtnMMXM:mov edx,RtnMM2MM + mov al,[I.PrefixByte] + or al,al + jz .L1 + cmp al,bit P66 + jnz ErrorDec + mov edx,R32RM32X + and byte [I.Prefixes],not (bit P66) + mov [I.Mandatory66],1 + mov [I.RandSize],VXWORD+80h +.L1: jmp rdx +;----------------------------------------------------------------------------- +Rtn0F78: + test [I.Sensitive],NIA + jz .L0 + cmp byte [rsi],0xC0 + jae ErrorDec + mov [I.RandSize],VTWORD+80h + mov [I.Name],TSVDC + jmp RM16SEG +.L0: mov al,[I.PrefixByte] + or al,al + jnz .L2 + mov edx,RM32R32 + mov [I.RandSize],VDWORD+80h + cmp [I.Arch],CPUX64 + jnz .L1 + mov edx,RM64R64 + mov [I.RandSize],VQWORD+80h +.L1: jmp rdx +.L2: cmp byte [rsi],0xC0 + jb ErrorDec + cmp al,bit P66 + jnz .L3 + call FetchModRM + cmp [I.Reg],0 + jnz ErrorDec + and byte [I.Prefixes],not (bit P66) + mov [I.Mandatory66],1 + mov [I.Name],TEXTRQ + mov [I.Arg1.Type],XMMRG + mov [I.Arg1.Type2nd],InRM + lea r8,[I.Arg2] +.LX: FetchW + mov [r8+TArg.Type],80h+1 + mov [r8+TArg.ImmB],al + add r8d,sizeof.TArg + mov [r8+TArg.Type],80h+1 + mov al,ah + mov [r8+TArg.ImmB],al + ret +.L3: cmp al,bit PF2 + jnz ErrorDec + and byte [I.Prefixes],not (bit PF2) + mov [I.Name],TINSERTQ + call R32RM32X + lea r8,[I.Arg3] + jmp .LX +;----------------------------------------------------------------------------- +Rtn0F79:test [I.Sensitive],NIA + jz .L0 + cmp byte [rsi],0xC0 + jae ErrorDec + mov [I.RandSize],VTWORD+80h + mov [I.Name],TRSDC + jmp SEGRM16 +.L0: mov al,[I.PrefixByte] + or al,al + jnz .L2 + mov edx,R32RM32 + mov [I.RandSize],VDWORD+80h + cmp [I.Arch],CPUX64 + jnz .L1 + mov edx,R64RM64 + mov [I.RandSize],VQWORD+80h +.L1: jmp rdx +.L2: cmp byte [rsi],0xC0 + jb ErrorDec + cmp al,bit P66 + jnz .L3 + and byte [I.Prefixes],not (bit P66) + mov [I.Mandatory66],1 + mov [I.Name],TEXTRQ + jmp R32RM32X +.L3: cmp al,bit PF2 + jnz ErrorDec + and byte [I.Prefixes],not (bit PF2) + mov [I.Name],TINSERTQ + jmp R32RM32X +;----------------------------------------------------------------------------- +Rtn0F7B: +Rtn0F7A:test [I.Sensitive],NIA + jz ErrorDec +.L1: call FetchModRM + cmp [I.Mod],3 + jz ErrorDec + cmp [I.Reg],0 + jnz ErrorDec + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + ret +;----------------------------------------------------------------------------- +Rtn0F7D: +Rtn0F7C: + test [I.Sensitive],NIA + jz Rtn0066F2F3 + jmp Rtn0F7A.L1 +;----------------------------------------------------------------------------- +Rtn0F7E:test [I.Sensitive],NIA + jz Rtn0066F2F3X + ret +;----------------------------------------------------------------------------- +Rtn0FA6:test [I.Sensitive],NIA + jnz .L1 + cmp [I.Arch],CPUX64 + je .L0 + mov [I.RandSize],VBYTE+80h + test [I.Sensitive],UND + jnz RM8R8 +.L0: jmp ErrorDec + +.L1: call FetchModRM + cmp [I.Mod],3 + jnz .L0 + cmp [I.RM],0 + jnz .L0 + movzx eax,[I.Reg] + cmp al,2 + ja .L0 + BitTR I.Prefixes,PF3 + jnc .L0 + mov eax,[rax*2+TCentTable] + mov [I.Name],ax + ret +;----------------------------------------------------------------------------- +Rtn0FA7:test [I.Sensitive],NIA + jnz .L1 + test [I.Sensitive],UND + jz .L4 + cmp [I.Arch],CPUX64 + je .L4 + BitTR I.Prefixes,P66 + cmp [I.Operand],0 + mov [I.RandSize],VDWORD+80h + jnz RM32R32 + mov [I.RandSize],VWORD+80h + jmp RM16R16 + +.L1: call FetchModRM + cmp [I.Mod],3 + jnz .L4 + cmp [I.RM],0 + jnz .L4 + cmp [I.PrefixByte],bit PF3 + jnz .L3 + BitTR I.Prefixes,PF3 + movzx eax,[I.Reg] + mov eax,[rax*2+TCRYPTable] + or ax,ax + jz .L4 +.L2: mov [I.Name],ax + ret +.L3: cmp al,$C0 + mov ax,TXSTORE + jz .L2 +.L4: jmp ErrorDec +;----------------------------------------------------------------------------- +Rtn0FAE:call FetchModRM + mov rsi,[I.SaveRSI] + + movzx ebx,[I.Reg] + + cmp [I.PrefixByte],bit P66 + je Rtn660FAE + + cmp [I.Mod],3 + je .L2 + + mov edx,T0FAETable + cmp [I.W],0 + jz .L0 + mov edx,T0FAETab64 + call ClearW +.L0: + cmp [I.PrefixByte],bit PF3 + je RtnF30FAE + + mov edx,[rbx*2+rdx] +.L1: or dx,dx + jz ErrorDec + mov [I.Name],dx + jmp RM32 +.L2: + cmp [I.PrefixByte],bit PF3 + je RtnF30FAE + cmp [I.PrefixByte],bit PF2 + je RtnF20FAE + mov dx,TLFENCE + cmp al,$E8 + je .L3 + mov dx,TMFENCE + cmp al,$F0 + je .L3 + mov dx,TSFENCE + cmp al,$F8 + jne ErrorDec +.L3: lodsb + mov [I.Name],dx + ret + +Rtn660FAE: + and byte [I.Prefixes],not (bit P66) + mov edx,T660FAETable3 + cmp [I.Mod],3 + jz .L1 + mov edx,T660FAETable0 +.L1: mov edx,[rbx*2+rdx] + or dx,dx + jz ErrorDec + mov [I.Name],dx + jmp RM32 + +RtnF20FAE: + and byte [I.Prefixes],not (bit PF2) + cmp byte [rsi],0xC0 + jb ErrorDec + mov [I.Name],TUMWAIT + jmp RM32 + +RtnF30FAE: + cmp bl,06h + jz .L0 + cmp [I.Arch],CPUX64 + jne ErrorDec +.L0: + mov edx,[rbx*2+TF30FAETable] + or dx,dx + jz ErrorDec + mov [I.Name],dx + and byte [I.Prefixes],not (bit PF3) + cmp bl,06h + jz IsUMONITOR + call ClearW + mov [I.RandSize],VDWORD + cmp [I.W],0 + jz RM32 + cmp bl,5 +ifz mov [I.Name],TINCSSPQ + mov [I.RandSize],VQWORD + jmp RM64 +IsUMONITOR: + cmp byte [rsi],0xC0 + jbe .1 + BitTR I.Prefixes,P67 + call FetchModRM + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov al,[I.Address] + add al,GPR16 + mov [I.Arg1.Type],al + mov [I.Arg1.Type2nd],InRM + ret +.1: mov [I.Name],TCLRSSBSY + call FetchModRM + mov [I.Arg1.Mem],1 + ret +;----------------------------------------------------------------------------- +Rtn0FC2:xor ebx,ebx + mov al,[I.PrefixByte] + or al,al + jz .L1 + inc ebx + cmp al,bit P66 + setz [I.Mandatory66] + jz .L1 + inc ebx + cmp al,bit PF2 + jz .L1 + inc ebx + cmp al,bit PF3 + jnz ErrorDec +.L1: not al + and byte [I.Prefixes],al + + mov eax,[rbx*3+CMPSuffixesY] + mov word [I.Suffix2nd],ax + shr eax,16 + mov [I.RandSize],al + + call R32RM32X + xor eax,eax + FetchB + mov edx,[rax*2+CMPxxNames] + cmp al,7 + ja .L2 + mov [I.Name],dx + ret +.L2: mov [I.Name],TCMP + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al + ret +;----------------------------------------------------------------------------- +Rtn0FC73: + mov ax,TRDPID + cmp [I.Reg],7 + jnz .M7 + BitTR I.Prefixes,PF3 + jc .M0 +.M7: cmp [I.Reg],6 + jb ErrorDec + mov ax,TRDRAND + jz .M0 + mov ax,TRDSEED +.M0: mov [I.Name],ax + cmp [I.W],0 + jz .M1 + call ClearW + jmp RM64 +.M1: BitTR I.Prefixes,P66 + cmp [I.Operand],0 + jnz RM32 + jmp RM16 +;----------------------------------------------------------------------------- +Rtn0FC7:call FetchModRM + mov rsi,[I.SaveRSI] + cmp [I.Mod],3 + jz Rtn0FC73 + cmp [I.Reg],1 + jne .L0 + or [I.Flags],_XA+_XR + mov [I.RandSize],VQWORD+80h + cmp [I.W],0 + jz .RM + mov [I.RandSize],VXWORD+80h + mov dx,TCMPXCHG16B +.WWWW: call ClearW +.EA: mov [I.Name],dx +.RM: jmp RM32 +.L0: + mov edx,T0FC7Table + cmp [I.W],0 + jz .W0 + mov edx,T0FC7Tab64 +.W0: movzx eax,[I.Reg] + mov dx,[rax*2+rdx] + or dx,dx + jnz .WWWW + + mov [I.RandSize],VQWORD+80h + mov ah,[I.Reg] + mov al,[I.PrefixByte] + or al,al + jne .L1 + mov dx,TVMPTRLD + cmp ah,6 + je .EA + mov dx,TVMPTRST + cmp ah,7 + je .EA +.ED: jmp ErrorDec + +.L1: cmp [I.Reg],6 + jne .ED + cmp al,bit P66 + jne .L2 + mov dx,TVMCLEAR + mov [I.Mandatory66],1 +.AN: not al + and byte [I.Prefixes],al + jmp .EA + +.L2: cmp al,bit PF3 + jne .ED + mov dx,TVMXON + jmp .AN +;----------------------------------------------------------------------------- +RtnBSWAP: + mov al,[rsi-1] + sub al,0xC8 + mov [I.RM],al + mov [I.Mod],3 + mov [I.Arg1.Type2nd],InRM + mov [I.Arg1.Type],GPR64 + cmp [I.W],0 + jnz .Exit + BitTR I.Prefixes,P66 + mov [I.Arg1.Type],GPR32 + cmp [I.Operand],0 + jnz .Exit + mov [I.Arg1.Type],GPR16 +.Exit: ret +;----------------------------------------------------------------------------- +MOVZXWB:call R16RM16 + mov [I.AltName],TMOVZBW + mov [I.Arg2.Type],GPR08 + ret +MOVZXDB:call R32RM32 + mov [I.AltName],TMOVZBL + mov [I.Arg2.Type],GPR08 + ret +MOVZXQB:call R64RM64 + mov [I.AltName],TMOVZBQ + mov [I.Arg2.Type],GPR08 + ret +MOVZXWW:call R16RM16 + mov [I.AltName],TMOVZWW + ret +MOVZXDW:call R32RM32 + mov [I.AltName],TMOVZWL + mov [I.Arg2.Type],GPR16 + ret +MOVZXQW:call R64RM64 + mov [I.AltName],TMOVZWQ + mov [I.Arg2.Type],GPR16 + ret +;----------------------------------------------------------------------------- +MOVSXWB:call R16RM16 + mov [I.AltName],TMOVSBW + mov [I.Arg2.Type],GPR08 + ret +MOVSXDB:call R32RM32 + mov [I.AltName],TMOVSBL + mov [I.Arg2.Type],GPR08 + ret +MOVSXQB:call R64RM64 + mov [I.AltName],TMOVSBQ + mov [I.Arg2.Type],GPR08 + ret +MOVSXWW:call R16RM16 + mov [I.AltName],TMOVSWW + ret +MOVSXDW:call R32RM32 + mov [I.AltName],TMOVSWL + mov [I.Arg2.Type],GPR16 + ret +MOVSXQW:call R64RM64 + mov [I.AltName],TMOVSWQ + mov [I.Arg2.Type],GPR16 + ret +;----------------------------------------------------------------------------- +R16RM16B8: + BitTR I.Prefixes,PF3 + jnc .L1 + call R16RM16 + mov [I.RandSize],VWORD+80h + ret +.L1: mov [I.Name],TJMPE + or [I.Flags],_J + jmp DODISPW +;----------------------------------------------------------------------------- +R32RM32B8: + BitTR I.Prefixes,PF3 + jnc .L1 + call R32RM32 + mov [I.RandSize],VDWORD+80h + ret +.L1: mov [I.Name],TJMPE + or [I.Flags],_J + jmp DODISPD +;----------------------------------------------------------------------------- +R64RM64B8: + BitTR I.Prefixes,PF3 + jnc .L1 + call ClearW + call R64RM64 + mov [I.RandSize],VQWORD+80h + ret +.L1: mov [I.Name],TJMPE + or [I.Flags],_J + jmp DODISPD +;----------------------------------------------------------------------------- +RtnCRC32: + mov [I.Table],TableCRC32 + jmp RtnMOV32 +;----------------------------------------------------------------------------- +RtnMOVBE: + mov [I.Table],TableMOVBE +RtnMOV32: + mov [I.NewTable],1 + mov [I.Only],0 + sub al,0xF0 + ret +;----------------------------------------------------------------------------- +RtnADOX:mov [I.Table],TableADOX + jmp RtnADXX +RtnADCX:mov [I.Table],TableADCX +RtnADXX:mov [I.NewTable],1 + mov [I.Only],1 + xor al,al + ret +;----------------------------------------------------------------------------- +RtnINVXX: + mov [I.Table],TableINVx + mov [I.NewTable],1 + mov [I.Only],1 + sub al,80h + ret +;----------------------------------------------------------------------------- +Rtn0F388X: + call R32RM32 + cmp [I.Mod],3 + jz ErrorDec + cmp [I.Arch],CPUX64 + jnz .L1 + mov [I.Arg1.Type],GPR64 +.L1: ret +;----------------------------------------------------------------------------- +Rtn0F3866: + FetchB + cmp al,0x80 + jb .M0 + cmp al,0x82 + jbe RtnINVXX +.M0: + cmp al,0xF0 + jb .L0 + cmp al,0xF1 + jbe RtnMOVBE + + cmp al,0xF6 + jz RtnADCX + +.L0: mov ebx,R32RM32X + call CheckPrevSSE4 + jnc .LX + call CheckNextSSE4 + jc ErrorDec +.LX: ret +;----------------------------------------------------------------------------- +Rtn0F38F2: + FetchB + cmp al,0xF0 + jb .L0 + cmp al,0xF1 + jbe RtnCRC32 +.L0: jmp ErrorDec +;----------------------------------------------------------------------------- +Rtn0F38F3: + FetchB + cmp al,0xF6 + jz RtnADOX +.L0: jmp ErrorDec +;----------------------------------------------------------------------------- +CRC32R: call R32RM32 + mov [I.Arg2.Type],GPR08 + cmp [I.W],0 + jz .L1 + mov [I.Arg1.Type],GPR64 +.L1: ret +;----------------------------------------------------------------------------- +CRC32X: call R32RM32 + BitTR I.Prefixes,P66 + jnc .L0 + mov [I.Arg2.Type],GPR16 +.L0: + cmp [I.W],0 + jz .L1 + mov [I.Arg1.Type],GPR64 + mov [I.Arg2.Type],GPR64 +.L1: ret +;----------------------------------------------------------------------------- +Rtn0F39:test [I.Sensitive],NIA + jz ErrorDec + ret +;----------------------------------------------------------------------------- +Rtn0F3A:test [I.Sensitive],NIA + jnz .L0 + test [I.Sensitive],UND + jz .L1 + mov [I.Name],TRDM + ret +.L0: mov [I.Name],TBB0?RESET + ret +.L1: FetchB + cmp al,14h + jz Rtn0F3A14 + cmp al,15h + jz Rtn0F3A15 + cmp al,16h + jz Rtn0F3A16 + cmp al,17h + jz Rtn0F3A17 + cmp al,20h + jz Rtn0F3A20 + cmp al,21h + jz Rtn0F3A21 + cmp al,22h + jz Rtn0F3A22 + cmp al,44h + jz Rtn0F3A44 + cmp al,$CC + jz .CC + + mov edx,TableSXSSE +.L5: cmp al,[rdx] + je .L4 + add edx,4 + cmp edx,TableEXSSE + jb .L5 + jmp ErrorDec +.L4: mov edx,[rdx+1] + mov [I.RandSize],dl + shr edx,8 + mov [I.Name],dx + + BitTR I.Prefixes,P66 + jnc .No66 + mov [I.Mandatory66],1 +.L3: call R32RM32X +.L2: FetchB + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al + ret +.No66: cmp al,0Fh + jnz ErrorDec + mov [I.RandSize],VQWORD+80h + call RtnMM2MM + jmp .L2 +.CC: mov [I.Name],TSHA1RNDS4 + mov [I.RandSize],VXWORD+80h + jmp .L3 +;----------------------------------------------------------------------------- +Rtn0F1012: + test [I.Sensitive],UND + jnz RM8R8 + jmp Rtn0066F2F3 + +Rtn0F11X: + test [I.Sensitive],UND + jz Rtn0066F2F3 + cmp [I.Operand],0 + jz RM16R16 + jmp RM32R32 + +Rtn0F13X: + test [I.Sensitive],UND + jz Rtn0066F2F3 + cmp [I.Operand],0 + jz R16RM16 + jmp R32RM32 + +Rtn0F18:call FetchModRM + cmp [I.Mod],3 + jz ErrorDec + setnz [I.Arg1.Mem] + mov al,[I.Reg] + mov dx,TPREFETCHNTA + or al,al + jz .L1 + mov dx,TPREFETCHT0 + cmp al,1 + jz .L1 + mov dx,TPREFETCHT1 + cmp al,2 + jz .L1 + mov dx,TPREFETCHT2 + cmp al,3 + jnz ErrorDec +.L1: mov [I.Name],dx + mov [I.RandSize],0 + ret + + +Rtn0F1C:call FetchModRM + cmp [I.Mod],3 + jz .Exit + cmp [I.Reg],0 + jnz .Exit + stc + ret +.Exit: mov rsi,[I.SaveRSI] + clc + ret + +Is0F1C: mov [I.RandSize],VBYTE+80h + mov [I.Name],TCLDEMOTE + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Type2nd],InRM + ret + +Rtn0F1C16: + call Rtn0F1C + jc Is0F1C +Rtn0F1X16: + mov ebx,RM16 + jmp Rtn0F18XX.L1 +Rtn0F1C32: + call Rtn0F1C + jc Is0F1C +Rtn0F1X32: + mov ebx,RM32 + jmp Rtn0F18XX.L1 +Rtn0F1C64: + call Rtn0F1C + jc Is0F1C +Rtn0F1X64: + mov ebx,RM64 + jmp Rtn0F18XX.L1 + +Rtn0F1816: + mov ebx,RM16 + jmp Rtn0F18XX +Rtn0F1832: + mov ebx,RM32 + jmp Rtn0F18XX +Rtn0F1864: + mov ebx,RM64 + ;jmp Rtn0F18XX +Rtn0F18XX: +.L0: test [I.Sensitive],UND + jz Rtn0F18 +.L1: BitTR I.Prefixes,P66 + call ClearW + + movzx eax,word [rsi-1] + sub al,18h + shl al,3 + and ah,111000b + shr ah,3 + add al,ah + xor ah,ah + mov cl,10 + div cl + add ax,'00' + cmp al,'0' + jne @F + mov al,ah + xor ah,ah +@@: mov [Names+THINT?NOPXX+8],ax + mov [I.Name],THINT?NOPXX + jmp rbx + +Rtn0F1A:mov r8d,N0F1A + jmp Rtn0F1B.L0 +Rtn0F1B:mov r8d,N0F1B +.L0: xor edx,edx + mov dl,3 + mov ecx,edx + movzx eax,[I.PrefixByte] + bsf edx,eax + bsr ecx,eax + cmp edx,ecx + jnz ErrorDec + push rdx + mov edx,[rdx*2+r8] + mov [I.Name],dx + BitTR I.Prefixes,P67 ; 0x48 & 0x67 have no effect + pushf + call FetchModRM + popf + jnc @F + BitTS I.Prefixes,P67 +@@: + pop rdx + movzx eax,word [rdx*2+r8+4*2] + add eax,RtnXX + mov [I.RandSize],0 + jmp rax +;----------------------------------------------------------------------------- +Rtn0F1E: + BitTR I.Prefixes,PF3 + jz ErrorDec + mov al,[rsi] + mov dx,TENDBR32 + cmp al,0xFB + jz .2 + mov dx,TENDBR64 + cmp al,0xFA + jz .2 + mov [I.Arg1.Type],GPR64 + mov dx,TRDSSPQ + test [I.PreREX],8 ;REX.W + jnz .1 + mov [I.Arg1.Type],GPR32 + mov dx,TRDSSPD +.1: mov [I.Name],dx + call FetchModRM + cmp [I.Mod],3 + jnz ErrorDec + cmp [I.Reg],1 + jnz ErrorDec + mov [I.Arg1.Type2nd],InRM + ret +.2: mov [I.Name],dx + lodsb + ret +;----------------------------------------------------------------------------- +RBNDLDX:push BNDX1 + cmp [I.Mod],3 + jz ErrorDec + jmp R32RM32M +;----------------------------------------------------------------------------- +RBNDSTX:push BNDX2 + cmp [I.Mod],3 + jz ErrorDec + jmp RM32R32M +;----------------------------------------------------------------------------- +RBNDMOV1: + push BNDX3 + BitTR I.Prefixes,P66 + jmp RM32R32M +;----------------------------------------------------------------------------- +RBNDMOV2: + push BNDX3 + BitTR I.Prefixes,P66 + jmp R32RM32M +;----------------------------------------------------------------------------- +RBNDCU: RBNDCN: + push BNDX4 + BitTR I.Prefixes,PF2 + jmp R32RM32M +;----------------------------------------------------------------------------- +RBNDMK: cmp [I.Mod],3 + jz ErrorDec +RBNDCL: push BNDX4 + BitTR I.Prefixes,PF3 + jmp R32RM32M +;----------------------------------------------------------------------------- +Rtn0066F2F3: + call Start66F2F3 +.L1: + movzx ebx,word [rdx+rbx+4*1+4*2] + add ebx,RtnXX + + mov edx,[rdx] + or dx,dx + jz ErrorDec + not al + and byte [I.Prefixes],al + mov [I.Name],dx + + jmp rbx +;----------------------------------------------------------------------------- +RtnWB: BitTR I.Prefixes,PF3 + jnc .Exit + mov [I.Name],TWBNOINVD +.Exit: ret +;----------------------------------------------------------------------------- +YaMOVDIRI: + mov [I.Name],TMOVDIRI + mov [I.RandSize],VDWORD+80h + cmp [I.W],0 + jz RM32R32 + BitTR I.Prefixes,P4X + mov [I.RandSize],VQWORD+80h + jmp RM64R64 +;----------------------------------------------------------------------------- +YaMOVDIR64B: + BitTR I.Prefixes,P66 + mov [I.Mandatory66],True + mov [I.Name],TMOVDIR64B + call FetchModRM + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov al,[I.Address] + add al,GPR16 + mov [I.Arg1.Type],al + mov [I.Arg1.Type2nd],InReg + + mov [I.Arg2.Type],GPR64 + mov [I.Arg2.Type2nd],InRM + ret +;----------------------------------------------------------------------------- +Rtn0066F2F3Y: + lodsb + cmp [I.PrefixByte],bit P66 + jnz NoMOVDIR64B + cmp al,0xF8 + jnz NoMOVDIR64B + cmp byte [rsi],0xC0 + jb YaMOVDIR64B +NoMOVDIR64B: + cmp al,0xF9 + jnz NoMOVDIRI + cmp byte [rsi],0xC0 + jb YaMOVDIRI +NoMOVDIRI: + dec rsi + + mov ecx,[rdx+4*2] + + mov al,[I.PrefixByte] + or al,al + jz .L1 + shr ecx,8 + add edx,2 + cmp al,bit P66 + setz [I.Mandatory66] + jz .L1 + shr ecx,8 + add edx,2 + cmp al,bit PF2 + jz .L1 + cmp al,bit PF2+bit P66 + jz .L0 + shr ecx,8 + add edx,2 + cmp al,bit PF3 + jz .L1 + jmp ErrorDec +.L0: mov al,bit PF2 +.L1: mov [I.RandSize],cl + + xor ebx,ebx + jmp Rtn0066F2F3.L1 +;----------------------------------------------------------------------------- +Rtn0066F2F3X: +r8w equ di + call Start66F2F3 + + mov r8d,[rdx+rbx+2*2*4+4] + + movzx ebx,word [rdx+rbx+1*2*4+4] + add ebx,RtnXX + + mov edx,[rdx] + or dx,dx + jz ErrorDec + not al + and byte [I.Prefixes],al + mov [I.Name],dx + + push r8 + call rbx + pop r8 + + mov eax,r8d + and eax,0F0Fh + mov [I.Arg1.Type],al + mov [I.Arg2.Type],ah + + test r8w,8080h + jz .L1 + cmp [I.W],0 + jz .L1 + call ClearW + + test r8b,0080h +ifnz mov [I.Arg1.Type],GPR64 + test r8w,8000h +ifnz mov [I.Arg2.Type],GPR64 + + test r8w,2020h +ifnz mov [I.LastByte],'q' + + test r8w,4040h + jz .L1 + and [I.RandSize],0xF0 + or [I.RandSize],VQWORD +.L1: + test r8w,1010h + jz .L2 + FetchB + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al +.L2: + ret + +RM16F5: mov [I.AltName],TLJMP + jmp RM16F35 +RM16F3: mov [I.AltName],TLCALL +RM16F35:mov [I.Point],TFAR + call RM16 + cmp [I.Mod],3 + jz ErrorDec + cmp [I.Syntax],0 + jnz .SkipATT + mov [I.RandSize],VDWORD +.SkipATT: + ret + +RM32F5: mov [I.AltName],TLJMP + jmp RM32F35 +RM32F3: mov [I.AltName],TLCALL +RM32F35:mov [I.Point],TFAR + call RM32 + cmp [I.Mod],3 + jz ErrorDec + cmp [I.Syntax],0 + jnz .SkipATT + mov [I.RandSize],VFWORD +.SkipATT: + ret + +RM64F5: mov [I.AltName],TLJMP + jmp RM64F35 +RM64F3: mov [I.AltName],TLCALL +RM64F35:mov [I.Point],TFAR + call RM64 + cmp [I.Mod],3 + jz ErrorDec + cmp [I.Syntax],0 + jnz .SkipATT + mov [I.RandSize],VTWORD +.SkipATT: + ret + +R8I08: + FetchB + + mov [I.Arg1.Type],GPR08 + + mov [I.Arg2.Type],80h+1 + mov [I.Arg2.ImmB],al + + ret + +R16I16: + FetchW + + mov [I.Arg1.Type],GPR16 + + mov [I.Arg2.Type],80h+2 + mov [I.Arg2.Imm],rax + + ret + +R32I32: + FetchSD + + mov [I.Arg1.Type],GPR32 + + mov [I.Arg2.Type],80h+4 + mov [I.Arg2.Imm],rax + + ret + +R64I32: + FetchSD + + mov [I.Arg1.Type],GPR64 + + mov [I.Arg2.Type],80h+40h+4 + mov [I.Arg2.Imm],rax + + ret + +R16RM16I16: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InReg + + FetchSW + mov [I.Arg3.Type],80h+40h+20h+2 + mov [I.Arg3.Imm],rax + ret + +R32RM32I32: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InReg + + FetchSD + mov [I.Arg3.Type],80h+40h+20h+4 + mov [I.Arg3.Imm],rax + ret + +R64RM64I32: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR64 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InReg + + FetchSD + mov [I.Arg3.Type],80h+40h+20h+4 + mov [I.Arg3.Imm],rax + ret + +R16RM16SI16: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InReg + + FetchSB + mov [I.Arg3.Type],80h+40h+20h+1 + mov [I.Arg3.Imm],rax + ret + +R32RM32SI32: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InReg + + FetchSB + mov [I.Arg3.Type],80h+40h+20h+1 + mov [I.Arg3.Imm],rax + ret + +R64RM64SI32: + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR64 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InReg + + FetchSB + mov [I.Arg3.Type],80h+40h+20h+1 + mov [I.Arg3.Imm],rax + ret + +RtnINSX: + mov [I.PossibleF2F3],True + + mov [I.AltName],TINS + + BitTR I.Prefixes,P67 + jnc .SkipATT + + mov [I.Name],TINS + + mov [I.Base],RRDI + + mov [I.Arg1.Type],1 + mov [I.Arg1.Mem],True + + mov [I.Arg2.Type],2 + mov [I.Arg2.Reg],RRDX +.SkipATT: + ret + +RtnOUTSX: + mov [I.PossibleF2F3],True + + mov [I.AltName],TOUTS + + test byte [I.Prefixes],bit PSEG+bit P67 + jz .SkipATT + + BitTR I.Prefixes,P67 + + mov [I.Name],TOUTS + + mov [I.Base],RRSI + + mov [I.Arg2.Type],1 + mov [I.Arg2.Mem],True + + mov [I.Arg1.Type],2 + mov [I.Arg1.Reg],RRDX + + call ClearSeg +.SkipATT: + ret + +RM16I8: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + + FetchB + mov [I.Arg2.Type],80h+1 + mov [I.Arg2.Imm],rax + ret + +RM32I8: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + + FetchB + mov [I.Arg2.Type],80h+1 + mov [I.Arg2.Imm],rax + ret + +RM64I8: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + + FetchB + mov [I.Arg2.Type],80h+1 + mov [I.Arg2.Imm],rax + ret + +RtnC216: + mov [I.IsRET],True + FetchW + mov [I.Arg1.Type],80h+2 + mov [I.Arg1.Imm],rax + + BitT I.Prefixes,P66 + jnc .SkipSuffix + mov [I.Suffix],'w' +.SkipSuffix: + ret + +RtnC232: + mov [I.IsRET],True + FetchW + mov [I.Arg1.Type],80h+2 + mov [I.Arg1.Imm],rax + BitT I.Prefixes,P66 + jnc .SkipSuffix + mov [I.Suffix],'d' +.SkipSuffix: + ret + +RtnC264: + mov [I.IsRET],True + FetchW + mov [I.Arg1.Type],80h+2 + mov [I.Arg1.Imm],rax +AddSuffixX: + cmp [I.W],0 + jz .SkipSuffix + BitTR I.Prefixes,P4X + mov [I.Suffix],'q' +.SkipSuffix: + ret + +AddSuffixQ: + cmp [I.Syntax],0 + jz AddSuffixX + ret + +RtnC316: + mov [I.IsRET],True + BitT I.Prefixes,P66 + jnc .SkipSuffix + mov [I.Suffix],'w' +.SkipSuffix: + ret + +RtnC332: + mov [I.IsRET],True + BitT I.Prefixes,P66 + jnc .SkipSuffix + mov [I.Suffix],'d' +.SkipSuffix: + ret + +RtnC364: + mov [I.IsRET],True + cmp [I.W],0 + jz .SkipSuffix + BitTR I.Prefixes,P4X + mov [I.Suffix],'q' +.SkipSuffix: + ret + +RtnC816: + BitT I.Prefixes,P66 + jnc .SkipSuffix + mov [I.RandSize],VWORD + mov [I.Suffix],'w' +.SkipSuffix: + jmp RtnC864 + +RtnC832: + BitT I.Prefixes,P66 + jnc .SkipSuffix + mov [I.RandSize],VDWORD + mov [I.Suffix],'d' +.SkipSuffix: + jmp RtnC864 + +RtnC864: + lea r10,[I.Arg2] + lea rax,[I.Arg1] + mov r8,rax + xor r8,r10 + + cmp [I.Syntax],0 + jnz .ATT + xor r10,r8 +.ATT: + FetchW + mov [r10+TArg.Type],80h+2 + mov [r10+TArg.Imm],rax + FetchB + xor r10,r8 + mov [r10+TArg.Type],80h+1 + mov [r10+TArg.Imm],rax + ret + +RtnC916: + BitT I.Prefixes,P66 + jnc .SkipSuffix + mov [I.RandSize],VWORD + mov [I.Suffix],'w' +.SkipSuffix: + jmp RtnC964 +RtnC932: + BitT I.Prefixes,P66 + jnc .SkipSuffix + mov [I.RandSize],VDWORD + mov [I.Suffix],'d' +.SkipSuffix: +RtnC964: + ret + +RtnCD: cmp [I.Emulated],0 + jnz .Emul + FetchB +.L4: mov [I.Name],TINT + mov [I.Arg1.Type],80h+1 + mov [I.Arg1.ImmB],al + ret +.Emul: + FetchB + cmp al,34h + jb .L4 + cmp al,3Bh + ja .L1 + add al,$D8-34h + pop rdx + jmp DisAsm.NewTable +.L1: cmp al,3Ch + jne .L2 + FetchB + mov [I.SegmName],TES + cmp al,$C0 + jae .V9 + cmp al,$3F + jb .V9 + mov [I.SegmName],TSS + cmp al,7Fh + ja .V9 + mov [I.SegmName],TCS + .V9: + mov [I.CurSeg],0xFF + and al,8 + add al,$D0 + pop rdx + jmp DisAsm.NewTable +.L2: cmp al,3Dh + jne .L3 + mov [I.Name],TWAIT + ret +.L3: cmp al,3Eh + jne .L4 + FetchW + mov al,3Eh + jmp .L4 + +RM81: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Type2nd],InRM + + mov word [I.Arg2.Type],Is1 shl 8+80h+1 + ret + +RM161: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + + mov word [I.Arg2.Type],Is1 shl 8+80h+1 + ret + +RM321: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + + mov word [I.Arg2.Type],Is1 shl 8+80h+1 + ret + +RM641: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + + mov word [I.Arg2.Type],Is1 shl 8+80h+1 + ret + +RM8CL: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR08 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Reg],RRCX + ret + +RM16CL: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Reg],RRCX + ret + +RM32CL: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR32 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Reg],RRCX + ret + +RM64CL: call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg1.Mem] + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InRM + + mov [I.Arg2.Type],GPR08 + mov [I.Arg2.Reg],RRCX + ret + +LoseByte: + FetchB + cmp al,0Ah + je .Default + mov [I.Arg1.Type],80h+1 + mov [I.Arg1.ImmB],al +.Default: + ret + +RtnD7: + test byte [I.Prefixes],bit PSEG+bit P67 + jz .SkipATT + + BitTR I.Prefixes,P67 + + mov [I.Name],TXLAT + + mov [I.RandSize],VBYTE + + mov [I.Base],RRBX + + mov [I.Arg1.Type],1 + mov [I.Arg1.Mem],True + + call ClearSeg +.SkipATT: + ret + +RtnE0: push DODISPB + mov al,[I.Arch] + cmp al,CPUX32 + jz .32 +.16: +.64: + BitTR I.Prefixes,P67 + jnc @F + mov dword [I.Name],TLOOPNZL shl 16+TLOOPNZD + @@: + ret +.32: + BitTR I.Prefixes,P67 + jnc @F + mov [I.Name],TLOOPNZW + @@: + ret + +RtnE1: push DODISPB + mov al,[I.Arch] + cmp al,CPUX32 + jz .32 +.16: +.64: + BitTR I.Prefixes,P67 + jnc @F + mov dword [I.Name],TLOOPZL shl 16+TLOOPZD + @@: + ret +.32: + BitTR I.Prefixes,P67 + jnc @F + mov [I.Name],TLOOPZW + @@: + ret + +RtnE2: push DODISPB + mov al,[I.Arch] + cmp al,CPUX32 + jz .32 +.16: +.64: + BitTR I.Prefixes,P67 + jnc @F + mov dword [I.Name],TLOOPL shl 16+TLOOPD + @@: + ret +.32: + BitTR I.Prefixes,P67 + jnc @F + mov [I.Name],TLOOPW + @@: + ret + +RtnE3: push DODISPB + mov al,[I.Arch] + cmp al,CPUX16 + jz .16 + cmp al,CPUX32 + jz .32 +.64: + mov [I.Name],TJRCXZ + BitTR I.Prefixes,P67 + jnc @F + mov [I.Name],TJECXZ + @@: + ret +.32: + mov [I.Name],TJECXZ + BitTR I.Prefixes,P67 + jnc @F + mov [I.Name],TJCXZ + @@: + ret +.16: + mov [I.Name],TJCXZ + BitTR I.Prefixes,P67 + jnc @F + mov [I.Name],TJECXZ + @@: + ret + +RtnE4: mov [I.Arg1.Type],GPR08 +RtnEXVV: + FetchB + mov [I.Arg2.Type],80h+1 + mov [I.Arg2.ImmB],al + ret + +RtnE516:mov [I.Arg1.Type],GPR16 + jmp RtnEXVV + +RtnE532:mov [I.Arg1.Type],GPR32 + jmp RtnEXVV + +RtnEC: mov [I.Arg1.Type],GPR08 +RtnEXXX:mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Reg],RRDX + ret + +RtnED16:mov [I.Arg1.Type],GPR16 + jmp RtnEXXX + +RtnED32:mov [I.Arg1.Type],GPR32 + jmp RtnEXXX + +RtnE6: FetchB + mov [I.Arg2.Type],GPR08 +RtnEXYY:mov [I.Arg1.Type],80h+1 + mov [I.Arg1.ImmB],al + ret + +RtnE716:FetchB + mov [I.Arg2.Type],GPR16 + jmp RtnEXYY + +RtnE732:FetchB + mov [I.Arg2.Type],GPR32 + jmp RtnEXYY + +RtnEE: mov [I.Arg2.Type],GPR08 +RtnEXZZ: + mov [I.Arg1.Type],GPR16 + mov [I.Arg1.Reg],RRDX + ret + +RtnEF16:mov [I.Arg2.Type],GPR16 + jmp RtnEXZZ + +RtnEF32:mov [I.Arg2.Type],GPR32 + jmp RtnEXZZ + +ESC_0_000: +ESC_0_001: +ESC_0_010: +ESC_0_011: +ESC_0_100: +ESC_0_101: +ESC_0_110: +ESC_0_111: + call FetchModRM + + lea r8,[I.Arg1] + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.RandSize],0 + + cmp [I.Reg],2 + jz .Exit + cmp [I.Reg],3 + jz .Exit + + lea r8,[I.Arg2] + mov [r8+TArg.Type],STXRG +.Exit: + mov [r8+TArg.Type2nd],InRM + ret + +ESC_1_000: + call FetchModRM + + mov [I.Arg1.Type2nd],InRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.RandSize],0 +.Exit: + ret + +ESC_1_001: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz ErrorDec + + mov [I.RandSize],0 + + mov [I.Arg1.Type2nd],InRM + ret + +ESC_1_010: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.RandSize],0 + + cmp byte [rsi-1],0xD0 + jnz ErrorDec + mov [I.Arg1.Type],0 + mov [I.Name],TFNOP +.Exit: + ret + +ESC_1_011: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.RandSize],0 + + mov [I.Name],TFSTP1 + + mov [I.Arg1.Type2nd],InRM +.Exit: + ret + +ESC_1_100: + call FetchModRM + + mov [I.Name],TFLDENV + + mov al,[I.Arch] + cmp al,CPUX16 + jz .16 +.64: +.32: + BitTR I.Prefixes,P66 + jnc @F + mov dword [I.Name],TFLDENVS shl 16+TFLDENVW + @@: + jmp .XX +.16: + BitTR I.Prefixes,P66 + jnc @F + mov dword [I.Name],TFLDENVS shl 16+TFLDENVD + @@: + +.XX: cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov al,[I.RM] + mov [I.Name],TFCHS + or al,al + jz .Quit + mov [I.Name],TFABS + cmp al,1 + jz .Quit + mov [I.Name],TFTST + cmp al,4 + jz .Quit + mov [I.Name],TFXAM + cmp al,5 + jnz ErrorDec +.Quit: mov [I.Arg1.Type],0 +.Exit: ret + +ESC_1_101: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.Arg1.Type],0 + movzx eax,[I.RM] + mov ax,[TFLDXTable+rax*2] + or eax,eax + jz ErrorDec + mov [I.Name],ax +.Exit: + ret + +ESC_1_110: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jz .Mod3 +if %B=64 + mov rdx,(TFSTENV shl 16+TFNSTENV)shl 32+(TFSTENV shl 16+TFNSTENV) +else + mov edx,(TFSTENV shl 16+TFNSTENV) + mov edi,(TFSTENV shl 16+TFNSTENV) +end if + mov al,[I.Arch] + cmp al,CPUX16 + jz .16 +.64: +.32: + BitTR I.Prefixes,P66 + jnc @F +if %B=64 + mov rdx,(TFSTENVS shl 16+TFNSTENVS)shl 32+(TFSTENVW shl 16+TFNSTENVW) +else + mov edx,(TFSTENVW shl 16+TFNSTENVW) + mov edi,(TFSTENVS shl 16+TFNSTENVS) +end if + @@: + jmp .XX +.16: + BitTR I.Prefixes,P66 + jnc @F +if %B=64 + mov rdx,(TFSTENVS shl 16+TFNSTENVS)shl 32+(TFSTENVD shl 16+TFNSTENVD) +else + mov edx,(TFSTENVD shl 16+TFNSTENVD) + mov edi,(TFSTENVS shl 16+TFNSTENVS) +end if + @@: + +.XX: + cmp [I.Syntax],0 + jz .YY +if %B=64 + rol rdx,32 +else + mov edx,edi +end if +.YY: + BitTR I.Prefixes,P9B + jnc @F + rol edx,16 + @@: + mov [I.Name],dx + ret + +.Mod3: + mov [I.Arg1.Type],0 + movzx eax,[I.RM] + mov ax,[TE110Table+rax*2] + mov [I.Name],ax + +.Exit: ret + +ESC_1_111: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jz .Mod3 + + mov ax,TFNSTCW + BitTR I.Prefixes,P9B + jnc @F + mov ax,TFSTCW + @@: + jmp .Name +.Mod3: + mov [I.Arg1.Type],0 + movzx eax,[I.RM] + mov ax,[TE111Table+rax*2] +.Name: + mov [I.Name],ax + ret + +ESC_2_000: + mov di,TFCMOVB + jmp ESC_2_XXX +ESC_2_001: + mov di,TFCMOVE + jmp ESC_2_XXX +ESC_2_010: + mov di,TFCMOVBE + jmp ESC_2_XXX +ESC_2_011: + mov di,TFCMOVU + jmp ESC_2_XXX +ESC_2_100: +ESC_2_101: +ESC_2_110: +ESC_2_111: + xor edi,edi +ESC_2_XXX: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.RandSize],0 + + mov [I.Name],TFUCOMPP + cmp byte [rsi-1],0xE9 + jz .Quit + + or di,di + jz ErrorDec + mov [I.Name],di + mov [I.Arg2.Type],STXRG + mov [I.Arg2.Type2nd],InRM +.Exit: ret +.Quit: + mov [I.Arg1.Type],0 + ret + +ESC_3_000: + mov di,TFCMOVNB + jmp ESC_3_XXX +ESC_3_001: + mov di,TFCMOVNE + jmp ESC_3_XXX +ESC_3_010: + mov di,TFCMOVNBE + jmp ESC_3_XXX +ESC_3_011: + mov di,TFCMOVNU +ESC_3_XXX: +ESC_3_YYY: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.RandSize],0 + + or di,di + jz ErrorDec + mov [I.Name],di + mov [I.Arg2.Type],STXRG + mov [I.Arg2.Type2nd],InRM +.Exit: + ret + +ESC_3_100: + call FetchModRM + cmp [I.Mod],3 + jnz ErrorDec + mov al,[I.RM] + mov edx,TFENI shl 16 +TFNENI + or al,al + jz .L1 + mov edx,TFDISI shl 16 +TFNDISI + dec al + jz .L1 + mov edx,TFCLEX shl 16 +TFNCLEX + dec al + jz .L1 + mov edx,TFINIT shl 16 +TFNINIT + dec al + jz .L1 + mov dx,TFSETPM + dec al + jz .L2 + mov dx,TFRSTPM + dec al + jnz ErrorDec + jmp .L2 +.L1: BitTR I.Prefixes,P9B + jnc .L2 + rol edx,16 +.L2: mov [I.Name],dx + ret + +ESC_3_101: + mov di,TFUCOMI + mov [I.IsFloat],1 + test [I.Sensitive],NIA + jz ESC_3_YYY + mov [I.RandSize],0 + call FetchModRM + cmp [I.Mod],3 + jnz ErrorDec + mov al,[I.RM] + mov dx,TFSTB0 + or al,al + jz .L1 + dec al + jz ErrorDec + mov dx,TFSTB2 + dec al + jz .L1 + mov dx,TFSTB1 + dec al + jnz ErrorDec +.L1: mov [I.Name],dx + ret + +ESC_3_110: + call FetchModRM + cmp [I.Mod],3 + jnz ErrorDec + + test [I.Sensitive],NIA + jz .YIA + + cmp [I.RM],1 + jnz ErrorDec + mov [I.Name],TF4X4 + ret +.YIA: + mov [I.Arg1.Type],STXRG + mov [I.Arg2.Type],STXRG + mov [I.Arg2.Type2nd],InRM + ret + +ESC_3_111: + call FetchModRM + test [I.Sensitive],NIA + jz .YIA + + cmp [I.Mod],3 + jnz ErrorDec + cmp [I.RM],4 + jnz ErrorDec + mov [I.Name],TFRINT2 + ret +.YIA: + cmp [I.Mod],3 + jz ErrorDec + mov [I.IsFloat],1 + mov [I.Arg1.Mem],True + mov [I.Arg1.Type],STXRG + mov [I.RandSize],VTWORD + ret + +ESC_4_010: + mov edi,TFCOM2 shl 16+TFCOM2 + jmp ESC_4_XXX +ESC_4_011: + mov edi,TFCOMP3 shl 16+TFCOMP3 + jmp ESC_4_XXX +ESC_4_000: +ESC_4_001: + xor edi,edi + jmp ESC_4_XXX +ESC_4_100: + mov edi,TFSUB shl 16+TFSUBR + jmp ESC_4_XXX +ESC_4_101: + mov edi,TFSUBR shl 16+TFSUB + jmp ESC_4_XXX +ESC_4_110: + mov edi,TFDIV shl 16+TFDIVR + jmp ESC_4_XXX +ESC_4_111: + mov edi,TFDIVR shl 16+TFDIV +ESC_4_XXX: + call FetchModRM + + mov [I.Arg1.Type2nd],InRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + or edi,edi + jz .Null + mov dword [I.Name],edi +.Null: + + mov [I.RandSize],0 + + cmp [I.Reg],2 + jz .Exit + cmp [I.Reg],3 + jz .Exit + + mov [I.Arg2.Type],STXRG +.Exit: ret + +ESC_5_001: + mov di,TFXCH4 + jmp ESC_5_XXX +ESC_5_000: + mov di,TFFREE + jmp ESC_5_XXX +ESC_5_010: +ESC_5_011: + xor edi,edi +ESC_5_XXX: + call FetchModRM +ESC_5_YYY: + + mov [I.Arg1.Type2nd],InRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + or di,di + jz .Null + mov [I.Name],di +.Null: + + mov [I.RandSize],0 +.Exit: ret + + +ESC_5_100: + mov di,TFUCOM + call FetchModRM + cmp [I.Mod],3 + jz ESC_5_YYY + + mov [I.Name],TFRSTOR + + mov al,[I.Arch] + cmp al,CPUX16 + jz .16 +.64: +.32: + BitTR I.Prefixes,P66 + jnc @F + mov dword [I.Name],TFRSTORS shl 16+TFRSTORW + @@: + jmp .XX +.16: + BitTR I.Prefixes,P66 + jnc @F + mov dword [I.Name],TFRSTORS shl 16+TFRSTORD + @@: + +.XX: + mov [I.Arg1.Mem],True + mov [I.Arg1.Type],STXRG + ret + +ESC_5_101: + call FetchModRM + cmp [I.Mod],3 + jnz ErrorDec + + mov [I.Name],TFUCOMP + + mov [I.Arg1.Type2nd],InRM + mov [I.Arg1.Type],STXRG + ret + +ESC_5_110: + call FetchModRM + cmp [I.Mod],3 + jz ErrorDec + + mov edi,TFSAVE shl 16+TFNSAVE + + mov al,[I.Arch] + cmp al,CPUX16 + jz .16 +.64: +.32: + BitTR I.Prefixes,P66 + jnc @F + mov edi,TFSAVEW shl 16+TFNSAVEW + @@: + jmp .XX +.16: + BitTR I.Prefixes,P66 + jnc @F + mov edi,TFSAVED shl 16+TFNSAVED + @@: +.XX: + BitTR I.Prefixes,P9B + jnc .YY + rol edi,16 +.YY: + mov [I.Name],di + mov [I.Arg1.Mem],True + mov [I.Arg1.Type],STXRG + ret + +ESC_5_111: + call FetchModRM + + test [I.Sensitive],NIA + jnz .XX + + cmp [I.Mod],3 + jz ErrorDec + + mov edi,TFSTSW shl 16+TFNSTSW + BitTR I.Prefixes,P9B + jnc .YY + rol edi,16 +.YY: + mov [I.Name],di + mov [I.Arg1.Mem],True + mov [I.Arg1.Type],STXRG + ret +.XX: cmp [I.Mod],3 + jnz ErrorDec + cmp byte [rsi-1],0xFC + jnz ErrorDec + mov [I.Name],TFRICHOP + ret + +ESC_6_111: + mov edi,TFDIVRP shl 16+TFDIVP + jmp ESC_6_XXX +ESC_6_110: + mov edi,TFDIVP shl 16+TFDIVRP + jmp ESC_6_XXX +ESC_6_101: + mov edi,TFSUBRP shl 16+TFSUBP + jmp ESC_6_XXX +ESC_6_100: + mov edi,TFSUBP shl 16+TFSUBRP + jmp ESC_6_XXX +ESC_6_010: + mov edi,TFCOMP5 shl 16+TFCOMP5 + jmp ESC_7_XXX ;Yes = ESC_7_XXX +ESC_6_001: + mov edi,TFMULP shl 16+TFMULP + jmp ESC_6_XXX +ESC_6_000: + mov edi,TFADDP shl 16+TFADDP + jmp ESC_6_XXX +ESC_6_011: + xor edi,edi +ESC_6_XXX: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.Arg1.Type2nd],InRM + + mov [I.RandSize],0 + + cmp byte [rsi-1],0xD9 + jz .Quit + + or edi,edi + jz .Null + mov dword [I.Name],edi +.Null: + mov [I.Arg2.Type],STXRG +.Exit: + ret +.Quit: + mov [I.Name],TFCOMPP + mov [I.Arg1.Type],0 + ret + +ESC_7_011: + mov di,TFSTP9 + jmp ESC_7_XXX +ESC_7_010: + mov di,TFSTP8 + jmp ESC_7_XXX +ESC_7_001: + mov di,TFXCH7 + jmp ESC_7_XXX +ESC_7_000: + mov di,TFFREEP +ESC_7_XXX: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.Arg1.Type2nd],InRM + + mov [I.RandSize],0 + + or di,di + jz .Null + mov [I.Name],di +.Null: + +.Exit: + ret + +ESC_7_100: + call FetchModRM + + cmp [I.Syntax],0 + jz .SkipATT + mov [I.RandSize],0 +.SkipATT: + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov al,[I.Reg] + + mov edx,TFSTSW shl 16 +TFNSTSW + or al,al + jz .L1 + + test [I.Sensitive],UND + jz .L1 + + mov edx,TFSTDW shl 16 +TFNSTDW + cmp al,1 + jz .L1 + + mov edx,TFSTSG shl 16 +TFNSTSG + cmp al,2 +.L1: + jnz ErrorDec + + BitTR I.Prefixes,P9B + jnc .L2 + rol edx,16 +.L2: mov [I.Name],dx + + mov [I.Arg1.Type],GPR16 + mov [I.RandSize],0 +.Exit: + ret + +ESC_7_110: + cmp [I.Syntax],0 + jz .SkipATT + mov [I.RandSize],0 +.SkipATT: + + mov di,TFCOMIP + jmp ESC_7_YYY +ESC_7_101: + mov [I.IsFloat],0 + mov di,TFUCOMIP +ESC_7_YYY: + call FetchModRM + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + mov [I.Name],di + + mov [I.Arg2.Type2nd],InRM + mov [I.Arg2.Type],STXRG + + mov [I.RandSize],0 +.Exit: + ret + +ESC_7_111: + call FetchModRM + + mov [I.IsFloat],0 + + cmp [I.Mod],3 + setnz [I.Arg1.Mem] + mov [I.Arg1.Type],STXRG + jnz .Exit + + test [I.Sensitive],NIA + jz ErrorDec + cmp byte [rsi-1],0xFC + jnz ErrorDec + + mov [I.Name],TFRINEAR + mov [I.Arg1.Type],0 + + mov [I.RandSize],0 +.Exit: + ret + +DODISPBS: + mov [I.IsShort],True +DODISPB: + mov [I.IsAddress],True +if %B=64 + FetchSB + add rax,[Origin] + add rax,rsi + sub rax,[I.Addr] + + mov cl,[I.Arch] + or cl,cl + jnz @F + movzx eax,ax + @@: + cmp cl,CPUX32 + jnz @F + mov eax,eax + @@: + + mov [I.Arg1.Type],80h+8 + mov [I.Arg1.Imm],rax + ret +else + FetchSB + cdq + add eax,[Origin] + adc edx,0 + add eax,esi + adc edx,0 + sub eax,[I.Addr] + sbb edx,0 + + mov cl,[I.Arch] + or cl,cl + jnz @F + xor edx,edx + movzx eax,ax + @@: + cmp cl,CPUX32 + jnz @F + xor edx,edx + @@: + + mov [I.Arg1.Type],80h+8 + mov [I.Arg1.Imm],eax + mov [I.Arg1.Imm+4],edx + ret +end if +DODISPW: + mov [I.IsAddress],True + mov [I.RandSize],VWORD +if %B=64 + FetchSW + add rax,[Origin] + add rax,rsi + sub rax,[I.Addr] + + movzx eax,ax + + mov [I.Arg1.Type],80h+8 + mov [I.Arg1.Imm],rax + ret +else + FetchSW + cdq + add eax,[Origin] + adc edx,0 + add eax,esi + adc edx,0 + sub eax,[I.Addr] + sbb edx,0 + + xor edx,edx + movzx eax,ax + + mov [I.Arg1.Type],80h+8 + mov [I.Arg1.Imm],eax + mov [I.Arg1.Imm+4],edx + ret +end if +DODISPD: + mov [I.IsAddress],True +if %B=64 + FetchSD + add rax,[Origin] + add rax,rsi + sub rax,[I.Addr] + + cmp [I.Arch],CPUX64 + jz @F + mov eax,eax + @@: + + mov [I.Arg1.Type],80h+8 + mov [I.Arg1.Imm],rax + ret +else + FetchSD + cdq + add eax,[Origin] + adc edx,0 + add eax,esi + adc edx,0 + sub eax,[I.Addr] + sbb edx,0 + + cmp [I.Arch],CPUX64 + jz @F + xor edx,edx + @@: + + mov [I.Arg1.Type],80h+8 + mov [I.Arg1.Imm],eax + mov [I.Arg1.Imm+4],edx + ret +end if +RtnArgQ: + mov [I.Arg1.Type],GPR64 +RtnArgX: + mov al,[I.B] + add [I.Arg1.Reg],al + call ClearB + ret + +RtnArgD: + mov [I.Arg1.Type],GPR32 + jmp RtnArgX + +RtnArgW: + mov [I.Arg1.Type],GPR16 + jmp RtnArgX + +RndSizeD60: + mov [I.AltName],TPUSHA + ret +RndSizeD61: + mov [I.AltName],TPOPA + ret + +AddPointD: + mov ax,TDWORD + jmp AddPointCommon +AddPointW: + mov ax,TWORD +AddPointCommon: + BitTR I.Prefixes,P66 + jnc .Skip66 + mov [I.Point],ax +.Skip66: + mov [I.Arg1.Type],SEGRG + ret + +RtnMOVSXD: + mov dword [I.Name],TMOVSLQ shl 16+TMOVSXD + cmp [I.W],0 + jnz RtnMOVZXD.Continue +RtnMOVZXD: + mov dword [I.Name],TMOVZLQ shl 16+TMOVZXD + BitTR I.Prefixes,P66 + jnc .Continue + mov dword [I.Name],TMOVZWQ shl 16+TMOVZXDW + + call FetchModRM + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR16 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InReg + ret + +.Continue: + call FetchModRM + + cmp [I.Syntax],0 + jnz @F + mov [I.RandSize],VDWORD + @@: + + ;cmp [I.Mod],3 + ;setnz [I.Arg2.Mem] + mov [I.Arg2.Type],GPR32 + mov [I.Arg2.Type2nd],InRM + + mov [I.Arg1.Type],GPR64 + mov [I.Arg1.Type2nd],InReg + ret + +PushI16: + FetchW + mov [I.Arg1.Type],80h+2 + mov [I.Arg1.Imm],rax + + mov [I.Point],TWORD + ret + +PushI32: + FetchSD + mov [I.Arg1.Type],80h+4 + mov [I.Arg1.Imm],rax + + mov [I.Point],TDWORD + ret + +PushI64: + FetchSD + mov [I.Arg1.Type],80h+40h+4 + mov [I.Arg1.Imm],rax + + mov [I.Point],TQWORD + ret + +PushSI16: + FetchSB + mov [I.Arg1.Type],80h+40h+2 + mov [I.Arg1.Imm],rax + + mov [I.Point],TWORD + ret + +PushSI32: + FetchSB + mov [I.Arg1.Type],80h+40h+4 + mov [I.Arg1.Imm],rax + + mov [I.Point],TDWORD + ret + +PushSI64: + FetchSB + mov [I.Arg1.Type],80h+40h+4 + mov [I.Arg1.Imm],rax + + mov [I.Point],TQWORD + ret + +include "rtn-c4c5.inc" +include "rtn-62xx.inc" +include "far-code.inc" + +ClearSeg: + cmp [I.IsLEA],0 + jnz .NoClear + mov ax,[I.SegmName] + cmp [I.Arch],CPUX64 + jnz .Clear + cmp ax,TFS + jz .Clear + cmp ax,TGS + jz .Clear +.NoClear: + ret +.Clear: BitTR I.Prefixes,PSEG + +ModRM2EA.Exit: + ret + +ModRM2EA: + cmp [I.Mod],3 + jz .Exit + + mov [I.DefSeg],VDS + + call ClearSeg + BitTR I.Prefixes,P67 + + mov [I.PossibleLOCK],True + + cmp [I.Address],AD16 + jz .Address16 +.SkipJmp: + mov al,[I.RM] + add al,[I.B] + + cmp al,04h + jz .J4 + cmp al,0Ch + jz .JC + cmp al,05h + jz .J5 + cmp al,0Dh + jz .JD + + mov [I.Base],al + jmp .AddressSizeCont + +.JC: +.J4: call SIBByte + jmp .AddressSizeCont +.JD: +.J5: cmp [I.Mod],0 + jne .ModeX + mov [I.DispSize],4 + FetchSD + mov [I.Disp],rax + cmp [I.Arch],CPUX64 + jnz .No64X + mov [I.Relative],True +.No64X: + jmp .AddressSizeCont +.ModeX: + mov [I.Base],al + mov [I.DefSeg],VSS +.AddressSizeCont: + mov al,[I.Mod] + cmp al,1 + jne .ModeNEQ1 + mov [I.DispSize],1 + FetchSB + mov [I.Disp],rax + jmp .ModeNEQ2 +.ModeNEQ1: + cmp al,2 + jne .ModeNEQ2 + mov [I.DispSize],4 + FetchSD + mov [I.Disp],rax +.ModeNEQ2: + + cmp [I.Base],-1 + jz .NoBase + mov al,[I.NotB] + and byte [I.Prefixes],al +.NoBase: + cmp [I.Indx],-1 + jz .NoIndx + mov al,[I.NotX] + and byte [I.Prefixes],al +.NoIndx: + ret + +.Jump16:dd .I0,.I1,.I2,.I3,.I4,.I5,.I6,.I7 + +.Address16: + movzx eax,[I.RM] + mov eax,[rax*4+.Jump16] + jmp rax +.I0: + mov [I.Base],RRBX + mov [I.Indx],RRSI + jmp .AddressSizeCont0 +.I1: + mov [I.Base],RRBX + mov [I.Indx],RRDI + jmp .AddressSizeCont0 +.I2: + mov [I.Base],RRBP + mov [I.Indx],RRSI + mov [I.DefSeg],VSS + jmp .AddressSizeCont0 +.I3: + mov [I.Base],RRBP + mov [I.Indx],RRDI + mov [I.DefSeg],VSS + jmp .AddressSizeCont0 +.I4: + mov [I.Base],RRSI + jmp .AddressSizeCont0 +.I5: + mov [I.Base],RRDI + jmp .AddressSizeCont0 +.I6: + cmp [I.Mod],0 + jne .ModeY + mov [I.DispSize],2 + FetchSW + mov [I.Disp],rax + jmp .AddressSizeCont0 +.ModeY: + mov [I.Base],RRBP + mov [I.DefSeg],VSS + jmp .AddressSizeCont0 +.I7: + mov [I.Base],RRBX +.AddressSizeCont0: + mov al,[I.Mod] + cmp al,1 + jne .NotModeEQ1 + mov [I.DispSize],1 + FetchSB + mov [I.Disp],rax + ret +.NotModeEQ1: + cmp al,2 + jne .NotModeEQ2 + mov [I.DispSize],2 + FetchSW + mov [I.Disp],rax +.NotModeEQ2: + ret + +SIBByte: + FetchB + + mov [I.SIB],al + shr al,6 + mov [I.Scale],al + + mov al,[I.SIB] + shr al,3 + and al,7 ;Index + add al,[I.X] + cmp al,4 + jz .NoIndx + mov [I.Indx],al +.NoIndx: + mov al,[I.SIB] + and al,7 ;Base + add al,[I.B] + + cmp al,05h + jz .X5 + cmp al,0Dh + jz .XD + + mov [I.Base],al + + cmp al,04h + jz .X4 + + ret +.XD: + cmp [I.Mod],0 + jne .ModeNX +.LD: mov [I.DispSize],4 + FetchSD + mov [I.Disp],rax + ret +.ModeNX: + mov [I.Base],al + ret +.X5: + cmp [I.Mod],0 + jz .LD + mov [I.Base],RRBP +.X4: mov [I.DefSeg],VSS + ret + +Hex16: mov cl,16 + jmp Hex +Hex8: mov cl,8 +Hex: movzx ecx,cl + jrcxz .L2 +if ~OS + push rdi + call FindEAX + pop rdi + jc .No + add rdi,rcx + ret +.No: +end if + push rcx + push rdx + xchg rdx,rax +.L1: movzx eax,dl + shr rdx,8 + mov ax,[rax*2+HexString] + sub cl,2 + mov [rdi+rcx],ax + ja .L1 + pop rdx + pop rcx + add rdi,rcx +.L2: ret + +if %B=32 +Bin2Hex32: + or eax,eax + jnz Bin2Hex + mov cl,0 + jmp Bin2Hex +end if + +Bin2Hex16: + mov cl,16 + jmp Bin2Hex +Bin2Hex8: + mov cl,8 + jmp Bin2Hex +; +Bin2Hex4: + mov cl,4 + jmp Bin2Hex +; +Bin2Hex2: + mov cl,2 +; +Bin2Hex: +if ~OS + call FindEAX + jc .No + ret +.No: +end if + push rcx + cmp cl,16 + ja .L0 + push rdx + cmp [I.FullHex],True + je .L3 + cmp rax,$FF + ja .SB + cmp cl,2 + jb .L3 + mov cl,2 + jmp .L3 +.SB: + cmp rax,$FFFF + ja .SW + cmp cl,4 + jb .L3 + mov cl,4 + jmp .L3 +.SW: + cmp rax,$FFFFFF + ja .SF + cmp cl,6 + jb .L3 + mov cl,6 + jmp .L3 +.SF: + or edx,$FFFFFFFF + cmp rax,rdx + ja .SD + cmp cl,8 + jb .L3 + mov cl,8 + jmp .L3 +.SD: + +.L3: +if 1 + cmp cl,16 + jnz .L4 + or edx,$FFFFFFFF + cmp rax,rdx + ja .L4 + mov cl,8 +.L4: +end if + movzx ecx,cl + push rdi rcx + + cmp [I.HexPrefix],0 + je @F +if 1 + cmp byte [rdi-1],'L' + jz .L2 +end if + mov word [rdi],'0x' + scasw + jmp .L2 +@@: + cmp [I.Dollar],0 + jne .L2 +if 1 + cmp byte [rdi-1],'L' + jz .L2 +end if + mov byte [rdi],'$' + scasb +.L2: xchg rdx,rax +.L1: movzx eax,dl + shr rdx,8 + mov ax,[rax*2+HexString] + sub cl,2 + mov [rdi+rcx],ax + ja .L1 + pop rcx rdi rdx + add rdi,rcx + + cmp [I.HexPrefix],0 + je @F +if 1 + neg rcx + cmp byte [rdi+rcx-1],'L' + jz .L0 +end if + scasw + jmp .L0 +@@: + cmp [I.Dollar],0 + jne .L0 +if 1 + neg rcx + cmp byte [rdi+rcx-1],'L' + jz .L0 +end if + scasb +.L0: pop rcx + ret + +Start66F2F3: + FetchB + dec rsi + + xor ebx,ebx + test [I.Flags],_3 + jz @F + mov bl,2*4 +@@: + mov ecx,[rdx+rbx+4*2] + + cmp al,0xC0 + jb @F + test [I.Flags],_3 + jz @F + add edx,ebx + xor ebx,ebx +@@: + mov al,[I.PrefixByte] + or al,al + jz .L1 + shr ecx,8 + add edx,2 + cmp al,bit P66 + setz [I.Mandatory66] + jz .L1 + shr ecx,8 + add edx,2 + cmp al,bit PF2 + jz .L1 + shr ecx,8 + add edx,2 + cmp al,bit PF3 + jz .L1 + jmp ErrorDec +.L1: mov [I.RandSize],cl + ret + +include "selbat.inc" +include "tables.inc" + + CpyElements NextTab + +vglobal +Params rd ParamSize/4 ;Parameters buffer +BufferI rb BufferSizeI +Buffer rb BufferSizeO +endg + +if %B=32 +r9v dd ? +r5v dd ? +r1v dd ? +end if +LastHex db ? + +rept 16 +{ +restore r8b,r8w,r8d,r8 +restore r9b,r9w,r9d,r9 +restore r10b,r10w,r10d,r10 +restore r11b,r11w,r11d,r11 +restore r12b,r12w,r12d,r12 +restore r13b,r13w,r13d,r13 +restore r14b,r14w,r14d,r14 +restore r15b,r15w,r15d,r15 +} \ No newline at end of file diff --git a/programs/develop/koldbg/disasm/disasm32.asm b/programs/develop/koldbg/disasm/disasm32.asm new file mode 100644 index 0000000000..7cd3f31e8b --- /dev/null +++ b/programs/develop/koldbg/disasm/disasm32.asm @@ -0,0 +1,187 @@ + +BufferSizeI = 1*1024 +BufferSizeO = 1*1024 + + use32 + +rax equ eax +rbx equ ebx +rcx equ ecx +rdx equ edx +rsi equ esi +rdi equ edi +rbp equ ebp +rsp equ esp + +dq equ dd + +macro dv A,B +{ + db A + dw B +} + +macro dy A,B,C +{ + db A,B + dw C +} + +macro cmova Dst,Src +{ +local ..L + jna ..L + mov Dst,Src +..L: +} + +macro cmovae Dst,Src +{ +local ..L + jnae ..L + mov Dst,Src +..L: +} + +macro cmovb Dst,Src +{ +local ..L + jnb ..L + mov Dst,Src +..L: +} + +macro cmovbe Dst,Src +{ +local ..L + jnbe ..L + mov Dst,Src +..L: +} + +macro cmovg Dst,Src +{ +local ..L + jng ..L + mov Dst,Src +..L: +} + +macro cmovge Dst,Src +{ +local ..L + jnge ..L + mov Dst,Src +..L: +} + +macro cmovl Dst,Src +{ +local ..L + jnl ..L + mov Dst,Src +..L: +} + +macro cmovle Dst,Src +{ +local ..L + jnle ..L + mov Dst,Src +..L: +} + +macro cmovno Dst,Src +{ +local ..L + jo ..L + mov Dst,Src +..L: +} + +macro cmovnp Dst,Src +{ +local ..L + jp ..L + mov Dst,Src +..L: +} + +macro cmovns Dst,Src +{ +local ..L + js ..L + mov Dst,Src +..L: +} + +macro cmovnz Dst,Src +{ +local ..L + jz ..L + mov Dst,Src +..L: +} + +macro cmovo Dst,Src +{ +local ..L + jno ..L + mov Dst,Src +..L: +} + +macro cmovp Dst,Src +{ +local ..L + jnp ..L + mov Dst,Src +..L: +} + +macro cmovs Dst,Src +{ +local ..L + jns ..L + mov Dst,Src +..L: +} + +macro cmovz Dst,Src +{ +local ..L + jnz ..L + mov Dst,Src +..L: +} + +macro jrcxz Dst +{ + jecxz Dst +} + +use32 +InitDefault: + mov [DefInst.Arch],CPUX32 + mov [DefInst.Size],15 + mov [DefInst.Negate],True + + mov [DefInst.Base],-1 + mov [DefInst.Indx],-1 + mov [DefInst.Scale],-1 + ret + +include "disasm.asm" + +CrLf db 0 +TheL db 0 +LastByte db 0 +IgnoreInvalid db 0 ;Ignore invalid VEX/XOP +SpaceSize dd 8 +Origin dd 0 +TheBufferO dd 0 + +_r8_ dd ? +_r9_ dd ? +_r10_ dq ? +_r15_ dq ? diff --git a/programs/develop/koldbg/disasm/disasm64.asm b/programs/develop/koldbg/disasm/disasm64.asm new file mode 100644 index 0000000000..9cb1ad1827 --- /dev/null +++ b/programs/develop/koldbg/disasm/disasm64.asm @@ -0,0 +1,26 @@ + +BufferSizeI = 1k +BufferSizeO = 1k + +use64 +InitDefault: + mov [DefInst.Arch],CPUX64 + mov [DefInst.Size],15 + mov [DefInst.Negate],True + + mov [DefInst.HideRIP],True + + mov [DefInst.Base],-1 + mov [DefInst.Indx],-1 + mov [DefInst.Scale],-1 + ret + +include "disasm.asm" + +CrLf db 0 +TheL db 0 +LastByte db 0 +IgnoreInvalid db 0 ;Ignore invalid VEX/XOP +SpaceSize dd 8 +Origin dq 0 +TheBufferO dq 0 diff --git a/programs/develop/koldbg/disasm/far-code.inc b/programs/develop/koldbg/disasm/far-code.inc new file mode 100644 index 0000000000..23acf6d5a6 --- /dev/null +++ b/programs/develop/koldbg/disasm/far-code.inc @@ -0,0 +1,693 @@ +ClrMagicBytes: + xor al,al + +SetMagicBytes: + + test al,4 + setnz dl + shl dl,3 + mov [I.R],dl + + mov bl,-1 + cmovnz ebx,[NotP4X] + mov [I.NotR],bl + + test al,2 + setnz dl + shl dl,3 + mov [I.X],dl + + mov bl,-1 + cmovnz ebx,[NotP4X] + mov [I.NotX],bl + + test al,1 + setnz dl + shl dl,3 + mov [I.B],dl + + mov bl,-1 + cmovnz ebx,[NotP4X] + mov [I.NotB],bl + + test al,8 + setnz [I.W] + + mov bl,-1 + cmovnz ebx,[NotP4X] + mov [I.NotW],bl + + test al,40h + setnz [I.P] + + mov bl,-1 + cmovnz ebx,[NotP4X] + mov [I.NotP],bl + + ret + +FetchModRM: + FetchB + mov [I.ModRM],al + + mov cl,al + mov bl,al + mov dl,al + shr cl,6 ;cl = mod + and bl,7 ;bl = r/m + shr dl,3 + and dl,7 ;dl = reg + + mov [I.Mod],cl + mov [I.Reg],dl + mov [I.RM],bl + + call ModRM2EA + + mov al,[I.ModRM] + ret + +TWorFW: cmp [I.Syntax],0 + jnz .Exit + mov [I.RandSize],VTWORD + cmp [I.Arch],CPUX64 + jz .Exit + mov [I.RandSize],VFWORD +.Exit: + ret + +SetArg2W: + cmp [I.Fasm],0 + jz .Exit + mov [I.Arg2.Type],GPR16 +.Exit: ret + +SetArg12X: + mov [I.Arg1.Type],XMMRG + mov [I.Arg2.Type],XMMRG + ret + +RM32R32C: + call RM32R32M + + mov [I.Arg1.Type],GPR64 + mov [I.Arg2.Type],CTRRG + + cmp [I.Arch],CPUX64 + je .L1 + mov [I.Arg1.Type],GPR32 + ;lock mov reg,cr0 = mov reg,cr8 + ;lock mov cr0,reg = mov cr8,reg + cmp [I.Reg],0 + jne .L1 + BitTR I.Prefixes,PF0 + jnc .L1 + mov [I.Reg],8 +.L1: ret +;----------------------------------------------------------------------------- +CheckPrevSSE4: + mov ecx,(EndSSE4-TabSSE4)/3 + mov edx,TabSSE4 +.L1: cmp al,[rdx] + je .L2 + add edx,3 + loop .L1 + stc + ret +.L2: mov edx,[rdx+1] + mov [I.Name],dx + call rbx + mov [I.RandSize],VQWORD+80h + clc + ret +;----------------------------------------------------------------------------- +CheckNextSSE4: + mov ecx,(EndNxtSSE4-NxtSSE4)/4 + mov edx,NxtSSE4 +.L1: cmp al,[rdx] + je .L2 + add edx,4 + loop .L1 + stc + ret +.L2: mov ecx,[rdx+1] + mov [I.RandSize],cl + shr ecx,8 + mov [I.Name],cx + + cmp al,2Ah + jne .2A + cmp byte [rsi],0xC0 + jae ErrorDec +.2A: + cmp al,15h + ja .L3 + mov [I.Arg3.Type],XMMRG +.L3: call R32RM32X + clc + ret +;----------------------------------------------------------------------------- +R32RM32C: + call R32RM32M + + mov [I.Arg2.Type],GPR64 + mov [I.Arg1.Type],CTRRG + + cmp [I.Arch],CPUX64 + je .L1 + mov [I.Arg2.Type],GPR32 + ;lock mov reg,cr0 = mov reg,cr8 + ;lock mov cr0,reg = mov cr8,reg + cmp [I.Reg],0 + jne .L1 + BitTR I.Prefixes,PF0 + jnc .L1 + mov [I.Reg],8 +.L1: ret + +RM32R32D: + call RM32R32M + + mov [I.Arg1.Type],GPR64 + mov [I.Arg2.Type],DBGRG + + cmp [I.Arch],CPUX64 + je .L1 + mov [I.Arg1.Type],GPR32 +.L1: ret + +R32RM32D: + call R32RM32M + + mov [I.Arg2.Type],GPR64 + mov [I.Arg1.Type],DBGRG + + cmp [I.Arch],CPUX64 + je .L1 + mov [I.Arg2.Type],GPR32 +.L1: ret + +RM32R32T: + call RM32R32M + + mov [I.Arg1.Type],GPR64 + mov [I.Arg2.Type],TRXRG + + cmp [I.Arch],CPUX64 + je .L1 + mov [I.Arg1.Type],GPR32 +.L1: ret + +R32RM32T: + call R32RM32M + + mov [I.Arg2.Type],GPR64 + mov [I.Arg1.Type],TRXRG + + cmp [I.Arch],CPUX64 + je .L1 + mov [I.Arg2.Type],GPR32 +.L1: ret +;----------------------------------------------------------------------------- +BNDX4: mov [I.Arg2.Type],GPR64 + mov [I.RandSize],VQWORD+80h + cmp [I.Arch],CPUX64 + jz .Next + mov [I.RandSize],VDWORD+80h + mov [I.Arg2.Type],GPR32 +.Next: ;jmp BNDX1 +;----------------------------------------------------------------------------- +BNDX1: mov [I.Arg1.Type],BNDRG + ret +;----------------------------------------------------------------------------- +BNDX3: mov [I.Arg1.Type],BNDRG +BNDX2: mov [I.Arg2.Type],BNDRG + ret +;----------------------------------------------------------------------------- +Rtn0F3A14: + mov [I.RandSize],VBYTE+80h + mov dx,TPEXTRB +.L0: BitTR I.Prefixes,P66 + jnc ErrorDec + mov [I.Name],dx + call RM32R32X + mov [I.Arg1.Type],GPR32 + cmp [I.W],0 + jz .L1 + mov [I.Arg1.Type],GPR64 +.L1: call ClearW + FetchB + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al + ret +Rtn0F3A15: + mov [I.RandSize],VWORD+80h + mov dx,TPEXTRW + jmp Rtn0F3A14.L0 +Rtn0F3A16: + mov [I.RandSize],VDWORD+80h + mov dx,TPEXTRD + test [I.W],0 + jz .L1 + mov [I.RandSize],VQWORD+80h + mov dx,TPEXTRQ +.L1: jmp Rtn0F3A14.L0 +Rtn0F3A17: + mov [I.RandSize],VDWORD+80h + mov dx,TEXTRACTPS + jmp Rtn0F3A14.L0 +Rtn0F3A20: + mov [I.RandSize],VBYTE+80h + BitTR I.Prefixes,P66 + jnc ErrorDec + mov [I.Name],TPINSRB + call R32RM32X + FetchB + mov [I.Arg2.Type],GPR32 + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al + ret +Rtn0F3A21: + mov [I.RandSize],VDWORD+80h + BitTR I.Prefixes,P66 + jnc ErrorDec + mov [I.Name],TINSERTPS + call R32RM32X + FetchB + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al + ret +Rtn0F3A22: + call R32RM32X + mov [I.RandSize],VDWORD+80h + BitTR I.Prefixes,P66 + jnc ErrorDec + mov dx,TPINSRD + mov [I.Arg2.Type],GPR32 + cmp [I.W],0 + jz .L1 + mov dx,TPINSRQ + mov [I.Arg2.Type],GPR64 +.L1: mov [I.Name],dx + call ClearW + FetchB +.L2: mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al + ret +Rtn0F3A44: + mov [I.RandSize],VXWORD+80h + mov [I.Name],TPCLMULQDQ + BitTR I.Prefixes,P66 + jnc ErrorDec + call R32RM32X + xor eax,eax + FetchB + cmp al,18 + ja Rtn0F3A22.L2 + mov edx,[rax*2+TabCLMUL] + or dx,dx + jz Rtn0F3A22.L2 + mov [I.Name],dx + ret + +SetArg3Imm: + FetchB + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al + ret + +SetArg3CL: + mov [I.Arg3.Type],GPR08 + mov [I.Arg3.Reg],RRCX + ret + +RtnXOP: mov ebx,R32RM32X + test [I.FlagsXOP],XOPO + jnz .Z1 + mov ebx,RM32R32X +.Z1: call rbx + cmp [I.MMMMM],8 + jnz .Z2 + test [I.FlagsXOP],XOPI + jz .Z2 + FetchB + mov [I.Arg3.Type],80h+1 + mov [I.Arg3.ImmB],al +.Z2: ret +;----------------------------------------------------------------------------- +SetVT3: push CheckVT3 +SetVT: mov [I.Base],-1 + mov [I.Indx],-1 + mov [I.Scale],-1 + mov [I.DispSize],0 + + cmp [I.Arch],CPUX64 + jz .L1 + mov [I.Address],AD32 +.L1: + mov rsi,[I.SaveRSI] + push rax + sub al,XMMRG-ADXX + mov [I.VT],al + call FetchModRM + pop rax + + cmp [I.Arch],CPUX64 + jz .L2 + BitT I.PrefixesCpy,P67 + jnc .L2 + BitTS I.Prefixes,P67 +.L2: + cmp [I.Relative],0 + jnz ErrorDec + ret +;----------------------------------------------------------------------------- +CheckVT3: + cmp [I.Mod],3 + jz ErrorDec + ret +;----------------------------------------------------------------------------- +RtnPINSR?: + test [I.VEX],VEXW + jz .L1 + cmp [I.Arch],CPUX64 + jnz ErrorDec + mov [I.RandSize],VQWORD+80h + mov [I.LastByte],'q' + mov [I.Arg3.Type],GPR64 +.L1: ret +;----------------------------------------------------------------------------- +MoveKandZ: + test byte [I.FlagsEVEX],EVEXS + jnz .L1 + mov al,[I.AAAA] + or al,al + jz .L1 + mov al,'{' + stosb + cmp [I.Syntax],0 + jz .L0 + mov al,'%' + stosb +.L0: + mov al,'k' + stosb + mov al,[I.AAAA] + add al,'0' + stosb + mov al,'}' + stosb +.L1: + mov al,[I.Z] + or al,al + jz .L2 + mov al,'{' + stosb + mov al,'z' + stosb + mov al,'}' + stosb +.L2: + ret +;----------------------------------------------------------------------------- +GetP0P1P2: + ;P0 + lodsb + cmp rsi,r9 + ja .Error + test al,1100b + jnz .Error + mov ah,al + and al,11b + mov [I.MMMMM],al + mov al,ah + + test al,10000000b + setz [I.R] + test al,00010000b + setz dl + shl dl,1 + or [I.R],dl + shl [I.R],3 + + test al,01000000b + setz [I.X] + shl [I.X],3 + + test al,00100000b + setz [I.B] + shl [I.B],3 + + mov al,[I.X] + shl al,1 + mov [I.XX],al + + mov [I.P],1 + + ;P1 + lodsb + cmp rsi,r9 + ja .Error + test al,100b + jz .Error + mov ah,al + and al,11b + mov [I.PP],al + mov al,ah + shr al,3 + and al,1111b + xor al,1111b + mov [I.VVVV],al + mov al,ah + rol al,1 + and al,1b + mov [I.W],al + ;P2 + lodsb + cmp rsi,r9 + ja .Error + mov ah,al + and al,111b + mov [I.AAAA],al + mov al,ah + xor dl,dl + shl al,1 + rcl dl,1 + mov [I.Z],dl + mov al,ah + and al,1000b + xor al,1000b + jz .L1 + add [I.V],16 +.L1: + shl al,1 + or [I.VVVV],al + mov al,ah + and al,1100000b + cmp al,1100000b + shr al,5 + mov [I.LL],al + test ah,10000b + setnz [I.BB] + ; + movzx eax,[I.PP] + mov edx,[rax*4+T6200Tab] + mov ebx,[rax*4+T6238Tab] + mov ecx,[rax*4+T623ATab] + ; + mov al,[I.MMMMM] + or al,al + jz .Error + cmp al,00011b + jne .L2 + mov edx,ecx +.L2: + cmp al,00010b + jne .L3 + mov edx,ebx +.L3: + lodsb + cmp rsi,r9 + ja .Error + mov ebx,edx + ; + mov [I.SaveRSI],rsi + ret + ; +.Error: pop rax + jmp BNDEVEX62.Error +;----------------------------------------------------------------------------- +DetectMULT: + cmp [I.Is62],0 + jz .L2 + mov al,[I.RandSize] + mov ah,1 + cmp al,xW + jz .L1 + mov ah,2 + cmp al,xD + jz .L1 + mov ah,3 + cmp al,xQ + jz .L1 + mov ah,4 + cmp al,xO + jz .L1 + mov ah,5 + cmp al,xY + jz .L1 + mov ah,6 + cmp al,xZ + jz .L1 + xor ah,ah +.L1: + mov [I.MULT],ah +.L2: + ret +;----------------------------------------------------------------------------- +MoveXtoX: + cmp [I.Mod],3 + jz .V1 + cmp [I.BB],0 + jz .V1 + movzx eax,[I.LL] + test byte [I.FlagsEVEX+2],EVEXAA shr 16 + jnz .V0 + cmp [I.RandSize],xQ + jz .V0 + inc eax +.V0: mov esi,dword [rax*2+T1TO] + call MoveStringData +.V1: ret +;----------------------------------------------------------------------------- +MoveSAE1: + cmp [I.Mod],3 + jnz .E1 + test byte [I.FlagsEVEX],EVEXO + jz .L1 + cmp [I.W],0 + jz .E1 +.L1: + test byte [I.FlagsEVEX],EVEXR + jz .E2 + cmp [I.BB],0 + jz .E1 + mov al,',' + stosb + movzx eax,[I.LL] + mov esi,dword [rax*2+TSAE] + call MoveStringData +.E1: ret +.E2: cmp [I.BB],0 + jz .E3 + cmp [I.LL],00b + jnz .E3 +if %B=64 + mov rax,',{sae}' + stosq + sub rdi,2 +else + mov ax,',{' + stosw + mov eax,'sae}' + stosd +end if +.E3: ret +;----------------------------------------------------------------------------- +MoveSAE2: + cmp [I.Mod],3 + jnz .E1 + test byte [I.FlagsEVEX],EVEXO + jz .L1 + cmp [I.W],0 + jz .E1 +.L1: + test byte [I.FlagsEVEX],EVEXR + jz .E2 + cmp [I.BB],0 + jz .E1 + movzx eax,[I.LL] + mov esi,dword [rax*2+TSAE] + call MoveStringData + mov al,',' + stosb +.E1: ret +.E2: cmp [I.BB],0 + jz .E3 + cmp [I.LL],00b + jnz .E3 +if %B=64 + mov rax,'{sae},' + stosq + sub rdi,2 +else + mov eax,'{sae' + stosd + mov ax,'},' + stosw +end if +.E3: ret +;----------------------------------------------------------------------------- +GetVectorAL: + test byte [I.FlagsEVEX],EVEXX + jnz .L1 + mov al,ZMMRG + cmp [I.BB],0 + jnz .L0 + test [I.LL],10b + jnz .L0 + mov al,YMMRG + test [I.LL],01b + jnz .L0 +.L1: mov al,XMMRG +.L0: ret +;----------------------------------------------------------------------------- +GetVectorAndMUL: + test byte [I.FlagsEVEX],EVEXX + jnz .L4 + ; + mov ah,[I.LL] + + mov al,ZMMRG + ; + cmp [I.Mod],3 + jnz .LX + cmp [I.BB],0 + jnz .L0 +.LX: ; + test ah,10b + jnz .L0 + mov al,YMMRG + test ah,01b + jnz .L0 + mov al,XMMRG + ; +.L0: mov ah,al + ; + cmp [I.BB],0 + jnz .L3 + cmp al,YMMRG + jz .L2 + ja .L1 + ret + ; +.L1: call .L2 +.L2: inc [I.RandSize] +.L3: ret +.L4: mov al,XMMRG + mov ah,al + ret +;----------------------------------------------------------------------------- +GetRDRQAH: + mov ah,GPR32 + cmp [I.W],1 + jnz .L1 + mov ah,GPR64 +.L1: ret +;----------------------------------------------------------------------------- +GetRDRQAL: + mov al,GPR32 + cmp [I.W],1 + jnz .L1 + mov al,GPR64 +.L1: ret diff --git a/programs/develop/koldbg/disasm/qopcodes.bin b/programs/develop/koldbg/disasm/qopcodes.bin new file mode 100644 index 0000000000000000000000000000000000000000..55c821e9f3abf9652afc75876f6f12b944507271 GIT binary patch literal 11077 zcmY+K+p^+3l7;;!bvYd!Gf^1!>FR%!3gZK~@CnNX7ajfX^Q}yYO-109D^sb|!LlUF z{NM4dnn|ukXdS8=vx%+Z|kn;V);@ z7w7h`!0q3GrM~*2z65Un4lMP>InaVsL59mQG+cCCxEE7)T=>zWx?2m047(rM@o{dm z^0?dquIj3*&KM#kpsUhV_alR}?3!*3=Oo8zfu6|U>6$}0hCh%+Sr#I76jOHhBk-u_ zF)JBwC4F8v5)kF&=t^fw=gOcQ<87E+5KG#_geQ55C&(^+s;|FBnM77<;lwOW(FMhx zj6}Cn{cAM0(-Mi5KXu98(ae78QtD8fHzK+lv-o1Gvy+uG5Zvo9oGc0=8N8H%Vxota zGfHN3+?4AA%s;tyx{MghrS1g>!5bix zEHX%^!1;sglk1DC+~aXus%x&6JE8pBGF7<-s*#DI=OiUvQ_}i$TBGfps{y#TF{FrF zLJApD5`>|SGsFuCd5jbC6dUHYYpSJ)g$z~BG)4fCWLcxB&2`&IgLqm<7KmpfwzKaB zi+N?lykxOh9iz#bTJ+rjvG3Gpo@X1ZrdGCCDmr*`9rXdu*05 z{O&aSUNL6wnkMc`msKoi6$@EaERf?*uAMF;#&W59!9nl_$Rvvl(%-p0xIVeQxTa84 zOlZ|Pt6GX^way4BroGYiLO4l%J1ki>DP7N2#o(tTitokeq?pAW%ZGZ<+-j}E@V6XJJTW@3|GS&SRH2uyvg@NR&(p?FlF^N zX*?lVkEvuNvMh5^`XZIMEgdh)=hMrUjg(@GMpSGqO8hmy)}d#9Uv`q)Ykun1cJM-{*% z<+yk8=E97W&6db2QnmDL!w4`S6*@bj)P0X{J>b&JHKhx&x3mhh!i6$f3?bQDwY2Tm z4jjCoc4!wgc2xpp2#brAX0~BHD&MwFZLb+UQ3htCU>&<0pu7v~f$EyD6jbvr#tYmk$aoEjvn73Jia z92b_!N%s` zgUj9wtP2uTn8X#rxb;F}PmkCSZda8P`}XjzFuUq$L=_yKU7wieq2AQS%Z0~sojpCC z<;w2mI{WrWQUa}!Ziv$#t* zna&=nnOKnqgkG4m^@&WSvKwL&64Gsxxy|K6Rh7U2p=wG z>eI|&8D*7FCQ0Rzq#nqL(!7mAd}0ejS+I|6cqKEBmg)wkA2z^ExXy&u za(&6Od(DILooDx&2PLIkV-aSl7Zz(J8DSVe`eI-gmYCZDuj;2JpFWF*rK4_#+x7Tr zNE&O)F*`G*P+t=vJ2QNK4db+J*_qdevp+5-Le`cw_l41*ive6kc}0eL_N_ytw(@`T z&*WnJhG@5C-?{A?B7Mo~dxmI#$?C7EZm0E5RE=dP*b7GBR`W`U=%!N?h2&K7dV#!6 zk~7B-zc~o`UGS^3-$#Cka(iUI*=T_$epotw2;Tp)-@Hry=0)=N5V&wbMVrkX(<8h5 z%r3j^l4qBFb~$91x9swsT|Tl4{e3jNgKW|a*``Pt+y>f)MhG9qg=7#u&d_mQYM#49 z%nXEc+brDDNUBJb!;%=smzYt49P2QZ7q+!dc)fALp8B%!YDY#1(l=McyW-pcbJj6c zbXiwb*A?uyl9Pe13Rzbdx|lz^8jY<_32mUKY5^dv2pySqomh9D%462`Jo_DIB^K6Y z&Rb(QmX{x(LIXI0mEqM;xtI(EGLM|O2)QjT+&Dav+5H{e=ix5V<3UounS%{##^92; z6<8i6vuj@j-551HQi@G1BzA>tmas8G;XIqY_XTeVN&qnt9vs=(jq@h5Xv;_ZLOv2o zzE#yanQZ6x!!fef<=lBGXD{>YT9>3-qYuYt zu8UaR241NZMbhdpELJmSCToJtP?jFuxO=8r%Wqe`DWh{|4XyRz7;SemT840roe;Vw zaW6-!3}Z-9?jGgtDR(!je{W&4V5`?{^(H)y=Kt_gA3PFxK03?&@K_Iz_3&5^i}mnW z2r|T1L~fr#gVbm3)K<_qdG1Ba;o!h@qlH^|%6PJ~akVRm&=JDQ@SaVFYPtv1L_#+4 zT68qT3cniST9g+&6XB#xmNi+{U=~e46Vs6L^7I;7xT*@R@*-WV(M(1&3w4+~BRSm^ z431K6wc_4Rj-K~+B9EQW;^9ZPBs+Opk_+!}o+Lv$ca$x0VUQ@d3ON#q27|7O7)CHs*ux1%`nRJDgUF9LeGPh6G8#^&+EA7Nt zg-g$KVltM_`&`T;=6QIvQ_|`=R(BNg)+*riP{NNQ#aOCLEGAg7q_LPw^t?by>daBn z4&hWlq$(s*FTxJ}unkRnQrggTZK>Kb zdol8YRDnTQzI{WQ0x-H6zx=~}`{+|&VR zx{(rYRHtdvAtORYgd5GX9n2FUBj;*4^9-^|QaMpQwbv7Y+Utoh8SUZX3D=lSvnA;o zIuh;`v=X7(0wo!}LUaqsPwSS_Hw_^t>K?PiP@C?%S*&xEq_Kj9smZhZLTHv)(3(nu zcpP6N@wvx}$D$vpXo!b}covrbWQj#Tyy&&F1Xdm&L?YJJBFbx$r(DFk8|ik=>tyX* zTUy(|Tcy`d2kldTJJk<0>(;p#TnO0=a}@@}87FO9U05n=G82EC8i2=KGhD`s(9{dB z&xs72q9?xm{HD8a%7hYg5iT*!H}j}=fK(Xdj0B;_4K&m2CM}Ees7isBpaqe$h-KmJ z8*`)@7U5jr4LZjgF7Gq1K0>qeTH=ZdkdYTDlP)ZmIyam>KEgeb(QIOEEGVK~u3E0b zdDR>up<5;Can?pEnk-FPy_`3rhj)OwTA+T$*L zNC|@$a1fS#+qYw9j(jqn_-@R&6e=sP28N7e zUR4dM?CK{%e0Vu#Kqcq|cVH*mPPUzFJK31a0NHZcSkvd-Ubek#d)fA~@d5_Oc988L z+na1}vc1XnhK=u>^Cy;144>#<=wIkx=wImUo_`2WHJc2Rye7=7=rhMGGoN{8{%*k1 zy*nsfQt9QCf4ZK3y6&3snRN11O*j^OnVzdtA}vaEGGnmI9MW; zmf>o67uqc68ARjZVoWg2vd1(X6@I7bWbmok0pqLon)X*dJ7bKV7NS0t;YSwgQ{|#| z(YQFd2qst%I3K1hKrK8O7^QRSg?A2+iBLEi(lv0Z13rXiHme!^zaH30^iz_c(;^=4 zT^~-nL~$e8O8i> zGsd1abv#Mxah+fVz66JheK!eygcUfR=3=!q)au9Ijkw1gNoimyfW{YM`JbQv67CFh z!@c3b@Xheu@I&~Mi+1<#ZK0ihyI&o$NSXPWyn_kp|$eq za^?S7Ydk3vxdA#($$SZ+=t#(-b4?w?L=v)FJ4C`!Mcq@rYio(?nlm>E5tB5 znd20FpW_sLpEWh#XPcDov!-5tvE7r5#@E|$odD2EzWkVPrUqX<@{$_%43-r zyOwCWV)G&VM_mW( z44gX8&9XN<7`_?48-5sm8h#1QovstL0Cb(W1)%H1EdX67ZUN{zaSLFMbR7n|4zxU$ z#d25%^T*vQufNmjftOtMB9J}Q9AIbQ)Ol`}z2U*|&G6mu!|>DaOK9#iN7Mq)9B~Uk zbHptG%@MZ%G)LS5m?O=>KyyILV_7VRWiWr-y*dBcE#vO}znNt2;^5*FF<1W^idtky KWKHDZ0, temporary equal 0 + +EleSize = 6 ;xxh.Size + +virtual at 0 +Vals:: +rb 64*1024 +end virtual + +macro AddElement Source +{ +local A,B,C,Index,Found +C = 0 +Index = 0 +Found = 0 + if ScanItems + repeat CntItems + Found = 0 + load B fword from Vals:+(%-1)*EleSize+C + load A fword from Source+C + if A=B + Found = % + Break + else + Found = 0 + end if + end repeat + end if + if ~Found + load A fword from Source+C + store fword A at Vals:+CntItems*EleSize+C + dw (CntItems)*EleSize + CntItems = CntItems+1 + else + dw (Found-1)*EleSize + end if +} + +macro CpyElements Dst +{ +local A +Dst rb CntItems*EleSize + repeat CntItems + load A fword from Vals:(%-1)*EleSize + store fword A at Dst+(%-1)*EleSize + end repeat +} diff --git a/programs/develop/koldbg/disasm/selbat.inc b/programs/develop/koldbg/disasm/selbat.inc new file mode 100644 index 0000000000..d8779fc037 --- /dev/null +++ b/programs/develop/koldbg/disasm/selbat.inc @@ -0,0 +1,2375 @@ +InstTab: +;00 +xx TADD,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TADD,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TADD,RM8R8,VBYTE,,_S+_O+_XA+_XR +;01 +xx TADD,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TADD,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TADD,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;02 +xx TADD,R8RM8,VBYTE,,_S+_O +xx TADD,R8RM8,VBYTE,,_S+_O +xx TADD,R8RM8,VBYTE,,_S+_O +;03 +xx TADD,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TADD,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TADD,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;04 +xx TADD,R8I08,VBYTE,RACC,_S +xx TADD,R8I08,VBYTE,RACC,_S +xx TADD,R8I08,VBYTE,RACC,_S +;05 +xx TADD,R16I16, VWORD,RACC,_S+_R+_R64 +xx TADD,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TADD,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;06 +xx TPUSH,AddPointW, VWORD,RES,_S+_A+_R +xx TPUSH,AddPointD,VDWORD,RES,_S+_A+_R +xx TNULL,ErrorDec ,,, +;07 +xx TPOP,AddPointW, VWORD,RES,_S+_A+_R +xx TPOP,AddPointD,VDWORD,RES,_S+_A+_R +xx TNULL,ErrorDec,,, +;08 +xx TOR,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TOR,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TOR,RM8R8,VBYTE,,_S+_O+_XA+_XR +;09 +xx TOR,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TOR,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TOR,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;0A +xx TOR,R8RM8,VBYTE,,_S+_O +xx TOR,R8RM8,VBYTE,,_S+_O +xx TOR,R8RM8,VBYTE,,_S+_O +;0B +xx TOR,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TOR,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TOR,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;0C +xx TOR,R8I08,VBYTE,RACC,_S +xx TOR,R8I08,VBYTE,RACC,_S +xx TOR,R8I08,VBYTE,RACC,_S +;0D +xx TOR,R16I16, VWORD,RACC,_S+_R+_R64 +xx TOR,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TOR,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;0E +xx TPUSH,AddPointW, VWORD,RCS,_S+_A+_R +xx TPUSH,AddPointD,VDWORD,RCS,_S+_A+_R +xx TNULL,ErrorDec ,,, +;0F +xx TNULL,Rtn0F, +xx TNULL,Rtn0F, +xx TNULL,Rtn0F, +;10 +xx TADC,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TADC,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TADC,RM8R8,VBYTE,,_S+_O+_XA+_XR +;11 +xx TADC,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TADC,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TADC,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;12 +xx TADC,R8RM8,VBYTE,,_S+_O +xx TADC,R8RM8,VBYTE,,_S+_O +xx TADC,R8RM8,VBYTE,,_S+_O +;13 +xx TADC,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TADC,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TADC,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;14 +xx TADC,R8I08,VBYTE,RACC,_S +xx TADC,R8I08,VBYTE,RACC,_S +xx TADC,R8I08,VBYTE,RACC,_S +;15 +xx TADC,R16I16, VWORD,RACC,_S+_R+_R64 +xx TADC,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TADC,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;16 +xx TPUSH,AddPointW, VWORD,RSS,_S+_A+_R +xx TPUSH,AddPointD,VDWORD,RSS,_S+_A+_R +xx TNULL,ErrorDec ,,, +;17 +xx TPOP,AddPointW, VWORD,RSS,_S+_A+_R +xx TPOP,AddPointD,VDWORD,RSS,_S+_A+_R +xx TNULL,ErrorDec,,, +;18 +xx TSBB,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TSBB,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TSBB,RM8R8,VBYTE,,_S+_O+_XA+_XR +;19 +xx TSBB,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TSBB,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TSBB,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;1A +xx TSBB,R8RM8,VBYTE,,_S+_O +xx TSBB,R8RM8,VBYTE,,_S+_O +xx TSBB,R8RM8,VBYTE,,_S+_O +;1B +xx TSBB,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TSBB,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TSBB,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;1C +xx TSBB,R8I08,VBYTE,RACC,_S +xx TSBB,R8I08,VBYTE,RACC,_S +xx TSBB,R8I08,VBYTE,RACC,_S +;1D +xx TSBB,R16I16, VWORD,RACC,_S+_R+_R64 +xx TSBB,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TSBB,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;1E +xx TPUSH,AddPointW, VWORD,RDS,_S+_A+_R +xx TPUSH,AddPointD,VDWORD,RDS,_S+_A+_R +xx TNULL,ErrorDec ,,, +;1F +xx TPOP,AddPointW, VWORD,RDS,_S+_A+_R +xx TPOP,AddPointD,VDWORD,RDS,_S+_A+_R +xx TNULL,ErrorDec,,, +;20 +xx TAND,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TAND,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TAND,RM8R8,VBYTE,,_S+_O+_XA+_XR +;21 +xx TAND,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TAND,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TAND,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;22 +xx TAND,R8RM8,VBYTE,,_S+_O +xx TAND,R8RM8,VBYTE,,_S+_O +xx TAND,R8RM8,VBYTE,,_S+_O +;23 +xx TAND,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TAND,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TAND,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;24 +xx TAND,R8I08,VBYTE,RACC,_S +xx TAND,R8I08,VBYTE,RACC,_S +xx TAND,R8I08,VBYTE,RACC,_S +;25 +xx TAND,R16I16, VWORD,RACC,_S+_R+_R64 +xx TAND,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TAND,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;26 +xx TNULL,Rtn262E363E,,,_A +xx TNULL,Rtn262E363E,,,_A +xx TNULL,Rtn262E363E64,,, +;27 +xx TDAA,RtnXX,,,_A +xx TDAA,RtnXX,,,_A +xx TNULL,ErrorDec, +;28 +xx TSUB,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TSUB,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TSUB,RM8R8,VBYTE,,_S+_O+_XA+_XR +;29 +xx TSUB,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TSUB,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TSUB,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;2A +xx TSUB,R8RM8,VBYTE,,_S+_O +xx TSUB,R8RM8,VBYTE,,_S+_O +xx TSUB,R8RM8,VBYTE,,_S+_O +;2B +xx TSUB,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TSUB,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TSUB,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;2C +xx TSUB,R8I08,VBYTE,RACC,_S +xx TSUB,R8I08,VBYTE,RACC,_S +xx TSUB,R8I08,VBYTE,RACC,_S +;2D +xx TSUB,R16I16, VWORD,RACC,_S+_R+_R64 +xx TSUB,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TSUB,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;2E +xx TNULL,Rtn262E363E,,,_A +xx TNULL,Rtn262E363E,,,_A +xx TNULL,Rtn262E363E64,,, +;2F +xx TDAS,RtnXX,,,_A +xx TDAS,RtnXX,,,_A +xx TNULL,ErrorDec, +;30 +xx TXOR,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TXOR,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TXOR,RM8R8,VBYTE,,_S+_O+_XA+_XR +;31 +xx TXOR,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TXOR,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TXOR,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;32 +xx TXOR,R8RM8,VBYTE,,_S+_O +xx TXOR,R8RM8,VBYTE,,_S+_O +xx TXOR,R8RM8,VBYTE,,_S+_O +;33 +xx TXOR,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TXOR,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TXOR,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;34 +xx TXOR,R8I08,VBYTE,RACC,_S +xx TXOR,R8I08,VBYTE,RACC,_S +xx TXOR,R8I08,VBYTE,RACC,_S +;35 +xx TXOR,R16I16, VWORD,RACC,_S+_R+_R64 +xx TXOR,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TXOR,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;36 +xx TNULL,Rtn262E363E,,,_A +xx TNULL,Rtn262E363E,,,_A +xx TNULL,Rtn262E363E64,,, +;37 +xx TAAA,RtnXX,,,_A +xx TAAA,RtnXX,,,_A +xx TNULL,ErrorDec +;38 +xx TCMP,RM8R8,VBYTE,,_S+_O +xx TCMP,RM8R8,VBYTE,,_S+_O +xx TCMP,RM8R8,VBYTE,,_S+_O +;39 +xx TCMP,RM16R16, VWORD,,_S+_O+_R+_R64 +xx TCMP,RM32R32,VDWORD,,_S+_O+_R+_R64 +xx TCMP,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64 +;3A +xx TCMP,R8RM8,VBYTE,,_S+_O +xx TCMP,R8RM8,VBYTE,,_S+_O +xx TCMP,R8RM8,VBYTE,,_S+_O +;3B +xx TCMP,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMP,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMP,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;3C +xx TCMP,R8I08,VBYTE,RACC,_S +xx TCMP,R8I08,VBYTE,RACC,_S +xx TCMP,R8I08,VBYTE,RACC,_S +;3D +xx TCMP,R16I16, VWORD,RACC,_S+_R+_R64 +xx TCMP,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TCMP,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;3E +xx TNULL,Rtn262E363E,,,_A +xx TNULL,Rtn262E363E,,,_A +xx TNULL,Rtn262E363E64,,, +;3F +xx TAAS,RtnXX,,,_A +xx TAAS,RtnXX,,,_A +xx TNULL,ErrorDec +;40 +xx TINC,RtnArgW, VWORD,RRAX,_S+_A+_R +xx TINC,RtnArgD,VDWORD,RRAX,_S+_A+_R +xx TNULL,Rtn4X,,, +;41 +xx TINC,RtnArgW, VWORD,RRCX,_S+_A+_R +xx TINC,RtnArgD,VDWORD,RRCX,_S+_A+_R +xx TNULL,Rtn4X,,, +;42 +xx TINC,RtnArgW, VWORD,RRDX,_S+_A+_R +xx TINC,RtnArgD,VDWORD,RRDX,_S+_A+_R +xx TNULL,Rtn4X,,, +;43 +xx TINC,RtnArgW, VWORD,RRBX,_S+_A+_R +xx TINC,RtnArgD,VDWORD,RRBX,_S+_A+_R +xx TNULL,Rtn4X,,, +;44 +xx TINC,RtnArgW, VWORD,RRSP,_S+_A+_R +xx TINC,RtnArgD,VDWORD,RRSP,_S+_A+_R +xx TNULL,Rtn4X,,, +;45 +xx TINC,RtnArgW, VWORD,RRBP,_S+_A+_R +xx TINC,RtnArgD,VDWORD,RRBP,_S+_A+_R +xx TNULL,Rtn4X,,, +;46 +xx TINC,RtnArgW, VWORD,RRSI,_S+_A+_R +xx TINC,RtnArgD,VDWORD,RRSI,_S+_A+_R +xx TNULL,Rtn4X,,, +;47 +xx TINC,RtnArgW, VWORD,RRDI,_S+_A+_R +xx TINC,RtnArgD,VDWORD,RRDI,_S+_A+_R +xx TNULL,Rtn4X,,, +;48 +xx TDEC,RtnArgW, VWORD,RRAX,_S+_A+_R +xx TDEC,RtnArgD,VDWORD,RRAX,_S+_A+_R +xx TNULL,Rtn4X,,, +;49 +xx TDEC,RtnArgW, VWORD,RRCX,_S+_A+_R +xx TDEC,RtnArgD,VDWORD,RRCX,_S+_A+_R +xx TNULL,Rtn4X,,, +;4A +xx TDEC,RtnArgW, VWORD,RRDX,_S+_A+_R +xx TDEC,RtnArgD,VDWORD,RRDX,_S+_A+_R +xx TNULL,Rtn4X,,, +;4B +xx TDEC,RtnArgW, VWORD,RRBX,_S+_A+_R +xx TDEC,RtnArgD,VDWORD,RRBX,_S+_A+_R +xx TNULL,Rtn4X,,, +;4C +xx TDEC,RtnArgW, VWORD,RRSP,_S+_A+_R +xx TDEC,RtnArgD,VDWORD,RRSP,_S+_A+_R +xx TNULL,Rtn4X,,, +;4D +xx TDEC,RtnArgW, VWORD,RRBP,_S+_A+_R +xx TDEC,RtnArgD,VDWORD,RRBP,_S+_A+_R +xx TNULL,Rtn4X,,, +;4E +xx TDEC,RtnArgW, VWORD,RRSI,_S+_A+_R +xx TDEC,RtnArgD,VDWORD,RRSI,_S+_A+_R +xx TNULL,Rtn4X,,, +;4F +xx TDEC,RtnArgW, VWORD,RRDI,_S+_A+_R +xx TDEC,RtnArgD,VDWORD,RRDI,_S+_A+_R +xx TNULL,Rtn4X,,, +;50 +xx TPUSH,RtnArgW, VWORD,RRAX,_S+_R+_R64 +xx TPUSH,RtnArgD,VDWORD,RRAX,_S+_A+_R+_R64 +xx TPUSH,RtnArgQ,VQWORD,RRAX,_S+_R+_R64 +;51 +xx TPUSH,RtnArgW, VWORD,RRCX,_S+_R+_R64 +xx TPUSH,RtnArgD,VDWORD,RRCX,_S+_A+_R+_R64 +xx TPUSH,RtnArgQ,VQWORD,RRCX,_S+_R+_R64 +;52 +xx TPUSH,RtnArgW, VWORD,RRDX,_S+_R+_R64 +xx TPUSH,RtnArgD,VDWORD,RRDX,_S+_A+_R+_R64 +xx TPUSH,RtnArgQ,VQWORD,RRDX,_S+_R+_R64 +;53 +xx TPUSH,RtnArgW, VWORD,RRBX,_S+_R+_R64 +xx TPUSH,RtnArgD,VDWORD,RRBX,_S+_A+_R+_R64 +xx TPUSH,RtnArgQ,VQWORD,RRBX,_S+_R+_R64 +;54 +xx TPUSH,RtnArgW, VWORD,RRSP,_S+_R+_R64 +xx TPUSH,RtnArgD,VDWORD,RRSP,_S+_A+_R+_R64 +xx TPUSH,RtnArgQ,VQWORD,RRSP,_S+_R+_R64 +;55 +xx TPUSH,RtnArgW, VWORD,RRBP,_S+_R+_R64 +xx TPUSH,RtnArgD,VDWORD,RRBP,_S+_A+_R+_R64 +xx TPUSH,RtnArgQ,VQWORD,RRBP,_S+_R+_R64 +;56 +xx TPUSH,RtnArgW, VWORD,RRSI,_S+_R+_R64 +xx TPUSH,RtnArgD,VDWORD,RRSI,_S+_A+_R+_R64 +xx TPUSH,RtnArgQ,VQWORD,RRSI,_S+_R+_R64 +;57 +xx TPUSH,RtnArgW, VWORD,RRDI,_S+_R+_R64 +xx TPUSH,RtnArgD,VDWORD,RRDI,_S+_A+_R+_R64 +xx TPUSH,RtnArgQ,VQWORD,RRDI,_S+_R+_R64 +;58 +xx TPOP,RtnArgW, VWORD,RRAX,_S+_R+_R64 +xx TPOP,RtnArgD,VDWORD,RRAX,_S+_A+_R+_R64 +xx TPOP,RtnArgQ,VQWORD,RRAX,_S+_R+_R64 +;59 +xx TPOP,RtnArgW, VWORD,RRCX,_S+_R+_R64 +xx TPOP,RtnArgD,VDWORD,RRCX,_S+_A+_R+_R64 +xx TPOP,RtnArgQ,VQWORD,RRCX,_S+_R+_R64 +;5A +xx TPOP,RtnArgW, VWORD,RRDX,_S+_R+_R64 +xx TPOP,RtnArgD,VDWORD,RRDX,_S+_A+_R+_R64 +xx TPOP,RtnArgQ,VQWORD,RRDX,_S+_R+_R64 +;5B +xx TPOP,RtnArgW, VWORD,RRBX,_S+_R+_R64 +xx TPOP,RtnArgD,VDWORD,RRBX,_S+_A+_R+_R64 +xx TPOP,RtnArgQ,VQWORD,RRBX,_S+_R+_R64 +;5C +xx TPOP,RtnArgW, VWORD,RRSP,_S+_R+_R64 +xx TPOP,RtnArgD,VDWORD,RRSP,_S+_A+_R+_R64 +xx TPOP,RtnArgQ,VQWORD,RRSP,_S+_R+_R64 +;5D +xx TPOP,RtnArgW, VWORD,RRBP,_S+_R+_R64 +xx TPOP,RtnArgD,VDWORD,RRBP,_S+_A+_R+_R64 +xx TPOP,RtnArgQ,VQWORD,RRBP,_S+_R+_R64 +;5E +xx TPOP,RtnArgW, VWORD,RRSI,_S+_R+_R64 +xx TPOP,RtnArgD,VDWORD,RRSI,_S+_A+_R+_R64 +xx TPOP,RtnArgQ,VQWORD,RRSI,_S+_R+_R64 +;5F +xx TPOP,RtnArgW, VWORD,RRDI,_S+_R+_R64 +xx TPOP,RtnArgD,VDWORD,RRDI,_S+_A+_R+_R64 +xx TPOP,RtnArgQ,VQWORD,RRDI,_S+_R+_R64 +;60 +xx TPUSHA ,RtnXX,VWORD,,_S+_A+_R +xx TPUSHAD,RndSizeD60,VDWORD,,_S+_A+_R +xx TNULL,ErrorDec,,, +;61 +xx TPOPA ,RtnXX,VWORD,,_S+_A+_R +xx TPOPAD,RndSizeD61,VDWORD,,_S+_A+_R +xx TNULL,ErrorDec,,, +;62 +xx TBOUND,BNDEVEX62,,,_S+_A +xx TBOUND,BNDEVEX62,,,_S+_A +xx TNULL ,EVEX62,,, +;63 +xx TARPL,RM16R16,VWORD,,_S+_A+_O+_R48 +xx TARPL,RM16R16,VWORD,,_S+_A+_O+_R48 +xx TNULL,RtnMOVSXD,,,_O+_R48 +;64 +xx TNULL,Rtn6465,,, +xx TNULL,Rtn6465,,, +xx TNULL,Rtn6465,,, +;65 +xx TNULL,Rtn6465,,, +xx TNULL,Rtn6465,,, +xx TNULL,Rtn6465,,, +;66 +xx TNULL,Rtn66,,, +xx TNULL,Rtn66,,, +xx TNULL,Rtn66,,, +;67 +xx TNULL,Rtn67,,, +xx TNULL,Rtn67,,, +xx TNULL,Rtn67,,, +;68 +xx TPUSH,PushI16, VWORD,,_S+_R+_R64 +xx TPUSH,PushI32,VDWORD,,_S+_A+_R+_R64 +xx TPUSH,PushI64,VQWORD,,_S+_R+_R64 +;69 +xx TIMUL,R16RM16I16, VWORD,,_S+_O+_R+_R64 +xx TIMUL,R32RM32I32,VDWORD,,_S+_O+_R+_R64 +xx TIMUL,R64RM64I32,VQWORD,,_S+_R48+_O+_R+_R64 +;6A +xx TPUSH,PushSI16, VWORD,,_S+_R+_R64 +xx TPUSH,PushSI32,VDWORD,,_S+_A+_R+_R64 +xx TPUSH,PushSI64,VQWORD,,_S+_R+_R64 +;6B +xx TIMUL,R16RM16SI16, VWORD,,_S+_O+_R+_R64 +xx TIMUL,R32RM32SI32,VDWORD,,_S+_O+_R+_R64 +xx TIMUL,R64RM64SI32,VQWORD,,_S+_O+_R48+_R+_R64 +;6C +xx TINSB,RtnINSX,VBYTE,,_S +xx TINSB,RtnINSX,VBYTE,,_S +xx TINSB,RtnINSX,VBYTE,,_S +;6D +xx TINSW,RtnINSX, VWORD,,_S+_R+_R64 +xx TINSD,RtnINSX,VDWORD,,_S+_R+_R64 +xx TINSD,RtnINSX,VDWORD,,_S+_R+_R64 +;6E +xx TOUTSB,RtnOUTSX,VBYTE,,_S +xx TOUTSB,RtnOUTSX,VBYTE,,_S +xx TOUTSB,RtnOUTSX,VBYTE,,_S +;6F +xx TOUTSW,RtnOUTSX, VWORD,,_S+_R+_R64 +xx TOUTSD,RtnOUTSX,VDWORD,,_S+_R+_R64 +xx TOUTSD,RtnOUTSX,VDWORD,,_S+_R+_R64 +;70 +xx TJO,DODISPB,,,_J+_B +xx TJO,DODISPB,,,_J+_B +xx TJO,DODISPB,,,_J+_B +;71 +xx TJNO,DODISPB,,,_J+_B +xx TJNO,DODISPB,,,_J+_B +xx TJNO,DODISPB,,,_J+_B +;72 ò +xx TJB,DODISPB,,,_J+_B +xx TJB,DODISPB,,,_J+_B +xx TJB,DODISPB,,,_J+_B +;73 +xx TJAE,DODISPB,,,_J+_B +xx TJAE,DODISPB,,,_J+_B +xx TJAE,DODISPB,,,_J+_B +;74 +xx TJZ,DODISPB,,,_J+_B +xx TJZ,DODISPB,,,_J+_B +xx TJZ,DODISPB,,,_J+_B +;75 +xx TJNZ,DODISPB,,,_J+_B +xx TJNZ,DODISPB,,,_J+_B +xx TJNZ,DODISPB,,,_J+_B +;76 +xx TJBE,DODISPB,,,_J+_B +xx TJBE,DODISPB,,,_J+_B +xx TJBE,DODISPB,,,_J+_B +;77 +xx TJA,DODISPB,,,_J+_B +xx TJA,DODISPB,,,_J+_B +xx TJA,DODISPB,,,_J+_B +;78 +xx TJS,DODISPB,,,_J+_B +xx TJS,DODISPB,,,_J+_B +xx TJS,DODISPB,,,_J+_B +;79 +xx TJNS,DODISPB,,,_J+_B +xx TJNS,DODISPB,,,_J+_B +xx TJNS,DODISPB,,,_J+_B +;7A +xx TJP,DODISPB,,,_J+_B +xx TJP,DODISPB,,,_J+_B +xx TJP,DODISPB,,,_J+_B +;7B +xx TJNP,DODISPB,,,_J+_B +xx TJNP,DODISPB,,,_J+_B +xx TJNP,DODISPB,,,_J+_B +;7C +xx TJL,DODISPB,,,_J+_B +xx TJL,DODISPB,,,_J+_B +xx TJL,DODISPB,,,_J+_B +;7D +xx TJGE,DODISPB,,,_J+_B +xx TJGE,DODISPB,,,_J+_B +xx TJGE,DODISPB,,,_J+_B +;7E +xx TJLE,DODISPB,,,_J+_B +xx TJLE,DODISPB,,,_J+_B +xx TJLE,DODISPB,,,_J+_B +;7F +xx TJG,DODISPB,,,_J+_B +xx TJG,DODISPB,,,_J+_B +xx TJG,DODISPB,,,_J+_B +;80 +xx TNULL,EXTINSONE,,EXT80,_E +xx TNULL,EXTINSONE,,EXT80,_E +xx TNULL,EXTINSONE,,EXT80,_E +;81 +xx TNULL,EXTINST,,EXT81,_E +xx TNULL,EXTINST,,EXT81,_E +xx TNULL,EXTINST,,EXT81,_E +;82 +xx TNULL,EXTINSONE,,EXT82,_A+_E +xx TNULL,EXTINSONE,,EXT82,_A+_E +xx TNULL,ErrorDec ,,EXT82,_E +;83 +xx TNULL,EXTINST,,EXT83,_E +xx TNULL,EXTINST,,EXT83,_E +xx TNULL,EXTINST,,EXT83,_E +;84 +xx TTEST,RM8R8,VBYTE,,_S+_O +xx TTEST,RM8R8,VBYTE,,_S+_O +xx TTEST,RM8R8,VBYTE,,_S+_O +;85 +xx TTEST,RM16R16, VWORD,,_S+_O+_R+_R64 +xx TTEST,RM32R32,VDWORD,,_S+_O+_R+_R64 +xx TTEST,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64 +;86 +xx TXCHG,RM8R8,VBYTE,,_S+_O+_XA+_XR+_L +xx TXCHG,RM8R8,VBYTE,,_S+_O+_XA+_XR+_L +xx TXCHG,RM8R8,VBYTE,,_S+_O+_XA+_XR+_L +;87 +xx TXCHG,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR+_L +xx TXCHG,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR+_L +xx TXCHG,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR+_L +;88 +xx TMOV,RM8R8,VBYTE,,_S+_O+_XR+_L +xx TMOV,RM8R8,VBYTE,,_S+_O+_XR+_L +xx TMOV,RM8R8,VBYTE,,_S+_O+_XR+_L +;89 +xx TMOV,RM16R16, VWORD,,_S+_O+_R+_R64+_XR+_L +xx TMOV,RM32R32,VDWORD,,_S+_O+_R+_R64+_XR+_L +xx TMOV,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XR+_L +;8A +xx TMOV,R8RM8,VBYTE,,_S+_O +xx TMOV,R8RM8,VBYTE,,_S+_O +xx TMOV,R8RM8,VBYTE,,_S+_O +;8B +xx TMOV,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TMOV,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TMOV,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;8C +xx TMOV,RM16SEG,VWORD,,_O+_R+_R64 +xx TMOV,RM32SEG,VWORD,,_O+_R+_R64 +xx TMOV,RM64SEG,VWORD,,_R48+_O+_R+_R64 +;8D +xx TLEA,R16RM16L, VWORD,,_S+_O+_R+_R64 +xx TLEA,R32RM32L,VDWORD,,_S+_O+_R+_R64 +xx TLEA,R64RM64L,VQWORD,,_S+_R48+_O+_R+_R64 +;8E +xx TMOV,SEGRM16,VWORD,,_O+_R+_R64 +xx TMOV,SEGRM32,VWORD,,_O+_R+_R64 +xx TMOV,SEGRM64,VWORD,,_R48+_O+_R+_R64 +;8F +xx TNULL,Rtn8F,,EXT8F,_E +xx TNULL,Rtn8F,,EXT8F,_E +xx TNULL,Rtn8F,,EXT8F,_E +;90 +xx TXCHG,Rtn9X16, VWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X32,VDWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X64,VQWORD,,_S+_R48+_R+_R64 +;91 +xx TXCHG,Rtn9X16, VWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X32,VDWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X64,VQWORD,,_S+_R48+_R+_R64 +;92 +xx TXCHG,Rtn9X16, VWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X32,VDWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X64,VQWORD,,_S+_R48+_R+_R64 +;93 +xx TXCHG,Rtn9X16, VWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X32,VDWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X64,VQWORD,,_S+_R48+_R+_R64 +;94 +xx TXCHG,Rtn9X16, VWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X32,VDWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X64,VQWORD,,_S+_R48+_R+_R64 +;95 +xx TXCHG,Rtn9X16, VWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X32,VDWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X64,VQWORD,,_S+_R48+_R+_R64 +;96 +xx TXCHG,Rtn9X16, VWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X32,VDWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X64,VQWORD,,_S+_R48+_R+_R64 +;97 +xx TXCHG,Rtn9X16, VWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X32,VDWORD,,_S+_R+_R64 +xx TXCHG,Rtn9X64,VQWORD,,_S+_R48+_R+_R64 +;98 +xx TCBW ,Rtn9816,,,_R+_R64 +xx TCWDE,Rtn9832,,,_R+_R64 +xx TCDQE,Rtn9864,,,_R48+_R+_R64 +;99 +xx TCWD,Rtn9916,,,_R+_R64 +xx TCDQ,Rtn9932,,,_R+_R64 +xx TCQO,Rtn9964,,,_R48+_R+_R64 +;9A +xx TCALL,Rtn9A,,,_A+_R +xx TCALL,Rtn9A,,,_A+_R +xx TCALL,ErrorDec,,,_R +;9B +xx TNULL,Rtn9B,,, +xx TNULL,Rtn9B,,, +xx TNULL,Rtn9B,,, +;9C +xx TPUSHF,RtnF16, VWORD,,_S+_R+_R64 +xx TPUSHF,RtnF32,VDWORD,,_S+_A+_R+_R64 +xx TPUSHF,RtnF64,VQWORD,,_S+_R+_R64 +;9D +xx TPOPF,RtnF16, VWORD,,_S+_R+_R64 +xx TPOPF,RtnF32,VDWORD,,_S+_A+_R+_R64 +xx TPOPF,RtnF64,VQWORD,,_S+_R+_R64 +;9E +xx TSAHF,RtnXX, +xx TSAHF,RtnXX, +xx TSAHF,RtnXX, +;9F +xx TLAHF,RtnXX, +xx TLAHF,RtnXX, +xx TLAHF,RtnXX, +;A0 +xx TMOV,RtnA0,VBYTE,,_S+_O +xx TMOV,RtnA0,VBYTE,,_S+_O +xx TMOV,RtnA0,VBYTE,,_S+_O +;A1 +xx TMOV,RtnA1,,,_S+_O+_R+_R64 +xx TMOV,RtnA1,,,_S+_O+_R+_R64 +xx TMOV,RtnA1,,,_S+_R48+_O+_R+_R64 +;A2 +xx TMOV,RtnA2,VBYTE,,_S+_O +xx TMOV,RtnA2,VBYTE,,_S+_O +xx TMOV,RtnA2,VBYTE,,_S+_O +;A3 +xx TMOV,RtnA3,,,_S+_O+_R+_R64 +xx TMOV,RtnA3,,,_S+_O+_R+_R64 +xx TMOV,RtnA3,,,_S+_R48+_O+_R+_R64 +;A4 +xx TMOVSB,RtnMOVX,VBYTE,,_S +xx TMOVSB,RtnMOVX,VBYTE,,_S +xx TMOVSB,RtnMOVX,VBYTE,,_S +;A5 +xx TMOVSW,RtnMOVX, VWORD,,_S+_R+_R64 +xx TMOVSD,RtnMOVX,VDWORD,,_S+_R+_R64 +xx TMOVSQ,RtnMOVX,VQWORD,,_S+_R48+_R+_R64 +;A6 +xx TCMPSB,RtnCMPX,VBYTE,,_S +xx TCMPSB,RtnCMPX,VBYTE,,_S +xx TCMPSB,RtnCMPX,VBYTE,,_S +;A7 +xx TCMPSW,RtnCMPX, VWORD,,_S+_R+_R64 +xx TCMPSD,RtnCMPX,VDWORD,,_S+_R+_R64 +xx TCMPSQ,RtnCMPX,VQWORD,,_S+_R48+_R+_R64 +;A8 +xx TTEST,R8I08,VBYTE,RACC,_S +xx TTEST,R8I08,VBYTE,RACC,_S +xx TTEST,R8I08,VBYTE,RACC,_S +;A9 +xx TTEST,R16I16, VWORD,RACC,_S+_R+_R64 +xx TTEST,R32I32,VDWORD,RACC,_S+_R+_R64 +xx TTEST,R64I32,VQWORD,RACC,_S+_R48+_R+_R64 +;AA +xx TSTOSB,RtnSTOX,VBYTE,,_S +xx TSTOSB,RtnSTOX,VBYTE,,_S +xx TSTOSB,RtnSTOX,VBYTE,,_S +;AB +xx TSTOSW,RtnSTOX, VWORD,,_S+_R+_R64 +xx TSTOSD,RtnSTOX,VDWORD,,_S+_R+_R64 +xx TSTOSQ,RtnSTOX,VQWORD,,_S+_R48+_R+_R64 +;AC +xx TLODSB,RtnLODX,VBYTE,,_S +xx TLODSB,RtnLODX,VBYTE,,_S +xx TLODSB,RtnLODX,VBYTE,,_S +;AD +xx TLODSW,RtnLODX, VWORD,,_S+_R+_R64 +xx TLODSD,RtnLODX,VDWORD,,_S+_R48+_R+_R64 +xx TLODSQ,RtnLODX,VQWORD,,_S+_R48+_R+_R64 +;AE +xx TSCASB,RtnSCAX,VBYTE,,_S +xx TSCASB,RtnSCAX,VBYTE,,_S +xx TSCASB,RtnSCAX,VBYTE,,_S +;AF +xx TSCASW,RtnSCAX, VWORD,,_S+_R+_R64 +xx TSCASD,RtnSCAX,VDWORD,,_S+_R+_R64 +xx TSCASQ,RtnSCAX,VQWORD,,_S+_R48+_R+_R64 +;B0 +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +;B1 +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +;B2 +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +;B3 +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +;B4 +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +;B5 +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +;B6 +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +;B7 +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +xx TMOV,R8IMM8,VBYTE,,_S +;B8 +xx TMOV,R16IMM16, VWORD,,_S+_R+_R64 +xx TMOV,R32IMM32,VDWORD,,_S+_R+_R64 +xx TMOV,R64IMM64,VQWORD,,_S+_R48+_R+_R64 +;B9 +xx TMOV,R16IMM16, VWORD,,_S+_R+_R64 +xx TMOV,R32IMM32,VDWORD,,_S+_R+_R64 +xx TMOV,R64IMM64,VQWORD,,_S+_R48+_R+_R64 +;BA +xx TMOV,R16IMM16, VWORD,,_S+_R+_R64 +xx TMOV,R32IMM32,VDWORD,,_S+_R+_R64 +xx TMOV,R64IMM64,VQWORD,,_S+_R48+_R+_R64 +;BB +xx TMOV,R16IMM16, VWORD,,_S+_R+_R64 +xx TMOV,R32IMM32,VDWORD,,_S+_R+_R64 +xx TMOV,R64IMM64,VQWORD,,_S+_R48+_R+_R64 +;BC +xx TMOV,R16IMM16, VWORD,,_S+_R+_R64 +xx TMOV,R32IMM32,VDWORD,,_S+_R+_R64 +xx TMOV,R64IMM64,VQWORD,,_S+_R48+_R+_R64 +;BD +xx TMOV,R16IMM16, VWORD,,_S+_R+_R64 +xx TMOV,R32IMM32,VDWORD,,_S+_R+_R64 +xx TMOV,R64IMM64,VQWORD,,_S+_R48+_R+_R64 +;BE +xx TMOV,R16IMM16, VWORD,,_S+_R+_R64 +xx TMOV,R32IMM32,VDWORD,,_S+_R+_R64 +xx TMOV,R64IMM64,VQWORD,,_S+_R48+_R+_R64 +;BF +xx TMOV,R16IMM16, VWORD,,_S+_R+_R64 +xx TMOV,R32IMM32,VDWORD,,_S+_R+_R64 +xx TMOV,R64IMM64,VQWORD,,_S+_R48+_R+_R64 +;C0 +xx TNULL,EXTINSONE,,EXTC0,_E +xx TNULL,EXTINSONE,,EXTC0,_E +xx TNULL,EXTINSONE,,EXTC0,_E +;C1 +xx TNULL,EXTINST,,EXTC1,_E +xx TNULL,EXTINST,,EXTC1,_E +xx TNULL,EXTINST,,EXTC1,_E +;C2 +xx TRET,RtnC216, VWORD,,_S+_R+_R64+_B +xx TRET,RtnC232,VDWORD,,_S+_A+_R+_R64+_B +xx TRET,RtnC264,VQWORD,,_S+_R+_R64+_B +;C3 +xx TRET,RtnC316, VWORD,,_S+_R+_R64+_B +xx TRET,RtnC332,VDWORD,,_S+_A+_R+_R64+_B +xx TRET,RtnC364,VQWORD,,_S+_R+_R64+_B +;C4 +xx TLES,R16RM16C4,VDWORD,,_A +xx TLES,R32RM32C4,VFWORD,,_A +xx TLES,RtnAVX2C4, +;C5 +xx TLDS,R16RM16C5,VDWORD,,_A +xx TLDS,R32RM32C5,VFWORD,,_A +xx TLDS,RtnAVX2C5, +;C6 +xx TNULL,RtnC6,,EXTC6,_E +xx TNULL,RtnC6,,EXTC6,_E +xx TNULL,RtnC6,,EXTC6,_E +;C7 +xx TNULL,RtnC7,,EXTC7,_E +xx TNULL,RtnC7,,EXTC7,_E +xx TNULL,RtnC7,,EXTC7,_E +;C8 +xx TENTER,RtnC816,,,_R+_R64 +xx TENTER,RtnC832,,,_A+_R+_R64 +xx TENTER,RtnC864,,,_R+_R64 +;C9 +xx TLEAVE,RtnC916,,,_R+_R64 +xx TLEAVE,RtnC932,,,_A+_R+_R64 +xx TLEAVE,RtnC964,,,_R+_R64 +;CA +xx TRETF,RtnC216, VWORD,,_S+_R+_R64 +xx TRETF,RtnC232,VDWORD,,_S+_A+_R+_R64 +xx TRETF,RtnC264,VQWORD,,_S+_R+_R64 +;CB +xx TRETF,RtnC316, VWORD,,_S+_R+_R64 +xx TRETF,RtnC332,VDWORD,,_S+_A+_R+_R64 +xx TRETF,RtnC364,VQWORD,,_S+_R+_R64 +;CC +xx TINT3,RtnXX, +xx TINT3,RtnXX, +xx TINT3,RtnXX, +;CD +xx TNULL,RtnCD, +xx TNULL,RtnCD, +xx TNULL,RtnCD, +;CE +xx TINTO,RtnXX,,,_A +xx TINTO,RtnXX,,,_A +xx TINTO,ErrorDec, +;CF +xx TIRET,RtnC316, VWORD,,_S+_R+_R64 +xx TIRET,RtnC332,VDWORD,,_S+_A+_R+_R64 +xx TIRET,RtnC364,VQWORD,,_S+_R+_R64 +;D0 +xx TNULL,EXTINSONE,,EXTD0,_E +xx TNULL,EXTINSONE,,EXTD0,_E +xx TNULL,EXTINSONE,,EXTD0,_E +;D1 +xx TNULL,EXTINST,,EXTD1,_E +xx TNULL,EXTINST,,EXTD1,_E +xx TNULL,EXTINST,,EXTD1,_E +;D2 +xx TNULL,EXTINSONE,,EXTD2,_E +xx TNULL,EXTINSONE,,EXTD2,_E +xx TNULL,EXTINSONE,,EXTD2,_E +;D3 +xx TNULL,EXTINST,,EXTD3,_E +xx TNULL,EXTINST,,EXTD3,_E +xx TNULL,EXTINST,,EXTD3,_E +;D4 +xx TAAM,LoseByte,,,_A +xx TAAM,LoseByte,,,_A +xx TAAM,ErrorDec +;D5 +xx TAAD,LoseByte,,,_A +xx TAAD,LoseByte,,,_A +xx TAAD,ErrorDec +;D6 +xx TSALC,RtnXX,,,_A +xx TSALC,RtnXX,,,_A +xx TSALC,ErrorDec +;D7 +xx TXLATB,RtnD7, +xx TXLATB,RtnD7, +xx TXLATB,RtnD7, +;D8 +xx TNULL,EXTINSONEFLT,,EXTD8,_E +xx TNULL,EXTINSONEFLT,,EXTD8,_E +xx TNULL,EXTINSONEFLT,,EXTD8,_E +;D9 +xx TNULL,EXTINSONEFLT,,EXTD9,_E +xx TNULL,EXTINSONEFLT,,EXTD9,_E +xx TNULL,EXTINSONEFLT,,EXTD9,_E +;DA +xx TNULL,EXTINSONE,,EXTDA,_E +xx TNULL,EXTINSONE,,EXTDA,_E +xx TNULL,EXTINSONE,,EXTDA,_E +;DB +xx TNULL,EXTINSONE,,EXTDB,_E +xx TNULL,EXTINSONE,,EXTDB,_E +xx TNULL,EXTINSONE,,EXTDB,_E +;DC +xx TNULL,EXTINSONEFLT,,EXTDC,_E +xx TNULL,EXTINSONEFLT,,EXTDC,_E +xx TNULL,EXTINSONEFLT,,EXTDC,_E +;DD +xx TNULL,EXTINSONEFLT,,EXTDD,_E +xx TNULL,EXTINSONEFLT,,EXTDD,_E +xx TNULL,EXTINSONEFLT,,EXTDD,_E +;DE +xx TNULL,EXTINSONEFLT,,EXTDE,_E +xx TNULL,EXTINSONEFLT,,EXTDE,_E +xx TNULL,EXTINSONEFLT,,EXTDE,_E +;DF +xx TNULL,EXTINSONEFLT,,EXTDF,_E +xx TNULL,EXTINSONEFLT,,EXTDF,_E +xx TNULL,EXTINSONEFLT,,EXTDF,_E +;E0 +xx TLOOPNZ,RtnE0, +xx TLOOPNZ,RtnE0, +xx TLOOPNZ,RtnE0, +;E1 +xx TLOOPZ,RtnE1, +xx TLOOPZ,RtnE1, +xx TLOOPZ,RtnE1, +;E2 +xx TLOOP,RtnE2, +xx TLOOP,RtnE2, +xx TLOOP,RtnE2, +;E3 +xx TNULL,RtnE3, +xx TNULL,RtnE3, +xx TNULL,RtnE3, +;E4 +xx TIN,RtnE4, +xx TIN,RtnE4, +xx TIN,RtnE4, +;E5 +xx TIN,RtnE516,,,_R+_R64 +xx TIN,RtnE532,,,_R+_R64 +xx TIN,RtnE532,,,_R+_R64 +;E6 +xx TOUT,RtnE6, +xx TOUT,RtnE6, +xx TOUT,RtnE6, +;E7 +xx TOUT,RtnE716,,,_R+_R64 +xx TOUT,RtnE732,,,_R+_R64 +xx TOUT,RtnE732,,,_R+_R64 +;E8 +xx TCALL,DODISPW,,,_R+_R64+_B +xx TCALL,DODISPD,,,_R+_R64+_B +xx TCALL,DODISPD,,,_R+_R64+_B +;E9 +xx TJMP,DODISPW,,,_R+_R64+_B +xx TJMP,DODISPD,,,_R+_R64+_B +xx TJMP,DODISPD,,,_R+_R64+_B +;EA +xx TJMP,RtnEA,,,_A+_R +xx TJMP,RtnEA,,,_A+_R +xx TJMP,ErrorDec,,,_R +;EB +xx TJMP,DODISPBS,,, +xx TJMP,DODISPBS,,, +xx TJMP,DODISPBS,,, +;EC +xx TIN,RtnEC, +xx TIN,RtnEC, +xx TIN,RtnEC, +;ED, +xx TIN,RtnED16,,,_R+_R64 +xx TIN,RtnED32,,,_R+_R64 +xx TIN,RtnED32,,,_R+_R64 +;EE +xx TOUT,RtnEE, +xx TOUT,RtnEE, +xx TOUT,RtnEE, +;EF +xx TOUT,RtnEF16,,,_R+_R64 +xx TOUT,RtnEF32,,,_R+_R64 +xx TOUT,RtnEF32,,,_R+_R64 +;F0 +xx TNULL,RtnF0,,, +xx TNULL,RtnF0,,, +xx TNULL,RtnF0,,, +;F1 +xx TINT1,RtnF1, +xx TINT1,RtnF1, +xx TINT1,RtnF1, +;F2 +xx TNULL,RtnF2,,, +xx TNULL,RtnF2,,, +xx TNULL,RtnF2,,, +;F3 +xx TNULL,RtnF3,,, +xx TNULL,RtnF3,,, +xx TNULL,RtnF3,,, +;F4 +xx THLT,RtnXX, +xx THLT,RtnXX, +xx THLT,RtnXX, +;F5 +xx TCMC,RtnXX, +xx TCMC,RtnXX, +xx TCMC,RtnXX, +;F6 +xx TNULL,EXTINSONE,,EXTF6,_E +xx TNULL,EXTINSONE,,EXTF6,_E +xx TNULL,EXTINSONE,,EXTF6,_E +;F7 +xx TNULL,EXTINST,,EXTF7,_E +xx TNULL,EXTINST,,EXTF7,_E +xx TNULL,EXTINST,,EXTF7,_E +;F8 +xx TCLC,RtnXX, +xx TCLC,RtnXX, +xx TCLC,RtnXX, +;F9 +xx TSTC,RtnXX, +xx TSTC,RtnXX, +xx TSTC,RtnXX, +;FA +xx TCLI,RtnXX, +xx TCLI,RtnXX, +xx TCLI,RtnXX, +;FB +xx TSTI,RtnXX, +xx TSTI,RtnXX, +xx TSTI,RtnXX, +;FC +xx TCLD,RtnXX, +xx TCLD,RtnXX, +xx TCLD,RtnXX, +;FD +xx TSTD,RtnXX, +xx TSTD,RtnXX, +xx TSTD,RtnXX, +;FE +xx TNULL,EXTINSONE,,EXTFE,_E +xx TNULL,EXTINSONE,,EXTFE,_E +xx TNULL,EXTINSONE,,EXTFE,_E +;FF +xx TNULL,EXTINSTFF,,EXTFF,_E +xx TNULL,EXTINSTFF,,EXTFF,_E +xx TNULL,EXTINSTFF,,EXTFF,_E +;----------------------------------------------------------------------------- +EXT80: ;One table +EXT82: ;One table +;0 +xx TADD,RM8IMM8,VBYTE,,_S+_XA+_XR +;1 +xx TOR ,RM8IMM8,VBYTE,,_S+_XA+_XR +;2 +xx TADC,RM8IMM8,VBYTE,,_S+_XA+_XR +;3 +xx TSBB,RM8IMM8,VBYTE,,_S+_XA+_XR +;4 +xx TAND,RM8IMM8,VBYTE,,_S+_XA+_XR +;5 +xx TSUB,RM8IMM8,VBYTE,,_S+_XA+_XR +;6 +xx TXOR,RM8IMM8,VBYTE,,_S+_XA+_XR +;7 +xx TCMP,RM8IMM8,VBYTE,,_S +;----------------------------------------------------------------------------- +EXT81: +;0 +xx TADD,RM16IMM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TADD,RM32IMM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TADD,RM64IMM32,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;1 +xx TOR ,RM16IMM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TOR ,RM32IMM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TOR ,RM64IMM32,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;2 +xx TADC,RM16IMM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TADC,RM32IMM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TADC,RM64IMM32,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;3 +xx TSBB,RM16IMM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TSBB,RM32IMM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TSBB,RM64IMM32,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;4 +xx TAND,RM16IMM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TAND,RM32IMM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TAND,RM64IMM32,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;5 +xx TSUB,RM16IMM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TSUB,RM32IMM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TSUB,RM64IMM32,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;6 +xx TXOR,RM16IMM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TXOR,RM32IMM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TXOR,RM64IMM32,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;7 +xx TCMP,RM16IMM16, VWORD,,_S+_R+_R64 +xx TCMP,RM32IMM32,VDWORD,,_S+_R+_R64 +xx TCMP,RM64IMM32,VQWORD,,_S+_R48+_R+_R64 +;----------------------------------------------------------------------------- +EXT83: +;0 +xx TADD,RM16IMMS8, VWORD,,_S+_R+_R64+_XA+_XR +xx TADD,RM32IMMS8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TADD,RM64IMMS8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;1 +xx TOR ,RM16IMMS8, VWORD,,_S+_R+_R64+_XA+_XR +xx TOR ,RM32IMMS8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TOR ,RM64IMMS8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;2 +xx TADC,RM16IMMS8, VWORD,,_S+_R+_R64+_XA+_XR +xx TADC,RM32IMMS8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TADC,RM64IMMS8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;3 +xx TSBB,RM16IMMS8, VWORD,,_S+_R+_R64+_XA+_XR +xx TSBB,RM32IMMS8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TSBB,RM64IMMS8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;4 +xx TAND,RM16IMMS8, VWORD,,_S+_R+_R64+_XA+_XR +xx TAND,RM32IMMS8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TAND,RM64IMMS8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;5 +xx TSUB,RM16IMMS8, VWORD,,_S+_R+_R64+_XA+_XR +xx TSUB,RM32IMMS8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TSUB,RM64IMMS8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;6 +xx TXOR,RM16IMMS8, VWORD,,_S+_R+_R64+_XA+_XR +xx TXOR,RM32IMMS8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TXOR,RM64IMMS8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;7 +xx TCMP,RM16IMMS8, VWORD,,_S+_R+_R64 +xx TCMP,RM32IMMS8,VDWORD,,_S+_R+_R64 +xx TCMP,RM64IMMS8,VQWORD,,_S+_R48+_R+_R64 +;----------------------------------------------------------------------------- +EXT8F: +;0 +xx TPOP,RM16, VWORD,,_S+_R+_R64 +xx TPOP,RM32,VDWORD,,_S+_A+_R+_R64 +xx TPOP,RM64,VQWORD,,_S+_R+_R64 +;----------------------------------------------------------------------------- +EXTC0: ;One table +;0 +xx TROL,RM8IMM8,VBYTE,,_S +;1 +xx TROR,RM8IMM8,VBYTE,,_S +;2 +xx TRCL,RM8IMM8,VBYTE,,_S +;3 +xx TRCR,RM8IMM8,VBYTE,,_S +;4 +xx TSHL,RM8IMM8,VBYTE,,_S +;5 +xx TSHR,RM8IMM8,VBYTE,,_S +;6 +xx TSAL,RM8IMM8,VBYTE,,_S +;7 +xx TSAR,RM8IMM8,VBYTE,,_S +;----------------------------------------------------------------------------- +EXTC1: +;0 +xx TROL,RM16I8, VWORD,,_S+_R+_R64 +xx TROL,RM32I8,VDWORD,,_S+_R+_R64 +xx TROL,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;1 +xx TROR,RM16I8, VWORD,,_S+_R+_R64 +xx TROR,RM32I8,VDWORD,,_S+_R+_R64 +xx TROR,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;2 +xx TRCL,RM16I8, VWORD,,_S+_R+_R64 +xx TRCL,RM32I8,VDWORD,,_S+_R+_R64 +xx TRCL,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;3 +xx TRCR,RM16I8, VWORD,,_S+_R+_R64 +xx TRCR,RM32I8,VDWORD,,_S+_R+_R64 +xx TRCR,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;4 +xx TSHL,RM16I8, VWORD,,_S+_R+_R64 +xx TSHL,RM32I8,VDWORD,,_S+_R+_R64 +xx TSHL,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;5 +xx TSHR,RM16I8, VWORD,,_S+_R+_R64 +xx TSHR,RM32I8,VDWORD,,_S+_R+_R64 +xx TSHR,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;6 +xx TSAL,RM16I8, VWORD,,_S+_R+_R64 +xx TSAL,RM32I8,VDWORD,,_S+_R+_R64 +xx TSAL,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;7 +xx TSAR,RM16I8, VWORD,,_S+_R+_R64 +xx TSAR,RM32I8,VDWORD,,_S+_R+_R64 +xx TSAR,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;----------------------------------------------------------------------------- +EXTC6: ;One table +;0 +xx TMOV,RM8IMM8,VBYTE,,_S+_XR+_L +;----------------------------------------------------------------------------- +EXTC7: +;0 +xx TMOV,RM16IMM16, VWORD,,_S+_R+_R64+_XR+_L +xx TMOV,RM32IMM32,VDWORD,,_S+_R+_R64+_XR+_L +xx TMOV,RM64IMM32,VQWORD,,_S+_R48+_R+_R64+_XR+_L +;----------------------------------------------------------------------------- +EXTD0: ;One table +;0 +xx TROL,RM81,VBYTE,,_S +;1 +xx TROR,RM81,VBYTE,,_S +;2 +xx TRCL,RM81,VBYTE,,_S +;3 +xx TRCR,RM81,VBYTE,,_S +;4 +xx TSHL,RM81,VBYTE,,_S +;5 +xx TSHR,RM81,VBYTE,,_S +;6 +xx TSAL,RM81,VBYTE,,_S +;7 +xx TSAR,RM81,VBYTE,,_S +;----------------------------------------------------------------------------- +EXTD1: +;0 +xx TROL,RM161, VWORD,,_S+_R+_R64 +xx TROL,RM321,VDWORD,,_S+_R+_R64 +xx TROL,RM641,VQWORD,,_S+_R48+_R+_R64 +;1 +xx TROR,RM161, VWORD,,_S+_R+_R64 +xx TROR,RM321,VDWORD,,_S+_R+_R64 +xx TROR,RM641,VQWORD,,_S+_R48+_R+_R64 +;2 +xx TRCL,RM161, VWORD,,_S+_R+_R64 +xx TRCL,RM321,VDWORD,,_S+_R+_R64 +xx TRCL,RM641,VQWORD,,_S+_R48+_R+_R64 +;3 +xx TRCR,RM161, VWORD,,_S+_R+_R64 +xx TRCR,RM321,VDWORD,,_S+_R+_R64 +xx TRCR,RM641,VQWORD,,_S+_R48+_R+_R64 +;4 +xx TSHL,RM161, VWORD,,_S+_R+_R64 +xx TSHL,RM321,VDWORD,,_S+_R+_R64 +xx TSHL,RM641,VQWORD,,_S+_R48+_R+_R64 +;5 +xx TSHR,RM161, VWORD,,_S+_R+_R64 +xx TSHR,RM321,VDWORD,,_S+_R+_R64 +xx TSHR,RM641,VQWORD,,_S+_R48+_R+_R64 +;6 +xx TSAL,RM161, VWORD,,_S+_R+_R64 +xx TSAL,RM321,VDWORD,,_S+_R+_R64 +xx TSAL,RM641,VQWORD,,_S+_R48+_R+_R64 +;7 +xx TSAR,RM161, VWORD,,_S+_R+_R64 +xx TSAR,RM321,VDWORD,,_S+_R+_R64 +xx TSAR,RM641,VQWORD,,_S+_R48+_R+_R64 +;----------------------------------------------------------------------------- +EXTD2: ;One table +;0 +xx TROL,RM8CL,VBYTE,,_S +;1 +xx TROR,RM8CL,VBYTE,,_S +;2 +xx TRCL,RM8CL,VBYTE,,_S +;3 +xx TRCR,RM8CL,VBYTE,,_S +;4 +xx TSHL,RM8CL,VBYTE,,_S +;5 +xx TSHR,RM8CL,VBYTE,,_S +;6 +xx TSAL,RM8CL,VBYTE,,_S +;7 +xx TSAR,RM8CL,VBYTE,,_S +;----------------------------------------------------------------------------- +EXTD3: +;0 +xx TROL,RM16CL, VWORD,,_S+_R+_R64 +xx TROL,RM32CL,VDWORD,,_S+_R+_R64 +xx TROL,RM64CL,VQWORD,,_S+_R48+_R+_R64 +;1 +xx TROR,RM16CL, VWORD,,_S+_R+_R64 +xx TROR,RM32CL,VDWORD,,_S+_R+_R64 +xx TROR,RM64CL,VQWORD,,_S+_R48+_R+_R64 +;2 +xx TRCL,RM16CL, VWORD,,_S+_R+_R64 +xx TRCL,RM32CL,VDWORD,,_S+_R+_R64 +xx TRCL,RM64CL,VQWORD,,_S+_R48+_R+_R64 +;3 +xx TRCR,RM16CL, VWORD,,_S+_R+_R64 +xx TRCR,RM32CL,VDWORD,,_S+_R+_R64 +xx TRCR,RM64CL,VQWORD,,_S+_R48+_R+_R64 +;4 +xx TSHL,RM16CL, VWORD,,_S+_R+_R64 +xx TSHL,RM32CL,VDWORD,,_S+_R+_R64 +xx TSHL,RM64CL,VQWORD,,_S+_R48+_R+_R64 +;5 +xx TSHR,RM16CL, VWORD,,_S+_R+_R64 +xx TSHR,RM32CL,VDWORD,,_S+_R+_R64 +xx TSHR,RM64CL,VQWORD,,_S+_R48+_R+_R64 +;6 +xx TSAL,RM16CL, VWORD,,_S+_R+_R64 +xx TSAL,RM32CL,VDWORD,,_S+_R+_R64 +xx TSAL,RM64CL,VQWORD,,_S+_R48+_R+_R64 +;7 +xx TSAR,RM16CL, VWORD,,_S+_R+_R64 +xx TSAR,RM32CL,VDWORD,,_S+_R+_R64 +xx TSAR,RM64CL,VQWORD,,_S+_R48+_R+_R64 +;----------------------------------------------------------------------------- +EXTF6: ;One table +;0 +xx TTEST ,RM8IMM8,VBYTE,,_S +;1 +xx TTEST2,RM8IMM8,VBYTE,,_S +;2 +xx TNOT ,RM8,VBYTE,,_S+_XA+_XR +;3 +xx TNEG ,RM8,VBYTE,,_S+_XA+_XR +;4 +xx TMUL ,RM8,VBYTE,,_S +;5 +xx TIMUL ,RM8,VBYTE,,_S +;6 +xx TDIV ,RM8,VBYTE,,_S +;7 +xx TIDIV ,RM8,VBYTE,,_S +;----------------------------------------------------------------------------- +EXTF7: +;0 +xx TTEST ,RM16IMM16, VWORD,,_S+_R+_R64 +xx TTEST ,RM32IMM32,VDWORD,,_S+_R+_R64 +xx TTEST ,RM64IMM32,VQWORD,,_S+_R48+_R+_R64 +;1 +xx TTEST2,RM16IMM16, VWORD,,_S+_R+_R64 +xx TTEST2,RM32IMM32,VDWORD,,_S+_R+_R64 +xx TTEST2,RM64IMM32,VQWORD,,_S+_R48+_R+_R64 +;2 +xx TNOT ,RM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TNOT ,RM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TNOT ,RM64,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;3 +xx TNEG ,RM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TNEG ,RM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TNEG ,RM64,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;4 +xx TMUL ,RM16, VWORD,,_S+_R+_R64 +xx TMUL ,RM32,VDWORD,,_S+_R+_R64 +xx TMUL ,RM64,VQWORD,,_S+_R48+_R+_R64 +;5 +xx TIMUL ,RM16, VWORD,,_S+_R+_R64 +xx TIMUL ,RM32,VDWORD,,_S+_R+_R64 +xx TIMUL ,RM64,VQWORD,,_S+_R48+_R+_R64 +;6 +xx TDIV ,RM16, VWORD,,_S+_R+_R64 +xx TDIV ,RM32,VDWORD,,_S+_R+_R64 +xx TDIV ,RM64,VQWORD,,_S+_R48+_R+_R64 +;7 +xx TIDIV ,RM16, VWORD,,_S+_R+_R64 +xx TIDIV ,RM32,VDWORD,,_S+_R+_R64 +xx TIDIV ,RM64,VQWORD,,_S+_R48+_R+_R64 +;----------------------------------------------------------------------------- +EXTFE: ;One table +;0 +xx TINC ,RM8,VBYTE,,_S+_XA+_XR +;1 +xx TDEC ,RM8,VBYTE,,_S+_XA+_XR +;2 +xx TNULL,ErrorDec, +;3 +xx TNULL,ErrorDec, +;4 +xx TNULL,ErrorDec, +;5 +xx TNULL,ErrorDec, +;6 +xx TNULL,ErrorDec, +;7 +xx TNULL,ErrorDec, +;----------------------------------------------------------------------------- +EXTFF: +;0 +xx TINC ,RM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TINC ,RM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TINC ,RM64,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;1 +xx TDEC ,RM16, VWORD,,_S+_R+_R64+_XA+_XR +xx TDEC ,RM32,VDWORD,,_S+_R+_R64+_XA+_XR +xx TDEC ,RM64,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;2 +xx TCALL,RM16N, VWORD,,_S+_R+_R64+_B +xx TCALL,RM32N,VDWORD,,_S+_A+_R+_R64+_B +xx TCALL,RM64N,VQWORD,,_S+_R+_R64+_B +;3 +xx TCALL,RM16F3, VWORD,,_S+_R+_R64 +xx TCALL,RM32F3,VDWORD,,_S+_R+_R64 +xx TCALL,RM64F3, ,,_R48+_R+_R64 +;4 +xx TJMP,RM16N, VWORD,,_S+_R+_R64+_B +xx TJMP,RM32N,VDWORD,,_S+_A+_R+_R64+_B +xx TJMP,RM64N,VQWORD,,_S+_R+_R64+_B +;5 +xx TJMP,RM16F5, VWORD,,_S+_R+_R64 +xx TJMP,RM32F5,VDWORD,,_S+_R+_R64 +xx TJMP,RM64F5, ,,_R48+_R+_R64 +;6 +xx TPUSH,RM16, VWORD,,_S+_R+_R64 +xx TPUSH,RM32,VDWORD,,_S+_A+_R+_R64 +xx TPUSH,RM64,VQWORD,,_S+_R+_R64 +;7 +xx TNULL,ErrorDec, +xx TNULL,ErrorDec, +xx TNULL,ErrorDec, +;----------------------------------------------------------------------------- +EXTD8: ;One table +;0 +xx TFADD ,ESC_0_000,VDWORD,,_S +;1 +xx TFMUL ,ESC_0_001,VDWORD,,_S +;2 +xx TFCOM ,ESC_0_010,VDWORD,,_S +;3 +xx TFCOMP,ESC_0_011,VDWORD,,_S +;4 +xx TFSUB ,ESC_0_100,VDWORD,,_S +;5 +xx TFSUBR,ESC_0_101,VDWORD,,_S +;6 +xx TFDIV ,ESC_0_110,VDWORD,,_S +;7 +xx TFDIVR,ESC_0_111,VDWORD,,_S +;----------------------------------------------------------------------------- +EXTD9: ;One table +;0 +xx TFLD ,ESC_1_000,VDWORD,,_S +;1 +xx TFXCH ,ESC_1_001, ,,_S +;2 +xx TFST ,ESC_1_010,VDWORD,,_S +;3 +xx TFSTP ,ESC_1_011,VDWORD,,_S +;4 +xx TNULL ,ESC_1_100, ,,_S +;5 +xx TFLDCW,ESC_1_101, ,,_S +;6 +xx TNULL ,ESC_1_110, ,,_S +;7 +xx TNULL ,ESC_1_111, ,,_S +;----------------------------------------------------------------------------- +EXTDA: ;One table +;0 +xx TFIADD ,ESC_2_000,VDWORD,,_S +;1 +xx TFIMUL ,ESC_2_001,VDWORD,,_S +;2 +xx TFICOM ,ESC_2_010,VDWORD,,_S +;3 +xx TFICOMP,ESC_2_011,VDWORD,,_S +;4 +xx TFISUB ,ESC_2_100,VDWORD,,_S +;5 +xx TFISUBR,ESC_2_101,VDWORD,,_S +;6 +xx TFIDIV ,ESC_2_110,VDWORD,,_S +;7 +xx TFIDIVR,ESC_2_111,VDWORD,,_S +;----------------------------------------------------------------------------- +EXTDB: ;One table +;0 +xx TFILD ,ESC_3_000,VDWORD,,_S +;1 +xx TFISTTP,ESC_3_001,VDWORD,,_S +;2 +xx TFIST ,ESC_3_010,VDWORD,,_S +;3 +xx TFISTP ,ESC_3_011,VDWORD,,_S +;4 +xx TNULL ,ESC_3_100, ,,_S +;5 +xx TFLD ,ESC_3_101,VTWORD,,_S +;6 +xx TFCOMI ,ESC_3_110, ,,_S +;7 +xx TFSTP ,ESC_3_111, ,,_S +;----------------------------------------------------------------------------- +EXTDC: ;One table +;0 +xx TFADD ,ESC_4_000,VQWORD,,_S +;1 +xx TFMUL ,ESC_4_001,VQWORD,,_S +;2 +xx TFCOM ,ESC_4_010,VQWORD,,_S +;3 +xx TFCOMP ,ESC_4_011,VQWORD,,_S +;4 +xx TFSUB ,ESC_4_100,VQWORD,,_S +;5 +xx TFSUBR ,ESC_4_101,VQWORD,,_S +;6 +xx TFDIV ,ESC_4_110,VQWORD,,_S +;7 +xx TFDIVR ,ESC_4_111,VQWORD,,_S +;----------------------------------------------------------------------------- +EXTDD: ;One table +;0 +xx TFLD ,ESC_5_000,VQWORD,,_S +;1 +xx TFISTTP,ESC_5_001,VQWORD,,_S +;2 +xx TFST ,ESC_5_010,VQWORD,,_S +;3 +xx TFSTP ,ESC_5_011,VQWORD,,_S +;4 +xx TNULL ,ESC_5_100, ,,_S +;5 +xx TNULL ,ESC_5_101, ,,_S +;6 +xx TNULL ,ESC_5_110, ,,_S +;7 +xx TNULL ,ESC_5_111, ,,_S +;----------------------------------------------------------------------------- +EXTDE: ;One table +;0 +xx TFIADD ,ESC_6_000,VWORD ,,_S +;1 +xx TFIMUL ,ESC_6_001,VWORD ,,_S +;2 +xx TFICOM ,ESC_6_010,VWORD ,,_S +;3 +xx TFICOMP,ESC_6_011,VWORD ,,_S +;4 +xx TFISUB ,ESC_6_100,VWORD ,,_S +;5 +xx TFISUBR,ESC_6_101,VWORD ,,_S +;6 +xx TFIDIV ,ESC_6_110,VWORD ,,_S +;7 +xx TFIDIVR,ESC_6_111,VWORD ,,_S +;----------------------------------------------------------------------------- +EXTDF: ;One table +;0 +xx TFILD ,ESC_7_000,VWORD ,,_S +;1 +xx TFISTTP,ESC_7_001,VWORD ,,_S +;2 +xx TFIST ,ESC_7_010,VWORD ,,_S +;3 +xx TFISTP ,ESC_7_011,VWORD ,,_S +;4 +xx TFBLD ,ESC_7_100,VTWORD,,_S +;5 +xx TFILD ,ESC_7_101,VQWORD,,_S +;6 +xx TFBSTP ,ESC_7_110,VTWORD,,_S +;7 +xx TFISTP ,ESC_7_111,VQWORD,,_S +;----------------------------------------------------------------------------- +EXTR0F00: +;0 +xx TSLDT,RM163264W,VWORD,,_S+_O +;0 +xx TSTR ,RM163264W,VWORD,,_S+_O +;2 +xx TLLDT ,RM16,VWORD,,_S+_O +;3 +xx TLTR ,RM16,VWORD,,_S+_O +;4 +xx TVERR ,RM16,VWORD,,_S+_O +;5 +xx TVERW ,RM16,VWORD,,_S+_O +;6 +xx TJMPE ,RMDW,VWORD,,_S+_R+_R64 +;7 +xx TNULL ,ErrorDec, +;----------------------------------------------------------------------------- +EXTR0F01: +;0 +xx TSGDT ,RMW0100,,,_O +;1 +xx TSIDT ,RMW0101,,,_O +;2 +xx TLGDT ,RMW0102,,,_O +;3 +xx TLIDT ,RMW0103,,,_O +;4 +xx TSMSW ,RMW0104,,, +;5 +xx TNULL ,RtnPKRU,,, +;6 +xx TLMSW ,RM16,VWORD,,_O +;7 +xx TINVLPG,RMW0107,,, +;----------------------------------------------------------------------------- +TableMOVBE: +;F0 +xx TMOVBE,R16RM163, VWORD,,_S+_O+_R+_R64 +xx TMOVBE,R32RM323,VDWORD,,_S+_O+_R+_R64 +xx TMOVBE,R64RM643,VQWORD,,_S+_O+_R+_R64+_R48 +;F1 +xx TMOVBE,RM16R163, VWORD,,_S+_O+_R+_R64 +xx TMOVBE,RM32R323,VDWORD,,_S+_O+_R+_R64 +xx TMOVBE,RM64R643,VQWORD,,_S+_O+_R+_R64+_R48 +;----------------------------------------------------------------------------- +TableCRC32: +;F0 +xx TCRC32,CRC32R,VBYTE,,_S +xx TCRC32,CRC32R,VBYTE,,_S +xx TCRC32,CRC32R,VBYTE,,_S+_R48 +;F1 +xx TCRC32,CRC32X, VWORD,,_S+_R+_R64 +xx TCRC32,CRC32X,VDWORD,,_S+_R+_R64 +xx TCRC32,CRC32X,VQWORD,,_S+_R+_R64+_R48 +;----------------------------------------------------------------------------- +TableADCX: +;F6 +xx TADCX,R3264RM3264,VDWORD,,_S+_O+_R+_R64+_R48 +;----------------------------------------------------------------------------- +TableADOX: +;F6 +xx TADOX,R3264RM3264,VDWORD,,_S+_O+_R+_R64+_R48 +;----------------------------------------------------------------------------- +TableINVx:;One table +;80 +xx TINVEPT ,Rtn0F388X,VXWORD,,_O+_R+_R64 +;81 +xx TINVVPID ,Rtn0F388X,VXWORD,,_O+_R+_R64 +;82 +xx TINVPCID ,Rtn0F388X,VXWORD,,_O+_R+_R64 +;----------------------------------------------------------------------------- +EXT0FBA: +;0 +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +;1 +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +;2 +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +;3 +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +;4 +xx TBT,RM16I8, VWORD,,_S+_R+_R64 +xx TBT,RM32I8,VDWORD,,_S+_R+_R64 +xx TBT,RM64I8,VQWORD,,_S+_R48+_R+_R64 +;5 +xx TBTS,RM16I8, VWORD,,_S+_R+_R64+_XA+_XR +xx TBTS,RM32I8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TBTS,RM64I8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;6 +xx TBTR,RM16I8, VWORD,,_S+_R+_R64+_XA+_XR +xx TBTR,RM32I8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TBTR,RM64I8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;7 +xx TBTC,RM16I8, VWORD,,_S+_R+_R64+_XA+_XR +xx TBTC,RM32I8,VDWORD,,_S+_R+_R64+_XA+_XR +xx TBTC,RM64I8,VQWORD,,_S+_R48+_R+_R64+_XA+_XR +;----------------------------------------------------------------------------- +EXT0F00: +;00 +xx TNULL,EXTINSONE,,EXTR0F00,_E +xx TNULL,EXTINSONE,,EXTR0F00,_E +xx TNULL,EXTINSONE,,EXTR0F00,_E +;01 +xx TNULL,EXTINSONE,,EXTR0F01,_E +xx TNULL,EXTINSONE,,EXTR0F01,_E +xx TNULL,EXTINSONE,,EXTR0F01,_E +;02 +xx TLAR,R16RM16W,VWORD,,_O+_R+_R64 +xx TLAR,R32RM32W,VWORD,,_O+_R+_R64 +xx TLAR,R64RM64W,VWORD,,_O+_R48+_R+_R64 +;03 +xx TLSL,R16RM16W,VWORD,,_O+_R+_R64 +xx TLSL,R32RM32W,VWORD,,_O+_R+_R64 +xx TLSL,R64RM64W,VWORD,,_O+_R48+_R+_R64 +;04 +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +;05 +xx TSYSCALL,LOADALL2,,,_A +xx TSYSCALL,LOADALL2,,,_A +xx TSYSCALL,RtnXX +;06 +xx TCLTS,RtnXX, +xx TCLTS,RtnXX, +xx TCLTS,RtnXX, +;07 +xx TSYSRET,Rtn0F07 +xx TSYSRET,Rtn0F07 +xx TSYSRETQ,Rtn0F07,,,_R48 +;08 +xx TINVD,RtnXX, +xx TINVD,RtnXX, +xx TINVD,RtnXX, +;09 +xx TWBINVD,RtnWB, +xx TWBINVD,RtnWB, +xx TWBINVD,RtnWB, +;0A +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +;0B +xx TUD2,RtnXX, +xx TUD2,RtnXX, +xx TUD2,RtnXX, +;0C +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +xx TNULL,ErrorDec,,, +;0D +xx TPREFETCH,PREFETCHRTN +xx TPREFETCH,PREFETCHRTN +xx TPREFETCH,PREFETCHRTN +;0E +xx TFEMMS,RtnXX +xx TFEMMS,RtnXX +xx TFEMMS,RtnXX +;0F +xx TNULL,Rtn0F0F,VQWORD,,_O +xx TNULL,Rtn0F0F,VQWORD,,_O +xx TNULL,Rtn0F0F,VQWORD,,_O +;----------------------------------------------------------------------------- +EXT0F10: +;10 +xx TUMOV,Rtn0F1012 ,,TT0F10,_A+_T +xx TUMOV,Rtn0F1012 ,,TT0F10,_A+_T +xx TNULL,Rtn0066F2F3 ,,TT0F10,_T +;11 +xx TUMOV,Rtn0F11X ,,TT0F11,_A+_R+_T +xx TUMOV,Rtn0F11X ,,TT0F11,_A+_R+_T +xx TNULL,Rtn0066F2F3 ,,TT0F11,_T +;12 +xx TUMOV,Rtn0F1012 ,,TT0F12,_A+_T+_3 +xx TUMOV,Rtn0F1012 ,,TT0F12,_A+_T+_3 +xx TNULL,Rtn0066F2F3 ,,TT0F12,_T+_3 +;13 +xx TUMOV,Rtn0F13X ,,TT0F13,_A+_R+_T+_3 +xx TUMOV,Rtn0F13X ,,TT0F13,_A+_R+_T+_3 +xx TNULL,Rtn0066F2F3 ,,TT0F13,_A+_R+_T+_3 +;14 +xx TNULL,Rtn0066F2F3 ,,TT0F14,_T +xx TNULL,Rtn0066F2F3 ,,TT0F14,_T +xx TNULL,Rtn0066F2F3 ,,TT0F14,_T +;15 +xx TNULL,Rtn0066F2F3 ,,TT0F15,_T +xx TNULL,Rtn0066F2F3 ,,TT0F15,_T +xx TNULL,Rtn0066F2F3 ,,TT0F15,_T +;16 +xx TNULL,Rtn0066F2F3 ,,TT0F16,_T+_3 +xx TNULL,Rtn0066F2F3 ,,TT0F16,_T+_3 +xx TNULL,Rtn0066F2F3 ,,TT0F16,_T+_3 +;17 +xx TNULL,Rtn0066F2F3 ,,TT0F17,_T+_3 +xx TNULL,Rtn0066F2F3 ,,TT0F17,_T+_3 +xx TNULL,Rtn0066F2F3 ,,TT0F17,_T+_3 +;18 +xx TNULL,Rtn0F1816 , VWORD,, +xx TNULL,Rtn0F1832 ,VDWORD,, +xx TNULL,Rtn0F1864 ,VQWORD,, +;19 +xx TNULL,Rtn0F1X16 , VWORD,, +xx TNULL,Rtn0F1X32 ,VDWORD,, +xx TNULL,Rtn0F1X64 ,VQWORD,, +;1A +xx TNULL,Rtn0F1A , VWORD,, +xx TNULL,Rtn0F1A ,VDWORD,, +xx TNULL,Rtn0F1A ,VQWORD,, +;1B +xx TNULL,Rtn0F1B , VWORD,, +xx TNULL,Rtn0F1B ,VDWORD,, +xx TNULL,Rtn0F1B ,VQWORD,, +;1C +xx TNULL,Rtn0F1C16 , VWORD,, +xx TNULL,Rtn0F1C32 ,VDWORD,, +xx TNULL,Rtn0F1C64 ,VQWORD,, +;1D +xx TNULL,Rtn0F1X16 , VWORD,, +xx TNULL,Rtn0F1X32 ,VDWORD,, +xx TNULL,Rtn0F1X64 ,VQWORD,, +;1E +xx TNULL,Rtn0F1E , VWORD,, +xx TNULL,Rtn0F1E ,VDWORD,, +xx TNULL,Rtn0F1E ,VQWORD,,_R48 +;1F +xx TNULL,Rtn0F1X16 , VWORD,, +xx TNULL,Rtn0F1X32 ,VDWORD,, +xx TNULL,Rtn0F1X64 ,VQWORD,, +;----------------------------------------------------------------------------- +EXT0F20:;One table +;20 +xx TMOV ,Rtn0F20 ,,, +;21 +xx TMOV ,Rtn0F21 ,,, +;22 +xx TMOV ,Rtn0F22 ,,, +;23 +xx TMOV ,Rtn0F23 ,,, +;24 +xx TMOV ,Rtn0F24 ,,, +;25 +xx TNULL,ErrorDec ,,, +;26 +xx TMOV ,Rtn0F26 ,,, +;27 +xx TNULL,ErrorDec ,,, +;28 +xx TNULL,Rtn0066F2F3 ,,TT0F28,_T +;29 +xx TNULL,Rtn0066F2F3 ,,TT0F29,_T +;2A +xx TNULL,Rtn0066F2F3X ,,TT0F2A,_T +;2B +xx TNULL,Rtn0066F2F3 ,,TT0F2B,_T+_3 +;2C +xx TNULL,Rtn0066F2F3X ,,TT0F2C,_T +;2D +xx TNULL,Rtn0066F2F3X ,,TT0F2D,_T +;2E +xx TNULL,Rtn0066F2F3 ,,TT0F2E,_T +;2F +xx TNULL,Rtn0066F2F3 ,,TT0F2F,_T +;----------------------------------------------------------------------------- +EXT0F30:;One table +;30 +xx TWRMSR ,AddSuffixQ,,, +;31 +xx TRDTSC ,RtnXX,,, +;32 +xx TRDMSR ,AddSuffixQ,,, +;33 +xx TRDPMC ,RtnXX,,, +;34 +xx TSYSENTER ,RtnXX,,, +;35 +xx TSYSEXIT ,AddSuffixQ,,, +;36 +xx TRDSHR ,Rtn0F36,,, +;37 +xx TGETSEC ,Rtn0F37,,, +;38 +xx TNULL ,Rtn0066F2F3Y,,TT0F38,_T +;39 +xx TDMINT ,Rtn0F39,,, +;3A +xx TPALIGNR ,Rtn0F3A,,, +;3B +xx TBB1?RESET ,Rtn0F3X,,, +;3C +xx TCPU?WRITE ,Rtn0F3X,,, +;3D +xx TCPU?READ ,Rtn0F3X,,, +;3E +xx TNULL ,ErrorDec,,, +;3F +xx TNULL ,ErrorDec,,, +;----------------------------------------------------------------------------- +EXT0F40: +;40 +xx TCMOVO ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVO ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVO ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;41 +xx TCMOVNO ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVNO ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVNO ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;42 +xx TCMOVB ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVB ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVB ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;43 +xx TCMOVAE ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVAE ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVAE ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;44 +xx TCMOVZ ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVZ ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVZ ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;45 +xx TCMOVNZ ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVNZ ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVNZ ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;46 +xx TCMOVBE ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVBE ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVBE ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;47 +xx TCMOVA ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVA ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVA ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;48 +xx TCMOVS ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVS ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVS ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;49 +xx TCMOVNS ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVNS ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVNS ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;4A +xx TCMOVP ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVP ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVP ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;4B +xx TCMOVNP ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVNP ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVNP ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;4C +xx TCMOVL ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVL ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVL ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;4D +xx TCMOVGE ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVGE ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVGE ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;4E +xx TCMOVLE ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVLE ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVLE ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;4F +xx TCMOVG ,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TCMOVG ,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TCMOVG ,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;----------------------------------------------------------------------------- +EXT0F50:;One table +;50 +xx TPAVEB ,Rtn0F50,,TT0F50,_T+_3 +;51 +xx TPADDSIW ,RtnIAMM ,,TT0F51,_T +;52 +xx TPMAGW ,RtnIAMM ,,TT0F52,_T +;53 +xx TNULL ,Rtn0066F2F3 ,,TT0F53,_T +;54 +xx TPDISTIB ,RtnIAMM ,,TT0F54,_T +;55 +xx TPSUBSIW ,RtnIAMM ,,TT0F55,_T +;56 +xx TNULL ,Rtn0066F2F3 ,,TT0F56,_T +;57 +xx TNULL ,Rtn0066F2F3 ,,TT0F57,_T +;58 +xx TPMVZB ,RtnIAM3 ,,TT0F58,_T +;59 +xx TPMULHRWC ,RtnIAMM ,,TT0F59,_T +;5A +xx TPMVNZB ,RtnIAM3 ,,TT0F5A,_T +;5B +xx TPMVLZB ,RtnIAM3 ,,TT0F5B,_T +;5C +xx TPMVGEZB ,RtnIAM3 ,,TT0F5C,_T +;5D +xx TPMULHRIW ,RtnIAMM ,,TT0F5D,_T +;5E +xx TPMACHRIW ,RtnIAM3 ,,TT0F5E,_T +;5F +xx TNULL ,Rtn0066F2F3 ,,TT0F5F,_T +;----------------------------------------------------------------------------- +EXT0F60:;One table +;60 +xx TPUNPCKLBW ,Rtn0F6X,VDWORD,,_O +;61 +xx TPUNPCKLWD ,Rtn0F6X,VDWORD,,_O +;62 +xx TPUNPCKLDQ ,Rtn0F6X,VDWORD,,_O +;63 +xx TPACKSSWB ,Rtn0F6X,VQWORD,,_O +;64 +xx TPCMPGTB ,Rtn0F6X,VQWORD,,_O +;65 +xx TPCMPGTW ,Rtn0F6X,VQWORD,,_O +;66 +xx TPCMPGTD ,Rtn0F6X,VQWORD,,_O +;67 +xx TPACKUSWB ,Rtn0F6X,VQWORD,,_O +;68 +xx TPUNPCKHBW ,Rtn0F6X,VQWORD,,_O +;69 +xx TPUNPCKHWD ,Rtn0F6X,VQWORD,,_O +;6A +xx TPUNPCKHDQ ,Rtn0F6X,VQWORD,,_O +;6B +xx TPACKSSDW ,Rtn0F6X,VQWORD,,_O +;6C +xx TPUNPCKLQDQ ,Rtn0F6X,VQWORD,,_O +;6D +xx TPUNPCKHQDQ ,Rtn0F6X,VQWORD,,_O +;6E +xx TNULL ,Rtn0066F2F3X,,TT0F6E,_T +;6F +xx TNULL ,Rtn0066F2F3 ,,TT0F6F,_T +;----------------------------------------------------------------------------- +EXT0F70:;One table +;70 +xx TNULL ,Rtn0066F2F3X,,TT0F70,_T +;71 +xx TNULL ,Rtn0F71,,, +;72 +xx TNULL ,Rtn0F72,,, +;73 +xx TNULL ,Rtn0F73,,, +;74 +xx TPCMPEQB ,RtnMMXM,VQWORD,,_O +;75 +xx TPCMPEQW ,RtnMMXM,VQWORD,,_O +;76 +xx TPCMPEQD ,RtnMMXM,VQWORD,,_O +;77 +xx TEMMS ,RtnXX ,,, +;78 +xx TVMREAD ,Rtn0F78,,, +;79 +xx TVMWRITE ,Rtn0F79,,, +;7A +xx TSVLDT ,Rtn0F7A,,, +;7B +xx TRSLDT ,Rtn0F7B,,, +;7C +xx TSVTS ,Rtn0F7C,,TT0F7C,_T +;7D +xx TRSTS ,Rtn0F7D,,TT0F7D,_T +;7E +xx TSMINTOLD ,Rtn0F7E,,TT0F7E,_T +;7F +xx TNULL ,Rtn0066F2F3,,TT0F7F,_T +;----------------------------------------------------------------------------- +EXT0F80:;One table +;80 +xx TJO ,DODISPWD,,,_J+_R+_R64+_B +;81 +xx TJNO ,DODISPWD,,,_J+_R+_R64+_B +;82 +xx TJB ,DODISPWD,,,_J+_R+_R64+_B +;83 +xx TJAE ,DODISPWD,,,_J+_R+_R64+_B +;84 +xx TJZ ,DODISPWD,,,_J+_R+_R64+_B +;85 +xx TJNZ ,DODISPWD,,,_J+_R+_R64+_B +;86 +xx TJBE ,DODISPWD,,,_J+_R+_R64+_B +;87 +xx TJA ,DODISPWD,,,_J+_R+_R64+_B +;88 +xx TJS ,DODISPWD,,,_J+_R+_R64+_B +;89 +xx TJNS ,DODISPWD,,,_J+_R+_R64+_B +;8A +xx TJP ,DODISPWD,,,_J+_R+_R64+_B +;8B +xx TJNP ,DODISPWD,,,_J+_R+_R64+_B +;8C +xx TJL ,DODISPWD,,,_J+_R+_R64+_B +;8D +xx TJGE ,DODISPWD,,,_J+_R+_R64+_B +;8E +xx TJLE ,DODISPWD,,,_J+_R+_R64+_B +;8F +xx TJG ,DODISPWD,,,_J+_R+_R64+_B +;----------------------------------------------------------------------------- +EXT0F90:;One table +;90 +xx TSETO ,RM8,VBYTE,,_S+_O +;91 +xx TSETNO ,RM8,VBYTE,,_S+_O +;92 +xx TSETB ,RM8,VBYTE,,_S+_O +;93 +xx TSETNB ,RM8,VBYTE,,_S+_O +;94 +xx TSETZ ,RM8,VBYTE,,_S+_O +;95 +xx TSETNZ ,RM8,VBYTE,,_S+_O +;96 +xx TSETBE ,RM8,VBYTE,,_S+_O +;97 +xx TSETA ,RM8,VBYTE,,_S+_O +;98 +xx TSETS ,RM8,VBYTE,,_S+_O +;99 +xx TSETNS ,RM8,VBYTE,,_S+_O +;9A +xx TSETP ,RM8,VBYTE,,_S+_O +;9B +xx TSETNP ,RM8,VBYTE,,_S+_O +;9C +xx TSETL ,RM8,VBYTE,,_S+_O +;9D +xx TSETGE ,RM8,VBYTE,,_S+_O +;9E +xx TSETLE ,RM8,VBYTE,,_S+_O +;9F +xx TSETG ,RM8,VBYTE,,_S+_O +;----------------------------------------------------------------------------- +EXT0FA0: +;A0 +xx TPUSH,AddPointW, VWORD,RFS,_S+_R +xx TPUSH,AddPointD,VDWORD,RFS,_S+_R +xx TPUSH,RtnXX ,VQWORD,RFS,_S+_R +;A1 +xx TPOP ,AddPointW, VWORD,RFS,_S+_R +xx TPOP ,AddPointD,VDWORD,RFS,_S+_R +xx TPOP ,RtnXX ,VQWORD,RFS,_S+_R +;A2 +xx TCPUID,RtnXX,,, +xx TCPUID,RtnXX,,, +xx TCPUID,RtnXX,,, +;A3 +xx TBT,RM16R16, VWORD,,_S+_O+_R+_R64 +xx TBT,RM32R32,VDWORD,,_S+_O+_R+_R64 +xx TBT,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64 +;A4 +xx TSHLD,RM16R16I8, VWORD,,_S+_O+_R+_R64 +xx TSHLD,RM32R32I8,VDWORD,,_S+_O+_R+_R64 +xx TSHLD,RM64R64I8,VQWORD,,_S+_R48+_O+_R+_R64 +;A5 +xx TSHLD,RM16R16CL, VWORD,,_S+_O+_R+_R64 +xx TSHLD,RM32R32CL,VDWORD,,_S+_O+_R+_R64 +xx TSHLD,RM64R64CL,VQWORD,,_S+_R48+_O+_R+_R64 +;A6 +xx TCMPXCHG486,Rtn0FA6,,, +xx TCMPXCHG486,Rtn0FA6,,, +xx TCMPXCHG486,Rtn0FA6,,, +;A7 +xx TCMPXCHG486,Rtn0FA7,,, +xx TCMPXCHG486,Rtn0FA7,,, +xx TCMPXCHG486,Rtn0FA7,,, +;A8 +xx TPUSH,AddPointW, VWORD,RGS,_S+_R +xx TPUSH,AddPointD,VDWORD,RGS,_S+_R +xx TPUSH,RtnXX ,VQWORD,RGS,_S+_R +;A9 +xx TPOP ,AddPointW, VWORD,RGS,_S+_R +xx TPOP ,AddPointD,VDWORD,RGS,_S+_R +xx TPOP ,RtnXX ,VQWORD,RGS,_S+_R +;AA +xx TRSM ,RtnXX,,, +xx TRSM ,RtnXX,,, +xx TRSM ,RtnXX,,, +;AB +xx TBTS,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TBTS,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TBTS,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;AC +xx TSHRD,RM16R16I8, VWORD,,_S+_O+_R+_R64 +xx TSHRD,RM32R32I8,VDWORD,,_S+_O+_R+_R64 +xx TSHRD,RM64R64I8,VQWORD,,_S+_R48+_O+_R+_R64 +;AD +xx TSHRD,RM16R16CL, VWORD,,_S+_O+_R+_R64 +xx TSHRD,RM32R32CL,VDWORD,,_S+_O+_R+_R64 +xx TSHRD,RM64R64CL,VQWORD,,_S+_R48+_O+_R+_R64 +;AE +xx TNULL,Rtn0FAE,,, +xx TNULL,Rtn0FAE,,, +xx TNULL,Rtn0FAE,,, +;AF +xx TIMUL,R16RM16, VWORD,,_S+_O+_R+_R64 +xx TIMUL,R32RM32,VDWORD,,_S+_O+_R+_R64 +xx TIMUL,R64RM64,VQWORD,,_S+_R48+_O+_R+_R64 +;----------------------------------------------------------------------------- +EXT0FB0: +;B0 +xx TCMPXCHG,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TCMPXCHG,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TCMPXCHG,RM8R8,VBYTE,,_S+_O+_XA+_XR +;B1 +xx TCMPXCHG,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TCMPXCHG,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TCMPXCHG,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;B2 +xx TLSS,R16RM163,VDWORD,,_O+_R+_R64 +xx TLSS,R32RM323,VFWORD,,_O+_R+_R64 +xx TLSS,R64RM643,VTWORD,,_O+_R+_R64+_R48 +;B3 +xx TBTR,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TBTR,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TBTR,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;B4 +xx TLFS,R16RM163,VDWORD,,_O+_R+_R64 +xx TLFS,R32RM323,VFWORD,,_O+_R+_R64 +xx TLFS,R64RM643,VTWORD,,_O+_R+_R64+_R48 +;B5 +xx TLGS,R16RM163,VDWORD,,_O+_R+_R64 +xx TLGS,R32RM323,VFWORD,,_O+_R+_R64 +xx TLGS,R64RM643,VTWORD,,_O+_R+_R64+_R48 +;B6 +xx TMOVZX,MOVZXWB,VBYTE,,_R+_R64 +xx TMOVZX,MOVZXDB,VBYTE,,_R+_R64 +xx TMOVZX,MOVZXQB,VBYTE,,_R+_R64+_R48 +;B7 +xx TMOVZX,MOVZXWW,VWORD,,_R+_R64 +xx TMOVZX,MOVZXDW,VWORD,,_R+_R64 +xx TMOVZX,MOVZXQW,VWORD,,_R+_R64+_R48 +;B8 +xx TPOPCNT,R16RM16B8,,,_R+_R64 +xx TPOPCNT,R32RM32B8,,,_R+_R64 +xx TPOPCNT,R64RM64B8,,,_R+_R64 +;B9 +xx TUD1,RtnXX,,, +xx TUD1,RtnXX,,, +xx TUD1,RtnXX,,, +;BA +xx TNULL,EXTINST,,EXT0FBA,_E +xx TNULL,EXTINST,,EXT0FBA,_E +xx TNULL,EXTINST,,EXT0FBA,_E +;BB +xx TBTC,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TBTC,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TBTC,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;BC +xx TBSF,R16RM16TZ, VWORD,,_S+_O+_R+_R64 +xx TBSF,R32RM32TZ,VDWORD,,_S+_O+_R+_R64 +xx TBSF,R64RM64TZ,VQWORD,,_S+_R48+_O+_R+_R64 +;BD +xx TBSR,R16RM16LZ, VWORD,,_S+_O+_R+_R64 +xx TBSR,R32RM32LZ,VDWORD,,_S+_O+_R+_R64 +xx TBSR,R64RM64LZ,VQWORD,,_S+_R48+_O+_R+_R64 +;BE +xx TMOVSX,MOVSXWB,VBYTE,,_R+_R64 +xx TMOVSX,MOVSXDB,VBYTE,,_R+_R64 +xx TMOVSX,MOVSXQB,VBYTE,,_R+_R64+_R48 +;BF +xx TMOVSX,MOVSXWW,VWORD,,_R+_R64 +xx TMOVSX,MOVSXDW,VWORD,,_R+_R64 +xx TMOVSX,MOVSXQW,VWORD,,_R+_R64+_R48 +;----------------------------------------------------------------------------- +EXT0FC0: +;C0 +xx TXADD,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TXADD,RM8R8,VBYTE,,_S+_O+_XA+_XR +xx TXADD,RM8R8,VBYTE,,_S+_O+_XA+_XR +;C1 +xx TXADD,RM16R16, VWORD,,_S+_O+_R+_R64+_XA+_XR +xx TXADD,RM32R32,VDWORD,,_S+_O+_R+_R64+_XA+_XR +xx TXADD,RM64R64,VQWORD,,_S+_R48+_O+_R+_R64+_XA+_XR +;C2 +xx TNULL,Rtn0FC2,,, +xx TNULL,Rtn0FC2,,, +xx TNULL,Rtn0FC2,,, +;C3 +xx TNULL,Rtn0066F2F3X,,TT0FC3,_T+_3 +xx TNULL,Rtn0066F2F3X,,TT0FC3,_T+_3 +xx TNULL,Rtn0066F2F3X,,TT0FC3,_T+_3 +;C4 +xx TNULL,Rtn0066F2F3X,,TT0FC4,_T +xx TNULL,Rtn0066F2F3X,,TT0FC4,_T +xx TNULL,Rtn0066F2F3X,,TT0FC4,_T +;C5 +xx TNULL,Rtn0066F2F3X,,TT0FC5,_T+_3 +xx TNULL,Rtn0066F2F3X,,TT0FC5,_T+_3 +xx TNULL,Rtn0066F2F3X,,TT0FC5,_T+_3 +;C6 +xx TNULL,Rtn0066F2F3X,,TT0FC6,_T +xx TNULL,Rtn0066F2F3X,,TT0FC6,_T +xx TNULL,Rtn0066F2F3X,,TT0FC6,_T +;C7 +xx TCMPXCHG8B,Rtn0FC7,,, +xx TCMPXCHG8B,Rtn0FC7,,, +xx TCMPXCHG8B,Rtn0FC7,,, +;C8 +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R+_R48 +;C9 +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R+_R48 +;CA +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R+_R48 +;CB +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R+_R48 +;CC +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R+_R48 +;CD +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R+_R48 +;CE +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R+_R48 +;CF +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R +xx TBSWAP,RtnBSWAP,,,_R+_R48 +;----------------------------------------------------------------------------- +EXT0FD0:;One table +;D0 +xx TNULL,Rtn0066F2F3,,TT0FD0,_T +;D1 +xx TPSRLW ,RtnMMXM,VQWORD,,_O +;D2 +xx TPSRLD ,RtnMMXM,VQWORD,,_O +;D3 +xx TPSRLQ ,RtnMMXM,VQWORD,,_O +;D4 +xx TPADDQ ,RtnMMXM,VQWORD,,_O +;D5 +xx TPMULLW,RtnMMXM,VQWORD,,_O +;D6 +xx TNULL,Rtn0066F2F3X,,TT0FD6,_T+_3 +;D7 +xx TNULL,Rtn0066F2F3X,,TT0FD7,_T+_3 +;D8 +xx TPSUBUSB,RtnMMXM,VQWORD,,_O +;D9 +xx TPSUBUSW,RtnMMXM,VQWORD,,_O +;DA +xx TPMINUB ,RtnMMXM,VQWORD,,_O +;DB +xx TPAND ,RtnMMXM,VQWORD,,_O +;DC +xx TPADDUSB,RtnMMXM,VQWORD,,_O +;DD +xx TPADDUSW,RtnMMXM,VQWORD,,_O +;DE +xx TPMAXUB ,RtnMMXM,VQWORD,,_O +;DF +xx TPANDN ,RtnMMXM,VQWORD,,_O +;----------------------------------------------------------------------------- +EXT0FE0:;One table +;E0 +xx TPAVGB ,RtnMMXM,VQWORD,,_O +;E1 +xx TPSRAW ,RtnMMXM,VQWORD,,_O +;E2 +xx TPSRAD ,RtnMMXM,VQWORD,,_O +;E3 +xx TPAVGW ,RtnMMXM,VQWORD,,_O +;E4 +xx TPMULHUW,RtnMMXM,VQWORD,,_O +;E5 +xx TPMULHW ,RtnMMXM,VQWORD,,_O +;E6 +xx TNULL,Rtn0066F2F3 ,,TT0FE6,_T +;E7 +xx TNULL,Rtn0066F2F3X,,TT0FE7,_T+_3 +;E8 +xx TPSUBSB ,RtnMMXM,VQWORD,,_O +;E9 +xx TPSUBSW ,RtnMMXM,VQWORD,,_O +;EA +xx TPMINSW ,RtnMMXM,VQWORD,,_O +;EB +xx TPOR ,RtnMMXM,VQWORD,,_O +;EC +xx TPADDSB ,RtnMMXM,VQWORD,,_O +;ED +xx TPADDSW ,RtnMMXM,VQWORD,,_O +;EE +xx TPMAXSW ,RtnMMXM,VQWORD,,_O +;EF +xx TPXOR ,RtnMMXM,VQWORD,,_O +;----------------------------------------------------------------------------- +EXT0FF0:;One table +;F0 +xx TNULL ,Rtn0066F2F3,,TT0FF0,_T+_3 +;F1 +xx TPSLLW ,RtnMMXM,VQWORD,,_O +;F2 +xx TPSLLD ,RtnMMXM,VQWORD,,_O +;F3 +xx TPSLLQ ,RtnMMXM,VQWORD,,_O +;F4 +xx TPMULUDQ,RtnMMXM,VQWORD,,_O +;F5 +xx TPMADDWD,RtnMMXM,VQWORD,,_O +;F6 +xx TPSADBW ,RtnMMXM,VQWORD,,_O +;F7 +xx TNULL ,Rtn0066F2F3X,,TT0FF7,_T+_3 +;F8 +xx TPSUBB ,RtnMMXM,VQWORD,,_O +;F9 +xx TPSUBW ,RtnMMXM,VQWORD,,_O +;FA +xx TPSUBD ,RtnMMXM,VQWORD,,_O +;FB +xx TPSUBQ ,RtnMMXM,VQWORD,,_O +;FC +xx TPADDB ,RtnMMXM,VQWORD,,_O +;FD +xx TPADDW ,RtnMMXM,VQWORD,,_O +;FE +xx TPADDD ,RtnMMXM,VQWORD,,_O +;FF +xx TUD0 ,RtnXX,,, +;----------------------------------------------------------------------------- diff --git a/programs/develop/koldbg/disasm/tables.inc b/programs/develop/koldbg/disasm/tables.inc new file mode 100644 index 0000000000..f2891e4464 --- /dev/null +++ b/programs/develop/koldbg/disasm/tables.inc @@ -0,0 +1,1800 @@ +;----------------------------------------------------------------------------- +macro dr [Name] +{ +if Name eq + dw 0 +else + dw Name-RtnXX +end if +} +;----------------------------------------------------------------------------- +N0F1A: dw TBNDCL,TBNDCU,TBNDMOV ,TBNDLDX +R0F1A: dr RBNDCL,RBNDCU,RBNDMOV2,RBNDLDX +;----------------------------------------------------------------------------- +N0F1B: dw TBNDMK,TBNDCN,TBNDMOV ,TBNDSTX +R0F1B: dr RBNDMK,RBNDCN,RBNDMOV1,RBNDSTX +;----------------------------------------------------------------------------- +TTXXXX: +;----------------------------------------------------------------------------- +TT0F10: dw TMOVUPS ;00 + dw TMOVUPD ;66 + dw TMOVSD ;F2 + dw TMOVSS ;F3 + ;ch=3, dwdwdwdw + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F11: dw TMOVUPS ;00 + dw TMOVUPD ;66 + dw TMOVSD ;F2 + dw TMOVSS ;F3 + ;ch=3, dwdwdwdw + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr RM32R32X ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr RM32R32X ;F3 +;----------------------------------------------------------------------------- +TT0F12: dw TMOVLPS ;00 + dw TMOVLPD ;66 + dw TMOVDDUP ;F2 + dw TMOVSLDUP ;F3 + dw TMOVHLPS ;00 ch=3 + dw 0 ;66 ch=3 + dw TMOVDDUP ;F2 ch=3 + dw TMOVSLDUP ;F3 ch=3 + db VQWORD+80h ;00 + db VQWORD+80h ;66 + db VQWORD+80h ;F2 + db VXWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F13: dw TMOVLPS ;00 + dw TMOVLPD ;66 + dw 0 ;F2 + dw 0 ;F3 + dw 0 ;00 ch=3 + dw 0 ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db VQWORD+80h ;00 + db VQWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr RM32R32X ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr RM32R32X ;F3 +;----------------------------------------------------------------------------- +TT0F14: dw TUNPCKLPS ;00 + dw TUNPCKLPD ;66 + dw 0 ;F2 + dw 0 ;F3 + ;ch=3, dwdwdwdw + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr ;F2 + dr ;F3 +;----------------------------------------------------------------------------- +TT0F15: dw TUNPCKHPS ;00 + dw TUNPCKHPD ;66 + dw 0 ;F2 + dw 0 ;F3 + ;ch=3, dwdwdwdw + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr ;F2 + dr ;F3 +;----------------------------------------------------------------------------- +TT0F16: dw TMOVHPS ;00 + dw TMOVHPD ;66 + dw 0 ;F2 + dw TMOVSHDUP ;F3 + dw TMOVLHPS ;00 ch=3 + dw 0 ;66 ch=3 + dw 0 ;F2 ch=3 + dw TMOVSHDUP ;F3 ch=3 + db VQWORD+80h ;00 + db VQWORD+80h ;66 + db 0 ;F2 + db VXWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F17: dw TMOVHPS ;00 + dw TMOVHPD ;66 + dw 0 ;F2 + dw 0 ;F3 + dw 0 ;00 ch=3 + dw 0 ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db VQWORD+80h ;00 + db VQWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr RM32R32X ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr RM32R32X ;F3 +;----------------------------------------------------------------------------- +TT0F28: dw TMOVAPS ;00 + dw TMOVAPD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F29: dw TMOVAPS ;00 + dw TMOVAPD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr RM32R32X ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr RM32R32X ;F3 +;----------------------------------------------------------------------------- +TT0F2B: dw TMOVNTPS ;00 + dw TMOVNTPD ;66 + dw TMOVNTSD ;F2 + dw TMOVNTSS ;F3 + dw 0 ;00 ch=3 + dw 0 ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr RM32R32X ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr RM32R32X ;F3 +;----------------------------------------------------------------------------- +TT0F2E: dw TUCOMISS ;00 + dw TUCOMISD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VDWORD+80h ;00 + db VQWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F2F: dw TCOMISS ;00 + dw TCOMISD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VDWORD+80h ;00 + db VQWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F38: dw TNULL ;00 + dw TNULL ;66 + dw TNULL ;F2 + dw TNULL ;F3 + db 0 ;00 + db 0 ;66 + db 0 ;F2 + db 0 ;F3 + dr Rtn0F3800 ;00 + dr Rtn0F3866 ;66 + dr Rtn0F38F2 ;F2 + dr Rtn0F38F3 ;F3 +;----------------------------------------------------------------------------- +TT0F51: dw TSQRTPS ;00 + dw TSQRTPD ;66 + dw TSQRTSD ;F2 + dw TSQRTSS ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F52: dw TRSQRTPS ;00 + dw 0 ;66 + dw 0 ;F2 + dw TRSQRTSS ;F3 + db VXWORD+80h ;00 + db 0 ;66 + db 0 ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F53: dw TRCPPS ;00 + dw 0 ;66 + dw 0 ;F2 + dw TRCPSS ;F3 + db VXWORD+80h ;00 + db 0 ;66 + db 0 ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F54: dw TANDPS ;00 + dw TANDPD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F55: dw TANDNPS ;00 + dw TANDNPD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F56: dw TORPS ;00 + dw TORPD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F57: dw TXORPS ;00 + dw TXORPD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F58: dw TADDPS ;00 + dw TADDPD ;66 + dw TADDSD ;F2 + dw TADDSS ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F59: dw TMULPS ;00 + dw TMULPD ;66 + dw TMULSD ;F2 + dw TMULSS ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F5A: dw TCVTPS2PD ;00 + dw TCVTPD2PS ;66 + dw TCVTSD2SS ;F2 + dw TCVTSS2SD ;F3 + db VQWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F5B: dw TCVTDQ2PS ;00 + dw TCVTPS2DQ ;66 + dw 0 ;F2 + dw TCVTTPS2DQ ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db VXWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F5C: dw TSUBPS ;00 + dw TSUBPD ;66 + dw TSUBSD ;F2 + dw TSUBSS ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F5D: dw TMINPS ;00 + dw TMINPD ;66 + dw TMINSD ;F2 + dw TMINSS ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F5E: dw TDIVPS ;00 + dw TDIVPD ;66 + dw TDIVSD ;F2 + dw TDIVSS ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F5F: dw TMAXPS ;00 + dw TMAXPD ;66 + dw TMAXSD ;F2 + dw TMAXSS ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F6F: dw TMOVQ ;00 + dw TMOVDQA ;66 + dw 0 ;F2 + dw TMOVDQU ;F3 + db VQWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db VXWORD+80h ;F3 + dr RtnMM2MM ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F7C: dw 0 ;00 + dw THADDPD ;66 + dw THADDPS ;F2 + dw 0 ;F3 + db 0 ;00 + db VXWORD+80h ;66 + db VXWORD+80h ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F7D: dw 0 ;00 + dw THSUBPD ;66 + dw THSUBPS ;F2 + dw 0 ;F3 + db 0 ;00 + db VXWORD+80h ;66 + db VXWORD+80h ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0F7F: dw TMOVQ ;00 + dw TMOVDQA ;66 + dw 0 ;F2 + dw TMOVDQU ;F3 + db VQWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db VXWORD+80h ;F3 + dr RtnMM4MM ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr RM32R32X ;F3 +;----------------------------------------------------------------------------- +TT0FD0: dw 0 ;00 + dw TADDSUBPD ;66 + dw TADDSUBPS ;F2 + dw 0 ;F3 + db 0 ;00 + db VXWORD+80h ;66 + db VXWORD+80h ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0FE6: dw 0 ;00 + dw TCVTTPD2DQ ;66 + dw TCVTPD2DQ ;F2 + dw TCVTDQ2PD ;F3 + db 0 ;00 + db VXWORD+80h ;66 + db VXWORD+80h ;F2 + db VQWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +TT0FF0: dw 0 ;00 + dw 0 ;66 + dw TLDDQU ;F2 + dw 0 ;F3 + dw 0 ;00 ch=3 + dw 0 ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db 0 ;00 + db 0 ;66 + db VXWORD+80h ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 +;----------------------------------------------------------------------------- +; 80h - REX.W -> RD -> RQ +; 40h - REX.W -> QWORD +; 20h - REX.W -> ...Q +; 10h - IMMB +;----------------------------------------------------------------------------- +TT0F2A: dw TCVTPI2PS ;00 + dw TCVTPI2PD ;66 + dw TCVTSI2SD ;F2 + dw TCVTSI2SS ;F3 + ;ch=3 dwdwdwdw + db VQWORD+80h ;00 + db VQWORD+80h ;66 + db VDWORD ;F2 + db VDWORD ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db XMMRG,MMXRG ;00 + db XMMRG,MMXRG ;66 + db XMMRG,GPR32+80h+40h ;F2 + db XMMRG,GPR32+80h+40h ;F3 +;----------------------------------------------------------------------------- +TT0F2C: dw TCVTTPS2PI ;00 + dw TCVTTPD2PI ;66 + dw TCVTTSD2SI ;F2 + dw TCVTTSS2SI ;F3 + db VQWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db MMXRG,XMMRG ;00 + db MMXRG,XMMRG ;66 + db GPR32+80h,XMMRG ;F2 + db GPR32+80h,XMMRG ;F3 +;----------------------------------------------------------------------------- +TT0F2D: dw TCVTPS2PI ;00 + dw TCVTPD2PI ;66 + dw TCVTSD2SI ;F2 + dw TCVTSS2SI ;F3 + db VQWORD+80h ;00 + db VXWORD+80h ;66 + db VQWORD+80h ;F2 + db VDWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db MMXRG,XMMRG ;00 + db MMXRG,XMMRG ;66 + db GPR32+80h,XMMRG ;F2 + db GPR32+80h,XMMRG ;F3 +;----------------------------------------------------------------------------- +TT0F50: dw 0 ;00 + dw 0 ;66 + dw 0 ;F2 + dw 0 ;F3 + dw TMOVMSKPS ;00 ch=3 + dw TMOVMSKPD ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db 0 ;00 + db 0 ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr ;F2 + dr ;F3 + db GPR32+80h,XMMRG ;00 + db GPR32+80h,XMMRG ;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +TT0F6E: dw TMOVD ;00 + dw TMOVD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VDWORD+80h ;00 + db VDWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr ;F2 + dr ;F3 + db MMXRG,GPR32+20h+40h+80h;00 + db XMMRG,GPR32+20h+40h+80h;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +TT0F70: dw TPSHUFW ;00 + dw TPSHUFD ;66 + dw TPSHUFLW ;F2 + dw TPSHUFHW ;F3 + db VQWORD+80h ;00 + db VXWORD+80h ;66 + db VXWORD+80h ;F2 + db VXWORD+80h ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db MMXRG,MMXRG+10h ;00 + db XMMRG,XMMRG+10h ;66 + db XMMRG,XMMRG+10h ;F2 + db XMMRG,XMMRG+10h ;F3 +;----------------------------------------------------------------------------- +TT0F7E: dw TMOVD ;00 + dw TMOVD ;66 + dw 0 ;F2 + dw TMOVQ ;F3 + db VDWORD+80h ;00 + db VDWORD+80h ;66 + db 0 ;F2 + db VQWORD+80h ;F3 + dr RM32R32X ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr R32RM32X ;F3 + db GPR32+20h+40h+80h,MMXRG;00 + db GPR32+20h+40h+80h,XMMRG;66 + db 0,0 ;F2 + db XMMRG,XMMRG ;F3 +;----------------------------------------------------------------------------- +TT0FC3: dw TMOVNTI ;00 + dw 0 ;66 + dw 0 ;F2 + dw 0 ;F3 + dw 0 ;00 ch=3 + dw 0 ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db VDWORD+80h ;00 + db 0 ;66 + db 0 ;F2 + db 0 ;F3 + dr RM32R32X ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr RM32R32X ;F3 + db 0,GPR32+80h+40h ;00 + db 0,0 ;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +TT0FC4: dw TPINSRW ;00 + dw TPINSRW ;66 + dw 0 ;F2 + dw 0 ;F3 + db VWORD+80h ;00 + db VWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db MMXRG,GPR32+80h+10h ;00 + db XMMRG,GPR32+80h+10h ;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +TT0FC5: dw 0 ;00 + dw 0 ;66 + dw 0 ;F2 + dw 0 ;F3 + dw TPEXTRW ;00 ch=3 + dw TPEXTRW ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db 0 ;00 + db 0 ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db GPR32+80h+10h,MMXRG ;00 + db GPR32+80h+10h,XMMRG ;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +TT0FC6: dw TSHUFPS ;00 + dw TSHUFPD ;66 + dw 0 ;F2 + dw 0 ;F3 + db VXWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db XMMRG,XMMRG+10h ;00 + db XMMRG,XMMRG+10h ;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +TT0FD6: dw 0 ;00 + dw TMOVQ ;66 + dw 0 ;F2 + dw 0 ;F3 + dw 0 ;00 ch=3 + dw TMOVQ ;66 ch=3 + dw TMOVDQ2Q ;F2 ch=3 + dw TMOVQ2DQ ;F3 ch=3 + db 0 ;00 + db VQWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr RM32R32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db XMMRG,XMMRG ;00 + db XMMRG,XMMRG ;66 + db MMXRG,XMMRG ;F2 + db XMMRG,MMXRG ;F3 +;----------------------------------------------------------------------------- +TT0FD7: dw 0 ;00 + dw 0 ;66 + dw 0 ;F2 + dw 0 ;F3 + dw TPMOVMSKB ;00 ch=3 + dw TPMOVMSKB ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db 0 ;00 + db 0 ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db GPR32+80h,MMXRG ;00 + db GPR32+80h,XMMRG ;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +TT0FE7: dw TMOVNTQ ;00 + dw TMOVNTDQ ;66 + dw 0 ;F2 + dw 0 ;F3 + dw 0 ;00 ch=3 + dw 0 ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db VQWORD+80h ;00 + db VXWORD+80h ;66 + db 0 ;F2 + db 0 ;F3 + dr RM32R32X ;00 + dr RM32R32X ;66 + dr RM32R32X ;F2 + dr RM32R32X ;F3 + db 0,MMXRG ;00 + db 0,XMMRG ;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +TT0FF7: dw 0 ;00 + dw 0 ;66 + dw 0 ;F2 + dw 0 ;F3 + dw TMASKMOVQ ;00 ch=3 + dw TMASKMOVDQU ;66 ch=3 + dw 0 ;F2 ch=3 + dw 0 ;F3 ch=3 + db 0 ;00 + db 0 ;66 + db 0 ;F2 + db 0 ;F3 + dr R32RM32X ;00 + dr R32RM32X ;66 + dr R32RM32X ;F2 + dr R32RM32X ;F3 + db MMXRG,MMXRG ;00 + db XMMRG,XMMRG ;66 + db 0,0 ;F2 + db 0,0 ;F3 +;----------------------------------------------------------------------------- +StrTabXOPA: +XOPc $10,0,0,XOPL ,RtnTBM0,TNULL +XOPc $12,0,0,0 ,RtnLWPxx,TNULL +dd -1 +;----------------------------------------------------------------------------- +StrTabXOP9: +XOPc $01,0,0,XOPL ,RtnTBM1,TNULL +XOPc $02,0,0,XOPL ,RtnTBM2,TNULL +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +XOPc $12,0,0,XOPV ,RtnLWPCB,TNULL +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +XOPc $81,VOWORD+80h,VYWORD+80h,XOPV or XOPO or XOPW ,RtnXOP,TFRCZPD +XOPc $80,VOWORD+80h,VYWORD+80h,XOPV or XOPO or XOPW ,RtnXOP,TFRCZPS +XOPc $83,VQWORD+80h,0,XOPV or XOPO or XOPL ,RtnXOP,TFRCZSD +XOPc $82,VDWORD+80h,0,XOPV or XOPO or XOPL ,RtnXOP,TFRCZSS +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +XOPc $C1,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDBW +XOPc $C2,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDBD +XOPc $C3,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDBQ +XOPc $C6,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDWD +XOPc $C7,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDWQ +XOPc $CB,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDDQ +XOPc $D1,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDUBW +XOPc $D2,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDUBD +XOPc $D3,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDUBQ +XOPc $D6,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDUWD +XOPc $D7,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDUWQ +XOPc $DB,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHADDUDQ +XOPc $E1,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHSUBBW +XOPc $E2,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHSUBWD +XOPc $E3,VOWORD+80h,0,XOPL or XOPW ,RtnXOP,TPHSUBDQ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +XOPc $90,VOWORD+80h,0,XOPL ,XOP3Rtn,TPROTB +XOPc $91,VOWORD+80h,0,XOPL ,XOP3Rtn,TPROTW +XOPc $92,VOWORD+80h,0,XOPL ,XOP3Rtn,TPROTD +XOPc $93,VOWORD+80h,0,XOPL ,XOP3Rtn,TPROTQ +XOPc $98,VOWORD+80h,0,XOPL ,XOP3Rtn,TPSHAB +XOPc $99,VOWORD+80h,0,XOPL ,XOP3Rtn,TPSHAW +XOPc $9A,VOWORD+80h,0,XOPL ,XOP3Rtn,TPSHAD +XOPc $9B,VOWORD+80h,0,XOPL ,XOP3Rtn,TPSHAQ +XOPc $94,VOWORD+80h,0,XOPL ,XOP3Rtn,TPSHLB +XOPc $95,VOWORD+80h,0,XOPL ,XOP3Rtn,TPSHLW +XOPc $96,VOWORD+80h,0,XOPL ,XOP3Rtn,TPSHLD +XOPc $97,VOWORD+80h,0,XOPL ,XOP3Rtn,TPSHLQ +dd -1 +;----------------------------------------------------------------------------- +StrTabXOP8: +XOPc $A2,VOWORD+80h,VYWORD+80h,XOPI ,XOP4Rtn,TPCMOV +XOPc $CC,VOWORD+80h,0,XOPL or XOPW ,SuffixCOMB,TPCOM +XOPc $CD,VOWORD+80h,0,XOPL or XOPW ,SuffixCOMW,TPCOM +XOPc $CE,VOWORD+80h,0,XOPL or XOPW ,SuffixCOMD,TPCOM +XOPc $CF,VOWORD+80h,0,XOPL or XOPW ,SuffixCOMQ,TPCOM +XOPc $EC,VOWORD+80h,0,XOPL or XOPW ,SuffixCOMUB,TPCOM +XOPc $ED,VOWORD+80h,0,XOPL or XOPW ,SuffixCOMUW,TPCOM +XOPc $EE,VOWORD+80h,0,XOPL or XOPW ,SuffixCOMUD,TPCOM +XOPc $EF,VOWORD+80h,0,XOPL or XOPW ,SuffixCOMUQ,TPCOM +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +XOPc $9E,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSDD +XOPc $9F,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSDQH +XOPc $97,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSDQL +XOPc $8E,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSSDD +XOPc $8F,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSSDQH +XOPc $87,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSSDQL +XOPc $86,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSSWD +XOPc $85,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSSWW +XOPc $96,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSWD +XOPc $95,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMACSWW +XOPc $A6,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMADCSSWD +XOPc $B6,VOWORD+80h,0,XOPL or XOPW or XOPI ,XOP4Rtn,TPMADCSWD +XOPc $A3,VOWORD+80h,0,XOPL or XOPI ,XOP4Rtn,TPPERM +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +XOPc $C0,VOWORD+80h,0,XOPL or XOPW or XOPV ,XOPImm8,TPROTB +XOPc $C1,VOWORD+80h,0,XOPL or XOPW or XOPV ,XOPImm8,TPROTW +XOPc $C2,VOWORD+80h,0,XOPL or XOPW or XOPV ,XOPImm8,TPROTD +XOPc $C3,VOWORD+80h,0,XOPL or XOPW or XOPV ,XOPImm8,TPROTQ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +dd -1 +;----------------------------------------------------------------------------- +C43866: +xC RtnC4C5, VEXV or VEX2 or VEXW, $13,xQ,xO,TCVTPH2PS +xC RtnC4C5, VEX0, $DC,xO,xY,TAESENC +xC RtnC4C5, VEX0, $DD,xO,xY,TAESENCLAST +xC RtnC4C5, VEX0, $DE,xO,xY,TAESDEC +xC RtnC4C5, VEX0, $DF,xO,xY,TAESDECLAST +xC RtnC4C5, VEXV or VEXL, $DB,xO,xN,TAESIMC +xC RtnC401, VEXV or VEX0 or VEXW, $18,xD,xD,TBROADCASTSS +xC RtnC401, VEXV or VEXN or VEXW, $19,xN,xQ,TBROADCASTSD +xC RtnC4C5, VEXV or VEXN or VEXM, $1A,xN,xO,TBROADCASTF128 +xC RtnC4C5, VEXV or VEXN or VEXM or VEXW, $5A,xN,xO,TBROADCASTI128 +xC RtnC4C5, VEXM, $2C,xO,xY,TMASKMOVPS +xC RtnC4C5, VEXM, $2D,xO,xY,TMASKMOVPD +xC RtnC402, VEXM, $2E,xO,xY,TMASKMOVPS +xC RtnC402, VEXM, $2F,xO,xY,TMASKMOVPD +xC RtnC4C5, VEXV or VEXM, $2A,xO,xY,TMOVNTDQA +xC RtnC4C5, VEXV, $1C,xO,xY,TPABSB +xC RtnC4C5, VEXV, $1D,xO,xY,TPABSW +xC RtnC4C5, VEXV, $1E,xO,xY,TPABSD +xC RtnC4C5, VEX0, $2B,xO,xY,TPACKUSDW +xC RtnC4C5, VEX0, $29,xO,xY,TPCMPEQQ +xC RtnC4C5, VEX0, $37,xO,xY,TPCMPGTQ +xC RtnC4C5, VEX0, $0D,xO,xY,TPERMILPD +xC RtnC4C5, VEX0, $0C,xO,xY,TPERMILPS +xC RtnC4C5, VEX0, $01,xO,xY,TPHADDW +xC RtnC4C5, VEX0, $02,xO,xY,TPHADDD +xC RtnC4C5, VEX0, $03,xO,xY,TPHADDSW +xC RtnC4C5, VEXV or VEXL, $41,xO,xN,TPHMINPOSUW +xC RtnC4C5, VEX0, $05,xO,xY,TPHSUBW +xC RtnC4C5, VEX0, $06,xO,xY,TPHSUBD +xC RtnC4C5, VEX0, $07,xO,xY,TPHSUBSW +xC RtnC4C5, VEX0, $04,xO,xY,TPMADDUBSW +xC RtnC4C5, VEX0, $3C,xO,xY,TPMAXSB +xC RtnC4C5, VEX0, $3D,xO,xY,TPMAXSD +xC RtnC4C5, VEX0, $3E,xO,xY,TPMAXUW +xC RtnC4C5, VEX0, $3F,xO,xY,TPMAXUD +xC RtnC4C5, VEX0, $38,xO,xY,TPMINSB +xC RtnC4C5, VEX0, $39,xO,xY,TPMINSD +xC RtnC4C5, VEX0, $3A,xO,xY,TPMINUW +xC RtnC4C5, VEX0, $3B,xO,xY,TPMINUD +xC RtnC4C5, VEXV or VEX2, $20,xQ,xO,TPMOVSXBW +xC RtnC4C5, VEXV or VEX2, $21,xD,xQ,TPMOVSXBD +xC RtnC4C5, VEXV or VEX2, $22,xW,xD,TPMOVSXBQ +xC RtnC4C5, VEXV or VEX2, $23,xQ,xO,TPMOVSXWD +xC RtnC4C5, VEXV or VEX2, $24,xD,xQ,TPMOVSXWQ +xC RtnC4C5, VEXV or VEX2, $25,xQ,xO,TPMOVSXDQ +xC RtnC4C5, VEXV or VEX2, $30,xQ,xO,TPMOVZXBW +xC RtnC4C5, VEXV or VEX2, $31,xD,xQ,TPMOVZXBD +xC RtnC4C5, VEXV or VEX2, $32,xW,xD,TPMOVZXBQ +xC RtnC4C5, VEXV or VEX2, $33,xQ,xO,TPMOVZXWD +xC RtnC4C5, VEXV or VEX2, $34,xD,xQ,TPMOVZXWQ +xC RtnC4C5, VEXV or VEX2, $35,xQ,xO,TPMOVZXDQ +xC RtnC4C5, VEX0, $0B,xO,xY,TPMULHRSW +xC RtnC4C5, VEX0, $40,xO,xY,TPMULLD +xC RtnC4C5, VEX0, $28,xO,xY,TPMULDQ +xC RtnC4C5, VEX0, $00,xO,xY,TPSHUFB +xC RtnC4C5, VEX0, $08,xO,xY,TPSIGNB +xC RtnC4C5, VEX0, $09,xO,xY,TPSIGNW +xC RtnC4C5, VEX0, $0A,xO,xY,TPSIGND +xC RtnC4C5, VEXV, $17,xO,xY,TPTEST +xC RtnC4C5, VEXV, $0E,xO,xY,TTESTPS +xC RtnC4C5, VEXV, $0F,xO,xY,TTESTPD +xC RtnC401, VEXV or VEXW, $78,xB,xB,TPBROADCASTB +xC RtnC401, VEXV or VEXW, $79,xW,xW,TPBROADCASTW +xC RtnC401, VEXV or VEXW, $58,xD,xD,TPBROADCASTD +xC RtnC401, VEXV or VEXW, $59,xQ,xQ,TPBROADCASTQ +xC RtnC4C5, VEXN or VEXW, $36,xN,xY,TPERMD +xC RtnC4C5, VEXN or VEXW, $16,xN,xY,TPERMPS +xC RtnC403, VEX0, $47,xO,xY,TPSLLVD +xC RtnC4C5, VEXW, $46,xO,xY,TPSRAVD +xC RtnC403, VEX0, $45,xO,xY,TPSRLVD +xC RtnC403, VEXM, $8C,xO,xY,TPMASKMOVD +xC RtnC404, VEXM, $8E,xO,xY,TPMASKMOVD +xC RtnC405, VEXM, $90,xD,xD,TPGATHERDD +xC RtnC405, VEXM, $91,xQ,xQ,TPGATHERQD +xC RtnC406, VEXM, $92,xD,xD,TGATHERD +xC RtnC406, VEXM, $93,xQ,xQ,TGATHERQ +;;;;;;;;---------------------------------------------------------------------- +xC RtnC407, VEX0 or VEXC, $96,xO,xY,TFMADDSUB132 +xC RtnC407, VEX0 or VEXC, $97,xO,xY,TFMSUBADD132 +xC RtnC407, VEX0 or VEXC, $98,xO,xY,TFMADD132 +xC RtnC408, VEXL or VEXC, $99,xD,xN,TFMADD132 +xC RtnC407, VEX0 or VEXC, $9A,xO,xY,TFMSUB132 +xC RtnC408, VEXL or VEXC, $9B,xD,xN,TFMSUB132 +xC RtnC407, VEX0 or VEXC, $9C,xO,xY,TFNMADD132 +xC RtnC408, VEXL or VEXC, $9D,xD,xN,TFNMADD132 +xC RtnC407, VEX0 or VEXC, $9E,xO,xY,TFNMSUB132 +xC RtnC408, VEXL or VEXC, $9F,xD,xN,TFNMSUB132 +xC RtnC407, VEX0 or VEXC, $A6,xO,xY,TFMADDSUB213 +xC RtnC407, VEX0 or VEXC, $A7,xO,xY,TFMSUBADD213 +xC RtnC407, VEX0 or VEXC, $A8,xO,xY,TFMADD213 +xC RtnC408, VEXL or VEXC, $A9,xD,xN,TFMADD213 +xC RtnC407, VEX0 or VEXC, $AA,xO,xY,TFMSUB213 +xC RtnC408, VEXL or VEXC, $AB,xD,xN,TFMSUB213 +xC RtnC407, VEX0 or VEXC, $AC,xO,xY,TFNMADD213 +xC RtnC408, VEXL or VEXC, $AD,xD,xN,TFNMADD213 +xC RtnC407, VEX0 or VEXC, $AE,xO,xY,TFNMSUB213 +xC RtnC408, VEXL or VEXC, $AF,xD,xN,TFNMSUB213 +xC RtnC407, VEX0 or VEXC, $B6,xO,xY,TFMADDSUB231 +xC RtnC407, VEX0 or VEXC, $B7,xO,xY,TFMSUBADD231 +xC RtnC407, VEX0 or VEXC, $B8,xO,xY,TFMADD231 +xC RtnC408, VEXL or VEXC, $B9,xD,xN,TFMADD231 +xC RtnC407, VEX0 or VEXC, $BA,xO,xY,TFMSUB231 +xC RtnC408, VEXL or VEXC, $BB,xD,xN,TFMSUB231 +xC RtnC407, VEX0 or VEXC, $BC,xO,xY,TFNMADD231 +xC RtnC408, VEXL or VEXC, $BD,xD,xN,TFNMADD231 +xC RtnC407, VEX0 or VEXC, $BE,xO,xY,TFNMSUB231 +xC RtnC408, VEXL or VEXC, $BF,xD,xN,TFNMSUB231 +xC RtnC409, VEXG or VEXH or VEXL, $F7,xD,xQ,TSHLX +xC RtnC4C5, VEXW, $CF,xO,xY,TGF2P8MULB +;;;;;;;;---------------------------------------------------------------------- +dd -1 +;----------------------------------------------------------------------------- +C43A66: +xC RtnC40A, VEXL or VEXI or VEXH, $30,xO,xY,TKSHIFTRB +xC RtnC40B, VEXL or VEXI or VEXH, $31,xO,xY,TKSHIFTRD +xC RtnC40A, VEXL or VEXI or VEXH, $32,xO,xY,TKSHIFTLB +xC RtnC40B, VEXL or VEXI or VEXH, $33,xO,xY,TKSHIFTLD +xC RtnC4C5, VEXV or VEXL or VEXI, $DF,xO,xN,TAESKEYGENASSIST +xC RtnC4C5, VEXI, $0C,xO,xY,TBLENDPS +xC RtnC4C5, VEXI, $0D,xO,xY,TBLENDPD +xC RtnC4C5, VEX4 or VEXW, $4A,xO,xY,TBLENDVPS +xC RtnC4C5, VEX4 or VEXW, $4B,xO,xY,TBLENDVPD +xC RtnC4C5, VEXI or VEXL, $41,xO,xN,TDPPD +xC RtnC4C5, VEXI, $40,xO,xY,TDPPS +xC RtnC40C, VEXI or VEXV or VEXN, $19,xN,xO,TEXTRACTF128 +xC RtnC40D, VEXI or VEXV or VEXW, $1D,xQ,xO,TCVTPS2PH +xC RtnC40E, VEXI or VEXV or VEXL, $17,xD,xN,TEXTRACTPS +xC RtnC410, VEXI or VEX0, $18,xN,xO,TINSERTF128 +xC RtnC4C5, VEXI or VEXL, $21,xD,xN,TINSERTPS +xC RtnC4C5, VEXI, $42,xO,xY,TMPSADBW +xC RtnC4C5, VEXI, $0F,xO,xY,TPALIGNR +xC RtnC4C5, VEX4 or VEXW, $4C,xO,xY,TPBLENDVB +xC RtnC4C5, VEXI, $0E,xO,xY,TPBLENDW +xC RtnCLMUL, VEXI, $44,xO,xY,TPCLMULQDQ +xC RtnC4C5, VEXV or VEXL or VEXI, $61,xO,xN,TPCMPESTRI +xC RtnC4C5, VEXV or VEXL or VEXI, $60,xO,xN,TPCMPESTRM +xC RtnC4C5, VEXV or VEXL or VEXI, $63,xO,xN,TPCMPISTRI +xC RtnC4C5, VEXV or VEXL or VEXI, $62,xO,xN,TPCMPISTRM +xC RtnC4C5, VEXV or VEXI, $05,xO,xY,TPERMILPD +xC RtnC4C5, VEXV or VEXI, $04,xO,xY,TPERMILPS +xC RtnC4C5, VEXN or VEXI, $06,xN,xY,TPERM2F128 +xC RtnC40F, VEXV or VEXL or VEXI, $14,xB,xN,TPEXTRB +xC RtnC40F, VEXV or VEXL or VEXI, $15,xW,xN,TPEXTRW +xC RtnC411, VEXV or VEXL or VEXI, $16,xD,xN,TPEXTRD +xC RtnC412, VEXL or VEXI, $20,xB,xN,TPINSRB +xC RtnC413, VEXL or VEXI, $22,xD,xN,TPINSRD +xC RtnC4C5, VEXV or VEXI, $09,xO,xY,TROUNDPD +xC RtnC4C5, VEXV or VEXI, $08,xO,xY,TROUNDPS +xC RtnC4C5, VEXL or VEXI, $0B,xQ,xN,TROUNDSD +xC RtnC4C5, VEXL or VEXI, $0A,xD,xN,TROUNDSS +xC RtnC4C5, VEXI or VEXW, $02,xO,xY,TPBLENDD +xC RtnC414, VEXN or VEXC or VEXI, $01,xN,xY,TPERMPD +xC RtnC414, VEXN or VEXC or VEXI, $00,xN,xY,TPERMQ +xC RtnC4C5, VEXN or VEXW or VEXI, $46,xN,xY,TPERM2I128 +xC RtnC40C, VEXN or VEXV or VEXW or VEXI, $39,xN,xO,TEXTRACTI128 +xC RtnC410, VEXN or VEXW or VEXI, $38,xN,xO,TINSERTI128 +xC RtnC4C5, VEXC or VEXI, $CE,xO,xY,TGF2P8AFFINEQB +xC RtnC4C5, VEXC or VEXI, $CF,xO,xY,TGF2P8AFFINEINVQB +;;;;;;;;---------------------------------------------------------------------- +xC C4FMA, VEX0 or VEXC, $69,xO,xY,TFMADDPD +xC C4FMA, VEX0 or VEXC, $68,xO,xY,TFMADDPS +xC C4FMA, VEXL or VEXC, $6B,xQ,xN,TFMADDSD +xC C4FMA, VEXL or VEXC, $6A,xD,xN,TFMADDSS +xC C4FMA, VEX0 or VEXC, $5D,xO,xY,TFMADDSUBPD +xC C4FMA, VEX0 or VEXC, $5C,xO,xY,TFMADDSUBPS +xC C4FMA, VEX0 or VEXC, $5F,xO,xY,TFMSUBADDPD +xC C4FMA, VEX0 or VEXC, $5E,xO,xY,TFMSUBADDPS +xC C4FMA, VEX0 or VEXC, $6D,xO,xY,TFMSUBPD +xC C4FMA, VEX0 or VEXC, $6C,xO,xY,TFMSUBPS +xC C4FMA, VEXL or VEXC, $6F,xQ,xN,TFMSUBSD +xC C4FMA, VEXL or VEXC, $6E,xD,xN,TFMSUBSS +xC C4FMA, VEX0 or VEXC, $79,xO,xY,TFNMADDPD +xC C4FMA, VEX0 or VEXC, $78,xO,xY,TFNMADDPS +xC C4FMA, VEXL or VEXC, $7B,xQ,xN,TFNMADDSD +xC C4FMA, VEXL or VEXC, $7A,xD,xN,TFNMADDSS +xC C4FMA, VEX0 or VEXC, $7D,xO,xY,TFNMSUBPD +xC C4FMA, VEX0 or VEXC, $7C,xO,xY,TFNMSUBPS +xC C4FMA, VEXL or VEXC, $7F,xQ,xN,TFNMSUBSD +xC C4FMA, VEXL or VEXC, $7E,xD,xN,TFNMSUBSS +dd -1 +;;;;;;;;---------------------------------------------------------------------- +C43800: +xC RtnC4C5, VEXG or VEXH or VEXL, $F2,xD,xQ,TANDN +xC RtnC409, VEXG or VEXH or VEXL, $F7,xD,xQ,TBEXTR +xC RtnC415, VEXG or VEXH or VEXL, $F3,xD,xQ,TNULL +xC RtnC409, VEXG or VEXH or VEXL, $F5,xD,xQ,TBZHI +dd -1 +C438F3: +xC RtnC4C5, VEXG or VEXH or VEXL, $F5,xD,xQ,TPEXT +xC RtnC409, VEXG or VEXH or VEXL, $F7,xD,xQ,TSARX +dd -1 +C438F2: +xC RtnC4C5, VEXG or VEXH or VEXL, $F6,xD,xQ,TMULX +xC RtnC4C5, VEXG or VEXH or VEXL, $F5,xD,xQ,TPDEP +xC RtnC409, VEXG or VEXH or VEXL, $F7,xD,xQ,TSHRX +dd -1 +C43A00: +xC C40F3A48, VEX4, $48,xO,xY,TPERMIL2PS +xC C40F3A49, VEX4, $49,xO,xY,TPERMIL2PD +dd -1 +C43AF3: +C43AF2: +xC RtnC416, VEXG or VEXH or VEXL, $F0,xD,xQ,TRORX +dd -1 +;----------------------------------------------------------------------------- +C4C500: +xC RtnC4C501, VEXN+VEXH, $4A,xO,xY,TKADDW +xC RtnC4C501, VEXN+VEXH, $41,xO,xY,TKANDW +xC RtnC4C501, VEXN+VEXH, $42,xO,xY,TKANDNW +xC RtnC4C501, VEXN+VEXH, $45,xO,xY,TKORW +xC RtnC4C501, VEXN+VEXH, $46,xO,xY,TKXNORW +xC RtnC4C501, VEXN+VEXH, $47,xO,xY,TKXORW +xC RtnC4C504, VEXL+VEXH, $44,xO,xY,TKNOTW +xC RtnC4C504, VEXL+VEXH, $98,xO,xY,TKORTESTW +xC RtnC4C504, VEXL+VEXH, $99,xO,xY,TKTESTW +xC RtnC4C505, VEXL+VEXH, $90,xN,xN,TKMOVW +xC RtnC4C507, VEXL+VEXH, $91,xN,xN,TKMOVW +xC RtnC4C508, VEXN+VEXH, $4B,xN,xN,TKUNPCKWD +xC RtnC4C509, VEXL+VEXH+VEXW, $92,xN,xN,TKMOVW +xC RtnC4C50A, VEXL+VEXH+VEXW, $93,xN,xN,TKMOVW +xC RtnC4C5, VEX0, $58,xO,xY,TADDPS +xC RtnC4C5, VEX0, $54,xO,xY,TANDPS +xC RtnC4C5, VEX0, $55,xO,xY,TANDNPS +xC RtnC4C5, VEX8, $C2,xO,xY,TCMPPS +xC RtnC4C5, VEXV or VEXL, $2F,xD,xN,TCOMISS +xC RtnC4C5, VEXV or VEX0, $5B,xO,xY,TCVTDQ2PS +xC RtnC4C5, VEXV or VEX2, $5A,xQ,xO,TCVTPS2PD +xC RtnC4C5, VEX0, $5E,xO,xY,TDIVPS +xC RtnC4C50B, VEXL or VEXM, $AE,xD,xN,TLDMXCSR +xC RtnC4C5, VEX0, $5F,xO,xY,TMAXPS +xC RtnC4C5, VEX0, $5D,xO,xY,TMINPS +xC RtnC4C5, VEXV, $28,xO,xY,TMOVAPS +xC RtnC4C50C, VEXV, $29,xO,xY,TMOVAPS +xC C4C5NB1, VEXL, $12,xQ,xY,TMOVLPS +xC C4C5NB2, VEXL, $16,xQ,xN,TMOVHPS +xC RtnC4C50C, VEXV or VEXL or VEXM, $17,xQ,xN,TMOVHPS +xC RtnC4C50C, VEXV or VEXL or VEXM, $13,xQ,xN,TMOVLPS +xC RtnC4C50D, VEXV or VEXR, $50,xO,xY,TMOVMSKPS +xC RtnC4C50C, VEXV or VEXM, $2B,xO,xY,TMOVNTPS +xC RtnC4C5, VEXV, $10,xO,xY,TMOVUPS +xC RtnC4C50C, VEXV, $11,xO,xY,TMOVUPS +xC RtnC4C5, VEX0, $59,xO,xY,TMULPS +xC RtnC4C5, VEX0, $56,xO,xY,TORPS +xC RtnC4C5, VEXV, $53,xO,xY,TRCPPS +xC RtnC4C5, VEXV, $52,xO,xY,TRSQRTPS +xC RtnC4C5, VEXI, $C6,xO,xY,TSHUFPS +xC RtnC4C5, VEXV, $51,xO,xY,TSQRTPS +xC RtnC4C5, VEX0, $5C,xO,xY,TSUBPS +xC RtnC4C5, VEXV or VEXL, $2E,xD,xN,TUCOMISS +xC RtnC4C5, VEX0, $15,xO,xY,TUNPCKHPS +xC RtnC4C5, VEX0, $14,xO,xY,TUNPCKLPS +xC RtnC4C5, VEX0, $57,xO,xY,TXORPS +xC RtnC4C50E, VEXF or VEXV, $77,xN,xN,TZEROALL +dd -1 +;----------------------------------------------------------------------------- +C4C566: +xC RtnC4C502, VEXN+VEXH, $41,xO,xY,TKANDB +xC RtnC4C502, VEXN+VEXH, $42,xO,xY,TKANDNB +xC RtnC4C502, VEXN+VEXH, $4A,xO,xY,TKADDB +xC RtnC4C502, VEXN+VEXH, $45,xO,xY,TKORB +xC RtnC4C502, VEXN+VEXH, $46,xO,xY,TKXNORB +xC RtnC4C502, VEXN+VEXH, $47,xO,xY,TKXORB +xC RtnC4C503, VEXL+VEXH, $44,xO,xY,TKNOTB +xC RtnC4C503, VEXL+VEXH, $98,xO,xY,TKORTESTB +xC RtnC4C503, VEXL+VEXH, $99,xO,xY,TKTESTB +xC RtnC4C508, VEXN+VEXH+VEXW, $4B,xN,xN,TKUNPCKBW +xC RtnC4C503, VEXL+VEXH, $90,xN,xN,TKMOVB +xC RtnC4C506, VEXL+VEXH, $91,xN,xN,TKMOVB +xC RtnC4C509, VEXL+VEXH+VEXW, $92,xN,xN,TKMOVB +xC RtnC4C50A, VEXL+VEXH+VEXW, $93,xN,xN,TKMOVB +xC RtnC4C5, VEX0, $58,xO,xY,TADDPD +xC RtnC4C5, VEX0, $D0,xO,xY,TADDSUBPD +xC RtnC4C5, VEX0, $54,xO,xY,TANDPD +xC RtnC4C5, VEX0, $55,xO,xY,TANDNPD +xC RtnC4C5, VEX8, $C2,xO,xY,TCMPPD +xC RtnC4C5, VEXV or VEXL, $2F,xQ,xN,TCOMISD +xC RtnC4C5, VEXV or VEX1, $5A,xO,xY,TCVTPD2PS +xC RtnC4C5, VEXV or VEX0, $5B,xO,xY,TCVTPS2DQ +xC RtnC4C5, VEXV or VEX0 or VEX1, $E6,xO,xY,TCVTTPD2DQ +xC RtnC4C5, VEX0, $5E,xO,xY,TDIVPD +xC RtnC4C5, VEX0, $7C,xO,xY,THADDPD +xC RtnC4C5, VEX0, $7D,xO,xY,THSUBPD +xC RtnC4C5, VEXV or VEXL or VEXR, $F7,xN,xN,TMASKMOVDQU +xC RtnC4C5, VEX0, $5F,xO,xY,TMAXPD +xC RtnC4C5, VEX0, $5D,xO,xY,TMINPD +xC RtnC4C5, VEXV, $28,xO,xY,TMOVAPD +xC RtnC4C50C, VEXV, $29,xO,xY,TMOVAPD +xC RtnC4C5XRM, VEXV or VEXL, $6E,xD,xN,TMOVD +xC RtnC4C5RMX, VEXV or VEXL, $7E,xD,xN,TMOVD +xC RtnC4C50C, VEXV or VEXL, $D6,xQ,xN,TMOVQ +xC RtnC4C5, VEXV, $6F,xO,xY,TMOVDQA +xC RtnC4C50C, VEXV, $7F,xO,xY,TMOVDQA +xC RtnC4C5, VEXL or VEXM, $16,xQ,xN,TMOVHPD +xC RtnC4C50C, VEXV or VEXL or VEXM, $17,xQ,xN,TMOVHPD +xC RtnC4C5, VEXL or VEXM, $12,xQ,xN,TMOVLPD +xC RtnC4C50C, VEXV or VEXL or VEXM, $13,xQ,xN,TMOVLPD +xC RtnC4C50D, VEXV or VEXR, $50,xO,xY,TMOVMSKPD +xC RtnC4C50C, VEXV or VEXM, $E7,xO,xY,TMOVNTDQ +xC RtnC4C50C, VEXV or VEXM, $2B,xO,xY,TMOVNTPD +xC RtnC4C5, VEXV, $10,xO,xY,TMOVUPD +xC RtnC4C50C, VEXV, $11,xO,xY,TMOVUPD +xC RtnC4C5, VEX0, $59,xO,xY,TMULPD +xC RtnC4C5, VEX0, $56,xO,xY,TORPD +xC RtnC4C5, VEX0, $63,xO,xY,TPACKSSWB +xC RtnC4C5, VEX0, $6B,xO,xY,TPACKSSDW +xC RtnC4C5, VEX0, $67,xO,xY,TPACKUSWB +xC RtnC4C5, VEX0, $FC,xO,xY,TPADDB +xC RtnC4C5, VEX0, $FD,xO,xY,TPADDW +xC RtnC4C5, VEX0, $FE,xO,xY,TPADDD +xC RtnC4C5, VEX0, $D4,xO,xY,TPADDQ +xC RtnC4C5, VEX0, $EC,xO,xY,TPADDSB +xC RtnC4C5, VEX0, $ED,xO,xY,TPADDSW +xC RtnC4C5, VEX0, $DC,xO,xY,TPADDUSB +xC RtnC4C5, VEX0, $DD,xO,xY,TPADDUSW +xC RtnC4C5, VEX0, $DB,xO,xY,TPAND +xC RtnC4C5, VEX0, $DF,xO,xY,TPANDN +xC RtnC4C5, VEX0, $E0,xO,xY,TPAVGB +xC RtnC4C5, VEX0, $E3,xO,xY,TPAVGW +xC RtnC4C5, VEX0, $74,xO,xY,TPCMPEQB +xC RtnC4C5, VEX0, $75,xO,xY,TPCMPEQW +xC RtnC4C5, VEX0, $76,xO,xY,TPCMPEQD +xC RtnC4C5, VEX0, $64,xO,xY,TPCMPGTB +xC RtnC4C5, VEX0, $65,xO,xY,TPCMPGTW +xC RtnC4C5, VEX0, $66,xO,xY,TPCMPGTD +xC RtnC4C50F, VEXV or VEXL or VEXR, $C5,xN,xN,TPEXTRW +xC RtnC412, VEXL or VEXI, $C4,xW,xN,TPINSRW +xC RtnC4C5, VEX0, $F5,xO,xY,TPMADDWD +xC RtnC4C5, VEX0, $EE,xO,xY,TPMAXSW +xC RtnC4C5, VEX0, $DE,xO,xY,TPMAXUB +xC RtnC4C5, VEX0, $EA,xO,xY,TPMINSW +xC RtnC4C5, VEX0, $DA,xO,xY,TPMINUB +xC RtnC4C50D, VEXV or VEXR, $D7,xN,xN,TPMOVMSKB +xC RtnC4C5, VEX0, $E4,xO,xY,TPMULHUW +xC RtnC4C5, VEX0, $E5,xO,xY,TPMULHW +xC RtnC4C5, VEX0, $D5,xO,xY,TPMULLW +xC RtnC4C5, VEX0, $F4,xO,xY,TPMULUDQ +xC RtnC4C5, VEX0, $EB,xO,xY,TPOR +xC RtnC4C5, VEX0, $F6,xO,xY,TPSADBW +xC RtnC4C5, VEXV or VEXI, $70,xO,xY,TPSHUFD +xC C4C50F71, VEXS or VEXI or VEXR, $71,xN,xN,TNULL +xC C4C50F72, VEXS or VEXI or VEXR, $72,xN,xN,TNULL +xC C4C50F73, VEXS or VEXI or VEXR, $73,xN,xN,TNULL +xC RtnC4C510, VEX0, $F1,xO,xO,TPSLLW +xC RtnC4C510, VEX0, $F2,xO,xO,TPSLLD +xC RtnC4C510, VEX0, $F3,xO,xO,TPSLLQ +xC RtnC4C510, VEX0, $E1,xO,xO,TPSRAW +xC RtnC4C510, VEX0, $E2,xO,xO,TPSRAD +xC RtnC4C510, VEX0, $D1,xO,xO,TPSRLW +xC RtnC4C510, VEX0, $D2,xO,xO,TPSRLD +xC RtnC4C510, VEX0, $D3,xO,xO,TPSRLQ +xC RtnC4C5, VEX0, $F8,xO,xY,TPSUBB +xC RtnC4C5, VEX0, $F9,xO,xY,TPSUBW +xC RtnC4C5, VEX0, $FA,xO,xY,TPSUBD +xC RtnC4C5, VEX0, $FB,xO,xY,TPSUBQ +xC RtnC4C5, VEX0, $E8,xO,xY,TPSUBSB +xC RtnC4C5, VEX0, $E9,xO,xY,TPSUBSW +xC RtnC4C5, VEX0, $D8,xO,xY,TPSUBUSB +xC RtnC4C5, VEX0, $D9,xO,xY,TPSUBUSW +xC RtnC4C5, VEX0, $68,xO,xY,TPUNPCKHBW +xC RtnC4C5, VEX0, $69,xO,xY,TPUNPCKHWD +xC RtnC4C5, VEX0, $6A,xO,xY,TPUNPCKHDQ +xC RtnC4C5, VEX0, $6D,xO,xY,TPUNPCKHQDQ +xC RtnC4C5, VEX0, $60,xO,xY,TPUNPCKLBW +xC RtnC4C5, VEX0, $61,xO,xY,TPUNPCKLWD +xC RtnC4C5, VEX0, $62,xO,xY,TPUNPCKLDQ +xC RtnC4C5, VEX0, $6C,xO,xY,TPUNPCKLQDQ +xC RtnC4C5, VEX0, $EF,xO,xY,TPXOR +xC RtnC4C5, VEXI, $C6,xO,xY,TSHUFPD +xC RtnC4C5, VEXV, $51,xO,xY,TSQRTPD +xC RtnC4C5, VEX0, $5C,xO,xY,TSUBPD +xC RtnC4C5, VEXV or VEXL, $2E,xQ,xN,TUCOMISD +xC RtnC4C5, VEX0, $15,xO,xY,TUNPCKHPD +xC RtnC4C5, VEX0, $14,xO,xY,TUNPCKLPD +xC RtnC4C5, VEX0, $57,xO,xY,TXORPD +dd -1 +;----------------------------------------------------------------------------- +C4C5F2: +xC RtnC4C5, VEXL, $58,xQ,xN,TADDSD +xC RtnC4C5, VEX0, $D0,xO,xY,TADDSUBPS +xC RtnC4C5, VEX8 or VEXL, $C2,xQ,xN,TCMPSD +xC RtnC4C5, VEXV or VEX1, $E6,xO,xY,TCVTPD2DQ +xC RtnC4C511, VEXV or VEXL, $2D,xQ,xN,TCVTSD2SI +xC RtnC4C5, VEXL, $5A,xQ,xN,TCVTSD2SS +xC RtnC4C512, VEXL, $2A,xD,xN,TCVTSI2SD +xC RtnC4C511, VEXV or VEXL, $2C,xQ,xN,TCVTTSD2SI +xC RtnC4C5, VEXL, $5E,xQ,xN,TDIVSD +xC RtnC4C5, VEX0, $7C,xO,xY,THADDPS +xC RtnC4C5, VEX0, $7D,xO,xY,THSUBPS +xC RtnC4C5, VEXV or VEXM, $F0,xO,xY,TLDDQU +xC RtnC4C5, VEXL, $5F,xQ,xN,TMAXSD +xC RtnC4C5, VEXL, $5D,xQ,xN,TMINSD +xC RtnC4C5, VEXV, $12,xQ,xY,TMOVDDUP +xC C4C5XMJ, VEXL, $10,xQ,xN,TMOVSD +xC C4C5MXJ, VEXL, $11,xQ,xN,TMOVSD +xC RtnC4C5, VEXL, $59,xQ,xN,TMULSD +xC RtnC4C5, VEXV or VEXI, $70,xO,xY,TPSHUFLW +xC RtnC4C5, VEXL, $51,xQ,xN,TSQRTSD +xC RtnC4C5, VEXL, $5C,xQ,xN,TSUBSD +xC RtnC4C509, VEXL or VEXH, $92,xN,xN,TKMOVD +xC RtnC4C50A, VEXL or VEXH, $93,xN,xN,TKMOVD +dd -1 +;----------------------------------------------------------------------------- +C4C5F3: +xC RtnC4C5, VEXL, $58,xD,xN,TADDSS +xC RtnC4C5, VEX8 or VEXL, $C2,xD,xN,TCMPSS +xC RtnC4C5, VEXV or VEX0 or VEX2, $E6,xQ,xO,TCVTDQ2PD +xC RtnC4C512, VEXL, $2A,xD,xN,TCVTSI2SS +xC RtnC4C5, VEXL, $5A,xD,xN,TCVTSS2SD +xC RtnC4C511, VEXV or VEXL, $2D,xD,xN,TCVTSS2SI +xC RtnC4C5, VEXV, $5B,xO,xY,TCVTTPS2DQ +xC RtnC4C511, VEXV or VEXL, $2C,xD,xN,TCVTTSS2SI +xC RtnC4C5, VEXL, $5E,xD,xN,TDIVSS +xC RtnC4C5, VEXL, $5F,xD,xN,TMAXSS +xC RtnC4C5, VEXL, $5D,xD,xN,TMINSS +xC RtnC4C5, VEXV or VEXL, $7E,xQ,xN,TMOVQ +xC RtnC4C5, VEXV, $6F,xO,xY,TMOVDQU +xC RtnC4C50C, VEXV, $7F,xO,xY,TMOVDQU +xC RtnC4C5, VEXV, $16,xO,xY,TMOVSHDUP +xC RtnC4C5, VEXV, $12,xO,xY,TMOVSLDUP +xC C4C5XMJ, VEXL, $10,xD,xN,TMOVSS +xC C4C5MXJ, VEXL, $11,xD,xN,TMOVSS +xC RtnC4C5, VEXL, $59,xD,xN,TMULSS +xC RtnC4C5, VEXV or VEXI, $70,xO,xY,TPSHUFHW +xC RtnC4C5, VEXL, $53,xD,xN,TRCPSS +xC RtnC4C5, VEXL, $51,xD,xN,TSQRTSS +xC RtnC4C5, VEXL, $52,xD,xN,TRSQRTSS +xC RtnC4C5, VEXL, $5C,xD,xN,TSUBSS +dd -1 +;----------------------------------------------------------------------------- +T620000: + T62 T6201,54h,TANDPS,EVEXM+EVEXYW,xO,xD + T62 T6201,55h,TANDNPS,EVEXM+EVEXYW,xO,xD + T62 T6201,58h,TADDPS,EVEXM+EVEXYW+EVEXR,xO,xD + T62 T6202,$C2,TCMPPS,EVEXM+EVEXYW+EVEXI,xO,xD + T62 T6203,$2E,TUCOMISS,EVEXYW+EVEXX+EVEXS+EVEXV,xD,xD + T62 T6203,$2F,TCOMISS,EVEXYW+EVEXX+EVEXS+EVEXV,xD,xD + T62 T6201,5Eh,TDIVPS,EVEXM+EVEXR+EVEXYW,xO,xD + T62 T62W0,$5B,TCVT?Q2PS,EVEX2+EVEXR+EVEXB+EVEXM+EVEXE+EVEXV,xO,xD + T62 T62W1,$79,TCVTP?2UDQ,EVEX2+EVEXR+EVEXM+EVEXE+EVEXV,xO,xQ + T62 T6206,$5A,TCVTPS2PD,EVEXM+EVEXV+EVEXYW,xO,xQ + T62 T62W0,$78,TCVTTP?2UDQ,EVEX2+EVEXM+EVEXE+EVEXB+EVEXV,xO,xD + T62 T6201,5Fh,TMAXPS,EVEXM+EVEXYW,xO,xD + T62 T6201,5Dh,TMINPS,EVEXM+EVEXYW,xO,xD + T62 T6204,28h,TMOVAPS,EVEXM+EVEXYW+EVEXV,xO,xO + T62 T620B,29h,TMOVAPS,EVEXM+EVEXYW+EVEXV,xO,xO + T62 T620C,12h,TMOVLPS,EVEXLX+EVEXM+EVEXYW,xQ,xQ + T62 T620E,16h,TMOVHPS,EVEXM+EVEXLX+EVEXYW,xQ,xQ + T62 T620F,17h,TMOVHPS,EVEXM+EVEXLX+EVEXV+EVEXYW,xQ,xQ + T62 T620F,13h,TMOVLPS,EVEXM+EVEXLX+EVEXV+EVEXYW,xQ,xQ + T62 T6210,2Bh,TMOVNTPS,EVEXM+EVEXV+EVEXYW,xO,xO + T62 T6204,10h,TMOVUPS,EVEXM+EVEXV+EVEXYW,xO,xO + T62 T620B,11h,TMOVUPS,EVEXM+EVEXYW+EVEXV,xO,xO + T62 T6201,59h,TMULPS,EVEXM+EVEXR+EVEXYW,xO,xD + T62 T6201,56h,TORPS,EVEXM+EVEXR+EVEXYW,xO,xD + T62 T6201,57h,TXORPS,EVEXM+EVEXR+EVEXYW,xO,xD + T62 T6201,$C6,TSHUFPS,EVEXM+EVEXYW+EVEXI,xO,xD + T62 T6204,51h,TSQRTPS,EVEXM+EVEXR+EVEXYW+EVEXV,xO,xD + T62 T6201,5Ch,TSUBPS,EVEXM+EVEXYW+EVEXR,xO,xD + T62 T6201,15h,TUNPCKHPS,EVEXM+EVEXYW,xO,xD + T62 T6201,14h,TUNPCKLPS,EVEXM+EVEXYW,xO,xD +dd -1 +T620066: + T62 T6201,54h,TANDPD,EVEXM+EVEXNW,xO,xQ + T62 T6201,55h,TANDNPD,EVEXM+EVEXNW,xO,xQ + T62 T6201,58h,TADDPD,EVEXM+EVEXNW+EVEXR,xO,xQ + T62 T6202,$C2,TCMPPD,EVEXM+EVEXNW+EVEXI,xO,xQ + T62 T6203,2Eh,TUCOMISD,EVEXNW+EVEXX+EVEXS+EVEXV,xQ,xQ + T62 T6203,2Fh,TCOMISD,EVEXNW+EVEXX+EVEXS+EVEXV,xQ,xQ + T62 T6201,5Eh,TDIVPD,EVEXM+EVEXR+EVEXNW,xO,xQ + T62 T6205,$5A,TCVTPD2PS,EVEXM+EVEXR+EVEXNW+EVEXV,xO,xQ + T62 T6206,$7B,TCVTP?2QQ,EVEXM+EVEXR+EVEXE+EVEXV,xO,xQ + T62 T6206,$79,TCVTP?2UQQ,EVEXM+EVEXR+EVEXE+EVEXV,xO,xQ + T62 T6204,$5B,TCVTPS2DQ,EVEXM+EVEXR+EVEXYW+EVEXV,xO,xD + T62 T6205,$E6,TCVTTPD2DQ,EVEXM+EVEXNW+EVEXV,xO,xQ + T62 T6206,$7A,TCVTTP?2QQ,EVEXM+EVEXE+EVEXV,xO,xQ + T62 T6206,$78,TCVTTP?2UQQ,EVEXM+EVEXE+EVEXV,xO,xQ + T62 T6201,5Fh,TMAXPD,EVEXM+EVEXNW,xO,xQ + T62 T6201,5Dh,TMINPD,EVEXM+EVEXNW,xO,xQ + T62 T6204,28h,TMOVAPD,EVEXM+EVEXNW+EVEXV,xO,xO + T62 T620B,29h,TMOVAPD,EVEXM+EVEXNW+EVEXV,xO,xO + T62 T6211,6Eh,TMOVD,EVEXM+EVEXQ1+EVEXNW+EVEXYW+EVEXV,xD,xD + T62 T6212,7Eh,TMOVD,EVEXM+EVEXQ1+EVEXNW+EVEXYW+EVEXV,xD,xD + T62 T620B,$D6,TMOVQ,EVEXM+EVEXNW+EVEXV,xQ,xQ + T62 T6204,6Fh,TMOVDQA??,EVEXM+EVEXE+EVEXV,xO,xO + T62 T620B,7Fh,TMOVDQA??,EVEXM+EVEXE+EVEXV,xO,xO + T62 T620D,16h,TMOVHPD,EVEXM+EVEXLX+EVEXNW,xQ,xQ + T62 T620D,12h,TMOVLPD,EVEXM+EVEXLX+EVEXNW,xQ,xQ + T62 T620F,17h,TMOVHPD,EVEXM+EVEXLX+EVEXV+EVEXNW,xQ,xQ + T62 T620F,13h,TMOVLPD,EVEXM+EVEXLX+EVEXV+EVEXNW,xQ,xQ + T62 T6210,$E7,TMOVNTDQ,EVEXM+EVEXV+EVEXYW,xO,xO + T62 T6210,2Bh,TMOVNTPD,EVEXM+EVEXV+EVEXNW,xO,xO + T62 T6204,10h,TMOVUPD,EVEXM+EVEXV+EVEXNW,xO,xO + T62 T620B,11h,TMOVUPD,EVEXM+EVEXNW+EVEXV,xO,xO + T62 T6201,$F6,TPSADBW,EVEXM,xO,xO + T62 T6201,59h,TMULPD,EVEXM+EVEXR+EVEXNW,xO,xQ + T62 T6201,56h,TORPD,EVEXM+EVEXR+EVEXNW,xO,xQ + T62 T6201,57h,TXORPD,EVEXM+EVEXR+EVEXNW,xO,xQ + T62 T6201,63h,TPACKSSWB,EVEXM,xO,xO + T62 T6201,6Bh,TPACKSSDW,EVEXM+EVEXR+EVEXYW,xO,xD + T62 T6201,67h,TPACKUSWB,EVEXM,xO,xO + T62 T6201,$FC,TPADDB,EVEXM,xO,xO + T62 T6201,$FD,TPADDW,EVEXM,xO,xO + T62 T6201,$FE,TPADDD,EVEXM+EVEXR+EVEXYW,xO,xD + T62 T6201,$D4,TPADDQ,EVEXM+EVEXR+EVEXNW,xO,xQ + T62 T6201,$EC,TPADDSB,EVEXM,xO,xO + T62 T6201,$ED,TPADDSW,EVEXM,xO,xO + T62 T6201,$DC,TPADDUSB,EVEXM,xO,xO + T62 T6201,$DD,TPADDUSW,EVEXM,xO,xO + T62 T6201,$DB,TPANDD,EVEXM+EVEXQ1+EVEXB+EVEXR,xO,xD + T62 T6201,$DF,TPANDND,EVEXM+EVEXQ1+EVEXB+EVEXR,xO,xD + T62 T6201,$E0,TPAVGB,EVEXM,xO,xO + T62 T6201,$E3,TPAVGW,EVEXM,xO,xO + T62 T6202,$76,TPCMPEQD,EVEXM+EVEXYW,xO,xD + T62 T6202,$74,TPCMPEQB,EVEXM,xO,xO + T62 T6202,$75,TPCMPEQW,EVEXM,xO,xO + T62 T6202,$66,TPCMPGTD,EVEXM+EVEXYW,xO,xD + T62 T6202,$64,TPCMPGTB,EVEXM,xO,xO + T62 T6202,$65,TPCMPGTW,EVEXM,xO,xO + T62 T6213,$C5,TPEXTRW,EVEXV+EVEXI+EVEXM+EVEXLX,xW,xW + T62 T6201,$F5,TPMADDWD,EVEXM,xO,xO + T62 T6214,$C4,TPINSRW,EVEXM+EVEXLX+EVEXI,xW,xW + T62 T6201,$EE,TPMAXSW,EVEXM,xO,xO + T62 T6201,$DE,TPMAXUB,EVEXM,xO,xO + T62 T6201,$EA,TPMINSW,EVEXM,xO,xO + T62 T6201,$DA,TPMINUB,EVEXM,xO,xO + T62 T6201,$E4,TPMULHUW,EVEXM,xO,xO + T62 T6201,$E5,TPMULHW,EVEXM,xO,xO + T62 T6201,$D5,TPMULLW,EVEXM,xO,xO + T62 T6201,$F4,TPMULUDQ,EVEXNW+EVEXM+EVEXB,xO,xD + T62 T6201,$EB,TPORD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6204,70h,TPSHUFD,EVEXYW+EVEXM+EVEXI+EVEXV,xO,xD + T62 T6215,$F1,TPSLLW,EVEXM,xO,xO + T62 T6215,$F2,TPSLLD,EVEXYW+EVEXM,xO,xO + T62 T6215,$F3,TPSLLQ,EVEXNW+EVEXM,xO,xO + T62 T6271,71h,TNULL,EVEXM+EVEXI,xO,xO + T62 T6272,72h,TNULL,EVEXM+EVEXB+EVEXI,xO,xD + T62 T6273,73h,TNULL,EVEXM+EVEXB+EVEXI,xO,xD + T62 T6215,$E1,TPSRAW,EVEXM,xO,xO + T62 T6215,$E2,TPSRAD,EVEXQ1+EVEXM,xO,xO + T62 T6215,$D1,TPSRLW,EVEXM,xO,xO + T62 T6215,$D2,TPSRLD,EVEXYW+EVEXQ1+EVEXM,xO,xO + T62 T6215,$D3,TPSRLQ,EVEXNW+EVEXM,xO,xO + T62 T6201,$F8,TPSUBB,EVEXM,xO,xD + T62 T6201,$F9,TPSUBW,EVEXM,xO,xD + T62 T6201,$FA,TPSUBD,EVEXM+EVEXYW+EVEXB,xO,xD + T62 T6201,$FB,TPSUBQ,EVEXM+EVEXNW+EVEXB,xO,xD + T62 T6201,$E8,TPSUBSB,EVEXM,xO,xD + T62 T6201,$E9,TPSUBSW,EVEXM,xO,xD + T62 T6201,$D8,TPSUBUSB,EVEXM,xO,xD + T62 T6201,$D9,TPSUBUSW,EVEXM,xO,xD + T62 T6201,68h,TPUNPCKHBW,EVEXM,xO,xD + T62 T6201,69h,TPUNPCKHWD,EVEXM,xO,xD + T62 T6201,6Ah,TPUNPCKHDQ,EVEXYW+EVEXM,xO,xD + T62 T6201,6Dh,TPUNPCKHQDQ,EVEXNW+EVEXM,xO,xQ + T62 T6201,60h,TPUNPCKLBW,EVEXM,xO,xD + T62 T6201,61h,TPUNPCKLWD,EVEXM,xO,xD + T62 T6201,62h,TPUNPCKLDQ,EVEXYW+EVEXM,xO,xD + T62 T6201,6Ch,TPUNPCKLQDQ,EVEXNW+EVEXM,xO,xQ + T62 T6201,$C6,TSHUFPD,EVEXM+EVEXNW+EVEXI,xO,xQ + T62 T6206,51h,TSQRTPD,EVEXM+EVEXR+EVEXNW+EVEXV,xO,xQ + T62 T6201,$EF,TPXORD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6201,5Ch,TSUBPD,EVEXM+EVEXNW+EVEXR,xO,xQ + T62 T6201,15h,TUNPCKHPD,EVEXM+EVEXNW,xO,xQ + T62 T6201,14h,TUNPCKLPD,EVEXM+EVEXNW,xO,xQ +dd -1 +T6200F3: + T62 T6201,5Ch,TSUBSS,EVEXM+EVEXYW+EVEXR+EVEXX,xD,xD + T62 T6201,58h,TADDSS,EVEXM+EVEXYW+EVEXR+EVEXX,xD,xD + T62 T6201,59h,TMULSS,EVEXM+EVEXYW+EVEXR+EVEXX,xD,xD + T62 T6202,$C2,TCMPSS,EVEXM+EVEXYW+EVEXI+EVEXX,xD,xD + T62 T6201,5Eh,TDIVSS,EVEXM+EVEXYW+EVEXR+EVEXX,xD,xD + T62 T62W2,$E6,TCVT?Q2PD,EVEX2+EVEXO+EVEXR+EVEXM+EVEXE+EVEXB+EVEXV,xO,xD + T62 T6201,5Ah,TCVTSS2SD,EVEXM+EVEXX+EVEXYW,xD,xD + T62 T6213,2Dh,TCVTSS2SI,EVEXM+EVEXR+EVEXX+EVEXW0+EVEXV,xQ,xQ + T62 T6214,2Ah,TCVTSI2SS,EVEXU+EVEXR+EVEXM+EVEXX+EVEXNW+EVEXYW,xD,xD + T62 T6213,79h,TCVTSS2USI,EVEXM+EVEXX+EVEXW0+EVEXV,xD,xD + T62 T6213,2Ch,TCVTTSS2SI,EVEXM+EVEXX+EVEXW0+EVEXV,xQ,xQ + T62 T6213,78h,TCVTTSS2USI,EVEXM+EVEXX+EVEXW0+EVEXV,xD,xD + T62 T6204,$5B,TCVTTPS2DQ,EVEXM+EVEXYW+EVEXV,xO,xD + T62 T6206,$7A,TCVTU?Q2PD,EVEXM+EVEXO+EVEXR+EVEXE+EVEXV,xO,xQ + T62 T6214,7Bh,TCVTUSI2SS,EVEXU+EVEXR+EVEXX+EVEXM+EVEXNW+EVEXYW,xD,xD + T62 T6201,5Fh,TMAXSS,EVEXM+EVEXX+EVEXYW,xD,xD + T62 T6201,5Dh,TMINSS,EVEXM+EVEXX+EVEXYW,xD,xD + T62 T6204,7Eh,TMOVQ,EVEXM+EVEXNW+EVEXV,xQ,xQ + T62 T6204,6Fh,TMOVDQU?2,EVEXM+EVEXE+EVEXV,xO,xO + T62 T620B,7Fh,TMOVDQU?2,EVEXM+EVEXE+EVEXV,xO,xO + T62 T6204,16h,TMOVSHDUP,EVEXM+EVEXV+EVEXYW,xO,xO + T62 T6204,12h,TMOVSLDUP,EVEXM+EVEXV+EVEXYW,xO,xO + T62 T6216,10h,TMOVSS,EVEXM+EVEXX+EVEXYW,xD,xD + T62 T6217,11h,TMOVSS,EVEXM+EVEXX+EVEXYW,xD,xD + T62 T6204,70h,TPSHUFHW,EVEXM+EVEXI+EVEXV,xO,xO + T62 T6201,51h,TSQRTSS,EVEXX+EVEXM+EVEXYW+EVEXR+EVEXX,xD,xD +dd -1 +T6200F2: + T62 T6201,5Ch,TSUBSD,EVEXM+EVEXNW+EVEXR+EVEXX,xQ,xQ + T62 T6201,58h,TADDSD,EVEXM+EVEXNW+EVEXR+EVEXX,xQ,xQ + T62 T6201,59h,TMULSD,EVEXM+EVEXNW+EVEXR+EVEXX,xQ,xQ + T62 T6202,$C2,TCMPSD,EVEXM+EVEXNW+EVEXI+EVEXX,xQ,xQ + T62 T6201,5Eh,TDIVSD,EVEXM+EVEXNW+EVEXR+EVEXX,xQ,xQ + T62 T6205,$E6,TCVTPD2DQ,EVEXM+EVEXR+EVEXNW+EVEXV,xO,xQ + T62 T6213,2Dh,TCVTSD2SI,EVEXM+EVEXR+EVEXX+EVEXW0+EVEXV,xQ,xQ + T62 T6213,79h,TCVTSD2USI,EVEXM+EVEXR+EVEXX+EVEXW0+EVEXV,xQ,xQ + T62 T6201,5Ah,TCVTSD2SS,EVEXM+EVEXR+EVEXNW,xQ,xQ + T62 T6214,2Ah,TCVTSI2SD,EVEXU+EVEXR+EVEXM+EVEXX+EVEXNW+EVEXYW,xD,xD + T62 T6213,2Ch,TCVTTSD2SI,EVEXM+EVEXX+EVEXW0+EVEXV,xQ,xQ + T62 T6213,78h,TCVTTSD2USI,EVEXM+EVEXX+EVEXW0+EVEXV,xQ,xQ + T62 T62W1,7Ah,TCVTU?Q2PS,EVEX2+EVEXR+EVEXM+EVEXE+EVEXV,xO,xQ + T62 T6214,7Bh,TCVTUSI2SD,EVEXU+EVEXR+EVEXX+EVEXM+EVEXNW+EVEXYW,xD,xD + T62 T6201,5Fh,TMAXSD,EVEXM+EVEXNW,xQ,xQ + T62 T6201,5Dh,TMINSD,EVEXM+EVEXNW,xQ,xQ + T62 T6218,12h,TMOVDDUP,EVEXM+EVEXNW+EVEXV,xQ,xQ + T62 T6204,6Fh,TMOVDQU??,EVEXM+EVEXE+EVEXV,xO,xO + T62 T620B,7Fh,TMOVDQU??,EVEXM+EVEXE+EVEXV,xO,xO + T62 T6216,10h,TMOVSD,EVEXM+EVEXX+EVEXNW,xQ,xQ + T62 T6217,11h,TMOVSD,EVEXM+EVEXX+EVEXNW,xQ,xQ + T62 T6204,70h,TPSHUFLW,EVEXM+EVEXI+EVEXV,xO,xO + T62 T6201,51h,TSQRTSD,EVEXM+EVEXNW+EVEXR+EVEXX,xQ,xQ +dd -1 +T623800: +dd -1 +T623866: + T62 T6201,64h,TPBLENDMD,EVEXB+EVEXM+EVEXQ1+EVEX0,xX,xD + T62 T6201,65h,TBLENDMPS,EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,66h,TPBLENDM?,EVEXM+EVEXE,xX,0 + T62 T6203,19h,TBROADCAST??,EVEXL0+EVEXE+EVEX0,xQ,xQ + T62 T6203,18h,TBROADCASTSS,EVEXYW,xD,xD + T62 T6219,1Ah,TBROADCASTF??X2,EVEXL0+EVEXE+EVEXV,xO,xO + T62 T621A,1Bh,TBROADCASTF??X?,EVEXLL+EVEXE+EVEXV,xY,xY + T62 T62RB,7Ah,TPBROADCASTB,EVEXYW+EVEXV,xN,xN + T62 T62RW,7Bh,TPBROADCASTW,EVEXYW+EVEXV,xN,xN + T62 T62RD,7Ch,TPBROADCASTD,EVEXQ1+EVEXV,xN,xN + T62 T6203,78h,TPBROADCASTB,EVEXYW+EVEXV,xB,xB + T62 T6203,79h,TPBROADCASTW,EVEXYW+EVEXV,xW,xW + T62 T6203,58h,TPBROADCASTD,EVEXYW+EVEXV,xD,xD + T62 T6203,59h,TBROADCASTI??,EVEXE+EVEXV,xQ,xQ + T62 T6219,5Ah,TBROADCASTI??X2,EVEXL0+EVEXE+EVEXV,xX,xX + T62 T621A,5Bh,TBROADCASTI??X?,EVEXLL+EVEXE+EVEXV,xY,xY + T62 T620B,8Ah,TCOMPRESSPS,EVEXM+EVEXD1+EVEXV,xO,xO + T62 T6207,13h,TCVTPH2PS,EVEXM+EVEXYW+EVEXV,xQ,xQ + T62 T6204,88h,TEXPANDPS,EVEXM+EVEXD1+EVEXV,xO,xO + T62 T6201,98h,TFMADD132PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$A8,TFMADD213PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$B8,TFMADD231PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$96,TFMADDSUB132PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$A6,TFMADDSUB213PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$B6,TFMADDSUB231PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$97,TFMSUBADD132PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$A7,TFMSUBADD213PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$B7,TFMSUBADD231PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$9A,TFMSUB132PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$AA,TFMSUB213PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$BA,TFMSUB231PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$9C,TFNMADD132PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$AC,TFNMADD213PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$BC,TFNMADD231PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$9E,TFNMSUB132PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$AE,TFNMSUB213PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$BE,TFNMSUB231PS,EVEXR+EVEXB+EVEXM+EVEXD1,xX,xD + T62 T6201,$99,TFMADD132SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$A9,TFMADD213SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$B9,TFMADD231SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$9B,TFMSUB132SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$AB,TFMSUB213SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$BB,TFMSUB231SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$9D,TFNMADD132SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$AD,TFNMADD213SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$BD,TFNMADD231SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$9F,TFNMSUB132SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$AF,TFNMSUB213SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6201,$BF,TFNMSUB231SS,EVEXR+EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T6200,$90,TPGATHERDD,EVEXM+EVEXQ1,xN,xN + T62 T621B,$91,TPGATHERQD,EVEXM+EVEXQ1,xN,xN + T62 T6200,$92,TGATHERDPS,EVEXM+EVEXD1,xN,xN + T62 T621B,$93,TGATHERQPS,EVEXM+EVEXD1,xN,xN + T62 T6204,$42,TGETEXPPS,EVEXB+EVEXM+EVEXD1+EVEXV,xO,xD + T62 T6201,$43,TGETEXPSS,EVEXU+EVEXX+EVEXM+EVEXD1,xD,xD + T62 T621C,2Ah,TMOVNTDQA,EVEXM+EVEXV+EVEXYW,xO,xO + T62 T6204,1Ch,TPABSB,EVEXM+EVEXV,xO,xO + T62 T6204,1Dh,TPABSW,EVEXM+EVEXV,xO,xO + T62 T6204,1Eh,TPABSD,EVEXM+EVEXR+EVEXYW+EVEXV,xO,xD + T62 T6204,1Fh,TPABSQ,EVEXM+EVEXR+EVEXNW+EVEXV,xO,xQ + T62 T6201,2Bh,TPACKUSDW,EVEXM+EVEXR+EVEXYW,xO,xD + T62 T6202,29h,TPCMPEQQ,EVEXM+EVEXNW,xO,xQ + T62 T6202,37h,TPCMPGTQ,EVEXM+EVEXNW,xO,xQ + T62 T620B,8Bh,TPCOMPRESSD,EVEXM+EVEXQ1+EVEXV,xO,xO + T62 T6204,$C4,TPCONFLICTD,EVEXM+EVEXB+EVEXQ1+EVEXV,xO,xD + T62 T6201,8Dh,TPERM?,EVEXM+EVEXE,xO,xO + T62 T6201,36h,TPERMD,EVEXM+EVEXQ1+EVEXB+EVEXL0,xO,xD + T62 T6201,75h,TPERMI2?,EVEXM+EVEXE,xO,xO + T62 T6201,76h,TPERMI2D,EVEXM+EVEXB+EVEXQ1,xO,xD + T62 T6201,77h,TPERMI2PS,EVEXM+EVEXB+EVEXD1,xO,xD + T62 T6201,7Dh,TPERMI2?2,EVEXM+EVEXE,xO,xO + T62 T6201,7Eh,TPERMT2D,EVEXM+EVEXB+EVEXQ1,xO,xD + T62 T6201,7Fh,TPERMT2PS,EVEXM+EVEXB+EVEXD1,xO,xD + T62 T6201,0Dh,TPERMILPD,EVEXNW+EVEXM+EVEXB,xO,xD + T62 T6201,0Ch,TPERMILPS,EVEXYW+EVEXM+EVEXB,xO,xD + T62 T6201,16h,TPERMPS,EVEXD1+EVEXM+EVEXB,xO,xD + T62 T6204,89h,TPEXPANDD,EVEXM+EVEXQ1+EVEXV,xO,xO + T62 T6204,44h,TPLZCNTD,EVEXQ1+EVEXM+EVEXB+EVEXV,xO,xD + T62 T6201,04h,TPMADDUBSW,EVEXM,xO,xO + T62 T6201,$B4,TPMADD52LUQ,EVEXNW+EVEXM+EVEXB,xO,xD + T62 T6201,$B5,TPMADD52HUQ,EVEXNW+EVEXM+EVEXB,xO,xD + T62 T6201,3Ch,TPMAXSB,EVEXM,xO,xO + T62 T6201,3Dh,TPMAXSD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6201,3Eh,TPMAXUW,EVEXM,xO,xO + T62 T6201,3Fh,TPMAXUD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6201,38h,TPMINSB,EVEXM,xO,xO + T62 T6201,39h,TPMINSD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6201,3Ah,TPMINUW,EVEXM,xO,xO + T62 T6201,3Bh,TPMINUD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6207,20h,TPMOVSXBW,EVEXM+EVEXV,xQ,xQ + T62 T6207,23h,TPMOVSXWD,EVEXM+EVEXV,xQ,xQ + T62 T6207,25h,TPMOVSXDQ,EVEXYW+ EVEXM+EVEXV,xQ,xQ + T62 T6203,21h,TPMOVSXBD,EVEXM+EVEXV,xD,xD + T62 T6203,22h,TPMOVSXBQ,EVEXM+EVEXV,xW,xW + T62 T6203,24h,TPMOVSXWQ,EVEXM+EVEXV,xD,xD + T62 T6207,30h,TPMOVZXBW,EVEXM+EVEXV,xQ,xQ + T62 T6207,33h,TPMOVZXWD,EVEXM+EVEXV,xQ,xQ + T62 T6207,35h,TPMOVZXDQ,EVEXYW+EVEXM+EVEXV,xQ,xQ + T62 T6203,31h,TPMOVZXBD,EVEXM+EVEXV,xD,xD + T62 T6203,32h,TPMOVZXBQ,EVEXM+EVEXV,xW,xW + T62 T6203,34h,TPMOVZXWQ,EVEXM+EVEXV,xD,xD + T62 T6201,28h,TPMULDQ,EVEXM+EVEXNW,xO,xQ + T62 T6201,0Bh,TPMULHRSW,EVEXM,xO,xO + T62 T6201,40h,TPMULLD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6201,83h,TPMULTISHIFTQB,EVEXNW+EVEXM+EVEXB,xO,xD + T62 T6201,15h,TPROLVD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6201,14h,TPRORVD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T62V1XYZ,$A0,TPSCATTERDD,EVEXM+EVEXQ1,xD,xD + T62 T62V2XYZ,$A1,TPSCATTERQD,EVEXM+EVEXQ1,xD,xD + T62 T6201,00h,TPSHUFB,EVEXM,xO,xO + T62 T6201,12h,TPSLLVW,EVEXNW+EVEXM,xO,xO + T62 T6201,47h,TPSLLVD,EVEXM+EVEXB+EVEXQ1,xO,xD + T62 T6201,10h,TPSRLVW,EVEXNW+EVEXM,xO,xO + T62 T6201,45h,TPSRLVD,EVEXM+EVEXB+EVEXQ1,xO,xD + T62 T6202,26h,TPTESTM?,EVEXM+EVEXE,xO,xO + T62 T6202,27h,TPTESTMD,EVEXQ1+EVEXM+EVEXB,xO,xD + T62 T6201,11h,TPSRAVW,EVEXM+EVEXNW,xO,xO + T62 T6201,46h,TPSRAVD,EVEXQ1+EVEXB+EVEXM,xO,xD + T62 T6204,4Ch,TRCP14PS,EVEXM+EVEXB+EVEXD1,xO,xD + T62 T6201,4Dh,TRCP14SS,EVEXX+EVEXM+EVEXU+EVEXD1,xD,xD + T62 T6204,4Eh,TRSQRT14PS,EVEXM+EVEXB+EVEXD1,xO,xD + T62 T6201,2Ch,TSCALEFPS,EVEXM+EVEXB+EVEXR+EVEXD1,xO,xD + T62 T6201,4Fh,TRSQRT14SS,EVEXX+EVEXU+EVEXM+EVEXD1,xD,xD + T62 T6201,2Dh,TSCALEFSS,EVEXX+EVEXU+EVEXM+EVEXR+EVEXD1,xD,xD + T62 T62V1XYZ,$A2,TSCATTERDPS,EVEXM+EVEXD1,xD,xD + T62 T62V2XYZ,$A3,TSCATTERQPS,EVEXM+EVEXD1,xD,xD + T62 T6204,$C8,TEXP2PS,EVEXLL+EVEXM+EVEXB+EVEXD1+EVEXV,xO,xD + T62 T6204,$CA,TRCP28PS,EVEXLL+EVEXM+EVEXB+EVEXD1+EVEXV,xO,xD + T62 T6204,$CC,TRSQRT28PS,EVEXLL+EVEXM+EVEXB+EVEXD1+EVEXV,xO,xD + T62 T6201,$CB,TRCP28SS,EVEXX+EVEXU+EVEXM+EVEXD1,xD,xD + T62 T6201,$CD,TRSQRT28SS,EVEXX+EVEXU+EVEXM+EVEXD1,xD,xD + T62 T62XYZVV1,$C6,TNULL,EVEXU,xD,xD + T62 T62XYZVV2,$C7,TNULL,EVEXU,xD,xD + T62 T6201,$CF,TGF2P8MULB,EVEXR+EVEXB+EVEXM+EVEXYW,xX,xD + T62 T6201,$DE,TAESDEC,EVEXM,xO,xO + T62 T6201,$DF,TAESDECLAST,EVEXM,xO,xO + T62 T6201,$DC,TAESENC,EVEXM,xO,xO + T62 T6201,$DD,TAESENCLAST,EVEXM,xO,xO + T62 T6201,50h,TPDPBUSD,EVEXM+EVEXB,xO,xD + T62 T6201,51h,TPDPBUSDS,EVEXM+EVEXB,xO,xD + T62 T6201,52h,TPDPWSSD,EVEXM+EVEXB,xO,xD + T62 T6201,53h,TPDPWSSDS,EVEXM+EVEXB,xO,xD + T62 T6204,54h,TPOPCNT?A,EVEXM+EVEXV+EVEXE,xO,xO + T62 T6204,55h,TPOPCNTD,EVEXM+EVEXV+EVEXQ1,xO,xO + T62 T6201,70h,TPSHLDVW,EVEXM+EVEXNW,xO,xQ + T62 T6201,71h,TPSHLDVD,EVEXM+EVEXB+EVEXQ1,xO,xD + T62 T6201,72h,TPSHRDVW,EVEXM+EVEXNW,xO,xQ + T62 T6201,73h,TPSHRDVD,EVEXM+EVEXB+EVEXQ1,xO,xD + T62 T6202,8Fh,TPSHUFBITQMB,EVEXM,xO,xO + T62 T6204,62h,TPEXPAND?,EVEXM+EVEXV+EVEXE,xO,xO + T62 T620B,63h,TPCOMPRESS?,EVEXM+EVEXV+EVEXE,xO,xO +dd -1 +T6238F3: + T62 T621D,2Ah,TPBROADCASTMB2Q,EVEXV+EVEXM+EVEXNW,xN,xN + T62 T621D,3Ah,TPBROADCASTMW2D,EVEXV+EVEXM+EVEXYW,xN,xN + T62 T621D,28h,TPMOVM2?,EVEXE+EVEXV+EVEXM,xN,xN + T62 T621D,38h,TPMOVM2D,EVEXQ1+EVEXV+EVEXM,xN,xN + T62 T621E,29h,TPMOVB?2M,EVEXE+EVEXV+EVEXM,xN,xN + T62 T621E,39h,TPMOVD?2M,EVEXE+EVEXV+EVEXM,xN,xN + T62 T6220,12h,TPMOVUSQB,EVEXYW+EVEXV+EVEXM+EVEXB,xW,xW + T62 T6220,22h,TPMOVSQB,EVEXYW+EVEXV+EVEXM+EVEXB,xW,xW + T62 T6220,32h,TPMOVQB,EVEXYW+EVEXV+EVEXM+EVEXB,xW,xW + T62 T6220,14h,TPMOVUSQW,EVEXYW+EVEXV+EVEXM+EVEXB,xD,xD + T62 T6220,24h,TPMOVSQW,EVEXYW+EVEXV+EVEXM+EVEXB,xD,xD + T62 T6220,34h,TPMOVQW,EVEXYW+EVEXV+EVEXM+EVEXB,xD,xD + T62 T620A,15h,TPMOVUSQD,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T620A,25h,TPMOVSQD,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T620A,35h,TPMOVQD,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T6220,11h,TPMOVUSDB,EVEXYW+EVEXV+EVEXM+EVEXB,xD,xD + T62 T6220,21h,TPMOVSDB,EVEXYW+EVEXV+EVEXM+EVEXB,xD,xD + T62 T6220,31h,TPMOVDB,EVEXYW+EVEXV+EVEXM+EVEXB,xD,xD + T62 T620A,13h,TPMOVUSDW,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T620A,23h,TPMOVSDW,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T620A,33h,TPMOVDW,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T620A,10h,TPMOVUSWB,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T620A,20h,TPMOVSWB,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T620A,30h,TPMOVWB,EVEXYW+EVEXV+EVEXM+EVEXB,xQ,xQ + T62 T6202,26h,TPTESTNM?,EVEXM+EVEXE,xO,xO + T62 T6202,27h,TPTESTNMD,EVEXQ1+EVEXM+EVEXB,xO,xD +dd -1 +T6238F2: + T62 T6244,9Ah,T4FMADDPS,EVEXYW+EVEXM+EVEXLL,xO,xO + T62 T6244,$AA,T4FNMADDPS,EVEXYW+EVEXM+EVEXLL,xO,xO + T62 T6244,9Bh,T4FMADDSS,EVEXYW+EVEXM+EVEXX,xO,xO + T62 T6244,$AB,T4FNMADDSS,EVEXYW+EVEXM+EVEXX,xO,xO + T62 T6244,53h,TP4DPWSSDS,EVEXYW+EVEXM+EVEXLL,xO,xO + T62 T6244,52h,TP4DPWSSD,EVEXYW+EVEXM+EVEXLL,xO,xO +dd -1 +T623A00: +dd -1 +T623A66: + T62 T6201,03h,TALIGND,EVEXB+EVEXM+EVEXQ1+EVEXI,xO,xD + T62 T620A,1Dh,TCVTPS2PH,EVEXM+EVEXI+EVEXYW+EVEXV,xQ,xQ + T62 T6201,42h,TDBPSADBW,EVEXM+EVEXYW+EVEXI,xO,xO + T62 T6221,19h,TEXTRACTF??X2,EVEXE+EVEXM+EVEXV+EVEXI,xO,xO + T62 T6222,1Bh,TEXTRACTF??X?,EVEXE+EVEXM+EVEXV+EVEXI,xY,xY + T62 T6221,39h,TEXTRACTI??X2,EVEXE+EVEXM+EVEXV+EVEXI,xO,xO + T62 T6222,3Bh,TEXTRACTI??X?,EVEXE+EVEXM+EVEXV+EVEXI,xY,xY + T62 T6223,17h,TEXTRACTPS,EVEXV+EVEXI,xD,xD + T62 T6201,54h,TFIXUPIMMPS,EVEXB+EVEXM+EVEXD1+EVEXI,xO,xD + T62 T6201,55h,TFIXUPIMMSS,EVEXU+EVEXX+EVEXM+EVEXD1+EVEXI,xD,xD + T62 T621F,66h,TFPCLASSPS,EVEXB+EVEXM+EVEXD1+EVEXV+EVEXI,xO,xD + T62 T621F,67h,TFPCLASSSS,EVEXU+EVEXX+EVEXM+EVEXD1+EVEXV+EVEXI,xD,xD + T62 T6204,26h,TGETMANTPS,EVEXB+EVEXM+EVEXD1+EVEXV+EVEXI,xO,xD + T62 T6201,$27,TGETMANTSS,EVEXU+EVEXX+EVEXM+EVEXD1+EVEXI,xD,xD + T62 T6224,18h,TINSERTF??X?,EVEXE+EVEXM+EVEXI,xX,xX + T62 T6225,1Ah,TINSERTF??X2,EVEXE+EVEXM+EVEXI,xX,xX + T62 T6224,38h,TINSERTI??X2,EVEXE+EVEXM+EVEXI,xX,xX + T62 T6225,3Ah,TINSERTI??X?,EVEXE+EVEXM+EVEXI,xX,xX + T62 T6201,$21,TINSERTPS,EVEXU+EVEXM+EVEXD1+EVEXYW+EVEXI,xD,xD + T62 T6201,0Fh,TPALIGNR,EVEXM+EVEXI,xO,xO + T62 T6202,3Fh,TPCMP?,EVEXM+EVEXE+EVEXI,xO,xO + T62 T6202,3Eh,TPCMPU?,EVEXM+EVEXE+EVEXI,xO,xO + T62 T6202,1Fh,TPCMPD,EVEXQ1+EVEXB+EVEXM+EVEXI,xO,xD + T62 T6202,1Eh,TPCMPUD,EVEXQ1+EVEXB+EVEXM+EVEXI,xO,xD + T62 T6204,05h,TPERMILPD,EVEXNW+EVEXV+EVEXB+EVEXM+EVEXI,xO,xD + T62 T6204,04h,TPERMILPS,EVEXYW+EVEXB+EVEXM+EVEXV+EVEXI,xO,xD + T62 T6204,01h,TPERMPD,EVEXNW+EVEXL0+EVEXV+EVEXB+EVEXM+EVEXI,xO,xD + T62 T6204,00h,TPERMQ,EVEXNW+EVEXL0+EVEXV+EVEXB+EVEXM+EVEXI,xO,xD + T62 T6212,14h,TPEXTRB,EVEXV+EVEXI+EVEXM+EVEXLX,xB,xB + T62 T6212,15h,TPEXTRW,EVEXV+EVEXI+EVEXM+EVEXLX,xW,xW + T62 T6212,16h,TPEXTRD,EVEXV+EVEXI+EVEXM+EVEXLX+EVEXU+EVEXQ1,xD,xD + T62 T6214,20h,TPINSRB,EVEXM+EVEXLX+EVEXI,xB,xB + T62 T6214,22h,TPINSRD,EVEXQ1+EVEXU+EVEXM+EVEXLX+EVEXI,xD,xD + T62 T6201,23h,TSHUFF?,EVEXE+EVEXM+EVEXL0+EVEXB+EVEXI,xO,xD + T62 T6201,43h,TSHUFI?,EVEXE+EVEXM+EVEXL0+EVEXB+EVEXI,xO,xD + T62 T6201,25h,TPTERNLOGD,EVEXM+EVEXB+EVEXQ1+EVEXI,xO,xD + T62 T6201,50h,TRANGEPS,EVEXM+EVEXB+EVEXD1+EVEXI,xO,xD + T62 T6201,51h,TRANGESS,EVEXX+EVEXM+EVEXU+EVEXD1+EVEXI,xD,xD + T62 T6204,56h,TREDUCEPS,EVEXD1+EVEXB+EVEXM+EVEXI+EVEXV,xO,xD + T62 T6201,57h,TREDUCESS,EVEXX+EVEXM+EVEXU+EVEXD1+EVEXI,xD,xD + T62 T6204,09h,TRNDSCALEPD,EVEXB+EVEXM+EVEXNW+EVEXI+EVEXV,xO,xD + T62 T6204,08h,TRNDSCALEPS,EVEXB+EVEXM+EVEXYW+EVEXI+EVEXV,xO,xD + T62 T6201,0Bh,TRNDSCALESD,EVEXX+EVEXM+EVEXNW+EVEXI,xQ,xQ + T62 T6201,0Ah,TRNDSCALESS,EVEXX+EVEXM+EVEXYW+EVEXI,xD,xD + T62 T6201,$CE,TGF2P8AFFINEQB,EVEXM+EVEXNW+EVEXI,xO,xQ + T62 T6201,$CF,TGF2P8AFFINEINVQB,EVEXM+EVEXNW+EVEXI,xO,xQ + T62 T6201,44h,TPCLMULQDQ,EVEXM+EVEXI,xO,xO + T62 T6201,70h,TPSHLDW,EVEXM+EVEXNW+EVEXI,xO,xQ + T62 T6201,71h,TPSHLDD,EVEXM+EVEXB+EVEXI+EVEXQ1,xO,xD + T62 T6201,72h,TPSHRDW,EVEXM+EVEXNW+EVEXI,xO,xQ + T62 T6201,73h,TPSHRDD,EVEXM+EVEXB+EVEXI+EVEXQ1,xO,xD +dd -1 +T623AF3: +dd -1 +T623AF2: +dd -1 +;----------------------------------------------------------------------------- +T62Names: +TEXTRACTI??X?: dw TEXTRACTI32X8 ,TEXTRACTI64X4 +TEXTRACTF??X?: dw TEXTRACTF32X8 ,TEXTRACTF64X4 +TEXTRACTF??X2: dw TEXTRACTF32X4 ,TEXTRACTF64X2 +TEXTRACTI??X2: dw TEXTRACTI32X4 ,TEXTRACTI64X2 +TINSERTI??X?: dw TINSERTI32X8 ,TINSERTI64X4 +TINSERTI??X2: dw TINSERTI32X4 ,TINSERTI64X2 +TINSERTF??X?: dw TINSERTF32X4 ,TINSERTF64X2 +TINSERTF??X2: dw TINSERTF32X8 ,TINSERTF64X4 +TMOVDQA??: dw TMOVDQA32 ,TMOVDQA64 +TCVTTP?2UDQ: dw TCVTTPS2UDQ ,TCVTTPD2UDQ +TMOVDQU??: dw TMOVDQU8 ,TMOVDQU16 +TMOVDQU?2: dw TMOVDQU32 ,TMOVDQU64 +TCVT?Q2PS: dw TCVTDQ2PS ,TCVTQQ2PS +TCVTP?2QQ: dw TCVTPS2QQ ,TCVTPD2QQ +TCVTTP?2QQ: dw TCVTTPS2QQ ,TCVTTPD2QQ +TCVTTP?2UQQ: dw TCVTTPS2UQQ ,TCVTTPD2UQQ +TCVTU?Q2PD: dw TCVTUDQ2PD ,TCVTUQQ2PD +TCVT?Q2PD: dw TCVTDQ2PD ,TCVTQQ2PD +TCVTP?2UQQ: dw TCVTPS2UQQ ,TCVTPD2UQQ +TCVTP?2UDQ: dw TCVTPS2UDQ ,TCVTPD2UDQ +TCVTU?Q2PS: dw TCVTUDQ2PS ,TCVTUQQ2PS +TBROADCASTI??: dw TBROADCASTI32X2 ,TPBROADCASTQ +TBROADCASTF??X?:dw TBROADCASTF32X8 ,TBROADCASTF64X4 +TBROADCASTI??X?:dw TBROADCASTI32X8 ,TBROADCASTI64X4 +TBROADCASTF??X2:dw TBROADCASTF32X4 ,TBROADCASTF64X2 +TBROADCASTI??X2:dw TBROADCASTI32X4 ,TBROADCASTI64X2 +TBROADCAST??: dw TBROADCASTF32X2 ,TBROADCASTSD +TPBLENDM?: dw TPBLENDMB ,TPBLENDMW +TPCMP?: dw TPCMPB ,TPCMPW +TPCMPU?: dw TPCMPUB ,TPCMPUW +TPERM?: dw TPERMB ,TPERMW +TPERMI2?: dw TPERMI2B ,TPERMI2W +TPERMI2?2: dw TPERMT2B ,TPERMT2W +TPMOVM2?: dw TPMOVM2B ,TPMOVM2W +TPMOVB?2M: dw TPMOVB2M ,TPMOVW2M +TPMOVD?2M: dw TPMOVD2M ,TPMOVQ2M +TPTESTNM?: dw TPTESTNMB ,TPTESTNMW +TPTESTM?: dw TPTESTMB ,TPTESTMW +TSHUFF?: dw TSHUFF32X4 ,TSHUFF64X2 +TSHUFI?: dw TSHUFI32X4 ,TSHUFI64X2 +TPOPCNT?A: dw TPOPCNTB ,TPOPCNTW +TPCOMPRESS?: dw TPCOMPRESSB ,TPCOMPRESSW +TPEXPAND?: dw TPEXPANDB ,TPEXPANDW +;----------------------------------------------------------------------------- +T62W0: dr T6204,T6205 +T62W1: dr T6208,T6205 +T62W2: dr T6209,T6204 +;----------------------------------------------------------------------------- diff --git a/programs/develop/koldbg/fasm/assemble.inc b/programs/develop/koldbg/fasm/assemble.inc new file mode 100644 index 0000000000..3d0d419f2b --- /dev/null +++ b/programs/develop/koldbg/fasm/assemble.inc @@ -0,0 +1,2240 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +assembler: + xor eax,eax + mov [stub_size],eax + mov [current_pass],ax + mov [resolver_flags],eax + mov [number_of_sections],eax + mov [actual_fixups_size],eax + assembler_loop: + mov eax,[labels_list] + mov [tagged_blocks],eax + mov eax,[additional_memory] + mov [free_additional_memory],eax + mov eax,[additional_memory_end] + mov [structures_buffer],eax + mov esi,[source_start] + mov edi,[code_start] + xor eax,eax + mov dword [adjustment],eax + mov dword [adjustment+4],eax + mov [addressing_space],eax + mov [error_line],eax + mov [counter],eax + mov [format_flags],eax + mov [number_of_relocations],eax + mov [undefined_data_end],eax + mov [file_extension],eax + mov [next_pass_needed],al + mov [output_format],al + mov [adjustment_sign],al + mov [evex_mode],al + ;*mov [code_type],16 + call init_addressing_space + pass_loop: + call assemble_line + jnc pass_loop + mov eax,[additional_memory_end] + cmp eax,[structures_buffer] + je pass_done + sub eax,18h + mov eax,[eax+4] + mov [current_line],eax + jmp missing_end_directive + pass_done: + call close_pass + mov eax,[labels_list] + check_symbols: + cmp eax,[memory_end] + jae symbols_checked + test byte [eax+8],8 + jz symbol_defined_ok + mov cx,[current_pass] + cmp cx,[eax+18] + jne symbol_defined_ok + test byte [eax+8],1 + jz symbol_defined_ok + sub cx,[eax+16] + cmp cx,1 + jne symbol_defined_ok + and byte [eax+8],not 1 + or [next_pass_needed],-1 + symbol_defined_ok: + test byte [eax+8],10h + jz use_prediction_ok + mov cx,[current_pass] + and byte [eax+8],not 10h + test byte [eax+8],20h + jnz check_use_prediction + cmp cx,[eax+18] + jne use_prediction_ok + test byte [eax+8],8 + jz use_prediction_ok + jmp use_misprediction + check_use_prediction: + test byte [eax+8],8 + jz use_misprediction + cmp cx,[eax+18] + je use_prediction_ok + use_misprediction: + or [next_pass_needed],-1 + use_prediction_ok: + test byte [eax+8],40h + jz check_next_symbol + and byte [eax+8],not 40h + test byte [eax+8],4 + jnz define_misprediction + mov cx,[current_pass] + test byte [eax+8],80h + jnz check_define_prediction + cmp cx,[eax+16] + jne check_next_symbol + test byte [eax+8],1 + jz check_next_symbol + jmp define_misprediction + check_define_prediction: + test byte [eax+8],1 + jz define_misprediction + cmp cx,[eax+16] + je check_next_symbol + define_misprediction: + or [next_pass_needed],-1 + check_next_symbol: + add eax,LABEL_STRUCTURE_SIZE + jmp check_symbols + symbols_checked: + cmp [next_pass_needed],0 + jne next_pass + mov eax,[error_line] + or eax,eax + jz assemble_ok + mov [current_line],eax + cmp [error],undefined_symbol + jne error_confirmed + mov eax,[error_info] + or eax,eax + jz error_confirmed + test byte [eax+8],1 + jnz next_pass + error_confirmed: + call error_handler + error_handler: + mov eax,[error] + sub eax,error_handler + add [esp],eax + ret + next_pass: + inc [current_pass] + mov ax,[current_pass] + cmp ax,[passes_limit] + je code_cannot_be_generated + jmp assembler_loop + assemble_ok: + ret + +create_addressing_space: + mov ebx,[addressing_space] + test ebx,ebx + jz init_addressing_space + test byte [ebx+0Ah],1 + jnz illegal_instruction + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + init_addressing_space: + mov ebx,[tagged_blocks] + mov dword [ebx-4],10h + mov dword [ebx-8],24h + sub ebx,8+24h + cmp ebx,edi + jbe out_of_memory + mov [tagged_blocks],ebx + mov [addressing_space],ebx + xor eax,eax + mov [ebx],edi + mov [ebx+4],eax + mov [ebx+8],eax + mov [ebx+10h],eax + mov [ebx+14h],eax + mov [ebx+18h],edi + mov [ebx+1Ch],eax + mov [ebx+20h],eax + mov eax,[OriginPtr+0] ;* + sub [ebx+0],eax ;* + mov eax,[OriginPtr+4] ;* + sbb [ebx+4],eax ;* + sbb [ebx+8],byte 0 ;* + ret + +assemble_line: + mov eax,[tagged_blocks] + sub eax,100h + cmp edi,eax + ja out_of_memory + lods byte [esi] + cmp al,1 + je assemble_instruction + jb source_end + cmp al,3 + jb define_label + je define_constant + cmp al,4 + je label_addressing_space + cmp al,0Fh + je new_line + cmp al,13h + je code_type_setting + cmp al,10h + jne illegal_instruction + lods byte [esi] + jmp segment_prefix + code_type_setting: + lods byte [esi] + mov [code_type],al + jmp instruction_assembled + new_line: + lods dword [esi] + mov [current_line],eax + and [prefix_flags],0 + cmp [symbols_file],0 + je continue_line + cmp [next_pass_needed],0 + jne continue_line + mov ebx,[tagged_blocks] + mov dword [ebx-4],1 + mov dword [ebx-8],14h + sub ebx,8+14h + cmp ebx,edi + jbe out_of_memory + mov [tagged_blocks],ebx + mov [ebx],eax + mov [ebx+4],edi + mov eax,[addressing_space] + mov [ebx+8],eax + mov al,[code_type] + mov [ebx+10h],al + continue_line: + cmp byte [esi],0Fh + je line_assembled + jmp assemble_line + define_label: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov ebx,eax + lods byte [esi] + mov [label_size],al + call make_label + jmp continue_line + make_label: + mov eax,edi + xor edx,edx + xor cl,cl + mov ebp,[addressing_space] + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb cl,[ds:ebp+8] + jp label_value_ok + call recoverable_overflow + label_value_ok: + mov [address_sign],cl + test byte [ds:ebp+0Ah],1 + jnz make_virtual_label + or byte [ebx+9],1 + xchg eax,[ebx] + xchg edx,[ebx+4] + mov ch,[ebx+9] + shr ch,1 + and ch,1 + neg ch + sub eax,[ebx] + sbb edx,[ebx+4] + sbb ch,cl + mov dword [adjustment],eax + mov dword [adjustment+4],edx + mov [adjustment_sign],ch + or al,ch + or eax,edx + setnz ah + jmp finish_label + make_virtual_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + finish_label: + mov ebp,[addressing_space] + mov ch,[ds:ebp+9] + mov cl,[label_size] + mov edx,[ds:ebp+14h] + mov ebp,[ds:ebp+10h] + finish_label_symbol: + mov al,[address_sign] + xor al,[ebx+9] + and al,10b + or ah,al + xor [ebx+9],al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + cmp ebp,[ebx+12] + mov [ebx+12],ebp + setne al + or ah,al + or ch,ch + jz label_symbol_ok + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + label_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + mov edx,[current_line] + mov [ebx+28],edx + and byte [ebx+8],not 2 + test byte [ebx+8],1 + jz new_label + cmp cx,[ebx+16] + je symbol_already_defined + btr dword [ebx+8],10 + jc requalified_label + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz label_made + test byte [ebx+8],8 + jz label_made + mov cx,[current_pass] + cmp cx,[ebx+18] + jne label_made + requalified_label: + or [next_pass_needed],-1 + label_made: + ret + new_label: + or byte [ebx+8],1 + ret + define_constant: + lods dword [esi] + inc esi + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + push eax + or [operand_flags],1 + call get_value + pop ebx + xor cl,cl + mov ch,[value_type] + cmp ch,3 + je invalid_use_of_symbol + make_constant: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + mov al,[value_sign] + xor al,[ebx+9] + and al,10b + or ah,al + xor [ebx+9],al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + xor edx,edx + cmp edx,[ebx+12] + mov [ebx+12],edx + setne al + or ah,al + or ch,ch + jz constant_symbol_ok + mov edx,[symbol_identifier] + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + constant_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + mov edx,[current_line] + mov [ebx+28],edx + test byte [ebx+8],1 + jz new_constant + cmp cx,[ebx+16] + jne redeclare_constant + test byte [ebx+8],2 + jz symbol_already_defined + or byte [ebx+8],4 + and byte [ebx+9],not 4 + jmp instruction_assembled + redeclare_constant: + btr dword [ebx+8],10 + jc requalified_constant + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz instruction_assembled + test byte [ebx+8],4 + jnz instruction_assembled + test byte [ebx+8],8 + jz instruction_assembled + mov cx,[current_pass] + cmp cx,[ebx+18] + jne instruction_assembled + requalified_constant: + or [next_pass_needed],-1 + jmp instruction_assembled + new_constant: + or byte [ebx+8],1+2 + jmp instruction_assembled + label_addressing_space: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov cx,[current_pass] + test byte [eax+8],1 + jz make_addressing_space_label + cmp cx,[eax+16] + je symbol_already_defined + test byte [eax+9],4 + jnz make_addressing_space_label + or [next_pass_needed],-1 + make_addressing_space_label: + mov dx,[eax+8] + and dx,not (2 or 100h) + or dx,1 or 4 or 400h + mov [eax+8],dx + mov [eax+16],cx + mov edx,[current_line] + mov [eax+28],edx + mov ebx,[addressing_space] + mov [eax],ebx + or byte [ebx+0Ah],2 + jmp continue_line + assemble_instruction: +; mov [operand_size],0 +; mov [operand_flags],0 +; mov [operand_prefix],0 +; mov [rex_prefix],0 + and dword [operand_size],0 +; mov [opcode_prefix],0 +; mov [vex_required],0 +; mov [vex_register],0 +; mov [immediate_size],0 + and dword [opcode_prefix],0 + call instruction_handler + instruction_handler: + movzx ebx,word [esi] + mov al,[esi+2] + add esi,3 + add [esp],ebx + ret + instruction_assembled: + test [prefix_flags],not 1 + jnz illegal_instruction + mov al,[esi] + cmp al,0Fh + je line_assembled + or al,al + jnz extra_characters_on_line + line_assembled: + clc + ret + source_end: + dec esi + stc + ret + +org_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + mov cl,[value_type] + test cl,1 + jnz invalid_use_of_symbol + push eax + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + test byte [ebx+0Ah],1 + jnz in_virtual + call init_addressing_space + jmp org_space_ok + in_virtual: + call close_virtual_addressing_space + call init_addressing_space + or byte [ebx+0Ah],1 + org_space_ok: + pop eax + mov [ebx+9],cl + mov cl,[value_sign] + sub [ebx],eax + sbb [ebx+4],edx + sbb byte [ebx+8],cl + jp org_value_ok + call recoverable_overflow + org_value_ok: + mov edx,[symbol_identifier] + mov [ebx+14h],edx + cmp [output_format],1 + ja instruction_assembled + cmp edi,[code_start] + jne instruction_assembled + cmp eax,100h + jne instruction_assembled + bts [format_flags],0 + jmp instruction_assembled +label_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + mov [label_size],0 + lods byte [esi] + cmp al,':' + je get_label_size + dec esi + cmp al,11h + jne label_size_ok + get_label_size: + lods word [esi] + cmp al,11h + jne invalid_argument + mov [label_size],ah + label_size_ok: + cmp byte [esi],80h + je get_free_label_value + call make_label + jmp instruction_assembled + get_free_label_value: + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + push ebx ecx + or byte [ebx+8],4 + cmp byte [esi],'.' + je invalid_value + call get_address_value + or bh,bh + setnz ch + xchg ch,cl + mov bp,cx + shl ebp,16 + xchg bl,bh + mov bp,bx + pop ecx ebx + and byte [ebx+8],not 4 + mov ch,[value_type] + test ch,1 + jnz invalid_use_of_symbol + make_free_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + mov edx,[address_symbol] + mov cl,[label_size] + call finish_label_symbol + jmp instruction_assembled +load_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + push eax + mov al,1 + cmp byte [esi],11h + jne load_size_ok + lods byte [esi] + lods byte [esi] + load_size_ok: + cmp al,8 + ja invalid_value + mov [operand_size],al + and dword [value],0 + and dword [value+4],0 + lods byte [esi] + cmp al,82h + jne invalid_argument + call get_data_point + jc value_loaded + push esi edi + mov esi,ebx + mov edi,value + rep movs byte [edi],[esi] + pop edi esi + value_loaded: + mov [value_sign],0 + mov eax,dword [value] + mov edx,dword [value+4] + pop ebx + xor cx,cx + jmp make_constant + get_data_point: + lods byte [esi] + cmp al,':' + je get_data_offset + cmp al,'(' + jne invalid_argument + mov ebx,[addressing_space] + mov ecx,edi + sub ecx,[ebx+18h] + mov [ebx+1Ch],ecx + cmp byte [esi],11h + jne get_data_address + cmp word [esi+1+4],'):' + jne get_data_address + inc esi + lods dword [esi] + add esi,2 + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp eax,0Fh + jbe reserved_word_used_as_symbol + mov edx,undefined_symbol + test byte [eax+8],1 + jz addressing_space_unavailable + mov edx,symbol_out_of_scope + mov cx,[eax+16] + cmp cx,[current_pass] + jne addressing_space_unavailable + test byte [eax+9],4 + jz invalid_use_of_symbol + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + or byte [ebx+8],8 + call store_label_reference + get_addressing_space: + mov ebx,[ebx] + get_data_address: + push ebx + cmp byte [esi],'.' + je invalid_value + or [operand_flags],1 + call get_address_value + pop ebp + call calculate_relative_offset + cmp [next_pass_needed],0 + jne data_address_type_ok + cmp [value_type],0 + jne invalid_use_of_symbol + data_address_type_ok: + mov ebx,edi + xor ecx,ecx + add ebx,eax + adc edx,ecx + mov eax,ebx + sub eax,[ds:ebp+18h] + sbb edx,ecx + jnz bad_data_address + mov cl,[operand_size] + add eax,ecx + cmp eax,[ds:ebp+1Ch] + ja bad_data_address + clc + ret + addressing_space_unavailable: + cmp [error_line],0 + jne get_data_address + push [current_line] + pop [error_line] + mov [error],edx + mov [error_info],eax + jmp get_data_address + bad_data_address: + call recoverable_overflow + stc + ret + get_data_offset: + cmp [output_format],2 + jae invalid_operand + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [value_type],0 + je data_offset_ok + call recoverable_invalid_address + data_offset_ok: + add eax,[code_start] + jc bad_data_address + mov ebx,eax + movzx ecx,[operand_size] + add eax,ecx + jc bad_data_address + mov edx,[addressing_space] + test byte [edx+0Ah],1 + jnz data_offset_from_virtual + cmp eax,edi + ja bad_data_address + clc + ret + data_offset_from_virtual: + cmp eax,[undefined_data_end] + ja bad_data_address + clc + ret + +store_directive: + cmp byte [esi],11h + je sized_store + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_byte_value + xor edx,edx + movzx eax,al + mov [operand_size],1 + jmp store_value_ok + sized_store: + or [operand_flags],1 + call get_value + store_value_ok: + cmp [value_type],0 + jne invalid_use_of_symbol + mov dword [value],eax + mov dword [value+4],edx + lods byte [esi] + cmp al,80h + jne invalid_argument + call get_data_point + jc instruction_assembled + push esi edi + mov esi,value + mov edi,ebx + rep movs byte [edi],[esi] + mov eax,edi + pop edi esi + cmp ebx,[undefined_data_end] + jae instruction_assembled + cmp eax,[undefined_data_start] + jbe instruction_assembled + mov [undefined_data_start],eax + jmp instruction_assembled + +display_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],0 + jne display_byte + inc esi + lods dword [esi] + mov ecx,eax + push edi + mov edi,[tagged_blocks] + sub edi,8 + sub edi,eax + cmp edi,[esp] + jbe out_of_memory + mov [tagged_blocks],edi + rep movs byte [edi],[esi] + stos dword [edi] + xor eax,eax + stos dword [edi] + pop edi + inc esi + jmp display_next + display_byte: + call get_byte_value + push edi + mov edi,[tagged_blocks] + sub edi,8+1 + mov [tagged_blocks],edi + stos byte [edi] + mov eax,1 + stos dword [edi] + dec eax + stos dword [edi] + pop edi + display_next: + cmp edi,[tagged_blocks] + ja out_of_memory + lods byte [esi] + cmp al,',' + je display_directive + dec esi + jmp instruction_assembled +show_display_buffer: + mov eax,[tagged_blocks] + or eax,eax + jz display_done + mov esi,[labels_list] + cmp esi,eax + je display_done + display_messages: + sub esi,8 + mov eax,[esi+4] + mov ecx,[esi] + sub esi,ecx + cmp eax,10h + je write_addressing_space + test eax,eax + jnz skip_block + push esi + call display_block + pop esi + skip_block: + cmp esi,[tagged_blocks] + jne display_messages + display_done: + ret + write_addressing_space: + mov ecx,[esi+20h] + jecxz skip_block + push esi + mov edi,[free_additional_memory] + mov esi,[output_file] + test esi,esi + jz addressing_space_written + xor ebx,ebx + copy_output_path: + lodsb + cmp edi,[structures_buffer] + jae out_of_memory + stosb + test al,al + jz output_path_copied + cmp al,'/' + je new_path_segment + cmp al,'\' + je new_path_segment + cmp al,'.' + jne copy_output_path + mov ebx,edi + jmp copy_output_path + new_path_segment: + xor ebx,ebx + jmp copy_output_path + output_path_copied: + test ebx,ebx + jnz append_extension + mov byte [edi-1],'.' + mov ebx,edi + append_extension: + mov edi,ebx + add ebx,ecx + inc ebx + cmp ebx,[structures_buffer] + jae out_of_memory + mov esi,[esp] + mov esi,[esi+18h] + sub esi,ecx + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + mov edx,[free_additional_memory] + call create + jc write_failed + mov esi,[esp] + mov edx,[esi+18h] + mov ecx,[esi+1Ch] + call write + jc write_failed + call close + addressing_space_written: + pop esi + jmp skip_block + +times_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + cmp eax,0 + je zero_times + cmp byte [esi],':' + jne times_argument_ok + inc esi + times_argument_ok: + push [counter] + push [counter_limit] + mov [counter_limit],eax + mov [counter],1 + times_loop: + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push esi + or [prefix_flags],1 + call continue_line + mov eax,[counter_limit] + cmp [counter],eax + je times_done + inc [counter] + pop esi + jmp times_loop + times_done: + pop eax + pop [counter_limit] + pop [counter] + jmp instruction_assembled + zero_times: + call skip_symbol + jnc zero_times + jmp instruction_assembled + +virtual_directive: + lods byte [esi] + cmp al,'(' + je continue_virtual_area + cmp al,80h + jne virtual_at_current + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_address_value + mov ebp,[address_symbol] + or bh,bh + setnz ch + jmp set_virtual + virtual_at_current: + dec esi + virtual_fallback: + mov ebp,[addressing_space] + mov al,[ds:ebp+9] + mov [value_type],al + mov eax,edi + xor edx,edx + xor cl,cl + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb cl,[ds:ebp+8] + mov [address_sign],cl + mov bx,[ds:ebp+10h] + mov cx,[ds:ebp+10h+2] + xchg bh,bl + xchg ch,cl + mov ebp,[ds:ebp+14h] + set_virtual: + xchg bl,bh + xchg cl,ch + shl ecx,16 + mov cx,bx + push ecx eax + mov ebx,[addressing_space] + test byte [ebx+0Ah],1 + jnz non_virtual_end_ok + mov eax,edi + xchg eax,[undefined_data_end] + cmp eax,edi + je non_virtual_end_ok + mov [undefined_data_start],edi + non_virtual_end_ok: + call allocate_virtual_structure_data + call init_addressing_space + or byte [ebx+0Ah],1 + cmp byte [esi],86h + jne addressing_space_extension_ok + cmp word [esi+1],'(' + jne invalid_argument + mov ecx,[esi+3] + add esi,3+4 + add [ebx+18h],ecx + mov [ebx+20h],ecx + or byte [ebx+0Ah],2 + push ebx + mov ebx,characters + get_extension: + lods byte [esi] + stos byte [edi] + xlat byte [ebx] + test al,al + jz invalid_argument + loop get_extension + inc esi + pop ebx + addressing_space_extension_ok: + pop eax + mov cl,[address_sign] + not eax + not edx + not cl + add eax,1 + adc edx,0 + adc cl,0 + add eax,edi + adc edx,0 + adc cl,0 + mov [ebx],eax + mov [ebx+4],edx + mov [ebx+8],cl + pop dword [ebx+10h] + mov [ebx+14h],ebp + mov al,[value_type] + test al,1 + jnz invalid_use_of_symbol + mov [ebx+9],al + jmp instruction_assembled + allocate_structure_data: + mov ebx,[structures_buffer] + sub ebx,18h + cmp ebx,[free_additional_memory] + jb out_of_memory + mov [structures_buffer],ebx + ret + find_structure_data: + mov ebx,[structures_buffer] + scan_structures: + cmp ebx,[additional_memory_end] + je no_such_structure + cmp ax,[ebx] + je structure_data_found + add ebx,18h + jmp scan_structures + structure_data_found: + ret + no_such_structure: + stc + ret + allocate_virtual_structure_data: + call allocate_structure_data + mov word [ebx],virtual_directive-instruction_handler + mov ecx,[addressing_space] + mov [ebx+12],ecx + mov [ebx+8],edi + mov ecx,[current_line] + mov [ebx+4],ecx + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + ret + continue_virtual_area: + cmp byte [esi],11h + jne invalid_argument + cmp byte [esi+1+4],')' + jne invalid_argument + inc esi + lods dword [esi] + inc esi + cmp eax,0Fh + jbe reserved_word_used_as_symbol + mov edx,undefined_symbol + test byte [eax+8],1 + jz virtual_area_unavailable + mov edx,symbol_out_of_scope + mov cx,[eax+16] + cmp cx,[current_pass] + jne virtual_area_unavailable + mov edx,invalid_use_of_symbol + test byte [eax+9],4 + jz virtual_area_unavailable + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + or byte [ebx+8],8 + call store_label_reference + mov ebx,[ebx] + test byte [ebx+0Ah],4 + jz virtual_area_unavailable + and byte [ebx+0Ah],not 4 + mov edx,ebx + call allocate_virtual_structure_data + mov [addressing_space],edx + push esi + mov esi,[edx+18h] + mov ecx,[edx+1Ch] + mov eax,[edx+20h] + sub esi,eax + add ecx,eax + lea eax,[edi+ecx] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,esi + sub eax,edi + sub [edx+18h],eax + sub [edx],eax + sbb dword [edx+4],0 + sbb byte [edx+8],0 + mov al,cl + shr ecx,2 + rep movs dword [edi],[esi] + mov cl,al + and cl,11b + rep movs byte [edi],[esi] + pop esi + jmp instruction_assembled + virtual_area_unavailable: + cmp [error_line],0 + jne virtual_fallback + push [current_line] + pop [error_line] + mov [error],edx + mov [error_info],eax + jmp virtual_fallback + end_virtual: + call find_structure_data + jc unexpected_instruction + push ebx + call close_virtual_addressing_space + pop ebx + mov eax,[ebx+12] + mov [addressing_space],eax + mov edi,[ebx+8] + remove_structure_data: + push esi edi + mov ecx,ebx + sub ecx,[structures_buffer] + shr ecx,2 + lea esi,[ebx-4] + lea edi,[esi+18h] + std + rep movs dword [edi],[esi] + cld + add [structures_buffer],18h + pop edi esi + ret + close_virtual_addressing_space: + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + add eax,[ebx+20h] + test byte [ebx+0Ah],2 + jz addressing_space_closed + or byte [ebx+0Ah],4 + push esi edi ecx edx + mov ecx,eax + mov eax,[tagged_blocks] + mov dword [eax-4],11h + mov dword [eax-8],ecx + sub eax,8 + sub eax,ecx + mov [tagged_blocks],eax + lea edi,[eax+ecx-1] + add eax,[ebx+20h] + xchg eax,[ebx+18h] + sub eax,[ebx+20h] + lea esi,[eax+ecx-1] + mov eax,edi + sub eax,esi + std + shr ecx,1 + jnc virtual_byte_ok + movs byte [edi],[esi] + virtual_byte_ok: + dec esi + dec edi + shr ecx,1 + jnc virtual_word_ok + movs word [edi],[esi] + virtual_word_ok: + sub esi,2 + sub edi,2 + rep movs dword [edi],[esi] + cld + xor edx,edx + add [ebx],eax + adc dword [ebx+4],edx + adc byte [ebx+8],dl + pop edx ecx edi esi + addressing_space_closed: + ret +repeat_directive: + test [prefix_flags],1 + jnz unexpected_instruction + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + cmp eax,0 + je zero_repeat + call allocate_structure_data + mov word [ebx],repeat_directive-instruction_handler + xchg eax,[counter_limit] + mov [ebx+10h],eax + mov eax,1 + xchg eax,[counter] + mov [ebx+14h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + end_repeat: + test [prefix_flags],1 + jnz unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[counter_limit] + inc [counter] + cmp [counter],eax + jbe continue_repeating + stop_repeat: + mov eax,[ebx+10h] + mov [counter_limit],eax + mov eax,[ebx+14h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + continue_repeating: + mov esi,[ebx+8] + jmp instruction_assembled + zero_repeat: + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_repeat + jmp instruction_assembled + find_end_repeat: + call find_structure_end + cmp ax,repeat_directive-instruction_handler + jne unexpected_instruction + ret +while_directive: + test [prefix_flags],1 + jnz unexpected_instruction + call allocate_structure_data + mov word [ebx],while_directive-instruction_handler + mov eax,1 + xchg eax,[counter] + mov [ebx+10h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + do_while: + push ebx + call calculate_logical_expression + or al,al + jnz while_true + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + stop_while: + call find_end_while + pop ebx + mov eax,[ebx+10h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + while_true: + pop ebx + jmp instruction_assembled + end_while: + test [prefix_flags],1 + jnz unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[ebx+4] + mov [current_line],eax + inc [counter] + jz too_many_repeats + mov esi,[ebx+8] + jmp do_while + find_end_while: + call find_structure_end + cmp ax,while_directive-instruction_handler + jne unexpected_instruction + ret +if_directive: + test [prefix_flags],1 + jnz unexpected_instruction + call calculate_logical_expression + mov dl,al + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or dl,dl + jnz if_true + call find_else + jc instruction_assembled + mov al,[esi] + cmp al,1 + jne else_true + cmp word [esi+1],if_directive-instruction_handler + jne else_true + add esi,4 + jmp if_directive + if_true: + xor al,al + make_if_structure: + call allocate_structure_data + mov word [ebx],if_directive-instruction_handler + mov byte [ebx+2],al + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + else_true: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or al,-1 + jmp make_if_structure + else_directive: + test [prefix_flags],1 + jnz unexpected_instruction + mov ax,if_directive-instruction_handler + call find_structure_data + jc unexpected_instruction + cmp byte [ebx+2],0 + jne unexpected_instruction + found_else: + mov al,[esi] + cmp al,1 + jne skip_else + cmp word [esi+1],if_directive-instruction_handler + jne skip_else + add esi,4 + call find_else + jnc found_else + call remove_structure_data + jmp instruction_assembled + skip_else: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_if + call remove_structure_data + jmp instruction_assembled + end_if: + test [prefix_flags],1 + jnz unexpected_instruction + call find_structure_data + jc unexpected_instruction + call remove_structure_data + jmp instruction_assembled + find_else: + call find_structure_end + cmp ax,else_directive-instruction_handler + je else_found + cmp ax,if_directive-instruction_handler + jne unexpected_instruction + stc + ret + else_found: + clc + ret + find_end_if: + call find_structure_end + cmp ax,if_directive-instruction_handler + jne unexpected_instruction + ret + find_structure_end: + push [error_line] + mov eax,[current_line] + mov [error_line],eax + find_end_directive: + call skip_symbol + jnc find_end_directive + lods byte [esi] + cmp al,0Fh + jne no_end_directive + lods dword [esi] + mov [current_line],eax + skip_labels: + cmp byte [esi],2 + jne labels_ok + add esi,6 + jmp skip_labels + labels_ok: + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + cmp ax,prefix_instruction-instruction_handler + je find_end_directive + add esi,4 + cmp ax,repeat_directive-instruction_handler + je skip_repeat + cmp ax,while_directive-instruction_handler + je skip_while + cmp ax,if_directive-instruction_handler + je skip_if + cmp ax,else_directive-instruction_handler + je structure_end + cmp ax,end_directive-instruction_handler + jne find_end_directive + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + add esi,4 + cmp ax,repeat_directive-instruction_handler + je structure_end + cmp ax,while_directive-instruction_handler + je structure_end + cmp ax,if_directive-instruction_handler + jne find_end_directive + structure_end: + pop [error_line] + ret + no_end_directive: + mov eax,[error_line] + mov [current_line],eax + jmp missing_end_directive + skip_repeat: + call find_end_repeat + jmp find_end_directive + skip_while: + call find_end_while + jmp find_end_directive + skip_if: + call skip_if_block + jmp find_end_directive + skip_if_block: + call find_else + jc if_block_skipped + cmp byte [esi],1 + jne skip_after_else + cmp word [esi+1],if_directive-instruction_handler + jne skip_after_else + add esi,4 + jmp skip_if_block + skip_after_else: + call find_end_if + if_block_skipped: + ret +end_directive: + lods byte [esi] + cmp al,1 + jne invalid_argument + lods word [esi] + inc esi + cmp ax,virtual_directive-instruction_handler + je end_virtual + cmp ax,repeat_directive-instruction_handler + je end_repeat + cmp ax,while_directive-instruction_handler + je end_while + cmp ax,if_directive-instruction_handler + je end_if + cmp ax,data_directive-instruction_handler + je end_data + jmp invalid_argument +break_directive: + mov ebx,[structures_buffer] + mov al,[esi] + or al,al + jz find_breakable_structure + cmp al,0Fh + jne extra_characters_on_line + find_breakable_structure: + cmp ebx,[additional_memory_end] + je unexpected_instruction + mov ax,[ebx] + cmp ax,repeat_directive-instruction_handler + je break_repeat + cmp ax,while_directive-instruction_handler + je break_while + cmp ax,if_directive-instruction_handler + je break_if + add ebx,18h + jmp find_breakable_structure + break_if: + push [current_line] + mov eax,[ebx+4] + mov [current_line],eax + call remove_structure_data + call skip_if_block + pop [current_line] + mov ebx,[structures_buffer] + jmp find_breakable_structure + break_repeat: + push ebx + call find_end_repeat + pop ebx + jmp stop_repeat + break_while: + push ebx + jmp stop_while + +define_data: + cmp edi,[tagged_blocks] + jae out_of_memory + cmp byte [esi],'(' + jne simple_data_value + mov ebx,esi + inc esi + call skip_expression + xchg esi,ebx + cmp byte [ebx],81h + jne simple_data_value + inc esi + call get_count_value + inc esi + or eax,eax + jz duplicate_zero_times + cmp byte [esi],91h + jne duplicate_single_data_value + inc esi + duplicate_data: + push eax esi + duplicated_values: + cmp edi,[tagged_blocks] + jae out_of_memory + clc + call near dword [esp+8] + lods byte [esi] + cmp al,',' + je duplicated_values + cmp al,92h + jne invalid_argument + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_data + duplicate_single_data_value: + cmp edi,[tagged_blocks] + jae out_of_memory + push eax esi + clc + call near dword [esp+8] + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_single_data_value + duplicate_zero_times: + cmp byte [esi],91h + jne skip_single_data_value + inc esi + skip_data_value: + call skip_symbol + jc invalid_argument + cmp byte [esi],92h + jne skip_data_value + inc esi + jmp data_defined + skip_single_data_value: + call skip_symbol + jmp data_defined + simple_data_value: + cmp edi,[tagged_blocks] + jae out_of_memory + clc + call near dword [esp] + data_defined: + lods byte [esi] + cmp al,',' + je define_data + dec esi + stc + ret +data_bytes: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_byte + cmp al,'?' + jne invalid_argument + mov eax,edi + mov byte [edi],0 + inc edi + jmp undefined_data + get_byte: + cmp byte [esi],0 + je get_string + call get_byte_value + stos byte [edi] + ret + get_string: + inc esi + lods dword [esi] + mov ecx,eax + lea eax,[edi+ecx] + cmp eax,[tagged_blocks] + ja out_of_memory + rep movs byte [edi],[esi] + inc esi + ret + undefined_data: + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jz mark_undefined_data + ret + mark_undefined_data: + cmp eax,[undefined_data_end] + je undefined_data_ok + mov [undefined_data_start],eax + undefined_data_ok: + mov [undefined_data_end],edi + ret +data_unicode: + or [base_code],-1 + jmp define_words +data_words: + mov [base_code],0 + define_words: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_word + cmp al,'?' + jne invalid_argument + mov eax,edi + and word [edi],0 + scas word [edi] + jmp undefined_data + ret + get_word: + cmp [base_code],0 + je word_data_value + cmp byte [esi],0 + je word_string + word_data_value: + call get_word_value + call mark_relocation + stos word [edi] + ret + word_string: + inc esi + lods dword [esi] + mov ecx,eax + jecxz word_string_ok + lea eax,[edi+ecx*2] + cmp eax,[tagged_blocks] + ja out_of_memory + xor ah,ah + copy_word_string: + lods byte [esi] + stos word [edi] + loop copy_word_string + word_string_ok: + inc esi + ret +data_dwords: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_dword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + jmp undefined_data + get_dword: + push esi + call get_dword_value + pop ebx + cmp byte [esi],':' + je complex_dword + call mark_relocation + stos dword [edi] + ret + complex_dword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_word_value + call mark_relocation + stos word [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_pwords: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_pword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and word [edi],0 + scas word [edi] + jmp undefined_data + get_pword: + push esi + call get_pword_value + pop ebx + cmp byte [esi],':' + je complex_pword + call mark_relocation + stos dword [edi] + mov ax,dx + stos word [edi] + ret + complex_pword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_dword_value + call mark_relocation + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_qwords: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_qword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and dword [edi],0 + scas dword [edi] + jmp undefined_data + get_qword: + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + ret +data_twords: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_tword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and dword [edi],0 + scas dword [edi] + and word [edi],0 + scas word [edi] + jmp undefined_data + get_tword: + cmp byte [esi],'.' + jne complex_tword + inc esi + cmp word [esi+8],8000h + je fp_zero_tword + mov eax,[esi] + stos dword [edi] + mov eax,[esi+4] + stos dword [edi] + mov ax,[esi+8] + add ax,3FFFh + jo value_out_of_range + cmp ax,7FFFh + jge value_out_of_range + cmp ax,0 + jg tword_exp_ok + mov cx,ax + neg cx + inc cx + cmp cx,64 + jae value_out_of_range + cmp cx,32 + ja large_shift + mov eax,[esi] + mov edx,[esi+4] + mov ebx,edx + shr edx,cl + shrd eax,ebx,cl + jmp tword_mantissa_shift_done + large_shift: + sub cx,32 + xor edx,edx + mov eax,[esi+4] + shr eax,cl + tword_mantissa_shift_done: + jnc store_shifted_mantissa + add eax,1 + adc edx,0 + store_shifted_mantissa: + mov [edi-8],eax + mov [edi-4],edx + xor ax,ax + test edx,1 shl 31 + jz tword_exp_ok + inc ax + tword_exp_ok: + mov bl,[esi+11] + shl bx,15 + or ax,bx + stos word [edi] + add esi,13 + ret + fp_zero_tword: + xor eax,eax + stos dword [edi] + stos dword [edi] + mov al,[esi+11] + shl ax,15 + stos word [edi] + add esi,13 + ret + complex_tword: + call get_word_value + push eax + cmp byte [esi],':' + jne invalid_operand + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_file: + lods word [esi] + cmp ax,'(' + jne invalid_argument + add esi,4 + call open_binary_file + mov eax,[esi-4] + lea esi,[esi+eax+1] + mov al,2 + xor edx,edx + call lseek + push eax + xor edx,edx + cmp byte [esi],':' + jne position_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx + call get_count_value + pop ebx + mov edx,eax + sub [esp],edx + jc value_out_of_range + position_ok: + cmp byte [esi],',' + jne size_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx edx + call get_count_value + pop edx ebx + cmp eax,[esp] + ja value_out_of_range + mov [esp],eax + size_ok: + xor al,al + call lseek + pop ecx + mov edx,edi + add edi,ecx + jc out_of_memory + cmp edi,[tagged_blocks] + ja out_of_memory + call read + jc error_reading_file + call close + lods byte [esi] + cmp al,',' + je data_file + dec esi + jmp instruction_assembled + open_binary_file: + push esi + push edi + mov eax,[current_line] + find_current_source_path: + mov esi,[eax] + test byte [eax+7],80h + jz get_current_path + mov eax,[eax+8] + jmp find_current_source_path + get_current_path: + lodsb + stosb + or al,al + jnz get_current_path + cut_current_path: + cmp edi,[esp] + je current_path_ok + cmp byte [edi-1],'\' + je current_path_ok + cmp byte [edi-1],'/' + je current_path_ok + dec edi + jmp cut_current_path + current_path_ok: + mov esi,[esp+4] + call expand_path + pop edx + mov esi,edx + call open + jnc file_opened + mov edx,[include_paths] + search_in_include_paths: + push edx esi + mov edi,esi + mov esi,[esp+4] + call get_include_directory + mov [esp+4],esi + mov esi,[esp+8] + call expand_path + pop edx + mov esi,edx + call open + pop edx + jnc file_opened + cmp byte [edx],0 + jne search_in_include_paths + mov edi,esi + mov esi,[esp] + push edi + call expand_path + pop edx + mov esi,edx + call open + jc file_not_found + file_opened: + mov edi,esi + pop esi + ret +reserve_bytes: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_bytes + add edi,ecx + jmp reserved_data + zero_bytes: + xor eax,eax + shr ecx,1 + jnc bytes_stosb_ok + stos byte [edi] + bytes_stosb_ok: + shr ecx,1 + jnc bytes_stosw_ok + stos word [edi] + bytes_stosw_ok: + rep stos dword [edi] + reserved_data: + pop eax + call undefined_data + jmp instruction_assembled +reserve_words: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data + zero_words: + xor eax,eax + shr ecx,1 + jnc words_stosw_ok + stos word [edi] + words_stosw_ok: + rep stos dword [edi] + jmp reserved_data +reserve_dwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data + zero_dwords: + xor eax,eax + rep stos dword [edi] + jmp reserved_data +reserve_pwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,1 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +reserve_qwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,1 + jc out_of_memory + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data +reserve_twords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,2 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +align_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov edx,eax + dec edx + test eax,edx + jnz invalid_align_value + or eax,eax + jz invalid_align_value + cmp eax,1 + je instruction_assembled + mov ecx,edi + mov ebp,[addressing_space] + sub ecx,[ds:ebp] + cmp dword [ds:ebp+10h],0 + jne section_not_aligned_enough + cmp byte [ds:ebp+9],0 + je make_alignment + cmp [output_format],3 + je pe_alignment + cmp [output_format],5 + jne object_alignment + test [format_flags],1 + jnz pe_alignment + object_alignment: + mov ebx,[ds:ebp+14h] + cmp byte [ebx],0 + jne section_not_aligned_enough + cmp eax,[ebx+10h] + jbe make_alignment + jmp section_not_aligned_enough + pe_alignment: + cmp eax,1000h + ja section_not_aligned_enough + make_alignment: + dec eax + and ecx,eax + jz instruction_assembled + neg ecx + add ecx,eax + inc ecx + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je nops + add edi,ecx + jmp reserved_data + invalid_align_value: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + jmp instruction_assembled + nops: + mov eax,90909090h + shr ecx,1 + jnc nops_stosb_ok + stos byte [edi] + nops_stosb_ok: + shr ecx,1 + jnc nops_stosw_ok + stos word [edi] + nops_stosw_ok: + rep stos dword [edi] + jmp reserved_data +err_directive: + mov al,[esi] + cmp al,0Fh + je invoked_error + or al,al + jz invoked_error + jmp extra_characters_on_line +assert_directive: + call calculate_logical_expression + or al,al + jnz instruction_assembled + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],assertion_failed + jmp instruction_assembled diff --git a/programs/develop/koldbg/fasm/avx.inc b/programs/develop/koldbg/fasm/avx.inc new file mode 100644 index 0000000000..d8b7cc6fc9 --- /dev/null +++ b/programs/develop/koldbg/fasm/avx.inc @@ -0,0 +1,3425 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +avx_single_source_pd_instruction_er_evex: + or [vex_required],8 +avx_single_source_pd_instruction_er: + or [operand_flags],2+4+8 + jmp avx_pd_instruction +avx_single_source_pd_instruction_sae_evex: + or [vex_required],8 + or [operand_flags],2+4 + jmp avx_pd_instruction +avx_pd_instruction_imm8: + mov [immediate_size],1 + jmp avx_pd_instruction +avx_pd_instruction_er: + or [operand_flags],8 +avx_pd_instruction_sae: + or [operand_flags],4 +avx_pd_instruction: + mov [opcode_prefix],66h + or [rex_prefix],80h + mov cx,0800h + jmp avx_instruction_with_broadcast +avx_pd_instruction_38_evex: + or [vex_required],8 + mov [supplemental_code],al + mov al,38h + jmp avx_pd_instruction +avx_cvtps2dq_instruction: + mov [opcode_prefix],66h + jmp avx_single_source_ps_instruction_er +avx_cvtudq2ps_instruction: + mov [opcode_prefix],0F2h +avx_single_source_ps_instruction_er_evex: + or [vex_required],8 +avx_single_source_ps_instruction_er: + or [operand_flags],2+4+8 + jmp avx_ps_instruction +avx_single_source_ps_instruction_noevex: + or [operand_flags],2 + or [vex_required],2 + jmp avx_ps_instruction +avx_ps_instruction_imm8: + mov [immediate_size],1 + jmp avx_ps_instruction +avx_ps_instruction_er: + or [operand_flags],8 +avx_ps_instruction_sae: + or [operand_flags],4 +avx_ps_instruction: + mov cx,0400h + jmp avx_instruction_with_broadcast +avx_ps_instruction_66_38_evex: + or [vex_required],8 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp avx_ps_instruction +avx_sd_instruction_er: + or [operand_flags],8 +avx_sd_instruction_sae: + or [operand_flags],4 +avx_sd_instruction: + mov [opcode_prefix],0F2h + or [rex_prefix],80h + mov cl,8 + jmp avx_instruction +avx_ss_instruction_er: + or [operand_flags],8 +avx_ss_instruction_sae: + or [operand_flags],4 +avx_ss_instruction: + mov [opcode_prefix],0F3h + mov cl,4 + jmp avx_instruction +avx_ss_instruction_noevex: + or [vex_required],2 + jmp avx_ss_instruction +avx_single_source_q_instruction_38_evex: + or [operand_flags],2 +avx_q_instruction_38_evex: + or [vex_required],8 +avx_q_instruction_38: + mov [supplemental_code],al + mov al,38h + jmp avx_q_instruction +avx_q_instruction_38_w1_evex: + or [vex_required],8 +avx_q_instruction_38_w1: + or [rex_prefix],8 + jmp avx_q_instruction_38 +avx_q_instruction_3a_imm8_w1: + or [rex_prefix],8 + jmp avx_q_instruction_3a_imm8 +avx_q_instruction_3a_imm8_evex: + or [vex_required],8 +avx_q_instruction_3a_imm8: + mov [immediate_size],1 + mov [supplemental_code],al + mov al,3Ah + jmp avx_q_instruction +avx_q_instruction_evex: + or [vex_required],8 +avx_q_instruction: + or [rex_prefix],80h + mov ch,8 + jmp avx_pi_instruction +avx_single_source_d_instruction_38_evex_w1: + or [rex_prefix],8 +avx_single_source_d_instruction_38_evex: + or [vex_required],8 +avx_single_source_d_instruction_38: + or [operand_flags],2 + jmp avx_d_instruction_38 +avx_d_instruction_38_evex: + or [vex_required],8 +avx_d_instruction_38: + mov [supplemental_code],al + mov al,38h + jmp avx_d_instruction +avx_d_instruction_3a_imm8_evex: + mov [immediate_size],1 + or [vex_required],8 + mov [supplemental_code],al + mov al,3Ah + jmp avx_d_instruction +avx_single_source_d_instruction_imm8: + or [operand_flags],2 + mov [immediate_size],1 + jmp avx_d_instruction +avx_d_instruction_evex: + or [vex_required],8 +avx_d_instruction: + mov ch,4 + jmp avx_pi_instruction +avx_bw_instruction_3a_imm8_w1_evex: + or [rex_prefix],8 +avx_bw_instruction_3a_imm8_evex: + mov [immediate_size],1 + or [vex_required],8 + mov [supplemental_code],al + mov al,3Ah + jmp avx_bw_instruction +avx_single_source_bw_instruction_38: + or [operand_flags],2 +avx_bw_instruction_38: + mov [supplemental_code],al + mov al,38h +avx_bw_instruction: + xor ch,ch + avx_pi_instruction: + mov [opcode_prefix],66h + xor cl,cl + jmp avx_instruction_with_broadcast +avx_bw_instruction_38_w1_evex: + or [rex_prefix],8 +avx_bw_instruction_38_evex: + or [vex_required],8 + jmp avx_bw_instruction_38 +avx_pd_instruction_noevex: + xor cl,cl + or [vex_required],2 + mov [opcode_prefix],66h + jmp avx_instruction +avx_ps_instruction_noevex: + or [vex_required],2 + mov [opcode_prefix],0F2h + xor cl,cl + jmp avx_instruction +avx_instruction: + xor ch,ch + avx_instruction_with_broadcast: + mov [mmx_size],cl + mov [broadcast_size],ch + mov [base_code],0Fh + mov [extended_code],al + avx_xop_common: + or [vex_required],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + avx_reg: + lods byte [esi] + call convert_avx_register + mov [postbyte_register],al + call take_avx512_mask + avx_vex_reg: + test [operand_flags],2 + jnz avx_vex_reg_ok + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + avx_vex_reg_ok: + mov al,[mmx_size] + or al,al + jz avx_regs_size_ok + mov ah,[operand_size] + or ah,ah + jz avx_regs_size_ok + cmp al,ah + je avx_regs_size_ok + ja invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_regs_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + avx_regs_rm: + call take_avx_rm + jc avx_regs_reg + mov al,[immediate_size] + cmp al,1 + je mmx_imm8 + jb instruction_ready + cmp al,-4 + je sse_cmp_mem_ok + cmp byte [esi],',' + jne invalid_operand + inc esi + call take_avx_register + shl al,4 + jc invalid_operand + or byte [value],al + test al,80h + jz avx_regs_mem_reg_store + cmp [code_type],64 + jne invalid_operand + avx_regs_mem_reg_store: + call take_imm4_if_needed + call store_instruction_with_imm8 + jmp instruction_assembled + avx_regs_reg: + mov bl,al + call take_avx512_rounding + mov al,[immediate_size] + cmp al,1 + je mmx_nomem_imm8 + jb nomem_instruction_ready + cmp al,-4 + je sse_cmp_nomem_ok + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,bl + shl al,4 + jc invalid_operand + or byte [value],al + test al,80h + jz avx_regs_reg_ + cmp [code_type],64 + jne invalid_operand + avx_regs_reg_: + call take_avx_rm + jc avx_regs_reg_reg + cmp [immediate_size],-2 + jg invalid_operand + or [rex_prefix],8 + call take_imm4_if_needed + call store_instruction_with_imm8 + jmp instruction_assembled + avx_regs_reg_reg: + shl al,4 + jc invalid_operand + and byte [value],1111b + or byte [value],al + call take_imm4_if_needed + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled + take_avx_rm: + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + cmp al,'[' + je take_avx_mem + cmp al,10h + jne invalid_operand + mov [operand_size],cl + lods byte [esi] + call convert_avx_register + or cl,cl + jnz avx_reg_ok + or cl,[mmx_size] + jz avx_reg_ok + cmp ah,cl + je avx_reg_ok + jb invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_reg_ok: + stc + ret + take_avx_mem: + push ecx + call get_address + cmp byte [esi],'{' + jne avx_mem_ok + inc esi + lods byte [esi] + cmp al,1Fh + jne invalid_operand + mov al,[esi] + shr al,4 + cmp al,1 + jne invalid_operand + mov al,[mmx_size] + or al,al + jnz avx_mem_broadcast_check + mov eax,[esp] + or al,al + jnz avx_mem_broadcast_check + mov al,[broadcast_size] + mov [mmx_size],al + mov ah,cl + lods byte [esi] + and al,1111b + mov cl,al + mov al,[broadcast_size] + shl al,cl + mov [esp],al + mov cl,ah + jmp avx_mem_broadcast_ok + avx_mem_broadcast_check: + bsf eax,eax + xchg al,[broadcast_size] + mov [mmx_size],al + bsf eax,eax + jz invalid_operand + mov ah,[broadcast_size] + sub ah,al + lods byte [esi] + and al,1111b + cmp al,ah + jne invalid_operand_size + avx_mem_broadcast_ok: + or [vex_required],40h + lods byte [esi] + cmp al,'}' + jne invalid_operand + avx_mem_ok: + pop eax + or al,al + jz avx_mem_size_deciding + xchg al,[operand_size] + cmp [mmx_size],0 + jne avx_mem_size_enforced + or al,al + jz avx_mem_size_ok + cmp al,[operand_size] + jne operand_sizes_do_not_match + avx_mem_size_ok: + clc + ret + avx_mem_size_deciding: + mov al,[operand_size] + cmp [mmx_size],0 + jne avx_mem_size_enforced + cmp al,16 + je avx_mem_size_ok + cmp al,32 + je avx_mem_size_ok + cmp al,64 + je avx_mem_size_ok + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + avx_mem_size_enforced: + or al,al + jz avx_mem_size_ok + cmp al,[mmx_size] + je avx_mem_size_ok + jmp invalid_operand_size + take_imm4_if_needed: + cmp [immediate_size],-3 + jne imm4_ok + push ebx ecx edx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,'(' + jne invalid_operand + call get_byte_value + test al,11110000b + jnz value_out_of_range + or byte [value],al + pop edx ecx ebx + imm4_ok: + ret + take_avx512_mask: + cmp byte [esi],'{' + jne avx512_masking_ok + test [operand_flags],10h + jnz invalid_operand + inc esi + lods byte [esi] + cmp al,14h + jne invalid_operand + lods byte [esi] + mov ah,al + shr ah,4 + cmp ah,5 + jne invalid_operand + and al,111b + or al,al + jz invalid_operand + mov [mask_register],al + or [vex_required],20h + lods byte [esi] + cmp al,'}' + jne invalid_operand + cmp byte [esi],'{' + jne avx512_masking_ok + test [operand_flags],20h + jnz invalid_operand + inc esi + lods byte [esi] + cmp al,1Fh + jne invalid_operand + lods byte [esi] + or al,al + jnz invalid_operand + or [mask_register],80h + lods byte [esi] + cmp al,'}' + jne invalid_operand + avx512_masking_ok: + retn + take_avx512_rounding: + test [operand_flags],4+8 + jz avx512_rounding_done + test [operand_flags],8 + jz avx512_rounding_allowed + cmp [mmx_size],0 + jne avx512_rounding_allowed + cmp [operand_size],64 + jne avx512_rounding_done + avx512_rounding_allowed: + cmp byte [esi],',' + jne avx512_rounding_done + cmp byte [esi+1],'{' + jne avx512_rounding_done + add esi,2 + mov [rounding_mode],0 + or [vex_required],40h + test [operand_flags],8 + jz take_sae + or [vex_required],80h + lods byte [esi] + cmp al,1Fh + jne invalid_operand + lods byte [esi] + mov ah,al + shr ah,4 + cmp ah,2 + jne invalid_operand + and al,11b + mov [rounding_mode],al + lods byte [esi] + cmp al,'-' + jne invalid_operand + take_sae: + lods byte [esi] + cmp al,1Fh + jne invalid_operand + lods byte [esi] + cmp al,30h + jne invalid_operand + lods byte [esi] + cmp al,'}' + jne invalid_operand + avx512_rounding_done: + retn + +avx_movdqu_instruction: + mov ah,0F3h + jmp avx_movdq_instruction +avx_movdqa_instruction: + mov ah,66h + avx_movdq_instruction: + mov [opcode_prefix],ah + or [vex_required],2 + jmp avx_movps_instruction +avx512_movdqu16_instruction: + or [rex_prefix],8 +avx512_movdqu8_instruction: + mov ah,0F2h + jmp avx_movdq_instruction_evex +avx512_movdqu64_instruction: + or [rex_prefix],8 +avx512_movdqu32_instruction: + mov ah,0F3h + jmp avx_movdq_instruction_evex +avx512_movdqa64_instruction: + or [rex_prefix],8 +avx512_movdqa32_instruction: + mov ah,66h + avx_movdq_instruction_evex: + mov [opcode_prefix],ah + or [vex_required],8 + jmp avx_movps_instruction +avx_movpd_instruction: + mov [opcode_prefix],66h + or [rex_prefix],80h +avx_movps_instruction: + or [operand_flags],2 + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + xor al,al + mov [mmx_size],al + mov [broadcast_size],al + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_reg + inc [extended_code] + test [extended_code],1 + jnz avx_mem + add [extended_code],-1+10h + avx_mem: + cmp al,'[' + jne invalid_operand + call get_address + or [operand_flags],20h + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + jmp instruction_ready +avx_movntpd_instruction: + or [rex_prefix],80h +avx_movntdq_instruction: + mov [opcode_prefix],66h +avx_movntps_instruction: + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + or [operand_flags],10h + mov [mmx_size],0 + lods byte [esi] + call get_size_operator + jmp avx_mem +avx_compress_q_instruction: + or [rex_prefix],8 +avx_compress_d_instruction: + or [vex_required],8 + mov [mmx_size],0 + call setup_66_0f_38 + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_mem + lods byte [esi] + call convert_avx_register + mov bl,al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + jmp nomem_instruction_ready +avx_lddqu_instruction: + mov ah,0F2h + or [vex_required],2 + avx_load_instruction: + mov [opcode_prefix],ah + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],0 + or [vex_required],1 + call take_avx_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready +avx_movntdqa_instruction: + mov [supplemental_code],al + mov al,38h + mov ah,66h + jmp avx_load_instruction +avx_movq_instruction: + or [rex_prefix],8 + mov [mmx_size],8 + jmp avx_mov_instruction +avx_movd_instruction: + mov [mmx_size],4 + avx_mov_instruction: + or [vex_required],1 + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],7Eh + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_movd_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + not al + and [operand_size],al + jnz invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + cmp [mmx_size],8 + jne instruction_ready + and [rex_prefix],not 8 + or [rex_prefix],80h + mov [extended_code],0D6h + jmp instruction_ready + avx_movd_reg: + lods byte [esi] + cmp al,0C0h + jae avx_movd_xmmreg + call convert_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [operand_size],0 + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + avx_movd_reg_ready: + test [rex_prefix],8 + jz nomem_instruction_ready + cmp [code_type],64 + jne illegal_instruction + jmp nomem_instruction_ready + avx_movd_xmmreg: + sub [extended_code],10h + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_movd_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + cmp al,8 + jne avx_movd_xmmreg_mem_ready + call avx_movq_xmmreg_xmmreg_opcode + avx_movd_xmmreg_mem_ready: + not al + test [operand_size],al + jnz invalid_operand_size + jmp instruction_ready + avx_movd_xmmreg_reg: + lods byte [esi] + cmp al,0C0h + jae avx_movq_xmmreg_xmmreg + call convert_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + jmp avx_movd_reg_ready + avx_movq_xmmreg_xmmreg: + cmp [mmx_size],8 + jne invalid_operand + call avx_movq_xmmreg_xmmreg_opcode + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready + avx_movq_xmmreg_xmmreg_opcode: + and [rex_prefix],not 8 + or [rex_prefix],80h + add [extended_code],10h + mov [opcode_prefix],0F3h + ret +avx_movddup_instruction: + or [vex_required],1 + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],al + or [rex_prefix],80h + xor al,al + mov [mmx_size],al + mov [broadcast_size],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + mov [postbyte_register],al + cmp ah,16 + ja avx_movddup_size_ok + mov [mmx_size],8 + avx_movddup_size_ok: + call take_avx512_mask + jmp avx_vex_reg_ok +avx_movlpd_instruction: + mov [opcode_prefix],66h + or [rex_prefix],80h +avx_movlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],8 + mov [broadcast_size],0 + or [vex_required],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_movlps_mem + lods byte [esi] + call convert_avx_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + cmp [operand_size],16 + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_rm + jc invalid_operand + jmp instruction_ready + avx_movlps_mem: + cmp al,'[' + jne invalid_operand + call get_address + avx_movlps_mem_: + mov al,[operand_size] + or al,al + jz avx_movlps_mem_size_ok + cmp al,[mmx_size] + jne invalid_operand_size + mov [operand_size],0 + avx_movlps_mem_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + cmp ah,16 + jne invalid_operand + mov [postbyte_register],al + inc [extended_code] + jmp instruction_ready +avx_movhlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + call take_avx_register + cmp ah,16 + jne invalid_operand + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + jmp nomem_instruction_ready +avx_movsd_instruction: + mov al,0F2h + mov cl,8 + or [rex_prefix],80h + jmp avx_movs_instruction +avx_movss_instruction: + mov al,0F3h + mov cl,4 + avx_movs_instruction: + mov [opcode_prefix],al + mov [mmx_size],cl + or [vex_required],1 + mov [base_code],0Fh + mov [extended_code],10h + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_movs_mem + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand + mov [postbyte_register],al + call take_avx512_mask + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_movs_reg_mem + mov [operand_size],cl + lods byte [esi] + call convert_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + cmp bl,8 + jb nomem_instruction_ready + inc [extended_code] + xchg bl,[postbyte_register] + jmp nomem_instruction_ready + avx_movs_reg_mem: + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz avx_movs_reg_mem_ok + cmp al,[mmx_size] + jne invalid_operand_size + avx_movs_reg_mem_ok: + jmp instruction_ready + avx_movs_mem: + cmp al,'[' + jne invalid_operand + call get_address + or [operand_flags],20h + call take_avx512_mask + jmp avx_movlps_mem_ + +avx_comiss_instruction: + or [operand_flags],2+4+10h + mov cl,4 + jmp avx_instruction +avx_comisd_instruction: + or [operand_flags],2+4+10h + mov [opcode_prefix],66h + or [rex_prefix],80h + mov cl,8 + jmp avx_instruction +avx_movshdup_instruction: + or [operand_flags],2 + mov [opcode_prefix],0F3h + xor cl,cl + jmp avx_instruction +avx_cvtqq2pd_instruction: + mov [opcode_prefix],0F3h + or [vex_required],8 + or [operand_flags],2+4+8 + or [rex_prefix],8 + mov cx,0800h + jmp avx_instruction_with_broadcast +avx_pshuf_w_instruction: + mov [opcode_prefix],al + or [operand_flags],2 + mov [immediate_size],1 + mov al,70h + xor cl,cl + jmp avx_instruction +avx_single_source_128bit_instruction_38_noevex: + or [operand_flags],2 +avx_128bit_instruction_38_noevex: + mov cl,16 + jmp avx_instruction_38_noevex +avx_single_source_instruction_38_noevex: + or [operand_flags],2 + jmp avx_pi_instruction_38_noevex +avx_pi_instruction_38_noevex: + xor cl,cl + avx_instruction_38_noevex: + or [vex_required],2 + avx_instruction_38: + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp avx_instruction +avx_ss_instruction_3a_imm8_noevex: + mov cl,4 + jmp avx_instruction_3a_imm8_noevex +avx_sd_instruction_3a_imm8_noevex: + mov cl,8 + jmp avx_instruction_3a_imm8_noevex +avx_single_source_128bit_instruction_3a_imm8_noevex: + or [operand_flags],2 +avx_128bit_instruction_3a_imm8_noevex: + mov cl,16 + jmp avx_instruction_3a_imm8_noevex +avx_triple_source_instruction_3a_noevex: + xor cl,cl + mov [immediate_size],-1 + mov byte [value],0 + jmp avx_instruction_3a_noevex +avx_single_source_instruction_3a_imm8_noevex: + or [operand_flags],2 +avx_pi_instruction_3a_imm8_noevex: + xor cl,cl + avx_instruction_3a_imm8_noevex: + mov [immediate_size],1 + avx_instruction_3a_noevex: + or [vex_required],2 + avx_instruction_3a: + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,3Ah + jmp avx_instruction +avx_pi_instruction_3a_imm8: + xor cl,cl + mov [immediate_size],1 + jmp avx_instruction_3a +avx_pclmulqdq_instruction: + mov byte [value],al + mov [immediate_size],-4 + xor cl,cl + mov al,44h + or [operand_flags],10h + jmp avx_instruction_3a +avx_instruction_38_nomask: + or [operand_flags],10h + xor cl,cl + jmp avx_instruction_38 + +avx512_single_source_pd_instruction_sae_imm8: + or [operand_flags],2 +avx512_pd_instruction_sae_imm8: + or [rex_prefix],8 + mov cx,0800h + jmp avx512_instruction_sae_imm8 +avx512_single_source_ps_instruction_sae_imm8: + or [operand_flags],2 +avx512_ps_instruction_sae_imm8: + mov cx,0400h + jmp avx512_instruction_sae_imm8 +avx512_sd_instruction_sae_imm8: + or [rex_prefix],8 + mov cx,0008h + jmp avx512_instruction_sae_imm8 +avx512_ss_instruction_sae_imm8: + mov cx,0004h + avx512_instruction_sae_imm8: + or [operand_flags],4 + avx512_instruction_imm8: + or [vex_required],8 + mov [opcode_prefix],66h + mov [immediate_size],1 + mov [supplemental_code],al + mov al,3Ah + jmp avx_instruction_with_broadcast +avx512_pd_instruction_er: + or [operand_flags],4+8 + jmp avx512_pd_instruction +avx512_single_source_pd_instruction_sae: + or [operand_flags],4 +avx512_single_source_pd_instruction: + or [operand_flags],2 +avx512_pd_instruction: + or [rex_prefix],8 + mov cx,0800h + jmp avx512_instruction +avx512_ps_instruction_er: + or [operand_flags],4+8 + jmp avx512_ps_instruction +avx512_single_source_ps_instruction_sae: + or [operand_flags],4 +avx512_single_source_ps_instruction: + or [operand_flags],2 +avx512_ps_instruction: + mov cx,0400h + jmp avx512_instruction +avx512_sd_instruction_er: + or [operand_flags],8 +avx512_sd_instruction_sae: + or [operand_flags],4 +avx512_sd_instruction: + or [rex_prefix],8 + mov cx,0008h + jmp avx512_instruction +avx512_ss_instruction_er: + or [operand_flags],8 +avx512_ss_instruction_sae: + or [operand_flags],4 +avx512_ss_instruction: + mov cx,0004h + avx512_instruction: + or [vex_required],8 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp avx_instruction_with_broadcast +avx512_exp2pd_instruction: + or [rex_prefix],8 + or [operand_flags],2+4 + mov cx,0840h + jmp avx512_instruction +avx512_exp2ps_instruction: + or [operand_flags],2+4 + mov cx,0440h + jmp avx512_instruction + +fma_instruction_pd: + or [rex_prefix],8 + mov cx,0800h + jmp fma_instruction +fma_instruction_ps: + mov cx,0400h + jmp fma_instruction +fma_instruction_sd: + or [rex_prefix],8 + mov cx,0008h + jmp fma_instruction +fma_instruction_ss: + mov cx,0004h + fma_instruction: + or [operand_flags],4+8 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp avx_instruction_with_broadcast + +fma4_instruction_p: + xor cl,cl + jmp fma4_instruction +fma4_instruction_sd: + mov cl,8 + jmp fma4_instruction +fma4_instruction_ss: + mov cl,4 + fma4_instruction: + mov [immediate_size],-2 + mov byte [value],0 + jmp avx_instruction_3a_noevex + +avx_cmp_pd_instruction: + mov [opcode_prefix],66h + or [rex_prefix],80h + mov cx,0800h + jmp avx_cmp_instruction +avx_cmp_ps_instruction: + mov cx,0400h + jmp avx_cmp_instruction +avx_cmp_sd_instruction: + mov [opcode_prefix],0F2h + or [rex_prefix],80h + mov cx,0008h + jmp avx_cmp_instruction +avx_cmp_ss_instruction: + mov [opcode_prefix],0F3h + mov cx,0004h + avx_cmp_instruction: + mov byte [value],al + mov [immediate_size],-4 + or [operand_flags],4+20h + mov al,0C2h + jmp avx_cmp_common +avx_cmpeqq_instruction: + or [rex_prefix],80h + mov ch,8 + mov [supplemental_code],al + mov al,38h + jmp avx_cmp_pi_instruction +avx_cmpeqd_instruction: + mov ch,4 + jmp avx_cmp_pi_instruction +avx_cmpeqb_instruction: + xor ch,ch + jmp avx_cmp_pi_instruction +avx512_cmp_uq_instruction: + or [rex_prefix],8 + mov ch,8 + mov ah,1Eh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_ud_instruction: + mov ch,4 + mov ah,1Eh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_q_instruction: + or [rex_prefix],8 + mov ch,8 + mov ah,1Fh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_d_instruction: + mov ch,4 + mov ah,1Fh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_uw_instruction: + or [rex_prefix],8 +avx512_cmp_ub_instruction: + xor ch,ch + mov ah,3Eh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_w_instruction: + or [rex_prefix],8 +avx512_cmp_b_instruction: + xor ch,ch + mov ah,3Fh + avx_cmp_pi_instruction_evex: + mov byte [value],al + mov [immediate_size],-4 + mov [supplemental_code],ah + mov al,3Ah + or [vex_required],8 + avx_cmp_pi_instruction: + xor cl,cl + or [operand_flags],20h + mov [opcode_prefix],66h + avx_cmp_common: + mov [mmx_size],cl + mov [broadcast_size],ch + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,14h + je avx_maskreg + cmp al,10h + jne invalid_operand + or [vex_required],2 + jmp avx_reg + avx_maskreg: + cmp [operand_size],0 + jne invalid_operand_size + or [vex_required],8 + lods byte [esi] + call convert_mask_register + mov [postbyte_register],al + call take_avx512_mask + jmp avx_vex_reg +avx512_fpclasspd_instruction: + or [rex_prefix],8 + mov cx,0800h + jmp avx_fpclass_instruction +avx512_fpclassps_instruction: + mov cx,0400h + jmp avx_fpclass_instruction +avx512_fpclasssd_instruction: + or [rex_prefix],8 + mov cx,0008h + jmp avx_fpclass_instruction +avx512_fpclassss_instruction: + mov cx,0004h + avx_fpclass_instruction: + mov [broadcast_size],ch + mov [mmx_size],cl + or [operand_flags],2 + call setup_66_0f_3a + mov [immediate_size],1 + lods byte [esi] + cmp al,14h + je avx_maskreg + jmp invalid_operand +avx512_ptestnmd_instruction: + mov ch,4 + jmp avx512_ptestnm_instruction +avx512_ptestnmq_instruction: + or [rex_prefix],8 + mov ch,8 + jmp avx512_ptestnm_instruction +avx512_ptestnmw_instruction: + or [rex_prefix],8 +avx512_ptestnmb_instruction: + xor ch,ch + avx512_ptestnm_instruction: + mov ah,0F3h + jmp avx512_ptest_instruction +avx512_ptestmd_instruction: + mov ch,4 + jmp avx512_ptestm_instruction +avx512_ptestmq_instruction: + or [rex_prefix],8 + mov ch,8 + jmp avx512_ptestm_instruction +avx512_ptestmw_instruction: + or [rex_prefix],8 +avx512_ptestmb_instruction: + xor ch,ch + avx512_ptestm_instruction: + mov ah,66h + avx512_ptest_instruction: + xor cl,cl + mov [opcode_prefix],ah + mov [supplemental_code],al + mov al,38h + or [vex_required],8 + jmp avx_cmp_common + +mask_shift_instruction_q: + or [rex_prefix],8 +mask_shift_instruction_d: + or [operand_flags],2 + or [immediate_size],1 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,3Ah + jmp mask_instruction +mask_instruction_single_source_b: + mov [opcode_prefix],66h + jmp mask_instruction_single_source_w +mask_instruction_single_source_d: + mov [opcode_prefix],66h +mask_instruction_single_source_q: + or [rex_prefix],8 +mask_instruction_single_source_w: + or [operand_flags],2 + jmp mask_instruction +mask_instruction_b: + mov [opcode_prefix],66h + jmp mask_instruction_w +mask_instruction_d: + mov [opcode_prefix],66h +mask_instruction_q: + or [rex_prefix],8 +mask_instruction_w: + mov [operand_size],32 +mask_instruction: + or [vex_required],1 + mov [base_code],0Fh + mov [extended_code],al + call take_mask_register + mov [postbyte_register],al + test [operand_flags],2 + jnz mask_instruction_nds_ok + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + mov [vex_register],al + mask_instruction_nds_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + mov bl,al + cmp [immediate_size],0 + jne mmx_nomem_imm8 + jmp nomem_instruction_ready +take_mask_register: + lods byte [esi] + cmp al,14h + jne invalid_operand + lods byte [esi] +convert_mask_register: + mov ah,al + shr ah,4 + cmp ah,5 + jne invalid_operand + and al,1111b + ret +kmov_instruction: + mov [mmx_size],al + or [vex_required],1 + mov [base_code],0Fh + mov [extended_code],90h + lods byte [esi] + cmp al,14h + je kmov_maskreg + cmp al,10h + je kmov_reg + call get_size_operator + inc [extended_code] + cmp al,'[' + jne invalid_argument + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + mov [postbyte_register],al + kmov_with_mem: + mov ah,[mmx_size] + mov al,[operand_size] + or al,al + jz kmov_mem_size_ok + cmp al,ah + jne invalid_operand_size + kmov_mem_size_ok: + call setup_kmov_prefix + jmp instruction_ready + setup_kmov_prefix: + cmp ah,4 + jb kmov_w_ok + or [rex_prefix],8 + kmov_w_ok: + test ah,1 or 4 + jz kmov_prefix_ok + mov [opcode_prefix],66h + kmov_prefix_ok: + ret + kmov_maskreg: + lods byte [esi] + call convert_mask_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,14h + je kmov_maskreg_maskreg + cmp al,10h + je kmov_maskreg_reg + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + jmp kmov_with_mem + kmov_maskreg_maskreg: + lods byte [esi] + call convert_mask_register + mov bl,al + mov ah,[mmx_size] + call setup_kmov_prefix + jmp nomem_instruction_ready + kmov_maskreg_reg: + add [extended_code],2 + lods byte [esi] + call convert_register + kmov_with_reg: + mov bl,al + mov al,[mmx_size] + mov ah,4 + cmp al,ah + jbe kmov_reg_size_check + mov ah,al + kmov_reg_size_check: + cmp ah,[operand_size] + jne invalid_operand_size + cmp al,8 + je kmov_f2_w1 + cmp al,2 + ja kmov_f2 + je nomem_instruction_ready + mov [opcode_prefix],66h + jmp nomem_instruction_ready + kmov_f2_w1: + or [rex_prefix],8 + cmp [code_type],64 + jne illegal_instruction + kmov_f2: + mov [opcode_prefix],0F2h + jmp nomem_instruction_ready + kmov_reg: + add [extended_code],3 + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + jmp kmov_with_reg +avx512_pmov_m2_instruction_w1: + or [rex_prefix],8 +avx512_pmov_m2_instruction: + or [vex_required],8 + call setup_f3_0f_38 + call take_avx_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + mov bl,al + jmp nomem_instruction_ready +avx512_pmov_2m_instruction_w1: + or [rex_prefix],8 +avx512_pmov_2m_instruction: + or [vex_required],8 + call setup_f3_0f_38 + call take_mask_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + jmp nomem_instruction_ready + setup_f3_0f_38: + mov [extended_code],38h + mov [supplemental_code],al + mov [base_code],0Fh + mov [opcode_prefix],0F3h + ret + +vzeroall_instruction: + mov [operand_size],32 +vzeroupper_instruction: + mov [base_code],0Fh + mov [extended_code],al + and [displacement_compression],0 + call store_vex_instruction_code + jmp instruction_assembled +vldmxcsr_instruction: + or [vex_required],2 + jmp fxsave_instruction + +avx_perm2f128_instruction: + or [vex_required],2 + xor ch,ch + avx_instruction_imm8_without_128bit: + mov [immediate_size],1 + mov ah,3Ah + jmp avx_instruction_without_128bit +avx512_shuf_q_instruction: + or [rex_prefix],8 + or [vex_required],8 + mov ch,8 + jmp avx_instruction_imm8_without_128bit +avx512_shuf_d_instruction: + or [vex_required],8 + mov ch,4 + jmp avx_instruction_imm8_without_128bit +avx_permd_instruction: + mov ah,38h + mov ch,4 + avx_instruction_without_128bit: + xor cl,cl + call setup_avx_66_supplemental + call take_avx_register + cmp ah,32 + jb invalid_operand_size + mov [postbyte_register],al + call take_avx512_mask + jmp avx_vex_reg + setup_avx_66_supplemental: + mov [opcode_prefix],66h + mov [broadcast_size],ch + mov [mmx_size],cl + mov [base_code],0Fh + mov [extended_code],ah + mov [supplemental_code],al + or [vex_required],1 + ret +avx_permq_instruction: + or [rex_prefix],8 + mov ch,8 + jmp avx_permil_instruction +avx_permilpd_instruction: + or [rex_prefix],80h + mov ch,8 + jmp avx_permil_instruction +avx_permilps_instruction: + mov ch,4 + avx_permil_instruction: + or [operand_flags],2 + xor cl,cl + mov ah,3Ah + call setup_avx_66_supplemental + call take_avx_register + cmp [supplemental_code],4 + jae avx_permil_size_ok + cmp ah,32 + jb invalid_operand_size + avx_permil_size_ok: + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_rm + jnc mmx_imm8 + mov bl,al + cmp byte [esi],',' + jne invalid_operand + mov al,[esi+1] + cmp al,11h + jne avx_permil_rm_or_imm8 + mov al,[esi+3] + avx_permil_rm_or_imm8: + cmp al,'(' + je mmx_nomem_imm8 + mov [vex_register],bl + inc esi + mov [extended_code],38h + mov al,[supplemental_code] + cmp al,4 + jb avx_permq_rm + add [supplemental_code],8 + jmp avx_regs_rm + avx_permq_rm: + or [vex_required],8 + shl al,5 + neg al + add al,36h + mov [supplemental_code],al + jmp avx_regs_rm +vpermil_2pd_instruction: + mov [immediate_size],-2 + mov byte [value],al + mov al,49h + jmp vpermil2_instruction_setup +vpermil_2ps_instruction: + mov [immediate_size],-2 + mov byte [value],al + mov al,48h + jmp vpermil2_instruction_setup +vpermil2_instruction: + mov [immediate_size],-3 + mov byte [value],0 + vpermil2_instruction_setup: + or [vex_required],2 + mov [base_code],0Fh + mov [supplemental_code],al + mov al,3Ah + xor cl,cl + jmp avx_instruction + +avx_shift_q_instruction_evex: + or [vex_required],8 +avx_shift_q_instruction: + or [rex_prefix],80h + mov cl,8 + jmp avx_shift_instruction +avx_shift_d_instruction: + mov cl,4 + jmp avx_shift_instruction +avx_shift_bw_instruction: + xor cl,cl + avx_shift_instruction: + mov [broadcast_size],cl + mov [mmx_size],0 + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + cmp al,'[' + je avx_shift_reg_mem + mov [operand_size],cl + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + push esi + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_shift_reg_reg_reg + pop esi + cmp al,'[' + je avx_shift_reg_reg_mem + xchg cl,[operand_size] + test cl,not 1 + jnz invalid_operand_size + dec esi + call convert_avx_shift_opcode + mov bl,al + jmp mmx_nomem_imm8 + convert_avx_shift_opcode: + mov al,[extended_code] + mov ah,al + and ah,1111b + add ah,70h + mov [extended_code],ah + shr al,4 + sub al,0Ch + shl al,1 + xchg al,[postbyte_register] + xchg al,[vex_register] + ret + avx_shift_reg_reg_reg: + pop eax + lods byte [esi] + call convert_xmm_register + xchg cl,[operand_size] + mov bl,al + jmp nomem_instruction_ready + avx_shift_reg_reg_mem: + mov [mmx_size],16 + push ecx + lods byte [esi] + call get_size_operator + call get_address + pop eax + xchg al,[operand_size] + test al,al + jz instruction_ready + cmp al,16 + jne invalid_operand_size + jmp instruction_ready + avx_shift_reg_mem: + or [vex_required],8 + call take_avx_mem + call convert_avx_shift_opcode + jmp mmx_imm8 +avx_shift_dq_instruction: + mov [postbyte_register],al + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],73h + or [vex_required],1 + mov [mmx_size],0 + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je avx_shift_dq_reg_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + mov bl,al + jmp mmx_nomem_imm8 + avx_shift_dq_reg_mem: + or [vex_required],8 + call get_address + jmp mmx_imm8 +avx512_rotate_q_instruction: + mov cl,8 + or [rex_prefix],cl + jmp avx512_rotate_instruction +avx512_rotate_d_instruction: + mov cl,4 + avx512_rotate_instruction: + mov [broadcast_size],cl + mov [postbyte_register],al + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],72h + or [vex_required],8 + mov [mmx_size],0 + mov [immediate_size],1 + call take_avx_register + mov [vex_register],al + call take_avx512_mask + jmp avx_vex_reg_ok + +avx_pmovsxbq_instruction: + mov cl,2 + jmp avx_pmovsx_instruction +avx_pmovsxbd_instruction: + mov cl,4 + jmp avx_pmovsx_instruction +avx_pmovsxbw_instruction: + mov cl,8 + avx_pmovsx_instruction: + mov [mmx_size],cl + or [vex_required],1 + call setup_66_0f_38 + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + bsf ecx,eax + sub cl,4 + shl [mmx_size],cl + push eax + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_pmovsx_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + xchg al,[operand_size] + or al,al + jz instruction_ready + cmp al,[mmx_size] + jne invalid_operand_size + jmp instruction_ready + avx_pmovsx_reg_reg: + lods byte [esi] + call convert_avx_register + mov bl,al + cmp ah,[mmx_size] + je avx_pmovsx_xmmreg_reg_size_ok + jb invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_pmovsx_xmmreg_reg_size_ok: + pop eax + mov [operand_size],al + jmp nomem_instruction_ready +avx512_pmovqb_instruction: + mov cl,2 + jmp avx512_pmov_instruction +avx512_pmovdb_instruction: + mov cl,4 + jmp avx512_pmov_instruction +avx512_pmovwb_instruction: + mov cl,8 + avx512_pmov_instruction: + mov [mmx_size],cl + or [vex_required],8 + mov [extended_code],38h + mov [supplemental_code],al + mov [base_code],0Fh + mov [opcode_prefix],0F3h + lods byte [esi] + call get_size_operator + cmp al,10h + je avx512_pmov_reg + cmp al,'[' + jne invalid_operand + call get_address + or [operand_flags],20h + call avx512_pmov_common + or al,al + jz instruction_ready + cmp al,[mmx_size] + jne invalid_operand_size + jmp instruction_ready + avx512_pmov_common: + call take_avx512_mask + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + mov al,ah + mov ah,cl + bsf ecx,eax + sub cl,4 + shl [mmx_size],cl + mov cl,ah + pop eax + ret + avx512_pmov_reg: + lods byte [esi] + call convert_avx_register + mov bl,al + call avx512_pmov_common + cmp al,[mmx_size] + je nomem_instruction_ready + jb invalid_operand_size + cmp al,16 + jne invalid_operand_size + jmp nomem_instruction_ready + +avx_broadcast_128_instruction_noevex: + or [vex_required],2 + mov cl,10h + jmp avx_broadcast_instruction +avx512_broadcast_32x2_instruction: + mov cl,08h + jmp avx_broadcast_instruction_evex +avx512_broadcast_32x4_instruction: + mov cl,10h + jmp avx_broadcast_instruction_evex +avx512_broadcast_32x8_instruction: + mov cl,20h + jmp avx_broadcast_instruction_evex +avx512_broadcast_64x2_instruction: + mov cl,10h + jmp avx_broadcast_instruction_w1_evex +avx512_broadcast_64x4_instruction: + mov cl,20h + avx_broadcast_instruction_w1_evex: + or [rex_prefix],8 + avx_broadcast_instruction_evex: + or [vex_required],8 + jmp avx_broadcast_instruction +avx_broadcastss_instruction: + mov cl,4 + jmp avx_broadcast_instruction +avx_broadcastsd_instruction: + or [rex_prefix],80h + mov cl,8 + jmp avx_broadcast_instruction +avx_pbroadcastb_instruction: + mov cl,1 + jmp avx_broadcast_pi_instruction +avx_pbroadcastw_instruction: + mov cl,2 + jmp avx_broadcast_pi_instruction +avx_pbroadcastd_instruction: + mov cl,4 + jmp avx_broadcast_pi_instruction +avx_pbroadcastq_instruction: + mov cl,8 + or [rex_prefix],80h + avx_broadcast_pi_instruction: + or [operand_flags],40h + avx_broadcast_instruction: + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + mov [mmx_size],cl + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + call take_avx_register + cmp ah,[mmx_size] + je invalid_operand_size + test [operand_flags],40h + jnz avx_broadcast_destination_size_ok + cmp [mmx_size],4 + je avx_broadcast_destination_size_ok + cmp [supplemental_code],59h + je avx_broadcast_destination_size_ok + cmp ah,16 + je invalid_operand_size + avx_broadcast_destination_size_ok: + xor ah,ah + xchg ah,[operand_size] + push eax + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_broadcast_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + xchg ah,[operand_size] + mov [postbyte_register],al + mov al,[broadcast_size] + mov al,[mmx_size] + cmp al,ah + je instruction_ready + or al,al + jz instruction_ready + or ah,ah + jz instruction_ready + jmp invalid_operand_size + avx_broadcast_reg_reg: + lods byte [esi] + test [operand_flags],40h + jz avx_broadcast_reg_avx_reg + cmp al,60h + jb avx_broadcast_reg_general_reg + cmp al,80h + jb avx_broadcast_reg_avx_reg + cmp al,0C0h + jb avx_broadcast_reg_general_reg + avx_broadcast_reg_avx_reg: + call convert_avx_register + mov bl,al + mov al,[mmx_size] + or al,al + jz avx_broadcast_reg_avx_reg_size_ok + cmp ah,16 + jne invalid_operand_size + cmp al,ah + jae invalid_operand + avx_broadcast_reg_avx_reg_size_ok: + pop eax + xchg ah,[operand_size] + mov [postbyte_register],al + test [vex_required],2 + jnz invalid_operand + jmp nomem_instruction_ready + avx_broadcast_reg_general_reg: + call convert_register + mov bl,al + mov al,[mmx_size] + or al,al + jz avx_broadcast_reg_general_reg_size_ok + cmp al,ah + je avx_broadcast_reg_general_reg_size_ok + ja invalid_operand_size + cmp ah,4 + jne invalid_operand_size + avx_broadcast_reg_general_reg_size_ok: + cmp al,4 + jb avx_broadcast_reg_general_reg_ready + cmp al,8 + mov al,3 + jne avx_broadcast_reg_general_reg_ready + or [rex_prefix],8 + avx_broadcast_reg_general_reg_ready: + add al,7Ah-1 + mov [supplemental_code],al + or [vex_required],8 + pop eax + xchg ah,[operand_size] + mov [postbyte_register],al + jmp nomem_instruction_ready + +avx512_extract_64x4_instruction: + or [rex_prefix],8 +avx512_extract_32x8_instruction: + or [vex_required],8 + mov cl,32 + jmp avx_extractf_instruction +avx512_extract_64x2_instruction: + or [rex_prefix],8 +avx512_extract_32x4_instruction: + or [vex_required],8 + mov cl,16 + jmp avx_extractf_instruction +avx_extractf128_instruction: + or [vex_required],2 + mov cl,16 + avx_extractf_instruction: + mov [mmx_size],cl + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_extractf_reg + cmp al,'[' + jne invalid_operand + call get_address + xor al,al + xchg al,[operand_size] + or al,al + jz avx_extractf_mem_size_ok + cmp al,[mmx_size] + jne invalid_operand_size + avx_extractf_mem_size_ok: + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + cmp ah,[mmx_size] + jbe invalid_operand_size + mov [postbyte_register],al + jmp mmx_imm8 + avx_extractf_reg: + lods byte [esi] + call convert_avx_register + cmp ah,[mmx_size] + jne invalid_operand_size + push eax + call take_avx512_mask + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + cmp ah,[mmx_size] + jbe invalid_operand_size + mov [postbyte_register],al + pop ebx + jmp mmx_nomem_imm8 +avx512_insert_64x4_instruction: + or [rex_prefix],8 +avx512_insert_32x8_instruction: + or [vex_required],8 + mov cl,32 + jmp avx_insertf_instruction +avx512_insert_64x2_instruction: + or [rex_prefix],8 +avx512_insert_32x4_instruction: + or [vex_required],8 + mov cl,16 + jmp avx_insertf_instruction +avx_insertf128_instruction: + or [vex_required],2 + mov cl,16 + avx_insertf_instruction: + mov [mmx_size],cl + mov [broadcast_size],0 + call setup_66_0f_3a + call take_avx_register + cmp ah,[mmx_size] + jbe invalid_operand + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + mov al,[mmx_size] + xchg al,[operand_size] + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_insertf_reg_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov [operand_size],al + jmp mmx_imm8 + avx_insertf_reg_reg_reg: + lods byte [esi] + call convert_avx_register + mov bl,al + pop eax + mov [operand_size],al + jmp mmx_nomem_imm8 +avx_extract_b_instruction: + mov cl,1 + jmp avx_extract_instruction +avx_extract_w_instruction: + mov cl,2 + jmp avx_extract_instruction +avx_extract_q_instruction: + or [rex_prefix],8 + mov cl,8 + jmp avx_extract_instruction +avx_extract_d_instruction: + mov cl,4 + avx_extract_instruction: + mov [mmx_size],cl + call setup_66_0f_3a + or [vex_required],1 + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_extractps_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + not al + and [operand_size],al + jnz invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + jmp mmx_imm8 + avx_extractps_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,[mmx_size] + cmp ah,al + jb invalid_operand_size + cmp ah,4 + je avx_extractps_reg_size_ok + cmp ah,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + cmp al,4 + jae avx_extractps_reg_size_ok + or [rex_prefix],8 + avx_extractps_reg_size_ok: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + cmp [supplemental_code],15h + jne mmx_nomem_imm8 + mov [extended_code],0C5h + xchg bl,[postbyte_register] + jmp mmx_nomem_imm8 +avx_insertps_instruction: + mov [immediate_size],1 + or [operand_flags],10h + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,3Ah + mov cl,4 + jmp avx_instruction +avx_pinsrb_instruction: + mov cl,1 + jmp avx_pinsr_instruction_3a +avx_pinsrw_instruction: + mov cl,2 + jmp avx_pinsr_instruction +avx_pinsrd_instruction: + mov cl,4 + jmp avx_pinsr_instruction_3a +avx_pinsrq_instruction: + cmp [code_type],64 + jne illegal_instruction + mov cl,8 + or [rex_prefix],8 + avx_pinsr_instruction_3a: + mov [supplemental_code],al + mov al,3Ah + avx_pinsr_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],cl + or [vex_required],1 + call take_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + jmp pinsr_xmmreg + +avx_cvtudq2pd_instruction: + or [vex_required],8 +avx_cvtdq2pd_instruction: + mov [opcode_prefix],0F3h + mov cl,4 + jmp avx_cvt_d_instruction +avx_cvtps2qq_instruction: + or [operand_flags],8 +avx_cvttps2qq_instruction: + or [operand_flags],4 + or [vex_required],8 + mov [opcode_prefix],66h + mov cl,4 + jmp avx_cvt_d_instruction +avx_cvtps2pd_instruction: + or [operand_flags],4 + mov cl,4 + avx_cvt_d_instruction: + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + mov [broadcast_size],cl + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor ecx,ecx + xchg cl,[operand_size] + mov al,cl + shr al,1 + mov [mmx_size],al + lods byte [esi] + call get_size_operator + cmp al,'[' + je avx_cvt_d_reg_mem + cmp al,10h + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call convert_avx_register + cmp ah,[mmx_size] + je avx_cvt_d_reg_reg_size_ok + jb invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_cvt_d_reg_reg_size_ok: + mov bl,al + mov [operand_size],cl + call take_avx512_rounding + jmp nomem_instruction_ready + avx_cvt_d_reg_mem: + call take_avx_mem + jmp instruction_ready +avx_cvtpd2dq_instruction: + or [operand_flags],4+8 + mov [opcode_prefix],0F2h + jmp avx_cvt_q_instruction +avx_cvtuqq2ps_instruction: + mov [opcode_prefix],0F2h +avx_cvtpd2udq_instruction: + or [operand_flags],8 +avx_cvttpd2udq_instruction: + or [operand_flags],4 + or [vex_required],8 + jmp avx_cvt_q_instruction +avx_cvtpd2ps_instruction: + or [operand_flags],8 +avx_cvttpd2dq_instruction: + or [operand_flags],4 + mov [opcode_prefix],66h + avx_cvt_q_instruction: + mov [broadcast_size],8 + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + or [rex_prefix],80h + call take_avx_register + mov [postbyte_register],al + push eax + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + mov [operand_size],al + mov [mmx_size],al + call take_avx_rm + jnc avx_cvt_q_reg_mem + mov bl,al + pop eax + call avx_cvt_q_check_size + call take_avx512_rounding + jmp nomem_instruction_ready + avx_cvt_q_reg_mem: + pop eax + call avx_cvt_q_check_size + jmp instruction_ready + avx_cvt_q_check_size: + mov al,[operand_size] + or al,al + jz avx_cvt_q_size_not_specified + cmp al,64 + ja invalid_operand_size + shr al,1 + cmp al,ah + je avx_cvt_q_size_ok + ja invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_cvt_q_size_ok: + ret + avx_cvt_q_size_not_specified: + cmp ah,64 shr 1 + jne recoverable_unknown_size + mov [operand_size],64 + ret +avx_cvttps2udq_instruction: + or [vex_required],8 + or [operand_flags],2+4 + mov cx,0400h + jmp avx_instruction_with_broadcast +avx_cvttps2dq_instruction: + mov [opcode_prefix],0F3h + or [operand_flags],2+4 + mov cx,0400h + jmp avx_instruction_with_broadcast +avx_cvtph2ps_instruction: + mov [opcode_prefix],66h + mov [supplemental_code],al + or [operand_flags],4 + mov al,38h + xor cl,cl + jmp avx_cvt_d_instruction +avx_cvtps2ph_instruction: + call setup_66_0f_3a + or [vex_required],1 + or [operand_flags],4 + lods byte [esi] + call get_size_operator + cmp al,10h + je vcvtps2ph_reg + cmp al,'[' + jne invalid_operand + call get_address + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + shl [operand_size],1 + call take_avx_register + mov [postbyte_register],al + shr ah,1 + mov [mmx_size],ah + jmp mmx_imm8 + vcvtps2ph_reg: + lods byte [esi] + call convert_avx_register + mov bl,al + call take_avx512_mask + xor cl,cl + xchg cl,[operand_size] + shl cl,1 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + or cl,cl + jz vcvtps2ph_reg_size_ok + cmp cl,ah + je vcvtps2ph_reg_size_ok + jb invalid_operand_size + cmp ah,16 + jne invalid_operand_size + vcvtps2ph_reg_size_ok: + call take_avx512_rounding + jmp mmx_nomem_imm8 + +avx_cvtsd2usi_instruction: + or [operand_flags],8 +avx_cvttsd2usi_instruction: + or [vex_required],8 + jmp avx_cvttsd2si_instruction +avx_cvtsd2si_instruction: + or [operand_flags],8 +avx_cvttsd2si_instruction: + mov ah,0F2h + mov cl,8 + jmp avx_cvt_2si_instruction +avx_cvtss2usi_instruction: + or [operand_flags],8 +avx_cvttss2usi_instruction: + or [vex_required],8 + jmp avx_cvttss2si_instruction +avx_cvtss2si_instruction: + or [operand_flags],8 +avx_cvttss2si_instruction: + mov ah,0F3h + mov cl,4 + avx_cvt_2si_instruction: + or [operand_flags],2+4 + mov [mmx_size],cl + mov [broadcast_size],0 + mov [opcode_prefix],ah + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + mov [operand_size],0 + cmp ah,4 + je avx_cvt_2si_reg + cmp ah,8 + jne invalid_operand_size + call operand_64bit + avx_cvt_2si_reg: + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_rm + jnc instruction_ready + mov bl,al + call take_avx512_rounding + jmp nomem_instruction_ready +avx_cvtusi2sd_instruction: + or [vex_required],8 +avx_cvtsi2sd_instruction: + mov ah,0F2h + mov cl,8 + jmp avx_cvtsi_instruction +avx_cvtusi2ss_instruction: + or [vex_required],8 +avx_cvtsi2ss_instruction: + mov ah,0F3h + mov cl,4 + avx_cvtsi_instruction: + or [operand_flags],2+4+8 + mov [mmx_size],cl + mov [opcode_prefix],ah + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + call take_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'[' + je avx_cvtsi_reg_reg_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + cmp ah,4 + je avx_cvtsi_reg_reg_reg32 + cmp ah,8 + jne invalid_operand_size + call operand_64bit + avx_cvtsi_rounding: + call take_avx512_rounding + jmp nomem_instruction_ready + avx_cvtsi_reg_reg_reg32: + cmp [mmx_size],8 + jne avx_cvtsi_rounding + jmp nomem_instruction_ready + avx_cvtsi_reg_reg_mem: + call get_address + mov al,[operand_size] + mov [mmx_size],al + or al,al + jz single_mem_nosize + cmp al,4 + je instruction_ready + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp instruction_ready + +avx_maskmov_w1_instruction: + or [rex_prefix],8 +avx_maskmov_instruction: + call setup_66_0f_38 + mov [mmx_size],0 + or [vex_required],2 + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_maskmov_mem + lods byte [esi] + call convert_avx_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + avx_maskmov_mem: + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + add [supplemental_code],2 + jmp instruction_ready +avx_movmskpd_instruction: + mov [opcode_prefix],66h +avx_movmskps_instruction: + mov [base_code],0Fh + mov [extended_code],50h + or [vex_required],2 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,4 + je avx_movmskps_reg_ok + cmp ah,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + avx_movmskps_reg_ok: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + jmp nomem_instruction_ready +avx_maskmovdqu_instruction: + or [vex_required],2 + jmp maskmovdqu_instruction +avx_pmovmskb_instruction: + or [vex_required],2 + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + je avx_pmovmskb_reg_size_ok + cmp [code_type],64 + jne invalid_operand_size + cmp ah,8 + jnz invalid_operand_size + avx_pmovmskb_reg_size_ok: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + jmp nomem_instruction_ready + +gather_pd_instruction: + or [rex_prefix],8 +gather_ps_instruction: + call setup_66_0f_38 + or [vex_required],4 + or [operand_flags],20h + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor cl,cl + xchg cl,[operand_size] + push ecx + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + pop eax + xchg al,[operand_size] + gather_mem_size_check: + mov ah,4 + test [rex_prefix],8 + jz gather_elements_size_ok + add ah,ah + gather_elements_size_ok: + mov [mmx_size],ah + test al,al + jz gather_mem_size_ok + cmp al,ah + jne invalid_operand_size + gather_mem_size_ok: + cmp byte [esi],',' + je gather_reg_mem_reg + test [vex_required],20h + jz invalid_operand + mov ah,[operand_size] + mov al,80h + jmp gather_arguments_ok + gather_reg_mem_reg: + or [vex_required],2 + inc esi + call take_avx_register + gather_arguments_ok: + mov [vex_register],al + cmp al,[postbyte_register] + je disallowed_combination_of_registers + mov al,bl + and al,11111b + cmp al,[postbyte_register] + je disallowed_combination_of_registers + cmp al,[vex_register] + je disallowed_combination_of_registers + mov al,bl + shr al,5 + cmp al,0Ch shr 1 + je gather_vr128 + mov ah,32 + cmp al,6 shr 1 + jne gather_regular + add ah,ah + gather_regular: + mov al,[rex_prefix] + shr al,3 + xor al,[supplemental_code] + test al,1 + jz gather_uniform + test [supplemental_code],1 + jz gather_double + mov al,ah + xchg al,[operand_size] + add al,al + cmp al,ah + jne invalid_operand_size + jmp instruction_ready + gather_double: + add ah,ah + gather_uniform: + cmp ah,[operand_size] + jne invalid_operand_size + jmp instruction_ready + gather_vr128: + cmp ah,16 + je instruction_ready + cmp ah,32 + jne invalid_operand_size + test [supplemental_code],1 + jnz invalid_operand_size + test [rex_prefix],8 + jz invalid_operand_size + jmp instruction_ready +scatter_pd_instruction: + or [rex_prefix],8 +scatter_ps_instruction: + call setup_66_0f_38 + or [vex_required],4+8 + or [operand_flags],20h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + push eax + call take_avx_register + mov [postbyte_register],al + pop eax + jmp gather_mem_size_check +gatherpf_qpd_instruction: + mov ah,0C7h + jmp gatherpf_pd_instruction +gatherpf_dpd_instruction: + mov ah,0C6h + gatherpf_pd_instruction: + or [rex_prefix],8 + mov cl,8 + jmp gatherpf_instruction +gatherpf_qps_instruction: + mov ah,0C7h + jmp gatherpf_ps_instruction +gatherpf_dps_instruction: + mov ah,0C6h + gatherpf_ps_instruction: + mov cl,4 + gatherpf_instruction: + mov [mmx_size],cl + mov [postbyte_register],al + mov al,ah + call setup_66_0f_38 + or [vex_required],4+8 + or [operand_flags],20h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + call take_avx512_mask + mov ah,[mmx_size] + mov al,[operand_size] + or al,al + jz gatherpf_mem_size_ok + cmp al,ah + jne invalid_operand_size + gatherpf_mem_size_ok: + mov [operand_size],64 + mov al,6 shr 1 + cmp ah,4 + je gatherpf_check_vsib + cmp [supplemental_code],0C6h + jne gatherpf_check_vsib + mov al,0Eh shr 1 + gatherpf_check_vsib: + mov ah,bl + shr ah,5 + cmp al,ah + jne invalid_operand + jmp instruction_ready + +bmi_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F3h + mov [postbyte_register],al + bmi_reg: + or [vex_required],2 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je bmi_reg_reg + cmp al,'[' + jne invalid_argument + call get_address + call operand_32or64 + jmp instruction_ready + bmi_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + call operand_32or64 + jmp nomem_instruction_ready + operand_32or64: + mov al,[operand_size] + cmp al,4 + je operand_32or64_ok + cmp al,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + or [rex_prefix],8 + operand_32or64_ok: + ret +pdep_instruction: + mov [opcode_prefix],0F2h + jmp andn_instruction +pext_instruction: + mov [opcode_prefix],0F3h +andn_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + or [vex_required],2 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + jmp bmi_reg +sarx_instruction: + mov [opcode_prefix],0F3h + jmp bzhi_instruction +shrx_instruction: + mov [opcode_prefix],0F2h + jmp bzhi_instruction +shlx_instruction: + mov [opcode_prefix],66h +bzhi_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + or [vex_required],2 + call get_reg_mem + jc bzhi_reg_reg + call get_vex_source_register + jc invalid_operand + call operand_32or64 + jmp instruction_ready + bzhi_reg_reg: + call get_vex_source_register + jc invalid_operand + call operand_32or64 + jmp nomem_instruction_ready + get_vex_source_register: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne no_vex_source_register + lods byte [esi] + call convert_register + mov [vex_register],al + clc + ret + no_vex_source_register: + stc + ret +bextr_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + or [vex_required],2 + call get_reg_mem + jc bextr_reg_reg + call get_vex_source_register + jc bextr_reg_mem_imm32 + call operand_32or64 + jmp instruction_ready + bextr_reg_reg: + call get_vex_source_register + jc bextr_reg_reg_imm32 + call operand_32or64 + jmp nomem_instruction_ready + setup_bextr_imm_opcode: + mov [xop_opcode_map],0Ah + mov [base_code],10h + call operand_32or64 + ret + bextr_reg_mem_imm32: + call get_imm32 + call setup_bextr_imm_opcode + jmp store_instruction_with_imm32 + bextr_reg_reg_imm32: + call get_imm32 + call setup_bextr_imm_opcode + store_nomem_instruction_with_imm32: + call store_nomem_instruction + mov eax,dword [value] + call mark_relocation + stos dword [edi] + jmp instruction_assembled + get_imm32: + cmp al,'(' + jne invalid_operand + push edx ebx ecx + call get_dword_value + mov dword [value],eax + pop ecx ebx edx + ret +rorx_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],al + or [vex_required],2 + call get_reg_mem + jc rorx_reg_reg + call operand_32or64 + jmp mmx_imm8 + rorx_reg_reg: + call operand_32or64 + jmp mmx_nomem_imm8 + +tbm_instruction: + mov [xop_opcode_map],9 + mov ah,al + shr ah,4 + and al,111b + mov [base_code],ah + mov [postbyte_register],al + jmp bmi_reg + +llwpcb_instruction: + or [vex_required],2 + mov [xop_opcode_map],9 + mov [base_code],12h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + call operand_32or64 + jmp nomem_instruction_ready +lwpins_instruction: + or [vex_required],2 + mov [xop_opcode_map],0Ah + mov [base_code],12h + mov [vex_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + cmp al,10h + je lwpins_reg_reg + cmp al,'[' + jne invalid_argument + push ecx + call get_address + pop eax + xchg al,[operand_size] + test al,al + jz lwpins_reg_mem_size_ok + cmp al,4 + jne invalid_operand_size + lwpins_reg_mem_size_ok: + call prepare_lwpins + jmp store_instruction_with_imm32 + lwpins_reg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov [operand_size],cl + mov bl,al + call prepare_lwpins + jmp store_nomem_instruction_with_imm32 + prepare_lwpins: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_imm32 + call operand_32or64 + mov al,[vex_register] + xchg al,[postbyte_register] + mov [vex_register],al + ret + +xop_single_source_sd_instruction: + or [operand_flags],2 + mov [mmx_size],8 + jmp xop_instruction_9 +xop_single_source_ss_instruction: + or [operand_flags],2 + mov [mmx_size],4 + jmp xop_instruction_9 +xop_single_source_instruction: + or [operand_flags],2 + mov [mmx_size],0 + xop_instruction_9: + mov [base_code],al + mov [xop_opcode_map],9 + jmp avx_xop_common +xop_single_source_128bit_instruction: + or [operand_flags],2 + mov [mmx_size],16 + jmp xop_instruction_9 +xop_triple_source_128bit_instruction: + mov [immediate_size],-1 + mov byte [value],0 + mov [mmx_size],16 + jmp xop_instruction_8 +xop_128bit_instruction: + mov [immediate_size],-2 + mov byte [value],0 + mov [mmx_size],16 + xop_instruction_8: + mov [base_code],al + mov [xop_opcode_map],8 + jmp avx_xop_common +xop_pcom_b_instruction: + mov ah,0CCh + jmp xop_pcom_instruction +xop_pcom_d_instruction: + mov ah,0CEh + jmp xop_pcom_instruction +xop_pcom_q_instruction: + mov ah,0CFh + jmp xop_pcom_instruction +xop_pcom_w_instruction: + mov ah,0CDh + jmp xop_pcom_instruction +xop_pcom_ub_instruction: + mov ah,0ECh + jmp xop_pcom_instruction +xop_pcom_ud_instruction: + mov ah,0EEh + jmp xop_pcom_instruction +xop_pcom_uq_instruction: + mov ah,0EFh + jmp xop_pcom_instruction +xop_pcom_uw_instruction: + mov ah,0EDh + xop_pcom_instruction: + mov byte [value],al + mov [immediate_size],-4 + mov [mmx_size],16 + mov [base_code],ah + mov [xop_opcode_map],8 + jmp avx_xop_common +vpcmov_instruction: + or [vex_required],2 + mov [immediate_size],-2 + mov byte [value],0 + mov [mmx_size],0 + mov [base_code],al + mov [xop_opcode_map],8 + jmp avx_xop_common +xop_shift_instruction: + mov [base_code],al + or [vex_required],2 + mov [xop_opcode_map],9 + call take_avx_register + cmp ah,16 + jne invalid_operand + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je xop_shift_reg_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + push esi + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + pop esi + xchg cl,[operand_size] + cmp al,'[' + je xop_shift_reg_reg_mem + cmp al,10h + jne xop_shift_reg_reg_imm + call take_avx_register + mov bl,al + xchg bl,[vex_register] + jmp nomem_instruction_ready + xop_shift_reg_reg_mem: + or [rex_prefix],8 + lods byte [esi] + call get_size_operator + call get_address + jmp instruction_ready + xop_shift_reg_reg_imm: + xor bl,bl + xchg bl,[vex_register] + cmp [base_code],94h + jae invalid_operand + add [base_code],30h + mov [xop_opcode_map],8 + dec esi + jmp mmx_nomem_imm8 + xop_shift_reg_mem: + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + push esi + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + pop esi + xchg cl,[operand_size] + cmp al,10h + jne xop_shift_reg_mem_imm + call take_avx_register + mov [vex_register],al + jmp instruction_ready + xop_shift_reg_mem_imm: + cmp [base_code],94h + jae invalid_operand + add [base_code],30h + mov [xop_opcode_map],8 + dec esi + jmp mmx_imm8 + +avx512_4vnniw_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + mov [mmx_size],16 + mov [broadcast_size],0 + or [vex_required],8 + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + cmp byte [esi],'+' + jne reg4_ok + inc esi + cmp dword [esi],29030128h + jne invalid_operand + lods dword [esi] + reg4_ok: + cmp [operand_size],64 + jne invalid_operand_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_rm + jc invalid_operand + mov [operand_size],64 + jmp instruction_ready + +set_evex_mode: + mov [evex_mode],al + jmp instruction_assembled + +take_avx_register: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] +convert_avx_register: + mov ah,al + and al,1Fh + and ah,0E0h + sub ah,60h + jb invalid_operand + jz avx512_register_size + sub ah,60h + jb invalid_operand + jnz avx_register_size_ok + mov ah,16 + jmp avx_register_size_ok + avx512_register_size: + mov ah,64 + avx_register_size_ok: + cmp al,8 + jb match_register_size + cmp [code_type],64 + jne invalid_operand + jmp match_register_size +store_vex_instruction_code: + test [rex_prefix],10h + jnz invalid_operand + test [vex_required],0F8h + jnz store_evex_instruction_code + test [vex_register],10000b + jnz store_evex_instruction_code + cmp [operand_size],64 + je store_evex_instruction_code + mov al,[base_code] + cmp al,0Fh + jne store_xop_instruction_code + test [vex_required],2 + jnz prepare_vex + cmp [evex_mode],0 + je prepare_vex + cmp [displacement_compression],1 + jne prepare_vex + cmp edx,80h + jb prepare_vex + cmp edx,-80h + jae prepare_vex + mov al,bl + or al,bh + shr al,4 + cmp al,2 + je prepare_vex + call compress_displacement + cmp [displacement_compression],2 + ja prepare_evex + jb prepare_vex + dec [displacement_compression] + mov edx,[uncompressed_displacement] + prepare_vex: + mov ah,[extended_code] + cmp ah,38h + je store_vex_0f38_instruction_code + cmp ah,3Ah + je store_vex_0f3a_instruction_code + test [rex_prefix],1011b + jnz store_vex_0f_instruction_code + mov [edi+2],ah + mov byte [edi],0C5h + mov al,[vex_register] + not al + shl al,3 + mov ah,[rex_prefix] + shl ah,5 + and ah,80h + xor al,ah + call get_vex_lpp_bits + mov [edi+1],al + call check_vex + add edi,3 + ret + get_vex_lpp_bits: + cmp [operand_size],32 + jne get_vex_pp_bits + or al,100b + get_vex_pp_bits: + mov ah,[opcode_prefix] + cmp ah,66h + je vex_66 + cmp ah,0F3h + je vex_f3 + cmp ah,0F2h + je vex_f2 + test ah,ah + jnz disallowed_combination_of_registers + ret + vex_f2: + or al,11b + ret + vex_f3: + or al,10b + ret + vex_66: + or al,1 + ret + store_vex_0f38_instruction_code: + mov al,11100010b + mov ah,[supplemental_code] + jmp make_c4_vex + store_vex_0f3a_instruction_code: + mov al,11100011b + mov ah,[supplemental_code] + jmp make_c4_vex + store_vex_0f_instruction_code: + mov al,11100001b + make_c4_vex: + mov [edi+3],ah + mov byte [edi],0C4h + mov ah,[rex_prefix] + shl ah,5 + xor al,ah + mov [edi+1],al + call check_vex + mov al,[vex_register] + xor al,1111b + shl al,3 + mov ah,[rex_prefix] + shl ah,4 + and ah,80h + or al,ah + call get_vex_lpp_bits + mov [edi+2],al + add edi,4 + ret + check_vex: + cmp [code_type],64 + je vex_ok + not al + test al,11000000b + jnz invalid_operand + test [rex_prefix],40h + jnz invalid_operand + vex_ok: + ret +store_xop_instruction_code: + mov [edi+3],al + mov byte [edi],8Fh + mov al,[xop_opcode_map] + mov ah,[rex_prefix] + test ah,40h + jz xop_ok + cmp [code_type],64 + jne invalid_operand + xop_ok: + not ah + shl ah,5 + xor al,ah + mov [edi+1],al + mov al,[vex_register] + xor al,1111b + shl al,3 + mov ah,[rex_prefix] + shl ah,4 + and ah,80h + or al,ah + call get_vex_lpp_bits + mov [edi+2],al + add edi,4 + ret +store_evex_instruction_code: + test [vex_required],2 + jnz invalid_operand + cmp [base_code],0Fh + jne invalid_operand + cmp [displacement_compression],1 + jne prepare_evex + call compress_displacement + prepare_evex: + mov ah,[extended_code] + cmp ah,38h + je store_evex_0f38_instruction_code + cmp ah,3Ah + je store_evex_0f3a_instruction_code + mov al,11110001b + make_evex: + mov [edi+4],ah + mov byte [edi],62h + mov ah,[rex_prefix] + shl ah,5 + xor al,ah + mov ah,[vex_required] + and ah,10h + xor al,ah + mov [edi+1],al + call check_vex + mov al,[vex_register] + not al + and al,1111b + shl al,3 + mov ah,[rex_prefix] + shl ah,4 + or ah,[rex_prefix] + and ah,80h + or al,ah + or al,100b + call get_vex_pp_bits + mov [edi+2],al + mov al,[vex_register] + not al + shr al,1 + and al,1000b + test [vex_required],80h + jne evex_rounding + mov ah,[operand_size] + cmp ah,16 + jbe evex_l_ok + or al,ah + jmp evex_l_ok + evex_rounding: + mov ah,[rounding_mode] + shl ah,5 + or al,ah + evex_l_ok: + test [vex_required],20h + jz evex_zaaa_ok + or al,[mask_register] + evex_zaaa_ok: + test [vex_required],40h + jz evex_b_ok + or al,10h + evex_b_ok: + mov [edi+3],al + add edi,5 + ret + store_evex_0f38_instruction_code: + mov al,11110010b + mov ah,[supplemental_code] + jmp make_evex + store_evex_0f3a_instruction_code: + mov al,11110011b + mov ah,[supplemental_code] + jmp make_evex +compress_displacement: + mov ebp,ecx + mov [uncompressed_displacement],edx + or edx,edx + jz displacement_compressed + xor ecx,ecx + mov cl,[mmx_size] + test cl,cl + jnz calculate_displacement_scale + mov cl,[operand_size] + calculate_displacement_scale: + bsf ecx,ecx + jz displacement_compression_ok + xor eax,eax + shrd eax,edx,cl + jnz displacement_not_compressed + sar edx,cl + cmp edx,80h + jb displacement_compressed + cmp edx,-80h + jnb displacement_compressed + shl edx,cl + displacement_not_compressed: + inc [displacement_compression] + jmp displacement_compression_ok + displacement_compressed: + add [displacement_compression],2 + displacement_compression_ok: + mov ecx,ebp + ret diff --git a/programs/develop/koldbg/fasm/errors.inc b/programs/develop/koldbg/fasm/errors.inc new file mode 100644 index 0000000000..e25ca87216 --- /dev/null +++ b/programs/develop/koldbg/fasm/errors.inc @@ -0,0 +1,194 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +out_of_memory: + push _out_of_memory + jmp fatal_error +stack_overflow: + push _stack_overflow + jmp fatal_error +main_file_not_found: + push _main_file_not_found + jmp fatal_error +write_failed: + push _write_failed + jmp fatal_error + +unexpected_end_of_file: + push _unexpected_end_of_file + jmp general_error +code_cannot_be_generated: + push _code_cannot_be_generated + jmp general_error +format_limitations_exceeded: + push _format_limitations_exceeded + jmp general_error +invalid_definition: + push _invalid_definition + general_error: + cmp [symbols_file],0 + je fatal_error + call dump_preprocessed_source + jmp fatal_error + +file_not_found: + push _file_not_found + jmp error_with_source +error_reading_file: + push _error_reading_file + jmp error_with_source +invalid_file_format: + push _invalid_file_format + jmp error_with_source +invalid_macro_arguments: + push _invalid_macro_arguments + jmp error_with_source +incomplete_macro: + push _incomplete_macro + jmp error_with_source +unexpected_characters: + push _unexpected_characters + jmp error_with_source +invalid_argument: + push _invalid_argument + jmp error_with_source +illegal_instruction: + push _illegal_instruction + jmp error_with_source +invalid_operand: + push _invalid_operand + jmp error_with_source +invalid_operand_size: + push _invalid_operand_size + jmp error_with_source +operand_size_not_specified: + push _operand_size_not_specified + jmp error_with_source +operand_sizes_do_not_match: + push _operand_sizes_do_not_match + jmp error_with_source +invalid_address_size: + push _invalid_address_size + jmp error_with_source +address_sizes_do_not_agree: + push _address_sizes_do_not_agree + jmp error_with_source +disallowed_combination_of_registers: + push _disallowed_combination_of_registers + jmp error_with_source +long_immediate_not_encodable: + push _long_immediate_not_encodable + jmp error_with_source +relative_jump_out_of_range: + push _relative_jump_out_of_range + jmp error_with_source +invalid_expression: + push _invalid_expression + jmp error_with_source +invalid_address: + push _invalid_address + jmp error_with_source +invalid_value: + push _invalid_value + jmp error_with_source +value_out_of_range: + push _value_out_of_range + jmp error_with_source +undefined_symbol: + mov edi,message + mov esi,_undefined_symbol + call copy_asciiz + push message + cmp [error_info],0 + je error_with_source + mov esi,[error_info] + mov esi,[esi+24] + or esi,esi + jz error_with_source + mov byte [edi-1],20h + call write_quoted_symbol_name + jmp error_with_source + copy_asciiz: + lods byte [esi] + stos byte [edi] + test al,al + jnz copy_asciiz + ret + write_quoted_symbol_name: + mov al,27h + stosb + movzx ecx,byte [esi-1] + rep movs byte [edi],[esi] + mov ax,27h + stosw + ret +symbol_out_of_scope: + mov edi,message + mov esi,_symbol_out_of_scope_1 + call copy_asciiz + cmp [error_info],0 + je finish_symbol_out_of_scope_message + mov esi,[error_info] + mov esi,[esi+24] + or esi,esi + jz finish_symbol_out_of_scope_message + mov byte [edi-1],20h + call write_quoted_symbol_name + finish_symbol_out_of_scope_message: + mov byte [edi-1],20h + mov esi,_symbol_out_of_scope_2 + call copy_asciiz + push message + jmp error_with_source +invalid_use_of_symbol: + push _invalid_use_of_symbol + jmp error_with_source +name_too_long: + push _name_too_long + jmp error_with_source +invalid_name: + push _invalid_name + jmp error_with_source +reserved_word_used_as_symbol: + push _reserved_word_used_as_symbol + jmp error_with_source +symbol_already_defined: + push _symbol_already_defined + jmp error_with_source +missing_end_quote: + push _missing_end_quote + jmp error_with_source +missing_end_directive: + push _missing_end_directive + jmp error_with_source +unexpected_instruction: + push _unexpected_instruction + jmp error_with_source +extra_characters_on_line: + push _extra_characters_on_line + jmp error_with_source +section_not_aligned_enough: + push _section_not_aligned_enough + jmp error_with_source +setting_already_specified: + push _setting_already_specified + jmp error_with_source +data_already_defined: + push _data_already_defined + jmp error_with_source +too_many_repeats: + push _too_many_repeats + jmp error_with_source +assertion_failed: + push _assertion_failed + jmp error_with_source +invoked_error: + push _invoked_error + error_with_source: + cmp [symbols_file],0 + je assembler_error + call dump_preprocessed_source + call restore_preprocessed_source + jmp assembler_error diff --git a/programs/develop/koldbg/fasm/exprcalc.inc b/programs/develop/koldbg/fasm/exprcalc.inc new file mode 100644 index 0000000000..5ba10b3264 --- /dev/null +++ b/programs/develop/koldbg/fasm/exprcalc.inc @@ -0,0 +1,2270 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +calculate_expression: + mov [current_offset],edi + mov [value_undefined],0 + cmp byte [esi],0 + je get_string_value + cmp byte [esi],'.' + je convert_fp + calculation_loop: + mov eax,[tagged_blocks] + sub eax,0Ch + cmp eax,edi + jbe out_of_memory + lods byte [esi] + cmp al,1 + je get_byte_number + cmp al,2 + je get_word_number + cmp al,4 + je get_dword_number + cmp al,8 + je get_qword_number + cmp al,0Fh + je value_out_of_range + cmp al,10h + je get_register + cmp al,11h + je get_label + cmp al,')' + je expression_calculated + cmp al,']' + je expression_calculated + cmp al,'!' + je invalid_expression + sub edi,14h + mov ebx,edi + sub ebx,14h + cmp al,0F0h + je calculate_rva + cmp al,0F1h + je calculate_plt + cmp al,0D0h + je calculate_not + cmp al,0E0h + je calculate_bsf + cmp al,0E1h + je calculate_bsr + cmp al,083h + je calculate_neg + mov dx,[ebx+8] + or dx,[edi+8] + cmp al,80h + je calculate_add + cmp al,81h + je calculate_sub + mov ah,[ebx+12] + or ah,[edi+12] + jz absolute_values_calculation + call recoverable_misuse + absolute_values_calculation: + cmp al,90h + je calculate_mul + cmp al,91h + je calculate_div + or dx,dx + jnz invalid_expression + cmp al,0A0h + je calculate_mod + cmp al,0B0h + je calculate_and + cmp al,0B1h + je calculate_or + cmp al,0B2h + je calculate_xor + cmp al,0C0h + je calculate_shl + cmp al,0C1h + je calculate_shr + jmp invalid_expression + expression_calculated: + sub edi,14h + cmp [value_undefined],0 + je expression_value_ok + xor eax,eax + mov [edi],eax + mov [edi+4],eax + mov [edi+12],eax + expression_value_ok: + ret + get_byte_number: + xor eax,eax + lods byte [esi] + stos dword [edi] + xor al,al + stos dword [edi] + got_number: + and word [edi-8+8],0 + and word [edi-8+12],0 + and dword [edi-8+16],0 + add edi,0Ch + jmp calculation_loop + get_word_number: + xor eax,eax + lods word [esi] + stos dword [edi] + xor ax,ax + stos dword [edi] + jmp got_number + get_dword_number: + movs dword [edi],[esi] + xor eax,eax + stos dword [edi] + jmp got_number + get_qword_number: + movs dword [edi],[esi] + movs dword [edi],[esi] + jmp got_number + get_register: + mov byte [edi+9],0 + and word [edi+12],0 + lods byte [esi] + mov [edi+8],al + mov byte [edi+10],1 + xor eax,eax + mov [edi+16],eax + stos dword [edi] + stos dword [edi] + add edi,0Ch + jmp calculation_loop + get_label: + xor eax,eax + mov [edi+8],eax + mov [edi+12],eax + mov [edi+20],eax + lods dword [esi] + cmp eax,0Fh + jb predefined_label + je reserved_word_used_as_symbol + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + mov cl,[ebx+9] + shr cl,1 + and cl,1 + neg cl + or byte [ebx+8],8 + test byte [ebx+8],1 + jz label_undefined + cmp ax,[ebx+16] + je unadjusted_label + test byte [ebx+8],4 + jnz label_out_of_scope + test byte [ebx+9],1 + jz unadjusted_label + mov eax,[ebx] + sub eax,dword [adjustment] + stos dword [edi] + mov eax,[ebx+4] + sbb eax,dword [adjustment+4] + stos dword [edi] + sbb cl,[adjustment_sign] + mov [edi-8+13],cl + mov eax,dword [adjustment] + or al,[adjustment_sign] + or eax,dword [adjustment+4] + jz got_label + or [next_pass_needed],-1 + jmp got_label + unadjusted_label: + mov eax,[ebx] + stos dword [edi] + mov eax,[ebx+4] + stos dword [edi] + mov [edi-8+13],cl + got_label: + test byte [ebx+9],4 + jnz invalid_use_of_symbol + call store_label_reference + mov al,[ebx+11] + mov [edi-8+12],al + mov eax,[ebx+12] + mov [edi-8+8],eax + cmp al,ah + jne labeled_registers_ok + shr eax,16 + add al,ah + jo labeled_registers_ok + xor ah,ah + mov [edi-8+10],ax + mov [edi-8+9],ah + labeled_registers_ok: + mov eax,[ebx+20] + mov [edi-8+16],eax + add edi,0Ch + mov al,[ebx+10] + or al,al + jz calculation_loop + test [operand_flags],1 + jnz calculation_loop + check_size: + xchg [operand_size],al + or al,al + jz calculation_loop + cmp al,[operand_size] + jne operand_sizes_do_not_match + jmp calculation_loop + actual_file_offset_label: + mov eax,[undefined_data_end] + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jnz use_undefined_data_offset + cmp eax,[current_offset] + jne use_current_offset + use_undefined_data_offset: + mov eax,[undefined_data_start] + jmp make_file_offset_label + current_file_offset_label: + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jz use_current_offset + mov eax,[undefined_data_end] + jmp make_file_offset_label + use_current_offset: + mov eax,[current_offset] + make_file_offset_label: + cmp [output_format],2 + jae invalid_use_of_symbol + sub eax,[code_start] + jmp make_dword_label_value + current_offset_label: + mov eax,[current_offset] + make_current_offset_label: + xor edx,edx + xor ch,ch + mov ebp,[addressing_space] + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb ch,[ds:ebp+8] + jp current_offset_label_ok + call recoverable_overflow + current_offset_label_ok: + stos dword [edi] + mov eax,edx + stos dword [edi] + mov eax,[ds:ebp+10h] + stos dword [edi] + mov cl,[ds:ebp+9] + mov [edi-12+12],cx + mov eax,[ds:ebp+14h] + mov [edi-12+16],eax + add edi,8 + jmp calculation_loop + org_origin_label: + mov eax,[addressing_space] + mov eax,[eax+18h] + jmp make_current_offset_label + counter_label: + mov eax,[counter] + make_dword_label_value: + stos dword [edi] + xor eax,eax + stos dword [edi] + add edi,0Ch + jmp calculation_loop + timestamp_label: + call make_timestamp + make_qword_label_value: + stos dword [edi] + mov eax,edx + stos dword [edi] + add edi,0Ch + jmp calculation_loop + predefined_label: + or eax,eax + jz current_offset_label + cmp eax,1 + je counter_label + cmp eax,2 + je timestamp_label + cmp eax,3 + je org_origin_label + cmp eax,4 + je current_file_offset_label + cmp eax,5 + je actual_file_offset_label + mov edx,invalid_value + jmp error_undefined + label_out_of_scope: + mov edx,symbol_out_of_scope + jmp error_undefined + label_undefined: + mov edx,undefined_symbol + error_undefined: + cmp [current_pass],1 + ja undefined_value + force_next_pass: + or [next_pass_needed],-1 + undefined_value: + or [value_undefined],-1 + and word [edi+12],0 + xor eax,eax + stos dword [edi] + stos dword [edi] + add edi,0Ch + cmp [error_line],0 + jne calculation_loop + mov eax,[current_line] + mov [error_line],eax + mov [error],edx + mov [error_info],ebx + jmp calculation_loop + calculate_add: + xor ah,ah + mov ah,[ebx+12] + mov al,[edi+12] + or al,al + jz add_values + or ah,ah + jz add_relocatable + add ah,al + jnz invalid_add + mov ecx,[edi+16] + cmp ecx,[ebx+16] + je add_values + invalid_add: + call recoverable_misuse + jmp add_values + add_relocatable: + mov ah,al + mov ecx,[edi+16] + mov [ebx+16],ecx + add_values: + mov [ebx+12],ah + mov eax,[edi] + add [ebx],eax + mov eax,[edi+4] + adc [ebx+4],eax + mov al,[edi+13] + adc [ebx+13],al + jp add_sign_ok + call recoverable_overflow + add_sign_ok: + or dx,dx + jz calculation_loop + push esi + mov esi,ebx + mov cl,[edi+10] + mov al,[edi+8] + call add_register + mov cl,[edi+11] + mov al,[edi+9] + call add_register + pop esi + jmp calculation_loop + add_register: + or al,al + jz add_register_done + add_register_start: + cmp [esi+8],al + jne add_in_second_slot + add [esi+10],cl + jo value_out_of_range + jnz add_register_done + mov byte [esi+8],0 + ret + add_in_second_slot: + cmp [esi+9],al + jne create_in_first_slot + add [esi+11],cl + jo value_out_of_range + jnz add_register_done + mov byte [esi+9],0 + ret + create_in_first_slot: + cmp byte [esi+8],0 + jne create_in_second_slot + mov [esi+8],al + mov [esi+10],cl + ret + create_in_second_slot: + cmp byte [esi+9],0 + jne invalid_expression + mov [esi+9],al + mov [esi+11],cl + add_register_done: + ret + out_of_range: + jmp calculation_loop + calculate_sub: + xor ah,ah + mov ah,[ebx+12] + mov al,[edi+12] + or al,al + jz sub_values + or ah,ah + jz negate_relocatable + cmp al,ah + jne invalid_sub + xor ah,ah + mov ecx,[edi+16] + cmp ecx,[ebx+16] + je sub_values + invalid_sub: + call recoverable_misuse + jmp sub_values + negate_relocatable: + neg al + mov ah,al + mov ecx,[edi+16] + mov [ebx+16],ecx + sub_values: + mov [ebx+12],ah + mov eax,[edi] + sub [ebx],eax + mov eax,[edi+4] + sbb [ebx+4],eax + mov al,[edi+13] + sbb [ebx+13],al + jp sub_sign_ok + cmp [error_line],0 + jne sub_sign_ok + call recoverable_overflow + sub_sign_ok: + or dx,dx + jz calculation_loop + push esi + mov esi,ebx + mov cl,[edi+10] + mov al,[edi+8] + call sub_register + mov cl,[edi+11] + mov al,[edi+9] + call sub_register + pop esi + jmp calculation_loop + sub_register: + or al,al + jz add_register_done + neg cl + jo value_out_of_range + jmp add_register_start + calculate_mul: + or dx,dx + jz mul_start + cmp word [ebx+8],0 + jne mul_start + xor ecx,ecx + swap_values: + mov eax,[ebx+ecx] + xchg eax,[edi+ecx] + mov [ebx+ecx],eax + add ecx,4 + cmp ecx,16 + jb swap_values + mul_start: + push esi edx + mov esi,ebx + xor bl,bl + cmp byte [esi+13],0 + je mul_first_sign_ok + xor bl,-1 + mov eax,[esi] + mov edx,[esi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [esi],eax + mov [esi+4],edx + or eax,edx + jz mul_overflow + mul_first_sign_ok: + cmp byte [edi+13],0 + je mul_second_sign_ok + xor bl,-1 + cmp byte [esi+8],0 + je mul_first_register_sign_ok + neg byte [esi+10] + jo invalid_expression + mul_first_register_sign_ok: + cmp byte [esi+9],0 + je mul_second_register_sign_ok + neg byte [esi+11] + jo invalid_expression + mul_second_register_sign_ok: + mov eax,[edi] + mov edx,[edi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [edi],eax + mov [edi+4],edx + or eax,edx + jz mul_overflow + mul_second_sign_ok: + cmp dword [esi+4],0 + jz mul_numbers + cmp dword [edi+4],0 + jz mul_numbers + jnz mul_overflow + mul_numbers: + mov eax,[esi+4] + mul dword [edi] + or edx,edx + jnz mul_overflow + mov ecx,eax + mov eax,[esi] + mul dword [edi+4] + or edx,edx + jnz mul_overflow + add ecx,eax + jc mul_overflow + mov eax,[esi] + mul dword [edi] + add edx,ecx + jc mul_overflow + mov [esi],eax + mov [esi+4],edx + or bl,bl + jz mul_ok + not eax + not edx + add eax,1 + adc edx,0 + mov [esi],eax + mov [esi+4],edx + or eax,edx + jnz mul_ok + not bl + mul_ok: + mov [esi+13],bl + pop edx + or dx,dx + jz mul_calculated + cmp word [edi+8],0 + jne invalid_value + cmp byte [esi+8],0 + je mul_first_register_ok + call get_byte_scale + imul byte [esi+10] + mov dl,ah + cbw + cmp ah,dl + jne value_out_of_range + mov [esi+10],al + or al,al + jnz mul_first_register_ok + mov [esi+8],al + mul_first_register_ok: + cmp byte [esi+9],0 + je mul_calculated + call get_byte_scale + imul byte [esi+11] + mov dl,ah + cbw + cmp ah,dl + jne value_out_of_range + mov [esi+11],al + or al,al + jnz mul_calculated + mov [esi+9],al + mul_calculated: + pop esi + jmp calculation_loop + mul_overflow: + pop edx esi + call recoverable_overflow + jmp calculation_loop + get_byte_scale: + mov al,[edi] + cbw + cwde + cdq + cmp edx,[edi+4] + jne value_out_of_range + cmp eax,[edi] + jne value_out_of_range + ret + calculate_div: + push esi edx + mov esi,ebx + call div_64 + pop edx + or dx,dx + jz div_calculated + cmp byte [esi+8],0 + je div_first_register_ok + call get_byte_scale + or al,al + jz value_out_of_range + mov al,[esi+10] + cbw + idiv byte [edi] + or ah,ah + jnz invalid_use_of_symbol + mov [esi+10],al + div_first_register_ok: + cmp byte [esi+9],0 + je div_calculated + call get_byte_scale + or al,al + jz value_out_of_range + mov al,[esi+11] + cbw + idiv byte [edi] + or ah,ah + jnz invalid_use_of_symbol + mov [esi+11],al + div_calculated: + pop esi + jmp calculation_loop + calculate_mod: + push esi + mov esi,ebx + call div_64 + mov [esi],eax + mov [esi+4],edx + mov [esi+13],bh + pop esi + jmp calculation_loop + calculate_and: + mov eax,[edi] + mov edx,[edi+4] + mov cl,[edi+13] + and [ebx],eax + and [ebx+4],edx + and [ebx+13],cl + jmp calculation_loop + calculate_or: + mov eax,[edi] + mov edx,[edi+4] + mov cl,[edi+13] + or [ebx],eax + or [ebx+4],edx + or [ebx+13],cl + jmp calculation_loop + calculate_xor: + mov eax,[edi] + mov edx,[edi+4] + mov cl,[edi+13] + xor [ebx],eax + xor [ebx+4],edx + xor [ebx+13],cl + jmp calculation_loop + shr_negative: + mov byte [edi+13],0 + not dword [edi] + not dword [edi+4] + add dword [edi],1 + adc dword [edi+4],0 + jc shl_over + calculate_shl: + cmp byte [edi+13],0 + jne shl_negative + mov edx,[ebx+4] + mov eax,[ebx] + cmp dword [edi+4],0 + jne shl_over + movsx ecx,byte [ebx+13] + xchg ecx,[edi] + cmp ecx,64 + je shl_max + ja shl_over + cmp ecx,32 + jae shl_high + shld [edi],edx,cl + shld edx,eax,cl + shl eax,cl + mov [ebx],eax + mov [ebx+4],edx + jmp shl_done + shl_over: + cmp byte [ebx+13],0 + jne shl_overflow + shl_max: + movsx ecx,byte [ebx+13] + cmp eax,ecx + jne shl_overflow + cmp edx,ecx + jne shl_overflow + xor eax,eax + mov [ebx],eax + mov [ebx+4],eax + jmp calculation_loop + shl_high: + sub cl,32 + shld [edi],edx,cl + shld edx,eax,cl + shl eax,cl + mov [ebx+4],eax + and dword [ebx],0 + cmp edx,[edi] + jne shl_overflow + shl_done: + movsx eax,byte [ebx+13] + cmp eax,[edi] + je calculation_loop + shl_overflow: + call recoverable_overflow + jmp calculation_loop + shl_negative: + mov byte [edi+13],0 + not dword [edi] + not dword [edi+4] + add dword [edi],1 + adc dword [edi+4],0 + jnc calculate_shr + dec dword [edi+4] + calculate_shr: + cmp byte [edi+13],0 + jne shr_negative + mov edx,[ebx+4] + mov eax,[ebx] + cmp dword [edi+4],0 + jne shr_over + mov ecx,[edi] + cmp ecx,64 + jae shr_over + push esi + movsx esi,byte [ebx+13] + cmp ecx,32 + jae shr_high + shrd eax,edx,cl + shrd edx,esi,cl + mov [ebx],eax + mov [ebx+4],edx + pop esi + jmp calculation_loop + shr_high: + sub cl,32 + shrd edx,esi,cl + mov [ebx],edx + mov [ebx+4],esi + pop esi + jmp calculation_loop + shr_over: + movsx eax,byte [ebx+13] + mov dword [ebx],eax + mov dword [ebx+4],eax + jmp calculation_loop + calculate_not: + cmp word [edi+8],0 + jne invalid_expression + cmp byte [edi+12],0 + je not_ok + call recoverable_misuse + not_ok: + not dword [edi] + not dword [edi+4] + not byte [edi+13] + add edi,14h + jmp calculation_loop + calculate_bsf: + cmp word [edi+8],0 + jne invalid_expression + cmp byte [edi+12],0 + je bsf_ok + call recoverable_misuse + bsf_ok: + xor ecx,ecx + bsf eax,[edi] + jnz finish_bs + mov ecx,32 + bsf eax,[edi+4] + jnz finish_bs + cmp byte [edi+13],0 + jne finish_bs + bs_overflow: + call recoverable_overflow + add edi,14h + jmp calculation_loop + calculate_bsr: + cmp word [edi+8],0 + jne invalid_expression + cmp byte [edi+12],0 + je bsr_ok + call recoverable_misuse + bsr_ok: + cmp byte [edi+13],0 + jne bs_overflow + mov ecx,32 + bsr eax,[edi+4] + jnz finish_bs + xor ecx,ecx + bsr eax,[edi] + jz bs_overflow + finish_bs: + add eax,ecx + xor edx,edx + mov [edi],eax + mov [edi+4],edx + mov [edi+13],dl + add edi,14h + jmp calculation_loop + calculate_neg: + cmp byte [edi+8],0 + je neg_first_register_ok + neg byte [edi+10] + jo invalid_expression + neg_first_register_ok: + cmp byte [edi+9],0 + je neg_second_register_ok + neg byte [edi+11] + jo invalid_expression + neg_second_register_ok: + neg byte [edi+12] + xor eax,eax + xor edx,edx + xor cl,cl + xchg eax,[edi] + xchg edx,[edi+4] + xchg cl,[edi+13] + sub [edi],eax + sbb [edi+4],edx + sbb [edi+13],cl + jp neg_sign_ok + call recoverable_overflow + neg_sign_ok: + add edi,14h + jmp calculation_loop + calculate_rva: + cmp word [edi+8],0 + jne invalid_expression + mov al,[output_format] + cmp al,5 + je calculate_gotoff + cmp al,4 + je calculate_coff_rva + cmp al,3 + jne invalid_expression + test [format_flags],8 + jnz pe64_rva + mov al,2 + bt [resolver_flags],0 + jc rva_type_ok + xor al,al + rva_type_ok: + cmp byte [edi+12],al + je rva_ok + call recoverable_misuse + rva_ok: + mov byte [edi+12],0 + mov eax,[code_start] + mov eax,[eax+34h] + xor edx,edx + finish_rva: + sub [edi],eax + sbb [edi+4],edx + sbb byte [edi+13],0 + jp rva_finished + call recoverable_overflow + rva_finished: + add edi,14h + jmp calculation_loop + pe64_rva: + mov al,4 + bt [resolver_flags],0 + jc pe64_rva_type_ok + xor al,al + pe64_rva_type_ok: + cmp byte [edi+12],al + je pe64_rva_ok + call recoverable_misuse + pe64_rva_ok: + mov byte [edi+12],0 + mov eax,[code_start] + mov edx,[eax+34h] + mov eax,[eax+30h] + jmp finish_rva + calculate_gotoff: + test [format_flags],1 + jnz calculate_elf_dyn_rva + test [format_flags],8 + jnz invalid_expression + calculate_coff_rva: + mov dl,5 + cmp byte [edi+12],2 + je change_value_type + incorrect_change_of_value_type: + call recoverable_misuse + change_value_type: + mov byte [edi+12],dl + add edi,14h + jmp calculation_loop + calculate_elf_dyn_rva: + xor dl,dl + test byte [edi+12],1 + jnz incorrect_change_of_value_type + jmp change_value_type + calculate_plt: + cmp word [edi+8],0 + jne invalid_expression + cmp [output_format],5 + jne invalid_expression + test [format_flags],1 + jnz invalid_expression + mov dl,6 + mov dh,2 + test [format_flags],8 + jz check_value_for_plt + mov dh,4 + check_value_for_plt: + mov eax,[edi] + or eax,[edi+4] + jnz incorrect_change_of_value_type + cmp byte [edi+12],dh + jne incorrect_change_of_value_type + mov eax,[edi+16] + cmp byte [eax],80h + jne incorrect_change_of_value_type + jmp change_value_type + div_64: + xor ebx,ebx + cmp dword [edi],0 + jne divider_ok + cmp dword [edi+4],0 + jne divider_ok + cmp [next_pass_needed],0 + je value_out_of_range + jmp div_done + divider_ok: + cmp byte [esi+13],0 + je div_first_sign_ok + mov eax,[esi] + mov edx,[esi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [esi],eax + mov [esi+4],edx + or eax,edx + jz value_out_of_range + xor bx,-1 + div_first_sign_ok: + cmp byte [edi+13],0 + je div_second_sign_ok + mov eax,[edi] + mov edx,[edi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [edi],eax + mov [edi+4],edx + or eax,edx + jz value_out_of_range + xor bl,-1 + div_second_sign_ok: + cmp dword [edi+4],0 + jne div_high + mov ecx,[edi] + mov eax,[esi+4] + xor edx,edx + div ecx + mov [esi+4],eax + mov eax,[esi] + div ecx + mov [esi],eax + mov eax,edx + xor edx,edx + jmp div_done + div_high: + push ebx + mov eax,[esi+4] + xor edx,edx + div dword [edi+4] + mov ebx,[esi] + mov [esi],eax + and dword [esi+4],0 + mov ecx,edx + mul dword [edi] + div_high_loop: + cmp ecx,edx + ja div_high_done + jb div_high_large_correction + cmp ebx,eax + jae div_high_done + div_high_correction: + dec dword [esi] + sub eax,[edi] + sbb edx,[edi+4] + jnc div_high_loop + div_high_done: + sub ebx,eax + sbb ecx,edx + mov edx,ecx + mov eax,ebx + pop ebx + jmp div_done + div_high_large_correction: + push eax edx + mov eax,edx + sub eax,ecx + xor edx,edx + div dword [edi+4] + shr eax,1 + jz div_high_small_correction + sub [esi],eax + push eax + mul dword [edi+4] + sub dword [esp+4],eax + pop eax + mul dword [edi] + sub dword [esp+4],eax + sbb dword [esp],edx + pop edx eax + jmp div_high_loop + div_high_small_correction: + pop edx eax + jmp div_high_correction + div_done: + or bh,bh + jz remainder_ok + not eax + not edx + add eax,1 + adc edx,0 + mov ecx,eax + or ecx,edx + jnz remainder_ok + not bh + remainder_ok: + or bl,bl + jz div_ok + not dword [esi] + not dword [esi+4] + add dword [esi],1 + adc dword [esi+4],0 + mov ecx,[esi] + or ecx,[esi+4] + jnz div_ok + not bl + div_ok: + mov [esi+13],bl + ret + store_label_reference: + cmp [symbols_file],0 + je label_reference_ok + cmp [next_pass_needed],0 + jne label_reference_ok + mov eax,[tagged_blocks] + mov dword [eax-4],2 + mov dword [eax-8],4 + sub eax,8+4 + cmp eax,edi + jbe out_of_memory + mov [tagged_blocks],eax + mov [eax],ebx + label_reference_ok: + ret + convert_fp: + inc esi + and word [edi+8],0 + and word [edi+12],0 + mov al,[value_size] + cmp al,2 + je convert_fp_word + cmp al,4 + je convert_fp_dword + test al,not 8 + jz convert_fp_qword + call recoverable_misuse + convert_fp_qword: + xor eax,eax + xor edx,edx + cmp word [esi+8],8000h + je fp_qword_store + mov bx,[esi+8] + mov eax,[esi] + mov edx,[esi+4] + add eax,eax + adc edx,edx + mov ecx,edx + shr edx,12 + shrd eax,ecx,12 + jnc fp_qword_ok + add eax,1 + adc edx,0 + bt edx,20 + jnc fp_qword_ok + and edx,1 shl 20 - 1 + inc bx + shr edx,1 + rcr eax,1 + fp_qword_ok: + add bx,3FFh + cmp bx,7FFh + jge value_out_of_range + cmp bx,0 + jg fp_qword_exp_ok + or edx,1 shl 20 + mov cx,bx + neg cx + inc cx + cmp cx,52+1 + ja value_out_of_range + cmp cx,32 + jb fp_qword_small_shift + sub cx,32 + mov eax,edx + xor edx,edx + shr eax,cl + jmp fp_qword_shift_done + fp_qword_small_shift: + mov ebx,edx + shr edx,cl + shrd eax,ebx,cl + fp_qword_shift_done: + mov bx,0 + jnc fp_qword_exp_ok + add eax,1 + adc edx,0 + test edx,1 shl 20 + jz fp_qword_exp_ok + and edx,1 shl 20 - 1 + inc bx + fp_qword_exp_ok: + shl ebx,20 + or edx,ebx + jnz fp_qword_store + or eax,eax + jz value_out_of_range + fp_qword_store: + mov bl,[esi+11] + shl ebx,31 + or edx,ebx + mov [edi],eax + mov [edi+4],edx + add esi,13 + ret + convert_fp_word: + xor eax,eax + cmp word [esi+8],8000h + je fp_word_store + mov bx,[esi+8] + mov ax,[esi+6] + shl ax,1 + shr ax,6 + jnc fp_word_ok + inc ax + bt ax,10 + jnc fp_word_ok + and ax,1 shl 10 - 1 + inc bx + shr ax,1 + fp_word_ok: + add bx,0Fh + cmp bx,01Fh + jge value_out_of_range + cmp bx,0 + jg fp_word_exp_ok + or ax,1 shl 10 + mov cx,bx + neg cx + inc cx + cmp cx,10+1 + ja value_out_of_range + xor bx,bx + shr ax,cl + jnc fp_word_exp_ok + inc ax + test ax,1 shl 10 + jz fp_word_exp_ok + and ax,1 shl 10 - 1 + inc bx + fp_word_exp_ok: + shl bx,10 + or ax,bx + jz value_out_of_range + fp_word_store: + mov bl,[esi+11] + shl bx,15 + or ax,bx + mov [edi],eax + xor eax,eax + mov [edi+4],eax + add esi,13 + ret + convert_fp_dword: + xor eax,eax + cmp word [esi+8],8000h + je fp_dword_store + mov bx,[esi+8] + mov eax,[esi+4] + shl eax,1 + shr eax,9 + jnc fp_dword_ok + inc eax + bt eax,23 + jnc fp_dword_ok + and eax,1 shl 23 - 1 + inc bx + shr eax,1 + fp_dword_ok: + add bx,7Fh + cmp bx,0FFh + jge value_out_of_range + cmp bx,0 + jg fp_dword_exp_ok + or eax,1 shl 23 + mov cx,bx + neg cx + inc cx + cmp cx,23+1 + ja value_out_of_range + xor bx,bx + shr eax,cl + jnc fp_dword_exp_ok + inc eax + test eax,1 shl 23 + jz fp_dword_exp_ok + and eax,1 shl 23 - 1 + inc bx + fp_dword_exp_ok: + shl ebx,23 + or eax,ebx + jz value_out_of_range + fp_dword_store: + mov bl,[esi+11] + shl ebx,31 + or eax,ebx + mov [edi],eax + xor eax,eax + mov [edi+4],eax + add esi,13 + ret + get_string_value: + inc esi + lods dword [esi] + mov ecx,eax + cmp ecx,8 + ja value_out_of_range + mov edx,edi + xor eax,eax + stos dword [edi] + stos dword [edi] + mov edi,edx + rep movs byte [edi],[esi] + mov edi,edx + inc esi + and word [edi+8],0 + and word [edi+12],0 + ret + +get_byte_value: + mov [value_size],1 + or [operand_flags],1 + call calculate_value + or al,al + jz check_byte_value + call recoverable_misuse + check_byte_value: + mov eax,[edi] + mov edx,[edi+4] + cmp byte [edi+13],0 + je byte_positive + cmp edx,-1 + jne range_exceeded + cmp eax,-100h + jb range_exceeded + ret + byte_positive: + test edx,edx + jnz range_exceeded + cmp eax,100h + jae range_exceeded + return_byte_value: + ret + range_exceeded: + xor eax,eax + xor edx,edx + recoverable_overflow: + cmp [error_line],0 + jne ignore_overflow + push [current_line] + pop [error_line] + mov [error],value_out_of_range + or [value_undefined],-1 + ignore_overflow: + ret + recoverable_misuse: + cmp [error_line],0 + jne ignore_misuse + push [current_line] + pop [error_line] + mov [error],invalid_use_of_symbol + ignore_misuse: + ret +get_word_value: + mov [value_size],2 + or [operand_flags],1 + call calculate_value + cmp al,2 + jb check_word_value + call recoverable_misuse + check_word_value: + mov eax,[edi] + mov edx,[edi+4] + cmp byte [edi+13],0 + je word_positive + cmp edx,-1 + jne range_exceeded + cmp eax,-10000h + jb range_exceeded + ret + word_positive: + test edx,edx + jnz range_exceeded + cmp eax,10000h + jae range_exceeded + ret +get_dword_value: + mov [value_size],4 + or [operand_flags],1 + call calculate_value + cmp al,4 + jne check_dword_value + mov [value_type],2 + mov eax,[edi] + cdq + cmp edx,[edi+4] + jne range_exceeded + mov ecx,edx + shr ecx,31 + cmp cl,[value_sign] + jne range_exceeded + ret + check_dword_value: + mov eax,[edi] + mov edx,[edi+4] + cmp byte [edi+13],0 + je dword_positive + cmp edx,-1 + jne range_exceeded + ret + dword_positive: + test edx,edx + jne range_exceeded + ret +get_pword_value: + mov [value_size],6 + or [operand_flags],1 + call calculate_value + cmp al,4 + jne check_pword_value + call recoverable_misuse + check_pword_value: + mov eax,[edi] + mov edx,[edi+4] + cmp byte [edi+13],0 + je pword_positive + cmp edx,-10000h + jb range_exceeded + ret + pword_positive: + cmp edx,10000h + jae range_exceeded + ret +get_qword_value: + mov [value_size],8 + or [operand_flags],1 + call calculate_value + check_qword_value: + mov eax,[edi] + mov edx,[edi+4] + ret +get_count_value: + mov [value_size],8 + or [operand_flags],1 + call calculate_expression + cmp word [edi+8],0 + jne invalid_value + mov [value_sign],0 + mov al,[edi+12] + or al,al + jz check_count_value + call recoverable_misuse + check_count_value: + cmp byte [edi+13],0 + jne invalid_count_value + mov eax,[edi] + mov edx,[edi+4] + or edx,edx + jnz invalid_count_value + ret + invalid_count_value: + cmp [error_line],0 + jne zero_count + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + zero_count: + xor eax,eax + ret +get_value: + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_value + mov al,[operand_size] + cmp al,1 + je value_byte + cmp al,2 + je value_word + cmp al,4 + je value_dword + cmp al,6 + je value_pword + cmp al,8 + je value_qword + or al,al + jnz invalid_value + mov [value_size],al + call calculate_value + mov eax,[edi] + mov edx,[edi+4] + ret + calculate_value: + call calculate_expression + cmp word [edi+8],0 + jne invalid_value + mov eax,[edi+16] + mov [symbol_identifier],eax + mov al,[edi+13] + mov [value_sign],al + mov al,[edi+12] + mov [value_type],al + ret + value_qword: + call get_qword_value + truncated_value: + mov [value_sign],0 + ret + value_pword: + call get_pword_value + movzx edx,dx + jmp truncated_value + value_dword: + call get_dword_value + xor edx,edx + jmp truncated_value + value_word: + call get_word_value + xor edx,edx + movzx eax,ax + jmp truncated_value + value_byte: + call get_byte_value + xor edx,edx + movzx eax,al + jmp truncated_value +get_address_word_value: + mov [address_size],2 + mov [value_size],2 + mov [free_address_range],0 + jmp calculate_address +get_address_dword_value: + mov [address_size],4 + mov [value_size],4 + mov [free_address_range],0 + jmp calculate_address +get_address_qword_value: + mov [address_size],8 + mov [value_size],8 + mov [free_address_range],0 + jmp calculate_address +get_address_value: + mov [address_size],0 + mov [value_size],8 + or [free_address_range],-1 + calculate_address: + cmp byte [esi],'.' + je invalid_address + call calculate_expression + mov eax,[edi+16] + mov [address_symbol],eax + mov al,[edi+13] + mov [address_sign],al + mov al,[edi+12] + mov [value_type],al + cmp al,0 + je address_size_ok + jg get_address_symbol_size + neg al + get_address_symbol_size: + cmp al,6 + je special_address_type_32bit + cmp al,5 + je special_address_type_32bit + ja invalid_address_type + test al,1 + jnz invalid_address_type + shl al,5 + jmp address_symbol_ok + invalid_address_type: + call recoverable_misuse + special_address_type_32bit: + mov al,40h + address_symbol_ok: + mov ah,[address_size] + or [address_size],al + shr al,4 + or ah,ah + jz address_size_ok + cmp al,ah + je address_size_ok + cmp ax,0408h + je address_sizes_mixed + cmp ax,0804h + jne address_sizes_do_not_agree + address_sizes_mixed: + cmp [value_type],4 + jne address_sizes_mixed_type_ok + mov [value_type],2 + address_sizes_mixed_type_ok: + mov eax,[edi] + cdq + cmp edx,[edi+4] + je address_size_ok + cmp [error_line],0 + jne address_size_ok + call recoverable_overflow + address_size_ok: + xor ebx,ebx + xor ecx,ecx + mov cl,[value_type] + shl ecx,16 + mov ch,[address_size] + cmp word [edi+8],0 + je check_immediate_address + mov al,[edi+8] + mov dl,[edi+10] + call get_address_register + mov al,[edi+9] + mov dl,[edi+11] + call get_address_register + mov ax,bx + shr ah,4 + shr al,4 + or bh,bh + jz check_address_registers + or bl,bl + jz check_address_registers + cmp al,ah + jne check_vsib + check_address_registers: + or al,ah + cmp al,0Ch + jae check_vsib + cmp al,6 + je check_vsib + cmp al,7 + je check_vsib + mov ah,[address_size] + and ah,0Fh + jz address_registers_sizes_ok + cmp al,ah + jne invalid_address + address_registers_sizes_ok: + cmp al,4 + je sib_allowed + cmp al,8 + je sib_allowed + cmp al,9 + je check_ip_relative_address + cmp cl,1 + ja invalid_address + cmp [free_address_range],0 + jne check_qword_value + jmp check_word_value + address_sizes_do_not_match: + cmp al,0Fh + jne invalid_address + mov al,bh + and al,0Fh + cmp al,ah + jne invalid_address + check_ip_relative_address: + or bl,bl + jnz invalid_address + cmp bh,98h + je check_rip_relative_address + cmp bh,94h + jne invalid_address + cmp [free_address_range],0 + je check_dword_value + mov eax,[edi] + mov edx,[edi+4] + ret + check_rip_relative_address: + mov eax,[edi] + cdq + cmp edx,[edi+4] + jne range_exceeded + cmp dl,[edi+13] + jne range_exceeded + ret + get_address_register: + or al,al + jz address_register_ok + cmp dl,1 + jne scaled_register + or bh,bh + jnz scaled_register + mov bh,al + address_register_ok: + ret + scaled_register: + or bl,bl + jnz invalid_address + mov bl,al + mov cl,dl + jmp address_register_ok + sib_allowed: + or bh,bh + jnz check_index_with_base + cmp cl,3 + je special_index_scale + cmp cl,5 + je special_index_scale + cmp cl,9 + je special_index_scale + cmp cl,2 + jne check_index_scale + cmp bl,45h + jne special_index_scale + cmp [code_type],64 + je special_index_scale + cmp [segment_register],4 + jne special_index_scale + cmp [value_type],0 + jne check_index_scale + mov al,[edi] + cbw + cwde + cmp eax,[edi] + jne check_index_scale + cdq + cmp edx,[edi+4] + jne check_immediate_address + special_index_scale: + mov bh,bl + dec cl + check_immediate_address: + cmp [free_address_range],0 + jne check_qword_value + mov al,[address_size] + and al,0Fh + cmp al,2 + je check_word_value + cmp al,4 + je check_dword_value + cmp al,8 + je check_qword_value + or al,al + jnz invalid_value + cmp [code_type],64 + jne check_dword_value + jmp check_qword_value + check_index_with_base: + cmp cl,1 + jne check_index_scale + cmp bl,44h + je swap_base_with_index + cmp bl,84h + je swap_base_with_index + cmp [code_type],64 + je check_for_rbp_base + cmp bl,45h + jne check_for_ebp_base + cmp [segment_register],3 + je swap_base_with_index + jmp check_immediate_address + check_for_ebp_base: + cmp bh,45h + jne check_immediate_address + cmp [segment_register],4 + jne check_immediate_address + swap_base_with_index: + xchg bl,bh + jmp check_immediate_address + check_for_rbp_base: + cmp bh,45h + je swap_base_with_index + cmp bh,85h + je swap_base_with_index + jmp check_immediate_address + check_index_scale: + test cl,not 1111b + jnz invalid_address + mov al,cl + dec al + and al,cl + jz check_immediate_address + jmp invalid_address + check_vsib: + xor ah,ah + check_vsib_base: + test bh,bh + jz check_vsib_index + mov al,bh + shr al,4 + cmp al,4 + je check_vsib_base_size + cmp [code_type],64 + jne swap_vsib_registers + cmp al,8 + jne swap_vsib_registers + check_vsib_base_size: + mov ah,[address_size] + and ah,0Fh + jz check_vsib_index + cmp al,ah + jne invalid_address + check_vsib_index: + mov al,bl + and al,0E0h + cmp al,0C0h + jae check_index_scale + cmp al,60h + je check_index_scale + jmp invalid_address + swap_vsib_registers: + xor ah,-1 + jz invalid_address + cmp cl,1 + ja invalid_address + xchg bl,bh + mov cl,1 + jmp check_vsib_base + +calculate_relative_offset: + cmp [value_undefined],0 + jne relative_offset_ok + test bh,bh + setne ch + cmp bx,[ds:ebp+10h] + je origin_registers_ok + xchg bh,bl + xchg ch,cl + cmp bx,[ds:ebp+10h] + jne invalid_value + origin_registers_ok: + cmp cx,[ds:ebp+10h+2] + jne invalid_value + mov bl,[address_sign] + add eax,[ds:ebp] + adc edx,[ds:ebp+4] + adc bl,[ds:ebp+8] + sub eax,edi + sbb edx,0 + sbb bl,0 + mov [value_sign],bl + mov bl,[value_type] + mov ecx,[address_symbol] + mov [symbol_identifier],ecx + test bl,1 + jnz relative_offset_unallowed + cmp bl,6 + je plt_relative_offset + mov bh,[ds:ebp+9] + cmp bl,bh + je set_relative_offset_type + cmp bx,0402h + je set_relative_offset_type + relative_offset_unallowed: + call recoverable_misuse + set_relative_offset_type: + cmp [value_type],0 + je relative_offset_ok + mov [value_type],0 + cmp ecx,[ds:ebp+14h] + je relative_offset_ok + mov [value_type],3 + relative_offset_ok: + ret + plt_relative_offset: + mov [value_type],7 + cmp byte [ds:ebp+9],2 + je relative_offset_ok + cmp byte [ds:ebp+9],4 + jne recoverable_misuse + ret + +calculate_logical_expression: + xor al,al + calculate_embedded_logical_expression: + mov [logical_value_wrapping],al + call get_logical_value + logical_loop: + cmp byte [esi],'|' + je logical_or + cmp byte [esi],'&' + je logical_and + ret + logical_or: + inc esi + or al,al + jnz logical_value_already_determined + push eax + call get_logical_value + pop ebx + or al,bl + jmp logical_loop + logical_and: + inc esi + or al,al + jz logical_value_already_determined + push eax + call get_logical_value + pop ebx + and al,bl + jmp logical_loop + logical_value_already_determined: + push eax + call skip_logical_value + jc invalid_expression + pop eax + jmp logical_loop + get_value_for_comparison: + mov [value_size],8 + or [operand_flags],1 + lods byte [esi] + call calculate_expression + cmp byte [edi+8],0 + jne first_register_size_ok + mov byte [edi+10],0 + first_register_size_ok: + cmp byte [edi+9],0 + jne second_register_size_ok + mov byte [edi+11],0 + second_register_size_ok: + mov eax,[edi+16] + mov [symbol_identifier],eax + mov al,[edi+13] + mov [value_sign],al + mov bl,[edi+12] + mov eax,[edi] + mov edx,[edi+4] + mov ecx,[edi+8] + ret + get_logical_value: + xor al,al + check_for_negation: + cmp byte [esi],'~' + jne negation_ok + inc esi + xor al,-1 + jmp check_for_negation + negation_ok: + push eax + mov al,[esi] + cmp al,91h + je logical_expression + cmp al,0FFh + je invalid_expression + cmp al,88h + je check_for_defined + cmp al,8Ah + je check_for_earlier_defined + cmp al,89h + je check_for_used + cmp al,'0' + je given_false + cmp al,'1' + je given_true + cmp al,'(' + jne invalid_value + call get_value_for_comparison + mov bh,[value_sign] + push eax edx [symbol_identifier] ebx ecx + mov al,[esi] + or al,al + jz logical_number + cmp al,0Fh + je logical_number + cmp al,92h + je logical_number + cmp al,'&' + je logical_number + cmp al,'|' + je logical_number + inc esi + mov [compare_type],al + cmp byte [esi],'(' + jne invalid_value + call get_value_for_comparison + cmp bl,[esp+4] + jne values_not_relative + or bl,bl + jz check_values_registers + mov ebx,[symbol_identifier] + cmp ebx,[esp+8] + jne values_not_relative + check_values_registers: + cmp ecx,[esp] + je values_relative + ror ecx,16 + xchg ch,cl + ror ecx,16 + xchg ch,cl + cmp ecx,[esp] + je values_relative + values_not_relative: + cmp [compare_type],0F8h + jne invalid_comparison + add esp,12+8 + jmp return_false + invalid_comparison: + call recoverable_misuse + values_relative: + pop ebx + shl ebx,16 + mov bx,[esp] + add esp,8 + pop ecx ebp + cmp [compare_type],'=' + je check_equal + cmp [compare_type],0F1h + je check_not_equal + cmp [compare_type],0F8h + je return_true + test ebx,0FFFF0000h + jz check_less_or_greater + call recoverable_misuse + check_less_or_greater: + cmp [compare_type],'>' + je check_greater + cmp [compare_type],'<' + je check_less + cmp [compare_type],0F2h + je check_not_less + cmp [compare_type],0F3h + je check_not_greater + jmp invalid_expression + check_equal: + cmp bh,[value_sign] + jne return_false + cmp eax,ebp + jne return_false + cmp edx,ecx + jne return_false + jmp return_true + check_greater: + cmp bh,[value_sign] + jg return_true + jl return_false + cmp edx,ecx + jb return_true + ja return_false + cmp eax,ebp + jb return_true + jae return_false + check_less: + cmp bh,[value_sign] + jg return_false + jl return_true + cmp edx,ecx + jb return_false + ja return_true + cmp eax,ebp + jbe return_false + ja return_true + check_not_less: + cmp bh,[value_sign] + jg return_true + jl return_false + cmp edx,ecx + jb return_true + ja return_false + cmp eax,ebp + jbe return_true + ja return_false + check_not_greater: + cmp bh,[value_sign] + jg return_false + jl return_true + cmp edx,ecx + jb return_false + ja return_true + cmp eax,ebp + jb return_false + jae return_true + check_not_equal: + cmp bh,[value_sign] + jne return_true + cmp eax,ebp + jne return_true + cmp edx,ecx + jne return_true + jmp return_false + logical_number: + pop ecx ebx eax edx eax + or bl,bl + jnz invalid_logical_number + or cx,cx + jz logical_number_ok + invalid_logical_number: + call recoverable_misuse + logical_number_ok: + test bh,bh + jnz return_true + or eax,edx + jnz return_true + jmp return_false + check_for_earlier_defined: + or bh,-1 + jmp check_if_expression_defined + check_for_defined: + xor bh,bh + check_if_expression_defined: + or bl,-1 + lods word [esi] + cmp ah,'(' + jne invalid_expression + check_expression: + lods byte [esi] + or al,al + jz defined_string + cmp al,'.' + je defined_fp_value + cmp al,')' + je expression_checked + cmp al,'!' + je invalid_expression + cmp al,0Fh + je check_expression + cmp al,10h + je defined_register + cmp al,11h + je check_if_symbol_defined + cmp al,80h + jae check_expression + movzx eax,al + add esi,eax + jmp check_expression + defined_register: + inc esi + jmp check_expression + defined_fp_value: + add esi,12+1 + jmp expression_checked + defined_string: + lods dword [esi] + add esi,eax + inc esi + jmp expression_checked + check_if_symbol_defined: + lods dword [esi] + cmp eax,-1 + je invalid_expression + cmp eax,0Fh + jb check_expression + je reserved_word_used_as_symbol + test bh,bh + jnz no_prediction + test byte [eax+8],4 + jnz no_prediction + test byte [eax+8],1 + jz symbol_predicted_undefined + mov cx,[current_pass] + sub cx,[eax+16] + jz check_expression + cmp cx,1 + ja symbol_predicted_undefined + or byte [eax+8],40h+80h + jmp check_expression + no_prediction: + test byte [eax+8],1 + jz symbol_undefined + mov cx,[current_pass] + sub cx,[eax+16] + jz check_expression + jmp symbol_undefined + symbol_predicted_undefined: + or byte [eax+8],40h + and byte [eax+8],not 80h + symbol_undefined: + xor bl,bl + jmp check_expression + expression_checked: + mov al,bl + jmp logical_value_ok + check_for_used: + lods word [esi] + cmp ah,2 + jne invalid_expression + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + test byte [eax+8],8 + jz not_used + mov cx,[current_pass] + sub cx,[eax+18] + jz return_true + cmp cx,1 + ja not_used + or byte [eax+8],10h+20h + jmp return_true + not_used: + or byte [eax+8],10h + and byte [eax+8],not 20h + jmp return_false + given_false: + inc esi + return_false: + xor al,al + jmp logical_value_ok + given_true: + inc esi + return_true: + or al,-1 + jmp logical_value_ok + logical_expression: + lods byte [esi] + mov dl,[logical_value_wrapping] + push edx + call calculate_embedded_logical_expression + pop edx + mov [logical_value_wrapping],dl + push eax + lods byte [esi] + cmp al,92h + jne invalid_expression + pop eax + logical_value_ok: + pop ebx + xor al,bl + ret + +skip_symbol: + lods byte [esi] + or al,al + jz nothing_to_skip + cmp al,0Fh + je nothing_to_skip + cmp al,1 + je skip_instruction + cmp al,2 + je skip_label + cmp al,3 + je skip_label + cmp al,4 + je skip_special_label + cmp al,20h + jb skip_assembler_symbol + cmp al,'(' + je skip_expression + cmp al,'[' + je skip_address + skip_done: + clc + ret + skip_label: + add esi,2 + skip_instruction: + add esi,2 + skip_assembler_symbol: + inc esi + jmp skip_done + skip_special_label: + add esi,4 + jmp skip_done + skip_address: + mov al,[esi] + and al,11110000b + cmp al,60h + jb skip_expression + cmp al,70h + ja skip_expression + inc esi + jmp skip_address + skip_expression: + lods byte [esi] + or al,al + jz skip_string + cmp al,'.' + je skip_fp_value + cmp al,')' + je skip_done + cmp al,']' + je skip_done + cmp al,'!' + je skip_expression + cmp al,0Fh + je skip_expression + cmp al,10h + je skip_register + cmp al,11h + je skip_label_value + cmp al,80h + jae skip_expression + movzx eax,al + add esi,eax + jmp skip_expression + skip_label_value: + add esi,3 + skip_register: + inc esi + jmp skip_expression + skip_fp_value: + add esi,12 + jmp skip_done + skip_string: + lods dword [esi] + add esi,eax + inc esi + jmp skip_done + nothing_to_skip: + dec esi + stc + ret + +expand_path: + lods byte [esi] + cmp al,'%' + je environment_variable + stos byte [edi] + or al,al + jnz expand_path + cmp edi,[memory_end] + ja out_of_memory + ret + environment_variable: + mov ebx,esi + find_variable_end: + lods byte [esi] + or al,al + jz not_environment_variable + cmp al,'%' + jne find_variable_end + mov byte [esi-1],0 + push esi + mov esi,ebx + call get_environment_variable + pop esi + mov byte [esi-1],'%' + jmp expand_path + not_environment_variable: + mov al,'%' + stos byte [edi] + mov esi,ebx + jmp expand_path +get_include_directory: + lods byte [esi] + cmp al,';' + je include_directory_ok + stos byte [edi] + or al,al + jnz get_include_directory + dec esi + dec edi + include_directory_ok: + cmp byte [edi-1],'/' + je path_separator_ok + cmp byte [edi-1],'\' + je path_separator_ok + mov al,'/' + stos byte [edi] + path_separator_ok: + ret diff --git a/programs/develop/koldbg/fasm/exprpars.inc b/programs/develop/koldbg/fasm/exprpars.inc new file mode 100644 index 0000000000..7f5b7eca90 --- /dev/null +++ b/programs/develop/koldbg/fasm/exprpars.inc @@ -0,0 +1,1280 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +convert_expression: + push ebp + call get_fp_value + jnc fp_expression + mov [current_offset],esp + expression_loop: + push edi + mov edi,single_operand_operators + call get_operator + pop edi + or al,al + jz expression_element + cmp al,82h + je expression_loop + push eax + jmp expression_loop + expression_element: + mov al,[esi] + cmp al,1Ah + je expression_number + cmp al,22h + je expression_number + cmp al,'(' + je expression_number + mov al,'!' + stos byte [edi] + jmp expression_operator + expression_number: + call convert_number + expression_operator: + push edi + mov edi,operators + call get_operator + pop edi + or al,al + jz expression_end + operators_loop: + cmp esp,[current_offset] + je push_operator + mov bl,al + and bl,0F0h + mov bh,byte [esp] + and bh,0F0h + cmp bl,bh + ja push_operator + pop ebx + mov byte [edi],bl + inc edi + jmp operators_loop + push_operator: + push eax + jmp expression_loop + expression_end: + cmp esp,[current_offset] + je expression_converted + pop eax + stos byte [edi] + jmp expression_end + expression_converted: + pop ebp + ret + fp_expression: + mov al,'.' + stos byte [edi] + mov eax,[fp_value] + stos dword [edi] + mov eax,[fp_value+4] + stos dword [edi] + mov eax,[fp_value+8] + stos dword [edi] + pop ebp + ret + +convert_number: + lea eax,[edi+20h] + mov edx,[memory_end] + cmp [source_start],0 + je check_memory_for_number + mov edx,[labels_list] + check_memory_for_number: + cmp eax,edx + jae out_of_memory + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + cmp byte [esi],'(' + je expression_value + inc edi + call get_number + jc symbol_value + or ebp,ebp + jz valid_number + mov byte [edi-1],0Fh + ret + valid_number: + cmp dword [edi+4],0 + jne qword_number + cmp word [edi+2],0 + jne dword_number + cmp byte [edi+1],0 + jne word_number + byte_number: + mov byte [edi-1],1 + inc edi + ret + qword_number: + mov byte [edi-1],8 + add edi,8 + ret + dword_number: + mov byte [edi-1],4 + scas dword [edi] + ret + word_number: + mov byte [edi-1],2 + scas word [edi] + ret + expression_value: + inc esi + push [current_offset] + call convert_expression + pop [current_offset] + lods byte [esi] + cmp al,')' + je subexpression_closed + dec esi + mov al,'!' + stosb + subexpression_closed: + ret + symbol_value: + cmp [source_start],0 + je preprocessor_value + push edi esi + lods word [esi] + cmp al,1Ah + jne no_address_register + movzx ecx,ah + call get_symbol + jc no_address_register + cmp al,10h + jne no_address_register + mov al,ah + shr ah,4 + cmp ah,4 + je register_value + and ah,not 1 + cmp ah,8 + je register_value + cmp ah,0Ch + jae register_value + cmp ah,6 + je register_value + cmp al,23h + je register_value + cmp al,25h + je register_value + cmp al,26h + je register_value + cmp al,27h + je register_value + no_address_register: + pop esi + mov edi,directive_operators + call get_operator + pop edi + or al,al + jnz broken_value + lods byte [esi] + cmp al,1Ah + jne invalid_value + lods byte [esi] + movzx ecx,al + call get_label_id + store_label_value: + mov byte [edi-1],11h + stos dword [edi] + ret + broken_value: + mov eax,0Fh + jmp store_label_value + register_value: + pop edx edi + mov byte [edi-1],10h + stos byte [edi] + ret + preprocessor_value: + dec edi + cmp [hash_tree],0 + je invalid_value + lods byte [esi] + cmp al,1Ah + jne invalid_value + lods byte [esi] + mov cl,al + mov ch,10b + call get_preprocessor_symbol + jc invalid_value + push esi + mov esi,[edx+8] + push [current_offset] + call convert_expression + pop [current_offset] + pop esi + ret + +get_number: + xor ebp,ebp + lods byte [esi] + cmp al,22h + je get_text_number + cmp al,1Ah + jne not_number + lods byte [esi] + movzx ecx,al + mov [number_start],esi + mov al,[esi] + cmp al,'$' + je number_begin + sub al,30h + cmp al,9 + ja invalid_number + number_begin: + mov ebx,esi + add esi,ecx + push esi + dec esi + mov dword [edi],0 + mov dword [edi+4],0 + cmp byte [ebx],'$' + je pascal_hex_number + cmp word [ebx],'0x' + je get_hex_number + mov al,[esi] + dec esi + cmp al,'h' + je get_hex_number + cmp al,'b' + je get_bin_number + cmp al,'d' + je get_dec_number + cmp al,'o' + je get_oct_number + cmp al,'q' + je get_oct_number + cmp al,'H' + je get_hex_number + cmp al,'B' + je get_bin_number + cmp al,'D' + je get_dec_number + cmp al,'O' + je get_oct_number + cmp al,'Q' + je get_oct_number + inc esi + get_dec_number: + mov ebx,esi + mov esi,[number_start] + get_dec_digit: + cmp esi,ebx + ja number_ok + cmp byte [esi],27h + je next_dec_digit + cmp byte [esi],'_' + je next_dec_digit + xor edx,edx + mov eax,[edi] + shld edx,eax,2 + shl eax,2 + add eax,[edi] + adc edx,0 + add eax,eax + adc edx,edx + mov [edi],eax + mov eax,[edi+4] + add eax,eax + jc dec_out_of_range + add eax,eax + jc dec_out_of_range + add eax,[edi+4] + jc dec_out_of_range + add eax,eax + jc dec_out_of_range + add eax,edx + jc dec_out_of_range + mov [edi+4],eax + movzx eax,byte [esi] + sub al,30h + jc bad_number + cmp al,9 + ja bad_number + add [edi],eax + adc dword [edi+4],0 + jc dec_out_of_range + next_dec_digit: + inc esi + jmp get_dec_digit + dec_out_of_range: + cmp esi,ebx + ja dec_out_of_range_finished + lods byte [esi] + cmp al,27h + je bad_number + cmp al,'_' + je bad_number + sub al,30h + jc bad_number + cmp al,9 + ja bad_number + jmp dec_out_of_range + dec_out_of_range_finished: + or ebp,-1 + jmp number_ok + bad_number: + pop eax + invalid_number: + mov esi,[number_start] + dec esi + not_number: + dec esi + stc + ret + get_bin_number: + xor bl,bl + get_bin_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + cmp al,27h + je bin_digit_skip + cmp al,'_' + je bin_digit_skip + sub al,30h + cmp al,1 + ja bad_number + xor edx,edx + mov cl,bl + dec esi + cmp bl,64 + je bin_out_of_range + inc bl + cmp cl,32 + jae bin_digit_high + shl eax,cl + or dword [edi],eax + jmp get_bin_digit + bin_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_bin_digit + bin_out_of_range: + or al,al + jz get_bin_digit + or ebp,-1 + jmp get_bin_digit + bin_digit_skip: + dec esi + jmp get_bin_digit + pascal_hex_number: + cmp cl,1 + je bad_number + get_hex_number: + xor bl,bl + get_hex_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + cmp al,27h + je hex_digit_skip + cmp al,'_' + je hex_digit_skip + cmp al,'x' + je hex_number_ok + cmp al,'$' + je pascal_hex_ok + sub al,30h + cmp al,9 + jbe hex_digit_ok + sub al,7 + cmp al,15 + jbe hex_letter_digit_ok + sub al,20h + cmp al,15 + ja bad_number + hex_letter_digit_ok: + cmp al,10 + jb bad_number + hex_digit_ok: + xor edx,edx + mov cl,bl + dec esi + cmp bl,64 + je hex_out_of_range + add bl,4 + cmp cl,32 + jae hex_digit_high + shl eax,cl + or dword [edi],eax + jmp get_hex_digit + hex_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_hex_digit + hex_out_of_range: + or al,al + jz get_hex_digit + or ebp,-1 + jmp get_hex_digit + hex_digit_skip: + dec esi + jmp get_hex_digit + get_oct_number: + xor bl,bl + get_oct_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + cmp al,27h + je oct_digit_skip + cmp al,'_' + je oct_digit_skip + sub al,30h + cmp al,7 + ja bad_number + oct_digit_ok: + xor edx,edx + mov cl,bl + dec esi + cmp bl,63 + ja oct_out_of_range + jne oct_range_ok + cmp al,1 + ja oct_out_of_range + oct_range_ok: + add bl,3 + cmp cl,30 + je oct_digit_wrap + ja oct_digit_high + shl eax,cl + or dword [edi],eax + jmp get_oct_digit + oct_digit_wrap: + shl eax,cl + adc dword [edi+4],0 + or dword [edi],eax + jmp get_oct_digit + oct_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_oct_digit + oct_digit_skip: + dec esi + jmp get_oct_digit + oct_out_of_range: + or al,al + jz get_oct_digit + or ebp,-1 + jmp get_oct_digit + hex_number_ok: + dec esi + pascal_hex_ok: + cmp esi,[number_start] + jne bad_number + number_ok: + pop esi + number_done: + clc + ret + get_text_number: + lods dword [esi] + mov edx,eax + xor bl,bl + mov dword [edi],0 + mov dword [edi+4],0 + get_text_character: + sub edx,1 + jc number_done + movzx eax,byte [esi] + inc esi + mov cl,bl + cmp bl,64 + je text_out_of_range + add bl,8 + cmp cl,32 + jae text_character_high + shl eax,cl + or dword [edi],eax + jmp get_text_character + text_character_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_text_character + text_out_of_range: + or ebp,-1 + jmp get_text_character + +get_fp_value: + push edi esi + lods byte [esi] + cmp al,1Ah + je fp_value_start + cmp al,'-' + je fp_sign_ok + cmp al,'+' + jne not_fp_value + fp_sign_ok: + lods byte [esi] + cmp al,1Ah + jne not_fp_value + fp_value_start: + lods byte [esi] + movzx ecx,al + cmp cl,1 + jbe not_fp_value + lea edx,[esi+1] + xor ah,ah + check_fp_value: + lods byte [esi] + cmp al,'.' + je fp_character_dot + cmp al,'E' + je fp_character_exp + cmp al,'e' + je fp_character_exp + cmp al,'F' + je fp_last_character + cmp al,'f' + je fp_last_character + digit_expected: + cmp al,'0' + jb not_fp_value + cmp al,'9' + ja not_fp_value + jmp fp_character_ok + fp_character_dot: + cmp esi,edx + je not_fp_value + or ah,ah + jnz not_fp_value + or ah,1 + lods byte [esi] + loop digit_expected + not_fp_value: + pop esi edi + stc + ret + fp_last_character: + cmp cl,1 + jne not_fp_value + or ah,4 + jmp fp_character_ok + fp_character_exp: + cmp esi,edx + je not_fp_value + cmp ah,1 + ja not_fp_value + or ah,2 + cmp ecx,1 + jne fp_character_ok + cmp byte [esi],'+' + je fp_exp_sign + cmp byte [esi],'-' + jne fp_character_ok + fp_exp_sign: + inc esi + cmp byte [esi],1Ah + jne not_fp_value + inc esi + lods byte [esi] + movzx ecx,al + inc ecx + fp_character_ok: + dec ecx + jnz check_fp_value + or ah,ah + jz not_fp_value + pop esi + lods byte [esi] + mov [fp_sign],0 + cmp al,1Ah + je fp_get + inc esi + cmp al,'+' + je fp_get + mov [fp_sign],1 + fp_get: + lods byte [esi] + movzx ecx,al + xor edx,edx + mov edi,fp_value + mov [edi],edx + mov [edi+4],edx + mov [edi+12],edx + call fp_optimize + mov [fp_format],0 + mov al,[esi] + fp_before_dot: + lods byte [esi] + cmp al,'.' + je fp_dot + cmp al,'E' + je fp_exponent + cmp al,'e' + je fp_exponent + cmp al,'F' + je fp_done + cmp al,'f' + je fp_done + sub al,30h + mov edi,fp_value+16 + xor edx,edx + mov dword [edi+12],edx + mov dword [edi],edx + mov dword [edi+4],edx + mov [edi+7],al + mov dl,7 + mov dword [edi+8],edx + call fp_optimize + mov edi,fp_value + push ecx + mov ecx,10 + call fp_mul + pop ecx + mov ebx,fp_value+16 + call fp_add + loop fp_before_dot + fp_dot: + mov edi,fp_value+16 + xor edx,edx + mov [edi],edx + mov [edi+4],edx + mov byte [edi+7],80h + mov [edi+8],edx + mov dword [edi+12],edx + dec ecx + jz fp_done + fp_after_dot: + lods byte [esi] + cmp al,'E' + je fp_exponent + cmp al,'e' + je fp_exponent + cmp al,'F' + je fp_done + cmp al,'f' + je fp_done + inc [fp_format] + cmp [fp_format],80h + jne fp_counter_ok + mov [fp_format],7Fh + fp_counter_ok: + dec esi + mov edi,fp_value+16 + push ecx + mov ecx,10 + call fp_div + push dword [edi] + push dword [edi+4] + push dword [edi+8] + push dword [edi+12] + lods byte [esi] + sub al,30h + movzx ecx,al + call fp_mul + mov ebx,edi + mov edi,fp_value + call fp_add + mov edi,fp_value+16 + pop dword [edi+12] + pop dword [edi+8] + pop dword [edi+4] + pop dword [edi] + pop ecx + dec ecx + jnz fp_after_dot + jmp fp_done + fp_exponent: + or [fp_format],80h + xor edx,edx + xor ebp,ebp + dec ecx + jnz get_exponent + cmp byte [esi],'+' + je fp_exponent_sign + cmp byte [esi],'-' + jne fp_done + not ebp + fp_exponent_sign: + add esi,2 + lods byte [esi] + movzx ecx,al + get_exponent: + movzx eax,byte [esi] + inc esi + sub al,30h + cmp al,10 + jae exponent_ok + imul edx,10 + cmp edx,8000h + jae value_out_of_range + add edx,eax + loop get_exponent + exponent_ok: + mov edi,fp_value + or edx,edx + jz fp_done + mov ecx,edx + or ebp,ebp + jnz fp_negative_power + fp_power: + push ecx + mov ecx,10 + call fp_mul + pop ecx + loop fp_power + jmp fp_done + fp_negative_power: + push ecx + mov ecx,10 + call fp_div + pop ecx + loop fp_negative_power + fp_done: + mov edi,fp_value + mov al,[fp_format] + mov [edi+10],al + mov al,[fp_sign] + mov [edi+11],al + test byte [edi+15],80h + jz fp_ok + add dword [edi],1 + adc dword [edi+4],0 + jnc fp_ok + mov eax,[edi+4] + shrd [edi],eax,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc word [edi+8] + fp_ok: + pop edi + clc + ret + fp_mul: + or ecx,ecx + jz fp_zero + mov eax,[edi+12] + mul ecx + mov [edi+12],eax + mov ebx,edx + mov eax,[edi] + mul ecx + add eax,ebx + adc edx,0 + mov [edi],eax + mov ebx,edx + mov eax,[edi+4] + mul ecx + add eax,ebx + adc edx,0 + mov [edi+4],eax + .loop: + or edx,edx + jz .done + mov eax,[edi] + shrd [edi+12],eax,1 + mov eax,[edi+4] + shrd [edi],eax,1 + shrd eax,edx,1 + mov [edi+4],eax + shr edx,1 + inc dword [edi+8] + cmp dword [edi+8],8000h + jge value_out_of_range + jmp .loop + .done: + ret + fp_div: + mov eax,[edi+4] + xor edx,edx + div ecx + mov [edi+4],eax + mov eax,[edi] + div ecx + mov [edi],eax + mov eax,[edi+12] + div ecx + mov [edi+12],eax + mov ebx,eax + or ebx,[edi] + or ebx,[edi+4] + jz fp_zero + .loop: + test byte [edi+7],80h + jnz .exp_ok + mov eax,[edi] + shld [edi+4],eax,1 + mov eax,[edi+12] + shld [edi],eax,1 + add eax,eax + mov [edi+12],eax + dec dword [edi+8] + add edx,edx + jmp .loop + .exp_ok: + mov eax,edx + xor edx,edx + div ecx + add [edi+12],eax + adc dword [edi],0 + adc dword [edi+4],0 + jnc .done + mov eax,[edi+4] + mov ebx,[edi] + shrd [edi],eax,1 + shrd [edi+12],ebx,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc dword [edi+8] + .done: + ret + fp_add: + cmp dword [ebx+8],8000h + je .done + cmp dword [edi+8],8000h + je .copy + mov eax,[ebx+8] + cmp eax,[edi+8] + jge .exp_ok + mov eax,[edi+8] + .exp_ok: + call .change_exp + xchg ebx,edi + call .change_exp + xchg ebx,edi + mov edx,[ebx+12] + mov eax,[ebx] + mov ebx,[ebx+4] + add [edi+12],edx + adc [edi],eax + adc [edi+4],ebx + jnc .done + mov eax,[edi] + shrd [edi+12],eax,1 + mov eax,[edi+4] + shrd [edi],eax,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc dword [edi+8] + .done: + ret + .copy: + mov eax,[ebx] + mov [edi],eax + mov eax,[ebx+4] + mov [edi+4],eax + mov eax,[ebx+8] + mov [edi+8],eax + mov eax,[ebx+12] + mov [edi+12],eax + ret + .change_exp: + push ecx + mov ecx,eax + sub ecx,[ebx+8] + mov edx,[ebx+4] + jecxz .exp_done + .exp_loop: + mov ebp,[ebx] + shrd [ebx+12],ebp,1 + shrd [ebx],edx,1 + shr edx,1 + inc dword [ebx+8] + loop .exp_loop + .exp_done: + mov [ebx+4],edx + pop ecx + ret + fp_optimize: + mov eax,[edi] + mov ebp,[edi+4] + or ebp,[edi] + or ebp,[edi+12] + jz fp_zero + .loop: + test byte [edi+7],80h + jnz .done + shld [edi+4],eax,1 + mov ebp,[edi+12] + shld eax,ebp,1 + mov [edi],eax + shl dword [edi+12],1 + dec dword [edi+8] + jmp .loop + .done: + ret + fp_zero: + mov dword [edi+8],8000h + ret + +preevaluate_logical_expression: + xor al,al + preevaluate_embedded_logical_expression: + mov [logical_value_wrapping],al + push edi + call preevaluate_logical_value + preevaluation_loop: + cmp al,0FFh + je invalid_logical_expression + mov dl,[esi] + inc esi + cmp dl,'|' + je preevaluate_or + cmp dl,'&' + je preevaluate_and + cmp dl,92h + je preevaluation_done + or dl,dl + jnz invalid_logical_expression + preevaluation_done: + pop edx + dec esi + ret + preevaluate_or: + cmp al,'1' + je quick_true + cmp al,'0' + je leave_only_following + push edi + mov al,dl + stos byte [edi] + call preevaluate_logical_value + pop ebx + cmp al,'0' + je leave_only_preceding + cmp al,'1' + jne preevaluation_loop + stos byte [edi] + xor al,al + jmp preevaluation_loop + preevaluate_and: + cmp al,'0' + je quick_false + cmp al,'1' + je leave_only_following + push edi + mov al,dl + stos byte [edi] + call preevaluate_logical_value + pop ebx + cmp al,'1' + je leave_only_preceding + cmp al,'0' + jne preevaluation_loop + stos byte [edi] + xor al,al + jmp preevaluation_loop + leave_only_following: + mov edi,[esp] + call preevaluate_logical_value + jmp preevaluation_loop + leave_only_preceding: + mov edi,ebx + xor al,al + jmp preevaluation_loop + quick_true: + call skip_logical_value + jc invalid_logical_expression + mov edi,[esp] + mov al,'1' + jmp preevaluation_loop + quick_false: + call skip_logical_value + jc invalid_logical_expression + mov edi,[esp] + mov al,'0' + jmp preevaluation_loop + invalid_logical_expression: + pop edi + mov esi,edi + mov al,0FFh + stos byte [edi] + ret + skip_logical_value: + cmp byte [esi],'~' + jne negation_skipped + inc esi + jmp skip_logical_value + negation_skipped: + mov al,[esi] + cmp al,91h + jne skip_simple_logical_value + inc esi + xchg al,[logical_value_wrapping] + push eax + skip_logical_expression: + call skip_logical_value + lods byte [esi] + or al,al + jz wrongly_structured_logical_expression + cmp al,0Fh + je wrongly_structured_logical_expression + cmp al,'|' + je skip_logical_expression + cmp al,'&' + je skip_logical_expression + cmp al,92h + jne wrongly_structured_logical_expression + pop eax + mov [logical_value_wrapping],al + logical_value_skipped: + clc + ret + wrongly_structured_logical_expression: + pop eax + stc + ret + skip_simple_logical_value: + mov [logical_value_parentheses],0 + find_simple_logical_value_end: + mov al,[esi] + or al,al + jz logical_value_skipped + cmp al,0Fh + je logical_value_skipped + cmp al,'|' + je logical_value_skipped + cmp al,'&' + je logical_value_skipped + cmp al,91h + je skip_logical_value_internal_parenthesis + cmp al,92h + jne skip_logical_value_symbol + sub [logical_value_parentheses],1 + jnc skip_logical_value_symbol + cmp [logical_value_wrapping],91h + jne skip_logical_value_symbol + jmp logical_value_skipped + skip_logical_value_internal_parenthesis: + inc [logical_value_parentheses] + skip_logical_value_symbol: + call skip_symbol + jmp find_simple_logical_value_end + preevaluate_logical_value: + mov ebp,edi + preevaluate_negation: + cmp byte [esi],'~' + jne preevaluate_negation_ok + movs byte [edi],[esi] + jmp preevaluate_negation + preevaluate_negation_ok: + mov ebx,esi + cmp byte [esi],91h + jne preevaluate_simple_logical_value + lods byte [esi] + stos byte [edi] + push ebp + mov dl,[logical_value_wrapping] + push edx + call preevaluate_embedded_logical_expression + pop edx + mov [logical_value_wrapping],dl + pop ebp + cmp al,0FFh + je invalid_logical_value + cmp byte [esi],92h + jne invalid_logical_value + or al,al + jnz preevaluated_expression_value + movs byte [edi],[esi] + ret + preevaluated_expression_value: + inc esi + lea edx,[edi-1] + sub edx,ebp + test edx,1 + jz expression_negation_ok + xor al,1 + expression_negation_ok: + mov edi,ebp + ret + invalid_logical_value: + mov edi,ebp + mov al,0FFh + ret + preevaluate_simple_logical_value: + xor edx,edx + mov [logical_value_parentheses],edx + find_logical_value_boundaries: + mov al,[esi] + or al,al + jz logical_value_boundaries_found + cmp al,91h + je logical_value_internal_parentheses + cmp al,92h + je logical_value_boundaries_parenthesis_close + cmp al,'|' + je logical_value_boundaries_found + cmp al,'&' + je logical_value_boundaries_found + or edx,edx + jnz next_symbol_in_logical_value + cmp al,0F0h + je preevaluable_logical_operator + cmp al,0F7h + je preevaluable_logical_operator + cmp al,0F6h + jne next_symbol_in_logical_value + preevaluable_logical_operator: + mov edx,esi + next_symbol_in_logical_value: + call skip_symbol + jmp find_logical_value_boundaries + logical_value_internal_parentheses: + inc [logical_value_parentheses] + jmp next_symbol_in_logical_value + logical_value_boundaries_parenthesis_close: + sub [logical_value_parentheses],1 + jnc next_symbol_in_logical_value + cmp [logical_value_wrapping],91h + jne next_symbol_in_logical_value + logical_value_boundaries_found: + or edx,edx + jz non_preevaluable_logical_value + mov al,[edx] + cmp al,0F0h + je compare_symbols + cmp al,0F7h + je compare_symbol_types + cmp al,0F6h + je scan_symbols_list + non_preevaluable_logical_value: + mov ecx,esi + mov esi,ebx + sub ecx,esi + jz invalid_logical_value + cmp esi,edi + je leave_logical_value_intact + rep movs byte [edi],[esi] + xor al,al + ret + leave_logical_value_intact: + add edi,ecx + add esi,ecx + xor al,al + ret + compare_symbols: + lea ecx,[esi-1] + sub ecx,edx + mov eax,edx + sub eax,ebx + cmp ecx,eax + jne preevaluated_false + push esi edi + mov esi,ebx + lea edi,[edx+1] + repe cmps byte [esi],[edi] + pop edi esi + je preevaluated_true + preevaluated_false: + mov eax,edi + sub eax,ebp + test eax,1 + jnz store_true + store_false: + mov edi,ebp + mov al,'0' + ret + preevaluated_true: + mov eax,edi + sub eax,ebp + test eax,1 + jnz store_false + store_true: + mov edi,ebp + mov al,'1' + ret + compare_symbol_types: + push esi + lea esi,[edx+1] + type_comparison: + cmp esi,[esp] + je types_compared + mov al,[esi] + cmp al,[ebx] + jne different_type + cmp al,'(' + jne equal_type + mov al,[esi+1] + mov ah,[ebx+1] + cmp al,ah + je equal_type + or al,al + jz different_type + or ah,ah + jz different_type + cmp al,'.' + je different_type + cmp ah,'.' + je different_type + equal_type: + call skip_symbol + xchg esi,ebx + call skip_symbol + xchg esi,ebx + jmp type_comparison + types_compared: + pop esi + cmp byte [ebx],0F7h + jne preevaluated_false + jmp preevaluated_true + different_type: + pop esi + jmp preevaluated_false + scan_symbols_list: + push edi esi + lea esi,[edx+1] + sub edx,ebx + lods byte [esi] + cmp al,'<' + jne invalid_symbols_list + get_next_from_list: + mov edi,esi + get_from_list: + cmp byte [esi],',' + je compare_in_list + cmp byte [esi],'>' + je compare_in_list + cmp esi,[esp] + jae invalid_symbols_list + call skip_symbol + jmp get_from_list + compare_in_list: + mov ecx,esi + sub ecx,edi + cmp ecx,edx + jne not_equal_length_in_list + mov esi,ebx + repe cmps byte [esi],[edi] + mov esi,edi + jne not_equal_in_list + skip_rest_of_list: + cmp byte [esi],'>' + je check_list_end + cmp esi,[esp] + jae invalid_symbols_list + call skip_symbol + jmp skip_rest_of_list + check_list_end: + inc esi + cmp esi,[esp] + jne invalid_symbols_list + pop esi edi + jmp preevaluated_true + not_equal_in_list: + add esi,ecx + not_equal_length_in_list: + lods byte [esi] + cmp al,',' + je get_next_from_list + cmp esi,[esp] + jne invalid_symbols_list + pop esi edi + jmp preevaluated_false + invalid_symbols_list: + pop esi edi + jmp invalid_logical_value diff --git a/programs/develop/koldbg/fasm/fasm.asm b/programs/develop/koldbg/fasm/fasm.asm new file mode 100644 index 0000000000..6da82a450a --- /dev/null +++ b/programs/develop/koldbg/fasm/fasm.asm @@ -0,0 +1,155 @@ + use32 + +open: cmp edx,input_magic + jne fail + mov ebx,[edx] + ret + +close: cmp ebx,[input_magic] + jne fail + xor ebx,ebx ;CF=0 + ret + +lseek: cmp ebx,[input_magic] + jne fail + + cmp al,2 + je .end + cmp al,1 + je .pos + cmp al,0 + jne fail + + .str: + mov eax,edx + cmp eax,[input_size] + ja fail + jmp .ok + + .end: + mov eax,[input_size] + neg edx + add eax,edx + jc fail + .ok: + mov [input_start],eax + clc + ret + + .pos: + mov eax,[input_start] + add eax,edx + cmp eax,[input_size] + ja fail + jmp .ok + +read: cmp ebx,[input_magic] + jne fail + push esi edi + mov esi,[input_start] + add esi,[input_code] + mov eax,[input_size] + mov edi,edx + cmp eax,ecx + jnc skip + mov ecx,eax +skip: mov eax,ecx + add [input_start],eax + shr ecx,2 + cld + rep movsd + mov cl,al + and cl,3 + rep movsb + pop edi esi + clc + ret + +write: ;not implemented +create: ;not implemented + +fail: stc + ret + +make_timestamp: + xor eax,eax ;not implemented +get_environment_variable: ;not implemented +display_block: ;not implemented + ret + +assembler_error: fatal_error: + pop [output_errs] + stc + jmp stack_restore + +Assemble: + xor eax,eax + mov [output_errs],eax + mov [output_size],eax + mov [input_start],eax + + mov [input_file],input_magic + mov [input_size],ecx + mov [input_code],esi + mov [input_stack],esp + + mov [memory_start],StdMemStr + mov [memory_end],StdMemEnd + mov [additional_memory],AddMemStr + mov [additional_memory_end],AddMemEnd + + lea eax,[esp-4*1024] + mov [stack_limit],eax + + call preprocessor + call parser + call assembler + + mov esi,[code_start] + mov ecx,edi + sub ecx,esi + + mov eax,256 + cmp ecx,eax + jna max_256 + mov ecx,eax + max_256: + + mov [output_size],ecx + mov edi,output_data + rep movsb + + stack_restore: + + mov esp,[input_stack] + mov esi,[output_errs] + ret + +include 'fasm\version.inc' +include 'fasm\errors.inc' +include 'fasm\symbdump.inc' +include 'fasm\preproce.inc' +include 'fasm\parser.inc' +include 'fasm\exprpars.inc' +include 'fasm\assemble.inc' +include 'fasm\exprcalc.inc' +include 'fasm\formats.inc' +include 'fasm\x86_64.inc' +include 'fasm\avx.inc' + +include 'fasm\tables.inc' +include 'fasm\messages.inc' + +iglobal +input_magic dd 55AA55AAh +endg +uglobal +input_code dd ? +input_size dd ? +input_start dd ? +input_stack dd ? +output_size dd ? +output_errs dd ? +output_data rb 256 +include 'fasm\variable.inc' +endg diff --git a/programs/develop/koldbg/fasm/formats.inc b/programs/develop/koldbg/fasm/formats.inc new file mode 100644 index 0000000000..b600c92192 --- /dev/null +++ b/programs/develop/koldbg/fasm/formats.inc @@ -0,0 +1,4194 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +formatter: + mov [current_offset],edi + cmp [output_file],0 + jne output_path_ok + mov esi,[input_file] + mov edi,[free_additional_memory] + duplicate_output_path: + lods byte [esi] + cmp edi,[structures_buffer] + jae out_of_memory + stos byte [edi] + or al,al + jnz duplicate_output_path + dec edi + mov eax,edi + find_extension: + dec eax + cmp eax,[free_additional_memory] + jb extension_found + cmp byte [eax],'\' + je extension_found + cmp byte [eax],'/' + je extension_found + cmp byte [eax],'.' + jne find_extension + mov edi,eax + extension_found: + lea eax,[edi+9] + cmp eax,[structures_buffer] + jae out_of_memory + cmp [file_extension],0 + jne extension_specified + mov al,[output_format] + cmp al,2 + je exe_extension + jb bin_extension + cmp al,4 + je obj_extension + cmp al,5 + je o_extension + cmp al,3 + jne no_extension + cmp [subsystem],1 + je sys_extension + cmp [subsystem],10 + jae efi_extension + bt [format_flags],8 + jnc exe_extension + mov eax,'.dll' + jmp make_extension + sys_extension: + mov eax,'.sys' + jmp make_extension + efi_extension: + mov eax,'.efi' + jmp make_extension + bin_extension: + mov eax,'.bin' + bt [format_flags],0 + jnc make_extension + mov eax,'.com' + jmp make_extension + obj_extension: + mov eax,'.obj' + jmp make_extension + o_extension: + mov eax,'.o' + bt [format_flags],0 + jnc make_extension + no_extension: + xor eax,eax + jmp make_extension + exe_extension: + mov eax,'.exe' + make_extension: + xchg eax,[edi] + scas dword [edi] + mov byte [edi],0 + scas byte [edi] + mov esi,edi + stos dword [edi] + sub edi,9 + xor eax,eax + mov ebx,characters + adapt_case: + mov al,[esi] + or al,al + jz adapt_next + xlat byte [ebx] + cmp al,[esi] + je adapt_ok + sub byte [edi],20h + adapt_ok: + inc esi + adapt_next: + inc edi + cmp byte [edi],0 + jne adapt_case + jmp extension_ok + extension_specified: + mov al,'.' + stos byte [edi] + mov esi,[file_extension] + copy_extension: + lods byte [esi] + stos byte [edi] + test al,al + jnz copy_extension + dec edi + extension_ok: + mov esi,edi + lea ecx,[esi+1] + sub ecx,[free_additional_memory] + mov edi,[structures_buffer] + dec edi + std + rep movs byte [edi],[esi] + cld + inc edi + mov [structures_buffer],edi + mov [output_file],edi + output_path_ok: + cmp [symbols_file],0 + je labels_table_ok + mov ecx,[memory_end] + sub ecx,[labels_list] + mov edi,[tagged_blocks] + sub edi,8 + mov [edi],ecx + or dword [edi+4],-1 + sub edi,ecx + cmp edi,[current_offset] + jbe out_of_memory + mov [tagged_blocks],edi + mov esi,[memory_end] + copy_labels: + sub esi,32 + cmp esi,[labels_list] + jb labels_table_ok + mov ecx,32 shr 2 + rep movs dword [edi],[esi] + sub esi,32 + jmp copy_labels + labels_table_ok: + mov edi,[current_offset] + cmp [output_format],4 + je coff_formatter + cmp [output_format],5 + jne common_formatter + bt [format_flags],0 + jnc elf_formatter + common_formatter: + mov eax,edi + sub eax,[code_start] + mov [real_code_size],eax + cmp edi,[undefined_data_end] + jne calculate_code_size + mov edi,[undefined_data_start] + calculate_code_size: + mov [current_offset],edi + sub edi,[code_start] + mov [code_size],edi + and [written_size],0 + mov edx,[output_file] + call create + jc write_failed + cmp [output_format],3 + jne stub_written + mov edx,[code_start] + mov ecx,[stub_size] + sub edx,ecx + add [written_size],ecx + call write + stub_written: + cmp [output_format],2 + jne write_output + call write_mz_header + write_output: + call write_code + output_written: + call close + cmp [symbols_file],0 + jne dump_symbols + ret + write_code: + mov eax,[written_size] + mov [headers_size],eax + mov edx,[code_start] + mov ecx,[code_size] + add [written_size],ecx + lea eax,[edx+ecx] + call write + jc write_failed + ret +format_directive: + cmp edi,[code_start] + jne unexpected_instruction + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jnz unexpected_instruction + cmp [output_format],0 + jne unexpected_instruction + lods byte [esi] + cmp al,1Ch + je format_prefix + cmp al,18h + jne invalid_argument + lods byte [esi] + select_format: + mov dl,al + shr al,4 + mov [output_format],al + and edx,0Fh + or [format_flags],edx + cmp al,2 + je format_mz + cmp al,3 + je format_pe + cmp al,4 + je format_coff + cmp al,5 + je format_elf + format_defined: + cmp byte [esi],86h + jne instruction_assembled + cmp word [esi+1],'(' + jne invalid_argument + mov eax,[esi+3] + add esi,3+4 + mov [file_extension],esi + lea esi,[esi+eax+1] + jmp instruction_assembled + format_prefix: + lods byte [esi] + mov ah,al + lods byte [esi] + cmp al,18h + jne invalid_argument + lods byte [esi] + mov edx,eax + shr dl,4 + shr dh,4 + cmp dl,dh + jne invalid_argument + or al,ah + jmp select_format +entry_directive: + bts [format_flags],10h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_entry + cmp al,3 + je pe_entry + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc elf_entry + jmp illegal_instruction +stack_directive: + bts [format_flags],11h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_stack + cmp al,3 + je pe_stack + jmp illegal_instruction +heap_directive: + bts [format_flags],12h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_heap + cmp al,3 + je pe_heap + jmp illegal_instruction +segment_directive: + mov al,[output_format] + cmp al,2 + je mz_segment + cmp al,5 + je elf_segment + jmp illegal_instruction +section_directive: + mov al,[output_format] + cmp al,3 + je pe_section + cmp al,4 + je coff_section + cmp al,5 + je elf_section + jmp illegal_instruction +public_directive: + mov al,[output_format] + cmp al,4 + je public_allowed + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc illegal_instruction + public_allowed: + mov [base_code],0C0h + lods byte [esi] + cmp al,2 + je public_label + cmp al,1Dh + jne invalid_argument + lods byte [esi] + and al,7 + add [base_code],al + lods byte [esi] + cmp al,2 + jne invalid_argument + public_label: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov dx,[current_pass] + mov [eax+18],dx + or byte [eax+8],8 + mov ebx,eax + call store_label_reference + mov eax,ebx + mov ebx,[free_additional_memory] + lea edx,[ebx+10h] + cmp edx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],edx + mov [ebx+8],eax + mov eax,[current_line] + mov [ebx+0Ch],eax + lods byte [esi] + cmp al,86h + jne invalid_argument + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + lods dword [esi] + lea esi,[esi+eax+1] + mov al,[base_code] + mov [ebx],al + jmp instruction_assembled +extrn_directive: + mov al,[output_format] + cmp al,4 + je extrn_allowed + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc illegal_instruction + extrn_allowed: + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov ebx,esi + lods dword [esi] + lea esi,[esi+eax+1] + mov edx,[free_additional_memory] + lea eax,[edx+0Ch] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov byte [edx],80h + mov [edx+4],ebx + lods byte [esi] + cmp al,86h + jne invalid_argument + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + xor ah,ah + lods byte [esi] + cmp al,':' + je get_extrn_size + dec esi + cmp al,11h + jne extrn_size_ok + get_extrn_size: + lods word [esi] + cmp al,11h + jne invalid_argument + extrn_size_ok: + mov [address_symbol],edx + mov [label_size],ah + movzx ecx,ah + mov [edx+8],ecx + xor eax,eax + xor edx,edx + xor ebp,ebp + mov [address_sign],0 + mov ch,2 + test [format_flags],8 + jz make_free_label + mov ch,4 + jmp make_free_label +mark_relocation: + cmp [value_type],0 + je relocation_ok + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jnz relocation_ok + cmp [output_format],2 + je mark_mz_relocation + cmp [output_format],3 + je mark_pe_relocation + cmp [output_format],4 + je mark_coff_relocation + cmp [output_format],5 + je mark_elf_relocation + relocation_ok: + ret +close_pass: + mov al,[output_format] + cmp al,3 + je close_pe + cmp al,4 + je close_coff + cmp al,5 + je close_elf + ret + +format_mz: + mov edx,[additional_memory] + push edi + mov edi,edx + mov ecx,1Ch shr 2 + xor eax,eax + rep stos dword [edi] + mov [free_additional_memory],edi + pop edi + mov word [edx+0Ch],0FFFFh + mov word [edx+10h],1000h + mov [code_type],16 + jmp format_defined +mark_mz_relocation: + push eax ebx + inc word [number_of_relocations] + jz format_limitations_exceeded + mov ebx,[free_additional_memory] + mov eax,edi + sub eax,[code_start] + mov [ebx],ax + shr eax,16 + shl ax,12 + mov [ebx+2],ax + cmp word [ebx],0FFFFh + jne mz_relocation_ok + inc word [ebx+2] + sub word [ebx],10h + mz_relocation_ok: + add ebx,4 + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + pop ebx eax + ret +mz_segment: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + mov eax,edi + sub eax,[code_start] + mov ecx,0Fh + add eax,0Fh + and eax,1111b + sub ecx,eax + mov edx,edi + xor eax,eax + rep stos byte [edi] + mov eax,edx + call undefined_data + push ebx + call create_addressing_space + pop ebx + mov eax,edi + sub eax,[code_start] + shr eax,4 + cmp eax,10000h + jae value_out_of_range + mov edx,eax + mov al,16 + cmp byte [esi],13h + jne segment_type_ok + inc esi + lods byte [esi] + segment_type_ok: + mov [code_type],al + mov eax,edx + mov ch,1 + mov [address_sign],0 + xor edx,edx + xor ebp,ebp + mov [label_size],0 + mov [address_symbol],edx + jmp make_free_label +mz_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],1 + je initial_cs_ok + call recoverable_invalid_address + initial_cs_ok: + mov edx,[additional_memory] + mov [edx+16h],ax + lods byte [esi] + cmp al,':' + jne invalid_argument + lods byte [esi] + cmp al,'(' + jne invalid_argument + ja invalid_address + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+14h],ax + jmp instruction_assembled + recoverable_invalid_address: + cmp [error_line],0 + jne ignore_invalid_address + push [current_line] + pop [error_line] + mov [error],invalid_address + ignore_invalid_address: + ret +mz_stack: + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp byte [esi],':' + je stack_pointer + cmp ax,10h + jb invalid_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+10h],ax + jmp instruction_assembled + stack_pointer: + cmp [value_type],1 + je initial_ss_ok + call recoverable_invalid_address + initial_ss_ok: + mov edx,[additional_memory] + mov [edx+0Eh],ax + lods byte [esi] + cmp al,':' + jne invalid_argument + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+10h],ax + bts [format_flags],4 + jmp instruction_assembled +mz_heap: + cmp [output_format],2 + jne illegal_instruction + lods byte [esi] + call get_size_operator + cmp ah,1 + je invalid_value + cmp ah,2 + ja invalid_value + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+0Ch],ax + jmp instruction_assembled +write_mz_header: + mov edx,[additional_memory] + bt [format_flags],4 + jc mz_stack_ok + mov eax,[real_code_size] + dec eax + shr eax,4 + inc eax + mov [edx+0Eh],ax + shl eax,4 + movzx ecx,word [edx+10h] + add eax,ecx + mov [real_code_size],eax + mz_stack_ok: + mov edi,[free_additional_memory] + mov eax,[number_of_relocations] + shl eax,2 + add eax,1Ch + sub edi,eax + xchg edi,[free_additional_memory] + mov ecx,0Fh + add eax,0Fh + and eax,1111b + sub ecx,eax + xor al,al + rep stos byte [edi] + sub edi,[free_additional_memory] + mov ecx,edi + shr edi,4 + mov word [edx],'MZ' ; signature + mov [edx+8],di ; header size in paragraphs + mov eax,[number_of_relocations] + mov [edx+6],ax ; number of relocation entries + mov eax,[code_size] + add eax,ecx + mov esi,eax + shr esi,9 + and eax,1FFh + inc si + or ax,ax + jnz mz_size_ok + dec si + mz_size_ok: + mov [edx+2],ax ; number of bytes in last page + mov [edx+4],si ; number of pages + mov eax,[real_code_size] + dec eax + shr eax,4 + inc eax + mov esi,[code_size] + dec esi + shr esi,4 + inc esi + sub eax,esi + mov [edx+0Ah],ax ; minimum memory in addition to code + add [edx+0Ch],ax ; maximum memory in addition to code + salc + mov ah,al + or [edx+0Ch],ax + mov word [edx+18h],1Ch ; offset of relocation table + add [written_size],ecx + call write + jc write_failed + ret + +make_stub: + mov [stub_file],edx + or edx,edx + jnz stub_from_file + push esi + mov edx,edi + xor eax,eax + mov ecx,20h + rep stos dword [edi] + mov eax,40h+default_stub_end-default_stub + mov cx,100h+default_stub_end-default_stub + mov word [edx],'MZ' + mov byte [edx+4],1 + mov word [edx+2],ax + mov byte [edx+8],4 + mov byte [edx+0Ah],10h + mov word [edx+0Ch],0FFFFh + mov word [edx+10h],cx + mov word [edx+3Ch],ax + mov byte [edx+18h],40h + lea edi,[edx+40h] + mov esi,default_stub + mov ecx,default_stub_end-default_stub + rep movs byte [edi],[esi] + pop esi + jmp stub_ok + default_stub: + use16 + push cs + pop ds + mov dx,stub_message-default_stub + mov ah,9 + int 21h + mov ax,4C01h + int 21h + stub_message db 'This program cannot be run in DOS mode.',0Dh,0Ah,24h + rq 1 + default_stub_end: + use32 + stub_from_file: + push esi + mov esi,edx + call open_binary_file + mov edx,edi + mov ecx,1Ch + mov esi,edx + call read + jc binary_stub + cmp word [esi],'MZ' + jne binary_stub + add edi,1Ch + movzx ecx,word [esi+6] + add ecx,11b + and ecx,not 11b + add ecx,(40h-1Ch) shr 2 + lea eax,[edi+ecx*4] + cmp edi,[tagged_blocks] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov edx,40h + xchg dx,[esi+18h] + xor al,al + call lseek + movzx ecx,word [esi+6] + shl ecx,2 + lea edx,[esi+40h] + call read + mov edx,edi + sub edx,esi + shr edx,4 + xchg dx,[esi+8] + shl edx,4 + xor al,al + call lseek + movzx ecx,word [esi+4] + dec ecx + shl ecx,9 + movzx edx,word [esi+2] + test edx,edx + jnz stub_header_size_ok + mov dx,200h + stub_header_size_ok: + add ecx,edx + mov edx,edi + sub ecx,eax + je read_stub_code + jb stub_code_ok + push ecx + dec ecx + shr ecx,3 + inc ecx + shl ecx,1 + lea eax,[edi+ecx*4] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + pop ecx + read_stub_code: + call read + stub_code_ok: + call close + mov edx,edi + sub edx,esi + mov ax,dx + and ax,1FFh + mov [esi+2],ax + dec edx + shr edx,9 + inc edx + mov [esi+4],dx + mov eax,edi + sub eax,esi + mov [esi+3Ch],eax + pop esi + stub_ok: + ret + binary_stub: + mov esi,edi + mov ecx,40h shr 2 + xor eax,eax + rep stos dword [edi] + mov al,2 + xor edx,edx + call lseek + push eax + xor al,al + xor edx,edx + call lseek + mov ecx,[esp] + add ecx,40h+111b + and ecx,not 111b + mov ax,cx + and ax,1FFh + mov [esi+2],ax + lea eax,[ecx+1FFh] + shr eax,9 + mov [esi+4],ax + mov [esi+3Ch],ecx + sub ecx,40h + mov eax,10000h + sub eax,ecx + jbe binary_heap_ok + shr eax,4 + mov [esi+0Ah],ax + binary_heap_ok: + mov word [esi],'MZ' + mov byte [esi+8],4 + mov ax,0FFFFh + mov [esi+0Ch],ax + dec ax + mov [esi+10h],ax + sub ax,0Eh + mov [esi+0Eh],ax + mov [esi+16h],ax + mov word [esi+14h],100h + mov byte [esi+18h],40h + mov eax,[tagged_blocks] + sub eax,ecx + cmp edi,eax + jae out_of_memory + mov edx,edi + shr ecx,2 + xor eax,eax + rep stos dword [edi] + pop ecx + call read + call close + pop esi + ret + +format_pe: + xor edx,edx + mov [machine],14Ch + mov [subsystem],3 + mov [subsystem_version],3 + 10 shl 16 + mov [image_base],400000h + and [image_base_high],0 + test [format_flags],8 + jz pe_settings + mov [machine],8664h + mov [subsystem_version],5 + 0 shl 16 + pe_settings: + cmp byte [esi],84h + je get_stub_name + cmp byte [esi],80h + je get_pe_base + cmp byte [esi],1Bh + jne pe_settings_ok + lods byte [esi] + lods byte [esi] + test al,80h+40h + jz subsystem_setting + cmp al,80h + je dll_flag + cmp al,81h + je wdm_flag + cmp al,82h + je large_flag + cmp al,83h + je nx_flag + jmp pe_settings + dll_flag: + bts [format_flags],8 + jc setting_already_specified + jmp pe_settings + wdm_flag: + bts [format_flags],9 + jc setting_already_specified + jmp pe_settings + large_flag: + bts [format_flags],11 + jc setting_already_specified + test [format_flags],8 + jnz invalid_argument + jmp pe_settings + nx_flag: + bts [format_flags],12 + jc setting_already_specified + jmp pe_settings + subsystem_setting: + bts [format_flags],7 + jc setting_already_specified + and ax,3Fh + mov [subsystem],ax + cmp ax,10 + jb subsystem_type_ok + or [format_flags],4 + subsystem_type_ok: + cmp byte [esi],'(' + jne pe_settings + inc esi + cmp byte [esi],'.' + jne invalid_value + inc esi + push edx + cmp byte [esi+11],0 + jne invalid_value + cmp byte [esi+10],2 + ja invalid_value + mov dx,[esi+8] + cmp dx,8000h + je zero_version + mov eax,[esi+4] + cmp dx,7 + jg invalid_value + mov cx,7 + sub cx,dx + mov eax,[esi+4] + shr eax,cl + mov ebx,eax + shr ebx,24 + cmp bl,100 + jae invalid_value + and eax,0FFFFFFh + mov ecx,100 + mul ecx + shrd eax,edx,24 + jnc version_value_ok + inc eax + version_value_ok: + shl eax,16 + mov ax,bx + jmp subsystem_version_ok + zero_version: + xor eax,eax + subsystem_version_ok: + pop edx + add esi,13 + mov [subsystem_version],eax + jmp pe_settings + get_pe_base: + bts [format_flags],10 + jc setting_already_specified + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx edi + add edi,[stub_size] + test [format_flags],4 + jnz get_peplus_base + call get_dword_value + mov [image_base],eax + jmp pe_base_ok + get_peplus_base: + call get_qword_value + mov [image_base],eax + mov [image_base_high],edx + pe_base_ok: + pop edi edx + cmp [value_type],0 + jne invalid_use_of_symbol + cmp byte [esi],84h + jne pe_settings_ok + get_stub_name: + lods byte [esi] + lods word [esi] + cmp ax,'(' + jne invalid_argument + lods dword [esi] + mov edx,esi + add esi,eax + inc esi + pe_settings_ok: + mov ebp,[stub_size] + or ebp,ebp + jz make_pe_stub + cmp edx,[stub_file] + je pe_stub_ok + sub edi,[stub_size] + mov [code_start],edi + make_pe_stub: + call make_stub + mov eax,edi + sub eax,[code_start] + mov [stub_size],eax + mov [code_start],edi + mov ebp,eax + pe_stub_ok: + mov edx,edi + mov ecx,18h+0E0h + test [format_flags],4 + jz zero_pe_header + add ecx,10h + zero_pe_header: + add ebp,ecx + shr ecx,2 + xor eax,eax + rep stos dword [edi] + mov word [edx],'PE' ; signature + mov ax,[machine] + mov word [edx+4],ax + mov byte [edx+38h+1],10h ; section alignment + mov byte [edx+3Ch+1],2 ; file alignment + mov byte [edx+40h],1 ; OS version + mov eax,[subsystem_version] + mov [edx+48h],eax + mov ax,[subsystem] + mov [edx+5Ch],ax + cmp ax,1 + jne pe_alignment_ok + mov eax,20h + mov dword [edx+38h],eax + mov dword [edx+3Ch],eax + pe_alignment_ok: + mov word [edx+1Ah],VERSION_MAJOR + VERSION_MINOR shl 8 + test [format_flags],4 + jnz init_peplus_specific + mov byte [edx+14h],0E0h ; size of optional header + mov dword [edx+16h],10B010Fh; flags and magic value + mov eax,[image_base] + mov [edx+34h],eax + mov byte [edx+60h+1],10h ; stack reserve + mov byte [edx+64h+1],10h ; stack commit + mov byte [edx+68h+2],1 ; heap reserve + mov byte [edx+74h],16 ; number of directories + jmp pe_header_ok + init_peplus_specific: + mov byte [edx+14h],0F0h ; size of optional header + mov dword [edx+16h],20B002Fh; flags and magic value + mov eax,[image_base] + mov [edx+30h],eax + mov eax,[image_base_high] + mov [edx+34h],eax + mov byte [edx+60h+1],10h ; stack reserve + mov byte [edx+68h+1],10h ; stack commit + mov byte [edx+70h+2],1 ; heap reserve + mov byte [edx+84h],16 ; number of directories + pe_header_ok: + bsf ecx,[edx+3Ch] + imul ebx,[number_of_sections],28h + or ebx,ebx + jnz reserve_space_for_section_headers + mov ebx,28h + reserve_space_for_section_headers: + add ebx,ebp + dec ebx + shr ebx,cl + inc ebx + shl ebx,cl + sub ebx,ebp + mov ecx,ebx + mov eax,[tagged_blocks] + sub eax,ecx + cmp edi,eax + jae out_of_memory + shr ecx,2 + xor eax,eax + rep stos dword [edi] + mov eax,edi + sub eax,[code_start] + add eax,[stub_size] + mov [edx+54h],eax ; size of headers + mov ecx,[edx+38h] + dec ecx + add eax,ecx + not ecx + and eax,ecx + bt [format_flags],8 + jc pe_entry_init_ok + mov [edx+28h],eax ; entry point rva + pe_entry_init_ok: + and [number_of_sections],0 + movzx ebx,word [edx+14h] + lea ebx,[edx+18h+ebx] + mov [current_section],ebx + mov dword [ebx],'.fla' + mov dword [ebx+4],'t' + mov [ebx+14h],edi + mov [ebx+0Ch],eax + mov dword [ebx+24h],0E0000060h + xor ecx,ecx + xor bl,bl + not eax + not ecx + not bl + add eax,1 + adc ecx,0 + adc bl,0 + add eax,edi + adc ecx,0 + adc bl,0 + test [format_flags],4 + jnz peplus_org + sub eax,[edx+34h] + sbb ecx,0 + sbb bl,0 + jmp pe_org_ok + peplus_org: + sub eax,[edx+30h] + sbb ecx,[edx+34h] + sbb bl,0 + pe_org_ok: + test [format_flags],8 + jnz pe64_code + mov bh,2 + mov [code_type],32 + jmp pe_code_type_ok + pe64_code: + mov bh,4 + mov [code_type],64 + pe_code_type_ok: + bt [resolver_flags],0 + jc pe_labels_type_ok + xor bh,bh + pe_labels_type_ok: + push eax ebx + call init_addressing_space + mov ebp,ebx + pop ebx eax + mov [ds:ebp],eax + mov [ds:ebp+4],ecx + mov [ds:ebp+8],bx + mov [ds:ebp+18h],edi + bt [format_flags],8 + jnc dll_flag_ok + or byte [edx+16h+1],20h + dll_flag_ok: + bt [format_flags],9 + jnc wdm_flag_ok + or byte [edx+5Eh+1],20h + wdm_flag_ok: + bt [format_flags],11 + jnc large_flag_ok + or byte [edx+16h],20h + large_flag_ok: + bt [format_flags],12 + jnc nx_ok + or byte [edx+5Eh+1],1 + nx_ok: + jmp format_defined +pe_section: + call close_pe_section + push eax ebx + call create_addressing_space + mov ebp,ebx + pop ebx eax + bts [format_flags],5 + lea ecx,[ebx+28h] + add edx,[edx+54h] + sub edx,[stub_size] + cmp ecx,edx + jbe new_section + lea ebx,[edx-28h] + or [next_pass_needed],-1 + push edi + mov edi,ebx + mov ecx,28h shr 4 + xor eax,eax + rep stos dword [edi] + pop edi + new_section: + mov [ebx+0Ch],eax + lods word [esi] + cmp ax,'(' + jne invalid_argument + lea edx,[esi+4] + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + cmp ecx,8 + ja name_too_long + xor eax,eax + mov [ebx],eax + mov [ebx+4],eax + push esi edi + mov edi,ebx + mov esi,edx + rep movs byte [edi],[esi] + pop edi esi + and dword [ebx+24h],0 + mov [ebx+14h],edi + mov edx,[code_start] + mov eax,edi + xor ecx,ecx + sub eax,[ebx+0Ch] + sbb ecx,0 + sbb byte [ds:ebp+8],0 + mov byte [ds:ebp+9],2 + mov [code_type],32 + test [format_flags],8 + jz pe_section_code_type_ok + mov byte [ds:ebp+9],4 + mov [code_type],64 + pe_section_code_type_ok: + test [format_flags],4 + jnz peplus_section_org + sub eax,[edx+34h] + sbb ecx,0 + sbb byte [ds:ebp+8],0 + bt [resolver_flags],0 + jc pe_section_org_ok + mov byte [ds:ebp+9],0 + jmp pe_section_org_ok + peplus_section_org: + sub eax,[edx+30h] + sbb ecx,[edx+34h] + sbb byte [ds:ebp+8],0 + bt [resolver_flags],0 + jc pe_section_org_ok + mov byte [ds:ebp+9],0 + pe_section_org_ok: + mov [ds:ebp],eax + mov [ds:ebp+4],ecx + mov [ds:ebp+18h],edi + get_section_flags: + lods byte [esi] + cmp al,1Ah + je set_directory + cmp al,19h + je section_flag + dec esi + jmp instruction_assembled + set_directory: + movzx eax,byte [esi] + inc esi + mov ecx,ebx + test [format_flags],4 + jnz peplus_directory + xchg ecx,[edx+78h+eax*8] + mov dword [edx+78h+eax*8+4],-1 + jmp pe_directory_set + peplus_directory: + xchg ecx,[edx+88h+eax*8] + mov dword [edx+88h+eax*8+4],-1 + pe_directory_set: + or ecx,ecx + jnz data_already_defined + push ebx edx + call generate_pe_data + pop edx ebx + jmp get_section_flags + section_flag: + lods byte [esi] + cmp al,9 + je invalid_argument + cmp al,11 + je invalid_argument + mov cl,al + mov eax,1 + shl eax,cl + test dword [ebx+24h],eax + jnz setting_already_specified + or dword [ebx+24h],eax + jmp get_section_flags + close_pe_section: + mov ebx,[current_section] + mov edx,[code_start] + mov eax,edi + sub eax,[ebx+14h] + jnz finish_section + bt [format_flags],5 + jc finish_section + mov eax,[ebx+0Ch] + ret + finish_section: + mov [ebx+8],eax + cmp edi,[undefined_data_end] + jne align_section + cmp dword [edx+38h],1000h + jb align_section + mov edi,[undefined_data_start] + align_section: + and [undefined_data_end],0 + mov ebp,edi + sub ebp,[ebx+14h] + mov ecx,[edx+3Ch] + dec ecx + lea eax,[ebp+ecx] + not ecx + and eax,ecx + mov [ebx+10h],eax + sub eax,ebp + mov ecx,eax + xor al,al + rep stos byte [edi] + mov eax,[code_start] + sub eax,[stub_size] + sub [ebx+14h],eax + mov ecx,[ebx+10h] + test byte [ebx+24h],20h + jz pe_code_sum_ok + add [edx+1Ch],ecx + cmp dword [edx+2Ch],0 + jne pe_code_sum_ok + mov eax,[ebx+0Ch] + mov [edx+2Ch],eax + pe_code_sum_ok: + test byte [ebx+24h],40h + jz pe_data_sum_ok + add [edx+20h],ecx + test [format_flags],4 + jnz pe_data_sum_ok + cmp dword [edx+30h],0 + jne pe_data_sum_ok + mov eax,[ebx+0Ch] + mov [edx+30h],eax + pe_data_sum_ok: + mov eax,[ebx+8] + or eax,eax + jz udata_ok + cmp dword [ebx+10h],0 + jne udata_ok + or byte [ebx+24h],80h + add [edx+24h],ecx + udata_ok: + mov ecx,[edx+38h] + dec ecx + add eax,ecx + not ecx + and eax,ecx + add eax,[ebx+0Ch] + add ebx,28h + mov [current_section],ebx + inc word [number_of_sections] + jz format_limitations_exceeded + ret +data_directive: + cmp [output_format],3 + jne illegal_instruction + lods byte [esi] + cmp al,1Ah + je predefined_data_type + cmp al,'(' + jne invalid_argument + call get_byte_value + cmp al,16 + jb data_type_ok + jmp invalid_value + predefined_data_type: + movzx eax,byte [esi] + inc esi + data_type_ok: + mov ebx,[current_section] + mov ecx,edi + sub ecx,[ebx+14h] + add ecx,[ebx+0Ch] + mov edx,[code_start] + test [format_flags],4 + jnz peplus_data + xchg ecx,[edx+78h+eax*8] + jmp init_pe_data + peplus_data: + xchg ecx,[edx+88h+eax*8] + init_pe_data: + or ecx,ecx + jnz data_already_defined + call allocate_structure_data + mov word [ebx],data_directive-instruction_handler + mov [ebx+2],al + mov edx,[current_line] + mov [ebx+4],edx + call generate_pe_data + jmp instruction_assembled + end_data: + cmp [output_format],3 + jne illegal_instruction + call find_structure_data + jc unexpected_instruction + movzx eax,byte [ebx+2] + mov edx,[current_section] + mov ecx,edi + sub ecx,[edx+14h] + add ecx,[edx+0Ch] + mov edx,[code_start] + test [format_flags],4 + jnz end_peplus_data + sub ecx,[edx+78h+eax*8] + mov [edx+78h+eax*8+4],ecx + jmp remove_structure_data + end_peplus_data: + sub ecx,[edx+88h+eax*8] + mov [edx+88h+eax*8+4],ecx + jmp remove_structure_data +pe_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],8 + jnz pe64_entry + call get_dword_value + mov bl,2 + bt [resolver_flags],0 + jc check_pe_entry_label_type + xor bl,bl + check_pe_entry_label_type: + cmp [value_type],bl + je pe_entry_ok + call recoverable_invalid_address + pe_entry_ok: + cdq + test [format_flags],4 + jnz pe64_entry_type_ok + mov edx,[code_start] + sub eax,[edx+34h] + mov [edx+28h],eax + jmp instruction_assembled + pe64_entry: + call get_qword_value + mov bl,4 + bt [resolver_flags],0 + jc check_pe64_entry_label_type + xor bl,bl + check_pe64_entry_label_type: + cmp [value_type],bl + je pe64_entry_type_ok + call recoverable_invalid_address + pe64_entry_type_ok: + mov ecx,[code_start] + sub eax,[ecx+30h] + sbb edx,[ecx+34h] + jz pe64_entry_range_ok + call recoverable_overflow + pe64_entry_range_ok: + mov [ecx+28h],eax + jmp instruction_assembled +pe_stack: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],4 + jnz peplus_stack + call get_count_value + mov edx,[code_start] + mov [edx+60h],eax + cmp byte [esi],',' + jne default_stack_commit + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov edx,[code_start] + mov [edx+64h],eax + cmp eax,[edx+60h] + ja value_out_of_range + jmp instruction_assembled + default_stack_commit: + mov dword [edx+64h],1000h + mov eax,[edx+60h] + cmp eax,1000h + ja instruction_assembled + mov dword [edx+64h],eax + jmp instruction_assembled + peplus_stack: + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+60h],eax + mov [ecx+64h],edx + cmp byte [esi],',' + jne default_peplus_stack_commit + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+68h],eax + mov [ecx+6Ch],edx + cmp edx,[ecx+64h] + ja value_out_of_range + jb instruction_assembled + cmp eax,[ecx+60h] + ja value_out_of_range + jmp instruction_assembled + default_peplus_stack_commit: + mov dword [ecx+68h],1000h + cmp dword [ecx+64h],0 + jne instruction_assembled + mov eax,[ecx+60h] + cmp eax,1000h + ja instruction_assembled + mov dword [ecx+68h],eax + jmp instruction_assembled +pe_heap: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],4 + jnz peplus_heap + call get_count_value + mov edx,[code_start] + mov [edx+68h],eax + cmp byte [esi],',' + jne instruction_assembled + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov edx,[code_start] + mov [edx+6Ch],eax + cmp eax,[edx+68h] + ja value_out_of_range + jmp instruction_assembled + peplus_heap: + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+70h],eax + mov [ecx+74h],edx + cmp byte [esi],',' + jne instruction_assembled + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+78h],eax + mov [ecx+7Ch],edx + cmp edx,[ecx+74h] + ja value_out_of_range + jb instruction_assembled + cmp eax,[ecx+70h] + ja value_out_of_range + jmp instruction_assembled +mark_pe_relocation: + push eax ebx + test [format_flags],4 + jz check_standard_pe_relocation_type + cmp [value_type],4 + je pe_relocation_type_ok + check_standard_pe_relocation_type: + cmp [value_type],2 + je pe_relocation_type_ok + call recoverable_misuse + pe_relocation_type_ok: + mov ebx,[current_section] + mov eax,edi + sub eax,[ebx+14h] + add eax,[ebx+0Ch] + mov ebx,[free_additional_memory] + inc [number_of_relocations] + add ebx,5 + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + mov [ebx-5],eax + cmp [value_type],2 + je fixup_32bit + mov byte [ebx-1],0Ah + jmp fixup_ok + fixup_32bit: + mov byte [ebx-1],3 + fixup_ok: + pop ebx eax + ret +generate_pe_data: + cmp al,2 + je make_pe_resource + cmp al,5 + je make_pe_fixups + ret +make_pe_fixups: + mov edx,[code_start] + and byte [edx+16h],not 1 + or byte [edx+5Eh],40h + bts [resolver_flags],0 + jc fixups_ready + or [next_pass_needed],-1 + fixups_ready: + and [last_fixup_base],0 + call make_fixups + xchg eax,[actual_fixups_size] + sub eax,[actual_fixups_size] + ja reserve_forward_fixups + xor eax,eax + reserve_forward_fixups: + mov [reserved_fixups],edi + add edi,eax + mov [reserved_fixups_size],eax + ret + make_fixups: + push esi + xor ecx,ecx + xchg ecx,[number_of_relocations] + mov esi,[free_additional_memory] + lea eax,[ecx*5] + sub esi,eax + mov [free_additional_memory],esi + mov edx,[last_fixup_base] + mov ebx,[last_fixup_header] + mov ebp,edi + jecxz fixups_done + make_fixup: + cmp [esi],edx + jb store_fixup + mov eax,edi + sub eax,ebp + test eax,11b + jz fixups_block + xor ax,ax + stos word [edi] + add dword [ebx],2 + fixups_block: + mov eax,edx + add edx,1000h + cmp [esi],edx + jae fixups_block + stos dword [edi] + mov ebx,edi + mov eax,8 + stos dword [edi] + store_fixup: + add dword [ebx],2 + mov ah,[esi+1] + and ah,0Fh + mov al,[esi+4] + shl al,4 + or ah,al + mov al,[esi] + stos word [edi] + add esi,5 + loop make_fixup + fixups_done: + mov [last_fixup_base],edx + mov [last_fixup_header],ebx + pop esi + mov eax,edi + sub eax,ebp + ret +make_pe_resource: + cmp byte [esi],82h + jne resource_done + inc esi + lods word [esi] + cmp ax,'(' + jne invalid_argument + lods dword [esi] + mov edx,esi + lea esi,[esi+eax+1] + cmp [next_pass_needed],0 + je resource_from_file + cmp [current_pass],0 + jne reserve_space_for_resource + and [resource_size],0 + reserve_space_for_resource: + add edi,[resource_size] + cmp edi,[tagged_blocks] + ja out_of_memory + jmp resource_done + resource_from_file: + push esi + mov esi,edx + call open_binary_file + push ebx + mov esi,[free_additional_memory] + lea eax,[esi+20h] + cmp eax,[structures_buffer] + ja out_of_memory + mov edx,esi + mov ecx,20h + call read + jc invalid_file_format + xor eax,eax + cmp [esi],eax + jne invalid_file_format + mov ax,0FFFFh + cmp [esi+8],eax + jne invalid_file_format + cmp [esi+12],eax + jne invalid_file_format + mov eax,20h + cmp [esi+4],eax + jne invalid_file_format + read_resource_headers: + test eax,11b + jz resource_file_alignment_ok + mov edx,4 + and eax,11b + sub edx,eax + mov al,1 + call lseek + jc resource_headers_ok + resource_file_alignment_ok: + mov [esi],eax + lea edx,[esi+12] + mov ecx,8 + call read + jc resource_headers_ok + mov ecx,[esi+16] + add [esi],ecx + lea edx,[esi+20] + sub ecx,8 + mov [esi+16],ecx + lea eax,[edx+ecx] + cmp eax,[structures_buffer] + ja out_of_memory + call read + jc invalid_file_format + mov edx,[esi] + add edx,[esi+12] + mov eax,[esi+16] + lea ecx,[esi+20] + lea esi,[ecx+eax] + add ecx,2 + cmp word [ecx-2],0FFFFh + je resource_header_type_ok + check_resource_header_type: + cmp ecx,esi + jae invalid_file_format + cmp word [ecx],0 + je resource_header_type_ok + add ecx,2 + jmp check_resource_header_type + resource_header_type_ok: + add ecx,2 + cmp word [ecx],0FFFFh + je resource_header_name_ok + check_resource_header_name: + cmp ecx,esi + jae invalid_file_format + cmp word [ecx],0 + je resource_header_name_ok + add ecx,2 + jmp check_resource_header_name + resource_header_name_ok: + xor al,al + call lseek + jnc read_resource_headers + resource_headers_ok: + cmp esi,[free_additional_memory] + je invalid_file_format + xor eax,eax + mov [esi],eax + mov [resource_data],edi + lea eax,[edi+16] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + xor ebx,ebx + make_type_name_directory: + mov esi,[free_additional_memory] + xor edx,edx + find_type_name: + cmp dword [esi],0 + je type_name_ok + add esi,20 + cmp word [esi],0FFFFh + je check_next_type_name + or ebx,ebx + jz check_this_type_name + xor ecx,ecx + compare_with_previous_type_name: + mov ax,[esi+ecx] + cmp ax,[ebx+ecx] + ja check_this_type_name + jb check_next_type_name + add ecx,2 + mov ax,[esi+ecx] + or ax,[ebx+ecx] + jnz compare_with_previous_type_name + jmp check_next_type_name + check_this_type_name: + or edx,edx + jz type_name_found + xor ecx,ecx + compare_with_current_type_name: + mov ax,[esi+ecx] + cmp ax,[edx+ecx] + ja check_next_type_name + jb type_name_found + add ecx,2 + mov ax,[esi+ecx] + or ax,[edx+ecx] + jnz compare_with_current_type_name + jmp same_type_name + type_name_found: + mov edx,esi + same_type_name: + mov [esi-16],edi + check_next_type_name: + mov eax,[esi-4] + add esi,eax + jmp find_type_name + type_name_ok: + or edx,edx + jz type_name_directory_done + mov ebx,edx + make_type_name_entry: + mov eax,[resource_data] + inc word [eax+12] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_type_name_directory + type_name_directory_done: + mov ebx,-1 + make_type_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_type_id: + cmp dword [esi],0 + je type_id_ok + add esi,20 + cmp word [esi],0FFFFh + jne check_next_type_id + movzx eax,word [esi+2] + cmp eax,ebx + jle check_next_type_id + cmp eax,edx + jg check_next_type_id + mov edx,eax + mov [esi-16],edi + check_next_type_id: + mov eax,[esi-4] + add esi,eax + jmp find_type_id + type_id_ok: + cmp edx,10000h + je type_id_directory_done + mov ebx,edx + make_type_id_entry: + mov eax,[resource_data] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_type_id_directory + type_id_directory_done: + mov esi,[resource_data] + add esi,10h + mov ecx,[esi-4] + or cx,cx + jz resource_directories_ok + make_resource_directories: + push ecx + push edi + mov edx,edi + sub edx,[resource_data] + bts edx,31 + mov [esi+4],edx + lea eax,[edi+16] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + mov ebp,esi + xor ebx,ebx + make_resource_name_directory: + mov esi,[free_additional_memory] + xor edx,edx + find_resource_name: + cmp dword [esi],0 + je resource_name_ok + push esi + cmp [esi+4],ebp + jne check_next_resource_name + add esi,20 + call skip_resource_name + cmp word [esi],0FFFFh + je check_next_resource_name + or ebx,ebx + jz check_this_resource_name + xor ecx,ecx + compare_with_previous_resource_name: + mov ax,[esi+ecx] + cmp ax,[ebx+ecx] + ja check_this_resource_name + jb check_next_resource_name + add ecx,2 + mov ax,[esi+ecx] + or ax,[ebx+ecx] + jnz compare_with_previous_resource_name + jmp check_next_resource_name + skip_resource_name: + cmp word [esi],0FFFFh + jne skip_unicode_string + add esi,4 + ret + skip_unicode_string: + add esi,2 + cmp word [esi-2],0 + jne skip_unicode_string + ret + check_this_resource_name: + or edx,edx + jz resource_name_found + xor ecx,ecx + compare_with_current_resource_name: + mov ax,[esi+ecx] + cmp ax,[edx+ecx] + ja check_next_resource_name + jb resource_name_found + add ecx,2 + mov ax,[esi+ecx] + or ax,[edx+ecx] + jnz compare_with_current_resource_name + jmp same_resource_name + resource_name_found: + mov edx,esi + same_resource_name: + mov eax,[esp] + mov [eax+8],edi + check_next_resource_name: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_resource_name + resource_name_ok: + or edx,edx + jz resource_name_directory_done + mov ebx,edx + make_resource_name_entry: + mov eax,[esp] + inc word [eax+12] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_resource_name_directory + resource_name_directory_done: + mov ebx,-1 + make_resource_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_resource_id: + cmp dword [esi],0 + je resource_id_ok + push esi + cmp [esi+4],ebp + jne check_next_resource_id + add esi,20 + call skip_resource_name + cmp word [esi],0FFFFh + jne check_next_resource_id + movzx eax,word [esi+2] + cmp eax,ebx + jle check_next_resource_id + cmp eax,edx + jg check_next_resource_id + mov edx,eax + mov eax,[esp] + mov [eax+8],edi + check_next_resource_id: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_resource_id + resource_id_ok: + cmp edx,10000h + je resource_id_directory_done + mov ebx,edx + make_resource_id_entry: + mov eax,[esp] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_resource_id_directory + resource_id_directory_done: + pop eax + mov esi,ebp + pop ecx + add esi,8 + dec cx + jnz make_resource_directories + resource_directories_ok: + shr ecx,16 + jnz make_resource_directories + mov esi,[resource_data] + add esi,10h + movzx eax,word [esi-4] + movzx edx,word [esi-2] + add eax,edx + lea esi,[esi+eax*8] + push edi ; address of language directories + update_resource_directories: + cmp esi,[esp] + je resource_directories_updated + add esi,10h + mov ecx,[esi-4] + or cx,cx + jz language_directories_ok + make_language_directories: + push ecx + push edi + mov edx,edi + sub edx,[resource_data] + bts edx,31 + mov [esi+4],edx + lea eax,[edi+16] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + mov ebp,esi + mov ebx,-1 + make_language_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_language_id: + cmp dword [esi],0 + je language_id_ok + push esi + cmp [esi+8],ebp + jne check_next_language_id + add esi,20 + mov eax,esi + call skip_resource_name + call skip_resource_name + neg eax + add eax,esi + and eax,11b + add esi,eax + get_language_id: + movzx eax,word [esi+6] + cmp eax,ebx + jle check_next_language_id + cmp eax,edx + jge check_next_language_id + mov edx,eax + mov eax,[esp] + mov dword [value],eax + check_next_language_id: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_language_id + language_id_ok: + cmp edx,10000h + je language_id_directory_done + mov ebx,edx + make_language_id_entry: + mov eax,[esp] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + mov eax,dword [value] + stos dword [edi] + jmp make_language_id_directory + language_id_directory_done: + pop eax + mov esi,ebp + pop ecx + add esi,8 + dec cx + jnz make_language_directories + language_directories_ok: + shr ecx,16 + jnz make_language_directories + jmp update_resource_directories + resource_directories_updated: + mov esi,[resource_data] + push edi + make_name_strings: + add esi,10h + movzx eax,word [esi-2] + movzx ecx,word [esi-4] + add eax,ecx + lea eax,[esi+eax*8] + push eax + or ecx,ecx + jz string_entries_processed + process_string_entries: + push ecx + mov edx,edi + sub edx,[resource_data] + bts edx,31 + xchg [esi],edx + mov ebx,edi + xor ax,ax + stos word [edi] + copy_string_data: + lea eax,[edi+2] + cmp eax,[tagged_blocks] + jae out_of_memory + mov ax,[edx] + or ax,ax + jz string_data_copied + stos word [edi] + inc word [ebx] + add edx,2 + jmp copy_string_data + string_data_copied: + add esi,8 + pop ecx + loop process_string_entries + string_entries_processed: + pop esi + cmp esi,[esp] + jb make_name_strings + mov eax,edi + sub eax,[resource_data] + test al,11b + jz resource_strings_alignment_ok + xor ax,ax + stos word [edi] + resource_strings_alignment_ok: + pop edx + pop ebx ; address of language directories + mov ebp,edi + update_language_directories: + add ebx,10h + movzx eax,word [ebx-2] + movzx ecx,word [ebx-4] + add ecx,eax + make_data_records: + push ecx + mov esi,edi + sub esi,[resource_data] + xchg esi,[ebx+4] + lea eax,[edi+16] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,esi + stos dword [edi] + mov eax,[esi+12] + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + pop ecx + add ebx,8 + loop make_data_records + cmp ebx,edx + jb update_language_directories + pop ebx ; file handle + mov esi,ebp + mov ebp,edi + update_data_records: + push ebp + mov ecx,edi + mov eax,[current_section] + sub ecx,[eax+14h] + add ecx,[eax+0Ch] + xchg ecx,[esi] + mov edx,[ecx] + xor al,al + call lseek + mov edx,edi + mov ecx,[esi+4] + add edi,ecx + cmp edi,[tagged_blocks] + ja out_of_memory + call read + mov eax,edi + sub eax,[resource_data] + and eax,11b + jz resource_data_alignment_ok + mov ecx,4 + sub ecx,eax + xor al,al + rep stos byte [edi] + resource_data_alignment_ok: + pop ebp + add esi,16 + cmp esi,ebp + jb update_data_records + pop esi + call close + mov eax,edi + sub eax,[resource_data] + mov [resource_size],eax + resource_done: + ret +close_pe: + call close_pe_section + mov edx,[code_start] + mov [edx+50h],eax + call make_timestamp + mov edx,[code_start] + mov [edx+8],eax + mov eax,[number_of_sections] + mov [edx+6],ax + imul eax,28h + movzx ecx,word [edx+14h] + lea eax,[eax+18h+ecx] + add eax,[stub_size] + mov ecx,[edx+3Ch] + dec ecx + add eax,ecx + not ecx + and eax,ecx + cmp eax,[edx+54h] + je pe_sections_ok + or [next_pass_needed],-1 + pe_sections_ok: + xor ecx,ecx + add edx,78h + test [format_flags],4 + jz process_directories + add edx,10h + process_directories: + mov eax,[edx+ecx*8] + or eax,eax + jz directory_ok + cmp dword [edx+ecx*8+4],-1 + jne directory_ok + section_data: + mov ebx,[edx+ecx*8] + mov eax,[ebx+0Ch] + mov [edx+ecx*8],eax ; directory rva + mov eax,[ebx+8] + mov [edx+ecx*8+4],eax ; directory size + directory_ok: + inc cl + cmp cl,10h + jb process_directories + cmp dword [edx+5*8],0 + jne finish_pe_relocations + mov eax,[number_of_relocations] + shl eax,2 + sub [free_additional_memory],eax + btr [resolver_flags],0 + jnc pe_relocations_ok + or [next_pass_needed],-1 + jmp pe_relocations_ok + finish_pe_relocations: + push edi + mov edi,[reserved_fixups] + call make_fixups + pop edi + add [actual_fixups_size],eax + cmp eax,[reserved_fixups_size] + je pe_relocations_ok + or [next_pass_needed],-1 + pe_relocations_ok: + mov ebx,[code_start] + sub ebx,[stub_size] + mov ecx,edi + sub ecx,ebx + mov ebp,ecx + shr ecx,1 + xor eax,eax + cdq + calculate_checksum: + mov dx,[ebx] + add eax,edx + mov dx,ax + shr eax,16 + add eax,edx + add ebx,2 + loop calculate_checksum + add eax,ebp + mov ebx,[code_start] + mov [ebx+58h],eax + ret + +format_coff: + mov eax,[additional_memory] + mov [symbols_stream],eax + mov ebx,eax + add eax,20h + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [ebx],al + mov [ebx+4],eax + mov [ebx+8],edi + mov al,4 + mov [ebx+10h],eax + mov al,60h + bt [format_flags],0 + jnc flat_section_flags_ok + or eax,0E0000000h + flat_section_flags_ok: + mov dword [ebx+14h],eax + mov [current_section],ebx + xor eax,eax + mov [number_of_sections],eax + mov edx,ebx + call init_addressing_space + mov [ebx+14h],edx + mov byte [ebx+9],2 + mov [code_type],32 + test [format_flags],8 + jz format_defined + mov byte [ebx+9],4 + mov [code_type],64 + jmp format_defined +coff_section: + call close_coff_section + mov ebx,[free_additional_memory] + lea eax,[ebx+20h] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov [current_section],ebx + inc [number_of_sections] + xor eax,eax + mov [ebx],al + mov [ebx+8],edi + mov [ebx+10h],eax + mov [ebx+14h],eax + mov edx,ebx + call create_addressing_space + xchg edx,ebx + mov [edx+14h],ebx + mov byte [edx+9],2 + test [format_flags],8 + jz coff_labels_type_ok + mov byte [edx+9],4 + coff_labels_type_ok: + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + cmp ecx,8 + ja name_too_long + coff_section_flags: + cmp byte [esi],8Ch + je coff_section_alignment + cmp byte [esi],19h + jne coff_section_settings_ok + inc esi + lods byte [esi] + bt [format_flags],0 + jc coff_section_flag_ok + cmp al,7 + ja invalid_argument + coff_section_flag_ok: + mov cl,al + mov eax,1 + shl eax,cl + test dword [ebx+14h],eax + jnz setting_already_specified + or dword [ebx+14h],eax + jmp coff_section_flags + coff_section_alignment: + bt [format_flags],0 + jnc invalid_argument + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push ebx + call get_count_value + pop ebx + mov edx,eax + dec edx + test eax,edx + jnz invalid_value + or eax,eax + jz invalid_value + cmp eax,2000h + ja invalid_value + bsf edx,eax + inc edx + shl edx,20 + or [ebx+14h],edx + xchg [ebx+10h],eax + or eax,eax + jnz setting_already_specified + jmp coff_section_flags + coff_section_settings_ok: + cmp dword [ebx+10h],0 + jne instruction_assembled + mov dword [ebx+10h],4 + bt [format_flags],0 + jnc instruction_assembled + or dword [ebx+14h],300000h + jmp instruction_assembled + close_coff_section: + mov ebx,[current_section] + mov eax,edi + mov edx,[ebx+8] + sub eax,edx + mov [ebx+0Ch],eax + xor eax,eax + xchg [undefined_data_end],eax + cmp eax,edi + jne coff_section_ok + cmp edx,[undefined_data_start] + jne coff_section_ok + mov edi,edx + or byte [ebx+14h],80h + coff_section_ok: + ret +mark_coff_relocation: + cmp [value_type],3 + je coff_relocation_relative + push ebx eax + test [format_flags],8 + jnz coff_64bit_relocation + mov al,6 + cmp [value_type],2 + je coff_relocation + cmp [value_type],5 + jne invalid_use_of_symbol + inc al + jmp coff_relocation + coff_64bit_relocation: + mov al,1 + cmp [value_type],4 + je coff_relocation + mov al,2 + cmp [value_type],2 + je coff_relocation + cmp [value_type],5 + jne invalid_use_of_symbol + inc al + jmp coff_relocation + coff_relocation_relative: + push ebx + bt [format_flags],0 + jnc relative_ok + mov ebx,[current_section] + mov ebx,[ebx+8] + sub ebx,edi + sub eax,ebx + add eax,4 + relative_ok: + mov ebx,[addressing_space] + push eax + mov al,20 + test [format_flags],8 + jnz relative_coff_64bit_relocation + cmp byte [ebx+9],2 + jne invalid_use_of_symbol + jmp coff_relocation + relative_coff_64bit_relocation: + mov al,4 + cmp byte [ebx+9],4 + jne invalid_use_of_symbol + coff_relocation: + mov ebx,[free_additional_memory] + add ebx,0Ch + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + mov byte [ebx-0Ch],al + mov eax,[current_section] + mov eax,[eax+8] + neg eax + add eax,edi + mov [ebx-0Ch+4],eax + mov eax,[symbol_identifier] + mov [ebx-0Ch+8],eax + pop eax ebx + ret +close_coff: + call close_coff_section + cmp [next_pass_needed],0 + je coff_closed + mov eax,[symbols_stream] + mov [free_additional_memory],eax + coff_closed: + ret +coff_formatter: + sub edi,[code_start] + mov [code_size],edi + call prepare_default_section + mov edi,[free_additional_memory] + mov ebx,edi + mov ecx,28h shr 2 + imul ecx,[number_of_sections] + add ecx,14h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[structures_buffer] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov word [ebx],14Ch + test [format_flags],8 + jz coff_magic_ok + mov word [ebx],8664h + coff_magic_ok: + mov word [ebx+12h],104h + bt [format_flags],0 + jnc coff_flags_ok + or byte [ebx+12h],80h + coff_flags_ok: + push ebx + call make_timestamp + pop ebx + mov [ebx+4],eax + mov eax,[number_of_sections] + mov [ebx+2],ax + mov esi,[symbols_stream] + xor eax,eax + xor ecx,ecx + enumerate_symbols: + cmp esi,[free_additional_memory] + je symbols_enumerated + mov dl,[esi] + or dl,dl + jz enumerate_section + cmp dl,0C0h + jae enumerate_public + cmp dl,80h + jae enumerate_extrn + add esi,0Ch + jmp enumerate_symbols + enumerate_section: + mov edx,eax + shl edx,8 + mov [esi],edx + inc eax + inc ecx + mov [esi+1Eh],cx + add esi,20h + jmp enumerate_symbols + enumerate_public: + mov edx,eax + shl edx,8 + mov dl,[esi] + mov [esi],edx + mov edx,[esi+8] + add esi,10h + inc eax + cmp byte [edx+11],0 + je enumerate_symbols + mov edx,[edx+20] + cmp byte [edx],0C0h + jae enumerate_symbols + cmp byte [edx],80h + jb enumerate_symbols + inc eax + jmp enumerate_symbols + enumerate_extrn: + mov edx,eax + shl edx,8 + mov dl,[esi] + mov [esi],edx + add esi,0Ch + inc eax + jmp enumerate_symbols + prepare_default_section: + mov ebx,[symbols_stream] + cmp dword [ebx+0Ch],0 + jne default_section_ok + cmp [number_of_sections],0 + je default_section_ok + mov edx,ebx + find_references_to_default_section: + cmp ebx,[free_additional_memory] + jne check_reference + add [symbols_stream],20h + ret + check_reference: + mov al,[ebx] + or al,al + jz skip_other_section + cmp al,0C0h + jae check_public_reference + cmp al,80h + jae next_reference + cmp edx,[ebx+8] + je default_section_ok + next_reference: + add ebx,0Ch + jmp find_references_to_default_section + check_public_reference: + mov eax,[ebx+8] + add ebx,10h + test byte [eax+8],1 + jz find_references_to_default_section + mov cx,[current_pass] + cmp cx,[eax+16] + jne find_references_to_default_section + cmp edx,[eax+20] + je default_section_ok + jmp find_references_to_default_section + skip_other_section: + add ebx,20h + jmp find_references_to_default_section + default_section_ok: + inc [number_of_sections] + ret + symbols_enumerated: + mov [ebx+0Ch],eax + mov ebp,edi + sub ebp,ebx + push ebp + lea edi,[ebx+14h] + mov esi,[symbols_stream] + find_section: + cmp esi,[free_additional_memory] + je sections_finished + mov al,[esi] + or al,al + jz section_found + add esi,0Ch + cmp al,0C0h + jb find_section + add esi,4 + jmp find_section + section_found: + push esi edi + mov esi,[esi+4] + or esi,esi + jz default_section + mov ecx,[esi] + add esi,4 + rep movs byte [edi],[esi] + jmp section_name_ok + default_section: + mov al,'.' + stos byte [edi] + mov eax,'flat' + stos dword [edi] + section_name_ok: + pop edi esi + mov eax,[esi+0Ch] + mov [edi+10h],eax + mov eax,[esi+14h] + mov [edi+24h],eax + test al,80h + jnz section_ptr_ok + mov eax,[esi+8] + sub eax,[code_start] + add eax,ebp + mov [edi+14h],eax + section_ptr_ok: + mov ebx,[code_start] + mov edx,[code_size] + add ebx,edx + add edx,ebp + xor ecx,ecx + add esi,20h + find_relocations: + cmp esi,[free_additional_memory] + je section_relocations_done + mov al,[esi] + or al,al + jz section_relocations_done + cmp al,80h + jb add_relocation + cmp al,0C0h + jb next_relocation + add esi,10h + jmp find_relocations + add_relocation: + lea eax,[ebx+0Ah] + cmp eax,[tagged_blocks] + ja out_of_memory + mov eax,[esi+4] + mov [ebx],eax + mov eax,[esi+8] + mov eax,[eax] + shr eax,8 + mov [ebx+4],eax + movzx ax,byte [esi] + mov [ebx+8],ax + add ebx,0Ah + inc ecx + next_relocation: + add esi,0Ch + jmp find_relocations + section_relocations_done: + cmp ecx,10000h + jb section_relocations_count_16bit + bt [format_flags],0 + jnc format_limitations_exceeded + mov word [edi+20h],0FFFFh + or dword [edi+24h],1000000h + mov [edi+18h],edx + push esi edi + push ecx + lea esi,[ebx-1] + add ebx,0Ah + lea edi,[ebx-1] + imul ecx,0Ah + std + rep movs byte [edi],[esi] + cld + pop ecx + inc esi + inc ecx + mov [esi],ecx + xor eax,eax + mov [esi+4],eax + mov [esi+8],ax + pop edi esi + jmp section_relocations_ok + section_relocations_count_16bit: + mov [edi+20h],cx + jcxz section_relocations_ok + mov [edi+18h],edx + section_relocations_ok: + sub ebx,[code_start] + mov [code_size],ebx + add edi,28h + jmp find_section + sections_finished: + mov edx,[free_additional_memory] + mov ebx,[code_size] + add ebp,ebx + mov [edx+8],ebp + add ebx,[code_start] + mov edi,ebx + mov ecx,[edx+0Ch] + imul ecx,12h shr 1 + xor eax,eax + shr ecx,1 + jnc zero_symbols_table + stos word [edi] + zero_symbols_table: + rep stos dword [edi] + mov edx,edi + stos dword [edi] + mov esi,[symbols_stream] + make_symbols_table: + cmp esi,[free_additional_memory] + je symbols_table_ok + mov al,[esi] + cmp al,0C0h + jae add_public_symbol + cmp al,80h + jae add_extrn_symbol + or al,al + jz add_section_symbol + add esi,0Ch + jmp make_symbols_table + add_section_symbol: + call store_symbol_name + movzx eax,word [esi+1Eh] + mov [ebx+0Ch],ax + mov byte [ebx+10h],3 + add esi,20h + add ebx,12h + jmp make_symbols_table + add_extrn_symbol: + call store_symbol_name + mov byte [ebx+10h],2 + add esi,0Ch + add ebx,12h + jmp make_symbols_table + add_public_symbol: + call store_symbol_name + mov eax,[esi+0Ch] + mov [current_line],eax + mov eax,[esi+8] + test byte [eax+8],1 + jz undefined_coff_public + mov cx,[current_pass] + cmp cx,[eax+16] + jne undefined_coff_public + mov cl,[eax+11] + or cl,cl + jz public_constant + test [format_flags],8 + jnz check_64bit_public_symbol + cmp cl,2 + je public_symbol_type_ok + jmp invalid_use_of_symbol + undefined_coff_public: + mov [error_info],eax + jmp undefined_symbol + check_64bit_public_symbol: + cmp cl,4 + jne invalid_use_of_symbol + public_symbol_type_ok: + mov ecx,[eax+20] + cmp byte [ecx],80h + je alias_symbol + cmp byte [ecx],0 + jne invalid_use_of_symbol + mov cx,[ecx+1Eh] + mov [ebx+0Ch],cx + public_symbol_section_ok: + movzx ecx,byte [eax+9] + shr cl,1 + and cl,1 + neg ecx + cmp ecx,[eax+4] + jne value_out_of_range + xor ecx,[eax] + js value_out_of_range + mov eax,[eax] + mov [ebx+8],eax + mov al,2 + cmp byte [esi],0C0h + je store_symbol_class + inc al + cmp byte [esi],0C1h + je store_symbol_class + mov al,105 + store_symbol_class: + mov byte [ebx+10h],al + add esi,10h + add ebx,12h + jmp make_symbols_table + alias_symbol: + bt [format_flags],0 + jnc invalid_use_of_symbol + mov ecx,[eax] + or ecx,[eax+4] + jnz invalid_use_of_symbol + mov byte [ebx+10h],69h + mov byte [ebx+11h],1 + add ebx,12h + mov ecx,[eax+20] + mov ecx,[ecx] + shr ecx,8 + mov [ebx],ecx + mov byte [ebx+4],3 + add esi,10h + add ebx,12h + jmp make_symbols_table + public_constant: + mov word [ebx+0Ch],0FFFFh + jmp public_symbol_section_ok + symbols_table_ok: + mov eax,edi + sub eax,edx + mov [edx],eax + sub edi,[code_start] + mov [code_size],edi + and [written_size],0 + mov edx,[output_file] + call create + jc write_failed + mov edx,[free_additional_memory] + pop ecx + add [written_size],ecx + call write + jc write_failed + jmp write_output + store_symbol_name: + push esi + mov esi,[esi+4] + or esi,esi + jz default_name + lods dword [esi] + mov ecx,eax + cmp ecx,8 + ja add_string + push edi + mov edi,ebx + rep movs byte [edi],[esi] + pop edi esi + ret + default_name: + mov dword [ebx],'.fla' + mov dword [ebx+4],'t' + pop esi + ret + add_string: + mov eax,edi + sub eax,edx + mov [ebx+4],eax + inc ecx + rep movs byte [edi],[esi] + pop esi + ret + +format_elf: + test [format_flags],8 + jnz format_elf64 + mov edx,edi + mov ecx,34h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov dword [edx],7Fh + 'ELF' shl 8 + mov al,1 + mov [edx+4],al + mov [edx+5],al + mov [edx+6],al + mov [edx+14h],al + mov byte [edx+12h],3 + mov byte [edx+28h],34h + mov byte [edx+2Eh],28h + mov [code_type],32 + mov byte [edx+10h],2 + cmp word [esi],1D19h + je format_elf_exe + mov byte [edx+10h],3 + cmp word [esi],021Eh + je format_elf_exe + elf_header_ok: + mov byte [edx+10h],1 + mov eax,[additional_memory] + mov [symbols_stream],eax + mov ebx,eax + add eax,20h + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [current_section],ebx + mov [number_of_sections],eax + mov [ebx],al + mov [ebx+4],eax + mov [ebx+8],edi + mov al,111b + mov [ebx+14h],eax + mov al,4 + mov [ebx+10h],eax + mov edx,ebx + call init_addressing_space + xchg edx,ebx + mov [edx+14h],ebx + mov byte [edx+9],2 + test [format_flags],8 + jz format_defined + mov byte [edx+9],4 + mov byte [ebx+10h],8 + jmp format_defined + format_elf64: + mov edx,edi + mov ecx,40h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov dword [edx],7Fh + 'ELF' shl 8 + mov al,1 + mov [edx+5],al + mov [edx+6],al + mov [edx+14h],al + mov byte [edx+4],2 + mov byte [edx+12h],62 + mov byte [edx+34h],40h + mov byte [edx+3Ah],40h + mov [code_type],64 + mov byte [edx+10h],2 + cmp word [esi],1D19h + je format_elf64_exe + mov byte [edx+10h],3 + cmp word [esi],021Eh + je format_elf64_exe + jmp elf_header_ok +elf_section: + bt [format_flags],0 + jc illegal_instruction + call close_coff_section + mov ebx,[free_additional_memory] + lea eax,[ebx+20h] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov [current_section],ebx + inc word [number_of_sections] + jz format_limitations_exceeded + xor eax,eax + mov [ebx],al + mov [ebx+8],edi + mov [ebx+10h],eax + mov al,10b + mov [ebx+14h],eax + mov edx,ebx + call create_addressing_space + xchg edx,ebx + mov [edx+14h],ebx + mov byte [edx+9],2 + test [format_flags],8 + jz elf_labels_type_ok + mov byte [edx+9],4 + elf_labels_type_ok: + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + elf_section_flags: + cmp byte [esi],8Ch + je elf_section_alignment + cmp byte [esi],19h + jne elf_section_settings_ok + inc esi + lods byte [esi] + sub al,28 + xor al,11b + test al,not 10b + jnz invalid_argument + mov cl,al + mov al,1 + shl al,cl + test byte [ebx+14h],al + jnz setting_already_specified + or byte [ebx+14h],al + jmp elf_section_flags + elf_section_alignment: + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push ebx + call get_count_value + pop ebx + mov edx,eax + dec edx + test eax,edx + jnz invalid_value + or eax,eax + jz invalid_value + xchg [ebx+10h],eax + or eax,eax + jnz setting_already_specified + jmp elf_section_flags + elf_section_settings_ok: + cmp dword [ebx+10h],0 + jne instruction_assembled + mov dword [ebx+10h],4 + test [format_flags],8 + jz instruction_assembled + mov byte [ebx+10h],8 + jmp instruction_assembled +mark_elf_relocation: + test [format_flags],1 + jnz invalid_use_of_symbol + push ebx + mov ebx,[addressing_space] + cmp [value_type],3 + je elf_relocation_relative + cmp [value_type],7 + je elf_relocation_relative + push eax + cmp [value_type],5 + je elf_gotoff_relocation + ja invalid_use_of_symbol + mov al,1 ; R_386_32 / R_AMD64_64 + test [format_flags],8 + jz coff_relocation + cmp [value_type],4 + je coff_relocation + mov al,11 ; R_AMD64_32S + jmp coff_relocation + elf_gotoff_relocation: + test [format_flags],8 + jnz invalid_use_of_symbol + mov al,9 ; R_386_GOTOFF + jmp coff_relocation + elf_relocation_relative: + cmp byte [ebx+9],0 + je invalid_use_of_symbol + mov ebx,[current_section] + mov ebx,[ebx+8] + sub ebx,edi + sub eax,ebx + push eax + mov al,2 ; R_386_PC32 / R_AMD64_PC32 + cmp [value_type],3 + je coff_relocation + mov al,4 ; R_386_PLT32 / R_AMD64_PLT32 + jmp coff_relocation +close_elf: + bt [format_flags],0 + jc close_elf_exe + call close_coff_section + cmp [next_pass_needed],0 + je elf_closed + mov eax,[symbols_stream] + mov [free_additional_memory],eax + elf_closed: + ret +elf_formatter: + mov ecx,edi + sub ecx,[code_start] + neg ecx + and ecx,111b + test [format_flags],8 + jnz align_elf_structures + and ecx,11b + align_elf_structures: + xor al,al + rep stos byte [edi] + push edi + call prepare_default_section + mov esi,[symbols_stream] + mov edi,[free_additional_memory] + xor eax,eax + mov ecx,4 + rep stos dword [edi] + test [format_flags],8 + jz find_first_section + mov ecx,2 + rep stos dword [edi] + find_first_section: + mov al,[esi] + or al,al + jz first_section_found + cmp al,0C0h + jb skip_other_symbol + add esi,4 + skip_other_symbol: + add esi,0Ch + jmp find_first_section + first_section_found: + mov ebx,esi + mov ebp,esi + add esi,20h + xor ecx,ecx + xor edx,edx + find_next_section: + cmp esi,[free_additional_memory] + je make_section_symbol + mov al,[esi] + or al,al + jz make_section_symbol + cmp al,0C0h + jae skip_public + cmp al,80h + jae skip_extrn + or byte [ebx+14h],40h + skip_extrn: + add esi,0Ch + jmp find_next_section + skip_public: + add esi,10h + jmp find_next_section + make_section_symbol: + mov eax,edi + xchg eax,[ebx+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_section_symbol + xor eax,eax + stos dword [edi] + stos dword [edi] + call store_section_index + jmp section_symbol_ok + store_section_index: + inc ecx + mov eax,ecx + shl eax,8 + mov [ebx],eax + inc dx + jz format_limitations_exceeded + mov eax,edx + shl eax,16 + mov al,3 + test byte [ebx+14h],40h + jz section_index_ok + or ah,-1 + inc dx + jz format_limitations_exceeded + section_index_ok: + stos dword [edi] + ret + elf64_section_symbol: + call store_section_index + xor eax,eax + stos dword [edi] + stos dword [edi] + stos dword [edi] + stos dword [edi] + section_symbol_ok: + mov ebx,esi + add esi,20h + cmp ebx,[free_additional_memory] + jne find_next_section + inc dx + jz format_limitations_exceeded + mov [current_section],edx + mov esi,[symbols_stream] + find_other_symbols: + cmp esi,[free_additional_memory] + je elf_symbol_table_ok + mov al,[esi] + or al,al + jz skip_section + cmp al,0C0h + jae make_public_symbol + cmp al,80h + jae make_extrn_symbol + add esi,0Ch + jmp find_other_symbols + skip_section: + add esi,20h + jmp find_other_symbols + make_public_symbol: + mov eax,[esi+0Ch] + mov [current_line],eax + cmp byte [esi],0C0h + jne invalid_argument + mov ebx,[esi+8] + test byte [ebx+8],1 + jz undefined_public + mov ax,[current_pass] + cmp ax,[ebx+16] + jne undefined_public + mov dl,[ebx+11] + or dl,dl + jz public_absolute + mov eax,[ebx+20] + cmp byte [eax],0 + jne invalid_use_of_symbol + mov eax,[eax+4] + test [format_flags],8 + jnz elf64_public + cmp dl,2 + jne invalid_use_of_symbol + mov dx,[eax+0Eh] + jmp section_for_public_ok + undefined_public: + mov [error_info],ebx + jmp undefined_symbol + elf64_public: + cmp dl,4 + jne invalid_use_of_symbol + mov dx,[eax+6] + jmp section_for_public_ok + public_absolute: + mov dx,0FFF1h + section_for_public_ok: + mov eax,[esi+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_public_symbol + movzx eax,byte [ebx+9] + shr al,1 + and al,1 + neg eax + cmp eax,[ebx+4] + jne value_out_of_range + xor eax,[ebx] + js value_out_of_range + mov eax,[ebx] + stos dword [edi] + xor eax,eax + mov al,[ebx+10] + stos dword [edi] + mov eax,edx + shl eax,16 + mov al,10h + cmp byte [ebx+10],0 + je elf_public_function + or al,1 + jmp store_elf_public_info + elf_public_function: + or al,2 + store_elf_public_info: + stos dword [edi] + jmp public_symbol_ok + elf64_public_symbol: + mov eax,edx + shl eax,16 + mov al,10h + cmp byte [ebx+10],0 + je elf64_public_function + or al,1 + jmp store_elf64_public_info + elf64_public_function: + or al,2 + store_elf64_public_info: + stos dword [edi] + mov al,[ebx+9] + shl eax,31-1 + xor eax,[ebx+4] + js value_out_of_range + mov eax,[ebx] + stos dword [edi] + mov eax,[ebx+4] + stos dword [edi] + mov al,[ebx+10] + stos dword [edi] + xor al,al + stos dword [edi] + public_symbol_ok: + inc ecx + mov eax,ecx + shl eax,8 + mov al,0C0h + mov [esi],eax + add esi,10h + jmp find_other_symbols + make_extrn_symbol: + mov eax,[esi+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_extrn_symbol + xor eax,eax + stos dword [edi] + mov eax,[esi+8] + stos dword [edi] + mov eax,10h + stos dword [edi] + jmp extrn_symbol_ok + elf64_extrn_symbol: + mov eax,10h + stos dword [edi] + xor al,al + stos dword [edi] + stos dword [edi] + mov eax,[esi+8] + stos dword [edi] + xor eax,eax + stos dword [edi] + extrn_symbol_ok: + inc ecx + mov eax,ecx + shl eax,8 + mov al,80h + mov [esi],eax + add esi,0Ch + jmp find_other_symbols + elf_symbol_table_ok: + mov edx,edi + mov ebx,[free_additional_memory] + xor al,al + stos byte [edi] + add edi,16 + mov [edx+1],edx + add ebx,10h + test [format_flags],8 + jz make_string_table + add ebx,8 + make_string_table: + cmp ebx,edx + je elf_string_table_ok + test [format_flags],8 + jnz make_elf64_string + cmp byte [ebx+0Dh],0 + je rel_prefix_ok + mov byte [ebx+0Dh],0 + mov eax,'.rel' + stos dword [edi] + rel_prefix_ok: + mov esi,edi + sub esi,edx + xchg esi,[ebx] + add ebx,10h + make_elf_string: + or esi,esi + jz default_string + lods dword [esi] + mov ecx,eax + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + jmp make_string_table + make_elf64_string: + cmp byte [ebx+5],0 + je elf64_rel_prefix_ok + mov byte [ebx+5],0 + mov eax,'.rel' + stos dword [edi] + mov al,'a' + stos byte [edi] + elf64_rel_prefix_ok: + mov esi,edi + sub esi,edx + xchg esi,[ebx] + add ebx,18h + jmp make_elf_string + default_string: + mov eax,'.fla' + stos dword [edi] + mov ax,'t' + stos word [edi] + jmp make_string_table + elf_string_table_ok: + mov [edx+1+8],edi + mov ebx,[code_start] + mov eax,edi + sub eax,[free_additional_memory] + xor ecx,ecx + sub ecx,eax + test [format_flags],8 + jnz finish_elf64_header + and ecx,11b + add eax,ecx + mov [ebx+20h],eax + mov eax,[current_section] + inc ax + jz format_limitations_exceeded + mov [ebx+32h],ax + inc ax + jz format_limitations_exceeded + mov [ebx+30h],ax + jmp elf_header_finished + finish_elf64_header: + and ecx,111b + add eax,ecx + mov [ebx+28h],eax + mov eax,[current_section] + inc ax + jz format_limitations_exceeded + mov [ebx+3Eh],ax + inc ax + jz format_limitations_exceeded + mov [ebx+3Ch],ax + elf_header_finished: + xor eax,eax + add ecx,10*4 + rep stos byte [edi] + test [format_flags],8 + jz elf_null_section_ok + mov ecx,6*4 + rep stos byte [edi] + elf_null_section_ok: + mov esi,ebp + xor ecx,ecx + make_section_entry: + mov ebx,edi + mov eax,[esi+4] + mov eax,[eax] + stos dword [edi] + mov eax,1 + cmp dword [esi+0Ch],0 + je bss_section + test byte [esi+14h],80h + jz section_type_ok + bss_section: + mov al,8 + section_type_ok: + stos dword [edi] + mov eax,[esi+14h] + and al,3Fh + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + mov eax,[esi+8] + mov [image_base],eax + sub eax,[code_start] + call store_elf_machine_word + mov eax,[esi+0Ch] + call store_elf_machine_word + xor eax,eax + stos dword [edi] + stos dword [edi] + mov eax,[esi+10h] + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + inc ecx + add esi,20h + xchg edi,[esp] + mov ebp,edi + convert_relocations: + cmp esi,[free_additional_memory] + je relocations_converted + mov al,[esi] + or al,al + jz relocations_converted + cmp al,80h + jb make_relocation_entry + cmp al,0C0h + jb relocation_entry_ok + add esi,10h + jmp convert_relocations + make_relocation_entry: + test [format_flags],8 + jnz make_elf64_relocation_entry + mov eax,[esi+4] + stos dword [edi] + mov eax,[esi+8] + mov eax,[eax] + mov al,[esi] + stos dword [edi] + jmp relocation_entry_ok + make_elf64_relocation_entry: + mov eax,[esi+4] + stos dword [edi] + xor eax,eax + stos dword [edi] + movzx eax,byte [esi] + stos dword [edi] + mov eax,[esi+8] + mov eax,[eax] + shr eax,8 + stos dword [edi] + xor eax,eax + push edx + mov edx,[esi+4] + add edx,[image_base] + xchg eax,[edx] + stos dword [edi] + cmp byte [esi],1 + je addend_64bit + pop edx + sar eax,31 + stos dword [edi] + jmp relocation_entry_ok + addend_64bit: + xor eax,eax + xchg eax,[edx+4] + stos dword [edi] + pop edx + relocation_entry_ok: + add esi,0Ch + jmp convert_relocations + store_elf_machine_word: + stos dword [edi] + test [format_flags],8 + jz elf_machine_word_ok + and dword [edi],0 + add edi,4 + elf_machine_word_ok: + ret + relocations_converted: + cmp edi,ebp + xchg edi,[esp] + je rel_section_ok + mov eax,[ebx] + sub eax,4 + test [format_flags],8 + jz store_relocations_name_offset + dec eax + store_relocations_name_offset: + stos dword [edi] + test [format_flags],8 + jnz rela_section + mov eax,9 + jmp store_relocations_type + rela_section: + mov eax,4 + store_relocations_type: + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,ebp + sub eax,[code_start] + call store_elf_machine_word + mov eax,[esp] + sub eax,ebp + call store_elf_machine_word + mov eax,[current_section] + stos dword [edi] + mov eax,ecx + stos dword [edi] + inc ecx + test [format_flags],8 + jnz finish_elf64_rela_section + mov eax,4 + stos dword [edi] + mov al,8 + stos dword [edi] + jmp rel_section_ok + finish_elf64_rela_section: + mov eax,8 + stos dword [edi] + xor al,al + stos dword [edi] + mov al,24 + stos dword [edi] + xor al,al + stos dword [edi] + rel_section_ok: + cmp esi,[free_additional_memory] + jne make_section_entry + pop eax + mov ebx,[code_start] + sub eax,ebx + mov [code_size],eax + mov ecx,20h + test [format_flags],8 + jz adjust_elf_section_headers_offset + mov ecx,28h + adjust_elf_section_headers_offset: + add [ebx+ecx],eax + mov eax,1 + stos dword [edi] + mov al,2 + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,[code_size] + call store_elf_machine_word + mov eax,[edx+1] + sub eax,[free_additional_memory] + call store_elf_machine_word + mov eax,[current_section] + inc eax + stos dword [edi] + mov eax,[number_of_sections] + inc eax + stos dword [edi] + test [format_flags],8 + jnz finish_elf64_sym_section + mov eax,4 + stos dword [edi] + mov al,10h + stos dword [edi] + jmp sym_section_ok + finish_elf64_sym_section: + mov eax,8 + stos dword [edi] + xor al,al + stos dword [edi] + mov al,18h + stos dword [edi] + xor al,al + stos dword [edi] + sym_section_ok: + mov al,1+8 + stos dword [edi] + mov al,3 + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,[edx+1] + sub eax,[free_additional_memory] + add eax,[code_size] + call store_elf_machine_word + mov eax,[edx+1+8] + sub eax,[edx+1] + call store_elf_machine_word + xor eax,eax + stos dword [edi] + stos dword [edi] + mov al,1 + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + mov eax,'tab' + mov dword [edx+1],'.sym' + mov [edx+1+4],eax + mov dword [edx+1+8],'.str' + mov [edx+1+8+4],eax + mov [resource_data],edx + mov [written_size],0 + mov edx,[output_file] + call create + jc write_failed + call write_code + mov ecx,edi + mov edx,[free_additional_memory] + sub ecx,edx + add [written_size],ecx + call write + jc write_failed + jmp output_written + +format_elf_exe: + add esi,2 + or [format_flags],1 + cmp byte [esi],'(' + jne elf_exe_brand_ok + inc esi + cmp byte [esi],'.' + je invalid_value + push edx + call get_byte_value + cmp [value_type],0 + jne invalid_use_of_symbol + pop edx + mov [edx+7],al + elf_exe_brand_ok: + mov [image_base],8048000h + cmp byte [esi],80h + jne elf_exe_base_ok + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov [image_base],eax + pop edx + elf_exe_base_ok: + mov byte [edx+2Ah],20h + mov ebx,edi + mov ecx,20h shr 2 + cmp [current_pass],0 + je init_elf_segments + imul ecx,[number_of_sections] + init_elf_segments: + xor eax,eax + rep stos dword [edi] + and [number_of_sections],0 + mov byte [ebx],1 + mov word [ebx+1Ch],1000h + mov byte [ebx+18h],111b + mov ebp,[image_base] + and dword [ebx+4],0 + mov [ebx+8],ebp + mov [ebx+0Ch],ebp + mov eax,edi + sub eax,[code_start] + add eax,ebp + mov [edx+18h],eax + and [image_base_high],0 + elf_exe_addressing_setup: + call init_addressing_space + call setup_elf_exe_labels_type + mov eax,[code_start] + xor edx,edx + xor cl,cl + sub eax,[image_base] + sbb edx,[image_base_high] + sbb cl,0 + mov [ebx],eax + mov [ebx+4],edx + mov [ebx+8],cl + mov [symbols_stream],edi + jmp format_defined + format_elf64_exe: + add esi,2 + or [format_flags],1 + cmp byte [esi],'(' + jne elf64_exe_brand_ok + inc esi + cmp byte [esi],'.' + je invalid_value + push edx + call get_byte_value + cmp [value_type],0 + jne invalid_use_of_symbol + pop edx + mov [edx+7],al + elf64_exe_brand_ok: + mov [image_base],400000h + and [image_base_high],0 + cmp byte [esi],80h + jne elf64_exe_base_ok + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov [image_base],eax + mov [image_base_high],edx + pop edx + elf64_exe_base_ok: + mov byte [edx+36h],38h + mov ebx,edi + mov ecx,38h shr 2 + cmp [current_pass],0 + je init_elf64_segments + imul ecx,[number_of_sections] + init_elf64_segments: + xor eax,eax + rep stos dword [edi] + and [number_of_sections],0 + mov byte [ebx],1 + mov word [ebx+30h],1000h + mov byte [ebx+4],111b + mov ebp,[image_base] + mov ecx,[image_base_high] + and dword [ebx+8],0 + mov [ebx+10h],ebp + mov [ebx+10h+4],ecx + mov [ebx+18h],ebp + mov [ebx+18h+4],ecx + mov eax,edi + sub eax,[code_start] + add eax,ebp + adc ecx,0 + mov [edx+18h],eax + mov [edx+18h+8],ecx + jmp elf_exe_addressing_setup + setup_elf_exe_labels_type: + mov eax,[code_start] + cmp byte [eax+10h],3 + jne elf_exe_labels_type_ok + mov byte [ebx+9],2 + test [format_flags],8 + jz elf_exe_labels_type_ok + mov byte [ebx+9],4 + elf_exe_labels_type_ok: + ret +elf_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],8 + jnz elf64_entry + call get_dword_value + mov edx,[code_start] + mov [edx+18h],eax + jmp instruction_assembled + elf64_entry: + call get_qword_value + mov ebx,[code_start] + mov [ebx+18h],eax + mov [ebx+1Ch],edx + jmp instruction_assembled +elf_segment: + bt [format_flags],0 + jnc illegal_instruction + test [format_flags],8 + jnz elf64_segment + call close_elf_segment + push eax + call create_addressing_space + call setup_elf_exe_labels_type + mov ebp,ebx + mov ebx,[number_of_sections] + shl ebx,5 + add ebx,[code_start] + add ebx,34h + cmp ebx,[symbols_stream] + jb new_elf_segment + mov ebx,[symbols_stream] + sub ebx,20h + or [next_pass_needed],-1 + new_elf_segment: + mov byte [ebx],1 + and dword [ebx+18h],0 + mov word [ebx+1Ch],1000h + elf_segment_flags: + cmp byte [esi],1Eh + je elf_segment_type + cmp byte [esi],19h + jne elf_segment_flags_ok + lods word [esi] + sub ah,28 + jbe invalid_argument + cmp ah,1 + je mark_elf_segment_flag + cmp ah,3 + ja invalid_argument + xor ah,1 + cmp ah,2 + je mark_elf_segment_flag + inc ah + mark_elf_segment_flag: + test [ebx+18h],ah + jnz setting_already_specified + or [ebx+18h],ah + jmp elf_segment_flags + elf_segment_type: + cmp byte [ebx],1 + jne setting_already_specified + lods word [esi] + mov ecx,[number_of_sections] + jecxz elf_segment_type_ok + mov edx,[code_start] + add edx,34h + scan_elf_segment_types: + cmp edx,[symbols_stream] + jae elf_segment_type_ok + cmp [edx],ah + je data_already_defined + add edx,20h + loop scan_elf_segment_types + elf_segment_type_ok: + mov [ebx],ah + mov word [ebx+1Ch],1 + cmp ah,50h + jb elf_segment_flags + or dword [ebx],6474E500h + jmp elf_segment_flags + elf_segment_flags_ok: + pop edx + cmp byte [ebx],1 + jne no_elf_segment_merging + cmp [merge_segment],0 + jne merge_elf_segment + no_elf_segment_merging: + mov eax,edi + sub eax,[code_start] + mov [ebx+4],eax + and eax,0FFFh + add eax,edx + mov [ebx+8],eax + mov [ebx+0Ch],eax + xor edx,edx + elf_segment_addressing_setup: + xor cl,cl + not eax + not edx + not cl + add eax,1 + adc edx,0 + adc cl,0 + add eax,edi + adc edx,0 + adc cl,0 + mov [ds:ebp],eax + mov [ds:ebp+4],edx + mov [ds:ebp+8],cl + inc [number_of_sections] + jmp instruction_assembled + merge_elf_segment: + xor ecx,ecx + xchg ecx,[merge_segment] + cmp ecx,-1 + je merge_elf_header + mov eax,[ecx+8] + mov ecx,[ecx+4] + elf_segment_separated_base: + mov [ebx+8],eax + mov [ebx+0Ch],eax + mov [ebx+4],ecx + sub eax,ecx + add eax,edi + sub eax,[code_start] + xor edx,edx + jmp elf_segment_addressing_setup + merge_elf_header: + mov eax,[image_base] + xor ecx,ecx + jmp elf_segment_separated_base + close_elf_segment: + cmp [number_of_sections],0 + jne finish_elf_segment + cmp edi,[symbols_stream] + jne first_elf_segment_ok + or [merge_segment],-1 + mov eax,[image_base] + ret + first_elf_segment_ok: + and [merge_segment],0 + inc [number_of_sections] + finish_elf_segment: + mov ebx,[number_of_sections] + dec ebx + shl ebx,5 + add ebx,[code_start] + add ebx,34h + mov eax,edi + sub eax,[code_start] + sub eax,[ebx+4] + mov edx,edi + cmp edi,[undefined_data_end] + jne elf_segment_size_ok + cmp byte [ebx],1 + jne elf_segment_size_ok + mov edi,[undefined_data_start] + elf_segment_size_ok: + mov [ebx+14h],eax + add eax,edi + sub eax,edx + mov [ebx+10h],eax + and [undefined_data_end],0 + mov eax,[ebx+8] + cmp byte [ebx],1 + je elf_segment_position_move_and_align + cmp [merge_segment],0 + jne elf_segment_position_move + cmp byte [ebx],4 + je elf_segment_position_ok + cmp byte [ebx],51h + je elf_segment_position_ok + mov [merge_segment],ebx + elf_segment_position_move: + add eax,[ebx+14h] + jmp elf_segment_position_ok + elf_segment_position_move_and_align: + add eax,[ebx+14h] + add eax,0FFFh + elf_segment_position_ok: + and eax,not 0FFFh + ret + elf64_segment: + call close_elf64_segment + push eax edx + call create_addressing_space + call setup_elf_exe_labels_type + mov ebp,ebx + mov ebx,[number_of_sections] + imul ebx,38h + add ebx,[code_start] + add ebx,40h + cmp ebx,[symbols_stream] + jb new_elf64_segment + or [next_pass_needed],-1 + new_elf64_segment: + mov byte [ebx],1 + and dword [ebx+4],0 + mov word [ebx+30h],1000h + elf64_segment_flags: + cmp byte [esi],1Eh + je elf64_segment_type + cmp byte [esi],19h + jne elf64_segment_flags_ok + lods word [esi] + sub ah,28 + jbe invalid_argument + cmp ah,1 + je mark_elf64_segment_flag + cmp ah,3 + ja invalid_argument + xor ah,1 + cmp ah,2 + je mark_elf64_segment_flag + inc ah + mark_elf64_segment_flag: + test [ebx+4],ah + jnz setting_already_specified + or [ebx+4],ah + jmp elf64_segment_flags + elf64_segment_type: + cmp byte [ebx],1 + jne setting_already_specified + lods word [esi] + mov ecx,[number_of_sections] + jecxz elf64_segment_type_ok + mov edx,[code_start] + add edx,40h + scan_elf64_segment_types: + cmp edx,[symbols_stream] + jae elf64_segment_type_ok + cmp [edx],ah + je data_already_defined + add edx,38h + loop scan_elf64_segment_types + elf64_segment_type_ok: + mov [ebx],ah + mov word [ebx+30h],1 + cmp ah,50h + jb elf64_segment_flags + or dword [ebx],6474E500h + jmp elf64_segment_flags + elf64_segment_flags_ok: + pop edx eax + cmp byte [ebx],1 + jne no_elf64_segment_merging + cmp [merge_segment],0 + jne merge_elf64_segment + no_elf64_segment_merging: + mov ecx,edi + sub ecx,[code_start] + mov [ebx+8],ecx + and ecx,0FFFh + add eax,ecx + adc edx,0 + mov [ebx+10h],eax + mov [ebx+10h+4],edx + mov [ebx+18h],eax + mov [ebx+18h+4],edx + jmp elf_segment_addressing_setup + merge_elf64_segment: + xor ecx,ecx + xchg ecx,[merge_segment] + cmp ecx,-1 + je merge_elf64_header + mov eax,[ecx+10h] + mov edx,[ecx+10h+4] + mov ecx,[ecx+8] + elf64_segment_separated_base: + mov [ebx+10h],eax + mov [ebx+10h+4],edx + mov [ebx+18h],eax + mov [ebx+18h+4],edx + mov [ebx+8],ecx + neg ecx + add ecx,edi + sub ecx,[code_start] + add eax,ecx + adc edx,0 + jmp elf_segment_addressing_setup + merge_elf64_header: + mov eax,[image_base] + mov edx,[image_base_high] + xor ecx,ecx + jmp elf64_segment_separated_base + close_elf64_segment: + cmp [number_of_sections],0 + jne finish_elf64_segment + cmp edi,[symbols_stream] + jne first_elf64_segment_ok + or [merge_segment],-1 + mov eax,[image_base] + mov edx,[image_base_high] + ret + first_elf64_segment_ok: + and [merge_segment],0 + inc [number_of_sections] + finish_elf64_segment: + mov ebx,[number_of_sections] + dec ebx + imul ebx,38h + add ebx,[code_start] + add ebx,40h + mov eax,edi + sub eax,[code_start] + sub eax,[ebx+8] + mov edx,edi + cmp edi,[undefined_data_end] + jne elf64_segment_size_ok + cmp byte [ebx],1 + jne elf64_segment_size_ok + mov edi,[undefined_data_start] + elf64_segment_size_ok: + mov [ebx+28h],eax + add eax,edi + sub eax,edx + mov [ebx+20h],eax + and [undefined_data_end],0 + mov eax,[ebx+10h] + mov edx,[ebx+10h+4] + cmp byte [ebx],1 + je elf64_segment_position_move_and_align + cmp [merge_segment],0 + jne elf64_segment_position_move + cmp byte [ebx],4 + je elf64_segment_position_ok + cmp byte [ebx],51h + je elf64_segment_position_ok + mov [merge_segment],ebx + elf64_segment_position_move: + add eax,[ebx+28h] + adc edx,0 + jmp elf64_segment_position_ok + elf64_segment_position_move_and_align: + add eax,[ebx+28h] + adc edx,0 + add eax,0FFFh + adc edx,0 + elf64_segment_position_ok: + and eax,not 0FFFh + ret +close_elf_exe: + test [format_flags],8 + jnz close_elf64_exe + call close_elf_segment + mov edx,[code_start] + mov eax,[number_of_sections] + mov byte [edx+1Ch],34h + mov [edx+2Ch],ax + shl eax,5 + add eax,edx + add eax,34h + cmp eax,[symbols_stream] + je elf_exe_ok + or [next_pass_needed],-1 + elf_exe_ok: + ret + close_elf64_exe: + call close_elf64_segment + mov edx,[code_start] + mov eax,[number_of_sections] + mov byte [edx+20h],40h + mov [edx+38h],ax + imul eax,38h + add eax,edx + add eax,40h + cmp eax,[symbols_stream] + je elf64_exe_ok + or [next_pass_needed],-1 + elf64_exe_ok: + ret diff --git a/programs/develop/koldbg/fasm/messages.inc b/programs/develop/koldbg/fasm/messages.inc new file mode 100644 index 0000000000..0cd787483b --- /dev/null +++ b/programs/develop/koldbg/fasm/messages.inc @@ -0,0 +1,52 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +_out_of_memory db 'out of memory',0 +_stack_overflow db 'out of stack space',0 +_main_file_not_found db 'source file not found',0 +_unexpected_end_of_file db 'unexpected end of file',0 +_code_cannot_be_generated db 'code cannot be generated',0 +_format_limitations_exceeded db 'format limitations exceeded',0 +_invalid_definition db 'invalid definition provided',0 +_write_failed db 'write failed',0 +_file_not_found db 'file not found',0 +_error_reading_file db 'error reading file',0 +_invalid_file_format db 'invalid file format',0 +_invalid_macro_arguments db 'invalid macro arguments',0 +_incomplete_macro db 'incomplete macro',0 +_unexpected_characters db 'unexpected characters',0 +_invalid_argument db 'invalid argument',0 +_illegal_instruction db 'illegal instruction',0 +_invalid_operand db 'invalid operand',0 +_invalid_operand_size db 'invalid size of operand',0 +_operand_size_not_specified db 'operand size not specified',0 +_operand_sizes_do_not_match db 'operand sizes do not match',0 +_invalid_address_size db 'invalid size of address value',0 +_address_sizes_do_not_agree db 'address sizes do not agree',0 +_disallowed_combination_of_registers db 'disallowed combination of registers',0 +_long_immediate_not_encodable db 'not encodable with long immediate',0 +_relative_jump_out_of_range db 'relative jump out of range',0 +_invalid_expression db 'invalid expression',0 +_invalid_address db 'invalid address',0 +_invalid_value db 'invalid value',0 +_value_out_of_range db 'value out of range',0 +_undefined_symbol db 'undefined symbol',0 +_symbol_out_of_scope_1 db 'symbol',0 +_symbol_out_of_scope_2 db 'out of scope',0 +_invalid_use_of_symbol db 'invalid use of symbol',0 +_name_too_long db 'name too long',0 +_invalid_name db 'invalid name',0 +_reserved_word_used_as_symbol db 'reserved word used as symbol',0 +_symbol_already_defined db 'symbol already defined',0 +_missing_end_quote db 'missing end quote',0 +_missing_end_directive db 'missing end directive',0 +_unexpected_instruction db 'unexpected instruction',0 +_extra_characters_on_line db 'extra characters on line',0 +_section_not_aligned_enough db 'section is not aligned enough',0 +_setting_already_specified db 'setting already specified',0 +_data_already_defined db 'data already defined',0 +_too_many_repeats db 'too many repeats',0 +_invoked_error db 'error directive encountered in source file',0 +_assertion_failed db 'assertion failed',0 diff --git a/programs/develop/koldbg/fasm/parser.inc b/programs/develop/koldbg/fasm/parser.inc new file mode 100644 index 0000000000..1b4ae37aff --- /dev/null +++ b/programs/develop/koldbg/fasm/parser.inc @@ -0,0 +1,1470 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +parser: + mov eax,[memory_end] + mov [labels_list],eax + mov eax,[additional_memory] + mov [free_additional_memory],eax + xor eax,eax + mov [current_locals_prefix],eax + mov [anonymous_reverse],eax + mov [anonymous_forward],eax + mov [hash_tree],eax + mov [blocks_stack],eax + mov [parsed_lines],eax + mov esi,[memory_start] + mov edi,[source_start] + parser_loop: + mov [current_line],esi + lea eax,[edi+100h] + cmp eax,[labels_list] + jae out_of_memory + cmp byte [esi+16],0 + je empty_line + cmp byte [esi+16],3Bh + je empty_line + mov al,0Fh + stos byte [edi] + mov eax,esi + stos dword [edi] + inc [parsed_lines] + add esi,16 + parse_line: + mov [formatter_symbols_allowed],0 + mov [decorator_symbols_allowed],0 + cmp byte [esi],1Ah + jne empty_instruction + push edi + add esi,2 + movzx ecx,byte [esi-1] + cmp byte [esi+ecx],':' + je simple_label + cmp byte [esi+ecx],'=' + je constant_label + call get_instruction + jnc main_instruction_identified + cmp byte [esi+ecx],1Ah + jne no_data_label + push esi ecx + lea esi,[esi+ecx+2] + movzx ecx,byte [esi-1] + call get_data_directive + jnc data_label + pop ecx esi + no_data_label: + call get_data_directive + jnc main_instruction_identified + pop edi + sub esi,2 + xor bx,bx + call parse_line_contents + jmp parse_next_line + simple_label: + pop edi + call identify_label + cmp byte [esi+1],':' + je block_label + mov byte [edi],2 + inc edi + stos dword [edi] + inc esi + xor al,al + stos byte [edi] + jmp parse_line + block_label: + mov byte [edi],4 + inc edi + stos dword [edi] + add esi,2 + jmp parse_line + constant_label: + pop edi + call get_label_id + mov byte [edi],3 + inc edi + stos dword [edi] + xor al,al + stos byte [edi] + inc esi + xor bx,bx + call parse_line_contents + jmp parse_next_line + data_label: + pop ecx edx + pop edi + push eax ebx esi + mov esi,edx + movzx ecx,byte [esi-1] + call identify_label + mov byte [edi],2 + inc edi + stos dword [edi] + pop esi ebx eax + stos byte [edi] + push edi + main_instruction_identified: + pop edi + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + cmp bx,if_directive-instruction_handler + je parse_block + cmp bx,repeat_directive-instruction_handler + je parse_block + cmp bx,while_directive-instruction_handler + je parse_block + cmp bx,end_directive-instruction_handler + je parse_end_directive + cmp bx,else_directive-instruction_handler + je parse_else + cmp bx,assert_directive-instruction_handler + je parse_assert + common_parse: + call parse_line_contents + jmp parse_next_line + empty_instruction: + lods byte [esi] + or al,al + jz parse_next_line + cmp al,':' + je invalid_name + dec esi + mov [parenthesis_stack],0 + call parse_argument + jmp parse_next_line + empty_line: + add esi,16 + skip_rest_of_line: + call skip_foreign_line + parse_next_line: + cmp esi,[source_start] + jb parser_loop + source_parsed: + cmp [blocks_stack],0 + je blocks_stack_ok + pop eax + pop [current_line] + jmp missing_end_directive + blocks_stack_ok: + xor al,al + stos byte [edi] + add edi,0Fh + and edi,not 0Fh + mov [code_start],edi + ret + parse_block: + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push [current_line] + mov ax,bx + shl eax,16 + push eax + inc [blocks_stack] + cmp bx,if_directive-instruction_handler + je parse_if + cmp bx,while_directive-instruction_handler + je parse_while + call parse_line_contents + jmp parse_next_line + parse_end_directive: + cmp byte [esi],1Ah + jne common_parse + push edi + inc esi + movzx ecx,byte [esi] + inc esi + call get_instruction + pop edi + jnc parse_end_block + sub esi,2 + jmp common_parse + parse_end_block: + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + lods byte [esi] + or al,al + jnz extra_characters_on_line + cmp bx,if_directive-instruction_handler + je close_parsing_block + cmp bx,repeat_directive-instruction_handler + je close_parsing_block + cmp bx,while_directive-instruction_handler + je close_parsing_block + jmp parse_next_line + close_parsing_block: + cmp [blocks_stack],0 + je unexpected_instruction + cmp bx,[esp+2] + jne unexpected_instruction + dec [blocks_stack] + pop eax edx + cmp bx,if_directive-instruction_handler + jne parse_next_line + test al,1100b + jz parse_next_line + test al,10000b + jnz parse_next_line + sub edi,8 + jmp parse_next_line + parse_if: + push edi + call parse_line_contents + xor al,al + stos byte [edi] + xchg esi,[esp] + mov edi,esi + call preevaluate_logical_expression + pop esi + cmp al,'0' + je parse_false_condition_block + cmp al,'1' + je parse_true_condition_block + or byte [esp],10000b + jmp parse_next_line + parse_while: + push edi + call parse_line_contents + xor al,al + stos byte [edi] + xchg esi,[esp] + mov edi,esi + call preevaluate_logical_expression + pop esi + cmp al,'0' + je parse_false_condition_block + cmp al,'1' + jne parse_next_line + stos byte [edi] + jmp parse_next_line + parse_false_condition_block: + or byte [esp],1 + sub edi,4 + jmp skip_parsing + parse_true_condition_block: + or byte [esp],100b + sub edi,4 + jmp parse_next_line + parse_else: + cmp [blocks_stack],0 + je unexpected_instruction + cmp word [esp+2],if_directive-instruction_handler + jne unexpected_instruction + lods byte [esi] + or al,al + jz parse_pure_else + cmp al,1Ah + jne extra_characters_on_line + push edi + movzx ecx,byte [esi] + inc esi + call get_instruction + jc extra_characters_on_line + pop edi + cmp bx,if_directive-instruction_handler + jne extra_characters_on_line + test byte [esp],100b + jnz skip_true_condition_else + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp parse_if + parse_assert: + push edi + call parse_line_contents + xor al,al + stos byte [edi] + xchg esi,[esp] + mov edi,esi + call preevaluate_logical_expression + pop esi + or al,al + jz parse_next_line + stos byte [edi] + jmp parse_next_line + skip_true_condition_else: + sub edi,4 + or byte [esp],1 + jmp skip_parsing_contents + parse_pure_else: + bts dword [esp],1 + jc unexpected_instruction + test byte [esp],100b + jz parse_next_line + sub edi,4 + or byte [esp],1 + jmp skip_parsing + skip_parsing: + cmp esi,[source_start] + jae source_parsed + mov [current_line],esi + add esi,16 + skip_parsing_line: + cmp byte [esi],1Ah + jne skip_parsing_contents + inc esi + movzx ecx,byte [esi] + inc esi + cmp byte [esi+ecx],':' + je skip_parsing_label + push edi + call get_instruction + pop edi + jnc skip_parsing_instruction + add esi,ecx + jmp skip_parsing_contents + skip_parsing_label: + lea esi,[esi+ecx+1] + jmp skip_parsing_line + skip_parsing_instruction: + cmp bx,if_directive-instruction_handler + je skip_parsing_block + cmp bx,repeat_directive-instruction_handler + je skip_parsing_block + cmp bx,while_directive-instruction_handler + je skip_parsing_block + cmp bx,end_directive-instruction_handler + je skip_parsing_end_directive + cmp bx,else_directive-instruction_handler + je skip_parsing_else + skip_parsing_contents: + lods byte [esi] + or al,al + jz skip_parsing + cmp al,1Ah + je skip_parsing_symbol + cmp al,3Bh + je skip_parsing_symbol + cmp al,22h + je skip_parsing_string + jmp skip_parsing_contents + skip_parsing_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_parsing_contents + skip_parsing_string: + lods dword [esi] + add esi,eax + jmp skip_parsing_contents + skip_parsing_block: + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push [current_line] + mov ax,bx + shl eax,16 + push eax + inc [blocks_stack] + jmp skip_parsing_contents + skip_parsing_end_directive: + cmp byte [esi],1Ah + jne skip_parsing_contents + push edi + inc esi + movzx ecx,byte [esi] + inc esi + call get_instruction + pop edi + jnc skip_parsing_end_block + add esi,ecx + jmp skip_parsing_contents + skip_parsing_end_block: + lods byte [esi] + or al,al + jnz extra_characters_on_line + cmp bx,if_directive-instruction_handler + je close_skip_parsing_block + cmp bx,repeat_directive-instruction_handler + je close_skip_parsing_block + cmp bx,while_directive-instruction_handler + je close_skip_parsing_block + jmp skip_parsing + close_skip_parsing_block: + cmp [blocks_stack],0 + je unexpected_instruction + cmp bx,[esp+2] + jne unexpected_instruction + dec [blocks_stack] + pop eax edx + test al,1 + jz skip_parsing + cmp bx,if_directive-instruction_handler + jne parse_next_line + test al,10000b + jz parse_next_line + mov al,0Fh + stos byte [edi] + mov eax,[current_line] + stos dword [edi] + inc [parsed_lines] + mov eax,1 + (end_directive-instruction_handler) shl 8 + stos dword [edi] + mov eax,1 + (if_directive-instruction_handler) shl 8 + stos dword [edi] + jmp parse_next_line + skip_parsing_else: + cmp [blocks_stack],0 + je unexpected_instruction + cmp word [esp+2],if_directive-instruction_handler + jne unexpected_instruction + lods byte [esi] + or al,al + jz skip_parsing_pure_else + cmp al,1Ah + jne extra_characters_on_line + push edi + movzx ecx,byte [esi] + inc esi + call get_instruction + jc extra_characters_on_line + pop edi + cmp bx,if_directive-instruction_handler + jne extra_characters_on_line + mov al,[esp] + test al,1 + jz skip_parsing_contents + test al,100b + jnz skip_parsing_contents + test al,10000b + jnz parse_else_if + xor al,al + mov [esp],al + mov al,0Fh + stos byte [edi] + mov eax,[current_line] + stos dword [edi] + inc [parsed_lines] + parse_else_if: + mov eax,1 + (if_directive-instruction_handler) shl 8 + stos dword [edi] + jmp parse_if + skip_parsing_pure_else: + bts dword [esp],1 + jc unexpected_instruction + mov al,[esp] + test al,1 + jz skip_parsing + test al,100b + jnz skip_parsing + and al,not 1 + or al,1000b + mov [esp],al + jmp parse_next_line + +parse_line_contents: + mov [parenthesis_stack],0 + parse_instruction_arguments: + cmp bx,prefix_instruction-instruction_handler + je allow_embedded_instruction + cmp bx,times_directive-instruction_handler + je parse_times_directive + cmp bx,end_directive-instruction_handler + je allow_embedded_instruction + cmp bx,label_directive-instruction_handler + je parse_label_directive + cmp bx,segment_directive-instruction_handler + je parse_segment_directive + cmp bx,load_directive-instruction_handler + je parse_load_directive + cmp bx,extrn_directive-instruction_handler + je parse_extrn_directive + cmp bx,public_directive-instruction_handler + je parse_public_directive + cmp bx,section_directive-instruction_handler + je parse_formatter_argument + cmp bx,format_directive-instruction_handler + je parse_formatter_argument + cmp bx,data_directive-instruction_handler + je parse_formatter_argument + jmp parse_argument + parse_formatter_argument: + or [formatter_symbols_allowed],-1 + parse_argument: + lea eax,[edi+100h] + cmp eax,[labels_list] + jae out_of_memory + lods byte [esi] + cmp al,':' + je instruction_separator + cmp al,',' + je separator + cmp al,'=' + je expression_comparator + cmp al,'|' + je separator + cmp al,'&' + je separator + cmp al,'~' + je separator + cmp al,'>' + je greater + cmp al,'<' + je less + cmp al,')' + je close_parenthesis + or al,al + jz contents_parsed + cmp al,'[' + je address_argument + cmp al,']' + je separator + cmp al,'{' + je open_decorator + cmp al,'}' + je close_decorator + cmp al,'#' + je unallowed_character + cmp al,'`' + je unallowed_character + cmp al,3Bh + je foreign_argument + cmp [decorator_symbols_allowed],0 + je not_a_separator + cmp al,'-' + je separator + not_a_separator: + dec esi + cmp al,1Ah + jne expression_argument + push edi + mov edi,directive_operators + call get_operator + or al,al + jnz operator_argument + inc esi + movzx ecx,byte [esi] + inc esi + call get_symbol + jnc symbol_argument + cmp ecx,1 + jne check_argument + cmp byte [esi],'?' + jne check_argument + pop edi + movs byte [edi],[esi] + jmp argument_parsed + foreign_argument: + dec esi + call skip_foreign_line + jmp contents_parsed + symbol_argument: + pop edi + stos word [edi] + cmp byte [esi],'+' + jne argument_parsed + and ax,0F0FFh + cmp ax,6010h + jne argument_parsed + movs byte [edi],[esi] + jmp argument_parsed + operator_argument: + pop edi + cmp al,85h + je ptr_argument + stos byte [edi] + cmp al,8Ch + je forced_expression + cmp al,81h + je forced_parenthesis + cmp al,80h + je parse_at_operator + cmp al,82h + je parse_from_operator + cmp al,89h + je parse_label_operator + cmp al,0F8h + je forced_expression + jmp argument_parsed + instruction_separator: + stos byte [edi] + allow_embedded_instruction: + cmp byte [esi],1Ah + jne parse_argument + push edi + inc esi + movzx ecx,byte [esi] + inc esi + call get_instruction + jnc embedded_instruction + call get_data_directive + jnc embedded_instruction + pop edi + sub esi,2 + jmp parse_argument + embedded_instruction: + pop edi + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp parse_instruction_arguments + parse_times_directive: + mov al,'(' + stos byte [edi] + call convert_expression + mov al,')' + stos byte [edi] + cmp byte [esi],':' + jne allow_embedded_instruction + movs byte [edi],[esi] + jmp allow_embedded_instruction + parse_segment_directive: + or [formatter_symbols_allowed],-1 + parse_label_directive: + cmp byte [esi],1Ah + jne argument_parsed + push esi + inc esi + movzx ecx,byte [esi] + inc esi + call identify_label + pop ebx + cmp eax,0Fh + je non_label_identified + mov byte [edi],2 + inc edi + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + non_label_identified: + mov esi,ebx + jmp argument_parsed + parse_load_directive: + cmp byte [esi],1Ah + jne argument_parsed + push esi + inc esi + movzx ecx,byte [esi] + inc esi + call get_label_id + pop ebx + cmp eax,0Fh + je non_label_identified + mov byte [edi],2 + inc edi + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + parse_public_directive: + cmp byte [esi],1Ah + jne parse_argument + inc esi + push esi + movzx ecx,byte [esi] + inc esi + push esi ecx + push edi + or [formatter_symbols_allowed],-1 + call get_symbol + mov [formatter_symbols_allowed],0 + pop edi + jc parse_public_label + cmp al,1Dh + jne parse_public_label + add esp,12 + stos word [edi] + jmp parse_public_directive + parse_public_label: + pop ecx esi + mov al,2 + stos byte [edi] + call get_label_id + stos dword [edi] + mov ax,8600h + stos word [edi] + pop ebx + push ebx esi edi + mov edi,directive_operators + call get_operator + pop edi edx ebx + cmp al,86h + je argument_parsed + mov esi,edx + xchg esi,ebx + movzx ecx,byte [esi] + inc esi + mov ax,'(' + stos word [edi] + mov eax,ecx + stos dword [edi] + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + xchg esi,ebx + jmp argument_parsed + parse_extrn_directive: + cmp byte [esi],22h + je parse_quoted_extrn + cmp byte [esi],1Ah + jne parse_argument + push esi + movzx ecx,byte [esi+1] + add esi,2 + mov ax,'(' + stos word [edi] + mov eax,ecx + stos dword [edi] + rep movs byte [edi],[esi] + mov ax,8600h + stos word [edi] + pop esi + parse_label_operator: + cmp byte [esi],1Ah + jne argument_parsed + inc esi + movzx ecx,byte [esi] + inc esi + mov al,2 + stos byte [edi] + call get_label_id + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + parse_from_operator: + cmp byte [esi],22h + je argument_parsed + parse_at_operator: + cmp byte [esi],':' + je argument_parsed + jmp forced_multipart_expression + parse_quoted_extrn: + inc esi + mov ax,'(' + stos word [edi] + lods dword [esi] + mov ecx,eax + stos dword [edi] + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + push esi edi + mov edi,directive_operators + call get_operator + mov edx,esi + pop edi esi + cmp al,86h + jne argument_parsed + stos byte [edi] + mov esi,edx + jmp parse_label_operator + ptr_argument: + call parse_address + jmp address_parsed + check_argument: + push esi ecx + sub esi,2 + mov edi,single_operand_operators + call get_operator + pop ecx esi + or al,al + jnz not_instruction + call get_instruction + jnc embedded_instruction + call get_data_directive + jnc embedded_instruction + not_instruction: + pop edi + sub esi,2 + expression_argument: + cmp byte [esi],22h + jne not_string + mov eax,[esi+1] + lea ebx,[esi+5+eax] + push ebx ecx esi edi + call parse_expression + pop eax edx ecx ebx + cmp esi,ebx + jne expression_argument_parsed + mov edi,eax + mov esi,edx + string_argument: + inc esi + mov ax,'(' + stos word [edi] + lods dword [esi] + mov ecx,eax + stos dword [edi] + shr ecx,1 + jnc string_movsb_ok + movs byte [edi],[esi] + string_movsb_ok: + shr ecx,1 + jnc string_movsw_ok + movs word [edi],[esi] + string_movsw_ok: + rep movs dword [edi],[esi] + xor al,al + stos byte [edi] + jmp expression_argument_parsed + parse_expression: + mov al,'(' + stos byte [edi] + call convert_expression + mov al,')' + stos byte [edi] + ret + not_string: + cmp byte [esi],'(' + jne expression + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push esi edi + inc esi + mov al,91h + stos byte [edi] + inc [parenthesis_stack] + jmp parse_argument + expression_comparator: + stos byte [edi] + jmp forced_expression + greater: + cmp byte [esi],'=' + jne separator + inc esi + mov al,0F2h + jmp separator + less: + cmp byte [edi-1],0F6h + je separator + cmp byte [esi],'>' + je not_equal + cmp byte [esi],'=' + jne separator + inc esi + mov al,0F3h + jmp separator + not_equal: + inc esi + mov al,0F1h + jmp expression_comparator + expression: + call parse_expression + jmp expression_argument_parsed + forced_expression: + xor al,al + xchg al,[formatter_symbols_allowed] + push eax + call parse_expression + forced_expression_parsed: + pop eax + mov [formatter_symbols_allowed],al + jmp argument_parsed + forced_multipart_expression: + xor al,al + xchg al,[formatter_symbols_allowed] + push eax + call parse_expression + cmp byte [esi],':' + jne forced_expression_parsed + movs byte [edi],[esi] + call parse_expression + jmp forced_expression_parsed + address_argument: + call parse_address + lods byte [esi] + cmp al,']' + je address_parsed + cmp al,',' + je divided_address + dec esi + mov al,')' + stos byte [edi] + jmp argument_parsed + divided_address: + mov ax,'),' + stos word [edi] + jmp expression + address_parsed: + mov al,']' + stos byte [edi] + jmp argument_parsed + parse_address: + mov al,'[' + stos byte [edi] + cmp word [esi],021Ah + jne convert_address + push esi + add esi,4 + lea ebx,[esi+1] + cmp byte [esi],':' + pop esi + jne convert_address + add esi,2 + mov ecx,2 + push ebx edi + call get_symbol + pop edi esi + jc unknown_segment_prefix + cmp al,10h + jne unknown_segment_prefix + mov al,ah + and ah,11110000b + cmp ah,30h + jne unknown_segment_prefix + add al,30h + stos byte [edi] + jmp convert_address + unknown_segment_prefix: + sub esi,5 + convert_address: + push edi + mov edi,address_sizes + call get_operator + pop edi + or al,al + jz convert_expression + add al,70h + stos byte [edi] + jmp convert_expression + forced_parenthesis: + cmp byte [esi],'(' + jne argument_parsed + inc esi + mov al,91h + jmp separator + unallowed_character: + mov al,0FFh + jmp separator + open_decorator: + inc [decorator_symbols_allowed] + jmp separator + close_decorator: + dec [decorator_symbols_allowed] + jmp separator + close_parenthesis: + mov al,92h + separator: + stos byte [edi] + argument_parsed: + cmp [parenthesis_stack],0 + je parse_argument + dec [parenthesis_stack] + add esp,8 + jmp argument_parsed + expression_argument_parsed: + cmp [parenthesis_stack],0 + je parse_argument + cmp byte [esi],')' + jne argument_parsed + dec [parenthesis_stack] + pop edi esi + jmp expression + contents_parsed: + cmp [parenthesis_stack],0 + je contents_ok + dec [parenthesis_stack] + add esp,8 + jmp contents_parsed + contents_ok: + ret + +identify_label: + cmp byte [esi],'.' + je local_label_name + call get_label_id + cmp eax,10h + jb label_identified + or ebx,ebx + jz anonymous_label_name + dec ebx + mov [current_locals_prefix],ebx + label_identified: + ret + anonymous_label_name: + cmp byte [esi-1],'@' + je anonymous_label_name_ok + mov eax,0Fh + anonymous_label_name_ok: + ret + local_label_name: + call get_label_id + ret + +get_operator: + cmp byte [esi],1Ah + jne get_simple_operator + mov edx,esi + push ebp + inc esi + lods byte [esi] + movzx ebp,al + push edi + mov ecx,ebp + call lower_case + pop edi + check_operator: + mov esi,converted + movzx ecx,byte [edi] + jecxz no_operator + inc edi + mov ebx,edi + add ebx,ecx + cmp ecx,ebp + jne next_operator + repe cmps byte [esi],[edi] + je operator_found + jb no_operator + next_operator: + mov edi,ebx + inc edi + jmp check_operator + no_operator: + mov esi,edx + mov ecx,ebp + pop ebp + no_simple_operator: + xor al,al + ret + operator_found: + lea esi,[edx+2+ebp] + mov ecx,ebp + pop ebp + mov al,[edi] + ret + get_simple_operator: + mov al,[esi] + cmp al,22h + je no_simple_operator + simple_operator: + cmp byte [edi],1 + jb no_simple_operator + ja simple_next_operator + cmp al,[edi+1] + je simple_operator_found + simple_next_operator: + movzx ecx,byte [edi] + lea edi,[edi+1+ecx+1] + jmp simple_operator + simple_operator_found: + inc esi + mov al,[edi+2] + ret + +get_symbol: + push esi + mov ebp,ecx + call lower_case + mov ecx,ebp + cmp cl,11 + ja no_symbol + sub cl,1 + jc no_symbol + movzx ebx,word [symbols+ecx*4] + add ebx,symbols + movzx edx,word [symbols+ecx*4+2] + scan_symbols: + or edx,edx + jz no_symbol + mov eax,edx + shr eax,1 + lea edi,[ebp+2] + imul eax,edi + lea edi,[ebx+eax] + mov esi,converted + mov ecx,ebp + repe cmps byte [esi],[edi] + ja symbols_up + jb symbols_down + mov ax,[edi] + cmp al,18h + jb symbol_ok + cmp al,1Fh + je decorator_symbol + cmp [formatter_symbols_allowed],0 + je no_symbol + symbol_ok: + pop esi + add esi,ebp + clc + ret + decorator_symbol: + cmp [decorator_symbols_allowed],0 + jne symbol_ok + no_symbol: + pop esi + mov ecx,ebp + stc + ret + symbols_down: + shr edx,1 + jmp scan_symbols + symbols_up: + lea ebx,[edi+ecx+2] + shr edx,1 + adc edx,-1 + jmp scan_symbols + +get_data_directive: + push esi + mov ebp,ecx + call lower_case + mov ecx,ebp + cmp cl,4 + ja no_instruction + sub cl,2 + jc no_instruction + movzx ebx,word [data_directives+ecx*4] + add ebx,data_directives + movzx edx,word [data_directives+ecx*4+2] + jmp scan_instructions + +get_instruction: + push esi + mov ebp,ecx + call lower_case + mov ecx,ebp + cmp cl,17 + ja no_instruction + sub cl,2 + jc no_instruction + movzx ebx,word [instructions+ecx*4] + add ebx,instructions + movzx edx,word [instructions+ecx*4+2] + scan_instructions: + or edx,edx + jz no_instruction + mov eax,edx + shr eax,1 + lea edi,[ebp+3] + imul eax,edi + lea edi,[ebx+eax] + mov esi,converted + mov ecx,ebp + repe cmps byte [esi],[edi] + ja instructions_up + jb instructions_down + pop esi + add esi,ebp + mov al,[edi] + mov bx,[edi+1] + clc + ret + no_instruction: + pop esi + mov ecx,ebp + stc + ret + instructions_down: + shr edx,1 + jmp scan_instructions + instructions_up: + lea ebx,[edi+ecx+3] + shr edx,1 + adc edx,-1 + jmp scan_instructions + +get_label_id: + cmp ecx,100h + jae name_too_long + cmp byte [esi],'@' + je anonymous_label + cmp byte [esi],'.' + jne standard_label + cmp byte [esi+1],'.' + je standard_label + cmp [current_locals_prefix],0 + je standard_label + push edi + mov edi,[additional_memory_end] + sub edi,2 + sub edi,ecx + push ecx esi + mov esi,[current_locals_prefix] + lods byte [esi] + movzx ecx,al + sub edi,ecx + cmp edi,[free_additional_memory] + jb out_of_memory + mov word [edi],0 + add edi,2 + mov ebx,edi + rep movs byte [edi],[esi] + pop esi ecx + add al,cl + jc name_too_long + rep movs byte [edi],[esi] + pop edi + push ebx esi + movzx ecx,al + mov byte [ebx-1],al + mov esi,ebx + call get_label_id + pop esi ebx + cmp ebx,[eax+24] + jne composed_label_id_ok + lea edx,[ebx-2] + mov [additional_memory_end],edx + composed_label_id_ok: + ret + anonymous_label: + cmp ecx,2 + jne standard_label + mov al,[esi+1] + mov ebx,characters + xlat byte [ebx] + cmp al,'@' + je new_anonymous + cmp al,'b' + je anonymous_back + cmp al,'r' + je anonymous_back + cmp al,'f' + jne standard_label + add esi,2 + mov eax,[anonymous_forward] + or eax,eax + jnz anonymous_ok + mov eax,[current_line] + mov [error_line],eax + call allocate_label + mov [anonymous_forward],eax + anonymous_ok: + xor ebx,ebx + ret + anonymous_back: + mov eax,[anonymous_reverse] + add esi,2 + or eax,eax + jz bogus_anonymous + jmp anonymous_ok + bogus_anonymous: + call allocate_label + mov [anonymous_reverse],eax + jmp anonymous_ok + new_anonymous: + add esi,2 + mov eax,[anonymous_forward] + or eax,eax + jnz new_anonymous_ok + call allocate_label + new_anonymous_ok: + mov [anonymous_reverse],eax + mov [anonymous_forward],0 + jmp anonymous_ok + standard_label: + cmp byte [esi],'%' + je get_predefined_id + cmp byte [esi],'$' + je current_address_label + cmp byte [esi],'?' + jne find_label + cmp ecx,1 + jne find_label + inc esi + mov eax,0Fh + ret + current_address_label: + cmp ecx,3 + je current_address_label_3_characters + ja find_label + inc esi + cmp ecx,1 + jbe get_current_offset_id + inc esi + cmp byte [esi-1],'$' + je get_org_origin_id + cmp byte [esi-1],'%' + je get_file_offset_id + sub esi,2 + jmp find_label + get_current_offset_id: + xor eax,eax + ret + get_counter_id: + mov eax,1 + ret + get_timestamp_id: + mov eax,2 + ret + get_org_origin_id: + mov eax,3 + ret + get_file_offset_id: + mov eax,4 + ret + current_address_label_3_characters: + cmp word [esi+1],'%%' + jne find_label + add esi,3 + get_actual_file_offset_id: + mov eax,5 + ret + get_predefined_id: + cmp ecx,2 + ja find_label + inc esi + cmp cl,1 + je get_counter_id + lods byte [esi] + mov ebx,characters + xlat [ebx] + cmp al,'t' + je get_timestamp_id + sub esi,2 + find_label: + xor ebx,ebx + mov eax,2166136261 + mov ebp,16777619 + hash_label: + xor al,[esi+ebx] + mul ebp + inc bl + cmp bl,cl + jb hash_label + mov ebp,eax + shl eax,8 + and ebp,0FFh shl 24 + xor ebp,eax + or ebp,ebx + mov [label_hash],ebp + push edi esi + push ecx + mov ecx,32 + mov ebx,hash_tree + follow_tree: + mov edx,[ebx] + or edx,edx + jz extend_tree + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec ecx + jnz follow_tree + mov [label_leaf],ebx + pop edx + mov eax,[ebx] + or eax,eax + jz add_label + mov ebx,esi + mov ebp,[label_hash] + compare_labels: + mov esi,ebx + mov ecx,edx + mov edi,[eax+4] + mov edi,[edi+24] + repe cmps byte [esi],[edi] + je label_found + mov eax,[eax] + or eax,eax + jnz compare_labels + jmp add_label + label_found: + add esp,4 + pop edi + mov eax,[eax+4] + ret + extend_tree: + mov edx,[free_additional_memory] + lea eax,[edx+8] + cmp eax,[additional_memory_end] + ja out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [edx],eax + mov [edx+4],eax + shl ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + dec ecx + jnz extend_tree + mov [label_leaf],ebx + pop edx + add_label: + mov ecx,edx + pop esi + cmp byte [esi-2],0 + je label_name_ok + mov al,[esi] + cmp al,30h + jb name_first_char_ok + cmp al,39h + jbe numeric_name + name_first_char_ok: + cmp al,'$' + jne check_for_reserved_word + numeric_name: + add esi,ecx + reserved_word: + mov eax,0Fh + pop edi + ret + check_for_reserved_word: + call get_instruction + jnc reserved_word + call get_data_directive + jnc reserved_word + call get_symbol + jnc reserved_word + sub esi,2 + mov edi,operators + call get_operator + or al,al + jnz reserved_word + mov edi,single_operand_operators + call get_operator + or al,al + jnz reserved_word + mov edi,directive_operators + call get_operator + or al,al + jnz reserved_word + inc esi + movzx ecx,byte [esi] + inc esi + label_name_ok: + mov edx,[free_additional_memory] + lea eax,[edx+8] + cmp eax,[additional_memory_end] + ja out_of_memory + mov [free_additional_memory],eax + mov ebx,esi + add esi,ecx + mov eax,[label_leaf] + mov edi,[eax] + mov [edx],edi + mov [eax],edx + call allocate_label + mov [edx+4],eax + mov [eax+24],ebx + pop edi + ret + allocate_label: + mov eax,[labels_list] + mov ecx,LABEL_STRUCTURE_SIZE shr 2 + initialize_label: + sub eax,4 + mov dword [eax],0 + loop initialize_label + mov [labels_list],eax + ret + +LABEL_STRUCTURE_SIZE = 32 diff --git a/programs/develop/koldbg/fasm/preproce.inc b/programs/develop/koldbg/fasm/preproce.inc new file mode 100644 index 0000000000..f918cdd47c --- /dev/null +++ b/programs/develop/koldbg/fasm/preproce.inc @@ -0,0 +1,2899 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +preprocessor: + mov edi,characters + xor al,al + make_characters_table: + stosb + inc al + jnz make_characters_table + mov esi,characters+'a' + mov edi,characters+'A' + mov ecx,26 + rep movsb + mov edi,characters + mov esi,symbol_characters+1 + movzx ecx,byte [esi-1] + xor eax,eax + mark_symbol_characters: + lodsb + mov byte [edi+eax],0 + loop mark_symbol_characters + mov edi,locals_counter + mov ax,1 + '0' shl 8 + stos word [edi] + mov edi,[memory_start] + mov [include_paths],edi + mov esi,include_variable + call get_environment_variable + xor al,al + stos byte [edi] + mov [memory_start],edi + mov eax,[additional_memory] + mov [free_additional_memory],eax + mov eax,[additional_memory_end] + mov [labels_list],eax + xor eax,eax + mov [source_start],eax + mov [tagged_blocks],eax + mov [hash_tree],eax + mov [error],eax + mov [macro_status],al + mov [current_line],eax + mov esi,[initial_definitions] + test esi,esi + jz predefinitions_ok + process_predefinitions: + movzx ecx,byte [esi] + test ecx,ecx + jz predefinitions_ok + inc esi + lea eax,[esi+ecx] + push eax + mov ch,10b + call add_preprocessor_symbol + pop esi + mov edi,[memory_start] + mov [edx+8],edi + convert_predefinition: + cmp edi,[memory_end] + jae out_of_memory + lods byte [esi] + or al,al + jz predefinition_converted + cmp al,20h + je convert_predefinition + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz predefinition_separator + cmp ah,27h + je predefinition_string + cmp ah,22h + je predefinition_string + mov byte [edi],1Ah + scas word [edi] + xchg al,ah + stos byte [edi] + mov ebx,characters + xor ecx,ecx + predefinition_symbol: + lods byte [esi] + stos byte [edi] + xlat byte [ebx] + or al,al + loopnzd predefinition_symbol + neg ecx + cmp ecx,255 + ja invalid_definition + mov ebx,edi + sub ebx,ecx + mov byte [ebx-2],cl + found_predefinition_separator: + dec edi + mov ah,[esi-1] + predefinition_separator: + xchg al,ah + or al,al + jz predefinition_converted + cmp al,20h + je convert_predefinition + cmp al,3Bh + je invalid_definition + cmp al,5Ch + je predefinition_backslash + stos byte [edi] + jmp convert_predefinition + predefinition_string: + mov al,22h + stos byte [edi] + scas dword [edi] + mov ebx,edi + copy_predefinition_string: + lods byte [esi] + stos byte [edi] + or al,al + jz invalid_definition + cmp al,ah + jne copy_predefinition_string + lods byte [esi] + cmp al,ah + je copy_predefinition_string + dec esi + dec edi + mov eax,edi + sub eax,ebx + mov [ebx-4],eax + jmp convert_predefinition + predefinition_backslash: + mov byte [edi],0 + lods byte [esi] + or al,al + jz invalid_definition + cmp al,20h + je invalid_definition + cmp al,3Bh + je invalid_definition + mov al,1Ah + stos byte [edi] + mov ecx,edi + mov ax,5C01h + stos word [edi] + dec esi + group_predefinition_backslashes: + lods byte [esi] + cmp al,5Ch + jne predefinition_backslashed_symbol + stos byte [edi] + inc byte [ecx] + jmp group_predefinition_backslashes + predefinition_backslashed_symbol: + cmp al,20h + je invalid_definition + cmp al,22h + je invalid_definition + cmp al,27h + je invalid_definition + cmp al,3Bh + je invalid_definition + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz predefinition_backslashed_symbol_character + mov al,ah + convert_predefinition_backslashed_symbol: + stos byte [edi] + xlat byte [ebx] + or al,al + jz found_predefinition_separator + inc byte [ecx] + jz invalid_definition + lods byte [esi] + jmp convert_predefinition_backslashed_symbol + predefinition_backslashed_symbol_character: + mov al,ah + stos byte [edi] + inc byte [ecx] + jmp convert_predefinition + predefinition_converted: + mov [memory_start],edi + sub edi,[edx+8] + mov [edx+12],edi + jmp process_predefinitions + predefinitions_ok: + mov esi,[input_file] + mov edx,esi + call open + jc main_file_not_found + mov edi,[memory_start] + call preprocess_file + cmp [macro_status],0 + je process_postponed + mov eax,[error_line] + mov [current_line],eax + jmp incomplete_macro + process_postponed: + mov edx,hash_tree + mov ecx,32 + find_postponed_list: + mov edx,[edx] + or edx,edx + loopnz find_postponed_list + jz preprocessing_finished + process_postponed_list: + mov eax,[edx] + or eax,eax + jz preprocessing_finished + push edx + mov ebx,edx + find_earliest_postponed: + mov eax,[edx] + or eax,eax + jz earliest_postponed_found + mov ebx,edx + mov edx,eax + jmp find_earliest_postponed + earliest_postponed_found: + mov [ebx],eax + call use_postponed_macro + pop edx + cmp [macro_status],0 + je process_postponed_list + mov eax,[error_line] + mov [current_line],eax + jmp incomplete_macro + preprocessing_finished: + mov [source_start],edi + ret + use_postponed_macro: + lea esi,[edi-1] + push ecx esi + mov [struc_name],0 + jmp use_macro + +preprocess_file: + push [memory_end] + push esi + mov al,2 + xor edx,edx + call lseek + push eax + xor al,al + xor edx,edx + call lseek + pop ecx + mov edx,[memory_end] + dec edx + mov byte [edx],1Ah + sub edx,ecx + jc out_of_memory + mov esi,edx + cmp edx,edi + jbe out_of_memory + mov [memory_end],edx + call read + call close + pop edx + xor ecx,ecx + mov ebx,esi + preprocess_source: + inc ecx + mov [current_line],edi + mov eax,edx + stos dword [edi] + mov eax,ecx + stos dword [edi] + mov eax,esi + sub eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + push ebx edx + call convert_line + call preprocess_line + pop edx ebx + next_line: + cmp byte [esi-1],0 + je file_end + cmp byte [esi-1],1Ah + jne preprocess_source + file_end: + pop [memory_end] + clc + ret + +convert_line: + push ecx + test [macro_status],0Fh + jz convert_line_data + mov ax,3Bh + stos word [edi] + convert_line_data: + cmp edi,[memory_end] + jae out_of_memory + lods byte [esi] + cmp al,20h + je convert_line_data + cmp al,9 + je convert_line_data + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz convert_separator + cmp ah,27h + je convert_string + cmp ah,22h + je convert_string + mov byte [edi],1Ah + scas word [edi] + xchg al,ah + stos byte [edi] + mov ebx,characters + xor ecx,ecx + convert_symbol: + lods byte [esi] + stos byte [edi] + xlat byte [ebx] + or al,al + loopnzd convert_symbol + neg ecx + cmp ecx,255 + ja name_too_long + mov ebx,edi + sub ebx,ecx + mov byte [ebx-2],cl + found_separator: + dec edi + mov ah,[esi-1] + convert_separator: + xchg al,ah + cmp al,20h + jb control_character + je convert_line_data + symbol_character: + cmp al,3Bh + je ignore_comment + cmp al,5Ch + je backslash_character + stos byte [edi] + jmp convert_line_data + control_character: + cmp al,1Ah + je line_end + cmp al,0Dh + je cr_character + cmp al,0Ah + je lf_character + cmp al,9 + je convert_line_data + or al,al + jnz symbol_character + jmp line_end + lf_character: + lods byte [esi] + cmp al,0Dh + je line_end + dec esi + jmp line_end + cr_character: + lods byte [esi] + cmp al,0Ah + je line_end + dec esi + jmp line_end + convert_string: + mov al,22h + stos byte [edi] + scas dword [edi] + mov ebx,edi + copy_string: + lods byte [esi] + stos byte [edi] + cmp al,0Ah + je no_end_quote + cmp al,0Dh + je no_end_quote + or al,al + jz no_end_quote + cmp al,1Ah + je no_end_quote + cmp al,ah + jne copy_string + lods byte [esi] + cmp al,ah + je copy_string + dec esi + dec edi + mov eax,edi + sub eax,ebx + mov [ebx-4],eax + jmp convert_line_data + backslash_character: + mov byte [edi],0 + lods byte [esi] + cmp al,20h + je concatenate_lines + cmp al,9 + je concatenate_lines + cmp al,1Ah + je unexpected_end_of_file + or al,al + jz unexpected_end_of_file + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + cmp al,3Bh + je find_concatenated_line + mov al,1Ah + stos byte [edi] + mov ecx,edi + mov ax,5C01h + stos word [edi] + dec esi + group_backslashes: + lods byte [esi] + cmp al,5Ch + jne backslashed_symbol + stos byte [edi] + inc byte [ecx] + jz name_too_long + jmp group_backslashes + no_end_quote: + mov byte [ebx-5],0 + jmp missing_end_quote + backslashed_symbol: + cmp al,1Ah + je unexpected_end_of_file + or al,al + jz unexpected_end_of_file + cmp al,0Ah + je extra_characters_on_line + cmp al,0Dh + je extra_characters_on_line + cmp al,20h + je extra_characters_on_line + cmp al,9 + je extra_characters_on_line + cmp al,22h + je extra_characters_on_line + cmp al,27h + je extra_characters_on_line + cmp al,3Bh + je extra_characters_on_line + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz backslashed_symbol_character + mov al,ah + convert_backslashed_symbol: + stos byte [edi] + xlat byte [ebx] + or al,al + jz found_separator + inc byte [ecx] + jz name_too_long + lods byte [esi] + jmp convert_backslashed_symbol + backslashed_symbol_character: + mov al,ah + stos byte [edi] + inc byte [ecx] + jmp convert_line_data + concatenate_lines: + lods byte [esi] + cmp al,20h + je concatenate_lines + cmp al,9 + je concatenate_lines + cmp al,1Ah + je unexpected_end_of_file + or al,al + jz unexpected_end_of_file + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + cmp al,3Bh + jne extra_characters_on_line + find_concatenated_line: + lods byte [esi] + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + or al,al + jz concatenate_ok + cmp al,1Ah + jne find_concatenated_line + jmp unexpected_end_of_file + concatenate_lf: + lods byte [esi] + cmp al,0Dh + je concatenate_ok + dec esi + jmp concatenate_ok + concatenate_cr: + lods byte [esi] + cmp al,0Ah + je concatenate_ok + dec esi + concatenate_ok: + inc dword [esp] + jmp convert_line_data + ignore_comment: + lods byte [esi] + cmp al,0Ah + je lf_character + cmp al,0Dh + je cr_character + or al,al + jz line_end + cmp al,1Ah + jne ignore_comment + line_end: + xor al,al + stos byte [edi] + pop ecx + ret + +lower_case: + mov edi,converted + mov ebx,characters + convert_case: + lods byte [esi] + xlat byte [ebx] + stos byte [edi] + loop convert_case + case_ok: + ret + +get_directive: + push edi + mov edx,esi + mov ebp,ecx + call lower_case + pop edi + scan_directives: + mov esi,converted + movzx eax,byte [edi] + or al,al + jz no_directive + mov ecx,ebp + inc edi + mov ebx,edi + add ebx,eax + mov ah,[esi] + cmp ah,[edi] + jb no_directive + ja next_directive + cmp cl,al + jne next_directive + repe cmps byte [esi],[edi] + jb no_directive + je directive_found + next_directive: + mov edi,ebx + add edi,2 + jmp scan_directives + no_directive: + mov esi,edx + mov ecx,ebp + stc + ret + directive_found: + call get_directive_handler_base + directive_handler: + lea esi,[edx+ebp] + movzx ecx,word [ebx] + add eax,ecx + clc + ret + get_directive_handler_base: + mov eax,[esp] + ret + +preprocess_line: + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push ecx esi + preprocess_current_line: + mov esi,[current_line] + add esi,16 + cmp word [esi],3Bh + jne line_start_ok + add esi,2 + line_start_ok: + test [macro_status],0F0h + jnz macro_preprocessing + cmp byte [esi],1Ah + jne not_fix_constant + movzx edx,byte [esi+1] + lea edx,[esi+2+edx] + cmp word [edx],031Ah + jne not_fix_constant + mov ebx,characters + movzx eax,byte [edx+2] + xlat byte [ebx] + ror eax,8 + mov al,[edx+3] + xlat byte [ebx] + ror eax,8 + mov al,[edx+4] + xlat byte [ebx] + ror eax,16 + cmp eax,'fix' + je define_fix_constant + not_fix_constant: + call process_fix_constants + jmp initial_preprocessing_ok + macro_preprocessing: + call process_macro_operators + initial_preprocessing_ok: + mov esi,[current_line] + add esi,16 + mov al,[macro_status] + test al,2 + jnz skip_macro_block + test al,1 + jnz find_macro_block + preprocess_instruction: + mov [current_offset],esi + lods byte [esi] + movzx ecx,byte [esi] + inc esi + cmp al,1Ah + jne not_preprocessor_symbol + cmp cl,3 + jb not_preprocessor_directive + push edi + mov edi,preprocessor_directives + call get_directive + pop edi + jc not_preprocessor_directive + mov byte [edx-2],3Bh + jmp near eax + not_preprocessor_directive: + xor ch,ch + call get_preprocessor_symbol + jc not_macro + mov byte [ebx-2],3Bh + mov [struc_name],0 + jmp use_macro + not_macro: + mov [struc_name],esi + add esi,ecx + lods byte [esi] + cmp al,':' + je preprocess_label + cmp al,1Ah + jne not_preprocessor_symbol + lods byte [esi] + cmp al,3 + jne not_symbolic_constant + mov ebx,characters + movzx eax,byte [esi] + xlat byte [ebx] + ror eax,8 + mov al,[esi+1] + xlat byte [ebx] + ror eax,8 + mov al,[esi+2] + xlat byte [ebx] + ror eax,16 + cmp eax,'equ' + je define_equ_constant + mov al,3 + not_symbolic_constant: + mov ch,1 + mov cl,al + call get_preprocessor_symbol + jc not_preprocessor_symbol + push edx esi + mov esi,[struc_name] + mov [struc_label],esi + sub [struc_label],2 + mov cl,[esi-1] + mov ch,10b + call get_preprocessor_symbol + jc struc_name_ok + mov ecx,[edx+12] + add ecx,3 + lea ebx,[edi+ecx] + mov ecx,edi + sub ecx,[struc_label] + lea esi,[edi-1] + lea edi,[ebx-1] + std + rep movs byte [edi],[esi] + cld + mov edi,[struc_label] + mov esi,[edx+8] + mov ecx,[edx+12] + add [struc_name],ecx + add [struc_name],3 + call move_data + mov al,3Ah + stos byte [edi] + mov ax,3Bh + stos word [edi] + mov edi,ebx + pop esi + add esi,[edx+12] + add esi,3 + pop edx + jmp use_macro + struc_name_ok: + mov edx,[struc_name] + movzx eax,byte [edx-1] + add edx,eax + push edi + lea esi,[edi-1] + mov ecx,edi + sub ecx,edx + std + rep movs byte [edi],[esi] + cld + pop edi + inc edi + mov al,3Ah + mov [edx],al + inc al + mov [edx+1],al + pop esi edx + inc esi + jmp use_macro + preprocess_label: + dec esi + sub esi,ecx + lea ebp,[esi-2] + mov ch,10b + call get_preprocessor_symbol + jnc symbolic_constant_in_label + lea esi,[esi+ecx+1] + cmp byte [esi],':' + jne preprocess_instruction + inc esi + jmp preprocess_instruction + symbolic_constant_in_label: + mov ebx,[edx+8] + mov ecx,[edx+12] + add ecx,ebx + check_for_broken_label: + cmp ebx,ecx + je label_broken + cmp byte [ebx],1Ah + jne label_broken + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp ebx,ecx + je label_constant_ok + cmp byte [ebx],':' + jne label_broken + inc ebx + cmp byte [ebx],':' + jne check_for_broken_label + inc ebx + jmp check_for_broken_label + label_broken: + push line_preprocessed + jmp replace_symbolic_constant + label_constant_ok: + mov ecx,edi + sub ecx,esi + mov edi,[edx+12] + add edi,ebp + push edi + lea eax,[edi+ecx] + push eax + cmp esi,edi + je replace_label + jb move_rest_of_line_up + rep movs byte [edi],[esi] + jmp replace_label + move_rest_of_line_up: + lea esi,[esi+ecx-1] + lea edi,[edi+ecx-1] + std + rep movs byte [edi],[esi] + cld + replace_label: + mov ecx,[edx+12] + mov edi,[esp+4] + sub edi,ecx + mov esi,[edx+8] + rep movs byte [edi],[esi] + pop edi esi + inc esi + jmp preprocess_instruction + not_preprocessor_symbol: + mov esi,[current_offset] + call process_equ_constants + line_preprocessed: + pop esi ecx + ret + +get_preprocessor_symbol: + push ebp edi esi + mov ebp,ecx + shl ebp,22 + movzx ecx,cl + mov ebx,hash_tree + mov edi,10 + follow_hashes_roots: + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec edi + jnz follow_hashes_roots + mov edi,ebx + call calculate_hash + mov ebp,eax + and ebp,3FFh + shl ebp,10 + xor ebp,eax + mov ebx,edi + mov edi,22 + follow_hashes_tree: + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec edi + jnz follow_hashes_tree + mov al,cl + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + compare_with_preprocessor_symbol: + mov edi,[edx+4] + cmp edi,1 + jbe next_equal_hash + repe cmps byte [esi],[edi] + je preprocessor_symbol_found + mov cl,al + mov esi,[esp] + next_equal_hash: + mov edx,[edx] + or edx,edx + jnz compare_with_preprocessor_symbol + preprocessor_symbol_not_found: + pop esi edi ebp + stc + ret + preprocessor_symbol_found: + pop ebx edi ebp + clc + ret + calculate_hash: + xor ebx,ebx + mov eax,2166136261 + mov ebp,16777619 + fnv1a_hash: + xor al,[esi+ebx] + mul ebp + inc bl + cmp bl,cl + jb fnv1a_hash + ret +add_preprocessor_symbol: + push edi esi + xor eax,eax + or cl,cl + jz reshape_hash + cmp ch,11b + je preprocessor_symbol_name_ok + push ecx + movzx ecx,cl + mov edi,preprocessor_directives + call get_directive + jnc reserved_word_used_as_symbol + pop ecx + preprocessor_symbol_name_ok: + call calculate_hash + reshape_hash: + mov ebp,eax + and ebp,3FFh + shr eax,10 + xor ebp,eax + shl ecx,22 + or ebp,ecx + mov ebx,hash_tree + mov ecx,32 + find_leave_for_symbol: + mov edx,[ebx] + or edx,edx + jz extend_hashes_tree + xor eax,eax + rol ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec ecx + jnz find_leave_for_symbol + mov edx,[ebx] + or edx,edx + jz add_symbol_entry + shr ebp,30 + cmp ebp,11b + je reuse_symbol_entry + cmp dword [edx+4],0 + jne add_symbol_entry + find_entry_to_reuse: + mov edi,[edx] + or edi,edi + jz reuse_symbol_entry + cmp dword [edi+4],0 + jne reuse_symbol_entry + mov edx,edi + jmp find_entry_to_reuse + add_symbol_entry: + mov eax,edx + mov edx,[labels_list] + sub edx,16 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + mov [edx],eax + mov [ebx],edx + reuse_symbol_entry: + pop esi edi + mov [edx+4],esi + ret + extend_hashes_tree: + mov edx,[labels_list] + sub edx,8 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + xor eax,eax + mov [edx],eax + mov [edx+4],eax + shl ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + dec ecx + jnz extend_hashes_tree + mov edx,[labels_list] + sub edx,16 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + mov dword [edx],0 + mov [ebx],edx + pop esi edi + mov [edx+4],esi + ret + +define_fix_constant: + add edx,5 + add esi,2 + push edx + mov ch,11b + jmp define_preprocessor_constant +define_equ_constant: + add esi,3 + push esi + call process_equ_constants + mov esi,[struc_name] + mov ch,10b + define_preprocessor_constant: + mov byte [esi-2],3Bh + mov cl,[esi-1] + call add_preprocessor_symbol + pop ebx + mov ecx,edi + dec ecx + sub ecx,ebx + mov [edx+8],ebx + mov [edx+12],ecx + jmp line_preprocessed +define_symbolic_constant: + lods byte [esi] + cmp al,1Ah + jne invalid_name + lods byte [esi] + mov cl,al + mov ch,10b + call add_preprocessor_symbol + movzx eax,byte [esi-1] + add esi,eax + lea ecx,[edi-1] + sub ecx,esi + mov [edx+8],esi + mov [edx+12],ecx + jmp line_preprocessed + +define_struc: + mov ch,1 + jmp make_macro +define_macro: + xor ch,ch + make_macro: + lods byte [esi] + cmp al,1Ah + jne invalid_name + lods byte [esi] + mov cl,al + call add_preprocessor_symbol + mov eax,[current_line] + mov [edx+12],eax + movzx eax,byte [esi-1] + add esi,eax + mov [edx+8],esi + mov al,[macro_status] + and al,0F0h + or al,1 + mov [macro_status],al + mov eax,[current_line] + mov [error_line],eax + xor ebp,ebp + lods byte [esi] + or al,al + jz line_preprocessed + cmp al,'{' + je found_macro_block + dec esi + skip_macro_arguments: + lods byte [esi] + cmp al,1Ah + je skip_macro_argument + cmp al,'[' + jne invalid_macro_arguments + or ebp,-1 + jz invalid_macro_arguments + lods byte [esi] + cmp al,1Ah + jne invalid_macro_arguments + skip_macro_argument: + movzx eax,byte [esi] + inc esi + add esi,eax + lods byte [esi] + cmp al,':' + je macro_argument_with_default_value + cmp al,'=' + je macro_argument_with_default_value + cmp al,'*' + jne macro_argument_end + lods byte [esi] + macro_argument_end: + cmp al,',' + je skip_macro_arguments + cmp al,'&' + je macro_arguments_finisher + cmp al,']' + jne end_macro_arguments + not ebp + macro_arguments_finisher: + lods byte [esi] + end_macro_arguments: + or ebp,ebp + jnz invalid_macro_arguments + or al,al + jz line_preprocessed + cmp al,'{' + je found_macro_block + jmp invalid_macro_arguments + macro_argument_with_default_value: + or [skip_default_argument_value],-1 + call skip_macro_argument_value + inc esi + jmp macro_argument_end + skip_macro_argument_value: + cmp byte [esi],'<' + jne simple_argument + mov ecx,1 + inc esi + enclosed_argument: + lods byte [esi] + or al,al + jz invalid_macro_arguments + cmp al,1Ah + je enclosed_symbol + cmp al,22h + je enclosed_string + cmp al,'>' + je enclosed_argument_end + cmp al,'<' + jne enclosed_argument + inc ecx + jmp enclosed_argument + enclosed_symbol: + movzx eax,byte [esi] + inc esi + add esi,eax + jmp enclosed_argument + enclosed_string: + lods dword [esi] + add esi,eax + jmp enclosed_argument + enclosed_argument_end: + loop enclosed_argument + lods byte [esi] + or al,al + jz argument_value_end + cmp al,',' + je argument_value_end + cmp [skip_default_argument_value],0 + je invalid_macro_arguments + cmp al,'{' + je argument_value_end + cmp al,'&' + je argument_value_end + or ebp,ebp + jz invalid_macro_arguments + cmp al,']' + je argument_value_end + jmp invalid_macro_arguments + simple_argument: + lods byte [esi] + or al,al + jz argument_value_end + cmp al,',' + je argument_value_end + cmp al,22h + je argument_string + cmp al,1Ah + je argument_symbol + cmp [skip_default_argument_value],0 + je simple_argument + cmp al,'{' + je argument_value_end + cmp al,'&' + je argument_value_end + or ebp,ebp + jz simple_argument + cmp al,']' + je argument_value_end + argument_symbol: + movzx eax,byte [esi] + inc esi + add esi,eax + jmp simple_argument + argument_string: + lods dword [esi] + add esi,eax + jmp simple_argument + argument_value_end: + dec esi + ret + find_macro_block: + add esi,2 + lods byte [esi] + or al,al + jz line_preprocessed + cmp al,'{' + jne unexpected_characters + found_macro_block: + or [macro_status],2 + skip_macro_block: + lods byte [esi] + cmp al,1Ah + je skip_macro_symbol + cmp al,3Bh + je skip_macro_symbol + cmp al,22h + je skip_macro_string + or al,al + jz line_preprocessed + cmp al,'}' + jne skip_macro_block + mov al,[macro_status] + and [macro_status],0F0h + test al,8 + jnz use_instant_macro + cmp byte [esi],0 + je line_preprocessed + mov ecx,edi + sub ecx,esi + mov edx,esi + lea esi,[esi+ecx-1] + lea edi,[edi+1+16] + mov ebx,edi + dec edi + std + rep movs byte [edi],[esi] + cld + mov edi,edx + xor al,al + stos byte [edi] + mov esi,[current_line] + mov [current_line],edi + mov ecx,4 + rep movs dword [edi],[esi] + mov edi,ebx + jmp initial_preprocessing_ok + skip_macro_symbol: + movzx eax,byte [esi] + inc esi + add esi,eax + jmp skip_macro_block + skip_macro_string: + lods dword [esi] + add esi,eax + jmp skip_macro_block +postpone_directive: + push esi + mov esi,edx + xor ecx,ecx + call add_preprocessor_symbol + mov eax,[current_line] + mov [error_line],eax + mov [edx+12],eax + pop esi + mov [edx+8],esi + mov al,[macro_status] + and al,0F0h + or al,1 + mov [macro_status],al + lods byte [esi] + or al,al + jz line_preprocessed + cmp al,'{' + jne unexpected_characters + jmp found_macro_block +rept_directive: + mov [base_code],0 + jmp define_instant_macro +irp_directive: + mov [base_code],1 + jmp define_instant_macro +irps_directive: + mov [base_code],2 + jmp define_instant_macro +irpv_directive: + mov [base_code],3 + jmp define_instant_macro +match_directive: + mov [base_code],10h +define_instant_macro: + mov al,[macro_status] + and al,0F0h + or al,8+1 + mov [macro_status],al + mov eax,[current_line] + mov [error_line],eax + mov [instant_macro_start],esi + cmp [base_code],10h + je prepare_match + skip_parameters: + lods byte [esi] + or al,al + jz parameters_skipped + cmp al,'{' + je parameters_skipped + cmp al,22h + je skip_quoted_parameter + cmp al,1Ah + jne skip_parameters + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_parameters + skip_quoted_parameter: + lods dword [esi] + add esi,eax + jmp skip_parameters + parameters_skipped: + dec esi + mov [parameters_end],esi + lods byte [esi] + cmp al,'{' + je found_macro_block + or al,al + jnz invalid_macro_arguments + jmp line_preprocessed +prepare_match: + call skip_pattern + mov [value_type],80h+10b + call process_symbolic_constants + jmp parameters_skipped + skip_pattern: + lods byte [esi] + or al,al + jz invalid_macro_arguments + cmp al,',' + je pattern_skipped + cmp al,22h + je skip_quoted_string_in_pattern + cmp al,1Ah + je skip_symbol_in_pattern + cmp al,'=' + jne skip_pattern + mov al,[esi] + cmp al,1Ah + je skip_pattern + cmp al,22h + je skip_pattern + inc esi + jmp skip_pattern + skip_symbol_in_pattern: + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_pattern + skip_quoted_string_in_pattern: + lods dword [esi] + add esi,eax + jmp skip_pattern + pattern_skipped: + ret + +purge_macro: + xor ch,ch + jmp restore_preprocessor_symbol +purge_struc: + mov ch,1 + jmp restore_preprocessor_symbol +restore_equ_constant: + mov ch,10b + restore_preprocessor_symbol: + push ecx + lods byte [esi] + cmp al,1Ah + jne invalid_name + lods byte [esi] + mov cl,al + call get_preprocessor_symbol + jc no_symbol_to_restore + mov dword [edx+4],0 + jmp symbol_restored + no_symbol_to_restore: + add esi,ecx + symbol_restored: + pop ecx + lods byte [esi] + cmp al,',' + je restore_preprocessor_symbol + or al,al + jnz extra_characters_on_line + jmp line_preprocessed + +process_fix_constants: + mov [value_type],11b + jmp process_symbolic_constants +process_equ_constants: + mov [value_type],10b + process_symbolic_constants: + mov ebp,esi + lods byte [esi] + cmp al,1Ah + je check_symbol + cmp al,22h + je ignore_string + cmp al,'{' + je check_brace + or al,al + jnz process_symbolic_constants + ret + ignore_string: + lods dword [esi] + add esi,eax + jmp process_symbolic_constants + check_brace: + test [value_type],80h + jz process_symbolic_constants + ret + no_replacing: + movzx ecx,byte [esi-1] + add esi,ecx + jmp process_symbolic_constants + check_symbol: + mov cl,[esi] + inc esi + mov ch,[value_type] + call get_preprocessor_symbol + jc no_replacing + mov [current_section],edi + replace_symbolic_constant: + mov ecx,[edx+12] + mov edx,[edx+8] + xchg esi,edx + call move_data + mov esi,edx + process_after_replaced: + lods byte [esi] + cmp al,1Ah + je symbol_after_replaced + stos byte [edi] + cmp al,22h + je string_after_replaced + cmp al,'{' + je brace_after_replaced + or al,al + jnz process_after_replaced + mov ecx,edi + sub ecx,esi + mov edi,ebp + call move_data + mov esi,edi + ret + move_data: + lea eax,[edi+ecx] + cmp eax,[memory_end] + jae out_of_memory + shr ecx,1 + jnc movsb_ok + movs byte [edi],[esi] + movsb_ok: + shr ecx,1 + jnc movsw_ok + movs word [edi],[esi] + movsw_ok: + rep movs dword [edi],[esi] + ret + string_after_replaced: + lods dword [esi] + stos dword [edi] + mov ecx,eax + call move_data + jmp process_after_replaced + brace_after_replaced: + test [value_type],80h + jz process_after_replaced + mov edx,edi + mov ecx,[current_section] + sub edx,ecx + sub ecx,esi + rep movs byte [edi],[esi] + mov ecx,edi + sub ecx,esi + mov edi,ebp + call move_data + lea esi,[ebp+edx] + ret + symbol_after_replaced: + mov cl,[esi] + inc esi + mov ch,[value_type] + call get_preprocessor_symbol + jnc replace_symbolic_constant + movzx ecx,byte [esi-1] + mov al,1Ah + mov ah,cl + stos word [edi] + call move_data + jmp process_after_replaced +process_macro_operators: + xor dl,dl + mov ebp,edi + before_macro_operators: + mov edi,esi + lods byte [esi] + cmp al,'`' + je symbol_conversion + cmp al,'#' + je concatenation + cmp al,1Ah + je symbol_before_macro_operators + cmp al,3Bh + je no_more_macro_operators + cmp al,22h + je string_before_macro_operators + xor dl,dl + or al,al + jnz before_macro_operators + mov edi,esi + ret + no_more_macro_operators: + mov edi,ebp + ret + symbol_before_macro_operators: + mov dl,1Ah + mov ebx,esi + lods byte [esi] + movzx ecx,al + jecxz symbol_before_macro_operators_ok + mov edi,esi + cmp byte [esi],'\' + je escaped_symbol + symbol_before_macro_operators_ok: + add esi,ecx + jmp before_macro_operators + string_before_macro_operators: + mov dl,22h + mov ebx,esi + lods dword [esi] + add esi,eax + jmp before_macro_operators + escaped_symbol: + dec byte [edi-1] + dec ecx + inc esi + cmp ecx,1 + rep movs byte [edi],[esi] + jne after_macro_operators + mov al,[esi-1] + mov ecx,ebx + mov ebx,characters + xlat byte [ebx] + mov ebx,ecx + or al,al + jnz after_macro_operators + sub edi,3 + mov al,[esi-1] + stos byte [edi] + xor dl,dl + jmp after_macro_operators + reduce_symbol_conversion: + inc esi + symbol_conversion: + mov edx,esi + mov al,[esi] + cmp al,1Ah + jne symbol_character_conversion + lods word [esi] + movzx ecx,ah + lea ebx,[edi+3] + jecxz convert_to_quoted_string + cmp byte [esi],'\' + jne convert_to_quoted_string + inc esi + dec ecx + dec ebx + jmp convert_to_quoted_string + symbol_character_conversion: + cmp al,22h + je after_macro_operators + cmp al,'`' + je reduce_symbol_conversion + lea ebx,[edi+5] + xor ecx,ecx + or al,al + jz convert_to_quoted_string + cmp al,'#' + je convert_to_quoted_string + inc ecx + convert_to_quoted_string: + sub ebx,edx + ja shift_line_data + mov al,22h + mov dl,al + stos byte [edi] + mov ebx,edi + mov eax,ecx + stos dword [edi] + rep movs byte [edi],[esi] + cmp edi,esi + je before_macro_operators + jmp after_macro_operators + shift_line_data: + push ecx + mov edx,esi + lea esi,[ebp-1] + add ebp,ebx + lea edi,[ebp-1] + lea ecx,[esi+1] + sub ecx,edx + std + rep movs byte [edi],[esi] + cld + pop eax + sub edi,3 + mov dl,22h + mov [edi-1],dl + mov ebx,edi + mov [edi],eax + lea esi,[edi+4+eax] + jmp before_macro_operators + concatenation: + cmp dl,1Ah + je symbol_concatenation + cmp dl,22h + je string_concatenation + no_concatenation: + cmp esi,edi + je before_macro_operators + jmp after_macro_operators + symbol_concatenation: + cmp byte [esi],1Ah + jne no_concatenation + inc esi + lods byte [esi] + movzx ecx,al + jecxz do_symbol_concatenation + cmp byte [esi],'\' + je concatenate_escaped_symbol + do_symbol_concatenation: + add [ebx],cl + jc name_too_long + rep movs byte [edi],[esi] + jmp after_macro_operators + concatenate_escaped_symbol: + inc esi + dec ecx + jz do_symbol_concatenation + movzx eax,byte [esi] + cmp byte [characters+eax],0 + jne do_symbol_concatenation + sub esi,3 + jmp no_concatenation + string_concatenation: + cmp byte [esi],22h + je do_string_concatenation + cmp byte [esi],'`' + jne no_concatenation + concatenate_converted_symbol: + inc esi + mov al,[esi] + cmp al,'`' + je concatenate_converted_symbol + cmp al,22h + je do_string_concatenation + cmp al,1Ah + jne concatenate_converted_symbol_character + inc esi + lods byte [esi] + movzx ecx,al + jecxz finish_concatenating_converted_symbol + cmp byte [esi],'\' + jne finish_concatenating_converted_symbol + inc esi + dec ecx + finish_concatenating_converted_symbol: + add [ebx],ecx + rep movs byte [edi],[esi] + jmp after_macro_operators + concatenate_converted_symbol_character: + or al,al + jz after_macro_operators + cmp al,'#' + je after_macro_operators + inc dword [ebx] + movs byte [edi],[esi] + jmp after_macro_operators + do_string_concatenation: + inc esi + lods dword [esi] + mov ecx,eax + add [ebx],eax + rep movs byte [edi],[esi] + after_macro_operators: + lods byte [esi] + cmp al,'`' + je symbol_conversion + cmp al,'#' + je concatenation + stos byte [edi] + cmp al,1Ah + je symbol_after_macro_operators + cmp al,3Bh + je no_more_macro_operators + cmp al,22h + je string_after_macro_operators + xor dl,dl + or al,al + jnz after_macro_operators + ret + symbol_after_macro_operators: + mov dl,1Ah + mov ebx,edi + lods byte [esi] + stos byte [edi] + movzx ecx,al + jecxz symbol_after_macro_operatorss_ok + cmp byte [esi],'\' + je escaped_symbol + symbol_after_macro_operatorss_ok: + rep movs byte [edi],[esi] + jmp after_macro_operators + string_after_macro_operators: + mov dl,22h + mov ebx,edi + lods dword [esi] + stos dword [edi] + mov ecx,eax + rep movs byte [edi],[esi] + jmp after_macro_operators + +use_macro: + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],0 + push [counter_limit] + push dword [edx+4] + mov dword [edx+4],1 + push edx + mov ebx,esi + mov esi,[edx+8] + mov eax,[edx+12] + mov [macro_line],eax + mov [counter_limit],0 + xor ebp,ebp + process_macro_arguments: + mov al,[esi] + or al,al + jz arguments_end + cmp al,'{' + je arguments_end + inc esi + cmp al,'[' + jne get_macro_arguments + mov ebp,esi + inc esi + inc [counter_limit] + get_macro_arguments: + call get_macro_argument + lods byte [esi] + cmp al,',' + je next_argument + cmp al,']' + je next_arguments_group + cmp al,'&' + je arguments_end + dec esi + jmp arguments_end + next_argument: + cmp byte [ebx],',' + jne process_macro_arguments + inc ebx + jmp process_macro_arguments + next_arguments_group: + cmp byte [ebx],',' + jne arguments_end + inc ebx + inc [counter_limit] + mov esi,ebp + jmp process_macro_arguments + get_macro_argument: + lods byte [esi] + movzx ecx,al + mov eax,[counter_limit] + call add_macro_symbol + add esi,ecx + xor eax,eax + mov [default_argument_value],eax + cmp byte [esi],'*' + je required_value + cmp byte [esi],':' + je get_default_value + cmp byte [esi],'=' + jne default_value_ok + get_default_value: + inc esi + mov [default_argument_value],esi + or [skip_default_argument_value],-1 + call skip_macro_argument_value + jmp default_value_ok + required_value: + inc esi + or [default_argument_value],-1 + default_value_ok: + xchg esi,ebx + mov [edx+12],esi + mov [skip_default_argument_value],0 + cmp byte [ebx],'&' + je greedy_macro_argument + call skip_macro_argument_value + call finish_macro_argument + jmp got_macro_argument + greedy_macro_argument: + call skip_foreign_line + dec esi + mov eax,[edx+12] + mov ecx,esi + sub ecx,eax + mov [edx+8],ecx + got_macro_argument: + xchg esi,ebx + cmp dword [edx+8],0 + jne macro_argument_ok + mov eax,[default_argument_value] + or eax,eax + jz macro_argument_ok + cmp eax,-1 + je invalid_macro_arguments + mov [edx+12],eax + call finish_macro_argument + macro_argument_ok: + ret + finish_macro_argument: + mov eax,[edx+12] + mov ecx,esi + sub ecx,eax + cmp byte [eax],'<' + jne argument_value_length_ok + inc dword [edx+12] + sub ecx,2 + or ecx,80000000h + argument_value_length_ok: + mov [edx+8],ecx + ret + arguments_end: + cmp byte [ebx],0 + jne invalid_macro_arguments + mov eax,[esp+4] + dec eax + call process_macro + pop edx + pop dword [edx+4] + pop [counter_limit] + pop [macro_symbols] + pop [free_additional_memory] + jmp line_preprocessed +use_instant_macro: + push edi [current_line] esi + mov eax,[error_line] + mov [current_line],eax + mov [macro_line],eax + mov esi,[instant_macro_start] + cmp [base_code],10h + jae do_match + cmp [base_code],0 + jne do_irp + call precalculate_value + cmp eax,0 + jl value_out_of_range + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],0 + push [counter_limit] + mov [struc_name],0 + mov [counter_limit],eax + lods byte [esi] + or al,al + jz rept_counters_ok + cmp al,'{' + je rept_counters_ok + cmp al,1Ah + jne invalid_macro_arguments + add_rept_counter: + lods byte [esi] + movzx ecx,al + xor eax,eax + call add_macro_symbol + add esi,ecx + xor eax,eax + mov dword [edx+12],eax + inc eax + mov dword [edx+8],eax + lods byte [esi] + cmp al,':' + jne rept_counter_added + push edx + call precalculate_value + mov edx,eax + add edx,[counter_limit] + jo value_out_of_range + pop edx + mov dword [edx+8],eax + lods byte [esi] + rept_counter_added: + cmp al,',' + jne rept_counters_ok + lods byte [esi] + cmp al,1Ah + jne invalid_macro_arguments + jmp add_rept_counter + rept_counters_ok: + dec esi + cmp [counter_limit],0 + je instant_macro_finish + instant_macro_parameters_ok: + xor eax,eax + call process_macro + instant_macro_finish: + pop [counter_limit] + pop [macro_symbols] + pop [free_additional_memory] + instant_macro_done: + pop ebx esi edx + cmp byte [ebx],0 + je line_preprocessed + mov [current_line],edi + mov ecx,4 + rep movs dword [edi],[esi] + test [macro_status],0Fh + jz instant_macro_attached_line + mov ax,3Bh + stos word [edi] + instant_macro_attached_line: + mov esi,ebx + sub edx,ebx + mov ecx,edx + call move_data + jmp initial_preprocessing_ok + precalculate_value: + push edi + call convert_expression + mov al,')' + stosb + push esi + mov esi,[esp+4] + mov [error_line],0 + mov [value_size],0 + call calculate_expression + cmp [error_line],0 + je value_precalculated + jmp [error] + value_precalculated: + mov eax,[edi] + mov ecx,[edi+4] + cdq + cmp edx,ecx + jne value_out_of_range + cmp dl,[edi+13] + jne value_out_of_range + pop esi edi + ret +do_irp: + cmp byte [esi],1Ah + jne invalid_macro_arguments + movzx eax,byte [esi+1] + lea esi,[esi+2+eax] + lods byte [esi] + cmp [base_code],1 + ja irps_name_ok + cmp al,':' + je irp_with_default_value + cmp al,'=' + je irp_with_default_value + cmp al,'*' + jne irp_name_ok + lods byte [esi] + irp_name_ok: + cmp al,',' + jne invalid_macro_arguments + jmp irp_parameters_start + irp_with_default_value: + xor ebp,ebp + or [skip_default_argument_value],-1 + call skip_macro_argument_value + cmp byte [esi],',' + jne invalid_macro_arguments + inc esi + jmp irp_parameters_start + irps_name_ok: + cmp al,',' + jne invalid_macro_arguments + cmp [base_code],3 + je irp_parameters_start + mov al,[esi] + or al,al + jz instant_macro_done + cmp al,'{' + je instant_macro_done + irp_parameters_start: + xor eax,eax + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],eax + push [counter_limit] + mov [counter_limit],eax + mov [struc_name],eax + cmp [base_code],3 + je get_irpv_parameter + mov ebx,esi + cmp [base_code],2 + je get_irps_parameter + mov edx,[parameters_end] + mov al,[edx] + push eax + mov byte [edx],0 + get_irp_parameter: + inc [counter_limit] + mov esi,[instant_macro_start] + inc esi + call get_macro_argument + cmp byte [ebx],',' + jne irp_parameters_end + inc ebx + jmp get_irp_parameter + irp_parameters_end: + mov esi,ebx + pop eax + mov [esi],al + jmp instant_macro_parameters_ok + get_irps_parameter: + mov esi,[instant_macro_start] + inc esi + lods byte [esi] + movzx ecx,al + inc [counter_limit] + mov eax,[counter_limit] + call add_macro_symbol + mov [edx+12],ebx + cmp byte [ebx],1Ah + je irps_symbol + cmp byte [ebx],22h + je irps_quoted_string + mov eax,1 + jmp irps_parameter_ok + irps_quoted_string: + mov eax,[ebx+1] + add eax,1+4 + jmp irps_parameter_ok + irps_symbol: + movzx eax,byte [ebx+1] + add eax,1+1 + irps_parameter_ok: + mov [edx+8],eax + add ebx,eax + cmp byte [ebx],0 + je irps_parameters_end + cmp byte [ebx],'{' + jne get_irps_parameter + irps_parameters_end: + mov esi,ebx + jmp instant_macro_parameters_ok + get_irpv_parameter: + lods byte [esi] + cmp al,1Ah + jne invalid_macro_arguments + lods byte [esi] + mov ebp,esi + mov cl,al + mov ch,10b + call get_preprocessor_symbol + jc instant_macro_finish + push edx + mark_variable_value: + inc [counter_limit] + mov [edx+4],ebp + next_variable_value: + mov edx,[edx] + or edx,edx + jz variable_values_marked + mov eax,[edx+4] + cmp eax,1 + jbe next_variable_value + mov esi,ebp + movzx ecx,byte [esi-1] + xchg edi,eax + repe cmps byte [esi],[edi] + xchg edi,eax + je mark_variable_value + jmp next_variable_value + variable_values_marked: + pop edx + push [counter_limit] + add_irpv_value: + push edx + mov esi,[instant_macro_start] + inc esi + lods byte [esi] + movzx ecx,al + mov eax,[esp+4] + call add_macro_symbol + mov ebx,edx + pop edx + mov ecx,[edx+12] + mov eax,[edx+8] + mov [ebx+12],eax + mov [ebx+8],ecx + collect_next_variable_value: + mov edx,[edx] + or edx,edx + jz variable_values_collected + cmp ebp,[edx+4] + jne collect_next_variable_value + dec dword [esp] + jnz add_irpv_value + variable_values_collected: + pop eax + mov esi,ebp + movzx ecx,byte [esi-1] + add esi,ecx + cmp byte [esi],0 + je instant_macro_parameters_ok + cmp byte [esi],'{' + jne invalid_macro_arguments + jmp instant_macro_parameters_ok + +do_match: + mov ebx,esi + call skip_pattern + call exact_match + mov edx,edi + mov al,[ebx] + cmp al,1Ah + je free_match + cmp al,',' + jne instant_macro_done + cmp esi,[parameters_end] + je matched_pattern + jmp instant_macro_done + free_match: + add edx,12 + cmp edx,[memory_end] + ja out_of_memory + mov [edx-12],ebx + mov [edx-8],esi + call skip_match_element + jc try_different_matching + mov [edx-4],esi + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp byte [ebx],1Ah + je free_match + find_exact_match: + call exact_match + cmp esi,[parameters_end] + je end_matching + cmp byte [ebx],1Ah + je free_match + mov ebx,[edx-12] + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + mov esi,[edx-4] + jmp match_more_elements + try_different_matching: + sub edx,12 + cmp edx,edi + je instant_macro_done + mov ebx,[edx-12] + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp byte [ebx],1Ah + je try_different_matching + mov esi,[edx-4] + match_more_elements: + call skip_match_element + jc try_different_matching + mov [edx-4],esi + jmp find_exact_match + skip_match_element: + cmp esi,[parameters_end] + je cannot_match + mov al,[esi] + cmp al,1Ah + je skip_match_symbol + cmp al,22h + je skip_match_quoted_string + add esi,1 + ret + skip_match_quoted_string: + mov eax,[esi+1] + add esi,5 + jmp skip_match_ok + skip_match_symbol: + movzx eax,byte [esi+1] + add esi,2 + skip_match_ok: + add esi,eax + ret + cannot_match: + stc + ret + exact_match: + cmp esi,[parameters_end] + je exact_match_complete + mov ah,[esi] + mov al,[ebx] + cmp al,',' + je exact_match_complete + cmp al,1Ah + je exact_match_complete + cmp al,'=' + je match_verbatim + call match_elements + je exact_match + exact_match_complete: + ret + match_verbatim: + inc ebx + call match_elements + je exact_match + dec ebx + ret + match_elements: + mov al,[ebx] + cmp al,1Ah + je match_symbols + cmp al,22h + je match_quoted_strings + cmp al,ah + je symbol_characters_matched + ret + symbol_characters_matched: + lea ebx,[ebx+1] + lea esi,[esi+1] + ret + match_quoted_strings: + mov ecx,[ebx+1] + add ecx,5 + jmp compare_elements + match_symbols: + movzx ecx,byte [ebx+1] + add ecx,2 + compare_elements: + mov eax,esi + mov ebp,edi + mov edi,ebx + repe cmps byte [esi],[edi] + jne elements_mismatch + mov ebx,edi + mov edi,ebp + ret + elements_mismatch: + mov esi,eax + mov edi,ebp + ret + end_matching: + cmp byte [ebx],',' + jne instant_macro_done + matched_pattern: + xor eax,eax + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],eax + push [counter_limit] + mov [counter_limit],eax + mov [struc_name],eax + push esi edi edx + add_matched_symbol: + cmp edi,[esp] + je matched_symbols_ok + mov esi,[edi] + inc esi + lods byte [esi] + movzx ecx,al + xor eax,eax + call add_macro_symbol + mov eax,[edi+4] + mov dword [edx+12],eax + mov ecx,[edi+8] + sub ecx,eax + mov dword [edx+8],ecx + add edi,12 + jmp add_matched_symbol + matched_symbols_ok: + pop edx edi esi + jmp instant_macro_parameters_ok + +process_macro: + push dword [macro_status] + or [macro_status],10h + push [counter] + push [macro_block] + push [macro_block_line] + push [macro_block_line_number] + push [struc_label] + push [struc_name] + push eax + push [current_line] + lods byte [esi] + cmp al,'{' + je macro_instructions_start + or al,al + jnz unexpected_characters + find_macro_instructions: + mov [macro_line],esi + add esi,16+2 + lods byte [esi] + or al,al + jz find_macro_instructions + cmp al,'{' + je macro_instructions_start + cmp al,3Bh + jne unexpected_characters + call skip_foreign_symbol + jmp find_macro_instructions + macro_instructions_start: + mov ecx,80000000h + mov [macro_block],esi + mov eax,[macro_line] + mov [macro_block_line],eax + mov [macro_block_line_number],ecx + xor eax,eax + mov [counter],eax + cmp [counter_limit],eax + je process_macro_line + inc [counter] + process_macro_line: + lods byte [esi] + or al,al + jz process_next_line + cmp al,'}' + je macro_block_processed + dec esi + mov [current_line],edi + lea eax,[edi+10h] + cmp eax,[memory_end] + jae out_of_memory + mov eax,[esp+4] + or eax,eax + jz instant_macro_line_header + stos dword [edi] + mov eax,ecx + stos dword [edi] + mov eax,[esp] + stos dword [edi] + mov eax,[macro_line] + stos dword [edi] + jmp macro_line_header_ok + instant_macro_line_header: + mov eax,[esp] + add eax,16 + find_defining_directive: + inc eax + cmp byte [eax-1],3Bh + je defining_directive_ok + cmp byte [eax-1],1Ah + jne find_defining_directive + push eax + movzx eax,byte [eax] + inc eax + add [esp],eax + pop eax + jmp find_defining_directive + defining_directive_ok: + stos dword [edi] + mov eax,ecx + stos dword [edi] + mov eax,[macro_line] + stos dword [edi] + stos dword [edi] + macro_line_header_ok: + or [macro_status],20h + push ebx ecx + test [macro_status],0Fh + jz process_macro_line_element + mov ax,3Bh + stos word [edi] + process_macro_line_element: + lea eax,[edi+100h] + cmp eax,[memory_end] + jae out_of_memory + lods byte [esi] + cmp al,'}' + je macro_line_processed + or al,al + jz macro_line_processed + cmp al,1Ah + je process_macro_symbol + cmp al,3Bh + je macro_foreign_line + and [macro_status],not 20h + stos byte [edi] + cmp al,22h + jne process_macro_line_element + copy_macro_string: + mov ecx,[esi] + add ecx,4 + call move_data + jmp process_macro_line_element + process_macro_symbol: + push esi edi + test [macro_status],20h + jz not_macro_directive + movzx ecx,byte [esi] + inc esi + mov edi,macro_directives + call get_directive + jnc process_macro_directive + dec esi + jmp not_macro_directive + process_macro_directive: + mov edx,eax + pop edi eax + mov byte [edi],0 + inc edi + pop ecx ebx + jmp near edx + not_macro_directive: + and [macro_status],not 20h + movzx ecx,byte [esi] + inc esi + mov eax,[counter] + call get_macro_symbol + jnc group_macro_symbol + xor eax,eax + cmp [counter],eax + je multiple_macro_symbol_values + call get_macro_symbol + jc not_macro_symbol + replace_macro_symbol: + pop edi eax + mov ecx,[edx+8] + mov edx,[edx+12] + or edx,edx + jz replace_macro_counter + and ecx,not 80000000h + xchg esi,edx + call move_data + mov esi,edx + jmp process_macro_line_element + group_macro_symbol: + xor eax,eax + cmp [counter],eax + je replace_macro_symbol + push esi edx + sub esi,ecx + call get_macro_symbol + mov ebx,edx + pop edx esi + jc replace_macro_symbol + cmp edx,ebx + ja replace_macro_symbol + mov edx,ebx + jmp replace_macro_symbol + multiple_macro_symbol_values: + inc eax + push eax + call get_macro_symbol + pop eax + jc not_macro_symbol + pop edi + push ecx + mov ecx,[edx+8] + mov edx,[edx+12] + xchg esi,edx + btr ecx,31 + jc enclose_macro_symbol_value + rep movs byte [edi],[esi] + jmp macro_symbol_value_ok + enclose_macro_symbol_value: + mov byte [edi],'<' + inc edi + rep movs byte [edi],[esi] + mov byte [edi],'>' + inc edi + macro_symbol_value_ok: + cmp eax,[counter_limit] + je multiple_macro_symbol_values_ok + mov byte [edi],',' + inc edi + mov esi,edx + pop ecx + push edi + sub esi,ecx + jmp multiple_macro_symbol_values + multiple_macro_symbol_values_ok: + pop ecx eax + mov esi,edx + jmp process_macro_line_element + replace_macro_counter: + mov eax,[counter] + and eax,not 80000000h + jz group_macro_counter + add ecx,eax + dec ecx + call store_number_symbol + jmp process_macro_line_element + group_macro_counter: + mov edx,ecx + xor ecx,ecx + multiple_macro_counter_values: + push ecx edx + add ecx,edx + call store_number_symbol + pop edx ecx + inc ecx + cmp ecx,[counter_limit] + je process_macro_line_element + mov byte [edi],',' + inc edi + jmp multiple_macro_counter_values + store_number_symbol: + cmp ecx,0 + jge numer_symbol_sign_ok + neg ecx + mov al,'-' + stos byte [edi] + numer_symbol_sign_ok: + mov ax,1Ah + stos word [edi] + push edi + mov eax,ecx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + store_number_digits: + div ecx + push edx + or bl,bl + jnz store_number_digit + cmp ecx,1 + je store_number_digit + or al,al + jz number_digit_ok + not bl + store_number_digit: + add al,30h + stos byte [edi] + number_digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz store_number_digits + pop ebx + mov eax,edi + sub eax,ebx + mov [ebx-1],al + ret + not_macro_symbol: + pop edi esi + mov al,1Ah + stos byte [edi] + mov al,[esi] + inc esi + stos byte [edi] + cmp byte [esi],'.' + jne copy_raw_symbol + mov ebx,[esp+8+8] + or ebx,ebx + jz copy_raw_symbol + cmp al,1 + je copy_struc_name + xchg esi,ebx + movzx ecx,byte [esi-1] + add [edi-1],cl + jc name_too_long + rep movs byte [edi],[esi] + xchg esi,ebx + copy_raw_symbol: + movzx ecx,al + rep movs byte [edi],[esi] + jmp process_macro_line_element + copy_struc_name: + inc esi + xchg esi,ebx + movzx ecx,byte [esi-1] + mov [edi-1],cl + rep movs byte [edi],[esi] + xchg esi,ebx + mov eax,[esp+8+12] + cmp byte [eax],3Bh + je process_macro_line_element + cmp byte [eax],1Ah + jne disable_replaced_struc_name + mov byte [eax],3Bh + jmp process_macro_line_element + disable_replaced_struc_name: + mov ebx,[esp+8+8] + push esi edi + lea edi,[ebx-3] + lea esi,[edi-2] + lea ecx,[esi+1] + sub ecx,eax + std + rep movs byte [edi],[esi] + cld + mov word [eax],3Bh + pop edi esi + jmp process_macro_line_element + skip_foreign_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + skip_foreign_line: + lods byte [esi] + cmp al,1Ah + je skip_foreign_symbol + cmp al,3Bh + je skip_foreign_symbol + cmp al,22h + je skip_foreign_string + or al,al + jnz skip_foreign_line + ret + skip_foreign_string: + lods dword [esi] + add esi,eax + jmp skip_foreign_line + macro_foreign_line: + call skip_foreign_symbol + macro_line_processed: + mov byte [edi],0 + inc edi + push eax + call preprocess_line + pop eax + pop ecx ebx + cmp al,'}' + je macro_block_processed + process_next_line: + inc ecx + mov [macro_line],esi + add esi,16+2 + jmp process_macro_line + macro_block_processed: + call close_macro_block + jc process_macro_line + pop [current_line] + add esp,12 + pop [macro_block_line_number] + pop [macro_block_line] + pop [macro_block] + pop [counter] + pop eax + and al,0F0h + and [macro_status],0Fh + or [macro_status],al + ret + +local_symbols: + lods byte [esi] + cmp al,1Ah + jne invalid_argument + mov byte [edi-1],3Bh + xor al,al + stos byte [edi] + make_local_symbol: + push ecx + lods byte [esi] + movzx ecx,al + mov eax,[counter] + call add_macro_symbol + mov [edx+12],edi + movzx eax,[locals_counter] + add eax,ecx + inc eax + cmp eax,100h + jae name_too_long + lea ebp,[edi+2+eax] + cmp ebp,[memory_end] + jae out_of_memory + mov ah,al + mov al,1Ah + stos word [edi] + rep movs byte [edi],[esi] + mov al,'?' + stos byte [edi] + push esi + mov esi,locals_counter+1 + movzx ecx,[locals_counter] + rep movs byte [edi],[esi] + pop esi + mov eax,edi + sub eax,[edx+12] + mov [edx+8],eax + xor al,al + stos byte [edi] + mov eax,locals_counter + movzx ecx,byte [eax] + counter_loop: + inc byte [eax+ecx] + cmp byte [eax+ecx],'9'+1 + jb counter_ok + jne letter_digit + mov byte [eax+ecx],'A' + jmp counter_ok + letter_digit: + cmp byte [eax+ecx],'Z'+1 + jb counter_ok + jne small_letter_digit + mov byte [eax+ecx],'a' + jmp counter_ok + small_letter_digit: + cmp byte [eax+ecx],'z'+1 + jb counter_ok + mov byte [eax+ecx],'0' + loop counter_loop + inc byte [eax] + movzx ecx,byte [eax] + mov byte [eax+ecx],'0' + counter_ok: + pop ecx + lods byte [esi] + cmp al,'}' + je macro_block_processed + or al,al + jz process_next_line + cmp al,',' + jne extra_characters_on_line + dec edi + lods byte [esi] + cmp al,1Ah + je make_local_symbol + jmp invalid_argument +common_block: + call close_macro_block + jc process_macro_line + mov [counter],0 + jmp new_macro_block +forward_block: + cmp [counter_limit],0 + je common_block + call close_macro_block + jc process_macro_line + mov [counter],1 + jmp new_macro_block +reverse_block: + cmp [counter_limit],0 + je common_block + call close_macro_block + jc process_macro_line + mov eax,[counter_limit] + or eax,80000000h + mov [counter],eax + new_macro_block: + mov [macro_block],esi + mov eax,[macro_line] + mov [macro_block_line],eax + mov [macro_block_line_number],ecx + jmp process_macro_line +close_macro_block: + cmp esi,[macro_block] + je block_closed + cmp [counter],0 + je block_closed + jl reverse_counter + mov eax,[counter] + cmp eax,[counter_limit] + je block_closed + inc [counter] + jmp continue_block + reverse_counter: + mov eax,[counter] + dec eax + cmp eax,80000000h + je block_closed + mov [counter],eax + continue_block: + mov esi,[macro_block] + mov eax,[macro_block_line] + mov [macro_line],eax + mov ecx,[macro_block_line_number] + stc + ret + block_closed: + clc + ret +get_macro_symbol: + push ecx + call find_macro_symbol_leaf + jc macro_symbol_not_found + mov edx,[ebx] + mov ebx,esi + try_macro_symbol: + or edx,edx + jz macro_symbol_not_found + mov ecx,[esp] + mov edi,[edx+4] + repe cmps byte [esi],[edi] + je macro_symbol_found + mov esi,ebx + mov edx,[edx] + jmp try_macro_symbol + macro_symbol_found: + pop ecx + clc + ret + macro_symbol_not_found: + pop ecx + stc + ret + find_macro_symbol_leaf: + shl eax,8 + mov al,cl + mov ebp,eax + mov ebx,macro_symbols + follow_macro_symbols_tree: + mov edx,[ebx] + or edx,edx + jz no_such_macro_symbol + xor eax,eax + shr ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + or ebp,ebp + jnz follow_macro_symbols_tree + add ebx,8 + clc + ret + no_such_macro_symbol: + stc + ret +add_macro_symbol: + push ebx ebp + call find_macro_symbol_leaf + jc extend_macro_symbol_tree + mov eax,[ebx] + make_macro_symbol: + mov edx,[free_additional_memory] + add edx,16 + cmp edx,[labels_list] + ja out_of_memory + xchg edx,[free_additional_memory] + mov [ebx],edx + mov [edx],eax + mov [edx+4],esi + pop ebp ebx + ret + extend_macro_symbol_tree: + mov edx,[free_additional_memory] + add edx,16 + cmp edx,[labels_list] + ja out_of_memory + xchg edx,[free_additional_memory] + xor eax,eax + mov [edx],eax + mov [edx+4],eax + mov [edx+8],eax + mov [edx+12],eax + shr ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + or ebp,ebp + jnz extend_macro_symbol_tree + add ebx,8 + xor eax,eax + jmp make_macro_symbol + +include_file: + lods byte [esi] + cmp al,22h + jne invalid_argument + lods dword [esi] + cmp byte [esi+eax],0 + jne extra_characters_on_line + push esi + push edi + mov ebx,[current_line] + find_current_file_path: + mov esi,[ebx] + test byte [ebx+7],80h + jz copy_current_file_path + mov ebx,[ebx+8] + jmp find_current_file_path + copy_current_file_path: + lods byte [esi] + stos byte [edi] + or al,al + jnz copy_current_file_path + cut_current_file_name: + cmp edi,[esp] + je current_file_path_ok + cmp byte [edi-1],'\' + je current_file_path_ok + cmp byte [edi-1],'/' + je current_file_path_ok + dec edi + jmp cut_current_file_name + current_file_path_ok: + mov esi,[esp+4] + call expand_path + pop edx + mov esi,edx + call open + jnc include_path_ok + mov ebp,[include_paths] + try_include_directories: + mov edi,esi + mov esi,ebp + cmp byte [esi],0 + je try_in_current_directory + push ebp + push edi + call get_include_directory + mov [esp+4],esi + mov esi,[esp+8] + call expand_path + pop edx + mov esi,edx + call open + pop ebp + jnc include_path_ok + jmp try_include_directories + mov edi,esi + try_in_current_directory: + mov esi,[esp] + push edi + call expand_path + pop edx + mov esi,edx + call open + jc file_not_found + include_path_ok: + mov edi,[esp] + copy_preprocessed_path: + lods byte [esi] + stos byte [edi] + or al,al + jnz copy_preprocessed_path + pop esi + lea ecx,[edi-1] + sub ecx,esi + mov [esi-4],ecx + push dword [macro_status] + and [macro_status],0Fh + call preprocess_file + pop eax + and al,0F0h + and [macro_status],0Fh + or [macro_status],al + jmp line_preprocessed diff --git a/programs/develop/koldbg/fasm/symbdump.inc b/programs/develop/koldbg/fasm/symbdump.inc new file mode 100644 index 0000000000..1bd09fc616 --- /dev/null +++ b/programs/develop/koldbg/fasm/symbdump.inc @@ -0,0 +1,450 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +dump_symbols: + mov edi,[code_start] + call setup_dump_header + mov esi,[input_file] + call copy_asciiz + cmp edi,[tagged_blocks] + jae out_of_memory + mov eax,edi + sub eax,ebx + mov [ebx-40h+0Ch],eax + mov esi,[output_file] + call copy_asciiz + cmp edi,[tagged_blocks] + jae out_of_memory + mov edx,[symbols_stream] + mov ebp,[free_additional_memory] + and [number_of_sections],0 + cmp [output_format],4 + je prepare_strings_table + cmp [output_format],5 + jne strings_table_ready + bt [format_flags],0 + jc strings_table_ready + prepare_strings_table: + cmp edx,ebp + je strings_table_ready + mov al,[edx] + test al,al + jz prepare_string + cmp al,80h + je prepare_string + add edx,0Ch + cmp al,0C0h + jb prepare_strings_table + add edx,4 + jmp prepare_strings_table + prepare_string: + mov esi,edi + sub esi,ebx + xchg esi,[edx+4] + test al,al + jz prepare_section_string + or dword [edx+4],1 shl 31 + add edx,0Ch + prepare_external_string: + mov ecx,[esi] + add esi,4 + rep movs byte [edi],[esi] + mov byte [edi],0 + inc edi + cmp edi,[tagged_blocks] + jae out_of_memory + jmp prepare_strings_table + prepare_section_string: + mov ecx,[number_of_sections] + mov eax,ecx + inc eax + mov [number_of_sections],eax + xchg eax,[edx+4] + shl ecx,2 + add ecx,[free_additional_memory] + mov [ecx],eax + add edx,20h + test esi,esi + jz prepare_default_section_string + cmp [output_format],5 + jne prepare_external_string + bt [format_flags],0 + jc prepare_external_string + mov esi,[esi] + add esi,[resource_data] + copy_elf_section_name: + lods byte [esi] + cmp edi,[tagged_blocks] + jae out_of_memory + stos byte [edi] + test al,al + jnz copy_elf_section_name + jmp prepare_strings_table + prepare_default_section_string: + mov eax,'.fla' + stos dword [edi] + mov ax,'t' + stos word [edi] + cmp edi,[tagged_blocks] + jae out_of_memory + jmp prepare_strings_table + strings_table_ready: + mov edx,[tagged_blocks] + mov ebp,[memory_end] + sub ebp,[labels_list] + add ebp,edx + prepare_labels_dump: + cmp edx,ebp + je labels_dump_ok + mov eax,[edx+24] + test eax,eax + jz label_dump_name_ok + cmp eax,[memory_start] + jb label_name_outside_source + cmp eax,[source_start] + ja label_name_outside_source + sub eax,[memory_start] + dec eax + mov [edx+24],eax + jmp label_dump_name_ok + label_name_outside_source: + mov esi,eax + mov eax,edi + sub eax,ebx + or eax,1 shl 31 + mov [edx+24],eax + movzx ecx,byte [esi-1] + lea eax,[edi+ecx+1] + cmp edi,[tagged_blocks] + jae out_of_memory + rep movsb + xor al,al + stosb + label_dump_name_ok: + mov eax,[edx+28] + test eax,eax + jz label_dump_line_ok + sub eax,[memory_start] + mov [edx+28],eax + label_dump_line_ok: + test byte [edx+9],4 + jz convert_base_symbol_for_label + xor eax,eax + mov [edx],eax + mov [edx+4],eax + jmp base_symbol_for_label_ok + convert_base_symbol_for_label: + mov eax,[edx+20] + test eax,eax + jz base_symbol_for_label_ok + cmp eax,[symbols_stream] + mov eax,[eax+4] + jae base_symbol_for_label_ok + xor eax,eax + base_symbol_for_label_ok: + mov [edx+20],eax + mov ax,[current_pass] + cmp ax,[edx+16] + je label_defined_flag_ok + and byte [edx+8],not 1 + label_defined_flag_ok: + cmp ax,[edx+18] + je label_used_flag_ok + and byte [edx+8],not 8 + label_used_flag_ok: + add edx,LABEL_STRUCTURE_SIZE + jmp prepare_labels_dump + labels_dump_ok: + mov eax,edi + sub eax,ebx + mov [ebx-40h+14h],eax + add eax,40h + mov [ebx-40h+18h],eax + mov ecx,[memory_end] + sub ecx,[labels_list] + mov [ebx-40h+1Ch],ecx + add eax,ecx + mov [ebx-40h+20h],eax + mov ecx,[source_start] + sub ecx,[memory_start] + mov [ebx-40h+24h],ecx + add eax,ecx + mov [ebx-40h+28h],eax + mov eax,[number_of_sections] + shl eax,2 + mov [ebx-40h+34h],eax + call prepare_preprocessed_source + mov esi,[labels_list] + mov ebp,edi + make_lines_dump: + cmp esi,[tagged_blocks] + je lines_dump_ok + mov eax,[esi-4] + mov ecx,[esi-8] + sub esi,8 + sub esi,ecx + cmp eax,1 + je process_line_dump + cmp eax,2 + jne make_lines_dump + add dword [ebx-40h+3Ch],8 + jmp make_lines_dump + process_line_dump: + push ebx + mov ebx,[esi+8] + mov eax,[esi+4] + sub eax,[code_start] + add eax,[headers_size] + test byte [ebx+0Ah],1 + jz store_offset + xor eax,eax + store_offset: + stos dword [edi] + mov eax,[esi] + sub eax,[memory_start] + stos dword [edi] + mov eax,[esi+4] + xor edx,edx + xor cl,cl + sub eax,[ebx] + sbb edx,[ebx+4] + sbb cl,[ebx+8] + stos dword [edi] + mov eax,edx + stos dword [edi] + mov eax,[ebx+10h] + stos dword [edi] + mov eax,[ebx+14h] + test eax,eax + jz base_symbol_for_line_ok + cmp eax,[symbols_stream] + mov eax,[eax+4] + jae base_symbol_for_line_ok + xor eax,eax + base_symbol_for_line_ok: + stos dword [edi] + mov al,[ebx+9] + stos byte [edi] + mov al,[esi+10h] + stos byte [edi] + mov al,[ebx+0Ah] + and al,1 + stos byte [edi] + mov al,cl + stos byte [edi] + pop ebx + cmp edi,[tagged_blocks] + jae out_of_memory + mov eax,edi + sub eax,1Ch + sub eax,ebp + mov [esi],eax + jmp make_lines_dump + lines_dump_ok: + mov edx,edi + mov eax,[current_offset] + sub eax,[code_start] + add eax,[headers_size] + stos dword [edi] + mov ecx,edi + sub ecx,ebx + sub ecx,[ebx-40h+14h] + mov [ebx-40h+2Ch],ecx + add ecx,[ebx-40h+28h] + mov [ebx-40h+30h],ecx + add ecx,[ebx-40h+34h] + mov [ebx-40h+38h],ecx + find_inexisting_offsets: + sub edx,1Ch + cmp edx,ebp + jb write_symbols + test byte [edx+1Ah],1 + jnz find_inexisting_offsets + cmp eax,[edx] + jb correct_inexisting_offset + mov eax,[edx] + jmp find_inexisting_offsets + correct_inexisting_offset: + and dword [edx],0 + or byte [edx+1Ah],2 + jmp find_inexisting_offsets + write_symbols: + mov edx,[symbols_file] + call create + jc write_failed + mov edx,[code_start] + mov ecx,[edx+14h] + add ecx,40h + call write + jc write_failed + mov edx,[tagged_blocks] + mov ecx,[memory_end] + sub ecx,[labels_list] + call write + jc write_failed + mov edx,[memory_start] + mov ecx,[source_start] + sub ecx,edx + call write + jc write_failed + mov edx,ebp + mov ecx,edi + sub ecx,edx + call write + jc write_failed + mov edx,[free_additional_memory] + mov ecx,[number_of_sections] + shl ecx,2 + call write + jc write_failed + mov esi,[labels_list] + mov edi,[memory_start] + make_references_dump: + cmp esi,[tagged_blocks] + je references_dump_ok + mov eax,[esi-4] + mov ecx,[esi-8] + sub esi,8 + sub esi,ecx + cmp eax,2 + je dump_reference + cmp eax,1 + jne make_references_dump + mov edx,[esi] + jmp make_references_dump + dump_reference: + mov eax,[memory_end] + sub eax,[esi] + sub eax,LABEL_STRUCTURE_SIZE + stosd + mov eax,edx + stosd + cmp edi,[tagged_blocks] + jb make_references_dump + jmp out_of_memory + references_dump_ok: + mov edx,[memory_start] + mov ecx,edi + sub ecx,edx + call write + jc write_failed + call close + ret + setup_dump_header: + xor eax,eax + mov ecx,40h shr 2 + rep stos dword [edi] + mov ebx,edi + mov dword [ebx-40h],'fas'+1Ah shl 24 + mov dword [ebx-40h+4],VERSION_MAJOR + VERSION_MINOR shl 8 + 40h shl 16 + mov dword [ebx-40h+10h],40h + ret +prepare_preprocessed_source: + mov esi,[memory_start] + mov ebp,[source_start] + test ebp,ebp + jnz prepare_preprocessed_line + mov ebp,[current_line] + inc ebp + prepare_preprocessed_line: + cmp esi,ebp + jae preprocessed_source_ok + mov eax,[memory_start] + mov edx,[input_file] + cmp [esi],edx + jne line_not_from_main_input + mov [esi],eax + line_not_from_main_input: + sub [esi],eax + test byte [esi+7],1 shl 7 + jz prepare_next_preprocessed_line + sub [esi+8],eax + sub [esi+12],eax + prepare_next_preprocessed_line: + call skip_preprocessed_line + jmp prepare_preprocessed_line + preprocessed_source_ok: + ret + skip_preprocessed_line: + add esi,16 + skip_preprocessed_line_content: + lods byte [esi] + cmp al,1Ah + je skip_preprocessed_symbol + cmp al,3Bh + je skip_preprocessed_symbol + cmp al,22h + je skip_preprocessed_string + or al,al + jnz skip_preprocessed_line_content + ret + skip_preprocessed_string: + lods dword [esi] + add esi,eax + jmp skip_preprocessed_line_content + skip_preprocessed_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_preprocessed_line_content +restore_preprocessed_source: + mov esi,[memory_start] + mov ebp,[source_start] + test ebp,ebp + jnz restore_preprocessed_line + mov ebp,[current_line] + inc ebp + restore_preprocessed_line: + cmp esi,ebp + jae preprocessed_source_restored + mov eax,[memory_start] + add [esi],eax + cmp [esi],eax + jne preprocessed_line_source_restored + mov edx,[input_file] + mov [esi],edx + preprocessed_line_source_restored: + test byte [esi+7],1 shl 7 + jz restore_next_preprocessed_line + add [esi+8],eax + add [esi+12],eax + restore_next_preprocessed_line: + call skip_preprocessed_line + jmp restore_preprocessed_line + preprocessed_source_restored: + ret +dump_preprocessed_source: + mov edi,[free_additional_memory] + call setup_dump_header + mov esi,[input_file] + call copy_asciiz + cmp edi,[additional_memory_end] + jae out_of_memory + mov eax,edi + sub eax,ebx + dec eax + mov [ebx-40h+0Ch],eax + mov eax,edi + sub eax,ebx + mov [ebx-40h+14h],eax + add eax,40h + mov [ebx-40h+20h],eax + call prepare_preprocessed_source + sub esi,[memory_start] + mov [ebx-40h+24h],esi + mov edx,[symbols_file] + call create + jc write_failed + mov edx,[free_additional_memory] + mov ecx,[edx+14h] + add ecx,40h + call write + jc write_failed + mov edx,[memory_start] + mov ecx,esi + call write + jc write_failed + call close + ret \ No newline at end of file diff --git a/programs/develop/koldbg/fasm/tables.inc b/programs/develop/koldbg/fasm/tables.inc new file mode 100644 index 0000000000..552f3102d5 --- /dev/null +++ b/programs/develop/koldbg/fasm/tables.inc @@ -0,0 +1,4374 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +include_variable db 'INCLUDE',0 + +symbol_characters db 27 + db 9,0Ah,0Dh,1Ah,20h,'+-/*=<>()[]{}:,|&~#`;\' + +preprocessor_directives: + db 6,'define' + dw define_symbolic_constant-directive_handler + db 7,'include' + dw include_file-directive_handler + db 3,'irp' + dw irp_directive-directive_handler + db 4,'irps' + dw irps_directive-directive_handler + db 4,'irpv' + dw irpv_directive-directive_handler + db 5,'macro' + dw define_macro-directive_handler + db 5,'match' + dw match_directive-directive_handler + db 8,'postpone' + dw postpone_directive-directive_handler + db 5,'purge' + dw purge_macro-directive_handler + db 4,'rept' + dw rept_directive-directive_handler + db 7,'restore' + dw restore_equ_constant-directive_handler + db 7,'restruc' + dw purge_struc-directive_handler + db 5,'struc' + dw define_struc-directive_handler + db 0 + +macro_directives: + db 6,'common' + dw common_block-directive_handler + db 7,'forward' + dw forward_block-directive_handler + db 5,'local' + dw local_symbols-directive_handler + db 7,'reverse' + dw reverse_block-directive_handler + db 0 + +operators: + db 1,'+',80h + db 1,'-',81h + db 1,'*',90h + db 1,'/',91h + db 3,'and',0B0h + db 3,'mod',0A0h + db 2,'or',0B1h + db 3,'shl',0C0h + db 3,'shr',0C1h + db 3,'xor',0B2h + db 0 + +single_operand_operators: + db 1,'+',82h + db 1,'-',83h + db 3,'bsf',0E0h + db 3,'bsr',0E1h + db 3,'not',0D0h + db 3,'plt',0F1h + db 3,'rva',0F0h + db 0 + +directive_operators: + db 5,'align',8Ch + db 2,'as',86h + db 2,'at',80h + db 7,'defined',88h + db 8,'definite',8Ah + db 3,'dup',81h + db 2,'eq',0F0h + db 6,'eqtype',0F7h + db 4,'from',82h + db 2,'in',0F6h + db 2,'on',84h + db 3,'ptr',85h + db 10,'relativeto',0F8h + db 4,'used',89h + db 0 + +address_sizes: + db 4,'byte',1 + db 5,'dword',4 + db 5,'qword',8 + db 4,'word',2 + db 0 + +symbols: + dw symbols_1-symbols,(symbols_2-symbols_1)/(1+2) + dw symbols_2-symbols,(symbols_3-symbols_2)/(2+2) + dw symbols_3-symbols,(symbols_4-symbols_3)/(3+2) + dw symbols_4-symbols,(symbols_5-symbols_4)/(4+2) + dw symbols_5-symbols,(symbols_6-symbols_5)/(5+2) + dw symbols_6-symbols,(symbols_7-symbols_6)/(6+2) + dw symbols_7-symbols,(symbols_8-symbols_7)/(7+2) + dw symbols_8-symbols,(symbols_9-symbols_8)/(8+2) + dw symbols_9-symbols,(symbols_10-symbols_9)/(9+2) + dw symbols_10-symbols,(symbols_11-symbols_10)/(10+2) + dw symbols_11-symbols,(symbols_end-symbols_11)/(11+2) + +symbols_1: + db 'z',1Fh,0 +symbols_2: + db 'ah',10h,04h + db 'al',10h,10h + db 'ax',10h,20h + db 'bh',10h,07h + db 'bl',10h,13h + db 'bp',10h,25h + db 'bx',10h,23h + db 'ch',10h,05h + db 'cl',10h,11h + db 'cs',10h,32h + db 'cx',10h,21h + db 'dh',10h,06h + db 'di',10h,27h + db 'dl',10h,12h + db 'ds',10h,34h + db 'dx',10h,22h + db 'es',10h,31h + db 'fs',10h,35h + db 'gs',10h,36h + db 'k0',14h,50h + db 'k1',14h,51h + db 'k2',14h,52h + db 'k3',14h,53h + db 'k4',14h,54h + db 'k5',14h,55h + db 'k6',14h,56h + db 'k7',14h,57h + db 'ms',1Ch,41h + db 'mz',18h,20h + db 'nx',1Bh,83h + db 'pe',18h,30h + db 'r8',10h,88h + db 'r9',10h,89h + db 'rd',1Fh,21h + db 'rn',1Fh,20h + db 'ru',1Fh,22h + db 'rz',1Fh,23h + db 'si',10h,26h + db 'sp',10h,24h + db 'ss',10h,33h + db 'st',10h,0A0h +symbols_3: + db 'bpl',10h,15h + db 'cr0',14h,00h + db 'cr1',14h,01h + db 'cr2',14h,02h + db 'cr3',14h,03h + db 'cr4',14h,04h + db 'cr5',14h,05h + db 'cr6',14h,06h + db 'cr7',14h,07h + db 'cr8',14h,08h + db 'cr9',14h,09h + db 'dil',10h,17h + db 'dll',1Bh,80h + db 'dr0',14h,10h + db 'dr1',14h,11h + db 'dr2',14h,12h + db 'dr3',14h,13h + db 'dr4',14h,14h + db 'dr5',14h,15h + db 'dr6',14h,16h + db 'dr7',14h,17h + db 'dr8',14h,18h + db 'dr9',14h,19h + db 'eax',10h,40h + db 'ebp',10h,45h + db 'ebx',10h,43h + db 'ecx',10h,41h + db 'edi',10h,47h + db 'edx',10h,42h + db 'efi',1Bh,10 + db 'eip',10h,94h + db 'elf',18h,50h + db 'esi',10h,46h + db 'esp',10h,44h + db 'far',12h,3 + db 'gui',1Bh,2 + db 'mm0',10h,0B0h + db 'mm1',10h,0B1h + db 'mm2',10h,0B2h + db 'mm3',10h,0B3h + db 'mm4',10h,0B4h + db 'mm5',10h,0B5h + db 'mm6',10h,0B6h + db 'mm7',10h,0B7h + db 'r10',10h,8Ah + db 'r11',10h,8Bh + db 'r12',10h,8Ch + db 'r13',10h,8Dh + db 'r14',10h,8Eh + db 'r15',10h,8Fh + db 'r8b',10h,18h + db 'r8d',10h,48h + db 'r8l',10h,18h + db 'r8w',10h,28h + db 'r9b',10h,19h + db 'r9d',10h,49h + db 'r9l',10h,19h + db 'r9w',10h,29h + db 'rax',10h,80h + db 'rbp',10h,85h + db 'rbx',10h,83h + db 'rcx',10h,81h + db 'rdi',10h,87h + db 'rdx',10h,82h + db 'rip',10h,98h + db 'rsi',10h,86h + db 'rsp',10h,84h + db 'sae',1Fh,30h + db 'sil',10h,16h + db 'spl',10h,14h + db 'st0',10h,0A0h + db 'st1',10h,0A1h + db 'st2',10h,0A2h + db 'st3',10h,0A3h + db 'st4',10h,0A4h + db 'st5',10h,0A5h + db 'st6',10h,0A6h + db 'st7',10h,0A7h + db 'tr0',14h,40h + db 'tr1',14h,41h + db 'tr2',14h,42h + db 'tr3',14h,43h + db 'tr4',14h,44h + db 'tr5',14h,45h + db 'tr6',14h,46h + db 'tr7',14h,47h + db 'wdm',1Bh,81h +symbols_4: + db '1to2',1Fh,11h + db '1to4',1Fh,12h + db '1to8',1Fh,13h + db 'bnd0',14h,60h + db 'bnd1',14h,61h + db 'bnd2',14h,62h + db 'bnd3',14h,63h + db 'byte',11h,1 + db 'code',19h,5 + db 'coff',18h,40h + db 'cr10',14h,0Ah + db 'cr11',14h,0Bh + db 'cr12',14h,0Ch + db 'cr13',14h,0Dh + db 'cr14',14h,0Eh + db 'cr15',14h,0Fh + db 'data',19h,6 + db 'dr10',14h,1Ah + db 'dr11',14h,1Bh + db 'dr12',14h,1Ch + db 'dr13',14h,1Dh + db 'dr14',14h,1Eh + db 'dr15',14h,1Fh + db 'ms64',1Ch,49h + db 'near',12h,2 + db 'note',1Eh,4 + db 'pe64',18h,3Ch + db 'r10b',10h,1Ah + db 'r10d',10h,4Ah + db 'r10l',10h,1Ah + db 'r10w',10h,2Ah + db 'r11b',10h,1Bh + db 'r11d',10h,4Bh + db 'r11l',10h,1Bh + db 'r11w',10h,2Bh + db 'r12b',10h,1Ch + db 'r12d',10h,4Ch + db 'r12l',10h,1Ch + db 'r12w',10h,2Ch + db 'r13b',10h,1Dh + db 'r13d',10h,4Dh + db 'r13l',10h,1Dh + db 'r13w',10h,2Dh + db 'r14b',10h,1Eh + db 'r14d',10h,4Eh + db 'r14l',10h,1Eh + db 'r14w',10h,2Eh + db 'r15b',10h,1Fh + db 'r15d',10h,4Fh + db 'r15l',10h,1Fh + db 'r15w',10h,2Fh + db 'word',11h,2 + db 'xmm0',10h,0C0h + db 'xmm1',10h,0C1h + db 'xmm2',10h,0C2h + db 'xmm3',10h,0C3h + db 'xmm4',10h,0C4h + db 'xmm5',10h,0C5h + db 'xmm6',10h,0C6h + db 'xmm7',10h,0C7h + db 'xmm8',10h,0C8h + db 'xmm9',10h,0C9h + db 'ymm0',10h,0E0h + db 'ymm1',10h,0E1h + db 'ymm2',10h,0E2h + db 'ymm3',10h,0E3h + db 'ymm4',10h,0E4h + db 'ymm5',10h,0E5h + db 'ymm6',10h,0E6h + db 'ymm7',10h,0E7h + db 'ymm8',10h,0E8h + db 'ymm9',10h,0E9h + db 'zmm0',10h,60h + db 'zmm1',10h,61h + db 'zmm2',10h,62h + db 'zmm3',10h,63h + db 'zmm4',10h,64h + db 'zmm5',10h,65h + db 'zmm6',10h,66h + db 'zmm7',10h,67h + db 'zmm8',10h,68h + db 'zmm9',10h,69h +symbols_5: + db '1to16',1Fh,14h + db 'dword',11h,4 + db 'elf64',18h,58h + db 'fword',11h,6 + db 'large',1Bh,82h + db 'pword',11h,6 + db 'qword',11h,8 + db 'short',12h,1 + db 'tbyte',11h,0Ah + db 'tword',11h,0Ah + db 'use16',13h,16 + db 'use32',13h,32 + db 'use64',13h,64 + db 'xmm10',10h,0CAh + db 'xmm11',10h,0CBh + db 'xmm12',10h,0CCh + db 'xmm13',10h,0CDh + db 'xmm14',10h,0CEh + db 'xmm15',10h,0CFh + db 'xmm16',10h,0D0h + db 'xmm17',10h,0D1h + db 'xmm18',10h,0D2h + db 'xmm19',10h,0D3h + db 'xmm20',10h,0D4h + db 'xmm21',10h,0D5h + db 'xmm22',10h,0D6h + db 'xmm23',10h,0D7h + db 'xmm24',10h,0D8h + db 'xmm25',10h,0D9h + db 'xmm26',10h,0DAh + db 'xmm27',10h,0DBh + db 'xmm28',10h,0DCh + db 'xmm29',10h,0DDh + db 'xmm30',10h,0DEh + db 'xmm31',10h,0DFh + db 'xword',11h,16 + db 'ymm10',10h,0EAh + db 'ymm11',10h,0EBh + db 'ymm12',10h,0ECh + db 'ymm13',10h,0EDh + db 'ymm14',10h,0EEh + db 'ymm15',10h,0EFh + db 'ymm16',10h,0F0h + db 'ymm17',10h,0F1h + db 'ymm18',10h,0F2h + db 'ymm19',10h,0F3h + db 'ymm20',10h,0F4h + db 'ymm21',10h,0F5h + db 'ymm22',10h,0F6h + db 'ymm23',10h,0F7h + db 'ymm24',10h,0F8h + db 'ymm25',10h,0F9h + db 'ymm26',10h,0FAh + db 'ymm27',10h,0FBh + db 'ymm28',10h,0FCh + db 'ymm29',10h,0FDh + db 'ymm30',10h,0FEh + db 'ymm31',10h,0FFh + db 'yword',11h,32 + db 'zmm10',10h,6Ah + db 'zmm11',10h,6Bh + db 'zmm12',10h,6Ch + db 'zmm13',10h,6Dh + db 'zmm14',10h,6Eh + db 'zmm15',10h,6Fh + db 'zmm16',10h,70h + db 'zmm17',10h,71h + db 'zmm18',10h,72h + db 'zmm19',10h,73h + db 'zmm20',10h,74h + db 'zmm21',10h,75h + db 'zmm22',10h,76h + db 'zmm23',10h,77h + db 'zmm24',10h,78h + db 'zmm25',10h,79h + db 'zmm26',10h,7Ah + db 'zmm27',10h,7Bh + db 'zmm28',10h,7Ch + db 'zmm29',10h,7Dh + db 'zmm30',10h,7Eh + db 'zmm31',10h,7Fh + db 'zword',11h,64 +symbols_6: + db 'binary',18h,10h + db 'dqword',11h,16 + db 'export',1Ah,0 + db 'fixups',1Ah,5 + db 'import',1Ah,1 + db 'native',1Bh,1 + db 'qqword',11h,32 + db 'static',1Dh,1 +symbols_7: + db 'console',1Bh,3 + db 'dqqword',11h,64 + db 'dynamic',1Eh,2 + db 'efiboot',1Bh,11 +symbols_8: + db 'gnurelro',1Eh,52h + db 'gnustack',1Eh,51h + db 'linkinfo',19h,9 + db 'readable',19h,30 + db 'resource',1Ah,2 + db 'writable',19h,31 +symbols_9: + db 'shareable',19h,28 + db 'writeable',19h,31 +symbols_10: + db 'efiruntime',1Bh,12 + db 'executable',19h,29 + db 'gnuehframe',1Eh,50h + db 'linkremove',19h,11 +symbols_11: + db 'discardable',19h,25 + db 'interpreter',1Eh,3 + db 'notpageable',19h,27 +symbols_end: + +instructions: + dw instructions_2-instructions,(instructions_3-instructions_2)/(2+3) + dw instructions_3-instructions,(instructions_4-instructions_3)/(3+3) + dw instructions_4-instructions,(instructions_5-instructions_4)/(4+3) + dw instructions_5-instructions,(instructions_6-instructions_5)/(5+3) + dw instructions_6-instructions,(instructions_7-instructions_6)/(6+3) + dw instructions_7-instructions,(instructions_8-instructions_7)/(7+3) + dw instructions_8-instructions,(instructions_9-instructions_8)/(8+3) + dw instructions_9-instructions,(instructions_10-instructions_9)/(9+3) + dw instructions_10-instructions,(instructions_11-instructions_10)/(10+3) + dw instructions_11-instructions,(instructions_12-instructions_11)/(11+3) + dw instructions_12-instructions,(instructions_13-instructions_12)/(12+3) + dw instructions_13-instructions,(instructions_14-instructions_13)/(13+3) + dw instructions_14-instructions,(instructions_15-instructions_14)/(14+3) + dw instructions_15-instructions,(instructions_16-instructions_15)/(15+3) + dw instructions_16-instructions,(instructions_17-instructions_16)/(16+3) + dw instructions_17-instructions,(instructions_end-instructions_17)/(16+3) + +instructions_2: + db 'bt',4 + dw bt_instruction-instruction_handler + db 'if',0 + dw if_directive-instruction_handler + db 'in',0 + dw in_instruction-instruction_handler + db 'ja',77h + dw conditional_jump-instruction_handler + db 'jb',72h + dw conditional_jump-instruction_handler + db 'jc',72h + dw conditional_jump-instruction_handler + db 'je',74h + dw conditional_jump-instruction_handler + db 'jg',7Fh + dw conditional_jump-instruction_handler + db 'jl',7Ch + dw conditional_jump-instruction_handler + db 'jo',70h + dw conditional_jump-instruction_handler + db 'jp',7Ah + dw conditional_jump-instruction_handler + db 'js',78h + dw conditional_jump-instruction_handler + db 'jz',74h + dw conditional_jump-instruction_handler + db 'or',08h + dw basic_instruction-instruction_handler +instructions_3: + db 'aaa',37h + dw simple_instruction_except64-instruction_handler + db 'aad',0D5h + dw aa_instruction-instruction_handler + db 'aam',0D4h + dw aa_instruction-instruction_handler + db 'aas',3Fh + dw simple_instruction_except64-instruction_handler + db 'adc',10h + dw basic_instruction-instruction_handler + db 'add',00h + dw basic_instruction-instruction_handler + db 'and',20h + dw basic_instruction-instruction_handler + db 'bnd',0F2h + dw bnd_prefix_instruction-instruction_handler + db 'bsf',0BCh + dw bs_instruction-instruction_handler + db 'bsr',0BDh + dw bs_instruction-instruction_handler + db 'btc',7 + dw bt_instruction-instruction_handler + db 'btr',6 + dw bt_instruction-instruction_handler + db 'bts',5 + dw bt_instruction-instruction_handler + db 'cbw',98h + dw simple_instruction_16bit-instruction_handler + db 'cdq',99h + dw simple_instruction_32bit-instruction_handler + db 'clc',0F8h + dw simple_instruction-instruction_handler + db 'cld',0FCh + dw simple_instruction-instruction_handler + db 'cli',0FAh + dw simple_instruction-instruction_handler + db 'cmc',0F5h + dw simple_instruction-instruction_handler + db 'cmp',38h + dw basic_instruction-instruction_handler + db 'cqo',99h + dw simple_instruction_64bit-instruction_handler + db 'cwd',99h + dw simple_instruction_16bit-instruction_handler + db 'daa',27h + dw simple_instruction_except64-instruction_handler + db 'das',2Fh + dw simple_instruction_except64-instruction_handler + db 'dec',1 + dw inc_instruction-instruction_handler + db 'div',6 + dw single_operand_instruction-instruction_handler + db 'end',0 + dw end_directive-instruction_handler + db 'err',0 + dw err_directive-instruction_handler + db 'fld',0 + dw fld_instruction-instruction_handler + db 'fst',2 + dw fld_instruction-instruction_handler + db 'hlt',0F4h + dw simple_instruction-instruction_handler + db 'inc',0 + dw inc_instruction-instruction_handler + db 'ins',6Ch + dw ins_instruction-instruction_handler + db 'int',0CDh + dw int_instruction-instruction_handler + db 'jae',73h + dw conditional_jump-instruction_handler + db 'jbe',76h + dw conditional_jump-instruction_handler + db 'jge',7Dh + dw conditional_jump-instruction_handler + db 'jle',7Eh + dw conditional_jump-instruction_handler + db 'jmp',0 + dw jmp_instruction-instruction_handler + db 'jna',76h + dw conditional_jump-instruction_handler + db 'jnb',73h + dw conditional_jump-instruction_handler + db 'jnc',73h + dw conditional_jump-instruction_handler + db 'jne',75h + dw conditional_jump-instruction_handler + db 'jng',7Eh + dw conditional_jump-instruction_handler + db 'jnl',7Dh + dw conditional_jump-instruction_handler + db 'jno',71h + dw conditional_jump-instruction_handler + db 'jnp',7Bh + dw conditional_jump-instruction_handler + db 'jns',79h + dw conditional_jump-instruction_handler + db 'jnz',75h + dw conditional_jump-instruction_handler + db 'jpe',7Ah + dw conditional_jump-instruction_handler + db 'jpo',7Bh + dw conditional_jump-instruction_handler + db 'lar',2 + dw lar_instruction-instruction_handler + db 'lds',3 + dw ls_instruction-instruction_handler + db 'lea',0 + dw lea_instruction-instruction_handler + db 'les',0 + dw ls_instruction-instruction_handler + db 'lfs',4 + dw ls_instruction-instruction_handler + db 'lgs',5 + dw ls_instruction-instruction_handler + db 'lsl',3 + dw lar_instruction-instruction_handler + db 'lss',2 + dw ls_instruction-instruction_handler + db 'ltr',3 + dw pm_word_instruction-instruction_handler + db 'mov',0 + dw mov_instruction-instruction_handler + db 'mul',4 + dw single_operand_instruction-instruction_handler + db 'neg',3 + dw single_operand_instruction-instruction_handler + db 'nop',90h + dw nop_instruction-instruction_handler + db 'not',2 + dw single_operand_instruction-instruction_handler + db 'org',0 + dw org_directive-instruction_handler + db 'out',0 + dw out_instruction-instruction_handler + db 'pop',0 + dw pop_instruction-instruction_handler + db 'por',0EBh + dw basic_mmx_instruction-instruction_handler + db 'rcl',2 + dw sh_instruction-instruction_handler + db 'rcr',3 + dw sh_instruction-instruction_handler + db 'rep',0F3h + dw prefix_instruction-instruction_handler + db 'ret',0C2h + dw ret_instruction-instruction_handler + db 'rol',0 + dw sh_instruction-instruction_handler + db 'ror',1 + dw sh_instruction-instruction_handler + db 'rsm',0AAh + dw simple_extended_instruction-instruction_handler + db 'sal',4 + dw sh_instruction-instruction_handler + db 'sar',7 + dw sh_instruction-instruction_handler + db 'sbb',18h + dw basic_instruction-instruction_handler + db 'shl',4 + dw sh_instruction-instruction_handler + db 'shr',5 + dw sh_instruction-instruction_handler + db 'stc',0F9h + dw simple_instruction-instruction_handler + db 'std',0FDh + dw simple_instruction-instruction_handler + db 'sti',0FBh + dw simple_instruction-instruction_handler + db 'str',1 + dw pm_store_word_instruction-instruction_handler + db 'sub',28h + dw basic_instruction-instruction_handler + db 'ud0',0FFh + dw ud_instruction-instruction_handler + db 'ud1',0B9h + dw ud_instruction-instruction_handler + db 'ud2',0Bh + dw simple_extended_instruction-instruction_handler + db 'xor',30h + dw basic_instruction-instruction_handler +instructions_4: + db 'adcx',66h + dw adx_instruction-instruction_handler + db 'adox',0F3h + dw adx_instruction-instruction_handler + db 'andn',0F2h + dw andn_instruction-instruction_handler + db 'arpl',0 + dw arpl_instruction-instruction_handler + db 'blci',26h + dw tbm_instruction-instruction_handler + db 'blcs',13h + dw tbm_instruction-instruction_handler + db 'blsi',3 + dw bmi_instruction-instruction_handler + db 'blsr',1 + dw bmi_instruction-instruction_handler + db 'bzhi',0F5h + dw bzhi_instruction-instruction_handler + db 'call',0 + dw call_instruction-instruction_handler + db 'cdqe',98h + dw simple_instruction_64bit-instruction_handler + db 'clac',0CAh + dw simple_instruction_0f_01-instruction_handler + db 'clgi',0DDh + dw simple_instruction_0f_01-instruction_handler + db 'clts',6 + dw simple_extended_instruction-instruction_handler + db 'clwb',6 + dw clflushopt_instruction-instruction_handler + db 'cmps',0A6h + dw cmps_instruction-instruction_handler + db 'cwde',98h + dw simple_instruction_32bit-instruction_handler + db 'data',0 + dw data_directive-instruction_handler + db 'dppd',41h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'dpps',40h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'else',0 + dw else_directive-instruction_handler + db 'emms',77h + dw simple_extended_instruction-instruction_handler + db 'fabs',100001b + dw simple_fpu_instruction-instruction_handler + db 'fadd',0 + dw basic_fpu_instruction-instruction_handler + db 'fbld',4 + dw fbld_instruction-instruction_handler + db 'fchs',100000b + dw simple_fpu_instruction-instruction_handler + db 'fcom',2 + dw basic_fpu_instruction-instruction_handler + db 'fcos',111111b + dw simple_fpu_instruction-instruction_handler + db 'fdiv',6 + dw basic_fpu_instruction-instruction_handler + db 'feni',0E0h + dw finit_instruction-instruction_handler + db 'fild',0 + dw fild_instruction-instruction_handler + db 'fist',2 + dw fild_instruction-instruction_handler + db 'fld1',101000b + dw simple_fpu_instruction-instruction_handler + db 'fldz',101110b + dw simple_fpu_instruction-instruction_handler + db 'fmul',1 + dw basic_fpu_instruction-instruction_handler + db 'fnop',010000b + dw simple_fpu_instruction-instruction_handler + db 'fsin',111110b + dw simple_fpu_instruction-instruction_handler + db 'fstp',3 + dw fld_instruction-instruction_handler + db 'fsub',4 + dw basic_fpu_instruction-instruction_handler + db 'ftst',100100b + dw simple_fpu_instruction-instruction_handler + db 'fxam',100101b + dw simple_fpu_instruction-instruction_handler + db 'fxch',0 + dw fxch_instruction-instruction_handler + db 'heap',0 + dw heap_directive-instruction_handler + db 'idiv',7 + dw single_operand_instruction-instruction_handler + db 'imul',0 + dw imul_instruction-instruction_handler + db 'insb',6Ch + dw simple_instruction-instruction_handler + db 'insd',6Dh + dw simple_instruction_32bit-instruction_handler + db 'insw',6Dh + dw simple_instruction_16bit-instruction_handler + db 'int1',0F1h + dw simple_instruction-instruction_handler + db 'int3',0CCh + dw simple_instruction-instruction_handler + db 'into',0CEh + dw simple_instruction_except64-instruction_handler + db 'invd',8 + dw simple_extended_instruction-instruction_handler + db 'iret',0CFh + dw iret_instruction-instruction_handler + db 'jcxz',0E3h + dw loop_instruction_16bit-instruction_handler + db 'jnae',72h + dw conditional_jump-instruction_handler + db 'jnbe',77h + dw conditional_jump-instruction_handler + db 'jnge',7Ch + dw conditional_jump-instruction_handler + db 'jnle',7Fh + dw conditional_jump-instruction_handler + db 'korb',45h + dw mask_instruction_b-instruction_handler + db 'kord',45h + dw mask_instruction_d-instruction_handler + db 'korq',45h + dw mask_instruction_q-instruction_handler + db 'korw',45h + dw mask_instruction_w-instruction_handler + db 'lahf',9Fh + dw simple_instruction-instruction_handler + db 'lgdt',2 + dw lgdt_instruction-instruction_handler + db 'lidt',3 + dw lgdt_instruction-instruction_handler + db 'lldt',2 + dw pm_word_instruction-instruction_handler + db 'lmsw',16h + dw pm_word_instruction-instruction_handler + db 'load',0 + dw load_directive-instruction_handler + db 'lock',0F0h + dw prefix_instruction-instruction_handler + db 'lods',0ACh + dw lods_instruction-instruction_handler + db 'loop',0E2h + dw loop_instruction-instruction_handler + db 'movd',0 + dw movd_instruction-instruction_handler + db 'movq',0 + dw movq_instruction-instruction_handler + db 'movs',0A4h + dw movs_instruction-instruction_handler + db 'mulx',0F6h + dw pdep_instruction-instruction_handler + db 'orpd',56h + dw sse_pd_instruction-instruction_handler + db 'orps',56h + dw sse_ps_instruction-instruction_handler + db 'outs',6Eh + dw outs_instruction-instruction_handler + db 'pand',0DBh + dw basic_mmx_instruction-instruction_handler + db 'pdep',0F5h + dw pdep_instruction-instruction_handler + db 'pext',0F5h + dw pext_instruction-instruction_handler + db 'popa',61h + dw simple_instruction_except64-instruction_handler + db 'popd',4 + dw pop_instruction-instruction_handler + db 'popf',9Dh + dw simple_instruction-instruction_handler + db 'popq',8 + dw pop_instruction-instruction_handler + db 'popw',2 + dw pop_instruction-instruction_handler + db 'push',0 + dw push_instruction-instruction_handler + db 'pxor',0EFh + dw basic_mmx_instruction-instruction_handler + db 'repe',0F3h + dw prefix_instruction-instruction_handler + db 'repz',0F3h + dw prefix_instruction-instruction_handler + db 'retd',0C2h + dw ret_instruction_32bit_except64-instruction_handler + db 'retf',0CAh + dw retf_instruction-instruction_handler + db 'retn',0C2h + dw ret_instruction-instruction_handler + db 'retq',0C2h + dw ret_instruction_only64-instruction_handler + db 'retw',0C2h + dw ret_instruction_16bit-instruction_handler + db 'rorx',0F0h + dw rorx_instruction-instruction_handler + db 'sahf',9Eh + dw simple_instruction-instruction_handler + db 'salc',0D6h + dw simple_instruction_except64-instruction_handler + db 'sarx',0F7h + dw sarx_instruction-instruction_handler + db 'scas',0AEh + dw stos_instruction-instruction_handler + db 'seta',97h + dw set_instruction-instruction_handler + db 'setb',92h + dw set_instruction-instruction_handler + db 'setc',92h + dw set_instruction-instruction_handler + db 'sete',94h + dw set_instruction-instruction_handler + db 'setg',9Fh + dw set_instruction-instruction_handler + db 'setl',9Ch + dw set_instruction-instruction_handler + db 'seto',90h + dw set_instruction-instruction_handler + db 'setp',9Ah + dw set_instruction-instruction_handler + db 'sets',98h + dw set_instruction-instruction_handler + db 'setz',94h + dw set_instruction-instruction_handler + db 'sgdt',0 + dw lgdt_instruction-instruction_handler + db 'shld',0A4h + dw shd_instruction-instruction_handler + db 'shlx',0F7h + dw shlx_instruction-instruction_handler + db 'shrd',0ACh + dw shd_instruction-instruction_handler + db 'shrx',0F7h + dw shrx_instruction-instruction_handler + db 'sidt',1 + dw lgdt_instruction-instruction_handler + db 'sldt',0 + dw pm_store_word_instruction-instruction_handler + db 'smsw',14h + dw pm_store_word_instruction-instruction_handler + db 'stac',0CBh + dw simple_instruction_0f_01-instruction_handler + db 'stgi',0DCh + dw simple_instruction_0f_01-instruction_handler + db 'stos',0AAh + dw stos_instruction-instruction_handler + db 'test',0 + dw test_instruction-instruction_handler + db 'verr',4 + dw pm_word_instruction-instruction_handler + db 'verw',5 + dw pm_word_instruction-instruction_handler + db 'vpor',0EBh + dw avx_pd_instruction_noevex-instruction_handler + db 'wait',9Bh + dw simple_instruction-instruction_handler + db 'xadd',0C0h + dw basic_486_instruction-instruction_handler + db 'xchg',0 + dw xchg_instruction-instruction_handler + db 'xend',0D5h + dw simple_instruction_0f_01-instruction_handler + db 'xlat',0D7h + dw xlat_instruction-instruction_handler +instructions_5: + db 'addpd',58h + dw sse_pd_instruction-instruction_handler + db 'addps',58h + dw sse_ps_instruction-instruction_handler + db 'addsd',58h + dw sse_sd_instruction-instruction_handler + db 'addss',58h + dw sse_ss_instruction-instruction_handler + db 'align',0 + dw align_directive-instruction_handler + db 'andpd',54h + dw sse_pd_instruction-instruction_handler + db 'andps',54h + dw sse_ps_instruction-instruction_handler + db 'bextr',0F7h + dw bextr_instruction-instruction_handler + db 'blcic',15h + dw tbm_instruction-instruction_handler + db 'blsic',16h + dw tbm_instruction-instruction_handler + db 'bndcl',1Ah + dw bndcl_instruction-instruction_handler + db 'bndcn',1Bh + dw bndcu_instruction-instruction_handler + db 'bndcu',1Ah + dw bndcu_instruction-instruction_handler + db 'bndmk',1Bh + dw bndmk_instruction-instruction_handler + db 'bound',0 + dw bound_instruction-instruction_handler + db 'break',0 + dw break_directive-instruction_handler + db 'bswap',0 + dw bswap_instruction-instruction_handler + db 'cmova',47h + dw bs_instruction-instruction_handler + db 'cmovb',42h + dw bs_instruction-instruction_handler + db 'cmovc',42h + dw bs_instruction-instruction_handler + db 'cmove',44h + dw bs_instruction-instruction_handler + db 'cmovg',4Fh + dw bs_instruction-instruction_handler + db 'cmovl',4Ch + dw bs_instruction-instruction_handler + db 'cmovo',40h + dw bs_instruction-instruction_handler + db 'cmovp',4Ah + dw bs_instruction-instruction_handler + db 'cmovs',48h + dw bs_instruction-instruction_handler + db 'cmovz',44h + dw bs_instruction-instruction_handler + db 'cmppd',-1 + dw cmp_pd_instruction-instruction_handler + db 'cmpps',-1 + dw cmp_ps_instruction-instruction_handler + db 'cmpsb',0A6h + dw simple_instruction-instruction_handler + db 'cmpsd',-1 + dw cmpsd_instruction-instruction_handler + db 'cmpsq',0A7h + dw simple_instruction_64bit-instruction_handler + db 'cmpss',-1 + dw cmp_ss_instruction-instruction_handler + db 'cmpsw',0A7h + dw simple_instruction_16bit-instruction_handler + db 'cpuid',0A2h + dw simple_extended_instruction-instruction_handler + db 'crc32',0 + dw crc32_instruction-instruction_handler + db 'divpd',5Eh + dw sse_pd_instruction-instruction_handler + db 'divps',5Eh + dw sse_ps_instruction-instruction_handler + db 'divsd',5Eh + dw sse_sd_instruction-instruction_handler + db 'divss',5Eh + dw sse_ss_instruction-instruction_handler + db 'enter',0 + dw enter_instruction-instruction_handler + db 'entry',0 + dw entry_directive-instruction_handler + db 'extrn',0 + dw extrn_directive-instruction_handler + db 'extrq',0 + dw extrq_instruction-instruction_handler + db 'f2xm1',110000b + dw simple_fpu_instruction-instruction_handler + db 'faddp',0 + dw faddp_instruction-instruction_handler + db 'fbstp',6 + dw fbld_instruction-instruction_handler + db 'fclex',0E2h + dw finit_instruction-instruction_handler + db 'fcomi',0F0h + dw fcomi_instruction-instruction_handler + db 'fcomp',3 + dw basic_fpu_instruction-instruction_handler + db 'fdisi',0E1h + dw finit_instruction-instruction_handler + db 'fdivp',7 + dw faddp_instruction-instruction_handler + db 'fdivr',7 + dw basic_fpu_instruction-instruction_handler + db 'femms',0Eh + dw simple_extended_instruction-instruction_handler + db 'ffree',0 + dw ffree_instruction-instruction_handler + db 'fiadd',0 + dw fi_instruction-instruction_handler + db 'ficom',2 + dw fi_instruction-instruction_handler + db 'fidiv',6 + dw fi_instruction-instruction_handler + db 'fimul',1 + dw fi_instruction-instruction_handler + db 'finit',0E3h + dw finit_instruction-instruction_handler + db 'fistp',3 + dw fild_instruction-instruction_handler + db 'fisub',4 + dw fi_instruction-instruction_handler + db 'fldcw',5 + dw fldcw_instruction-instruction_handler + db 'fldpi',101011b + dw simple_fpu_instruction-instruction_handler + db 'fmulp',1 + dw faddp_instruction-instruction_handler + db 'fneni',0E0h + dw fninit_instruction-instruction_handler + db 'fprem',111000b + dw simple_fpu_instruction-instruction_handler + db 'fptan',110010b + dw simple_fpu_instruction-instruction_handler + db 'fsave',6 + dw fsave_instruction-instruction_handler + db 'fsqrt',111010b + dw simple_fpu_instruction-instruction_handler + db 'fstcw',7 + dw fstcw_instruction-instruction_handler + db 'fstsw',0 + dw fstsw_instruction-instruction_handler + db 'fsubp',5 + dw faddp_instruction-instruction_handler + db 'fsubr',5 + dw basic_fpu_instruction-instruction_handler + db 'fucom',4 + dw ffree_instruction-instruction_handler + db 'fwait',9Bh + dw simple_instruction-instruction_handler + db 'fyl2x',110001b + dw simple_fpu_instruction-instruction_handler + db 'icebp',0F1h + dw simple_instruction-instruction_handler + db 'iretd',0CFh + dw simple_instruction_32bit-instruction_handler + db 'iretq',0CFh + dw simple_instruction_64bit-instruction_handler + db 'iretw',0CFh + dw simple_instruction_16bit-instruction_handler + db 'jecxz',0E3h + dw loop_instruction_32bit-instruction_handler + db 'jrcxz',0E3h + dw loop_instruction_64bit-instruction_handler + db 'kaddb',4Ah + dw mask_instruction_b-instruction_handler + db 'kaddd',4Ah + dw mask_instruction_d-instruction_handler + db 'kaddq',4Ah + dw mask_instruction_q-instruction_handler + db 'kaddw',4Ah + dw mask_instruction_w-instruction_handler + db 'kandb',41h + dw mask_instruction_b-instruction_handler + db 'kandd',41h + dw mask_instruction_d-instruction_handler + db 'kandq',41h + dw mask_instruction_q-instruction_handler + db 'kandw',41h + dw mask_instruction_w-instruction_handler + db 'kmovb',1 + dw kmov_instruction-instruction_handler + db 'kmovd',4 + dw kmov_instruction-instruction_handler + db 'kmovq',8 + dw kmov_instruction-instruction_handler + db 'kmovw',2 + dw kmov_instruction-instruction_handler + db 'knotb',44h + dw mask_instruction_single_source_b-instruction_handler + db 'knotd',44h + dw mask_instruction_single_source_d-instruction_handler + db 'knotq',44h + dw mask_instruction_single_source_q-instruction_handler + db 'knotw',44h + dw mask_instruction_single_source_w-instruction_handler + db 'kxorb',47h + dw mask_instruction_b-instruction_handler + db 'kxord',47h + dw mask_instruction_d-instruction_handler + db 'kxorq',47h + dw mask_instruction_q-instruction_handler + db 'kxorw',47h + dw mask_instruction_w-instruction_handler + db 'label',0 + dw label_directive-instruction_handler + db 'lddqu',0 + dw lddqu_instruction-instruction_handler + db 'leave',0C9h + dw simple_instruction-instruction_handler + db 'lodsb',0ACh + dw simple_instruction-instruction_handler + db 'lodsd',0ADh + dw simple_instruction_32bit-instruction_handler + db 'lodsq',0ADh + dw simple_instruction_64bit-instruction_handler + db 'lodsw',0ADh + dw simple_instruction_16bit-instruction_handler + db 'loopd',0E2h + dw loop_instruction_32bit-instruction_handler + db 'loope',0E1h + dw loop_instruction-instruction_handler + db 'loopq',0E2h + dw loop_instruction_64bit-instruction_handler + db 'loopw',0E2h + dw loop_instruction_16bit-instruction_handler + db 'loopz',0E1h + dw loop_instruction-instruction_handler + db 'lzcnt',0BDh + dw popcnt_instruction-instruction_handler + db 'maxpd',5Fh + dw sse_pd_instruction-instruction_handler + db 'maxps',5Fh + dw sse_ps_instruction-instruction_handler + db 'maxsd',5Fh + dw sse_sd_instruction-instruction_handler + db 'maxss',5Fh + dw sse_ss_instruction-instruction_handler + db 'minpd',5Dh + dw sse_pd_instruction-instruction_handler + db 'minps',5Dh + dw sse_ps_instruction-instruction_handler + db 'minsd',5Dh + dw sse_sd_instruction-instruction_handler + db 'minss',5Dh + dw sse_ss_instruction-instruction_handler + db 'movbe',0F0h + dw movbe_instruction-instruction_handler + db 'movsb',0A4h + dw simple_instruction-instruction_handler + db 'movsd',0 + dw movsd_instruction-instruction_handler + db 'movsq',0A5h + dw simple_instruction_64bit-instruction_handler + db 'movss',0 + dw movss_instruction-instruction_handler + db 'movsw',0A5h + dw simple_instruction_16bit-instruction_handler + db 'movsx',0BEh + dw movx_instruction-instruction_handler + db 'movzx',0B6h + dw movx_instruction-instruction_handler + db 'mulpd',59h + dw sse_pd_instruction-instruction_handler + db 'mulps',59h + dw sse_ps_instruction-instruction_handler + db 'mulsd',59h + dw sse_sd_instruction-instruction_handler + db 'mulss',59h + dw sse_ss_instruction-instruction_handler + db 'mwait',0C9h + dw monitor_instruction-instruction_handler + db 'outsb',6Eh + dw simple_instruction-instruction_handler + db 'outsd',6Fh + dw simple_instruction_32bit-instruction_handler + db 'outsw',6Fh + dw simple_instruction_16bit-instruction_handler + db 'pabsb',1Ch + dw ssse3_instruction-instruction_handler + db 'pabsd',1Eh + dw ssse3_instruction-instruction_handler + db 'pabsw',1Dh + dw ssse3_instruction-instruction_handler + db 'paddb',0FCh + dw basic_mmx_instruction-instruction_handler + db 'paddd',0FEh + dw basic_mmx_instruction-instruction_handler + db 'paddq',0D4h + dw basic_mmx_instruction-instruction_handler + db 'paddw',0FDh + dw basic_mmx_instruction-instruction_handler + db 'pandn',0DFh + dw basic_mmx_instruction-instruction_handler + db 'pause',0 + dw pause_instruction-instruction_handler + db 'pavgb',0E0h + dw basic_mmx_instruction-instruction_handler + db 'pavgw',0E3h + dw basic_mmx_instruction-instruction_handler + db 'pf2id',1Dh + dw amd3dnow_instruction-instruction_handler + db 'pf2iw',1Ch + dw amd3dnow_instruction-instruction_handler + db 'pfacc',0AEh + dw amd3dnow_instruction-instruction_handler + db 'pfadd',9Eh + dw amd3dnow_instruction-instruction_handler + db 'pfmax',0A4h + dw amd3dnow_instruction-instruction_handler + db 'pfmin',94h + dw amd3dnow_instruction-instruction_handler + db 'pfmul',0B4h + dw amd3dnow_instruction-instruction_handler + db 'pfrcp',96h + dw amd3dnow_instruction-instruction_handler + db 'pfsub',9Ah + dw amd3dnow_instruction-instruction_handler + db 'pi2fd',0Dh + dw amd3dnow_instruction-instruction_handler + db 'pi2fw',0Ch + dw amd3dnow_instruction-instruction_handler + db 'popad',61h + dw simple_instruction_32bit_except64-instruction_handler + db 'popaw',61h + dw simple_instruction_16bit_except64-instruction_handler + db 'popfd',9Dh + dw simple_instruction_32bit_except64-instruction_handler + db 'popfq',9Dh + dw simple_instruction_only64-instruction_handler + db 'popfw',9Dh + dw simple_instruction_16bit-instruction_handler + db 'pslld',0F2h + dw mmx_bit_shift_instruction-instruction_handler + db 'psllq',0F3h + dw mmx_bit_shift_instruction-instruction_handler + db 'psllw',0F1h + dw mmx_bit_shift_instruction-instruction_handler + db 'psrad',0E2h + dw mmx_bit_shift_instruction-instruction_handler + db 'psraw',0E1h + dw mmx_bit_shift_instruction-instruction_handler + db 'psrld',0D2h + dw mmx_bit_shift_instruction-instruction_handler + db 'psrlq',0D3h + dw mmx_bit_shift_instruction-instruction_handler + db 'psrlw',0D1h + dw mmx_bit_shift_instruction-instruction_handler + db 'psubb',0F8h + dw basic_mmx_instruction-instruction_handler + db 'psubd',0FAh + dw basic_mmx_instruction-instruction_handler + db 'psubq',0FBh + dw basic_mmx_instruction-instruction_handler + db 'psubw',0F9h + dw basic_mmx_instruction-instruction_handler + db 'ptest',17h + dw sse4_instruction_66_38-instruction_handler + db 'pusha',60h + dw simple_instruction_except64-instruction_handler + db 'pushd',4 + dw push_instruction-instruction_handler + db 'pushf',9Ch + dw simple_instruction-instruction_handler + db 'pushq',8 + dw push_instruction-instruction_handler + db 'pushw',2 + dw push_instruction-instruction_handler + db 'rcpps',53h + dw sse_ps_instruction-instruction_handler + db 'rcpss',53h + dw sse_ss_instruction-instruction_handler + db 'rdmsr',32h + dw simple_extended_instruction-instruction_handler + db 'rdpid',7 + dw rdpid_instruction-instruction_handler + db 'rdpmc',33h + dw simple_extended_instruction-instruction_handler + db 'rdpru',0FDh + dw simple_instruction_0f_01-instruction_handler + db 'rdtsc',31h + dw simple_extended_instruction-instruction_handler + db 'repne',0F2h + dw prefix_instruction-instruction_handler + db 'repnz',0F2h + dw prefix_instruction-instruction_handler + db 'retfd',0CAh + dw retf_instruction_32bit-instruction_handler + db 'retfq',0CAh + dw retf_instruction_64bit-instruction_handler + db 'retfw',0CAh + dw retf_instruction_16bit-instruction_handler + db 'retnd',0C2h + dw ret_instruction_32bit_except64-instruction_handler + db 'retnq',0C2h + dw ret_instruction_only64-instruction_handler + db 'retnw',0C2h + dw ret_instruction_16bit-instruction_handler + db 'scasb',0AEh + dw simple_instruction-instruction_handler + db 'scasd',0AFh + dw simple_instruction_32bit-instruction_handler + db 'scasq',0AFh + dw simple_instruction_64bit-instruction_handler + db 'scasw',0AFh + dw simple_instruction_16bit-instruction_handler + db 'setae',93h + dw set_instruction-instruction_handler + db 'setbe',96h + dw set_instruction-instruction_handler + db 'setge',9Dh + dw set_instruction-instruction_handler + db 'setle',9Eh + dw set_instruction-instruction_handler + db 'setna',96h + dw set_instruction-instruction_handler + db 'setnb',93h + dw set_instruction-instruction_handler + db 'setnc',93h + dw set_instruction-instruction_handler + db 'setne',95h + dw set_instruction-instruction_handler + db 'setng',9Eh + dw set_instruction-instruction_handler + db 'setnl',9Dh + dw set_instruction-instruction_handler + db 'setno',91h + dw set_instruction-instruction_handler + db 'setnp',9Bh + dw set_instruction-instruction_handler + db 'setns',99h + dw set_instruction-instruction_handler + db 'setnz',95h + dw set_instruction-instruction_handler + db 'setpe',9Ah + dw set_instruction-instruction_handler + db 'setpo',9Bh + dw set_instruction-instruction_handler + db 'stack',0 + dw stack_directive-instruction_handler + db 'store',0 + dw store_directive-instruction_handler + db 'stosb',0AAh + dw simple_instruction-instruction_handler + db 'stosd',0ABh + dw simple_instruction_32bit-instruction_handler + db 'stosq',0ABh + dw simple_instruction_64bit-instruction_handler + db 'stosw',0ABh + dw simple_instruction_16bit-instruction_handler + db 'subpd',5Ch + dw sse_pd_instruction-instruction_handler + db 'subps',5Ch + dw sse_ps_instruction-instruction_handler + db 'subsd',5Ch + dw sse_sd_instruction-instruction_handler + db 'subss',5Ch + dw sse_ss_instruction-instruction_handler + db 'times',0 + dw times_directive-instruction_handler + db 'tzcnt',0BCh + dw popcnt_instruction-instruction_handler + db 'tzmsk',14h + dw tbm_instruction-instruction_handler + db 'vdppd',41h + dw avx_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vdpps',40h + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vmovd',0 + dw avx_movd_instruction-instruction_handler + db 'vmovq',0 + dw avx_movq_instruction-instruction_handler + db 'vmrun',0D8h + dw simple_svm_instruction-instruction_handler + db 'vmxon',6 + dw vmxon_instruction-instruction_handler + db 'vorpd',56h + dw avx_pd_instruction-instruction_handler + db 'vorps',56h + dw avx_ps_instruction-instruction_handler + db 'vpand',0DBh + dw avx_pd_instruction_noevex-instruction_handler + db 'vpord',0EBh + dw avx_d_instruction_evex-instruction_handler + db 'vporq',0EBh + dw avx_q_instruction_evex-instruction_handler + db 'vpxor',0EFh + dw avx_pd_instruction_noevex-instruction_handler + db 'while',0 + dw while_directive-instruction_handler + db 'wrmsr',30h + dw simple_extended_instruction-instruction_handler + db 'wrssd',0F6h + dw wrssd_instruction-instruction_handler + db 'wrssq',0F6h + dw wrssq_instruction-instruction_handler + db 'xlatb',0D7h + dw simple_instruction-instruction_handler + db 'xorpd',57h + dw sse_pd_instruction-instruction_handler + db 'xorps',57h + dw sse_ps_instruction-instruction_handler + db 'xsave',100b + dw fxsave_instruction-instruction_handler + db 'xtest',0D6h + dw simple_instruction_0f_01-instruction_handler +instructions_6: + db 'aesdec',0DEh + dw sse4_instruction_66_38-instruction_handler + db 'aesenc',0DCh + dw sse4_instruction_66_38-instruction_handler + db 'aesimc',0DBh + dw sse4_instruction_66_38-instruction_handler + db 'andnpd',55h + dw sse_pd_instruction-instruction_handler + db 'andnps',55h + dw sse_ps_instruction-instruction_handler + db 'assert',0 + dw assert_directive-instruction_handler + db 'blcmsk',21h + dw tbm_instruction-instruction_handler + db 'blsmsk',2 + dw bmi_instruction-instruction_handler + db 'bndldx',1Ah + dw bndldx_instruction-instruction_handler + db 'bndmov',1Ah + dw bndmov_instruction-instruction_handler + db 'bndstx',1Bh + dw bndstx_instruction-instruction_handler + db 'clzero',0 + dw clzero_instruction-instruction_handler + db 'cmovae',43h + dw bs_instruction-instruction_handler + db 'cmovbe',46h + dw bs_instruction-instruction_handler + db 'cmovge',4Dh + dw bs_instruction-instruction_handler + db 'cmovle',4Eh + dw bs_instruction-instruction_handler + db 'cmovna',46h + dw bs_instruction-instruction_handler + db 'cmovnb',43h + dw bs_instruction-instruction_handler + db 'cmovnc',43h + dw bs_instruction-instruction_handler + db 'cmovne',45h + dw bs_instruction-instruction_handler + db 'cmovng',4Eh + dw bs_instruction-instruction_handler + db 'cmovnl',4Dh + dw bs_instruction-instruction_handler + db 'cmovno',41h + dw bs_instruction-instruction_handler + db 'cmovnp',4Bh + dw bs_instruction-instruction_handler + db 'cmovns',49h + dw bs_instruction-instruction_handler + db 'cmovnz',45h + dw bs_instruction-instruction_handler + db 'cmovpe',4Ah + dw bs_instruction-instruction_handler + db 'cmovpo',4Bh + dw bs_instruction-instruction_handler + db 'comisd',2Fh + dw comisd_instruction-instruction_handler + db 'comiss',2Fh + dw comiss_instruction-instruction_handler + db 'fcmovb',0C0h + dw fcmov_instruction-instruction_handler + db 'fcmove',0C8h + dw fcmov_instruction-instruction_handler + db 'fcmovu',0D8h + dw fcmov_instruction-instruction_handler + db 'fcomip',0F0h + dw fcomip_instruction-instruction_handler + db 'fcompp',0 + dw fcompp_instruction-instruction_handler + db 'fdivrp',6 + dw faddp_instruction-instruction_handler + db 'ffreep',0 + dw ffreep_instruction-instruction_handler + db 'ficomp',3 + dw fi_instruction-instruction_handler + db 'fidivr',7 + dw fi_instruction-instruction_handler + db 'fisttp',1 + dw fild_instruction-instruction_handler + db 'fisubr',5 + dw fi_instruction-instruction_handler + db 'fldenv',4 + dw fldenv_instruction-instruction_handler + db 'fldl2e',101010b + dw simple_fpu_instruction-instruction_handler + db 'fldl2t',101001b + dw simple_fpu_instruction-instruction_handler + db 'fldlg2',101100b + dw simple_fpu_instruction-instruction_handler + db 'fldln2',101101b + dw simple_fpu_instruction-instruction_handler + db 'fnclex',0E2h + dw fninit_instruction-instruction_handler + db 'fndisi',0E1h + dw fninit_instruction-instruction_handler + db 'fninit',0E3h + dw fninit_instruction-instruction_handler + db 'fnsave',6 + dw fnsave_instruction-instruction_handler + db 'fnstcw',7 + dw fldcw_instruction-instruction_handler + db 'fnstsw',0 + dw fnstsw_instruction-instruction_handler + db 'format',0 + dw format_directive-instruction_handler + db 'fpatan',110011b + dw simple_fpu_instruction-instruction_handler + db 'fprem1',110101b + dw simple_fpu_instruction-instruction_handler + db 'frstor',4 + dw fnsave_instruction-instruction_handler + db 'frstpm',0E5h + dw fninit_instruction-instruction_handler + db 'fsaved',6 + dw fsave_instruction_32bit-instruction_handler + db 'fsavew',6 + dw fsave_instruction_16bit-instruction_handler + db 'fscale',111101b + dw simple_fpu_instruction-instruction_handler + db 'fsetpm',0E4h + dw fninit_instruction-instruction_handler + db 'fstenv',6 + dw fstenv_instruction-instruction_handler + db 'fsubrp',4 + dw faddp_instruction-instruction_handler + db 'fucomi',0E8h + dw fcomi_instruction-instruction_handler + db 'fucomp',5 + dw ffree_instruction-instruction_handler + db 'fxsave',0 + dw fxsave_instruction-instruction_handler + db 'getsec',37h + dw simple_extended_instruction-instruction_handler + db 'haddpd',07Ch + dw sse_pd_instruction-instruction_handler + db 'haddps',07Ch + dw cvtpd2dq_instruction-instruction_handler + db 'hsubpd',07Dh + dw sse_pd_instruction-instruction_handler + db 'hsubps',07Dh + dw cvtpd2dq_instruction-instruction_handler + db 'invept',80h + dw vmx_inv_instruction-instruction_handler + db 'invlpg',0 + dw invlpg_instruction-instruction_handler + db 'kandnb',42h + dw mask_instruction_b-instruction_handler + db 'kandnd',42h + dw mask_instruction_d-instruction_handler + db 'kandnq',42h + dw mask_instruction_q-instruction_handler + db 'kandnw',42h + dw mask_instruction_w-instruction_handler + db 'ktestb',99h + dw mask_instruction_single_source_b-instruction_handler + db 'ktestd',99h + dw mask_instruction_single_source_d-instruction_handler + db 'ktestq',99h + dw mask_instruction_single_source_q-instruction_handler + db 'ktestw',99h + dw mask_instruction_single_source_w-instruction_handler + db 'kxnorb',46h + dw mask_instruction_b-instruction_handler + db 'kxnord',46h + dw mask_instruction_d-instruction_handler + db 'kxnorq',46h + dw mask_instruction_q-instruction_handler + db 'kxnorw',46h + dw mask_instruction_w-instruction_handler + db 'lfence',0E8h + dw fence_instruction-instruction_handler + db 'llwpcb',0 + dw llwpcb_instruction-instruction_handler + db 'looped',0E1h + dw loop_instruction_32bit-instruction_handler + db 'loopeq',0E1h + dw loop_instruction_64bit-instruction_handler + db 'loopew',0E1h + dw loop_instruction_16bit-instruction_handler + db 'loopne',0E0h + dw loop_instruction-instruction_handler + db 'loopnz',0E0h + dw loop_instruction-instruction_handler + db 'loopzd',0E1h + dw loop_instruction_32bit-instruction_handler + db 'loopzq',0E1h + dw loop_instruction_64bit-instruction_handler + db 'loopzw',0E1h + dw loop_instruction_16bit-instruction_handler + db 'lwpins',0 + dw lwpins_instruction-instruction_handler + db 'lwpval',1 + dw lwpins_instruction-instruction_handler + db 'mfence',0F0h + dw fence_instruction-instruction_handler + db 'movapd',28h + dw movpd_instruction-instruction_handler + db 'movaps',28h + dw movps_instruction-instruction_handler + db 'movdqa',66h + dw movdq_instruction-instruction_handler + db 'movdqu',0F3h + dw movdq_instruction-instruction_handler + db 'movhpd',16h + dw movlpd_instruction-instruction_handler + db 'movhps',16h + dw movlps_instruction-instruction_handler + db 'movlpd',12h + dw movlpd_instruction-instruction_handler + db 'movlps',12h + dw movlps_instruction-instruction_handler + db 'movnti',0C3h + dw movnti_instruction-instruction_handler + db 'movntq',0E7h + dw movntq_instruction-instruction_handler + db 'movsxd',63h + dw movsxd_instruction-instruction_handler + db 'movupd',10h + dw movpd_instruction-instruction_handler + db 'movups',10h + dw movps_instruction-instruction_handler + db 'mwaitx',0FBh + dw monitor_instruction-instruction_handler + db 'paddsb',0ECh + dw basic_mmx_instruction-instruction_handler + db 'paddsw',0EDh + dw basic_mmx_instruction-instruction_handler + db 'pextrb',14h + dw pextrb_instruction-instruction_handler + db 'pextrd',16h + dw pextrd_instruction-instruction_handler + db 'pextrq',16h + dw pextrq_instruction-instruction_handler + db 'pextrw',15h + dw pextrw_instruction-instruction_handler + db 'pfnacc',8Ah + dw amd3dnow_instruction-instruction_handler + db 'pfsubr',0AAh + dw amd3dnow_instruction-instruction_handler + db 'phaddd',2 + dw ssse3_instruction-instruction_handler + db 'phaddw',1 + dw ssse3_instruction-instruction_handler + db 'phsubd',6 + dw ssse3_instruction-instruction_handler + db 'phsubw',5 + dw ssse3_instruction-instruction_handler + db 'pinsrb',20h + dw pinsrb_instruction-instruction_handler + db 'pinsrd',22h + dw pinsrd_instruction-instruction_handler + db 'pinsrq',22h + dw pinsrq_instruction-instruction_handler + db 'pinsrw',0C4h + dw pinsrw_instruction-instruction_handler + db 'pmaxsb',3Ch + dw sse4_instruction_66_38-instruction_handler + db 'pmaxsd',3Dh + dw sse4_instruction_66_38-instruction_handler + db 'pmaxsw',0EEh + dw basic_mmx_instruction-instruction_handler + db 'pmaxub',0DEh + dw basic_mmx_instruction-instruction_handler + db 'pmaxud',3Fh + dw sse4_instruction_66_38-instruction_handler + db 'pmaxuw',3Eh + dw sse4_instruction_66_38-instruction_handler + db 'pminsb',38h + dw sse4_instruction_66_38-instruction_handler + db 'pminsd',39h + dw sse4_instruction_66_38-instruction_handler + db 'pminsw',0EAh + dw basic_mmx_instruction-instruction_handler + db 'pminub',0DAh + dw basic_mmx_instruction-instruction_handler + db 'pminud',3Bh + dw sse4_instruction_66_38-instruction_handler + db 'pminuw',3Ah + dw sse4_instruction_66_38-instruction_handler + db 'pmuldq',28h + dw sse4_instruction_66_38-instruction_handler + db 'pmulhw',0E5h + dw basic_mmx_instruction-instruction_handler + db 'pmulld',40h + dw sse4_instruction_66_38-instruction_handler + db 'pmullw',0D5h + dw basic_mmx_instruction-instruction_handler + db 'popcnt',0B8h + dw popcnt_instruction-instruction_handler + db 'psadbw',0F6h + dw basic_mmx_instruction-instruction_handler + db 'pshufb',0 + dw ssse3_instruction-instruction_handler + db 'pshufd',66h + dw pshufd_instruction-instruction_handler + db 'pshufw',0 + dw pshufw_instruction-instruction_handler + db 'psignb',8 + dw ssse3_instruction-instruction_handler + db 'psignd',0Ah + dw ssse3_instruction-instruction_handler + db 'psignw',9 + dw ssse3_instruction-instruction_handler + db 'pslldq',111b + dw pslldq_instruction-instruction_handler + db 'psrldq',011b + dw pslldq_instruction-instruction_handler + db 'psubsb',0E8h + dw basic_mmx_instruction-instruction_handler + db 'psubsw',0E9h + dw basic_mmx_instruction-instruction_handler + db 'pswapd',0BBh + dw amd3dnow_instruction-instruction_handler + db 'public',0 + dw public_directive-instruction_handler + db 'pushad',60h + dw simple_instruction_32bit_except64-instruction_handler + db 'pushaw',60h + dw simple_instruction_16bit_except64-instruction_handler + db 'pushfd',9Ch + dw simple_instruction_32bit_except64-instruction_handler + db 'pushfq',9Ch + dw simple_instruction_only64-instruction_handler + db 'pushfw',9Ch + dw simple_instruction_16bit-instruction_handler + db 'rdmsrq',32h + dw simple_extended_instruction_64bit-instruction_handler + db 'rdpkru',0EEh + dw simple_instruction_0f_01-instruction_handler + db 'rdrand',110b + dw rdrand_instruction-instruction_handler + db 'rdseed',111b + dw rdrand_instruction-instruction_handler + db 'rdsspd',1 + dw rdsspd_instruction-instruction_handler + db 'rdsspq',1 + dw rdsspq_instruction-instruction_handler + db 'rdtscp',0F9h + dw simple_instruction_0f_01-instruction_handler + db 'repeat',0 + dw repeat_directive-instruction_handler + db 'setalc',0D6h + dw simple_instruction_except64-instruction_handler + db 'setnae',92h + dw set_instruction-instruction_handler + db 'setnbe',97h + dw set_instruction-instruction_handler + db 'setnge',9Ch + dw set_instruction-instruction_handler + db 'setnle',9Fh + dw set_instruction-instruction_handler + db 'sfence',0F8h + dw fence_instruction-instruction_handler + db 'shufpd',0C6h + dw sse_pd_instruction_imm8-instruction_handler + db 'shufps',0C6h + dw sse_ps_instruction_imm8-instruction_handler + db 'skinit',0 + dw skinit_instruction-instruction_handler + db 'slwpcb',1 + dw llwpcb_instruction-instruction_handler + db 'sqrtpd',51h + dw sse_pd_instruction-instruction_handler + db 'sqrtps',51h + dw sse_ps_instruction-instruction_handler + db 'sqrtsd',51h + dw sse_sd_instruction-instruction_handler + db 'sqrtss',51h + dw sse_ss_instruction-instruction_handler + db 'swapgs',0F8h + dw swapgs_instruction-instruction_handler + db 'sysret',07h + dw simple_extended_instruction-instruction_handler + db 't1mskc',17h + dw tbm_instruction-instruction_handler + db 'tpause',66h + dw tpause_instruction-instruction_handler + db 'umwait',0F2h + dw tpause_instruction-instruction_handler + db 'vaddpd',58h + dw avx_pd_instruction_er-instruction_handler + db 'vaddps',58h + dw avx_ps_instruction_er-instruction_handler + db 'vaddsd',58h + dw avx_sd_instruction_er-instruction_handler + db 'vaddss',58h + dw avx_ss_instruction_er-instruction_handler + db 'vandpd',54h + dw avx_pd_instruction-instruction_handler + db 'vandps',54h + dw avx_ps_instruction-instruction_handler + db 'vcmppd',-1 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpps',-1 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpsd',-1 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpss',-1 + dw avx_cmp_ss_instruction-instruction_handler + db 'vdivpd',5Eh + dw avx_pd_instruction_er-instruction_handler + db 'vdivps',5Eh + dw avx_ps_instruction_er-instruction_handler + db 'vdivsd',5Eh + dw avx_sd_instruction_er-instruction_handler + db 'vdivss',5Eh + dw avx_ss_instruction_er-instruction_handler + db 'vlddqu',0F0h + dw avx_lddqu_instruction-instruction_handler + db 'vmaxpd',5Fh + dw avx_pd_instruction_sae-instruction_handler + db 'vmaxps',5Fh + dw avx_ps_instruction_sae-instruction_handler + db 'vmaxsd',5Fh + dw avx_sd_instruction_sae-instruction_handler + db 'vmaxss',5Fh + dw avx_ss_instruction_sae-instruction_handler + db 'vmcall',0C1h + dw simple_instruction_0f_01-instruction_handler + db 'vmfunc',0D4h + dw simple_instruction_0f_01-instruction_handler + db 'vminpd',5Dh + dw avx_pd_instruction_sae-instruction_handler + db 'vminps',5Dh + dw avx_ps_instruction_sae-instruction_handler + db 'vminsd',5Dh + dw avx_sd_instruction_sae-instruction_handler + db 'vminss',5Dh + dw avx_ss_instruction_sae-instruction_handler + db 'vmload',0DAh + dw simple_svm_instruction-instruction_handler + db 'vmovsd',0 + dw avx_movsd_instruction-instruction_handler + db 'vmovss',0 + dw avx_movss_instruction-instruction_handler + db 'vmread',0 + dw vmread_instruction-instruction_handler + db 'vmsave',0DBh + dw simple_svm_instruction-instruction_handler + db 'vmulpd',59h + dw avx_pd_instruction_er-instruction_handler + db 'vmulps',59h + dw avx_ps_instruction_er-instruction_handler + db 'vmulsd',59h + dw avx_sd_instruction_er-instruction_handler + db 'vmulss',59h + dw avx_ss_instruction_er-instruction_handler + db 'vmxoff',0C4h + dw simple_instruction_0f_01-instruction_handler + db 'vpabsb',1Ch + dw avx_single_source_bw_instruction_38-instruction_handler + db 'vpabsd',1Eh + dw avx_single_source_d_instruction_38-instruction_handler + db 'vpabsq',1Fh + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vpabsw',1Dh + dw avx_single_source_bw_instruction_38-instruction_handler + db 'vpaddb',0FCh + dw avx_bw_instruction-instruction_handler + db 'vpaddd',0FEh + dw avx_d_instruction-instruction_handler + db 'vpaddq',0D4h + dw avx_q_instruction-instruction_handler + db 'vpaddw',0FDh + dw avx_bw_instruction-instruction_handler + db 'vpandd',0DBh + dw avx_d_instruction_evex-instruction_handler + db 'vpandn',0DFh + dw avx_pd_instruction_noevex-instruction_handler + db 'vpandq',0DBh + dw avx_q_instruction_evex-instruction_handler + db 'vpavgb',0E0h + dw avx_bw_instruction-instruction_handler + db 'vpavgw',0E3h + dw avx_bw_instruction-instruction_handler + db 'vpcmov',0A2h + dw vpcmov_instruction-instruction_handler + db 'vpcmpb',-1 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpd',-1 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpq',-1 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpw',-1 + dw avx512_cmp_w_instruction-instruction_handler + db 'vpcomb',-1 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomd',-1 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomq',-1 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomw',-1 + dw xop_pcom_w_instruction-instruction_handler + db 'vpermb',8Dh + dw avx_bw_instruction_38_evex-instruction_handler + db 'vpermd',36h + dw avx_permd_instruction-instruction_handler + db 'vpermq',0 + dw avx_permq_instruction-instruction_handler + db 'vpermw',8Dh + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpperm',0A3h + dw xop_128bit_instruction-instruction_handler + db 'vprold',1 + dw avx512_rotate_d_instruction-instruction_handler + db 'vprolq',1 + dw avx512_rotate_q_instruction-instruction_handler + db 'vprord',0 + dw avx512_rotate_d_instruction-instruction_handler + db 'vprorq',0 + dw avx512_rotate_q_instruction-instruction_handler + db 'vprotb',90h + dw xop_shift_instruction-instruction_handler + db 'vprotd',92h + dw xop_shift_instruction-instruction_handler + db 'vprotq',93h + dw xop_shift_instruction-instruction_handler + db 'vprotw',91h + dw xop_shift_instruction-instruction_handler + db 'vpshab',98h + dw xop_shift_instruction-instruction_handler + db 'vpshad',9Ah + dw xop_shift_instruction-instruction_handler + db 'vpshaq',9Bh + dw xop_shift_instruction-instruction_handler + db 'vpshaw',99h + dw xop_shift_instruction-instruction_handler + db 'vpshlb',94h + dw xop_shift_instruction-instruction_handler + db 'vpshld',96h + dw xop_shift_instruction-instruction_handler + db 'vpshlq',97h + dw xop_shift_instruction-instruction_handler + db 'vpshlw',95h + dw xop_shift_instruction-instruction_handler + db 'vpslld',0F2h + dw avx_shift_d_instruction-instruction_handler + db 'vpsllq',0F3h + dw avx_shift_q_instruction-instruction_handler + db 'vpsllw',0F1h + dw avx_shift_bw_instruction-instruction_handler + db 'vpsrad',0E2h + dw avx_shift_d_instruction-instruction_handler + db 'vpsraq',0E2h + dw avx_shift_q_instruction_evex-instruction_handler + db 'vpsraw',0E1h + dw avx_shift_bw_instruction-instruction_handler + db 'vpsrld',0D2h + dw avx_shift_d_instruction-instruction_handler + db 'vpsrlq',0D3h + dw avx_shift_q_instruction-instruction_handler + db 'vpsrlw',0D1h + dw avx_shift_bw_instruction-instruction_handler + db 'vpsubb',0F8h + dw avx_bw_instruction-instruction_handler + db 'vpsubd',0FAh + dw avx_d_instruction-instruction_handler + db 'vpsubq',0FBh + dw avx_q_instruction-instruction_handler + db 'vpsubw',0F9h + dw avx_bw_instruction-instruction_handler + db 'vptest',17h + dw avx_single_source_instruction_38_noevex-instruction_handler + db 'vpxord',0EFh + dw avx_d_instruction_evex-instruction_handler + db 'vpxorq',0EFh + dw avx_q_instruction_evex-instruction_handler + db 'vrcpps',53h + dw avx_single_source_ps_instruction_noevex-instruction_handler + db 'vrcpss',53h + dw avx_ss_instruction_noevex-instruction_handler + db 'vsubpd',5Ch + dw avx_pd_instruction_er-instruction_handler + db 'vsubps',5Ch + dw avx_ps_instruction_er-instruction_handler + db 'vsubsd',5Ch + dw avx_sd_instruction_er-instruction_handler + db 'vsubss',5Ch + dw avx_ss_instruction_er-instruction_handler + db 'vxorpd',57h + dw avx_pd_instruction-instruction_handler + db 'vxorps',57h + dw avx_ps_instruction-instruction_handler + db 'wbinvd',9 + dw simple_extended_instruction-instruction_handler + db 'wrmsrq',30h + dw simple_extended_instruction_64bit-instruction_handler + db 'wrpkru',0EFh + dw simple_instruction_0f_01-instruction_handler + db 'wrussd',0F5h + dw wrussd_instruction-instruction_handler + db 'wrussq',0F5h + dw wrussq_instruction-instruction_handler + db 'xabort',0 + dw xabort_instruction-instruction_handler + db 'xbegin',0 + dw xbegin_instruction-instruction_handler + db 'xgetbv',0D0h + dw simple_instruction_0f_01-instruction_handler + db 'xrstor',101b + dw fxsave_instruction-instruction_handler + db 'xsavec',4 + dw xsaves_instruction-instruction_handler + db 'xsaves',5 + dw xsaves_instruction-instruction_handler + db 'xsetbv',0D1h + dw simple_instruction_0f_01-instruction_handler +instructions_7: + db 'blcfill',11h + dw tbm_instruction-instruction_handler + db 'blendpd',0Dh + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'blendps',0Ch + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'blsfill',12h + dw tbm_instruction-instruction_handler + db 'clflush',111b + dw clflush_instruction-instruction_handler + db 'cmovnae',42h + dw bs_instruction-instruction_handler + db 'cmovnbe',47h + dw bs_instruction-instruction_handler + db 'cmovnge',4Ch + dw bs_instruction-instruction_handler + db 'cmovnle',4Fh + dw bs_instruction-instruction_handler + db 'cmpeqpd',0 + dw cmp_pd_instruction-instruction_handler + db 'cmpeqps',0 + dw cmp_ps_instruction-instruction_handler + db 'cmpeqsd',0 + dw cmp_sd_instruction-instruction_handler + db 'cmpeqss',0 + dw cmp_ss_instruction-instruction_handler + db 'cmplepd',2 + dw cmp_pd_instruction-instruction_handler + db 'cmpleps',2 + dw cmp_ps_instruction-instruction_handler + db 'cmplesd',2 + dw cmp_sd_instruction-instruction_handler + db 'cmpless',2 + dw cmp_ss_instruction-instruction_handler + db 'cmpltpd',1 + dw cmp_pd_instruction-instruction_handler + db 'cmpltps',1 + dw cmp_ps_instruction-instruction_handler + db 'cmpltsd',1 + dw cmp_sd_instruction-instruction_handler + db 'cmpltss',1 + dw cmp_ss_instruction-instruction_handler + db 'cmpxchg',0B0h + dw basic_486_instruction-instruction_handler + db 'display',0 + dw display_directive-instruction_handler + db 'endbr32',0FBh + dw endbr_instruction-instruction_handler + db 'endbr64',0FAh + dw endbr_instruction-instruction_handler + db 'fcmovbe',0D0h + dw fcmov_instruction-instruction_handler + db 'fcmovnb',0C0h + dw fcomi_instruction-instruction_handler + db 'fcmovne',0C8h + dw fcomi_instruction-instruction_handler + db 'fcmovnu',0D8h + dw fcomi_instruction-instruction_handler + db 'fdecstp',110110b + dw simple_fpu_instruction-instruction_handler + db 'fincstp',110111b + dw simple_fpu_instruction-instruction_handler + db 'fldenvd',4 + dw fldenv_instruction_32bit-instruction_handler + db 'fldenvw',4 + dw fldenv_instruction_16bit-instruction_handler + db 'fnsaved',6 + dw fnsave_instruction_32bit-instruction_handler + db 'fnsavew',6 + dw fnsave_instruction_16bit-instruction_handler + db 'fnstenv',6 + dw fldenv_instruction-instruction_handler + db 'frndint',111100b + dw simple_fpu_instruction-instruction_handler + db 'frstord',4 + dw fnsave_instruction_32bit-instruction_handler + db 'frstorw',4 + dw fnsave_instruction_16bit-instruction_handler + db 'fsincos',111011b + dw simple_fpu_instruction-instruction_handler + db 'fstenvd',6 + dw fstenv_instruction_32bit-instruction_handler + db 'fstenvw',6 + dw fstenv_instruction_16bit-instruction_handler + db 'fucomip',0E8h + dw fcomip_instruction-instruction_handler + db 'fucompp',0 + dw fucompp_instruction-instruction_handler + db 'fxrstor',1 + dw fxsave_instruction-instruction_handler + db 'fxtract',110100b + dw simple_fpu_instruction-instruction_handler + db 'fyl2xp1',111001b + dw simple_fpu_instruction-instruction_handler + db 'incsspd',5 + dw incsspd_instruction-instruction_handler + db 'incsspq',5 + dw incsspq_instruction-instruction_handler + db 'insertq',0 + dw insertq_instruction-instruction_handler + db 'invlpga',0DFh + dw invlpga_instruction-instruction_handler + db 'invpcid',82h + dw vmx_inv_instruction-instruction_handler + db 'invvpid',81h + dw vmx_inv_instruction-instruction_handler + db 'ldmxcsr',10b + dw stmxcsr_instruction-instruction_handler + db 'loopned',0E0h + dw loop_instruction_32bit-instruction_handler + db 'loopneq',0E0h + dw loop_instruction_64bit-instruction_handler + db 'loopnew',0E0h + dw loop_instruction_16bit-instruction_handler + db 'loopnzd',0E0h + dw loop_instruction_32bit-instruction_handler + db 'loopnzq',0E0h + dw loop_instruction_64bit-instruction_handler + db 'loopnzw',0E0h + dw loop_instruction_16bit-instruction_handler + db 'mcommit',0FAh + dw mcommit_instruction-instruction_handler + db 'monitor',0C8h + dw monitor_instruction-instruction_handler + db 'movddup',12h + dw sse_sd_instruction-instruction_handler + db 'movdiri',0F9h + dw movdiri_instruction-instruction_handler + db 'movdq2q',0 + dw movdq2q_instruction-instruction_handler + db 'movhlps',12h + dw movhlps_instruction-instruction_handler + db 'movlhps',16h + dw movhlps_instruction-instruction_handler + db 'movntdq',0E7h + dw movntpd_instruction-instruction_handler + db 'movntpd',2Bh + dw movntpd_instruction-instruction_handler + db 'movntps',2Bh + dw movntps_instruction-instruction_handler + db 'movntsd',2Bh + dw movntsd_instruction-instruction_handler + db 'movntss',2Bh + dw movntss_instruction-instruction_handler + db 'movq2dq',0 + dw movq2dq_instruction-instruction_handler + db 'mpsadbw',42h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'paddusb',0DCh + dw basic_mmx_instruction-instruction_handler + db 'paddusw',0DDh + dw basic_mmx_instruction-instruction_handler + db 'palignr',0 + dw palignr_instruction-instruction_handler + db 'pavgusb',0BFh + dw amd3dnow_instruction-instruction_handler + db 'pblendw',0Eh + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pcmpeqb',74h + dw basic_mmx_instruction-instruction_handler + db 'pcmpeqd',76h + dw basic_mmx_instruction-instruction_handler + db 'pcmpeqq',29h + dw sse4_instruction_66_38-instruction_handler + db 'pcmpeqw',75h + dw basic_mmx_instruction-instruction_handler + db 'pcmpgtb',64h + dw basic_mmx_instruction-instruction_handler + db 'pcmpgtd',66h + dw basic_mmx_instruction-instruction_handler + db 'pcmpgtq',37h + dw sse4_instruction_66_38-instruction_handler + db 'pcmpgtw',65h + dw basic_mmx_instruction-instruction_handler + db 'pcommit',0F8h + dw pcommit_instruction-instruction_handler + db 'pconfig',0C5h + dw pconfig_instruction-instruction_handler + db 'pfcmpeq',0B0h + dw amd3dnow_instruction-instruction_handler + db 'pfcmpge',90h + dw amd3dnow_instruction-instruction_handler + db 'pfcmpgt',0A0h + dw amd3dnow_instruction-instruction_handler + db 'pfpnacc',8Eh + dw amd3dnow_instruction-instruction_handler + db 'pfrsqrt',97h + dw amd3dnow_instruction-instruction_handler + db 'phaddsw',3 + dw ssse3_instruction-instruction_handler + db 'phsubsw',7 + dw ssse3_instruction-instruction_handler + db 'pmaddwd',0F5h + dw basic_mmx_instruction-instruction_handler + db 'pmulhrw',0B7h + dw amd3dnow_instruction-instruction_handler + db 'pmulhuw',0E4h + dw basic_mmx_instruction-instruction_handler + db 'pmuludq',0F4h + dw basic_mmx_instruction-instruction_handler + db 'pshufhw',0F3h + dw pshufd_instruction-instruction_handler + db 'pshuflw',0F2h + dw pshufd_instruction-instruction_handler + db 'psubusb',0D8h + dw basic_mmx_instruction-instruction_handler + db 'psubusw',0D9h + dw basic_mmx_instruction-instruction_handler + db 'ptwrite',4 + dw ptwrite_instruction-instruction_handler + db 'roundpd',9 + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'roundps',8 + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'roundsd',0Bh + dw sse4_sd_instruction_66_3a_imm8-instruction_handler + db 'roundss',0Ah + dw sse4_ss_instruction_66_3a_imm8-instruction_handler + db 'rsqrtps',52h + dw sse_ps_instruction-instruction_handler + db 'rsqrtss',52h + dw sse_ss_instruction-instruction_handler + db 'section',0 + dw section_directive-instruction_handler + db 'segment',0 + dw segment_directive-instruction_handler + db 'stmxcsr',11b + dw stmxcsr_instruction-instruction_handler + db 'syscall',05h + dw simple_extended_instruction-instruction_handler + db 'sysexit',35h + dw simple_extended_instruction-instruction_handler + db 'sysretq',07h + dw simple_extended_instruction_64bit-instruction_handler + db 'ucomisd',2Eh + dw comisd_instruction-instruction_handler + db 'ucomiss',2Eh + dw comiss_instruction-instruction_handler + db 'vaesdec',0DEh + dw avx_instruction_38_nomask-instruction_handler + db 'vaesenc',0DCh + dw avx_instruction_38_nomask-instruction_handler + db 'vaesimc',0DBh + dw avx_single_source_128bit_instruction_38_noevex-instruction_handler + db 'valignd',3 + dw avx_d_instruction_3a_imm8_evex-instruction_handler + db 'valignq',3 + dw avx_q_instruction_3a_imm8_evex-instruction_handler + db 'vandnpd',55h + dw avx_pd_instruction-instruction_handler + db 'vandnps',55h + dw avx_ps_instruction-instruction_handler + db 'vcomisd',2Fh + dw avx_comisd_instruction-instruction_handler + db 'vcomiss',2Fh + dw avx_comiss_instruction-instruction_handler + db 'vexp2pd',0C8h + dw avx512_exp2pd_instruction-instruction_handler + db 'vexp2ps',0C8h + dw avx512_exp2ps_instruction-instruction_handler + db 'vfrczpd',81h + dw xop_single_source_instruction-instruction_handler + db 'vfrczps',80h + dw xop_single_source_instruction-instruction_handler + db 'vfrczsd',83h + dw xop_single_source_sd_instruction-instruction_handler + db 'vfrczss',82h + dw xop_single_source_ss_instruction-instruction_handler + db 'vhaddpd',07Ch + dw avx_pd_instruction_noevex-instruction_handler + db 'vhaddps',07Ch + dw avx_ps_instruction_noevex-instruction_handler + db 'vhsubpd',07Dh + dw avx_pd_instruction_noevex-instruction_handler + db 'vhsubps',07Dh + dw avx_ps_instruction_noevex-instruction_handler + db 'virtual',0 + dw virtual_directive-instruction_handler + db 'vmclear',6 + dw vmclear_instruction-instruction_handler + db 'vmmcall',0D9h + dw simple_instruction_0f_01-instruction_handler + db 'vmovapd',28h + dw avx_movpd_instruction-instruction_handler + db 'vmovaps',28h + dw avx_movps_instruction-instruction_handler + db 'vmovdqa',6Fh + dw avx_movdqa_instruction-instruction_handler + db 'vmovdqu',6Fh + dw avx_movdqu_instruction-instruction_handler + db 'vmovhpd',16h + dw avx_movlpd_instruction-instruction_handler + db 'vmovhps',16h + dw avx_movlps_instruction-instruction_handler + db 'vmovlpd',12h + dw avx_movlpd_instruction-instruction_handler + db 'vmovlps',12h + dw avx_movlps_instruction-instruction_handler + db 'vmovupd',10h + dw avx_movpd_instruction-instruction_handler + db 'vmovups',10h + dw avx_movps_instruction-instruction_handler + db 'vmptrld',6 + dw vmx_instruction-instruction_handler + db 'vmptrst',7 + dw vmx_instruction-instruction_handler + db 'vmwrite',0 + dw vmwrite_instruction-instruction_handler + db 'vpaddsb',0ECh + dw avx_bw_instruction-instruction_handler + db 'vpaddsw',0EDh + dw avx_bw_instruction-instruction_handler + db 'vpandnd',0DFh + dw avx_d_instruction_evex-instruction_handler + db 'vpandnq',0DFh + dw avx_q_instruction_evex-instruction_handler + db 'vpcmpub',-1 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpud',-1 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpuq',-1 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpuw',-1 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcomub',-1 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomud',-1 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomuq',-1 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomuw',-1 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpermpd',1 + dw avx_permq_instruction-instruction_handler + db 'vpermps',16h + dw avx_permd_instruction-instruction_handler + db 'vpextrb',14h + dw avx_extract_b_instruction-instruction_handler + db 'vpextrd',16h + dw avx_extract_d_instruction-instruction_handler + db 'vpextrq',16h + dw avx_extract_q_instruction-instruction_handler + db 'vpextrw',15h + dw avx_extract_w_instruction-instruction_handler + db 'vphaddd',2 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphaddw',1 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphsubd',6 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphsubw',5 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vpinsrb',20h + dw avx_pinsrb_instruction-instruction_handler + db 'vpinsrd',22h + dw avx_pinsrd_instruction-instruction_handler + db 'vpinsrq',22h + dw avx_pinsrq_instruction-instruction_handler + db 'vpinsrw',0C4h + dw avx_pinsrw_instruction-instruction_handler + db 'vpmaxsb',3Ch + dw avx_bw_instruction_38-instruction_handler + db 'vpmaxsd',3Dh + dw avx_d_instruction_38-instruction_handler + db 'vpmaxsq',3Dh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpmaxsw',0EEh + dw avx_bw_instruction-instruction_handler + db 'vpmaxub',0DEh + dw avx_bw_instruction-instruction_handler + db 'vpmaxud',3Fh + dw avx_d_instruction_38-instruction_handler + db 'vpmaxuq',3Fh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpmaxuw',3Eh + dw avx_bw_instruction_38-instruction_handler + db 'vpminsb',38h + dw avx_bw_instruction_38-instruction_handler + db 'vpminsd',39h + dw avx_d_instruction_38-instruction_handler + db 'vpminsq',39h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpminsw',0EAh + dw avx_bw_instruction-instruction_handler + db 'vpminub',0DAh + dw avx_bw_instruction-instruction_handler + db 'vpminud',3Bh + dw avx_d_instruction_38-instruction_handler + db 'vpminuq',3Bh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpminuw',3Ah + dw avx_bw_instruction_38-instruction_handler + db 'vpmovdb',31h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovdw',33h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovqb',32h + dw avx512_pmovqb_instruction-instruction_handler + db 'vpmovqd',35h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovqw',34h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovwb',30h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmuldq',28h + dw avx_q_instruction_38-instruction_handler + db 'vpmulhw',0E5h + dw avx_bw_instruction-instruction_handler + db 'vpmulld',40h + dw avx_d_instruction_38-instruction_handler + db 'vpmullq',40h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpmullw',0D5h + dw avx_bw_instruction-instruction_handler + db 'vprolvd',15h + dw avx_d_instruction_38_evex-instruction_handler + db 'vprolvq',15h + dw avx_q_instruction_38_evex-instruction_handler + db 'vprorvd',14h + dw avx_d_instruction_38_evex-instruction_handler + db 'vprorvq',14h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpsadbw',0F6h + dw avx_bw_instruction-instruction_handler + db 'vpshldd',71h + dw avx_d_instruction_3a_imm8_evex-instruction_handler + db 'vpshldq',71h + dw avx_q_instruction_3a_imm8_evex-instruction_handler + db 'vpshldw',70h + dw avx_bw_instruction_3a_imm8_w1_evex-instruction_handler + db 'vpshrdd',73h + dw avx_d_instruction_3a_imm8_evex-instruction_handler + db 'vpshrdq',73h + dw avx_q_instruction_3a_imm8_evex-instruction_handler + db 'vpshrdw',72h + dw avx_bw_instruction_3a_imm8_w1_evex-instruction_handler + db 'vpshufb',0 + dw avx_bw_instruction_38-instruction_handler + db 'vpshufd',70h + dw avx_single_source_d_instruction_imm8-instruction_handler + db 'vpsignb',8 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vpsignd',0Ah + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vpsignw',9 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vpslldq',111b + dw avx_shift_dq_instruction-instruction_handler + db 'vpsllvd',47h + dw avx_d_instruction_38-instruction_handler + db 'vpsllvq',47h + dw avx_q_instruction_38_w1-instruction_handler + db 'vpsllvw',12h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpsravd',46h + dw avx_d_instruction_38-instruction_handler + db 'vpsravq',46h + dw avx_q_instruction_38_w1_evex-instruction_handler + db 'vpsravw',11h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpsrldq',011b + dw avx_shift_dq_instruction-instruction_handler + db 'vpsrlvd',45h + dw avx_d_instruction_38-instruction_handler + db 'vpsrlvq',45h + dw avx_q_instruction_38_w1-instruction_handler + db 'vpsrlvw',10h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpsubsb',0E8h + dw avx_bw_instruction-instruction_handler + db 'vpsubsw',0E9h + dw avx_bw_instruction-instruction_handler + db 'vshufpd',0C6h + dw avx_pd_instruction_imm8-instruction_handler + db 'vshufps',0C6h + dw avx_ps_instruction_imm8-instruction_handler + db 'vsqrtpd',51h + dw avx_single_source_pd_instruction_er-instruction_handler + db 'vsqrtps',51h + dw avx_single_source_ps_instruction_er-instruction_handler + db 'vsqrtsd',51h + dw avx_sd_instruction_er-instruction_handler + db 'vsqrtss',51h + dw avx_ss_instruction_er-instruction_handler + db 'vtestpd',0Fh + dw avx_single_source_instruction_38_noevex-instruction_handler + db 'vtestps',0Eh + dw avx_single_source_instruction_38_noevex-instruction_handler + db 'xrstors',3 + dw xsaves_instruction-instruction_handler + db 'xsave64',100b + dw fxsave_instruction_64bit-instruction_handler +instructions_8: + db 'addsubpd',0D0h + dw sse_pd_instruction-instruction_handler + db 'addsubps',0D0h + dw cvtpd2dq_instruction-instruction_handler + db 'blendvpd',15h + dw sse4_instruction_66_38_xmm0-instruction_handler + db 'blendvps',14h + dw sse4_instruction_66_38_xmm0-instruction_handler + db 'cldemote',0 + dw cldemote_instruction-instruction_handler + db 'clrssbsy',6 + dw clrssbsy_instruction-instruction_handler + db 'cmpneqpd',4 + dw cmp_pd_instruction-instruction_handler + db 'cmpneqps',4 + dw cmp_ps_instruction-instruction_handler + db 'cmpneqsd',4 + dw cmp_sd_instruction-instruction_handler + db 'cmpneqss',4 + dw cmp_ss_instruction-instruction_handler + db 'cmpnlepd',6 + dw cmp_pd_instruction-instruction_handler + db 'cmpnleps',6 + dw cmp_ps_instruction-instruction_handler + db 'cmpnlesd',6 + dw cmp_sd_instruction-instruction_handler + db 'cmpnless',6 + dw cmp_ss_instruction-instruction_handler + db 'cmpnltpd',5 + dw cmp_pd_instruction-instruction_handler + db 'cmpnltps',5 + dw cmp_ps_instruction-instruction_handler + db 'cmpnltsd',5 + dw cmp_sd_instruction-instruction_handler + db 'cmpnltss',5 + dw cmp_ss_instruction-instruction_handler + db 'cmpordpd',7 + dw cmp_pd_instruction-instruction_handler + db 'cmpordps',7 + dw cmp_ps_instruction-instruction_handler + db 'cmpordsd',7 + dw cmp_sd_instruction-instruction_handler + db 'cmpordss',7 + dw cmp_ss_instruction-instruction_handler + db 'cvtdq2pd',0E6h + dw cvtdq2pd_instruction-instruction_handler + db 'cvtdq2ps',5Bh + dw sse_ps_instruction-instruction_handler + db 'cvtpd2dq',0E6h + dw cvtpd2dq_instruction-instruction_handler + db 'cvtpd2pi',2Dh + dw cvtpd2pi_instruction-instruction_handler + db 'cvtpd2ps',5Ah + dw sse_pd_instruction-instruction_handler + db 'cvtpi2pd',2Ah + dw cvtpi2pd_instruction-instruction_handler + db 'cvtpi2ps',2Ah + dw cvtpi2ps_instruction-instruction_handler + db 'cvtps2dq',5Bh + dw sse_pd_instruction-instruction_handler + db 'cvtps2pd',5Ah + dw cvtps2pd_instruction-instruction_handler + db 'cvtps2pi',2Dh + dw cvtps2pi_instruction-instruction_handler + db 'cvtsd2si',2Dh + dw cvtsd2si_instruction-instruction_handler + db 'cvtsd2ss',5Ah + dw sse_sd_instruction-instruction_handler + db 'cvtsi2sd',2Ah + dw cvtsi2sd_instruction-instruction_handler + db 'cvtsi2ss',2Ah + dw cvtsi2ss_instruction-instruction_handler + db 'cvtss2sd',5Ah + dw sse_ss_instruction-instruction_handler + db 'cvtss2si',2Dh + dw cvtss2si_instruction-instruction_handler + db 'fcmovnbe',0D0h + dw fcomi_instruction-instruction_handler + db 'fnstenvd',6 + dw fldenv_instruction_32bit-instruction_handler + db 'fnstenvw',6 + dw fldenv_instruction_16bit-instruction_handler + db 'fxsave64',0 + dw fxsave_instruction_64bit-instruction_handler + db 'insertps',21h + dw insertps_instruction-instruction_handler + db 'kortestb',98h + dw mask_instruction_single_source_b-instruction_handler + db 'kortestd',98h + dw mask_instruction_single_source_d-instruction_handler + db 'kortestq',98h + dw mask_instruction_single_source_q-instruction_handler + db 'kortestw',98h + dw mask_instruction_single_source_w-instruction_handler + db 'kshiftlb',32h + dw mask_shift_instruction_d-instruction_handler + db 'kshiftld',33h + dw mask_shift_instruction_d-instruction_handler + db 'kshiftlq',33h + dw mask_shift_instruction_q-instruction_handler + db 'kshiftlw',32h + dw mask_shift_instruction_q-instruction_handler + db 'kshiftrb',30h + dw mask_shift_instruction_d-instruction_handler + db 'kshiftrd',31h + dw mask_shift_instruction_d-instruction_handler + db 'kshiftrq',31h + dw mask_shift_instruction_q-instruction_handler + db 'kshiftrw',30h + dw mask_shift_instruction_q-instruction_handler + db 'kunpckbw',4Bh + dw mask_instruction_b-instruction_handler + db 'kunpckdq',4Bh + dw mask_instruction_q-instruction_handler + db 'kunpckwd',4Bh + dw mask_instruction_w-instruction_handler + db 'maskmovq',0 + dw maskmovq_instruction-instruction_handler + db 'monitorx',0FAh + dw monitor_instruction-instruction_handler + db 'movmskpd',0 + dw movmskpd_instruction-instruction_handler + db 'movmskps',0 + dw movmskps_instruction-instruction_handler + db 'movntdqa',2Ah + dw movntdqa_instruction-instruction_handler + db 'movshdup',16h + dw movshdup_instruction-instruction_handler + db 'movsldup',12h + dw movshdup_instruction-instruction_handler + db 'packssdw',6Bh + dw basic_mmx_instruction-instruction_handler + db 'packsswb',63h + dw basic_mmx_instruction-instruction_handler + db 'packusdw',2Bh + dw sse4_instruction_66_38-instruction_handler + db 'packuswb',67h + dw basic_mmx_instruction-instruction_handler + db 'pblendvb',10h + dw sse4_instruction_66_38_xmm0-instruction_handler + db 'pfrcpit1',0A6h + dw amd3dnow_instruction-instruction_handler + db 'pfrcpit2',0B6h + dw amd3dnow_instruction-instruction_handler + db 'pfrsqit1',0A7h + dw amd3dnow_instruction-instruction_handler + db 'pmovmskb',0D7h + dw pmovmskb_instruction-instruction_handler + db 'pmovsxbd',21h + dw pmovsxbd_instruction-instruction_handler + db 'pmovsxbq',22h + dw pmovsxbq_instruction-instruction_handler + db 'pmovsxbw',20h + dw pmovsxbw_instruction-instruction_handler + db 'pmovsxdq',25h + dw pmovsxdq_instruction-instruction_handler + db 'pmovsxwd',23h + dw pmovsxwd_instruction-instruction_handler + db 'pmovsxwq',24h + dw pmovsxwq_instruction-instruction_handler + db 'pmovzxbd',31h + dw pmovsxbd_instruction-instruction_handler + db 'pmovzxbq',32h + dw pmovsxbq_instruction-instruction_handler + db 'pmovzxbw',30h + dw pmovsxbw_instruction-instruction_handler + db 'pmovzxdq',35h + dw pmovsxdq_instruction-instruction_handler + db 'pmovzxwd',33h + dw pmovsxwd_instruction-instruction_handler + db 'pmovzxwq',34h + dw pmovsxwq_instruction-instruction_handler + db 'pmulhrsw',0Bh + dw ssse3_instruction-instruction_handler + db 'prefetch',0 + dw amd_prefetch_instruction-instruction_handler + db 'rdfsbase',0 + dw rdfsbase_instruction-instruction_handler + db 'rdgsbase',1 + dw rdfsbase_instruction-instruction_handler + db 'rstorssp',5 + dw rstorssp_instruction-instruction_handler + db 'setssbsy',0E8h + dw setssbsy_instruction-instruction_handler + db 'sha1msg1',0C9h + dw sse4_instruction_38-instruction_handler + db 'sha1msg2',0CAh + dw sse4_instruction_38-instruction_handler + db 'sysenter',34h + dw simple_extended_instruction-instruction_handler + db 'sysexitq',35h + dw simple_extended_instruction_64bit-instruction_handler + db 'umonitor',0 + dw umonitor_instruction-instruction_handler + db 'unpckhpd',15h + dw sse_pd_instruction-instruction_handler + db 'unpckhps',15h + dw sse_ps_instruction-instruction_handler + db 'unpcklpd',14h + dw sse_pd_instruction-instruction_handler + db 'unpcklps',14h + dw sse_ps_instruction-instruction_handler + db 'vblendpd',0Dh + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vblendps',0Ch + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vcmpeqpd',0 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpeqps',0 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpeqsd',0 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpeqss',0 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpgepd',0Dh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpgeps',0Dh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpgesd',0Dh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpgess',0Dh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpgtpd',0Eh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpgtps',0Eh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpgtsd',0Eh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpgtss',0Eh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmplepd',2 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpleps',2 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmplesd',2 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpless',2 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpltpd',1 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpltps',1 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpltsd',1 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpltss',1 + dw avx_cmp_ss_instruction-instruction_handler + db 'vfmaddpd',69h + dw fma4_instruction_p-instruction_handler + db 'vfmaddps',68h + dw fma4_instruction_p-instruction_handler + db 'vfmaddsd',6Bh + dw fma4_instruction_sd-instruction_handler + db 'vfmaddss',6Ah + dw fma4_instruction_ss-instruction_handler + db 'vfmsubpd',6Dh + dw fma4_instruction_p-instruction_handler + db 'vfmsubps',6Ch + dw fma4_instruction_p-instruction_handler + db 'vfmsubsd',6Fh + dw fma4_instruction_sd-instruction_handler + db 'vfmsubss',6Eh + dw fma4_instruction_ss-instruction_handler + db 'vldmxcsr',10b + dw vldmxcsr_instruction-instruction_handler + db 'vmlaunch',0C2h + dw simple_instruction_0f_01-instruction_handler + db 'vmovddup',12h + dw avx_movddup_instruction-instruction_handler + db 'vmovdqu8',6Fh + dw avx512_movdqu8_instruction-instruction_handler + db 'vmovhlps',12h + dw avx_movhlps_instruction-instruction_handler + db 'vmovlhps',16h + dw avx_movhlps_instruction-instruction_handler + db 'vmovntdq',0E7h + dw avx_movntdq_instruction-instruction_handler + db 'vmovntpd',2Bh + dw avx_movntpd_instruction-instruction_handler + db 'vmovntps',2Bh + dw avx_movntps_instruction-instruction_handler + db 'vmpsadbw',42h + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vmresume',0C3h + dw simple_instruction_0f_01-instruction_handler + db 'vpaddusb',0DCh + dw avx_bw_instruction-instruction_handler + db 'vpaddusw',0DDh + dw avx_bw_instruction-instruction_handler + db 'vpalignr',0Fh + dw avx_pi_instruction_3a_imm8-instruction_handler + db 'vpblendd',2 + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vpblendw',0Eh + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpeqb',74h + dw avx_cmpeqb_instruction-instruction_handler + db 'vpcmpeqd',76h + dw avx_cmpeqd_instruction-instruction_handler + db 'vpcmpeqq',29h + dw avx_cmpeqq_instruction-instruction_handler + db 'vpcmpeqw',75h + dw avx_cmpeqb_instruction-instruction_handler + db 'vpcmpgtb',64h + dw avx_cmpeqb_instruction-instruction_handler + db 'vpcmpgtd',66h + dw avx_cmpeqd_instruction-instruction_handler + db 'vpcmpgtq',37h + dw avx_cmpeqq_instruction-instruction_handler + db 'vpcmpgtw',65h + dw avx_cmpeqb_instruction-instruction_handler + db 'vpcmpleb',2 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpled',2 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpleq',2 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmplew',2 + dw avx512_cmp_w_instruction-instruction_handler + db 'vpcmpltb',1 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpltd',1 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpltq',1 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpltw',1 + dw avx512_cmp_w_instruction-instruction_handler + db 'vpcomeqb',4 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomeqd',4 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomeqq',4 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomeqw',4 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcomgeb',3 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomged',3 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomgeq',3 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomgew',3 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcomgtb',2 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomgtd',2 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomgtq',2 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomgtw',2 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcomleb',1 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomled',1 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomleq',1 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomlew',1 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcomltb',0 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomltd',0 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomltq',0 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomltw',0 + dw xop_pcom_w_instruction-instruction_handler + db 'vpdpbusd',50h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpdpwssd',52h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpermi2b',75h + dw avx_bw_instruction_38_evex-instruction_handler + db 'vpermi2d',76h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpermi2q',76h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpermi2w',75h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpermt2b',7Dh + dw avx_bw_instruction_38_evex-instruction_handler + db 'vpermt2d',7Eh + dw avx_d_instruction_38_evex-instruction_handler + db 'vpermt2q',7Eh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpermt2w',7Dh + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vphaddbd',0C2h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddbq',0C3h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddbw',0C1h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphadddq',0CBh + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddsw',3 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphaddwd',0C6h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddwq',0C7h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphsubbw',0E1h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphsubdq',0E3h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphsubsw',7 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphsubwd',0E2h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vplzcntd',44h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vplzcntq',44h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vpmacsdd',9Eh + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacswd',96h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacsww',95h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmaddwd',0F5h + dw avx_bw_instruction-instruction_handler + db 'vpmovb2m',29h + dw avx512_pmov_2m_instruction-instruction_handler + db 'vpmovd2m',39h + dw avx512_pmov_2m_instruction-instruction_handler + db 'vpmovm2b',28h + dw avx512_pmov_m2_instruction-instruction_handler + db 'vpmovm2d',38h + dw avx512_pmov_m2_instruction-instruction_handler + db 'vpmovm2q',38h + dw avx512_pmov_m2_instruction_w1-instruction_handler + db 'vpmovm2w',28h + dw avx512_pmov_m2_instruction_w1-instruction_handler + db 'vpmovq2m',39h + dw avx512_pmov_2m_instruction_w1-instruction_handler + db 'vpmovsdb',21h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovsdw',23h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovsqb',22h + dw avx512_pmovqb_instruction-instruction_handler + db 'vpmovsqd',25h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovsqw',24h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovswb',20h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovw2m',29h + dw avx512_pmov_2m_instruction_w1-instruction_handler + db 'vpmulhuw',0E4h + dw avx_bw_instruction-instruction_handler + db 'vpmuludq',0F4h + dw avx_q_instruction-instruction_handler + db 'vpopcntb',54h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vpopcntd',55h + dw avx512_single_source_ps_instruction-instruction_handler + db 'vpopcntq',55h + dw avx512_single_source_pd_instruction-instruction_handler + db 'vpopcntw',54h + dw avx_single_source_d_instruction_38_evex_w1-instruction_handler + db 'vpshldvd',71h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpshldvq',71h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpshldvw',70h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpshrdvd',73h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpshrdvq',73h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpshrdvw',72 + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpshufhw',0F3h + dw avx_pshuf_w_instruction-instruction_handler + db 'vpshuflw',0F2h + dw avx_pshuf_w_instruction-instruction_handler + db 'vpsubusb',0D8h + dw avx_bw_instruction-instruction_handler + db 'vpsubusw',0D9h + dw avx_bw_instruction-instruction_handler + db 'vptestmb',26h + dw avx512_ptestmb_instruction-instruction_handler + db 'vptestmd',27h + dw avx512_ptestmd_instruction-instruction_handler + db 'vptestmq',27h + dw avx512_ptestmq_instruction-instruction_handler + db 'vptestmw',26h + dw avx512_ptestmw_instruction-instruction_handler + db 'vrangepd',50h + dw avx512_pd_instruction_sae_imm8-instruction_handler + db 'vrangeps',50h + dw avx512_ps_instruction_sae_imm8-instruction_handler + db 'vrangesd',51h + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vrangess',51h + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vrcp14pd',4Ch + dw avx512_single_source_pd_instruction-instruction_handler + db 'vrcp14ps',4Ch + dw avx512_single_source_ps_instruction-instruction_handler + db 'vrcp14sd',4Dh + dw avx512_sd_instruction-instruction_handler + db 'vrcp14ss',4Dh + dw avx512_ss_instruction-instruction_handler + db 'vrcp28pd',0CAh + dw avx512_exp2pd_instruction-instruction_handler + db 'vrcp28ps',0CAh + dw avx512_exp2ps_instruction-instruction_handler + db 'vrcp28sd',0CBh + dw avx512_sd_instruction_sae-instruction_handler + db 'vrcp28ss',0CBh + dw avx512_ss_instruction_sae-instruction_handler + db 'vroundpd',9 + dw avx_single_source_instruction_3a_imm8_noevex-instruction_handler + db 'vroundps',8 + dw avx_single_source_instruction_3a_imm8_noevex-instruction_handler + db 'vroundsd',0Bh + dw avx_sd_instruction_3a_imm8_noevex-instruction_handler + db 'vroundss',0Ah + dw avx_ss_instruction_3a_imm8_noevex-instruction_handler + db 'vrsqrtps',52h + dw avx_single_source_ps_instruction_noevex-instruction_handler + db 'vrsqrtss',52h + dw avx_ss_instruction_noevex-instruction_handler + db 'vstmxcsr',11b + dw vldmxcsr_instruction-instruction_handler + db 'vucomisd',2Eh + dw avx_comisd_instruction-instruction_handler + db 'vucomiss',2Eh + dw avx_comiss_instruction-instruction_handler + db 'vzeroall',77h + dw vzeroall_instruction-instruction_handler + db 'wbnoinvd',9 + dw simple_extended_instruction_f3-instruction_handler + db 'wrfsbase',2 + dw rdfsbase_instruction-instruction_handler + db 'wrgsbase',3 + dw rdfsbase_instruction-instruction_handler + db 'xacquire',0F2h + dw prefix_instruction-instruction_handler + db 'xrelease',0F3h + dw prefix_instruction-instruction_handler + db 'xrstor64',101b + dw fxsave_instruction_64bit-instruction_handler + db 'xsavec64',4 + dw xsaves_instruction_64bit-instruction_handler + db 'xsaveopt',110b + dw fxsave_instruction-instruction_handler + db 'xsaves64',5 + dw xsaves_instruction_64bit-instruction_handler +instructions_9: + db 'cmpxchg8b',8 + dw cmpxchgx_instruction-instruction_handler + db 'cvttpd2dq',0E6h + dw sse_pd_instruction-instruction_handler + db 'cvttpd2pi',2Ch + dw cvtpd2pi_instruction-instruction_handler + db 'cvttps2dq',5Bh + dw movshdup_instruction-instruction_handler + db 'cvttps2pi',2Ch + dw cvtps2pi_instruction-instruction_handler + db 'cvttsd2si',2Ch + dw cvtsd2si_instruction-instruction_handler + db 'cvttss2si',2Ch + dw cvtss2si_instruction-instruction_handler + db 'extractps',17h + dw extractps_instruction-instruction_handler + db 'fxrstor64',1 + dw fxsave_instruction_64bit-instruction_handler + db 'gf2p8mulb',0CFh + dw sse4_instruction_66_38-instruction_handler + db 'movdir64b',0F8h + dw movdir64b_instruction-instruction_handler + db 'pclmulqdq',-1 + dw pclmulqdq_instruction-instruction_handler + db 'pcmpestri',61h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pcmpestrm',60h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pcmpistri',63h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pcmpistrm',62h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pmaddubsw',4 + dw ssse3_instruction-instruction_handler + db 'prefetchw',1 + dw amd_prefetch_instruction-instruction_handler + db 'punpckhbw',68h + dw basic_mmx_instruction-instruction_handler + db 'punpckhdq',6Ah + dw basic_mmx_instruction-instruction_handler + db 'punpckhwd',69h + dw basic_mmx_instruction-instruction_handler + db 'punpcklbw',60h + dw basic_mmx_instruction-instruction_handler + db 'punpckldq',62h + dw basic_mmx_instruction-instruction_handler + db 'punpcklwd',61h + dw basic_mmx_instruction-instruction_handler + db 'sha1nexte',0C8h + dw sse4_instruction_38-instruction_handler + db 'sha1rnds4',0CCh + dw sse4_instruction_3a_imm8-instruction_handler + db 'useavx256',0 + dw set_evex_mode-instruction_handler + db 'useavx512',1 + dw set_evex_mode-instruction_handler + db 'vaddsubpd',0D0h + dw avx_pd_instruction_noevex-instruction_handler + db 'vaddsubps',0D0h + dw avx_ps_instruction_noevex-instruction_handler + db 'vblendmpd',65h + dw avx_pd_instruction_38_evex-instruction_handler + db 'vblendmps',65h + dw avx_ps_instruction_66_38_evex-instruction_handler + db 'vblendvpd',4Bh + dw avx_triple_source_instruction_3a_noevex-instruction_handler + db 'vblendvps',4Ah + dw avx_triple_source_instruction_3a_noevex-instruction_handler + db 'vcmpneqpd',4 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpneqps',4 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpneqsd',4 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpneqss',4 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpngepd',9 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpngeps',9 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpngesd',9 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpngess',9 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpngtpd',0Ah + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpngtps',0Ah + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpngtsd',0Ah + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpngtss',0Ah + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnlepd',6 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnleps',6 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnlesd',6 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnless',6 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnltpd',5 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnltps',5 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnltsd',5 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnltss',5 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpordpd',7 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpordps',7 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpordsd',7 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpordss',7 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcvtdq2pd',0E6h + dw avx_cvtdq2pd_instruction-instruction_handler + db 'vcvtdq2ps',5Bh + dw avx_single_source_ps_instruction_er-instruction_handler + db 'vcvtpd2dq',0E6h + dw avx_cvtpd2dq_instruction-instruction_handler + db 'vcvtpd2ps',5Ah + dw avx_cvtpd2ps_instruction-instruction_handler + db 'vcvtpd2qq',7Bh + dw avx_single_source_pd_instruction_er_evex-instruction_handler + db 'vcvtph2ps',13h + dw avx_cvtph2ps_instruction-instruction_handler + db 'vcvtps2dq',5Bh + dw avx_cvtps2dq_instruction-instruction_handler + db 'vcvtps2pd',5Ah + dw avx_cvtps2pd_instruction-instruction_handler + db 'vcvtps2ph',1Dh + dw avx_cvtps2ph_instruction-instruction_handler + db 'vcvtps2qq',7Bh + dw avx_cvtps2qq_instruction-instruction_handler + db 'vcvtqq2pd',0E6h + dw avx_cvtqq2pd_instruction-instruction_handler + db 'vcvtqq2ps',5Bh + dw avx_cvtpd2udq_instruction-instruction_handler + db 'vcvtsd2si',2Dh + dw avx_cvtsd2si_instruction-instruction_handler + db 'vcvtsd2ss',5Ah + dw avx_sd_instruction_er-instruction_handler + db 'vcvtsi2sd',2Ah + dw avx_cvtsi2sd_instruction-instruction_handler + db 'vcvtsi2ss',2Ah + dw avx_cvtsi2ss_instruction-instruction_handler + db 'vcvtss2sd',5Ah + dw avx_ss_instruction_sae-instruction_handler + db 'vcvtss2si',2Dh + dw avx_cvtss2si_instruction-instruction_handler + db 'vdbpsadbw',42h + dw avx_bw_instruction_3a_imm8_evex-instruction_handler + db 'vexpandpd',88h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vexpandps',88h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vfnmaddpd',79h + dw fma4_instruction_p-instruction_handler + db 'vfnmaddps',78h + dw fma4_instruction_p-instruction_handler + db 'vfnmaddsd',7Bh + dw fma4_instruction_sd-instruction_handler + db 'vfnmaddss',7Ah + dw fma4_instruction_ss-instruction_handler + db 'vfnmsubpd',7Dh + dw fma4_instruction_p-instruction_handler + db 'vfnmsubps',7Ch + dw fma4_instruction_p-instruction_handler + db 'vfnmsubsd',7Fh + dw fma4_instruction_sd-instruction_handler + db 'vfnmsubss',7Eh + dw fma4_instruction_ss-instruction_handler + db 'vgetexppd',42h + dw avx512_single_source_pd_instruction_sae-instruction_handler + db 'vgetexpps',42h + dw avx512_single_source_ps_instruction_sae-instruction_handler + db 'vgetexpsd',43h + dw avx512_sd_instruction_sae-instruction_handler + db 'vgetexpss',43h + dw avx512_ss_instruction_sae-instruction_handler + db 'vinsertps',21h + dw avx_insertps_instruction-instruction_handler + db 'vmovdqa32',6Fh + dw avx512_movdqa32_instruction-instruction_handler + db 'vmovdqa64',6Fh + dw avx512_movdqa64_instruction-instruction_handler + db 'vmovdqu16',6Fh + dw avx512_movdqu16_instruction-instruction_handler + db 'vmovdqu32',6Fh + dw avx512_movdqu32_instruction-instruction_handler + db 'vmovdqu64',6Fh + dw avx512_movdqu64_instruction-instruction_handler + db 'vmovmskpd',0 + dw avx_movmskpd_instruction-instruction_handler + db 'vmovmskps',0 + dw avx_movmskps_instruction-instruction_handler + db 'vmovntdqa',2Ah + dw avx_movntdqa_instruction-instruction_handler + db 'vmovshdup',16h + dw avx_movshdup_instruction-instruction_handler + db 'vmovsldup',12h + dw avx_movshdup_instruction-instruction_handler + db 'vp4dpwssd',52h + dw avx512_4vnniw_instruction-instruction_handler + db 'vpackssdw',6Bh + dw avx_d_instruction-instruction_handler + db 'vpacksswb',63h + dw avx_bw_instruction-instruction_handler + db 'vpackusdw',2Bh + dw avx_d_instruction_38-instruction_handler + db 'vpackuswb',67h + dw avx_bw_instruction-instruction_handler + db 'vpblendmb',66h + dw avx_bw_instruction_38_evex-instruction_handler + db 'vpblendmd',64h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpblendmq',64h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpblendmw',66h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpblendvb',4Ch + dw avx_triple_source_instruction_3a_noevex-instruction_handler + db 'vpcmpleub',2 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpleud',2 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpleuq',2 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpleuw',2 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcmpltub',1 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpltud',1 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpltuq',1 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpltuw',1 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcmpneqb',4 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpneqd',4 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpneqq',4 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpneqw',4 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpnleb',6 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpnled',6 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpnleq',6 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpnlew',6 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpnltb',5 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpnltd',5 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpnltq',5 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpnltw',5 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcomequb',4 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomequd',4 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomequq',4 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomequw',4 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomgeub',3 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomgeud',3 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomgeuq',3 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomgeuw',3 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomgtub',2 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomgtud',2 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomgtuq',2 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomgtuw',2 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomleub',1 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomleud',1 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomleuq',1 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomleuw',1 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomltub',0 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomltud',0 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomltuq',0 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomltuw',0 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomneqb',5 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomneqd',5 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomneqq',5 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomneqw',5 + dw xop_pcom_w_instruction-instruction_handler + db 'vpdpbusds',51h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpdpwssds',53h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpermi2pd',77h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpermi2ps',77h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpermilpd',5 + dw avx_permilpd_instruction-instruction_handler + db 'vpermilps',4 + dw avx_permilps_instruction-instruction_handler + db 'vpermt2pd',7Fh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpermt2ps',7Fh + dw avx_d_instruction_38_evex-instruction_handler + db 'vpexpandb',62h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vpexpandd',89h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vpexpandq',89h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vpexpandw',62h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vphaddubd',0D2h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddubq',0D3h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddubw',0D1h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddudq',0DBh + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphadduwd',0D6h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphadduwq',0D7h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vpmacsdqh',9Fh + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacsdql',97h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacssdd',8Eh + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacsswd',86h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacssww',85h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmadcswd',0B6h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmovmskb',0D7h + dw avx_pmovmskb_instruction-instruction_handler + db 'vpmovsxbd',21h + dw avx_pmovsxbd_instruction-instruction_handler + db 'vpmovsxbq',22h + dw avx_pmovsxbq_instruction-instruction_handler + db 'vpmovsxbw',20h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovsxdq',25h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovsxwd',23h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovsxwq',24h + dw avx_pmovsxbd_instruction-instruction_handler + db 'vpmovusdb',11h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovusdw',13h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovusqb',12h + dw avx512_pmovqb_instruction-instruction_handler + db 'vpmovusqd',15h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovusqw',14h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovuswb',10h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovzxbd',31h + dw avx_pmovsxbd_instruction-instruction_handler + db 'vpmovzxbq',32h + dw avx_pmovsxbq_instruction-instruction_handler + db 'vpmovzxbw',30h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovzxdq',35h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovzxwd',33h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovzxwq',34h + dw avx_pmovsxbd_instruction-instruction_handler + db 'vpmulhrsw',0Bh + dw avx_bw_instruction_38-instruction_handler + db 'vptestnmb',26h + dw avx512_ptestnmb_instruction-instruction_handler + db 'vptestnmd',27h + dw avx512_ptestnmd_instruction-instruction_handler + db 'vptestnmq',27h + dw avx512_ptestnmq_instruction-instruction_handler + db 'vptestnmw',26h + dw avx512_ptestnmw_instruction-instruction_handler + db 'vreducepd',56h + dw avx512_single_source_pd_instruction_sae_imm8-instruction_handler + db 'vreduceps',56h + dw avx512_single_source_ps_instruction_sae_imm8-instruction_handler + db 'vreducesd',57h + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vreducess',57h + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vscalefpd',2Ch + dw avx512_pd_instruction_er-instruction_handler + db 'vscalefps',2Ch + dw avx512_ps_instruction_er-instruction_handler + db 'vscalefsd',2Dh + dw avx512_sd_instruction_er-instruction_handler + db 'vscalefss',2Dh + dw avx512_ss_instruction_er-instruction_handler + db 'vunpckhpd',15h + dw avx_pd_instruction-instruction_handler + db 'vunpckhps',15h + dw avx_ps_instruction-instruction_handler + db 'vunpcklpd',14h + dw avx_pd_instruction-instruction_handler + db 'vunpcklps',14h + dw avx_ps_instruction-instruction_handler + db 'xrstors64',3 + dw xsaves_instruction_64bit-instruction_handler +instructions_10: + db 'aesdeclast',0DFh + dw sse4_instruction_66_38-instruction_handler + db 'aesenclast',0DDh + dw sse4_instruction_66_38-instruction_handler + db 'clflushopt',7 + dw clflushopt_instruction-instruction_handler + db 'cmpunordpd',3 + dw cmp_pd_instruction-instruction_handler + db 'cmpunordps',3 + dw cmp_ps_instruction-instruction_handler + db 'cmpunordsd',3 + dw cmp_sd_instruction-instruction_handler + db 'cmpunordss',3 + dw cmp_ss_instruction-instruction_handler + db 'cmpxchg16b',16 + dw cmpxchgx_instruction-instruction_handler + db 'loadall286',5 + dw simple_extended_instruction-instruction_handler + db 'loadall386',7 + dw simple_extended_instruction-instruction_handler + db 'maskmovdqu',0 + dw maskmovdqu_instruction-instruction_handler + db 'phminposuw',41h + dw sse4_instruction_66_38-instruction_handler + db 'prefetcht0',1 + dw prefetch_instruction-instruction_handler + db 'prefetcht1',2 + dw prefetch_instruction-instruction_handler + db 'prefetcht2',3 + dw prefetch_instruction-instruction_handler + db 'punpckhqdq',6Dh + dw sse_pd_instruction-instruction_handler + db 'punpcklqdq',6Ch + dw sse_pd_instruction-instruction_handler + db 'sha256msg1',0CCh + dw sse4_instruction_38-instruction_handler + db 'sha256msg2',0CDh + dw sse4_instruction_38-instruction_handler + db 'vcmptruepd',0Fh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmptrueps',0Fh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmptruesd',0Fh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmptruess',0Fh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcvtpd2udq',79h + dw avx_cvtpd2udq_instruction-instruction_handler + db 'vcvtpd2uqq',79h + dw avx_single_source_pd_instruction_er_evex-instruction_handler + db 'vcvtps2udq',79h + dw avx_single_source_ps_instruction_er_evex-instruction_handler + db 'vcvtps2uqq',79h + dw avx_cvtps2qq_instruction-instruction_handler + db 'vcvtsd2usi',79h + dw avx_cvtsd2usi_instruction-instruction_handler + db 'vcvtss2usi',79h + dw avx_cvtss2usi_instruction-instruction_handler + db 'vcvttpd2dq',0E6h + dw avx_cvttpd2dq_instruction-instruction_handler + db 'vcvttpd2qq',7Ah + dw avx_single_source_pd_instruction_sae_evex-instruction_handler + db 'vcvttps2dq',5Bh + dw avx_cvttps2dq_instruction-instruction_handler + db 'vcvttps2qq',7Ah + dw avx_cvttps2qq_instruction-instruction_handler + db 'vcvttsd2si',2Ch + dw avx_cvttsd2si_instruction-instruction_handler + db 'vcvttss2si',2Ch + dw avx_cvttss2si_instruction-instruction_handler + db 'vcvtudq2pd',7Ah + dw avx_cvtudq2pd_instruction-instruction_handler + db 'vcvtudq2ps',7Ah + dw avx_cvtudq2ps_instruction-instruction_handler + db 'vcvtuqq2pd',7Ah + dw avx_cvtqq2pd_instruction-instruction_handler + db 'vcvtuqq2ps',7Ah + dw avx_cvtuqq2ps_instruction-instruction_handler + db 'vcvtusi2sd',7Bh + dw avx_cvtusi2sd_instruction-instruction_handler + db 'vcvtusi2ss',7Bh + dw avx_cvtusi2ss_instruction-instruction_handler + db 'vextractps',17h + dw avx_extract_d_instruction-instruction_handler + db 'vfpclasspd',66h + dw avx512_fpclasspd_instruction-instruction_handler + db 'vfpclassps',66h + dw avx512_fpclassps_instruction-instruction_handler + db 'vfpclasssd',67h + dw avx512_fpclasssd_instruction-instruction_handler + db 'vfpclassss',67h + dw avx512_fpclassss_instruction-instruction_handler + db 'vgatherdpd',92h + dw gather_pd_instruction-instruction_handler + db 'vgatherdps',92h + dw gather_ps_instruction-instruction_handler + db 'vgatherqpd',93h + dw gather_pd_instruction-instruction_handler + db 'vgatherqps',93h + dw gather_ps_instruction-instruction_handler + db 'vgetmantpd',26h + dw avx512_single_source_pd_instruction_sae_imm8-instruction_handler + db 'vgetmantps',26h + dw avx512_single_source_ps_instruction_sae_imm8-instruction_handler + db 'vgetmantsd',27h + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vgetmantss',27h + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vgf2p8mulb',0CFh + dw avx_bw_instruction_38-instruction_handler + db 'vmaskmovpd',2Dh + dw avx_maskmov_instruction-instruction_handler + db 'vmaskmovps',2Ch + dw avx_maskmov_instruction-instruction_handler + db 'vp4dpwssds',53h + dw avx512_4vnniw_instruction-instruction_handler + db 'vpclmulqdq',-1 + dw avx_pclmulqdq_instruction-instruction_handler + db 'vpcmpestri',61h + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpestrm',60h + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpistri',63h + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpistrm',62h + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpnequb',4 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpnequd',4 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpnequq',4 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpnequw',4 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcmpnleub',6 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpnleud',6 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpnleuq',6 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpnleuw',6 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcmpnltub',5 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpnltud',5 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpnltuq',5 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpnltuw',5 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcomnequb',5 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomnequd',5 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomnequq',5 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomnequw',5 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomtrueb',7 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomtrued',7 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomtrueq',7 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomtruew',7 + dw xop_pcom_w_instruction-instruction_handler + db 'vperm2f128',6 + dw avx_perm2f128_instruction-instruction_handler + db 'vperm2i128',46h + dw avx_perm2f128_instruction-instruction_handler + db 'vpermil2pd',49h + dw vpermil2_instruction-instruction_handler + db 'vpermil2ps',48h + dw vpermil2_instruction-instruction_handler + db 'vpgatherdd',90h + dw gather_ps_instruction-instruction_handler + db 'vpgatherdq',90h + dw gather_pd_instruction-instruction_handler + db 'vpgatherqd',91h + dw gather_ps_instruction-instruction_handler + db 'vpgatherqq',91h + dw gather_pd_instruction-instruction_handler + db 'vpmacssdqh',8Fh + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacssdql',87h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmadcsswd',0A6h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmaddubsw',4 + dw avx_bw_instruction_38-instruction_handler + db 'vpmaskmovd',8Ch + dw avx_maskmov_instruction-instruction_handler + db 'vpmaskmovq',8Ch + dw avx_maskmov_w1_instruction-instruction_handler + db 'vpternlogd',25h + dw avx_d_instruction_3a_imm8_evex-instruction_handler + db 'vpternlogq',25h + dw avx_q_instruction_3a_imm8_evex-instruction_handler + db 'vpunpckhbw',68h + dw avx_bw_instruction-instruction_handler + db 'vpunpckhdq',6Ah + dw avx_d_instruction-instruction_handler + db 'vpunpckhwd',69h + dw avx_bw_instruction-instruction_handler + db 'vpunpcklbw',60h + dw avx_bw_instruction-instruction_handler + db 'vpunpckldq',62h + dw avx_d_instruction-instruction_handler + db 'vpunpcklwd',61h + dw avx_bw_instruction-instruction_handler + db 'vrsqrt14pd',4Eh + dw avx512_single_source_pd_instruction-instruction_handler + db 'vrsqrt14ps',4Eh + dw avx512_single_source_ps_instruction-instruction_handler + db 'vrsqrt14sd',4Fh + dw avx512_sd_instruction-instruction_handler + db 'vrsqrt14ss',4Fh + dw avx512_ss_instruction-instruction_handler + db 'vrsqrt28pd',0CCh + dw avx512_exp2pd_instruction-instruction_handler + db 'vrsqrt28ps',0CCh + dw avx512_exp2ps_instruction-instruction_handler + db 'vrsqrt28sd',0CDh + dw avx512_sd_instruction_sae-instruction_handler + db 'vrsqrt28ss',0CDh + dw avx512_ss_instruction_sae-instruction_handler + db 'vshuff32x4',23h + dw avx512_shuf_d_instruction-instruction_handler + db 'vshuff64x2',23h + dw avx512_shuf_q_instruction-instruction_handler + db 'vshufi32x4',43h + dw avx512_shuf_d_instruction-instruction_handler + db 'vshufi64x2',43h + dw avx512_shuf_q_instruction-instruction_handler + db 'vzeroupper',77h + dw vzeroupper_instruction-instruction_handler + db 'xsaveopt64',110b + dw fxsave_instruction_64bit-instruction_handler +instructions_11: + db 'pclmulhqhdq',10001b + dw pclmulqdq_instruction-instruction_handler + db 'pclmullqhdq',10000b + dw pclmulqdq_instruction-instruction_handler + db 'prefetchnta',0 + dw prefetch_instruction-instruction_handler + db 'prefetchwt1',2 + dw amd_prefetch_instruction-instruction_handler + db 'saveprevssp',0EAh + dw setssbsy_instruction-instruction_handler + db 'sha256rnds2',0CBh + dw sse4_instruction_38_xmm0-instruction_handler + db 'vaesdeclast',0DFh + dw avx_instruction_38_nomask-instruction_handler + db 'vaesenclast',0DDh + dw avx_instruction_38_nomask-instruction_handler + db 'vcmpeq_ospd',10h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpeq_osps',10h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpeq_ossd',10h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpeq_osss',10h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpeq_uqpd',8 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpeq_uqps',8 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpeq_uqsd',8 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpeq_uqss',8 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpeq_uspd',18h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpeq_usps',18h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpeq_ussd',18h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpeq_usss',18h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpfalsepd',0Bh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpfalseps',0Bh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpfalsesd',0Bh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpfalsess',0Bh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpge_oqpd',1Dh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpge_oqps',1Dh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpge_oqsd',1Dh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpge_oqss',1Dh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpgt_oqpd',1Eh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpgt_oqps',1Eh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpgt_oqsd',1Eh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpgt_oqss',1Eh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmple_oqpd',12h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmple_oqps',12h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmple_oqsd',12h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmple_oqss',12h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmplt_oqpd',11h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmplt_oqps',11h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmplt_oqsd',11h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmplt_oqss',11h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpord_spd',17h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpord_sps',17h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpord_ssd',17h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpord_sss',17h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpunordpd',3 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpunordps',3 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpunordsd',3 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpunordss',3 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcompresspd',8Ah + dw avx_compress_q_instruction-instruction_handler + db 'vcompressps',8Ah + dw avx_compress_d_instruction-instruction_handler + db 'vcvttpd2udq',78h + dw avx_cvttpd2udq_instruction-instruction_handler + db 'vcvttpd2uqq',78h + dw avx_single_source_pd_instruction_sae_evex-instruction_handler + db 'vcvttps2udq',78h + dw avx_cvttps2udq_instruction-instruction_handler + db 'vcvttps2uqq',78h + dw avx_cvttps2qq_instruction-instruction_handler + db 'vcvttsd2usi',78h + dw avx_cvttsd2usi_instruction-instruction_handler + db 'vcvttss2usi',78h + dw avx_cvttss2usi_instruction-instruction_handler + db 'vfixupimmpd',54h + dw avx512_pd_instruction_sae_imm8-instruction_handler + db 'vfixupimmps',54h + dw avx512_ps_instruction_sae_imm8-instruction_handler + db 'vfixupimmsd',55h + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vfixupimmss',55h + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vfmadd132pd',98h + dw fma_instruction_pd-instruction_handler + db 'vfmadd132ps',98h + dw fma_instruction_ps-instruction_handler + db 'vfmadd132sd',99h + dw fma_instruction_sd-instruction_handler + db 'vfmadd132ss',99h + dw fma_instruction_ss-instruction_handler + db 'vfmadd213pd',0A8h + dw fma_instruction_pd-instruction_handler + db 'vfmadd213ps',0A8h + dw fma_instruction_ps-instruction_handler + db 'vfmadd213sd',0A9h + dw fma_instruction_sd-instruction_handler + db 'vfmadd213ss',0A9h + dw fma_instruction_ss-instruction_handler + db 'vfmadd231pd',0B8h + dw fma_instruction_pd-instruction_handler + db 'vfmadd231ps',0B8h + dw fma_instruction_ps-instruction_handler + db 'vfmadd231sd',0B9h + dw fma_instruction_sd-instruction_handler + db 'vfmadd231ss',0B9h + dw fma_instruction_ss-instruction_handler + db 'vfmaddsubpd',5Dh + dw fma4_instruction_p-instruction_handler + db 'vfmaddsubps',5Ch + dw fma4_instruction_p-instruction_handler + db 'vfmsub132pd',9Ah + dw fma_instruction_pd-instruction_handler + db 'vfmsub132ps',9Ah + dw fma_instruction_ps-instruction_handler + db 'vfmsub132sd',9Bh + dw fma_instruction_sd-instruction_handler + db 'vfmsub132ss',9Bh + dw fma_instruction_ss-instruction_handler + db 'vfmsub213pd',0AAh + dw fma_instruction_pd-instruction_handler + db 'vfmsub213ps',0AAh + dw fma_instruction_ps-instruction_handler + db 'vfmsub213sd',0ABh + dw fma_instruction_sd-instruction_handler + db 'vfmsub213ss',0ABh + dw fma_instruction_ss-instruction_handler + db 'vfmsub231pd',0BAh + dw fma_instruction_pd-instruction_handler + db 'vfmsub231ps',0BAh + dw fma_instruction_ps-instruction_handler + db 'vfmsub231sd',0BBh + dw fma_instruction_sd-instruction_handler + db 'vfmsub231ss',0BBh + dw fma_instruction_ss-instruction_handler + db 'vfmsubaddpd',5Fh + dw fma4_instruction_p-instruction_handler + db 'vfmsubaddps',5Eh + dw fma4_instruction_p-instruction_handler + db 'vinsertf128',18h + dw avx_insertf128_instruction-instruction_handler + db 'vinserti128',38h + dw avx_insertf128_instruction-instruction_handler + db 'vmaskmovdqu',0 + dw avx_maskmovdqu_instruction-instruction_handler + db 'vpcomfalseb',6 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomfalsed',6 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomfalseq',6 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomfalsew',6 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcompressb',63h + dw avx_compress_d_instruction-instruction_handler + db 'vpcompressd',8Bh + dw avx_compress_d_instruction-instruction_handler + db 'vpcompressq',8Bh + dw avx_compress_q_instruction-instruction_handler + db 'vpcompressw',63h + dw avx_compress_q_instruction-instruction_handler + db 'vpcomtrueub',7 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomtrueud',7 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomtrueuq',7 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomtrueuw',7 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpconflictd',0C4h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vpconflictq',0C4h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vphminposuw',41h + dw avx_single_source_instruction_38_noevex-instruction_handler + db 'vpmadd52huq',0B5h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpmadd52luq',0B4h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpscatterdd',0A0h + dw scatter_ps_instruction-instruction_handler + db 'vpscatterdq',0A0h + dw scatter_pd_instruction-instruction_handler + db 'vpscatterqd',0A1h + dw scatter_ps_instruction-instruction_handler + db 'vpscatterqq',0A1h + dw scatter_pd_instruction-instruction_handler + db 'vpunpckhqdq',6Dh + dw avx_q_instruction-instruction_handler + db 'vpunpcklqdq',6Ch + dw avx_q_instruction-instruction_handler + db 'vrndscalepd',9 + dw avx512_single_source_pd_instruction_sae_imm8-instruction_handler + db 'vrndscaleps',8 + dw avx512_single_source_ps_instruction_sae_imm8-instruction_handler + db 'vrndscalesd',0Bh + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vrndscaless',0Ah + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vscatterdpd',0A2h + dw scatter_pd_instruction-instruction_handler + db 'vscatterdps',0A2h + dw scatter_ps_instruction-instruction_handler + db 'vscatterqpd',0A3h + dw scatter_pd_instruction-instruction_handler + db 'vscatterqps',0A3h + dw scatter_ps_instruction-instruction_handler +instructions_12: + db 'pclmulhqhqdq',10001b + dw pclmulqdq_instruction-instruction_handler + db 'pclmulhqlqdq',1 + dw pclmulqdq_instruction-instruction_handler + db 'pclmullqhqdq',10000b + dw pclmulqdq_instruction-instruction_handler + db 'pclmullqlqdq',0 + dw pclmulqdq_instruction-instruction_handler + db 'vbroadcastsd',19h + dw avx_broadcastsd_instruction-instruction_handler + db 'vbroadcastss',18h + dw avx_broadcastss_instruction-instruction_handler + db 'vcmpneq_oqpd',0Ch + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpneq_oqps',0Ch + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpneq_oqsd',0Ch + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpneq_oqss',0Ch + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpneq_ospd',1Ch + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpneq_osps',1Ch + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpneq_ossd',1Ch + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpneq_osss',1Ch + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpneq_uspd',14h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpneq_usps',14h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpneq_ussd',14h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpneq_usss',14h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnge_uqpd',19h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnge_uqps',19h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnge_uqsd',19h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnge_uqss',19h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpngt_uqpd',1Ah + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpngt_uqps',1Ah + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpngt_uqsd',1Ah + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpngt_uqss',1Ah + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnle_uqpd',16h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnle_uqps',16h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnle_uqsd',16h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnle_uqss',16h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnlt_uqpd',15h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnlt_uqps',15h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnlt_uqsd',15h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnlt_uqss',15h + dw avx_cmp_ss_instruction-instruction_handler + db 'vextractf128',19h + dw avx_extractf128_instruction-instruction_handler + db 'vextracti128',39h + dw avx_extractf128_instruction-instruction_handler + db 'vfnmadd132pd',9Ch + dw fma_instruction_pd-instruction_handler + db 'vfnmadd132ps',9Ch + dw fma_instruction_ps-instruction_handler + db 'vfnmadd132sd',9Dh + dw fma_instruction_sd-instruction_handler + db 'vfnmadd132ss',9Dh + dw fma_instruction_ss-instruction_handler + db 'vfnmadd213pd',0ACh + dw fma_instruction_pd-instruction_handler + db 'vfnmadd213ps',0ACh + dw fma_instruction_ps-instruction_handler + db 'vfnmadd213sd',0ADh + dw fma_instruction_sd-instruction_handler + db 'vfnmadd213ss',0ADh + dw fma_instruction_ss-instruction_handler + db 'vfnmadd231pd',0BCh + dw fma_instruction_pd-instruction_handler + db 'vfnmadd231ps',0BCh + dw fma_instruction_ps-instruction_handler + db 'vfnmadd231sd',0BDh + dw fma_instruction_sd-instruction_handler + db 'vfnmadd231ss',0BDh + dw fma_instruction_ss-instruction_handler + db 'vfnmsub132pd',9Eh + dw fma_instruction_pd-instruction_handler + db 'vfnmsub132ps',9Eh + dw fma_instruction_ps-instruction_handler + db 'vfnmsub132sd',9Fh + dw fma_instruction_sd-instruction_handler + db 'vfnmsub132ss',9Fh + dw fma_instruction_ss-instruction_handler + db 'vfnmsub213pd',0AEh + dw fma_instruction_pd-instruction_handler + db 'vfnmsub213ps',0AEh + dw fma_instruction_ps-instruction_handler + db 'vfnmsub213sd',0AFh + dw fma_instruction_sd-instruction_handler + db 'vfnmsub213ss',0AFh + dw fma_instruction_ss-instruction_handler + db 'vfnmsub231pd',0BEh + dw fma_instruction_pd-instruction_handler + db 'vfnmsub231ps',0BEh + dw fma_instruction_ps-instruction_handler + db 'vfnmsub231sd',0BFh + dw fma_instruction_sd-instruction_handler + db 'vfnmsub231ss',0BFh + dw fma_instruction_ss-instruction_handler + db 'vinsertf32x4',18h + dw avx512_insert_32x4_instruction-instruction_handler + db 'vinsertf32x8',1Ah + dw avx512_insert_32x8_instruction-instruction_handler + db 'vinsertf64x2',18h + dw avx512_insert_64x2_instruction-instruction_handler + db 'vinsertf64x4',1Ah + dw avx512_insert_64x4_instruction-instruction_handler + db 'vinserti32x4',38h + dw avx512_insert_32x4_instruction-instruction_handler + db 'vinserti32x8',3Ah + dw avx512_insert_32x8_instruction-instruction_handler + db 'vinserti64x2',38h + dw avx512_insert_64x2_instruction-instruction_handler + db 'vinserti64x4',3Ah + dw avx512_insert_64x4_instruction-instruction_handler + db 'vpbroadcastb',78h + dw avx_pbroadcastb_instruction-instruction_handler + db 'vpbroadcastd',58h + dw avx_pbroadcastd_instruction-instruction_handler + db 'vpbroadcastq',59h + dw avx_pbroadcastq_instruction-instruction_handler + db 'vpbroadcastw',79h + dw avx_pbroadcastw_instruction-instruction_handler + db 'vpclmulhqhdq',10001b + dw avx_pclmulqdq_instruction-instruction_handler + db 'vpclmullqhdq',10000b + dw avx_pclmulqdq_instruction-instruction_handler + db 'vpcomfalseub',6 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomfalseud',6 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomfalseuq',6 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomfalseuw',6 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpermilmo2pd',10b + dw vpermil_2pd_instruction-instruction_handler + db 'vpermilmo2ps',10b + dw vpermil_2ps_instruction-instruction_handler + db 'vpermilmz2pd',11b + dw vpermil_2pd_instruction-instruction_handler + db 'vpermilmz2ps',11b + dw vpermil_2ps_instruction-instruction_handler + db 'vpermiltd2pd',0 + dw vpermil_2pd_instruction-instruction_handler + db 'vpermiltd2ps',0 + dw vpermil_2ps_instruction-instruction_handler + db 'vpshufbitqmb',8Fh + dw avx512_ptestmb_instruction-instruction_handler +instructions_13: + db 'gf2p8affineqb',0CEh + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'vcmptrue_uspd',1Fh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmptrue_usps',1Fh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmptrue_ussd',1Fh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmptrue_usss',1Fh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpunord_spd',13h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpunord_sps',13h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpunord_ssd',13h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpunord_sss',13h + dw avx_cmp_ss_instruction-instruction_handler + db 'vextractf32x4',19h + dw avx512_extract_32x4_instruction-instruction_handler + db 'vextractf32x8',1Bh + dw avx512_extract_32x8_instruction-instruction_handler + db 'vextractf64x2',19h + dw avx512_extract_64x2_instruction-instruction_handler + db 'vextractf64x4',1Bh + dw avx512_extract_64x4_instruction-instruction_handler + db 'vextracti32x4',39h + dw avx512_extract_32x4_instruction-instruction_handler + db 'vextracti32x8',3Bh + dw avx512_extract_32x8_instruction-instruction_handler + db 'vextracti64x2',39h + dw avx512_extract_64x2_instruction-instruction_handler + db 'vextracti64x4',3Bh + dw avx512_extract_64x4_instruction-instruction_handler + db 'vgatherpf0dpd',1 + dw gatherpf_dpd_instruction-instruction_handler + db 'vgatherpf0dps',1 + dw gatherpf_dps_instruction-instruction_handler + db 'vgatherpf0qpd',1 + dw gatherpf_qpd_instruction-instruction_handler + db 'vgatherpf0qps',1 + dw gatherpf_qps_instruction-instruction_handler + db 'vgatherpf1dpd',2 + dw gatherpf_dpd_instruction-instruction_handler + db 'vgatherpf1dps',2 + dw gatherpf_dps_instruction-instruction_handler + db 'vgatherpf1qpd',2 + dw gatherpf_qpd_instruction-instruction_handler + db 'vgatherpf1qps',2 + dw gatherpf_qps_instruction-instruction_handler + db 'vpclmulhqlqdq',1 + dw avx_pclmulqdq_instruction-instruction_handler + db 'vpclmullqlqdq',0 + dw avx_pclmulqdq_instruction-instruction_handler +instructions_14: + db 'vbroadcastf128',1Ah + dw avx_broadcast_128_instruction_noevex-instruction_handler + db 'vbroadcasti128',5Ah + dw avx_broadcast_128_instruction_noevex-instruction_handler + db 'vcmpfalse_ospd',1Bh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpfalse_osps',1Bh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpfalse_ossd',1Bh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpfalse_osss',1Bh + dw avx_cmp_ss_instruction-instruction_handler + db 'vfmaddsub132pd',96h + dw fma_instruction_pd-instruction_handler + db 'vfmaddsub132ps',96h + dw fma_instruction_ps-instruction_handler + db 'vfmaddsub213pd',0A6h + dw fma_instruction_pd-instruction_handler + db 'vfmaddsub213ps',0A6h + dw fma_instruction_ps-instruction_handler + db 'vfmaddsub231pd',0B6h + dw fma_instruction_pd-instruction_handler + db 'vfmaddsub231ps',0B6h + dw fma_instruction_ps-instruction_handler + db 'vfmsubadd132pd',97h + dw fma_instruction_pd-instruction_handler + db 'vfmsubadd132ps',97h + dw fma_instruction_ps-instruction_handler + db 'vfmsubadd213pd',0A7h + dw fma_instruction_pd-instruction_handler + db 'vfmsubadd213ps',0A7h + dw fma_instruction_ps-instruction_handler + db 'vfmsubadd231pd',0B7h + dw fma_instruction_pd-instruction_handler + db 'vfmsubadd231ps',0B7h + dw fma_instruction_ps-instruction_handler + db 'vgf2p8affineqb',0CEh + dw avx_q_instruction_3a_imm8_w1-instruction_handler + db 'vpmultishiftqb',83h + dw avx_q_instruction_38_evex-instruction_handler + db 'vscatterpf0dpd',5 + dw gatherpf_dpd_instruction-instruction_handler + db 'vscatterpf0dps',5 + dw gatherpf_dps_instruction-instruction_handler + db 'vscatterpf0qpd',5 + dw gatherpf_qpd_instruction-instruction_handler + db 'vscatterpf0qps',5 + dw gatherpf_qps_instruction-instruction_handler + db 'vscatterpf1dpd',6 + dw gatherpf_dpd_instruction-instruction_handler + db 'vscatterpf1dps',6 + dw gatherpf_dps_instruction-instruction_handler + db 'vscatterpf1qpd',6 + dw gatherpf_qpd_instruction-instruction_handler + db 'vscatterpf1qps',6 + dw gatherpf_qps_instruction-instruction_handler +instructions_15: + db 'aeskeygenassist',0DFh + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'vbroadcastf32x2',19h + dw avx512_broadcast_32x2_instruction-instruction_handler + db 'vbroadcastf32x4',1Ah + dw avx512_broadcast_32x4_instruction-instruction_handler + db 'vbroadcastf32x8',1Bh + dw avx512_broadcast_32x8_instruction-instruction_handler + db 'vbroadcastf64x2',1Ah + dw avx512_broadcast_64x2_instruction-instruction_handler + db 'vbroadcastf64x4',1Bh + dw avx512_broadcast_64x4_instruction-instruction_handler + db 'vbroadcasti32x2',59h + dw avx512_broadcast_32x2_instruction-instruction_handler + db 'vbroadcasti32x4',5Ah + dw avx512_broadcast_32x4_instruction-instruction_handler + db 'vbroadcasti32x8',5Bh + dw avx512_broadcast_32x8_instruction-instruction_handler + db 'vbroadcasti64x2',5Ah + dw avx512_broadcast_64x2_instruction-instruction_handler + db 'vbroadcasti64x4',5Bh + dw avx512_broadcast_64x4_instruction-instruction_handler + db 'vpbroadcastmb2q',2Ah + dw avx512_pmov_m2_instruction_w1-instruction_handler + db 'vpbroadcastmw2d',3Ah + dw avx512_pmov_m2_instruction-instruction_handler +instructions_16: + db 'gf2p8affineinvqb',0CFh + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'vaeskeygenassist',0DFh + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler +instructions_17: + db 'vgf2p8affineinvqb',0CFh + dw avx_q_instruction_3a_imm8_w1-instruction_handler +instructions_end: + +data_directives: + dw data_directives_2-data_directives,(data_directives_3-data_directives_2)/(2+3) + dw data_directives_3-data_directives,(data_directives_4-data_directives_3)/(3+3) + dw data_directives_4-data_directives,(data_directives_end-data_directives_4)/(4+3) + +data_directives_2: + db 'db',1 + dw data_bytes-instruction_handler + db 'dd',4 + dw data_dwords-instruction_handler + db 'df',6 + dw data_pwords-instruction_handler + db 'dp',6 + dw data_pwords-instruction_handler + db 'dq',8 + dw data_qwords-instruction_handler + db 'dt',10 + dw data_twords-instruction_handler + db 'du',2 + dw data_unicode-instruction_handler + db 'dw',2 + dw data_words-instruction_handler + db 'rb',1 + dw reserve_bytes-instruction_handler + db 'rd',4 + dw reserve_dwords-instruction_handler + db 'rf',6 + dw reserve_pwords-instruction_handler + db 'rp',6 + dw reserve_pwords-instruction_handler + db 'rq',8 + dw reserve_qwords-instruction_handler + db 'rt',10 + dw reserve_twords-instruction_handler + db 'rw',2 + dw reserve_words-instruction_handler +data_directives_3: +data_directives_4: + db 'file',1 + dw data_file-instruction_handler +data_directives_end: diff --git a/programs/develop/koldbg/fasm/variable.inc b/programs/develop/koldbg/fasm/variable.inc new file mode 100644 index 0000000000..12609adb6b --- /dev/null +++ b/programs/develop/koldbg/fasm/variable.inc @@ -0,0 +1,155 @@ + +; flat assembler core variables +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +; Variables which have to be set up by interface: + +memory_start dd ? +memory_end dd ? + +additional_memory dd ? +additional_memory_end dd ? + +stack_limit dd ? + +initial_definitions dd ? +input_file dd ? +output_file dd ? +symbols_file dd ? + +passes_limit dw ? + +; Internal core variables: + +current_pass dw ? + +include_paths dd ? +free_additional_memory dd ? +source_start dd ? +code_start dd ? +code_size dd ? +real_code_size dd ? +written_size dd ? +headers_size dd ? + +current_line dd ? +macro_line dd ? +macro_block dd ? +macro_block_line dd ? +macro_block_line_number dd ? +macro_symbols dd ? +struc_name dd ? +struc_label dd ? +instant_macro_start dd ? +parameters_end dd ? +default_argument_value dd ? +locals_counter rb 8 +current_locals_prefix dd ? +anonymous_reverse dd ? +anonymous_forward dd ? +labels_list dd ? +label_hash dd ? +label_leaf dd ? +hash_tree dd ? +addressing_space dd ? +undefined_data_start dd ? +undefined_data_end dd ? +counter dd ? +counter_limit dd ? +error_info dd ? +error_line dd ? +error dd ? +tagged_blocks dd ? +structures_buffer dd ? +number_start dd ? +current_offset dd ? +value dq ? +fp_value rd 8 +adjustment dq ? +symbol_identifier dd ? +address_symbol dd ? +address_high dd ? +uncompressed_displacement dd ? +format_flags dd ? +resolver_flags dd ? +symbols_stream dd ? +number_of_relocations dd ? +number_of_sections dd ? +stub_size dd ? +stub_file dd ? +current_section dd ? +machine dw ? +subsystem dw ? +subsystem_version dd ? +image_base dd ? +image_base_high dd ? +merge_segment dd ? +resource_data dd ? +resource_size dd ? +actual_fixups_size dd ? +reserved_fixups dd ? +reserved_fixups_size dd ? +last_fixup_base dd ? +last_fixup_header dd ? +parenthesis_stack dd ? +blocks_stack dd ? +parsed_lines dd ? +logical_value_parentheses dd ? +file_extension dd ? + +operand_size db ? +operand_flags db ? +operand_prefix db ? +rex_prefix db ? +opcode_prefix db ? +vex_required db ? +vex_register db ? +immediate_size db ? +mask_register db ? +broadcast_size db ? +rounding_mode db ? + +base_code db ? +extended_code db ? +supplemental_code db ? +postbyte_register db ? +segment_register db ? +xop_opcode_map db ? + +mmx_size db ? +jump_type db ? +push_size db ? +value_size db ? +address_size db ? +label_size db ? +size_declared db ? +address_size_declared db ? +displacement_compression db ? + +value_undefined db ? +value_constant db ? +value_type db ? +value_sign db ? +fp_sign db ? +fp_format db ? +address_sign db ? +address_register db ? +compare_type db ? +logical_value_wrapping db ? +next_pass_needed db ? +output_format db ? +code_type db ? +adjustment_sign db ? +evex_mode db ? + +macro_status db ? +skip_default_argument_value db ? +prefix_flags db ? +formatter_symbols_allowed db ? +decorator_symbols_allowed db ? +free_address_range db ? + +characters rb 100h +converted rb 100h +message rb 180h diff --git a/programs/develop/koldbg/fasm/version.inc b/programs/develop/koldbg/fasm/version.inc new file mode 100644 index 0000000000..67c82dfc9a --- /dev/null +++ b/programs/develop/koldbg/fasm/version.inc @@ -0,0 +1,39 @@ + +; flat assembler version 1.73 +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. +; +; This programs is free for commercial and non-commercial use as long as +; the following conditions are adhered to. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are +; met: +; +; 1. Redistributions of source code must retain the above copyright notice, +; this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; +; The licence and distribution terms for any publically available +; version or derivative of this code cannot be changed. i.e. this code +; cannot simply be copied and put under another distribution licence +; (including the GNU Public Licence). + +VERSION_STRING equ "1.73.21" + +VERSION_MAJOR = 1 +VERSION_MINOR = 73 diff --git a/programs/develop/koldbg/fasm/x86_64.inc b/programs/develop/koldbg/fasm/x86_64.inc new file mode 100644 index 0000000000..194af8eb41 --- /dev/null +++ b/programs/develop/koldbg/fasm/x86_64.inc @@ -0,0 +1,7384 @@ + +; flat assembler core +; Copyright (c) 1999-2019, Tomasz Grysztar. +; All rights reserved. + +simple_instruction_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction: + stos byte [edi] + jmp instruction_assembled +simple_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp simple_instruction +simple_instruction_16bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_16bit: + cmp [code_type],16 + jne size_prefix + stos byte [edi] + jmp instruction_assembled + size_prefix: + mov ah,al + mov al,66h + stos word [edi] + jmp instruction_assembled +simple_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_32bit: + cmp [code_type],16 + je size_prefix + stos byte [edi] + jmp instruction_assembled +iret_instruction: + cmp [code_type],64 + jne simple_instruction +simple_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov ah,al + mov al,48h + stos word [edi] + jmp instruction_assembled +simple_extended_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov byte [edi],48h + inc edi +simple_extended_instruction: + mov ah,al + mov al,0Fh + stos word [edi] + jmp instruction_assembled +simple_extended_instruction_f3: + mov byte [edi],0F3h + inc edi + jmp simple_extended_instruction +prefix_instruction: + stos byte [edi] + or [prefix_flags],1 + jmp continue_line +segment_prefix: + mov ah,al + shr ah,4 + cmp ah,3 + jne illegal_instruction + and al,1111b + mov [segment_register],al + call store_segment_prefix + or [prefix_flags],1 + jmp continue_line +bnd_prefix_instruction: + stos byte [edi] + or [prefix_flags],1 + 10h + jmp continue_line +int_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + test eax,eax + jns int_imm_ok + call recoverable_overflow + int_imm_ok: + mov ah,al + mov al,0CDh + stos word [edi] + jmp instruction_assembled +aa_instruction: + cmp [code_type],64 + je illegal_instruction + push eax + mov bl,10 + cmp byte [esi],'(' + jne aa_store + inc esi + xor al,al + xchg al,[operand_size] + cmp al,1 + ja invalid_operand_size + call get_byte_value + mov bl,al + aa_store: + cmp [operand_size],0 + jne invalid_operand + pop eax + mov ah,bl + stos word [edi] + jmp instruction_assembled + +basic_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg + cmp al,'[' + jne invalid_operand + basic_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je basic_mem_imm + cmp al,10h + jne invalid_operand + basic_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je instruction_ready + call operand_autodetect + inc [base_code] + instruction_ready: + call store_instruction + jmp instruction_assembled + basic_mem_imm: + mov al,[operand_size] + cmp al,1 + jb basic_mem_imm_nosize + je basic_mem_imm_8bit + cmp al,2 + je basic_mem_imm_16bit + cmp al,4 + je basic_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + basic_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_mem_imm_32bit_ok + basic_mem_imm_nosize: + call recoverable_unknown_size + basic_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + mov [base_code],80h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + cmp [value_type],0 + jne basic_mem_imm_16bit_store + cmp [size_declared],0 + jne basic_mem_imm_16bit_store + cmp word [value],80h + jb basic_mem_simm_8bit + cmp word [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_16bit_store: + mov [base_code],81h + call store_instruction_with_imm16 + jmp instruction_assembled + basic_mem_simm_8bit: + mov [base_code],83h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_32bit: + call operand_32bit + call get_dword_value + basic_mem_imm_32bit_ok: + mov dword [value],eax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + cmp [value_type],0 + jne basic_mem_imm_32bit_store + cmp [size_declared],0 + jne basic_mem_imm_32bit_store + cmp dword [value],80h + jb basic_mem_simm_8bit + cmp dword [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_32bit_store: + mov [base_code],81h + call store_instruction_with_imm32 + jmp instruction_assembled + get_simm32: + call get_qword_value + mov ecx,edx + cdq + cmp ecx,edx + jne value_out_of_range + cmp [value_type],4 + jne get_simm32_ok + mov [value_type],2 + get_simm32_ok: + ret + basic_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg_reg + cmp al,'(' + je basic_reg_imm + cmp al,'[' + jne invalid_operand + basic_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je basic_reg_mem_8bit + call operand_autodetect + add [base_code],3 + jmp instruction_ready + basic_reg_mem_8bit: + add [base_code],2 + jmp instruction_ready + basic_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je nomem_instruction_ready + call operand_autodetect + inc [base_code] + nomem_instruction_ready: + call store_nomem_instruction + jmp instruction_assembled + basic_reg_imm: + mov al,[operand_size] + cmp al,1 + je basic_reg_imm_8bit + cmp al,2 + je basic_reg_imm_16bit + cmp al,4 + je basic_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + basic_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_reg_imm_32bit_ok + basic_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + or bl,bl + jz basic_al_imm + mov [base_code],80h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_al_imm: + mov al,[base_code] + add al,4 + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_16bit_store + cmp [size_declared],0 + jne basic_reg_imm_16bit_store + cmp dx,80h + jb basic_reg_simm_8bit + cmp dx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_16bit_store: + or bl,bl + jz basic_ax_imm + mov [base_code],81h + call store_nomem_instruction + basic_store_imm_16bit: + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + basic_reg_simm_8bit: + mov [base_code],83h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_ax_imm: + add [base_code],5 + call store_classic_instruction_code + jmp basic_store_imm_16bit + basic_reg_imm_32bit: + call operand_32bit + call get_dword_value + basic_reg_imm_32bit_ok: + mov edx,eax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_32bit_store + cmp [size_declared],0 + jne basic_reg_imm_32bit_store + cmp edx,80h + jb basic_reg_simm_8bit + cmp edx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_32bit_store: + or bl,bl + jz basic_eax_imm + mov [base_code],81h + call store_nomem_instruction + basic_store_imm_32bit: + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + basic_eax_imm: + add [base_code],5 + call store_classic_instruction_code + jmp basic_store_imm_32bit + recoverable_unknown_size: + cmp [error_line],0 + jne ignore_unknown_size + push [current_line] + pop [error_line] + mov [error],operand_size_not_specified + ignore_unknown_size: + ret +single_operand_instruction: + mov [base_code],0F6h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je single_reg + cmp al,'[' + jne invalid_operand + single_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je single_mem_8bit + jb single_mem_nosize + call operand_autodetect + inc [base_code] + jmp instruction_ready + single_mem_nosize: + call recoverable_unknown_size + single_mem_8bit: + jmp instruction_ready + single_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je single_reg_8bit + call operand_autodetect + inc [base_code] + single_reg_8bit: + jmp nomem_instruction_ready +mov_instruction: + mov [base_code],88h + lods byte [esi] + call get_size_operator + cmp al,10h + je mov_reg + cmp al,14h + je mov_creg + cmp al,'[' + jne invalid_operand + mov_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je mov_mem_imm + cmp al,10h + jne invalid_operand + mov_mem_reg: + lods byte [esi] + cmp al,30h + jb mov_mem_general_reg + cmp al,40h + jb mov_mem_sreg + mov_mem_general_reg: + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + cmp ah,1 + je mov_mem_reg_8bit + inc [base_code] + mov al,ah + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_mem_ax + jmp instruction_ready + mov_mem_reg_8bit: + or al,bl + or al,bh + jnz instruction_ready + mov_mem_al: + test ch,22h + jnz mov_mem_address16_al + test ch,44h + jnz mov_mem_address32_al + test ch,88h + jnz mov_mem_address64_al + or ch,ch + jnz invalid_address_size + call check_mov_address64 + cmp al,0 + jg mov_mem_address64_al + jl instruction_ready + cmp [code_type],16 + jne mov_mem_address32_al + cmp edx,10000h + jb mov_mem_address16_al + mov_mem_address32_al: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A2h + store_mov_address32: + call store_classic_instruction_code + call store_address_32bit_value + jmp instruction_assembled + mov_mem_address16_al: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A2h + store_mov_address16: + cmp [code_type],64 + je invalid_address + call store_classic_instruction_code + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + jmp instruction_assembled + check_mov_address64: + cmp [code_type],64 + jne no_address64 + mov eax,[address_high] + or eax,eax + jz no_address64 + bt edx,31 + adc eax,0 + jz address64_simm32 + address64_required: + mov al,1 + ret + address64_simm32: + mov al,-1 + ret + no_address64: + xor al,al + ret + mov_mem_address64_al: + call store_segment_prefix_if_necessary + mov [base_code],0A2h + store_mov_address64: + call store_classic_instruction_code + call store_address_64bit_value + jmp instruction_assembled + mov_mem_ax: + test ch,22h + jnz mov_mem_address16_ax + test ch,44h + jnz mov_mem_address32_ax + test ch,88h + jnz mov_mem_address64_ax + or ch,ch + jnz invalid_address_size + call check_mov_address64 + cmp al,0 + jg mov_mem_address64_ax + jl instruction_ready + cmp [code_type],16 + jne mov_mem_address32_ax + cmp edx,10000h + jb mov_mem_address16_ax + mov_mem_address32_ax: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A3h + jmp store_mov_address32 + mov_mem_address16_ax: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A3h + jmp store_mov_address16 + mov_mem_address64_ax: + call store_segment_prefix_if_necessary + mov [base_code],0A3h + jmp store_mov_address64 + mov_mem_sreg: + sub al,31h + mov [postbyte_register],al + pop ecx ebx edx + mov ah,[operand_size] + or ah,ah + jz mov_mem_sreg_store + cmp ah,2 + jne invalid_operand_size + mov_mem_sreg_store: + mov [base_code],8Ch + jmp instruction_ready + mov_mem_imm: + mov al,[operand_size] + cmp al,1 + jb mov_mem_imm_nosize + je mov_mem_imm_8bit + cmp al,2 + je mov_mem_imm_16bit + cmp al,4 + je mov_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + mov_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp mov_mem_imm_32bit_store + mov_mem_imm_nosize: + call recoverable_unknown_size + mov_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0C6h + pop ecx ebx edx + call store_instruction_with_imm8 + jmp instruction_assembled + mov_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0C7h + pop ecx ebx edx + call store_instruction_with_imm16 + jmp instruction_assembled + mov_mem_imm_32bit: + call operand_32bit + call get_dword_value + mov_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0C7h + pop ecx ebx edx + call store_instruction_with_imm32 + jmp instruction_assembled + mov_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_sreg + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_reg_mem + cmp al,'(' + je mov_reg_imm + cmp al,14h + je mov_reg_creg + cmp al,10h + jne invalid_operand + mov_reg_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_reg_sreg + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je mov_reg_reg_8bit + call operand_autodetect + inc [base_code] + mov_reg_reg_8bit: + jmp nomem_instruction_ready + mov_reg_sreg: + mov bl,[postbyte_register] + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,3 + jne invalid_operand + dec [postbyte_register] + cmp [operand_size],8 + je mov_reg_sreg64 + cmp [operand_size],4 + je mov_reg_sreg32 + cmp [operand_size],2 + jne invalid_operand_size + call operand_16bit + jmp mov_reg_sreg_store + mov_reg_sreg64: + call operand_64bit + jmp mov_reg_sreg_store + mov_reg_sreg32: + call operand_32bit + mov_reg_sreg_store: + mov [base_code],8Ch + jmp nomem_instruction_ready + mov_reg_creg: + lods byte [esi] + mov bl,al + shr al,4 + cmp al,4 + ja invalid_operand + add al,20h + mov [extended_code],al + and bl,1111b + xchg bl,[postbyte_register] + mov [base_code],0Fh + cmp [code_type],64 + je mov_reg_creg_64bit + cmp [operand_size],4 + jne invalid_operand_size + cmp [postbyte_register],8 + jb mov_reg_creg_store + cmp [extended_code],20h + jne mov_reg_creg_store + mov al,0F0h + stos byte [edi] + mov [postbyte_register],0 + mov_reg_creg_store: + jmp nomem_instruction_ready + mov_reg_creg_64bit: + cmp [operand_size],8 + jne invalid_operand_size + jmp nomem_instruction_ready + mov_reg_mem: + add [base_code],2 + call get_address + mov al,[operand_size] + cmp al,1 + je mov_reg_mem_8bit + inc [base_code] + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_ax_mem + jmp instruction_ready + mov_reg_mem_8bit: + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_al_mem + jmp instruction_ready + mov_al_mem: + test ch,22h + jnz mov_al_mem_address16 + test ch,44h + jnz mov_al_mem_address32 + test ch,88h + jnz mov_al_mem_address64 + or ch,ch + jnz invalid_address_size + call check_mov_address64 + cmp al,0 + jg mov_al_mem_address64 + jl instruction_ready + cmp [code_type],16 + jne mov_al_mem_address32 + cmp edx,10000h + jb mov_al_mem_address16 + mov_al_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A0h + jmp store_mov_address32 + mov_al_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A0h + jmp store_mov_address16 + mov_al_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A0h + jmp store_mov_address64 + mov_ax_mem: + test ch,22h + jnz mov_ax_mem_address16 + test ch,44h + jnz mov_ax_mem_address32 + test ch,88h + jnz mov_ax_mem_address64 + or ch,ch + jnz invalid_address_size + call check_mov_address64 + cmp al,0 + jg mov_ax_mem_address64 + jl instruction_ready + cmp [code_type],16 + jne mov_ax_mem_address32 + cmp edx,10000h + jb mov_ax_mem_address16 + mov_ax_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A1h + jmp store_mov_address32 + mov_ax_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A1h + jmp store_mov_address16 + mov_ax_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A1h + jmp store_mov_address64 + mov_reg_imm: + mov al,[operand_size] + cmp al,1 + je mov_reg_imm_8bit + cmp al,2 + je mov_reg_imm_16bit + cmp al,4 + je mov_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + mov_reg_imm_64bit: + call operand_64bit + call get_qword_value + mov ecx,edx + cmp [size_declared],0 + jne mov_reg_imm_64bit_store + cmp [value_type],4 + jae mov_reg_imm_64bit_store + cdq + cmp ecx,edx + je mov_reg_64bit_imm_32bit + mov_reg_imm_64bit_store: + push eax ecx + mov al,0B8h + call store_mov_reg_imm_code + pop edx eax + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + mov_reg_imm_8bit: + call get_byte_value + mov dl,al + mov al,0B0h + call store_mov_reg_imm_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + mov_reg_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + mov al,0B8h + call store_mov_reg_imm_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + mov_reg_imm_32bit: + call operand_32bit + call get_dword_value + mov edx,eax + mov al,0B8h + call store_mov_reg_imm_code + mov_store_imm_32bit: + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + store_mov_reg_imm_code: + mov ah,[postbyte_register] + test ah,1000b + jz mov_reg_imm_prefix_ok + or [rex_prefix],41h + mov_reg_imm_prefix_ok: + and ah,111b + add al,ah + mov [base_code],al + call store_classic_instruction_code + ret + mov_reg_64bit_imm_32bit: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0C7h + call store_nomem_instruction + jmp mov_store_imm_32bit + mov_sreg: + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,3 + jne invalid_operand + cmp al,2 + je illegal_instruction + dec [postbyte_register] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_sreg_mem + cmp al,10h + jne invalid_operand + mov_sreg_reg: + lods byte [esi] + call convert_register + or ah,ah + jz mov_sreg_reg_size_ok + cmp ah,2 + jne invalid_operand_size + mov bl,al + mov_sreg_reg_size_ok: + mov [base_code],8Eh + jmp nomem_instruction_ready + mov_sreg_mem: + call get_address + mov al,[operand_size] + or al,al + jz mov_sreg_mem_size_ok + cmp al,2 + jne invalid_operand_size + mov_sreg_mem_size_ok: + mov [base_code],8Eh + jmp instruction_ready + mov_creg: + lods byte [esi] + mov ah,al + shr ah,4 + cmp ah,4 + ja invalid_operand + add ah,22h + mov [extended_code],ah + and al,1111b + mov [postbyte_register],al + mov [base_code],0Fh + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov bl,al + cmp [code_type],64 + je mov_creg_64bit + cmp ah,4 + jne invalid_operand_size + cmp [postbyte_register],8 + jb mov_creg_store + cmp [extended_code],22h + jne mov_creg_store + mov al,0F0h + stos byte [edi] + mov [postbyte_register],0 + mov_creg_store: + jmp nomem_instruction_ready + mov_creg_64bit: + cmp ah,8 + je mov_creg_store + jmp invalid_operand_size +test_instruction: + mov [base_code],84h + lods byte [esi] + call get_size_operator + cmp al,10h + je test_reg + cmp al,'[' + jne invalid_operand + test_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je test_mem_imm + cmp al,10h + jne invalid_operand + test_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je test_mem_reg_8bit + call operand_autodetect + inc [base_code] + test_mem_reg_8bit: + jmp instruction_ready + test_mem_imm: + mov al,[operand_size] + cmp al,1 + jb test_mem_imm_nosize + je test_mem_imm_8bit + cmp al,2 + je test_mem_imm_16bit + cmp al,4 + je test_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + test_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_mem_imm_32bit_store + test_mem_imm_nosize: + call recoverable_unknown_size + test_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0F6h + pop ecx ebx edx + call store_instruction_with_imm8 + jmp instruction_assembled + test_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0F7h + pop ecx ebx edx + call store_instruction_with_imm16 + jmp instruction_assembled + test_mem_imm_32bit: + call operand_32bit + call get_dword_value + test_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0F7h + pop ecx ebx edx + call store_instruction_with_imm32 + jmp instruction_assembled + test_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,'(' + je test_reg_imm + cmp al,10h + jne invalid_operand + test_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je test_reg_reg_8bit + call operand_autodetect + inc [base_code] + test_reg_reg_8bit: + jmp nomem_instruction_ready + test_reg_imm: + mov al,[operand_size] + cmp al,1 + je test_reg_imm_8bit + cmp al,2 + je test_reg_imm_16bit + cmp al,4 + je test_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + test_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_reg_imm_32bit_store + test_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F6h + or bl,bl + jz test_al_imm + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_al_imm: + mov [base_code],0A8h + call store_classic_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_ax_imm + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + test_ax_imm: + mov [base_code],0A9h + call store_classic_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + test_reg_imm_32bit: + call operand_32bit + call get_dword_value + test_reg_imm_32bit_store: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_eax_imm + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + test_eax_imm: + mov [base_code],0A9h + call store_classic_instruction_code + mov eax,edx + stos dword [edi] + jmp instruction_assembled + test_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je test_reg_mem_8bit + call operand_autodetect + inc [base_code] + test_reg_mem_8bit: + jmp instruction_ready +xchg_instruction: + mov [base_code],86h + lods byte [esi] + call get_size_operator + cmp al,10h + je xchg_reg + cmp al,'[' + jne invalid_operand + xchg_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je test_mem_reg + jmp invalid_operand + xchg_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,10h + jne invalid_operand + xchg_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je xchg_reg_reg_8bit + call operand_autodetect + cmp [postbyte_register],0 + je xchg_ax_reg + or bl,bl + jnz xchg_reg_reg_store + mov bl,[postbyte_register] + xchg_ax_reg: + cmp [code_type],64 + jne xchg_ax_reg_ok + cmp ah,4 + jne xchg_ax_reg_ok + or bl,bl + jz xchg_reg_reg_store + xchg_ax_reg_ok: + test bl,1000b + jz xchg_ax_reg_store + or [rex_prefix],41h + and bl,111b + xchg_ax_reg_store: + add bl,90h + mov [base_code],bl + call store_classic_instruction_code + jmp instruction_assembled + xchg_reg_reg_store: + inc [base_code] + xchg_reg_reg_8bit: + jmp nomem_instruction_ready +push_instruction: + mov [push_size],al + push_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je push_reg + cmp al,'(' + je push_imm + cmp al,'[' + jne invalid_operand + push_mem: + call get_address + mov al,[operand_size] + mov ah,[push_size] + cmp al,2 + je push_mem_16bit + cmp al,4 + je push_mem_32bit + cmp al,8 + je push_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je push_mem_16bit + cmp ah,4 + je push_mem_32bit + cmp ah,8 + je push_mem_64bit + call recoverable_unknown_size + jmp push_mem_store + push_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_mem_store + push_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_mem_store + push_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_mem_store: + mov [base_code],0FFh + mov [postbyte_register],110b + call store_instruction + jmp push_done + push_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz push_sreg + call convert_register + test al,1000b + jz push_reg_ok + or [rex_prefix],41h + and al,111b + push_reg_ok: + add al,50h + mov [base_code],al + mov al,ah + mov ah,[push_size] + cmp al,2 + je push_reg_16bit + cmp al,4 + je push_reg_32bit + cmp al,8 + jne invalid_operand_size + push_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp push_reg_store + push_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_reg_store + push_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + push_reg_store: + call store_classic_instruction_code + jmp push_done + push_sreg: + mov bl,al + mov dl,[operand_size] + mov dh,[push_size] + cmp dl,2 + je push_sreg16 + cmp dl,4 + je push_sreg32 + cmp dl,8 + je push_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je push_sreg16 + cmp dh,4 + je push_sreg32 + cmp dh,8 + je push_sreg64 + jmp push_sreg_store + push_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_sreg_store + push_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_sreg_store + push_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_sreg_store: + mov al,bl + cmp al,40h + jae invalid_operand + sub al,31h + jc invalid_operand + cmp al,4 + jae push_sreg_386 + shl al,3 + add al,6 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp push_reg_store + push_sreg_386: + sub al,4 + shl al,3 + add al,0A0h + mov [extended_code],al + mov [base_code],0Fh + jmp push_reg_store + push_imm: + mov al,[operand_size] + mov ah,[push_size] + or al,al + je push_imm_size_ok + or ah,ah + je push_imm_size_ok + cmp al,ah + jne invalid_operand_size + push_imm_size_ok: + cmp al,2 + je push_imm_16bit + cmp al,4 + je push_imm_32bit + cmp al,8 + je push_imm_64bit + cmp ah,2 + je push_imm_optimized_16bit + cmp ah,4 + je push_imm_optimized_32bit + cmp ah,8 + je push_imm_optimized_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je push_imm_optimized_16bit + cmp [code_type],32 + je push_imm_optimized_32bit + push_imm_optimized_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_16bit: + call get_word_value + mov dx,ax + call operand_16bit + cmp [value_type],0 + jne push_imm_16bit_store + cmp ax,-80h + jl push_imm_16bit_store + cmp ax,80h + jge push_imm_16bit_store + push_imm_8bit: + mov ah,al + mov [base_code],6Ah + call store_classic_instruction_code + mov al,ah + stos byte [edi] + jmp push_done + push_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + push_imm_16bit_store: + mov [base_code],68h + call store_classic_instruction_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp push_done + push_imm_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + jmp push_imm_32bit_store + push_imm_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + push_imm_32bit_store: + mov [base_code],68h + call store_classic_instruction_code + mov eax,edx + call mark_relocation + stos dword [edi] + push_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled +; mov [operand_size],0 +; mov [operand_flags],0 +; mov [operand_prefix],0 +; mov [rex_prefix],0 + and dword [operand_size],0 + jmp push_next +pop_instruction: + mov [push_size],al + pop_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je pop_reg + cmp al,'[' + jne invalid_operand + pop_mem: + call get_address + mov al,[operand_size] + mov ah,[push_size] + cmp al,2 + je pop_mem_16bit + cmp al,4 + je pop_mem_32bit + cmp al,8 + je pop_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je pop_mem_16bit + cmp ah,4 + je pop_mem_32bit + cmp ah,8 + je pop_mem_64bit + call recoverable_unknown_size + jmp pop_mem_store + pop_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_mem_store + pop_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_mem_store + pop_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_mem_store: + mov [base_code],08Fh + mov [postbyte_register],0 + call store_instruction + jmp pop_done + pop_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz pop_sreg + call convert_register + test al,1000b + jz pop_reg_ok + or [rex_prefix],41h + and al,111b + pop_reg_ok: + add al,58h + mov [base_code],al + mov al,ah + mov ah,[push_size] + cmp al,2 + je pop_reg_16bit + cmp al,4 + je pop_reg_32bit + cmp al,8 + je pop_reg_64bit + jmp invalid_operand_size + pop_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp pop_reg_store + pop_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_reg_store + pop_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + pop_reg_store: + call store_classic_instruction_code + pop_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled +; mov [operand_size],0 +; mov [operand_flags],0 +; mov [operand_prefix],0 +; mov [rex_prefix],0 + and dword [operand_size],0 + jmp pop_next + pop_sreg: + mov dl,[operand_size] + mov dh,[push_size] + cmp al,32h + je pop_cs + mov bl,al + cmp dl,2 + je pop_sreg16 + cmp dl,4 + je pop_sreg32 + cmp dl,8 + je pop_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_sreg16 + cmp dh,4 + je pop_sreg32 + cmp dh,8 + je pop_sreg64 + jmp pop_sreg_store + pop_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_sreg_store + pop_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_sreg_store + pop_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_sreg_store: + mov al,bl + cmp al,40h + jae invalid_operand + sub al,31h + jc invalid_operand + cmp al,4 + jae pop_sreg_386 + shl al,3 + add al,7 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp pop_reg_store + pop_cs: + cmp [code_type],16 + jne illegal_instruction + cmp dl,2 + je pop_cs_store + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_cs_store + or dh,dh + jnz illegal_instruction + pop_cs_store: + test dh,not 2 + jnz invalid_operand_size + mov al,0Fh + stos byte [edi] + jmp pop_done + pop_sreg_386: + sub al,4 + shl al,3 + add al,0A1h + mov [extended_code],al + mov [base_code],0Fh + jmp pop_reg_store +inc_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je inc_reg + cmp al,'[' + je inc_mem + jne invalid_operand + inc_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je inc_mem_8bit + jb inc_mem_nosize + call operand_autodetect + mov al,0FFh + xchg al,[base_code] + mov [postbyte_register],al + jmp instruction_ready + inc_mem_nosize: + call recoverable_unknown_size + inc_mem_8bit: + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + jmp instruction_ready + inc_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je inc_reg_8bit + call operand_autodetect + cmp [code_type],64 + je inc_reg_long_form + mov al,[postbyte_register] + shl al,3 + add al,bl + add al,40h + mov [base_code],al + call store_classic_instruction_code + jmp instruction_assembled + inc_reg_long_form: + inc [base_code] + inc_reg_8bit: + jmp nomem_instruction_ready +set_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je set_reg + cmp al,'[' + jne invalid_operand + set_mem: + call get_address + cmp [operand_size],1 + ja invalid_operand_size + mov [postbyte_register],0 + jmp instruction_ready + set_reg: + lods byte [esi] + call convert_register + cmp ah,1 + jne invalid_operand_size + mov bl,al + mov [postbyte_register],0 + jmp nomem_instruction_ready +arpl_instruction: + cmp [code_type],64 + je illegal_instruction + mov [base_code],63h + lods byte [esi] + call get_size_operator + cmp al,10h + je arpl_reg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + cmp ah,2 + jne invalid_operand_size + jmp instruction_ready + arpl_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + jmp nomem_instruction_ready +bound_instruction: + cmp [code_type],64 + je illegal_instruction + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je bound_store + cmp al,4 + jne invalid_operand_size + bound_store: + call operand_autodetect + mov [base_code],62h + jmp instruction_ready +enter_instruction: + lods byte [esi] + call get_size_operator + cmp ah,2 + je enter_imm16_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm16_size_ok: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne enter_imm16_ok + cmp [value_type],0 + jne invalid_use_of_symbol + test eax,eax + js value_out_of_range + enter_imm16_ok: + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp ah,1 + je enter_imm8_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm8_size_ok: + cmp al,'(' + jne invalid_operand + call get_byte_value + cmp [next_pass_needed],0 + jne enter_imm8_ok + test eax,eax + js value_out_of_range + enter_imm8_ok: + mov dl,al + pop ebx + mov al,0C8h + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +ret_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp ret_instruction +ret_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +ret_instruction_32bit: + call operand_32bit + jmp ret_instruction +ret_instruction_16bit: + call operand_16bit + jmp ret_instruction +ret_instruction_64bit: + call operand_64bit +ret_instruction: + and [prefix_flags],not 10h + ret_common: + mov [base_code],al + lods byte [esi] + dec esi + or al,al + jz simple_ret + cmp al,0Fh + je simple_ret + lods byte [esi] + call get_size_operator + or ah,ah + jz ret_imm + cmp ah,2 + je ret_imm + jmp invalid_operand_size + ret_imm: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne ret_imm_ok + cmp [value_type],0 + jne invalid_use_of_symbol + test eax,eax + js value_out_of_range + ret_imm_ok: + cmp [size_declared],0 + jne ret_imm_store + or ax,ax + jz simple_ret + ret_imm_store: + mov dx,ax + call store_classic_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + simple_ret: + inc [base_code] + call store_classic_instruction_code + jmp instruction_assembled +retf_instruction: + cmp [code_type],64 + jne ret_common +retf_instruction_64bit: + call operand_64bit + jmp ret_common +retf_instruction_32bit: + call operand_32bit + jmp ret_common +retf_instruction_16bit: + call operand_16bit + jmp ret_common +lea_instruction: + mov [base_code],8Dh + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + or [operand_flags],1 + call get_address + pop eax + mov [operand_size],al + call operand_autodetect + jmp instruction_ready +ls_instruction: + or al,al + jz les_instruction + cmp al,3 + jz lds_instruction + add al,0B0h + mov [extended_code],al + mov [base_code],0Fh + jmp ls_code_ok + les_instruction: + mov [base_code],0C4h + jmp ls_short_code + lds_instruction: + mov [base_code],0C5h + ls_short_code: + cmp [code_type],64 + je illegal_instruction + ls_code_ok: + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + add [operand_size],2 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je ls_16bit + cmp al,6 + je ls_32bit + cmp al,10 + je ls_64bit + jmp invalid_operand_size + ls_16bit: + call operand_16bit + jmp instruction_ready + ls_32bit: + call operand_32bit + jmp instruction_ready + ls_64bit: + call operand_64bit + jmp instruction_ready +sh_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je sh_reg + cmp al,'[' + jne invalid_operand + sh_mem: + call get_address + push edx ebx ecx + mov al,[operand_size] + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_mem_imm + cmp al,10h + jne invalid_operand + sh_mem_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax ecx ebx edx + cmp al,1 + je sh_mem_cl_8bit + jb sh_mem_cl_nosize + call operand_autodetect + mov [base_code],0D3h + jmp instruction_ready + sh_mem_cl_nosize: + call recoverable_unknown_size + sh_mem_cl_8bit: + mov [base_code],0D2h + jmp instruction_ready + sh_mem_imm: + mov al,[operand_size] + or al,al + jz sh_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax ecx ebx edx + cmp al,1 + je sh_mem_imm_8bit + jb sh_mem_imm_nosize + call operand_autodetect + cmp byte [value],1 + je sh_mem_1 + mov [base_code],0C1h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1: + mov [base_code],0D1h + jmp instruction_ready + sh_mem_imm_nosize: + call recoverable_unknown_size + sh_mem_imm_8bit: + cmp byte [value],1 + je sh_mem_1_8bit + mov [base_code],0C0h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1_8bit: + mov [base_code],0D0h + jmp instruction_ready + sh_reg: + lods byte [esi] + call convert_register + mov bx,ax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_reg_imm + cmp al,10h + jne invalid_operand + sh_reg_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + mov al,bh + cmp al,1 + je sh_reg_cl_8bit + call operand_autodetect + mov [base_code],0D3h + jmp nomem_instruction_ready + sh_reg_cl_8bit: + mov [base_code],0D2h + jmp nomem_instruction_ready + sh_reg_imm: + mov al,[operand_size] + or al,al + jz sh_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_reg_imm_size_ok: + push ebx + call get_byte_value + mov dl,al + pop ebx + mov al,bh + cmp al,1 + je sh_reg_imm_8bit + call operand_autodetect + cmp dl,1 + je sh_reg_1 + mov [base_code],0C1h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1: + mov [base_code],0D1h + jmp nomem_instruction_ready + sh_reg_imm_8bit: + cmp dl,1 + je sh_reg_1_8bit + mov [base_code],0C0h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1_8bit: + mov [base_code],0D0h + jmp nomem_instruction_ready +shd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je shd_reg + cmp al,'[' + jne invalid_operand + shd_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + mov [operand_size],0 + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_mem_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax ecx ebx edx + call operand_autodetect + inc [extended_code] + jmp instruction_ready + shd_mem_reg_imm: + mov al,[operand_size] + or al,al + jz shd_mem_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_mem_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax ecx ebx edx + call operand_autodetect + call store_instruction_with_imm8 + jmp instruction_assembled + shd_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_reg_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop ebx eax + call operand_autodetect + inc [extended_code] + jmp nomem_instruction_ready + shd_reg_reg_imm: + mov al,[operand_size] + or al,al + jz shd_reg_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_reg_reg_imm_size_ok: + call get_byte_value + mov dl,al + pop ebx eax + call operand_autodetect + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +movx_instruction: + mov [base_code],0Fh + mov [extended_code],al + call take_register + mov [postbyte_register],al + mov al,ah + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movx_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov ah,[operand_size] + or ah,ah + jz movx_unknown_size + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_mem_store + cmp ah,2 + jne invalid_operand_size + inc [extended_code] + movx_mem_store: + call operand_autodetect + jmp instruction_ready + movx_unknown_size: + cmp al,2 + je movx_mem_store + call recoverable_unknown_size + jmp movx_mem_store + movx_reg: + lods byte [esi] + call convert_register + pop ebx + xchg bl,al + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_reg_8bit + cmp ah,2 + je movx_reg_16bit + jmp invalid_operand_size + movx_reg_8bit: + call operand_autodetect + jmp nomem_instruction_ready + movx_reg_16bit: + call operand_autodetect + inc [extended_code] + jmp nomem_instruction_ready +movsxd_instruction: + mov [base_code],al + call take_register + mov [postbyte_register],al + cmp ah,8 + jne invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movsxd_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je movsxd_mem_store + cmp [operand_size],0 + jne invalid_operand_size + movsxd_mem_store: + call operand_64bit + jmp instruction_ready + movsxd_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + call operand_64bit + jmp nomem_instruction_ready +bt_instruction: + mov [postbyte_register],al + shl al,3 + add al,83h + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je bt_reg + cmp al,'[' + jne invalid_operand + call get_address + push eax ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_mem_imm + cmp byte [esi],11h + jne bt_mem_reg + cmp byte [esi+2],'(' + je bt_mem_imm + bt_mem_reg: + call take_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + call operand_autodetect + jmp instruction_ready + bt_mem_imm: + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax + or al,al + jz bt_mem_imm_nosize + call operand_autodetect + bt_mem_imm_store: + pop ecx ebx edx + mov [extended_code],0BAh + call store_instruction_with_imm8 + jmp instruction_assembled + bt_mem_imm_nosize: + call recoverable_unknown_size + jmp bt_mem_imm_store + bt_reg: + lods byte [esi] + call convert_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_reg_imm + cmp byte [esi],11h + jne bt_reg_reg + cmp byte [esi+2],'(' + je bt_reg_imm + bt_reg_reg: + call take_register + mov [postbyte_register],al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + bt_reg_imm: + xor al,al + xchg al,[operand_size] + push eax ebx + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop ebx eax + call operand_autodetect + bt_reg_imm_store: + mov [extended_code],0BAh + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +bs_instruction: + mov [extended_code],al + mov [base_code],0Fh + call get_reg_mem + jc bs_reg_reg + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + bs_reg_reg: + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + get_reg_mem: + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je get_reg_reg + cmp al,'[' + jne invalid_argument + call get_address + clc + ret + get_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + stc + ret +ud_instruction: + mov [extended_code],al + mov [base_code],0Fh + call get_reg_mem + jc ud_reg_reg + cmp [operand_size],4 + jne invalid_operand_size + jmp instruction_ready + ud_reg_reg: + cmp ah,4 + jne invalid_operand_size + jmp nomem_instruction_ready + +imul_instruction: + mov [base_code],0F6h + mov [postbyte_register],5 + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg + cmp al,'[' + jne invalid_operand + imul_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je imul_mem_8bit + jb imul_mem_nosize + call operand_autodetect + inc [base_code] + jmp instruction_ready + imul_mem_nosize: + call recoverable_unknown_size + imul_mem_8bit: + jmp instruction_ready + imul_reg: + lods byte [esi] + call convert_register + cmp byte [esi],',' + je imul_reg_ + mov bl,al + mov al,ah + cmp al,1 + je imul_reg_8bit + call operand_autodetect + inc [base_code] + imul_reg_8bit: + jmp nomem_instruction_ready + imul_reg_: + mov [postbyte_register],al + inc esi + cmp byte [esi],'(' + je imul_reg_imm + cmp byte [esi],11h + jne imul_reg_noimm + cmp byte [esi+2],'(' + je imul_reg_imm + imul_reg_noimm: + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg_reg + cmp al,'[' + jne invalid_operand + imul_reg_mem: + call get_address + push edx ebx ecx + cmp byte [esi],',' + je imul_reg_mem_imm + mov al,[operand_size] + call operand_autodetect + pop ecx ebx edx + mov [base_code],0Fh + mov [extended_code],0AFh + jmp instruction_ready + imul_reg_mem_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_mem_imm_16bit + cmp al,4 + je imul_reg_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + imul_reg_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_mem_imm_32bit_ok + imul_reg_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + cmp [value_type],0 + jne imul_reg_mem_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_16bit_store + cmp ax,-80h + jl imul_reg_mem_imm_16bit_store + cmp ax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_16bit_store: + pop ecx ebx edx + mov [base_code],69h + call store_instruction_with_imm16 + jmp instruction_assembled + imul_reg_mem_imm_32bit: + call operand_32bit + call get_dword_value + imul_reg_mem_imm_32bit_ok: + mov dword [value],eax + cmp [value_type],0 + jne imul_reg_mem_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_32bit_store + cmp eax,-80h + jl imul_reg_mem_imm_32bit_store + cmp eax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_32bit_store: + pop ecx ebx edx + mov [base_code],69h + call store_instruction_with_imm32 + jmp instruction_assembled + imul_reg_mem_imm_8bit_store: + pop ecx ebx edx + mov [base_code],6Bh + call store_instruction_with_imm8 + jmp instruction_assembled + imul_reg_imm: + mov bl,[postbyte_register] + dec esi + jmp imul_reg_reg_imm + imul_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp byte [esi],',' + je imul_reg_reg_imm + mov al,ah + call operand_autodetect + mov [base_code],0Fh + mov [extended_code],0AFh + jmp nomem_instruction_ready + imul_reg_reg_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_reg_imm_16bit + cmp al,4 + je imul_reg_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + imul_reg_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + push ebx + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_reg_imm_32bit_ok + imul_reg_reg_imm_16bit: + call operand_16bit + push ebx + call get_word_value + pop ebx + mov dx,ax + cmp [value_type],0 + jne imul_reg_reg_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_16bit_store + cmp ax,-80h + jl imul_reg_reg_imm_16bit_store + cmp ax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_16bit_store: + mov [base_code],69h + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + imul_reg_reg_imm_32bit: + call operand_32bit + push ebx + call get_dword_value + imul_reg_reg_imm_32bit_ok: + pop ebx + mov edx,eax + cmp [value_type],0 + jne imul_reg_reg_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_32bit_store + cmp eax,-80h + jl imul_reg_reg_imm_32bit_store + cmp eax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_32bit_store: + mov [base_code],69h + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + imul_reg_reg_imm_8bit_store: + mov [base_code],6Bh + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +in_instruction: + call take_register + or al,al + jnz invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + push eax + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je in_imm + cmp al,10h + je in_reg + jmp invalid_operand + in_reg: + lods byte [esi] + cmp al,22h + jne invalid_operand + pop eax + cmp al,1 + je in_al_dx + cmp al,2 + je in_ax_dx + cmp al,4 + jne invalid_operand_size + in_ax_dx: + call operand_autodetect + mov [base_code],0EDh + call store_classic_instruction_code + jmp instruction_assembled + in_al_dx: + mov al,0ECh + stos byte [edi] + jmp instruction_assembled + in_imm: + mov al,[operand_size] + or al,al + jz in_imm_size_ok + cmp al,1 + jne invalid_operand_size + in_imm_size_ok: + call get_byte_value + mov dl,al + pop eax + cmp al,1 + je in_al_imm + cmp al,2 + je in_ax_imm + cmp al,4 + jne invalid_operand_size + in_ax_imm: + call operand_autodetect + mov [base_code],0E5h + call store_classic_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + in_al_imm: + mov al,0E4h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +out_instruction: + lods byte [esi] + call get_size_operator + cmp al,'(' + je out_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + call take_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_dx_al + cmp al,2 + je out_dx_ax + cmp al,4 + jne invalid_operand_size + out_dx_ax: + call operand_autodetect + mov [base_code],0EFh + call store_classic_instruction_code + jmp instruction_assembled + out_dx_al: + mov al,0EEh + stos byte [edi] + jmp instruction_assembled + out_imm: + mov al,[operand_size] + or al,al + jz out_imm_size_ok + cmp al,1 + jne invalid_operand_size + out_imm_size_ok: + call get_byte_value + mov dl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + call take_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_imm_al + cmp al,2 + je out_imm_ax + cmp al,4 + jne invalid_operand_size + out_imm_ax: + call operand_autodetect + mov [base_code],0E7h + call store_classic_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + out_imm_al: + mov al,0E6h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + +call_instruction: + mov [postbyte_register],10b + mov [base_code],0E8h + mov [extended_code],9Ah + jmp process_jmp +jmp_instruction: + mov [postbyte_register],100b + mov [base_code],0E9h + mov [extended_code],0EAh + process_jmp: + lods byte [esi] + call get_jump_operator + test [prefix_flags],10h + jz jmp_type_ok + test [jump_type],not 2 + jnz illegal_instruction + mov [jump_type],2 + and [prefix_flags],not 10h + jmp_type_ok: + call get_size_operator + cmp al,'(' + je jmp_imm + mov [base_code],0FFh + cmp al,10h + je jmp_reg + cmp al,'[' + jne invalid_operand + jmp_mem: + cmp [jump_type],1 + je illegal_instruction + call get_address + mov edx,eax + mov al,[operand_size] + or al,al + jz jmp_mem_size_not_specified + cmp al,2 + je jmp_mem_16bit + cmp al,4 + je jmp_mem_32bit + cmp al,6 + je jmp_mem_48bit + cmp al,8 + je jmp_mem_64bit + cmp al,10 + je jmp_mem_80bit + jmp invalid_operand_size + jmp_mem_size_not_specified: + cmp [jump_type],3 + je jmp_mem_far + cmp [jump_type],2 + je jmp_mem_near + call recoverable_unknown_size + jmp_mem_near: + cmp [code_type],16 + je jmp_mem_16bit + cmp [code_type],32 + je jmp_mem_near_32bit + jmp_mem_64bit: + cmp [jump_type],3 + je invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp instruction_ready + jmp_mem_far: + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_48bit: + call operand_32bit + jmp_mem_far_store: + cmp [jump_type],2 + je invalid_operand_size + inc [postbyte_register] + jmp instruction_ready + jmp_mem_80bit: + call operand_64bit + jmp jmp_mem_far_store + jmp_mem_far_32bit: + call operand_16bit + jmp jmp_mem_far_store + jmp_mem_32bit: + cmp [jump_type],3 + je jmp_mem_far_32bit + cmp [jump_type],2 + je jmp_mem_near_32bit + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_near_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp instruction_ready + jmp_mem_16bit: + cmp [jump_type],3 + je invalid_operand_size + call operand_16bit + jmp instruction_ready + jmp_reg: + test [jump_type],1 + jnz invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,2 + je jmp_reg_16bit + cmp al,4 + je jmp_reg_32bit + cmp al,8 + jne invalid_operand_size + jmp_reg_64bit: + cmp [code_type],64 + jne illegal_instruction + jmp nomem_instruction_ready + jmp_reg_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp nomem_instruction_ready + jmp_reg_16bit: + call operand_16bit + jmp nomem_instruction_ready + jmp_imm: + cmp byte [esi],'.' + je invalid_value + mov ebx,esi + dec esi + call skip_symbol + xchg esi,ebx + cmp byte [ebx],':' + je jmp_far + cmp [jump_type],3 + je invalid_operand + jmp_near: + mov al,[operand_size] + cmp al,2 + je jmp_imm_16bit + cmp al,4 + je jmp_imm_32bit + cmp al,8 + je jmp_imm_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je jmp_imm_16bit + cmp [code_type],64 + je jmp_imm_64bit + jmp_imm_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne jmp_imm_32bit_prefix_ok + mov byte [edi],66h + inc edi + jmp_imm_32bit_prefix_ok: + call calculate_jump_offset + cdq + call check_for_short_jump + jc jmp_short + jmp_imm_32bit_store: + mov edx,eax + sub edx,3 + jno jmp_imm_32bit_ok + cmp [code_type],64 + je jump_out_of_range + jmp_imm_32bit_ok: + mov al,[base_code] + stos byte [edi] + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + jmp_imm_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne jump_out_of_range + call check_for_short_jump + jnc jmp_imm_32bit_store + jmp_short: + mov ah,al + mov al,0EBh + stos word [edi] + jmp instruction_assembled + jmp_imm_16bit: + call get_address_word_value + cmp [code_type],16 + je jmp_imm_16bit_prefix_ok + mov byte [edi],66h + inc edi + jmp_imm_16bit_prefix_ok: + call calculate_jump_offset + cwde + cdq + call check_for_short_jump + jc jmp_short + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + dec edx + mov al,[base_code] + stos byte [edi] + mov eax,edx + stos word [edi] + jmp instruction_assembled + calculate_jump_offset: + add edi,2 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,2 + ret + check_for_short_jump: + cmp [jump_type],1 + je forced_short + ja no_short_jump + cmp [base_code],0E8h + je no_short_jump + cmp [value_type],0 + jne no_short_jump + cmp eax,80h + jb short_jump + cmp eax,-80h + jae short_jump + no_short_jump: + clc + ret + forced_short: + cmp [base_code],0E8h + je illegal_instruction + cmp [next_pass_needed],0 + jne jmp_short_value_type_ok + cmp [value_type],0 + jne invalid_use_of_symbol + jmp_short_value_type_ok: + cmp eax,-80h + jae short_jump + cmp eax,80h + jae jump_out_of_range + short_jump: + stc + ret + jump_out_of_range: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],relative_jump_out_of_range + jmp instruction_assembled + jmp_far: + cmp [jump_type],2 + je invalid_operand + cmp [code_type],64 + je illegal_instruction + mov al,[extended_code] + mov [base_code],al + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax [symbol_identifier] + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,4 + je jmp_far_16bit + cmp al,6 + je jmp_far_32bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + jne jmp_far_32bit + jmp_far_16bit: + call get_word_value + mov ebx,eax + call operand_16bit + call store_classic_instruction_code + mov ax,bx + call mark_relocation + stos word [edi] + jmp_far_segment: + pop [symbol_identifier] eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + jmp instruction_assembled + jmp_far_32bit: + call get_dword_value + mov ebx,eax + call operand_32bit + call store_classic_instruction_code + mov eax,ebx + call mark_relocation + stos dword [edi] + jmp jmp_far_segment +conditional_jump: + mov [base_code],al + and [prefix_flags],not 10h + lods byte [esi] + call get_jump_operator + cmp [jump_type],3 + je invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,2 + je conditional_jump_16bit + cmp al,4 + je conditional_jump_32bit + cmp al,8 + je conditional_jump_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je conditional_jump_16bit + cmp [code_type],64 + je conditional_jump_64bit + conditional_jump_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne conditional_jump_32bit_prefix_ok + mov byte [edi],66h + inc edi + conditional_jump_32bit_prefix_ok: + call calculate_jump_offset + cdq + call check_for_short_jump + jc conditional_jump_short + conditional_jump_32bit_store: + mov edx,eax + sub edx,4 + jno conditional_jump_32bit_range_ok + cmp [code_type],64 + je jump_out_of_range + conditional_jump_32bit_range_ok: + mov ah,[base_code] + add ah,10h + mov al,0Fh + stos word [edi] + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + conditional_jump_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne jump_out_of_range + call check_for_short_jump + jnc conditional_jump_32bit_store + conditional_jump_short: + mov ah,al + mov al,[base_code] + stos word [edi] + jmp instruction_assembled + conditional_jump_16bit: + call get_address_word_value + cmp [code_type],16 + je conditional_jump_16bit_prefix_ok + mov byte [edi],66h + inc edi + conditional_jump_16bit_prefix_ok: + call calculate_jump_offset + cwde + cdq + call check_for_short_jump + jc conditional_jump_short + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + sub dx,2 + mov ah,[base_code] + add ah,10h + mov al,0Fh + stos word [edi] + mov eax,edx + stos word [edi] + jmp instruction_assembled +loop_instruction_16bit: + cmp [code_type],64 + je illegal_instruction + cmp [code_type],16 + je loop_instruction + mov [operand_prefix],67h + jmp loop_instruction +loop_instruction_32bit: + cmp [code_type],32 + je loop_instruction + mov [operand_prefix],67h + jmp loop_instruction +loop_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction +loop_instruction: + mov [base_code],al + lods byte [esi] + call get_jump_operator + cmp [jump_type],1 + ja invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,2 + je loop_jump_16bit + cmp al,4 + je loop_jump_32bit + cmp al,8 + je loop_jump_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je loop_jump_16bit + cmp [code_type],64 + je loop_jump_64bit + loop_jump_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne loop_jump_32bit_prefix_ok + mov byte [edi],66h + inc edi + loop_jump_32bit_prefix_ok: + call loop_counter_size + call calculate_jump_offset + cdq + make_loop_jump: + call check_for_short_jump + jc conditional_jump_short + scas word [edi] + jmp jump_out_of_range + loop_counter_size: + cmp [operand_prefix],0 + je loop_counter_size_ok + push eax + mov al,[operand_prefix] + stos byte [edi] + pop eax + loop_counter_size_ok: + ret + loop_jump_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call loop_counter_size + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne jump_out_of_range + jmp make_loop_jump + loop_jump_16bit: + call get_address_word_value + cmp [code_type],16 + je loop_jump_16bit_prefix_ok + mov byte [edi],66h + inc edi + loop_jump_16bit_prefix_ok: + call loop_counter_size + call calculate_jump_offset + cwde + cdq + jmp make_loop_jump + +movs_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp [segment_register],1 + ja invalid_address + push ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop edx + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,6 + jne invalid_address + cmp dh,7 + jne invalid_address + cmp al,2 + je movs_address_16bit + cmp al,4 + je movs_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp movs_store + movs_address_32bit: + call address_32bit_prefix + jmp movs_store + movs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + movs_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0A4h + movs_check_size: + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + cmp bl,8 + je simple_instruction_64bit + or bl,bl + jnz invalid_operand_size + call recoverable_unknown_size + jmp simple_instruction +lods_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je lods_address_16bit + cmp bh,46h + je lods_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp lods_store + lods_address_32bit: + call address_32bit_prefix + jmp lods_store + lods_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + lods_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0ACh + jmp movs_check_size +stos_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je stos_address_16bit + cmp bh,47h + je stos_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp stos_store + stos_address_32bit: + call address_32bit_prefix + jmp stos_store + stos_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + stos_store: + cmp [segment_register],1 + ja invalid_address + mov al,[base_code] + jmp movs_check_size +cmps_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,[segment_register] + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + pop edx eax + cmp [segment_register],1 + ja invalid_address + mov [segment_register],al + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,7 + jne invalid_address + cmp dh,6 + jne invalid_address + cmp al,2 + je cmps_address_16bit + cmp al,4 + je cmps_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp cmps_store + cmps_address_32bit: + call address_32bit_prefix + jmp cmps_store + cmps_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + cmps_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0A6h + jmp movs_check_size +ins_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je ins_address_16bit + cmp bh,47h + je ins_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp ins_store + ins_address_32bit: + call address_32bit_prefix + jmp ins_store + ins_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + ins_store: + cmp [segment_register],1 + ja invalid_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + mov al,6Ch + ins_check_size: + cmp [operand_size],8 + jne movs_check_size + jmp invalid_operand_size +outs_instruction: + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je outs_address_16bit + cmp bh,46h + je outs_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp outs_store + outs_address_32bit: + call address_32bit_prefix + jmp outs_store + outs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + outs_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,6Eh + jmp ins_check_size +xlat_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,23h + je xlat_address_16bit + cmp bh,43h + je xlat_address_32bit + cmp bh,83h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp xlat_store + xlat_address_32bit: + call address_32bit_prefix + jmp xlat_store + xlat_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + xlat_store: + call store_segment_prefix_if_necessary + mov al,0D7h + cmp [operand_size],1 + jbe simple_instruction + jmp invalid_operand_size + +pm_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je pm_reg + pm_mem: + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je pm_mem_store + or al,al + jnz invalid_operand_size + pm_mem_store: + jmp instruction_ready + pm_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp ah,2 + jne invalid_operand_size + jmp nomem_instruction_ready +pm_store_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne pm_mem + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +lgdt_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,6 + je lgdt_mem_48bit + cmp al,10 + je lgdt_mem_80bit + or al,al + jnz invalid_operand_size + jmp lgdt_mem_store + lgdt_mem_80bit: + cmp [code_type],64 + jne illegal_instruction + jmp lgdt_mem_store + lgdt_mem_48bit: + cmp [code_type],64 + je illegal_instruction + cmp [postbyte_register],2 + jb lgdt_mem_store + call operand_32bit + lgdt_mem_store: + jmp instruction_ready +lar_instruction: + mov [extended_code],al + mov [base_code],0Fh + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + call operand_autodetect + lods byte [esi] + call get_size_operator + cmp al,10h + je lar_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz lar_reg_mem + cmp al,2 + jne invalid_operand_size + lar_reg_mem: + jmp instruction_ready + lar_reg_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +invlpg_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready +mcommit_instruction: + mov byte [edi],0F3h + inc edi + jmp simple_instruction_0f_01 +swapgs_instruction: + cmp [code_type],64 + jne illegal_instruction +simple_instruction_0f_01: + mov ah,al + mov al,0Fh + stos byte [edi] + mov al,1 + stos word [edi] + jmp instruction_assembled + +basic_486_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_486_reg + cmp al,'[' + jne invalid_operand + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je basic_486_mem_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_mem_reg_8bit: + jmp instruction_ready + basic_486_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov bl,al + xchg bl,[postbyte_register] + mov al,ah + cmp al,1 + je basic_486_reg_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_reg_reg_8bit: + jmp nomem_instruction_ready +bswap_instruction: + call take_register + test al,1000b + jz bswap_reg_code_ok + or [rex_prefix],41h + and al,111b + bswap_reg_code_ok: + add al,0C8h + mov [extended_code],al + mov [base_code],0Fh + cmp ah,8 + je bswap_reg64 + cmp ah,4 + jne invalid_operand_size + call operand_32bit + call store_classic_instruction_code + jmp instruction_assembled + bswap_reg64: + call operand_64bit + call store_classic_instruction_code + jmp instruction_assembled +cmpxchgx_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,1 + xchg [postbyte_register],ah + mov al,[operand_size] + or al,al + jz cmpxchgx_size_ok + cmp al,ah + jne invalid_operand_size + cmpxchgx_size_ok: + cmp ah,16 + jne cmpxchgx_store + call operand_64bit + cmpxchgx_store: + jmp instruction_ready +nop_instruction: + mov ah,[esi] + cmp ah,10h + je extended_nop + cmp ah,11h + je extended_nop + cmp ah,'[' + je extended_nop + stos byte [edi] + jmp instruction_assembled + extended_nop: + mov [base_code],0Fh + mov [extended_code],1Fh + mov [postbyte_register],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je extended_nop_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz extended_nop_store + call operand_autodetect + extended_nop_store: + jmp instruction_ready + extended_nop_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + +basic_fpu_instruction: + mov [postbyte_register],al + mov [base_code],0D8h + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_fpu_streg + cmp al,'[' + je basic_fpu_mem + dec esi + mov ah,[postbyte_register] + cmp ah,2 + jb invalid_operand + cmp ah,3 + ja invalid_operand + mov bl,1 + jmp nomem_instruction_ready + basic_fpu_mem: + call get_address + mov al,[operand_size] + cmp al,4 + je basic_fpu_mem_32bit + cmp al,8 + je basic_fpu_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + basic_fpu_mem_32bit: + jmp instruction_ready + basic_fpu_mem_64bit: + mov [base_code],0DCh + jmp instruction_ready + basic_fpu_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + mov ah,[postbyte_register] + cmp ah,2 + je basic_fpu_single_streg + cmp ah,3 + je basic_fpu_single_streg + or al,al + jz basic_fpu_st0 + test ah,110b + jz basic_fpu_streg_st0 + xor [postbyte_register],1 + basic_fpu_streg_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + mov [base_code],0DCh + jmp nomem_instruction_ready + basic_fpu_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov bl,al + basic_fpu_single_streg: + mov [base_code],0D8h + jmp nomem_instruction_ready +simple_fpu_instruction: + mov ah,al + or ah,11000000b + mov al,0D9h + stos word [edi] + jmp instruction_assembled +fi_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fi_mem_16bit + cmp al,4 + je fi_mem_32bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fi_mem_32bit: + mov [base_code],0DAh + jmp instruction_ready + fi_mem_16bit: + mov [base_code],0DEh + jmp instruction_ready +fld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je fld_streg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je fld_mem_32bit + cmp al,8 + je fld_mem_64bit + cmp al,10 + je fld_mem_80bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fld_mem_32bit: + mov [base_code],0D9h + jmp instruction_ready + fld_mem_64bit: + mov [base_code],0DDh + jmp instruction_ready + fld_mem_80bit: + mov al,[postbyte_register] + cmp al,0 + je fld_mem_80bit_store + dec [postbyte_register] + cmp al,3 + je fld_mem_80bit_store + jmp invalid_operand_size + fld_mem_80bit_store: + add [postbyte_register],5 + mov [base_code],0DBh + jmp instruction_ready + fld_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + cmp [postbyte_register],2 + jae fst_streg + mov [base_code],0D9h + jmp nomem_instruction_ready + fst_streg: + mov [base_code],0DDh + jmp nomem_instruction_ready +fild_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fild_mem_16bit + cmp al,4 + je fild_mem_32bit + cmp al,8 + je fild_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fild_mem_32bit: + mov [base_code],0DBh + jmp instruction_ready + fild_mem_16bit: + mov [base_code],0DFh + jmp instruction_ready + fild_mem_64bit: + mov al,[postbyte_register] + cmp al,1 + je fisttp_64bit_store + jb fild_mem_64bit_store + dec [postbyte_register] + cmp al,3 + je fild_mem_64bit_store + jmp invalid_operand_size + fild_mem_64bit_store: + add [postbyte_register],5 + mov [base_code],0DFh + jmp instruction_ready + fisttp_64bit_store: + mov [base_code],0DDh + jmp instruction_ready +fbld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fbld_mem_80bit + cmp al,10 + je fbld_mem_80bit + jmp invalid_operand_size + fbld_mem_80bit: + mov [base_code],0DFh + jmp instruction_ready +faddp_instruction: + mov [postbyte_register],al + mov [base_code],0DEh + mov edx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je faddp_streg + mov esi,edx + mov bl,1 + jmp nomem_instruction_ready + faddp_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + jmp nomem_instruction_ready +fcompp_instruction: + mov ax,0D9DEh + stos word [edi] + jmp instruction_assembled +fucompp_instruction: + mov ax,0E9DAh + stos word [edi] + jmp instruction_assembled +fxch_instruction: + mov dx,01D9h + jmp fpu_single_operand +ffreep_instruction: + mov dx,00DFh + jmp fpu_single_operand +ffree_instruction: + mov dl,0DDh + mov dh,al + fpu_single_operand: + mov ebx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je fpu_streg + or dh,dh + jz invalid_operand + mov esi,ebx + shl dh,3 + or dh,11000001b + mov ax,dx + stos word [edi] + jmp instruction_assembled + fpu_streg: + lods byte [esi] + call convert_fpu_register + shl dh,3 + or dh,al + or dh,11000000b + mov ax,dx + stos word [edi] + jmp instruction_assembled + +fstenv_instruction: + mov byte [edi],9Bh + inc edi +fldenv_instruction: + mov [base_code],0D9h + jmp fpu_mem +fstenv_instruction_16bit: + mov byte [edi],9Bh + inc edi +fldenv_instruction_16bit: + call operand_16bit + jmp fldenv_instruction +fstenv_instruction_32bit: + mov byte [edi],9Bh + inc edi +fldenv_instruction_32bit: + call operand_32bit + jmp fldenv_instruction +fsave_instruction_32bit: + mov byte [edi],9Bh + inc edi +fnsave_instruction_32bit: + call operand_32bit + jmp fnsave_instruction +fsave_instruction_16bit: + mov byte [edi],9Bh + inc edi +fnsave_instruction_16bit: + call operand_16bit + jmp fnsave_instruction +fsave_instruction: + mov byte [edi],9Bh + inc edi +fnsave_instruction: + mov [base_code],0DDh + fpu_mem: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + jne invalid_operand_size + jmp instruction_ready +fstcw_instruction: + mov byte [edi],9Bh + inc edi +fldcw_instruction: + mov [postbyte_register],al + mov [base_code],0D9h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fldcw_mem_16bit + cmp al,2 + je fldcw_mem_16bit + jmp invalid_operand_size + fldcw_mem_16bit: + jmp instruction_ready +fstsw_instruction: + mov al,9Bh + stos byte [edi] +fnstsw_instruction: + mov [base_code],0DDh + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,10h + je fstsw_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fstsw_mem_16bit + cmp al,2 + je fstsw_mem_16bit + jmp invalid_operand_size + fstsw_mem_16bit: + jmp instruction_ready + fstsw_reg: + lods byte [esi] + call convert_register + cmp ax,0200h + jne invalid_operand + mov ax,0E0DFh + stos word [edi] + jmp instruction_assembled +finit_instruction: + mov byte [edi],9Bh + inc edi +fninit_instruction: + mov ah,al + mov al,0DBh + stos word [edi] + jmp instruction_assembled +fcmov_instruction: + mov dh,0DAh + jmp fcomi_streg +fcomi_instruction: + mov dh,0DBh + jmp fcomi_streg +fcomip_instruction: + mov dh,0DFh + fcomi_streg: + mov dl,al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + cmp byte [esi],',' + je fcomi_st0_streg + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + fcomi_st0_streg: + or ah,ah + jnz invalid_operand + inc esi + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + +basic_mmx_instruction: + mov [base_code],0Fh + mov [extended_code],al + mmx_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'[' + jne invalid_operand + mmx_mmreg_mem: + call get_address + jmp instruction_ready + mmx_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp nomem_instruction_ready +mmx_bit_shift_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'(' + je mmx_ps_mmreg_imm8 + cmp al,'[' + je mmx_mmreg_mem + jmp invalid_operand + mmx_ps_mmreg_imm8: + call get_byte_value + mov byte [value],al + test [operand_size],not 1 + jnz invalid_value + mov bl,[extended_code] + mov al,bl + shr bl,4 + and al,1111b + add al,70h + mov [extended_code],al + sub bl,0Ch + shl bl,1 + xchg bl,[postbyte_register] + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +pmovmskb_instruction: + mov [base_code],0Fh + mov [extended_code],al + call take_register + cmp ah,4 + je pmovmskb_reg_size_ok + cmp [code_type],64 + jne invalid_operand_size + cmp ah,8 + jnz invalid_operand_size + pmovmskb_reg_size_ok: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + call make_mmx_prefix + cmp [extended_code],0C5h + je mmx_nomem_imm8 + jmp nomem_instruction_ready + mmx_imm8: + push ebx ecx edx + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + mov [operand_size],cl + cmp al,'(' + jne invalid_operand + call get_byte_value + mov byte [value],al + pop edx ecx ebx + call store_instruction_with_imm8 + jmp instruction_assembled + mmx_nomem_imm8: + call store_nomem_instruction + call append_imm8 + jmp instruction_assembled + append_imm8: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + stosb + ret +pinsrw_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsrw_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + cmp [operand_size],2 + jne invalid_operand_size + jmp mmx_imm8 + pinsrw_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp mmx_nomem_imm8 +pshufw_instruction: + mov [mmx_size],8 + mov [opcode_prefix],al + jmp pshuf_instruction +pshufd_instruction: + mov [mmx_size],16 + mov [opcode_prefix],al + pshuf_instruction: + mov [base_code],0Fh + mov [extended_code],70h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pshuf_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + pshuf_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +movd_instruction: + mov [base_code],0Fh + mov [extended_code],7Eh + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + call get_mmx_source_register + jmp instruction_ready + movd_reg: + lods byte [esi] + cmp al,0B0h + jae movd_mmreg + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + call get_mmx_source_register + jmp nomem_instruction_ready + movd_mmreg: + mov [extended_code],6Eh + call convert_mmx_register + mov [postbyte_register],al + call make_mmx_prefix + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + jmp instruction_ready + movd_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready + get_mmx_source_register: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + make_mmx_prefix: + cmp [operand_size],16 + jne no_mmx_prefix + mov [operand_prefix],66h + no_mmx_prefix: + ret +movq_instruction: + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + call get_mmx_source_register + mov al,7Fh + cmp ah,8 + je movq_mem_ready + mov al,0D6h + movq_mem_ready: + mov [extended_code],al + jmp instruction_ready + movq_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg + call convert_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + mov [extended_code],7Eh + call operand_64bit + call get_mmx_source_register + jmp nomem_instruction_ready + movq_mmreg: + call convert_mmx_register + mov [postbyte_register],al + mov [extended_code],6Fh + mov [mmx_size],ah + cmp ah,16 + jne movq_mmreg_ + mov [extended_code],7Eh + mov [opcode_prefix],0F3h + movq_mmreg_: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + jmp instruction_ready + movq_mmreg_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg_mmreg + mov [operand_size],0 + call convert_register + cmp ah,8 + jne invalid_operand_size + mov [extended_code],6Eh + mov [opcode_prefix],0 + mov bl,al + cmp [mmx_size],16 + jne movq_mmreg_reg_store + mov [opcode_prefix],66h + movq_mmreg_reg_store: + call operand_64bit + jmp nomem_instruction_ready + movq_mmreg_mmreg: + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +movdq_instruction: + mov [opcode_prefix],al + mov [base_code],0Fh + mov [extended_code],6Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [extended_code],7Fh + jmp instruction_ready + movdq_mmreg: + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + movdq_mmreg_mmreg: + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready +lddqu_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov [postbyte_register],al + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],0F0h + jmp instruction_ready + +movdq2q_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + jmp movq2dq_ +movq2dq_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],16 + movq2dq_: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + xor [mmx_size],8+16 + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + mov [base_code],0Fh + mov [extended_code],0D6h + jmp nomem_instruction_ready + +sse_ps_instruction_imm8: + mov [immediate_size],1 +sse_ps_instruction: + mov [mmx_size],16 + jmp sse_instruction +sse_pd_instruction_imm8: + mov [immediate_size],1 +sse_pd_instruction: + mov [mmx_size],16 + mov [opcode_prefix],66h + jmp sse_instruction +sse_ss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp sse_instruction +sse_sd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],0F2h + jmp sse_instruction +cmp_pd_instruction: + mov [opcode_prefix],66h +cmp_ps_instruction: + mov [mmx_size],16 + mov byte [value],al + mov al,0C2h + jmp sse_instruction +cmp_ss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp cmp_sx_instruction +cmpsd_instruction: + mov al,0A7h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov al,-1 +cmp_sd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],0F2h + cmp_sx_instruction: + mov byte [value],al + mov al,0C2h + jmp sse_instruction +comiss_instruction: + mov [mmx_size],4 + jmp sse_instruction +comisd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],66h + jmp sse_instruction +cvtdq2pd_instruction: + mov [opcode_prefix],0F3h +cvtps2pd_instruction: + mov [mmx_size],8 + jmp sse_instruction +cvtpd2dq_instruction: + mov [mmx_size],16 + mov [opcode_prefix],0F2h + jmp sse_instruction +movshdup_instruction: + mov [mmx_size],16 + mov [opcode_prefix],0F3h +sse_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + sse_xmmreg: + lods byte [esi] + call convert_xmm_register + sse_reg: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg + sse_reg_mem: + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je sse_mem_size_ok + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + sse_mem_size_ok: + mov al,[extended_code] + mov ah,[supplemental_code] + cmp al,0C2h + je sse_cmp_mem_ok + cmp ax,443Ah + je sse_cmp_mem_ok + cmp [immediate_size],1 + je mmx_imm8 + cmp [immediate_size],-1 + jne sse_ok + call take_additional_xmm0 + mov [immediate_size],0 + sse_ok: + jmp instruction_ready + sse_cmp_mem_ok: + cmp byte [value],-1 + je mmx_imm8 + call store_instruction_with_imm8 + jmp instruction_assembled + sse_xmmreg_xmmreg: + cmp [operand_prefix],66h + jne sse_xmmreg_xmmreg_ok + cmp [extended_code],12h + je invalid_operand + cmp [extended_code],16h + je invalid_operand + sse_xmmreg_xmmreg_ok: + lods byte [esi] + call convert_xmm_register + mov bl,al + mov al,[extended_code] + mov ah,[supplemental_code] + cmp al,0C2h + je sse_cmp_nomem_ok + cmp ax,443Ah + je sse_cmp_nomem_ok + cmp [immediate_size],1 + je mmx_nomem_imm8 + cmp [immediate_size],-1 + jne sse_nomem_ok + call take_additional_xmm0 + mov [immediate_size],0 + sse_nomem_ok: + jmp nomem_instruction_ready + sse_cmp_nomem_ok: + cmp byte [value],-1 + je mmx_nomem_imm8 + call store_nomem_instruction + mov al,byte [value] + stosb + jmp instruction_assembled + take_additional_xmm0: + cmp byte [esi],',' + jne additional_xmm0_ok + inc esi + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + test al,al + jnz invalid_operand + additional_xmm0_ok: + ret + +pslldq_instruction: + mov [postbyte_register],al + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],73h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp mmx_nomem_imm8 +movpd_instruction: + mov [opcode_prefix],66h +movps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],16 + jmp sse_mov_instruction +movss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp sse_movs +movsd_instruction: + mov al,0A5h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov [mmx_size],8 + mov [opcode_prefix],0F2h + sse_movs: + mov [base_code],0Fh + mov [extended_code],10h + jmp sse_mov_instruction +sse_mov_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg + sse_mem: + cmp al,'[' + jne invalid_operand + inc [extended_code] + call get_address + cmp [operand_size],0 + je sse_mem_xmmreg + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + mov [operand_size],0 + sse_mem_xmmreg: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + jmp instruction_ready +movlpd_instruction: + mov [opcode_prefix],66h +movlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],8 + lods byte [esi] + call get_size_operator + cmp al,10h + jne sse_mem + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + jmp sse_reg_mem +movhlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand +maskmovq_instruction: + mov cl,8 + jmp maskmov_instruction +maskmovdqu_instruction: + mov cl,16 + mov [opcode_prefix],66h + maskmov_instruction: + mov [base_code],0Fh + mov [extended_code],0F7h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,cl + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp nomem_instruction_ready +movmskpd_instruction: + mov [opcode_prefix],66h +movmskps_instruction: + mov [base_code],0Fh + mov [extended_code],50h + call take_register + mov [postbyte_register],al + cmp ah,4 + je movmskps_reg_ok + cmp ah,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + movmskps_reg_ok: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand + +cvtpi2pd_instruction: + mov [opcode_prefix],66h +cvtpi2ps_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtpi_xmmreg_xmmreg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtpi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + cvtpi_size_ok: + jmp instruction_ready + cvtpi_xmmreg_xmmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +cvtsi2ss_instruction: + mov [opcode_prefix],0F3h + jmp cvtsi_instruction +cvtsi2sd_instruction: + mov [opcode_prefix],0F2h + cvtsi_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + cvtsi_xmmreg: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtsi_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtsi_size_ok + cmp [operand_size],4 + je cvtsi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + call operand_64bit + cvtsi_size_ok: + jmp instruction_ready + cvtsi_xmmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + je cvtsi_xmmreg_reg_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + cvtsi_xmmreg_reg_store: + mov bl,al + jmp nomem_instruction_ready +cvtps2pi_instruction: + mov [mmx_size],8 + jmp cvtpd_instruction +cvtpd2pi_instruction: + mov [opcode_prefix],66h + mov [mmx_size],16 + cvtpd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [operand_size],0 + jmp sse_reg +cvtss2si_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],4 + jmp cvt2si_instruction +cvtsd2si_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + cvt2si_instruction: + mov [extended_code],al + mov [base_code],0Fh + call take_register + mov [operand_size],0 + cmp ah,4 + je sse_reg + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp sse_reg + +ssse3_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + jmp mmx_instruction +palignr_instruction: + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je palignr_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + palignr_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +amd3dnow_instruction: + mov [base_code],0Fh + mov [extended_code],0Fh + mov byte [value],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je amd3dnow_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + call store_instruction_with_imm8 + jmp instruction_assembled + amd3dnow_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled + +sse4_instruction_38_xmm0: + mov [immediate_size],-1 + jmp sse4_instruction_38 +sse4_instruction_66_38_xmm0: + mov [immediate_size],-1 +sse4_instruction_66_38: + mov [opcode_prefix],66h +sse4_instruction_38: + mov [mmx_size],16 + mov [supplemental_code],al + mov al,38h + jmp sse_instruction +sse4_ss_instruction_66_3a_imm8: + mov [immediate_size],1 + mov cl,4 + jmp sse4_instruction_66_3a_setup +sse4_sd_instruction_66_3a_imm8: + mov [immediate_size],1 + mov cl,8 + jmp sse4_instruction_66_3a_setup +sse4_instruction_66_3a_imm8: + mov [immediate_size],1 + mov cl,16 + sse4_instruction_66_3a_setup: + mov [opcode_prefix],66h + sse4_instruction_3a_setup: + mov [supplemental_code],al + mov al,3Ah + mov [mmx_size],cl + jmp sse_instruction +sse4_instruction_3a_imm8: + mov [immediate_size],1 + mov cl,16 + jmp sse4_instruction_3a_setup +pclmulqdq_instruction: + mov byte [value],al + mov al,44h + mov cl,16 + jmp sse4_instruction_66_3a_setup +extractps_instruction: + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + je extractps_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je extractps_size_ok + cmp [operand_size],0 + jne invalid_operand_size + extractps_size_ok: + push edx ebx ecx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ecx ebx edx + jmp mmx_imm8 + extractps_reg: + lods byte [esi] + call convert_register + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ebx + mov al,bh + cmp al,4 + je mmx_nomem_imm8 + cmp al,8 + jne invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp mmx_nomem_imm8 + setup_66_0f_3a: + mov [extended_code],3Ah + mov [supplemental_code],al + mov [base_code],0Fh + mov [opcode_prefix],66h + ret +insertps_instruction: + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je insertps_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je insertps_size_ok + cmp [operand_size],0 + jne invalid_operand_size + insertps_size_ok: + jmp mmx_imm8 + insertps_xmmreg_reg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +pextrq_instruction: + mov [mmx_size],8 + jmp pextr_instruction +pextrd_instruction: + mov [mmx_size],4 + jmp pextr_instruction +pextrw_instruction: + mov [mmx_size],2 + jmp pextr_instruction +pextrb_instruction: + mov [mmx_size],1 + pextr_instruction: + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + je pextr_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + cmp al,[operand_size] + je pextr_size_ok + cmp [operand_size],0 + jne invalid_operand_size + pextr_size_ok: + cmp al,8 + jne pextr_prefix_ok + call operand_64bit + pextr_prefix_ok: + push edx ebx ecx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ecx ebx edx + jmp mmx_imm8 + pextr_reg: + lods byte [esi] + call convert_register + cmp [mmx_size],4 + ja pextrq_reg + cmp ah,4 + je pextr_reg_size_ok + cmp [code_type],64 + jne pextr_invalid_size + cmp ah,8 + je pextr_reg_size_ok + pextr_invalid_size: + jmp invalid_operand_size + pextrq_reg: + cmp ah,8 + jne pextr_invalid_size + call operand_64bit + pextr_reg_size_ok: + mov [operand_size],0 + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov ebx,eax + pop eax + mov [postbyte_register],al + mov al,ah + cmp [mmx_size],2 + jne pextr_reg_store + mov [opcode_prefix],0 + mov [extended_code],0C5h + call make_mmx_prefix + jmp mmx_nomem_imm8 + pextr_reg_store: + cmp bh,16 + jne invalid_operand_size + xchg bl,[postbyte_register] + jmp mmx_nomem_imm8 +pinsrb_instruction: + mov [mmx_size],1 + jmp pinsr_instruction +pinsrd_instruction: + mov [mmx_size],4 + jmp pinsr_instruction +pinsrq_instruction: + mov [mmx_size],8 + call operand_64bit + pinsr_instruction: + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pinsr_xmmreg: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsr_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + mov al,[mmx_size] + cmp al,[operand_size] + je mmx_imm8 + jmp invalid_operand_size + pinsr_xmmreg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp [mmx_size],8 + je pinsrq_xmmreg_reg + cmp ah,4 + je mmx_nomem_imm8 + jmp invalid_operand_size + pinsrq_xmmreg_reg: + cmp ah,8 + je mmx_nomem_imm8 + jmp invalid_operand_size +pmovsxbw_instruction: + mov [mmx_size],8 + jmp pmovsx_instruction +pmovsxbd_instruction: + mov [mmx_size],4 + jmp pmovsx_instruction +pmovsxbq_instruction: + mov [mmx_size],2 + jmp pmovsx_instruction +pmovsxwd_instruction: + mov [mmx_size],8 + jmp pmovsx_instruction +pmovsxwq_instruction: + mov [mmx_size],4 + jmp pmovsx_instruction +pmovsxdq_instruction: + mov [mmx_size],8 + pmovsx_instruction: + call setup_66_0f_38 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je pmovsx_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je instruction_ready + mov al,[mmx_size] + cmp al,[operand_size] + jne invalid_operand_size + jmp instruction_ready + pmovsx_xmmreg_reg: + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready + setup_66_0f_38: + mov [extended_code],38h + mov [supplemental_code],al + mov [base_code],0Fh + mov [opcode_prefix],66h + ret + +xsaves_instruction_64bit: + call operand_64bit +xsaves_instruction: + mov ah,0C7h + jmp xsave_common +fxsave_instruction_64bit: + call operand_64bit +fxsave_instruction: + mov ah,0AEh + xor cl,cl + xsave_common: + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + mov [mmx_size],cl + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,[operand_size] + or ah,ah + jz xsave_size_ok + cmp ah,[mmx_size] + jne invalid_operand_size + xsave_size_ok: + jmp instruction_ready +clflush_instruction: + mov ah,0AEh + mov cl,1 + jmp xsave_common +cldemote_instruction: + mov ah,1Ch + mov cl,1 + jmp xsave_common +stmxcsr_instruction: + mov ah,0AEh + mov cl,4 + jmp xsave_common +prefetch_instruction: + mov [extended_code],18h + prefetch_mem_8bit: + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + or ah,ah + jz prefetch_size_ok + cmp ah,1 + jne invalid_operand_size + prefetch_size_ok: + call get_address + jmp instruction_ready +amd_prefetch_instruction: + mov [extended_code],0Dh + jmp prefetch_mem_8bit +clflushopt_instruction: + mov [extended_code],0AEh + mov [opcode_prefix],66h + jmp prefetch_mem_8bit +pcommit_instruction: + mov byte [edi],66h + inc edi +fence_instruction: + mov bl,al + mov ax,0AE0Fh + stos word [edi] + mov al,bl + stos byte [edi] + jmp instruction_assembled +pause_instruction: + mov ax,90F3h + stos word [edi] + jmp instruction_assembled +movntq_instruction: + mov [mmx_size],8 + jmp movnt_instruction +movntpd_instruction: + mov [opcode_prefix],66h +movntps_instruction: + mov [mmx_size],16 + movnt_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + jmp instruction_ready + +movntsd_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + jmp movnts_instruction +movntss_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],4 + movnts_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,[mmx_size] + je movnts_size_ok + test al,al + jnz invalid_operand_size + movnts_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + jmp instruction_ready + +movdiri_instruction: + mov [supplemental_code],al + mov al,38h +movnti_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ah,4 + je movnti_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + movnti_store: + mov [postbyte_register],al + jmp instruction_ready +monitor_instruction: + mov [postbyte_register],al + cmp byte [esi],0 + je monitor_instruction_store + cmp byte [esi],0Fh + je monitor_instruction_store + call take_register + cmp ax,0400h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ax,0401h + jne invalid_operand + cmp [postbyte_register],0C8h + jne monitor_instruction_store + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ax,0402h + jne invalid_operand + monitor_instruction_store: + mov ax,010Fh + stos word [edi] + mov al,[postbyte_register] + stos byte [edi] + jmp instruction_assembled +pconfig_instruction: + mov [postbyte_register],al + jmp monitor_instruction_store +movntdqa_instruction: + call setup_66_0f_38 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + +extrq_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je extrq_xmmreg_xmmreg + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + xor bl,bl + xchg bl,[postbyte_register] + call store_nomem_instruction + call get_byte_value + stosb + call append_imm8 + jmp instruction_assembled + extrq_xmmreg_xmmreg: + inc [extended_code] + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready +insertq_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov bl,al + cmp byte [esi],',' + je insertq_with_imm + inc [extended_code] + jmp nomem_instruction_ready + insertq_with_imm: + call store_nomem_instruction + call append_imm8 + call append_imm8 + jmp instruction_assembled + +crc32_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F0h + call take_register + mov [postbyte_register],al + cmp ah,4 + je crc32_reg_size_ok + cmp ah,8 + jne invalid_operand + cmp [code_type],64 + jne illegal_instruction + crc32_reg_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je crc32_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + test al,al + jz crc32_unknown_size + cmp al,1 + je crc32_reg_mem_store + inc [supplemental_code] + call operand_autodetect + crc32_reg_mem_store: + jmp instruction_ready + crc32_unknown_size: + call recoverable_unknown_size + jmp crc32_reg_mem_store + crc32_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je crc32_reg_reg_store + inc [supplemental_code] + call operand_autodetect + crc32_reg_reg_store: + jmp nomem_instruction_ready +popcnt_instruction: + mov [opcode_prefix],0F3h + jmp bs_instruction +movbe_instruction: + mov [supplemental_code],al + mov [extended_code],38h + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + je movbe_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + movbe_mem: + inc [supplemental_code] + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready +adx_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F6h + mov [operand_prefix],al + call get_reg_mem + jc adx_reg_reg + mov al,[operand_size] + cmp al,4 + je instruction_ready + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp instruction_ready + adx_reg_reg: + cmp ah,4 + je nomem_instruction_ready + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp nomem_instruction_ready +rdpid_instruction: + mov [postbyte_register],al + mov [extended_code],0C7h + mov [base_code],0Fh + mov [opcode_prefix],0F3h + call take_register + cmp [code_type],64 + je rdpid_64bit + cmp ah,4 + jne invalid_operand_size + jmp nomem_instruction_ready + rdpid_64bit: + cmp ah,8 + jne invalid_operand_size + jmp nomem_instruction_ready +ptwrite_instruction: + mov [base_code],0Fh + mov [extended_code],0AEh + mov [postbyte_register],al + mov [opcode_prefix],0F3h + lods byte [esi] + call get_size_operator + cmp al,10h + je ptwrite_reg + ptwrite_mem: + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je ptwrite_mem_store + cmp al,8 + je ptwrite_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + jmp ptwrite_mem_store + ptwrite_mem_64bit: + call operand_64bit + ptwrite_mem_store: + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + ptwrite_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,4 + je nomem_instruction_ready + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp nomem_instruction_ready + +vmclear_instruction: + mov [opcode_prefix],66h + jmp vmx_instruction +vmxon_instruction: + mov [opcode_prefix],0F3h +vmx_instruction: + mov [postbyte_register],al + mov [extended_code],0C7h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,8 + jne invalid_operand_size + vmx_size_ok: + mov [base_code],0Fh + jmp instruction_ready +vmread_instruction: + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + je vmread_nomem + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + call vmread_check_size + jmp vmx_size_ok + vmread_nomem: + lods byte [esi] + call convert_register + push eax + call vmread_check_size + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + call vmread_check_size + pop ebx + mov [base_code],0Fh + jmp nomem_instruction_ready + vmread_check_size: + cmp [code_type],64 + je vmread_long + cmp [operand_size],4 + jne invalid_operand_size + ret + vmread_long: + cmp [operand_size],8 + jne invalid_operand_size + ret +vmwrite_instruction: + mov [extended_code],79h + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je vmwrite_nomem + cmp al,'[' + jne invalid_operand + call get_address + call vmread_check_size + jmp vmx_size_ok + vmwrite_nomem: + lods byte [esi] + call convert_register + mov bl,al + mov [base_code],0Fh + jmp nomem_instruction_ready +vmx_inv_instruction: + call setup_66_0f_38 + call take_register + mov [postbyte_register],al + call vmread_check_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,16 + jne invalid_operand_size + jmp vmx_size_ok +simple_svm_instruction: + push eax + mov [base_code],0Fh + mov [extended_code],1 + call take_register + or al,al + jnz invalid_operand + simple_svm_detect_size: + cmp ah,2 + je simple_svm_16bit + cmp ah,4 + je simple_svm_32bit + cmp [code_type],64 + jne invalid_operand_size + jmp simple_svm_store + simple_svm_16bit: + cmp [code_type],16 + je simple_svm_store + cmp [code_type],64 + je invalid_operand_size + jmp prefixed_svm_store + simple_svm_32bit: + cmp [code_type],32 + je simple_svm_store + prefixed_svm_store: + mov al,67h + stos byte [edi] + simple_svm_store: + call store_classic_instruction_code + pop eax + stos byte [edi] + jmp instruction_assembled +skinit_instruction: + call take_register + cmp ax,0400h + jne invalid_operand + mov al,0DEh + jmp simple_instruction_0f_01 +clzero_instruction: + call take_register + or al,al + jnz invalid_operand + mov al,0FCh + cmp [code_type],64 + je clzero_64bit + cmp ah,4 + jne invalid_operand + jmp simple_instruction_0f_01 + clzero_64bit: + cmp ah,8 + jne invalid_operand + jmp simple_instruction_0f_01 +invlpga_instruction: + push eax + mov [base_code],0Fh + mov [extended_code],1 + call take_register + or al,al + jnz invalid_operand + mov bl,ah + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ax,0401h + jne invalid_operand + mov ah,bl + jmp simple_svm_detect_size + +rdrand_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + call take_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +rdfsbase_instruction: + cmp [code_type],64 + jne illegal_instruction + mov [opcode_prefix],0F3h + mov [base_code],0Fh + mov [extended_code],0AEh + mov [postbyte_register],al + call take_register + mov bl,al + mov al,ah + cmp ah,2 + je invalid_operand_size + call operand_autodetect + jmp nomem_instruction_ready + +xabort_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + mov dl,al + mov ax,0F8C6h + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +xbegin_instruction: + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[code_type] + cmp al,64 + je xbegin_64bit + cmp al,32 + je xbegin_32bit + xbegin_16bit: + call get_address_word_value + add edi,4 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,4 + shl eax,16 + mov ax,0F8C7h + stos dword [edi] + jmp instruction_assembled + xbegin_32bit: + call get_address_dword_value + jmp xbegin_address_ok + xbegin_64bit: + call get_address_qword_value + xbegin_address_ok: + add edi,5 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,5 + mov edx,eax + cwde + cmp eax,edx + jne xbegin_rel32 + mov al,66h + stos byte [edi] + mov eax,edx + shl eax,16 + mov ax,0F8C7h + stos dword [edi] + jmp instruction_assembled + xbegin_rel32: + sub edx,1 + jno xbegin_rel32_ok + cmp [code_type],64 + je jump_out_of_range + xbegin_rel32_ok: + mov ax,0F8C7h + stos word [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + +bndcl_instruction: + mov ah,0F3h + jmp bndc_instruction +bndcu_instruction: + mov ah,0F2h + bndc_instruction: + mov [opcode_prefix],ah + mov [base_code],0Fh + mov [extended_code],al + call take_bnd_register + mov [postbyte_register],al + call get_bnd_size + mov [operand_size],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je bndc_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + jmp nomem_instruction_ready + bndc_mem: + call get_address_of_required_size + jmp instruction_ready +bndmov_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],al + call get_bnd_size + shl al,1 + mov [operand_size],al + lods byte [esi] + cmp al,14h + je bndmov_reg + call get_size_operator + cmp al,'[' + jne invalid_operand + inc [extended_code] + call get_address_of_required_size + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_bnd_register + mov [postbyte_register],al + jmp instruction_ready + bndmov_reg: + lods byte [esi] + call convert_bnd_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,14h + je bndmov_reg_reg + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address_of_required_size + jmp instruction_ready + bndmov_reg_reg: + lods byte [esi] + call convert_bnd_register + mov bl,al + jmp nomem_instruction_ready + take_bnd_register: + lods byte [esi] + cmp al,14h + jne invalid_operand + lods byte [esi] + convert_bnd_register: + mov ah,al + shr ah,4 + cmp ah,6 + jne invalid_operand + and al,1111b + ret +bndmk_instruction: + mov [opcode_prefix],0F3h + mov [base_code],0Fh + mov [extended_code],al + call take_bnd_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_bnd_size + call get_address_prefixes + call get_address_component + cmp byte [esi-1],']' + je bndmk_ready + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,'(' + jne invalid_operand + or dl,bl + or dl,[address_sign] + or edx,[address_high] + jnz invalid_address + mov [address_register],bh + call get_address_component + lods byte [esi] + cmp al,']' + jne invalid_operand + or bh,bh + jz bndmk_selected_base + cmp bl,bh + je bndmk_to_index + or bl,bl + jnz invalid_address + mov bl,bh + bndmk_to_index: + inc cl + bndmk_selected_base: + mov bh,[address_register] + bndmk_ready: + or bx,bx + jz instruction_ready + cmp [address_size_declared],0 + jne instruction_ready + and ch,not 0Fh + jmp instruction_ready + get_bnd_size: + mov al,4 + cmp [code_type],64 + jne bnd_size_ok + add al,4 + bnd_size_ok: + mov [address_size],al + ret + get_address_component: + mov [free_address_range],0 + call calculate_address + mov [address_high],edx + mov edx,eax + or bx,bx + jz address_component_ok + mov al,bl + or al,bh + shr al,4 + cmp al,[address_size] + jne invalid_address + address_component_ok: + ret +bndldx_instruction: + mov [base_code],0Fh + mov [extended_code],al + call take_bnd_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_bnd_mib + jmp bndmk_ready +bndstx_instruction: + mov [base_code],0Fh + mov [extended_code],al + call take_bnd_mib + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_bnd_register + mov [postbyte_register],al + jmp bndmk_ready + take_bnd_mib: + lods byte [esi] + cmp al,'[' + jne invalid_operand + call get_bnd_size + call get_address_prefixes + call get_address_component + cmp byte [esi-1],']' + je bnd_mib_ok + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[address_sign] + push eax ebx ecx edx [address_symbol] + call get_address_component + lods byte [esi] + cmp al,']' + jne invalid_operand + or dl,bl + or dl,[address_sign] + or edx,[address_high] + jnz invalid_address + mov [address_register],bh + pop [address_symbol] edx ecx ebx eax + mov [address_sign],al + or bl,bl + jz mib_place_index + or bh,bh + jnz invalid_address + cmp cl,1 + jne invalid_address + mov bh,bl + mib_place_index: + mov bl,[address_register] + xor cl,cl + or bl,bl + jz bnd_mib_ok + inc cl + bnd_mib_ok: + ret + +tpause_instruction: + mov [postbyte_register],6 + mov [extended_code],0AEh + mov [base_code],0Fh + mov [opcode_prefix],al + call take_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + cmp byte [esi],',' + jne nomem_instruction_ready + inc esi + call take_register + cmp ax,0402h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ax,0400h + jne invalid_operand + jmp nomem_instruction_ready +umonitor_instruction: + mov [postbyte_register],6 + mov [extended_code],0AEh + mov [base_code],0Fh + mov [opcode_prefix],0F3h + call take_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +movdir64b_instruction: + call setup_66_0f_38 + call take_register + mov [postbyte_register],al + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz movdir64b_ready + cmp al,64 + jne invalid_operand_size + movdir64b_ready: + push edi + call store_instruction + pop ebx eax + mov cl,[code_type] + cmp byte [ebx],67h + jne movdir64b_size_check + shr cl,1 + cmp cl,16 + jae movdir64b_size_check + mov cl,32 + movdir64b_size_check: + shl al,3 + cmp al,cl + jne invalid_operand_size + jmp instruction_assembled + +setssbsy_instruction: + shl eax,24 + or eax,010FF3h + stos dword [edi] + jmp instruction_assembled +rstorssp_instruction: + mov ah,1 + jmp setup_clrssbsy +clrssbsy_instruction: + mov ah,0AEh + setup_clrssbsy: + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + mov [opcode_prefix],0F3h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + jmp instruction_ready +rdsspq_instruction: + mov [rex_prefix],48h +rdsspd_instruction: + mov ah,1Eh + jmp setup_incssp +incsspq_instruction: + mov [rex_prefix],48h +incsspd_instruction: + mov ah,0AEh + setup_incssp: + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + mov [opcode_prefix],0F3h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + call cet_size_check + jmp nomem_instruction_ready + cet_size_check: + cmp [rex_prefix],0 + je cet_dword + cmp [code_type],64 + jne illegal_instruction + shr ah,1 + cet_dword: + cmp ah,4 + jne invalid_operand_size + ret +wrussq_instruction: + mov [opcode_prefix],66h +wrssq_instruction: + mov [rex_prefix],48h + jmp wrssd_instruction +wrussd_instruction: + mov [opcode_prefix],66h +wrssd_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je wrss_reg + cmp al,'[' + jne invalid_operand + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + pop ecx ebx edx + call cet_size_check + jmp instruction_ready + wrss_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov bl,al + xchg bl,[postbyte_register] + call cet_size_check + jmp nomem_instruction_ready +endbr_instruction: + shl eax,24 + or eax,1E0FF3h + stos dword [edi] + jmp instruction_assembled + +take_register: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] +convert_register: + mov ah,al + shr ah,4 + and al,0Fh + cmp ah,8 + je match_register_size + cmp ah,4 + ja invalid_operand + cmp ah,1 + ja match_register_size + cmp al,4 + jb match_register_size + or ah,ah + jz high_byte_register + or [rex_prefix],40h + match_register_size: + cmp ah,[operand_size] + je register_size_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + register_size_ok: + ret + high_byte_register: + mov ah,1 + or [rex_prefix],10h + jmp match_register_size +convert_fpu_register: + mov ah,al + shr ah,4 + and al,111b + cmp ah,10 + jne invalid_operand + jmp match_register_size +convert_mmx_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + ja invalid_operand + and al,111b + cmp ah,0Bh + jne invalid_operand + mov ah,8 + jmp match_register_size + xmm_register: + and al,0Fh + mov ah,16 + cmp al,8 + jb match_register_size + cmp [code_type],64 + jne invalid_operand + jmp match_register_size +convert_xmm_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + jmp invalid_operand +get_size_operator: + xor ah,ah + cmp al,11h + jne no_size_operator + mov [size_declared],1 + lods word [esi] + xchg al,ah + or [operand_flags],1 + cmp ah,[operand_size] + je size_operator_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + size_operator_ok: + ret + no_size_operator: + mov [size_declared],0 + cmp al,'[' + jne size_operator_ok + and [operand_flags],not 1 + ret +get_jump_operator: + mov [jump_type],0 + cmp al,12h + jne jump_operator_ok + lods word [esi] + mov [jump_type],al + mov al,ah + jump_operator_ok: + ret +get_address: + and [address_size],0 + get_address_of_required_size: + call get_address_prefixes + and [free_address_range],0 + call calculate_address + cmp byte [esi-1],']' + jne invalid_address + mov [address_high],edx + mov edx,eax + cmp [address_size_declared],0 + jne address_ok + cmp [segment_register],4 + ja address_ok + or bx,bx + jnz clear_address_size + cmp [code_type],64 + jne address_ok + calculate_relative_address: + mov edx,[address_symbol] + mov [symbol_identifier],edx + mov edx,[address_high] + mov ebp,[addressing_space] + call calculate_relative_offset + mov [address_high],edx + cdq + cmp edx,[address_high] + je address_high_ok + call recoverable_overflow + address_high_ok: + mov edx,eax + ror ecx,16 + mov cl,[value_type] + rol ecx,16 + mov bx,9900h + clear_address_size: + and ch,not 0Fh + address_ok: + ret +get_address_prefixes: + and [segment_register],0 + and [address_size_declared],0 + mov al,[code_type] + shr al,3 + mov [value_size],al + mov al,[esi] + and al,11110000b + cmp al,60h + jne get_address_size_prefix + lods byte [esi] + sub al,60h + mov [segment_register],al + mov al,[esi] + and al,11110000b + get_address_size_prefix: + cmp al,70h + jne address_size_prefix_ok + lods byte [esi] + sub al,70h + cmp al,2 + jb invalid_address_size + cmp al,8 + ja invalid_address_size + mov [value_size],al + or [address_size_declared],1 + or [address_size],al + cmp al,[address_size] + jne invalid_address_size + address_size_prefix_ok: + ret +operand_16bit: + cmp [code_type],16 + je size_prefix_ok + mov [operand_prefix],66h + ret +operand_32bit: + cmp [code_type],16 + jne size_prefix_ok + mov [operand_prefix],66h + size_prefix_ok: + ret +operand_64bit: + cmp [code_type],64 + jne illegal_instruction + or [rex_prefix],48h + ret +operand_autodetect: + cmp al,2 + je operand_16bit + cmp al,4 + je operand_32bit + cmp al,8 + je operand_64bit + jmp invalid_operand_size +store_segment_prefix_if_necessary: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,4 + ja segment_prefix_386 + cmp [code_type],64 + je segment_prefix_ok + cmp al,3 + je ss_prefix + jb segment_prefix_86 + cmp bl,25h + je segment_prefix_86 + cmp bh,25h + je segment_prefix_86 + cmp bh,45h + je segment_prefix_86 + cmp bh,44h + je segment_prefix_86 + ret + ss_prefix: + cmp bl,25h + je segment_prefix_ok + cmp bh,25h + je segment_prefix_ok + cmp bh,45h + je segment_prefix_ok + cmp bh,44h + je segment_prefix_ok + jmp segment_prefix_86 +store_segment_prefix: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,5 + jae segment_prefix_386 + segment_prefix_86: + dec al + shl al,3 + add al,26h + stos byte [edi] + jmp segment_prefix_ok + segment_prefix_386: + add al,64h-5 + stos byte [edi] + segment_prefix_ok: + ret +store_instruction_code: + cmp [vex_required],0 + jne store_vex_instruction_code +store_classic_instruction_code: + mov al,[operand_prefix] + or al,al + jz operand_prefix_ok + stos byte [edi] + operand_prefix_ok: + mov al,[opcode_prefix] + or al,al + jz opcode_prefix_ok + stos byte [edi] + opcode_prefix_ok: + mov al,[rex_prefix] + test al,40h + jz rex_prefix_ok + cmp [code_type],64 + jne invalid_operand + test al,0B0h + jnz disallowed_combination_of_registers + stos byte [edi] + rex_prefix_ok: + mov al,[base_code] + stos byte [edi] + cmp al,0Fh + jne instruction_code_ok + store_extended_code: + mov al,[extended_code] + stos byte [edi] + cmp al,38h + je store_supplemental_code + cmp al,3Ah + je store_supplemental_code + instruction_code_ok: + ret + store_supplemental_code: + mov al,[supplemental_code] + stos byte [edi] + ret +store_nomem_instruction: + test [postbyte_register],10000b + jz nomem_reg_high_code_ok + or [vex_required],10h + and [postbyte_register],1111b + nomem_reg_high_code_ok: + test [postbyte_register],1000b + jz nomem_reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + nomem_reg_code_ok: + test bl,10000b + jz nomem_rm_high_code_ok + or [rex_prefix],42h + or [vex_required],8 + and bl,1111b + nomem_rm_high_code_ok: + test bl,1000b + jz nomem_rm_code_ok + or [rex_prefix],41h + and bl,111b + nomem_rm_code_ok: + and [displacement_compression],0 + call store_instruction_code + mov al,[postbyte_register] + shl al,3 + or al,bl + or al,11000000b + stos byte [edi] + ret +store_instruction: + mov [current_offset],edi + and [displacement_compression],0 + test [postbyte_register],10000b + jz reg_high_code_ok + or [vex_required],10h + and [postbyte_register],1111b + reg_high_code_ok: + test [postbyte_register],1000b + jz reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + reg_code_ok: + cmp [code_type],64 + jne address_value_ok + xor eax,eax + bt edx,31 + sbb eax,[address_high] + jz address_value_ok + cmp [address_high],0 + jne address_value_out_of_range + test ch,44h + jnz address_value_ok + test bx,8080h + jz address_value_ok + address_value_out_of_range: + call recoverable_overflow + address_value_ok: + call store_segment_prefix_if_necessary + test [vex_required],4 + jnz address_vsib + or bx,bx + jz address_immediate + cmp bx,9800h + je address_rip_based + cmp bx,9400h + je address_eip_based + cmp bx,9900h + je address_relative + mov al,bl + or al,bh + and al,11110000b + cmp al,80h + je postbyte_64bit + cmp al,40h + je postbyte_32bit + cmp al,20h + jne invalid_address + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + test ch,22h + setz [displacement_compression] + call store_instruction_code + cmp bl,bh + jbe determine_16bit_address + xchg bl,bh + determine_16bit_address: + cmp bx,2600h + je address_si + cmp bx,2700h + je address_di + cmp bx,2300h + je address_bx + cmp bx,2500h + je address_bp + cmp bx,2625h + je address_bp_si + cmp bx,2725h + je address_bp_di + cmp bx,2723h + je address_bx_di + cmp bx,2623h + jne invalid_address + address_bx_si: + xor al,al + jmp postbyte_16bit + address_bx_di: + mov al,1 + jmp postbyte_16bit + address_bp_si: + mov al,10b + jmp postbyte_16bit + address_bp_di: + mov al,11b + jmp postbyte_16bit + address_si: + mov al,100b + jmp postbyte_16bit + address_di: + mov al,101b + jmp postbyte_16bit + address_bx: + mov al,111b + jmp postbyte_16bit + address_bp: + mov al,110b + postbyte_16bit: + test ch,22h + jnz address_16bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + or dx,dx + jz address + cmp [displacement_compression],2 + ja address_8bit_value + je address_16bit_value + cmp dx,80h + jb address_8bit_value + cmp dx,-80h + jae address_8bit_value + address_16bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + ret + address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + ret + address: + cmp al,110b + je address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_vsib: + mov al,bl + shr al,4 + test al,1 + jz vsib_high_code_ok + or [vex_register],10000b + or [vex_required],8 + xor al,1 + vsib_high_code_ok: + cmp al,6 + je vsib_index_ok + cmp al,0Ch + jb invalid_address + vsib_index_ok: + mov al,bh + shr al,4 + cmp al,4 + je postbyte_32bit + cmp [code_type],64 + je address_prefix_ok + test al,al + jnz invalid_address + postbyte_32bit: + call address_32bit_prefix + jmp address_prefix_ok + postbyte_64bit: + cmp [code_type],64 + jne invalid_address_size + address_prefix_ok: + cmp bl,44h + je invalid_address + cmp bl,84h + je invalid_address + test bh,1000b + jz base_code_ok + or [rex_prefix],41h + base_code_ok: + test bl,1000b + jz index_code_ok + or [rex_prefix],42h + index_code_ok: + test ch,44h or 88h + setz [displacement_compression] + call store_instruction_code + or cl,cl + jz only_base_register + base_and_index: + mov al,100b + xor ah,ah + cmp cl,1 + je scale_ok + cmp cl,2 + je scale_1 + cmp cl,4 + je scale_2 + or ah,11000000b + jmp scale_ok + scale_2: + or ah,10000000b + jmp scale_ok + scale_1: + or ah,01000000b + scale_ok: + or bh,bh + jz only_index_register + and bl,111b + shl bl,3 + or ah,bl + and bh,111b + or ah,bh + sib_ready: + test ch,44h or 88h + jnz sib_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp bh,5 + je address_value + or edx,edx + jz sib_address + address_value: + cmp [displacement_compression],2 + ja sib_address_8bit_value + je sib_address_32bit_value + cmp edx,80h + jb sib_address_8bit_value + cmp edx,-80h + jnb sib_address_8bit_value + sib_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + sib_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + mov al,dl + stos byte [edi] + ret + sib_address: + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + ret + only_index_register: + or ah,101b + and bl,111b + shl bl,3 + or ah,bl + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + test ch,44h or 88h + jnz store_address_32bit_value + or ch,ch + jnz invalid_address_size + cmp [displacement_compression],2 + jbe store_address_32bit_value + mov edx,[uncompressed_displacement] + jmp store_address_32bit_value + zero_index_register: + mov bl,4 + mov cl,1 + jmp base_and_index + only_base_register: + mov al,bh + and al,111b + cmp al,4 + je zero_index_register + test ch,44h or 88h + jnz simple_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + or edx,edx + jz simple_address + cmp [displacement_compression],2 + ja simple_address_8bit_value + je simple_address_32bit_value + cmp edx,80h + jb simple_address_8bit_value + cmp edx,-80h + jnb simple_address_8bit_value + simple_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + jmp store_address_32bit_value + simple_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + ret + simple_address: + cmp al,5 + je simple_address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_immediate: + cmp [code_type],64 + je address_immediate_sib + test ch,44h or 88h + jnz address_immediate_32bit + test ch,22h + jnz address_immediate_16bit + or ch,ch + jnz invalid_address_size + cmp [code_type],16 + je addressing_16bit + address_immediate_32bit: + call address_32bit_prefix + call store_instruction_code + store_immediate_address: + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + store_address_32bit_value: + test ch,0F0h + jz address_32bit_relocation_ok + mov eax,ecx + shr eax,16 + cmp al,4 + jne address_32bit_relocation + mov al,2 + address_32bit_relocation: + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_32bit_relocation_ok: + mov eax,edx + stos dword [edi] + ret + store_address_64bit_value: + test ch,0F0h + jz address_64bit_relocation_ok + mov eax,ecx + shr eax,16 + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_64bit_relocation_ok: + mov eax,edx + stos dword [edi] + mov eax,[address_high] + stos dword [edi] + ret + address_immediate_sib: + test ch,44h + jnz address_immediate_sib_32bit + test ch,not 88h + jnz invalid_address_size + test edx,80000000h + jz address_immediate_sib_store + cmp [address_high],0 + je address_immediate_sib_nosignextend + address_immediate_sib_store: + call store_instruction_code + mov al,100b + mov ah,100101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + address_immediate_sib_32bit: + test ecx,0FF0000h + jnz address_immediate_sib_nosignextend + test edx,80000000h + jz address_immediate_sib_store + address_immediate_sib_nosignextend: + call address_32bit_prefix + jmp address_immediate_sib_store + address_eip_based: + mov al,67h + stos byte [edi] + address_rip_based: + cmp [code_type],64 + jne invalid_address + call store_instruction_code + jmp store_immediate_address + address_relative: + call store_instruction_code + movzx eax,[immediate_size] + add eax,edi + sub eax,[current_offset] + add eax,5 + sub edx,eax + jno @f + call recoverable_overflow + @@: + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + shr ecx,16 + xchg [value_type],cl + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + mov eax,edx + call mark_relocation + mov [value_type],cl + mov [symbol_identifier],ebx + stos dword [edi] + ret + addressing_16bit: + cmp edx,10000h + jge address_immediate_32bit + cmp edx,-8000h + jl address_immediate_32bit + movzx edx,dx + address_immediate_16bit: + call address_16bit_prefix + call store_instruction_code + mov al,110b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + ret + address_16bit_prefix: + cmp [code_type],16 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + ret + address_32bit_prefix: + cmp [code_type],32 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + instruction_prefix_ok: + ret +store_instruction_with_imm8: + mov [immediate_size],1 + call store_instruction + mov al,byte [value] + stos byte [edi] + ret +store_instruction_with_imm16: + mov [immediate_size],2 + call store_instruction + mov ax,word [value] + call mark_relocation + stos word [edi] + ret +store_instruction_with_imm32: + mov [immediate_size],4 + call store_instruction + mov eax,dword [value] + call mark_relocation + stos dword [edi] + ret diff --git a/programs/develop/koldbg/font.inc b/programs/develop/koldbg/font.inc new file mode 100644 index 0000000000..6852fd2f01 --- /dev/null +++ b/programs/develop/koldbg/font.inc @@ -0,0 +1,132 @@ +fontname equ 'font8x9.bmp' +virtual at 0 +file fontname,3Eh +; sanity check +load a1 word from 0 +load a2 dword from 0xE +if (a1 <> 'BM') | (a2 <> 0x28) +error 'not BMP file!' +end if +load a1 dword from 0x12 +load a2 dword from 0x16 +if (a1 and 0xF) | (a2 and 0xF) | (a1 > 16*16) +error 'font: invalid width or height' +end if +FontWidth = a1 shr 4 +font_bmp_scanline = (FontWidth*2 + 3) and not 3 +FontHeight = a2 shr 4 +load a1 dword from 0x1A +if a1 <> 0x10001 +error 'font: not monochrome bitmap' +end if +end virtual + +Font: +macro set_name_test a,b +{ +if %=a +font_data_#a = b +end if +} +macro set_name b +{ +set_name_test 1,b +set_name_test 2,b +set_name_test 3,b +set_name_test 4,b +set_name_test 5,b +set_name_test 6,b +set_name_test 7,b +set_name_test 8,b +set_name_test 9,b +set_name_test 10,b +set_name_test 11,b +set_name_test 12,b +set_name_test 13,b +set_name_test 14,b +set_name_test 15,b +set_name_test 16,b +} +macro db_name_test a +{ +if %=a +db font_data_#a +end if +} +macro db_name +{ +db_name_test 1 +db_name_test 2 +db_name_test 3 +db_name_test 4 +db_name_test 5 +db_name_test 6 +db_name_test 7 +db_name_test 8 +db_name_test 9 +db_name_test 10 +db_name_test 11 +db_name_test 12 +db_name_test 13 +db_name_test 14 +db_name_test 15 +db_name_test 16 +} +macro dw_name_test a +{ +if %=a +dw font_data_#a +end if +} +macro dw_name +{ +dw_name_test 1 +dw_name_test 2 +dw_name_test 3 +dw_name_test 4 +dw_name_test 5 +dw_name_test 6 +dw_name_test 7 +dw_name_test 8 +dw_name_test 9 +dw_name_test 10 +dw_name_test 11 +dw_name_test 12 +dw_name_test 13 +dw_name_test 14 +dw_name_test 15 +dw_name_test 16 +} +repeat FontHeight +cur_scan = % + repeat 16 + virtual at 0 + file fontname:3Eh + font_bmp_scanline*(FontHeight*(17-%)-cur_scan),FontWidth*2 + dd 0 + repeat 16 + load a1 dword from ((%-1)*FontWidth) shr 3 + a1 = ((a1 and 0x55555555) shl 1) or ((a1 and 0xAAAAAAAA) shr 1) + a1 = ((a1 and 0x33333333) shl 2) or ((a1 and 0xCCCCCCCC) shr 2) + a1 = ((a1 and 0x0F0F0F0F) shl 4) or ((a1 and 0xF0F0F0F0) shr 4) + a1 = (a1 shr (((%-1)*FontWidth) and 7)) and ((1 shl FontWidth) - 1) + a1 = a1 xor ((1 shl FontWidth) - 1) + set_name a1 + end repeat + end virtual + if FontWidth > 8 + repeat 16 + dw_name + end repeat + else + repeat 16 + db_name + end repeat + end if + end repeat +end repeat +purge set_name_test +purge db_name_test +purge dw_name_test +purge set_name +purge db_name +purge dw_name diff --git a/programs/develop/koldbg/font8x9.bmp b/programs/develop/koldbg/font8x9.bmp new file mode 100644 index 0000000000000000000000000000000000000000..fbdb17737ac9828d92b088cd85ee2bdf6722a300 GIT binary patch literal 2366 zcmb7Fzl+>P6xN_Z-by%byw!49gQN2Ds)54-r!*l|n*0HmHjpA+e98nSTWw$pXNZ@n z+~j`<+@fMmBrs(P6S(6HQ{EXhS%`W0M%wdU;&b9Wt!C$&_fv1aksf~hV3G~;0OJR^ zk8ppFTi_aGs~^E`WabR_O`@=Po)kj2N^7;jv?a;Bs;vw`Ho%5d%Pz0W5H^xyyfc?A zYbu~`q>tQZz$;y=u$0m;_wT`8u;sv&PxwQ`Gt@HCZ^koUevuOXLrP}l8R`EV6;8LC z3n?}tYbQ$0rJ~pXEY&2a17r-MJdyBLQ%_TAd%QkvE?M{wwW!LpXf>d_O4*M(o`%mv< z4gKk`1oy8#{qAr0UGzmU5yhmN2vHPUe~z1Ovq2{Y|Dt2)#iT3vN7*n9fd>Iq|66u^E?ceq6`%E7IveDL-13*}z1&F@XMR&{7z^Lq_`*I~!+ zO(m^;1eTBdb_Bk+`Ht`UX1*U>D_G`vnTbl{`J|LyBA~OYil$R*af+o#_=)OMzhEGx zQqF4cQ@<(!>_+|AujFoR2Y<{Kx8c7Qxj0Ml{qzj+#kJJKv^?9c6yv|^%OWmchkohcVw7yj&bIw>C^2DrH1vy{i=K0hYrsO+`fcsm)ujoH6Xlw; zo`Md(CY+y@vnXmH&|Yq9`{c&D*G z41=U^v)Rkm-aFv7jW})3WA^w}v`0;{ALG9nH#K literal 0 HcmV?d00001 diff --git a/programs/develop/koldbg/globals!.inc b/programs/develop/koldbg/globals!.inc new file mode 100644 index 0000000000..e71c2b9dfc --- /dev/null +++ b/programs/develop/koldbg/globals!.inc @@ -0,0 +1,118 @@ + +macro forward_list_builder name { + local c + macro .#name a& \{ + \local m + c equ m + macro m a + \} + macro name#List \{ + irpv v,c \\{ + ;\\forward + v + \\} + \} +} + +macro reverse_list_builder name { + local c + macro .#name a& \{ + \local m + c equ m + macro m a + \} + macro name#List \{ + irpv v,c \\{ + \\reverse + v + \\} + \} +} + +forward_list_builder IGlobalBlock +forward_list_builder SGlobalBlock +forward_list_builder TGlobalBlock +forward_list_builder UGlobalBlock +forward_list_builder VGlobalBlock +forward_list_builder XGlobalBlock + +;------------------------------------------------------------------ +; use "tglobal" for inserting TLS definitions. +;------------------------------------------------------------------ +macro tglobal { + .TGlobalBlock { } + +macro tglobal_nested { + .TGlobalBlock \{ } + +;------------------------------------------------------------------ +; use "vglobal" for inserting virtual definitions. +;------------------------------------------------------------------ +macro vglobal { + .VGlobalBlock { } + +macro vglobal_nested { + .VGlobalBlock \{ } + +;------------------------------------------------------------------ +; use "iglobal" for inserting initialized global data definitions. +;------------------------------------------------------------------ +macro iglobal { + .IGlobalBlock { } + +macro iglobal_nested { + .IGlobalBlock \{ } + +;------------------------------------------------------------------ +; use "sglobal" for inserting strings definitions. +;------------------------------------------------------------------ +macro sglobal { + .SGlobalBlock { } + +macro sglobal_nested { + .SGlobalBlock \{ } + +;------------------------------------------------------------- +; use 'uglobal' for inserting uninitialized global definitions. +; even when you define some data values, these variables +; will be stored as uninitialized data. +;------------------------------------------------------------- +macro uglobal { + .UGlobalBlock { } + +macro uglobal_nested { + .UGlobalBlock \{ } + +;------------------------------------------------------------- +; use 'xglobal' for inserting uninitialized global definitions. +; even when you define some data values, these variables +; will be stored as uninitialized data. +;------------------------------------------------------------- +macro xglobal { + .XGlobalBlock { } + +macro xglobal_nested { + .XGlobalBlock \{ } + +endg fix } ; Use endg for ending iglobal and uglobal blocks. +endg_nested fix \} + +macro IncludeGlobals MacroName +{ + local Begin,Size + virtual at $ + Begin = $ + MacroName + Size = $-Begin + end virtual + rb Size +} + +macro IncludeAllGlobals { + IGlobalBlockList + SGlobalBlockList +UDataStr: + IncludeGlobals UGlobalBlockList ;will be zeroed +UDataEnd: + IncludeGlobals XGlobalBlockList ;will be undefined +} diff --git a/programs/develop/koldbg/kernel.inc b/programs/develop/koldbg/kernel.inc new file mode 100644 index 0000000000..6ad77e5e83 --- /dev/null +++ b/programs/develop/koldbg/kernel.inc @@ -0,0 +1,3316 @@ +;----------------------------------------------------------------------------- +OS = 0 +Loader = 1 +;----------------------------------------------------------------------------- +SkipAddr = 8 +;----------------------------------------------------------------------------- +Bitness equ 32 +;----------------------------------------------------------------------------- +include "globals!.inc" +include "fasm\fasm.asm" +include "disasm\disasm32.asm" +if ~OS +include "loadmap.inc" +end if +include "assemble.inc" +;----------------------------------------------------------------------------- +xglobal +even 16 +StdMemStr rb 4*1024 +StdMemEnd: +AddMemStr rb 4*1024 +AddMemEnd: +endg +;----------------------------------------------------------------------------- +uglobal +even 16 +Inst TInstruction +even 16 +DefInst TInstruction +endg +;----------------------------------------------------------------------------- +virtual at 0 + dq ? +sizeof.dq = $ +end virtual +;---------------------------------------; +JccCalls: ; + seto al ; 0 + ret ; + setno al ; 1 + ret ; + setc al ; 2 + ret ; + setnc al ; 3 + ret ; + setz al ; 4 + ret ; + setnz al ; 5 + ret ; + setbe al ; 6 + ret ; + seta al ; 7 + ret ; + sets al ; 8 + ret ; + setns al ; 9 + ret ; + setpe al ; A + ret ; + setpo al ; B + ret ; + setl al ; C + ret ; + setge al ; D + ret ; + setle al ; E + ret ; + setg al ; F + ret ; +;----------------------------------------------------------------------------- +ShowCPU: + mov [XPos],3 + mov [YPos],0 + mov edx,Msg00 + call PrintS + movzx edx,[CPUType] + cmp dl,6 + jb @F + mov dl,6 + @@: + lea edx,[CPUTable+rdx*4] + jmp PrintS +;----------------------------------------------------------------------------- +ShowFPU: + movzx edx,[CPUType] + cmp dl,6 + jb @F + mov dl,6 + @@: + lea edx,[FPUTable+rdx*8] + jmp PrintS +;----------------------------------------------------------------------------- +DetectCPU: + mov dl,1 + push sp + pop ax + cmp ax,sp + jnz .RetCPU + inc edx + pushfw + pop ax + mov cx,ax + xor ah,40h + push ax + popfw + pushfw + pop ax + push cx + popfw + xor ah,ch + jz .RetCPU + inc edx + pushfd + pop eax + mov ecx,eax + btc eax,18 + push eax + popfd + pushfd + pop eax + push ecx + popfd + xor eax,ecx + jz .RetCPU + inc edx + mov eax,ecx + btc eax,21 + push eax + popfd + pushfd + pop eax + push ecx + popfd + xor eax,ecx + jz .RetCPU + inc edx + xor eax,eax + cpuid + test eax,eax + jz .RetCPU + xor eax,eax + inc eax + cpuid + mov dl,ah + and dl,0Fh +.RetCPU:ret +;----------------------------------------------------------------------------- +DetectFPU: + xor eax,eax + push ax + mov ebp,esp + fninit + fnstcw word [ebp] + mov dx,[ebp] + cmp dh,03h + jnz .Done ; done: no FPU present + inc eax + and word [ebp],0FF7Fh + wait + fldcw word [ebp] + fdisi + fstcw word [ebp] + wait + test byte [ebp],0080h + jnz .Done ; done: 8087 is present + inc eax + fninit + wait + fld1 + wait + fldz + wait + fdivp st1,st0 + wait + fld st0 + wait + fchs + wait + fcompp + wait + fnstsw ax + wait + fnclex + wait + sahf + jz .Done ; done: 80287 is present + inc eax + mov ah,[CPUType] + cmp ah,4 + jb .Done ; done: 80387 is present + mov al,ah ; done: 80487+ (build-in) +.Done: or al,al + jz .Exit + mov ecx,8 +.Loop: fldz ; set ST(0) to ST(7) to +ZERO + loop .Loop + finit ; reinitialize FPU +.Exit: pop dx + ret +;----------------------------------------------------------------------------- +ClearCmdLine: + mov [XPos],1 + mov [YPos],MinHeight-1 + mov [Color],7 + mov al,32 + mov ecx,[CurWidth] + sub ecx,2 +.Loop: call PrintC + loop .Loop + ret +;----------------------------------------------------------------------------- +PrintCmdLine: + call ClearCmdLine + mov [XPos],1 + lea edx,[Msg50] + jmp PrintS +;----------------------------------------------------------------------------- +Decode: push rax rcx rsi rdi + xor ecx,ecx + mov [Origin],rsi + mov rdi,rsi + @@: + mov rsi,rdi + add rsi,rcx + call GetDataByte + mov [rcx+BufferI],al + inc ecx + cmp cl,15 + jb @B + pop rdi rsi rcx rax + pushad + mov [DefInst.Addr],BufferI + mov [TheBufferO],BufferO + call DisAsmLine + mov [rsp+1Ch],rax + popad + add rsi,rax + ret +DisAsmLine: + push rbp + mov al,[CodeType] + mov ah,0 + cmp al,16 + jz @F + mov ah,1 + cmp al,32 + jz @F + mov ah,2 + @@: + mov [DefInst.Arch],ah + mov [DefInst.Emulated],-1 ;# + lea ebp,[Inst+128] + mov ecx,sizeof.TInstruction + lea esi,[DefInst] + lea edi,[Inst] + rep movsb + mov [SpaceSize],8 + call DisAsm + push rax + call PrnAsm + pop rax + pop rbp + ret +;----------------------------------------------------------------------------- +ShowText: +MakeText: + xor ebp,ebp + mov [CPUXPtr],ebp + mov rsi,[CodeAddr] + mov [AddrBuffer],rsi + mov [YPos],0 +.Loop: mov [Color],30h + mov [BufferO-1],byte 30h ;Default Color + inc [YPos] + mov [XPos],1 + call Decode + mov eax,[_EIP] + inc ebp + cmp [AddrBuffer+(rbp-1)*sizeof.dq],rax + jnz .1 + mov [CPUXPtr],ebp + mov [BufferO+SkipAddr+1],byte 10h ;'>>' + cmp [Inst.IsAddress],0 + je .1 + call CheckJump + cmp [JumpTaken],0 + jz .1 + mov [BufferO+SkipAddr+2*16+1],byte 18h + mov rax,[Inst.Arg1.Imm] + cmp rax,rsi + jbe .1 +.0: mov [BufferO+SkipAddr+2*16+1],byte 19h + +.1: mov [AddrBuffer+rbp*sizeof.dq],rsi + lea edx,[BufferO] + cmp byte [rdx-1],30h + jnz .2 + mov ax,'+' + xchg ax,[rdx+9+9] + cmp al,32 +ifz mov [rdx+9+9],al + call PrintS + add edx,9+15*2 + jmp .3 +.2: mov eax,edx +.N: cmp [eax],byte 32 + jz .F + inc eax + jmp .N +.F: mov [rax],byte 0 + sub eax,edx + cmp eax,(MinWidth-2) + jbe .X + mov [rdx+(MinWidth-2)],byte 0 +.X: add edx,43 + mov [Color],30h + mov [XPos],9+15*2-(9+9)+3 + call PrintS + sub edx,43 + mov al,[rdx-1] + mov [Color],al + mov [XPos],1 +.3: call PrintS + mov rax,[AddrBuffer+(rbp-1)*sizeof.dq] + call BChk + cmp ebp,28 + jb .Loop + ret +;----------------------------------------------------------------------------- +BChk: push rbp rbx rcx rsi rdi + xor ebp,ebp +.001: cmp [DrXBreak+rbp*4],eax + jnz .NotFound + push rax + mov esi,1 + movzx edi,[YPos] + mov ecx,[CurWidth] + sub ecx,25 + mov ax,7F00h + call Cursor + mov eax,ebp ; EBP = breakpoint number + shl eax,16 + add eax,60306023h ; show #X (X=BrkPnt) + add esi,ecx ; adjust X-pos + push rdx + mov edx,[CurWidth] + add edx,edx + imul edx,edi + lea esi,[rdx+rsi*2] + add esi,ConsoleDataPtr + mov [rsi],eax + pop rdx + pop rax +.NotFound: + inc ebp + cmp ebp,4 + jnz .001 + + push rax + call FindEnabledBreakPoint;FindBreakPoint + inc eax + jz .NoFound2 + mov esi,1 + movzx edi,[YPos] + mov ecx,[CurWidth] + sub ecx,21 + mov ax,7F00h + call Cursor +.NoFound2: + pop rax + + pop rdi rsi rcx rbx rbp + ret +;----------------------------------------------------------------------------- +CheckJump: + pushf + push rax rdx + pushf + and dword [rsp],$FFFFF700 + mov eax,[_EFL] + and eax,000008FFh + or [rsp],eax + mov rax,[Inst.SaveRSI] + movzx edx,byte [rax-2] + movzx eax,byte [rax-1] + mov [JumpTaken],ah ;ah=0 + cmp al,0xE8 + jz .2 + cmp al,0xE9 + jz .2 + cmp al,0xEB + jz .2 + cmp al,0xE0 ;LOOPNZ + jz .3 + cmp al,0xE1 ;LOOPZ + jz .4 + cmp al,0xE2 ;LOOP + jz .5 + cmp al,0xE3 ;JxCXZ + jz .6 + and al,7Fh ;70-7F + cmp al,0Fh ;0F80-0F8F + jbe .1 + sub al,70h + .1: + popf + lea eax,[JccCalls+rax*4] + call rax + mov [JumpTaken],al + pop rdx rax + popf + ret + .2: + mov [JumpTaken],1 + popf + pop rdx rax + popf + ret + .3: + popf + call JccCalls+5*4 + mov [JumpTaken],al + call TypeLoop + pop rdx rax + popf + ret + .4: + popf + call JccCalls+4*4 + mov [JumpTaken],al + call TypeLoop + pop rdx rax + popf + ret + .5: + popf + call TypeLoop + pop rdx rax + popf + ret + .6: + popf + call TypeJxCXZ + pop rdx rax + popf + ret +;----------------------------------------------------------------------------- +TypeJxCXZ: + cmp [CodeType],32 + jz JCXZ32 + cmp [CodeType],16 + jz JCXZ16 +if %B=64 + cmp dl,67h + jnz .1 + cmp [Reg.ECX],0 + jmp .2 +.1: cmp [Reg.RCX],0 +.2: setz [JumpTaken] +end if + ret +;----------------------------------------------------------------------------- +JCXZ16: cmp dl,67h + jz .1 + cmp word [_ECX],0 + setz [JumpTaken] + jmp .2 +.1: cmp [_ECX],0 + setz [JumpTaken] +.2: ret +;----------------------------------------------------------------------------- +JCXZ32: cmp dl,67h + jz .1 + cmp [_ECX],0 + setz [JumpTaken] + jmp .2 +.1: cmp word [_ECX],0 + setz [JumpTaken] +.2: ret +;----------------------------------------------------------------------------- +TypeLoop: + cmp [CodeType],32 + jz .32 + cmp [CodeType],16 + jz .16 +if %B=64 + mov rax,[_RCX] + cmp dl,67h ; check for ECX or RCX == 0 + jnz .1X + mov eax,eax +.1X: dec rax + setnz al + or [JumpTaken],al +end if + ret +.32: mov eax,[_ECX] + cmp dl,67h ; check for CX or ECX == 0 + jnz .1Y + movzx eax,ax +.1Y: dec eax + setnz al + or [JumpTaken],al + ret +.16: mov eax,[_ECX] + cmp dl,67h ; check for CX or ECX == 0 + jz .1Z + movzx eax,ax +.1Z: dec eax + setnz al + or [JumpTaken],al + ret +;----------------------------------------------------------------------------- +CPUCursor: + mov esi,[CPUXPos] + mov edi,[CPUYPos] + mov ecx,[CurWidth] + sub ecx,23 + mov ax,2F00h + call Cursor + mov eax,[CPUYPos] + mov rsi,[(rax-1)*sizeof.dq+AddrBuffer] + call Decode + call ShowAddress + ret +;----------------------------------------------------------------------------- +RegCursor: + mov esi,[RegXPos] + mov edi,[RegYPos] + mov ecx,[RegLDat] + jmp CursorXY +;----------------------------------------------------------------------------- +MemCursor: + mov esi,[MemXPos] + mov edi,[MemYPos] + mov ecx,2 + mov ax,2F00h + jmp Cursor +;----------------------------------------------------------------------------- +StkCursor: + mov esi,[StkXPos] + mov edi,[StkYPos] + mov ecx,20 + mov ax,2F00h + jmp Cursor +;----------------------------------------------------------------------------- +CursorXY: + pushad + mov eax,[CurWidth] + add eax,eax + imul eax,edi + lea esi,[rax+rsi*2] + add esi,ConsoleDataPtr +.Loop: mov al,[rsi+1] + cmp al,17h + jz .1 + cmp al,1Fh + jz .2 + cmp al,30h + jz .3 + cmp al,3Fh + jz .4 + jmp .Next +.1: mov al,3Fh + jmp .Next +.2: mov al,30h + jmp .Next +.3: mov al,1Fh + jmp .Next +.4: mov al,17h +.Next: mov [rsi+1],al + add esi,2 + dec cl + jnz .Loop + popad + ret +;----------------------------------------------------------------------------- +Cursor: push rcx rdx rsi + mov edx,eax + mov eax,[CurWidth] + add eax,eax + imul eax,edi + xchg edx,eax + lea esi,[rdx+rsi*2] + add esi,ConsoleDataPtr +.Loop: xor [rsi],ax + add esi,2 + dec cl + jnz .Loop + pop rsi rdx rcx + ret +;----------------------------------------------------------------------------- +ShowCursor: + mov ebp,CursorTab +GotoWindow: + mov ebx,[CurrentWindow] + and ebx,3 + jmp dword [rbp+rbx*4] +;----------------------------------------------------------------------------- +WindowSwitch: + test [CtrlState],3 + jz .1 + dec [CurrentWindow] + jmp .2 +.1: inc [CurrentWindow] +.2: and [CurrentWindow],3 + xor eax,eax +WinSwitch: + mov [AfterKey],1 + call ShowImage + mov ebp,WindowTab + jmp GotoWindow +;----------------------------------------------------------------------------- +DrawChar: + mov [rdi+rdx*2],ax + inc edx + ret +;----------------------------------------------------------------------------- +DrawLine: + mov [rdi+rdx*2],ax + inc edx + loop DrawLine + ret +;----------------------------------------------------------------------------- +DrawDown: + mov [rdi+rdx*2],ax + add edx,[CurWidth] + loop DrawDown + ret +;----------------------------------------------------------------------------- +PrintAL:push rdi + mov edi,HexBuf + call MakeHex + lea edi,[rdi+6] + jmp PrintHex +;----------------------------------------------------------------------------- +PrintAX:push rdi + mov edi,HexBuf + call MakeHex + lea edi,[rdi+4] + jmp PrintHex +;----------------------------------------------------------------------------- +PrintEAX: + push rdi + mov edi,HexBuf + call MakeHex +PrintHex: + push rdx + mov edx,edi + call PrintS + pop rdx rdi + ret +;----------------------------------------------------------------------------- +MakeHex:push rax rdx rsi + mov edx,3 +.Loop: mov esi,eax + and eax,$FF + mov ax,[rax*2+HexString] + mov [rdi+rdx*2],ax + mov eax,esi + shr eax,8 + sub edx,1 + jnc .Loop + pop rsi rdx rax + ret +;----------------------------------------------------------------------------- +DrawFrame: + mov ah,3Fh ; color + mov edi,ConsoleDataPtr + xor edx,edx + xor ecx,ecx + + mov al, 'É' + call DrawChar + mov al, 'Í' + mov cl,byte [CurWidth] + sub cl,2 + call DrawLine + mov al, '»' + call DrawChar + + mov al, 'º' ; left border + mov edx,[CurWidth] + mov cl,byte [CurHeight] + sub cl,2 + call DrawDown + mov al, 'È' + call DrawChar + mov al, 'º' ; right border + imul edx,[CurWidth],2 + dec edx + mov cl,byte [CurHeight] + sub cl,2 + call DrawDown + mov al, '¼' + call DrawChar + + mov al, 'Ç' + imul edx,[CurWidth],29 + call DrawChar + mov al, 'Ä' + mov cl,byte [CurWidth] + sub cl,2 + call DrawLine + mov al, '¶' + call DrawChar + + mov al, 'Ç' + imul edx,[CurWidth],40 + call DrawChar + mov al, 'Ä' + mov cl,byte [CurWidth] + sub cl,(2+45) + call DrawLine + mov al, '´' + call DrawChar + + mov al, 'Ç' + imul edx,[CurWidth],49 + call DrawChar + mov al, 'Ä' + mov cl,byte [CurWidth] + sub cl,2 + call DrawLine + mov al, '¶' + call DrawChar + + mov al, 'Â' + imul edx,[CurWidth],30 + sub edx,46 + call DrawChar + imul edx,[CurWidth],31 + sub edx,46 + mov al, '³' + mov cl,10 + call DrawDown + + imul edx,[CurWidth],40 + sub edx,46 + mov al, '³' + mov cl,10 + call DrawDown + + mov al, 'Ã' + imul edx,[CurWidth],46 + sub edx,46 + call DrawChar + mov al, 'Ä' + mov cl,44 + call DrawLine + mov al, '¶' + call DrawChar + mov al, 'Ñ' + mov edx,[CurWidth] + sub edx,22 + call DrawChar + + mov al, '³' + imul edx,[CurWidth],2 + sub edx,22 + mov cl,28 + call DrawDown + mov al, 'Á' + call DrawChar + + mov al, 'Ã' + imul edx,[CurWidth],42 + sub edx,46 + call DrawChar + mov al, 'Ä' + mov cl,44 + call DrawLine + mov al, '¶' + call DrawChar + + mov al, 'Ã' + imul edx,[CurWidth],34 + sub edx,46 + call DrawChar + mov al, 'Ä' + mov cl,44 + call DrawLine + mov al, '¶' + call DrawChar + + mov al, 'Ã' + imul edx,[CurWidth],38 + sub edx,46 + call DrawChar + mov al, 'Ä' + mov cl,44 + call DrawLine + mov al, '¶' + call DrawChar + mov al, '´' + imul edx,[CurWidth],41 + sub edx,46 + call DrawChar + mov al, 'Á' + imul edx,[CurWidth],50 + sub edx,46 + call DrawChar +if 1 + mov al, 'Ç' + imul edx,[CurWidth],MinHeight-2-(MSG_HEIGHT-1)-1 + call DrawChar + mov al, 'Ä' + mov cl,byte [CurWidth] + sub cl,2 + call DrawLine + mov al, '¶' + call DrawChar +end if + mov [Color],3Ah + call ShowCPU + call ShowFPU + mov [Color],3Ah + mov [XPos],3 + mov [YPos],29 + lea edx,[Msg10] + call PrintS + mov [Color],30h + mov [XPos],1 + inc [YPos] + lea edx,[Msg11] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg12] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg13] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg14] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg15] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg16] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg17] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg18] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg19] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[Msg20] + call PrintS + mov [XPos],3 + inc [YPos] + mov [Color],3Ah + lea edx,[Msg21] + call PrintS + mov eax,[CurWidth] + sub eax,43 + mov [XPos],al + mov [YPos],29 + lea edx,[MsgX2] + call PrintS + mov eax,[CurWidth] + sub eax,43 + mov [XPos],al + mov [YPos],33 + lea edx,[MsgX3] + call PrintS + mov eax,[CurWidth] + sub eax,43 + mov [XPos],al + mov [YPos],37 + lea edx,[MsgX4] + call PrintS + mov eax,[CurWidth] + sub eax,43 + mov [XPos],al + mov [YPos],41 + lea edx,[Msg22] + call PrintS + mov eax,[CurWidth] + sub eax,43 + mov [XPos],al + mov [YPos],45 + lea edx,[Msg23] + call PrintS + mov eax,[CurWidth] + sub eax,19 + mov [XPos],al + mov [YPos],0 + lea edx,[Msg30] + call PrintS + mov [XPos],3 + mov [YPos],MinHeight-2-(MSG_HEIGHT-1)-1 + lea edx,[Msg3M] + call PrintS + mov eax,[CurWidth] + sub eax,51-23 + mov [XPos],al + mov [YPos],MinHeight-2-(MSG_HEIGHT-1)-1 + lea edx,[Msg40] + call PrintS + + cmp [DebuggeePID],0 + jz .Exit + + call MakeText + btr dword [AfterKey],0 + jc .0 + + cmp [CPUXPtr],0 + jnz .1 + mov eax,[_EIP] + mov [CodeAddr],rax + mov [CPUYPos],1 +.0: + mov ebx,28 ;dY + mov ecx,[CurWidth] ;\dX + sub ecx,23 ;/ + mov esi,1 ;X + mov edi,1 ;Y + mov edx,3F203F20h + call ClearWindow + call MakeText + jmp .2 +.1: mov eax,[CPUXPtr] + mov [CPUYPos],eax + mov rsi,[AddrBuffer+(rax-1)*sizeof.dq] + call Decode + call ShowAddress +.2: + call ShowRegs + call ShowData + call ShowCursor +.Exit: + mov eax,PrintCmdLine + cmp [CmdLineActive],0 +ifnz mov eax,DrawCmdLine + call eax + + mov edx,Messages + push MSG_WIDTH + pop esi + xor ecx,ecx + @@: + mov eax,MinHeight-2-(MSG_HEIGHT-1) + add eax,ecx + mov [XPos],1 + mov [YPos],al + mov [Color],8Fh + xor ebp,ebp + .Loop: + mov al,[rdx+rbp] + cmp al,8 + jnz .NoColor + inc ebp + mov al,[rdx+rbp] + mov [Color],al + jmp .Next + .NoColor: + call PrintC + .Next: + inc ebp + cmp ebp,MSG_WIDTH + jnz .Loop + inc ecx + add edx,esi + cmp edx,Messages+MSG_WIDTH*MSG_HEIGHT + jb @B + + mov esi,[PrgNamePtr] + mov edi,HeaderE-61 + mov ecx,60 + @@: + lodsb + stosb + or al,al + loopnz @B + + mov eax,71 + mov ebx,2 + mov dl,1 ;CP866 + mov ecx,HeaderN + cmp [DebuggeePID],0 + jz @F + mov ecx,HeaderY + @@: int 40h + ret +;----------------------------------------------------------------------------- +ShowRegs: + call ShowGRegs + call ShowSRegs + call ShowXRegs + call ShowSlide +if 0 + jmp ShowMode +else + ret +end if +;----------------------------------------------------------------------------- +PrintC: push rax rdx rdi rbx + mov bl,byte [CurWidth] + mov bh,byte [CurHeight] + cmp al,09h + jz .09 + cmp al,0Ah + jz .0A + cmp al,0Dh + jz .0D + ; + mov edi,eax + movzx eax,[YPos] + mul [CurWidth] + movzx edx,[XPos] + add edx,eax + mov eax,edi + mov edi,ConsoleDataPtr + ; + mov ah,[Color] + mov [rdi+rdx*2],ax + inc [XPos] + cmp [XPos],bl + jb .Done + mov [XPos],0 + jmp .0A +.0D: pop rbx rdi rdx rax + mov [XPos],ah + ret +.09: and [XPos],$F8 + add [XPos],8 + cmp [XPos],bl + jb .Done + sub [XPos],bl +.0A: inc [YPos] + cmp [YPos],bh + jb .Done + mov [YPos],0 +.Done: pop rbx rdi rdx rax + ret +;----------------------------------------------------------------------------- +PrintS: push rax rdx + mov ah,[XPos] +.Loop: mov al,[rdx] + inc edx + test al,al + jz .Done + cmp al,08h + jz .1 + call PrintC + jmp .Loop +.1: mov al,[rdx] + inc edx + test al,al + jz .Done + mov [Color],al + jmp .Loop +.Done: pop rdx rax + ret +;----------------------------------------------------------------------------- +ShowGRegs: + mov dl,5 + mov [YPos],30 + mov [XPos],dl + lea rbp,[_EAX] + call DisplayIfChanged + lea rbp,[_EBX] + call DisplayIfChanged + lea rbp,[_ECX] + call DisplayIfChanged + lea rbp,[_EDX] + call DisplayIfChanged + lea rbp,[_ESI] + call DisplayIfChanged + lea rbp,[_EDI] + call DisplayIfChanged + lea rbp,[_EBP] + call DisplayIfChanged + lea rbp,[_ESP] +DisplayIfChanged: + mov rax,[rbp] + cmp rax,[rbp+Plus] + mov [Color],30h + jz @F + mov [Color],3Fh +@@: call PrintEAX + inc [YPos] + mov [XPos],dl + ret +;----------------------------------------------------------------------------- +ShowXRegs: + mov dl,18 + mov [YPos],30 + mov [XPos],dl + lea rbp,[_EFL] + call DisplayIfChanged + lea rbp,[_EIP] + call DisplayIfChanged + ret +;----------------------------------------------------------------------------- +ShowSlide: + mov [XPos],1 + mov [YPos],39 + mov esi,[_EFL] + mov edi,[_EFL+Plus] + shl esi,14 + shl edi,14 + call .Show ; VM-flag + call .Show ; RF-flag + shl esi,1 + shl edi,1 + call .Show ; NT-flag + call .Show ; IOPL-flag + dec [XPos] + call .Show + call .Show ; OF-flag + call .Show ; DF-flag + call .Show ; IF-flag + call .Show ; TF-flag + call .Show ; SF-flag + inc [XPos] + call .Show ; ZF-flag + shl esi,1 + shl edi,1 + call .Show ; AF-flag + shl esi,1 + shl edi,1 + call .Show ; PF-flag + shl esi,1 + shl edi,1 +.Show: xor ax,ax + shl esi,1 + adc al,'0' + shl edi,1 + adc ah,'0' + cmp al,ah + mov [Color],30h + jz .S1 + mov [Color],3Fh +.S1: call PrintC + inc [XPos] + ret +;----------------------------------------------------------------------------- +ShowSRegs: + mov dl,17 + mov [YPos],32 + mov eax,cs + call .DisplaySel + mov eax,ds + call .DisplaySel + mov eax,es + call .DisplaySel + mov eax,fs + call .DisplaySel + mov eax,gs + call .DisplaySel + mov eax,ss +.DisplaySel: + mov [Color],31h + mov [XPos],dl + call PrintAX + add [XPos],10 + lar eax,ax + shr eax,8 + call PrintAX + inc [YPos] + ret +;----------------------------------------------------------------------------- +ShowData: + mov bl,8 + mov [YPos],41 + mov [Color],30h + mov rsi,[DataAddr] + call ShowDataX + mov bl,3 + xor ebp,ebp + mov edi,[_EDX] + mov [YPos],30 + call ShowDataRDX + mov bl,3 + xor ebp,ebp + mov edi,[_EBX] + mov [YPos],34 + call ShowDataRBX + mov bl,3 + xor ebp,ebp + mov edi,[_ESI] + mov [YPos],42 + call ShowDataRSI + mov bl,3 + xor ebp,ebp + mov edi,[_EDI] + mov [YPos],46 + call ShowDataRDI + mov bl,3 + xor ebp,ebp + mov edi,[_EBP] + mov [YPos],38 + call ShowDataRBP + call ShowStack32 + call ShowFPURegs + cmp [MMXType],0 +ifnz call ShowMMXRegs + cmp [XMMType],0 +ifnz call ShowXMMRegs + ret +;----------------------------------------------------------------------------- +ShowDataX: +.1: mov [Color],30h + mov [XPos],1 + mov rax,rsi + call PrintEAX + mov al,':' + call PrintC + inc [XPos] + mov ecx,35 by 8 +.2: mov [Color],30h + call GetDataByte + jc .3 + lea eax,[Msg2ER] + xchg eax,edx + call PrintS + xchg eax,edx + mov al,'?' + jmp .5 +.3: call PrintAL + test al,al + jz .4 + cmp al,08h + jz .4 + cmp al,09h + jz .4 + cmp al,0Ah + jz .4 + cmp al,0Dh + jnz .5 +.4: mov al,'.' +.5: xchg [XPos],ch + call PrintC + xchg [XPos],ch + inc [XPos] + inc rsi + dec cl + jnz .2 + inc [YPos] + dec bl + jnz .1 + ret +;----------------------------------------------------------------------------- +ShowDataRSI: +.1: mov eax,[CurWidth] + sub eax,29+16 + mov [XPos],al + mov rax,rbp + test rbp,rbp + lea edx,[Msg2SIP] + jns .01 + lea edx,[Msg2SIM] + neg rax +.01: call PrintS + call PrintAL + mov al,']' + call PrintC + mov al,32 + test rbp,rbp + jnz .03 + mov al,10h +.03: call PrintC + inc [XPos] +.04: mov ecx,[CurWidth] + sub ecx,5+5 + shl ecx,8 + mov cl,8 +.2: lea rsi,[rdi+rbp] + mov al,3 ;ds + call GetDataByte + jc .3 + lea edx,[Msg2ER] + call PrintS + mov al,'?' + jmp .5 +.3: call PrintAL + test al,al + jz .4 + cmp al,08h + jz .4 + cmp al,09h + jz .4 + cmp al,0Ah + jz .4 + cmp al,0Dh + jnz .5 +.4: mov al,'.' +.5: xchg [XPos],ch + call PrintC + xchg [XPos],ch + inc [XPos] + inc rbp + dec cl + jnz .2 + inc [YPos] + dec bl + jnz .1 + ret +ShowDataRDI: +.1: mov eax,[CurWidth] + sub eax,29+16 + mov [XPos],al + mov rax,rbp + test rbp,rbp + lea edx,[Msg2DIP] + jns .01 + lea edx,[Msg2DIM] + neg rax +.01: call PrintS + call PrintAL + mov al,']' + call PrintC + mov al,32 + test rbp,rbp + jnz .03 + mov al,10h +.03: call PrintC + inc [XPos] +.04: mov ecx,[CurWidth] + sub ecx,5+5 + shl ecx,8 + mov cl,8 +.2: lea rsi,[rdi+rbp] + mov al,0 ;es + call GetDataByte + jc .3 + lea edx,[Msg2ER] + call PrintS + mov al,'?' + jmp .5 +.3: call PrintAL + test al,al + jz .4 + cmp al,08h + jz .4 + cmp al,09h + jz .4 + cmp al,0Ah + jz .4 + cmp al,0Dh + jnz .5 +.4: mov al,'.' +.5: xchg [XPos],ch + call PrintC + xchg [XPos],ch + inc [XPos] + inc rbp + dec cl + jnz .2 + inc [YPos] + dec bl + jnz .1 + ret +ShowDataRBX: +.1: mov eax,[CurWidth] + sub eax,29+16 + mov [XPos],al + mov rax,rbp + test rbp,rbp + lea edx,[Msg2BXP] + jns .01 + lea edx,[Msg2BXM] + neg rax +.01: call PrintS + call PrintAL + mov al,']' + call PrintC + mov al,32 + test rbp,rbp + jnz .03 + mov al,10h +.03: call PrintC + inc [XPos] +.04: mov ecx,[CurWidth] + sub ecx,5+5 + shl ecx,8 + mov cl,8 +.2: lea rsi,[rdi+rbp] + mov al,3 ;ds + call GetDataByte + jc .3 + lea edx,[Msg2ER] + call PrintS + mov al,'?' + jmp .5 +.3: call PrintAL + test al,al + jz .4 + cmp al,08h + jz .4 + cmp al,09h + jz .4 + cmp al,0Ah + jz .4 + cmp al,0Dh + jnz .5 +.4: mov al,'.' +.5: xchg [XPos],ch + call PrintC + xchg [XPos],ch + inc [XPos] + inc rbp + dec cl + jnz .2 + inc [YPos] + dec bl + jnz .1 + ret +;----------------------------------------------------------------------------- +ShowDataRDX: +.1: mov eax,[CurWidth] + sub eax,29+16 + mov [XPos],al + mov rax,rbp + test rbp,rbp + lea edx,[Msg2DXP] + jns .01 + lea edx,[Msg2DXM] + neg rax +.01: call PrintS + call PrintAL + mov al,']' + call PrintC + mov al,32 + test rbp,rbp + jnz .03 + mov al,10h +.03: call PrintC + inc [XPos] +.04: mov ecx,[CurWidth] + sub ecx,5+5 + shl ecx,8 + mov cl,8 +.2: lea rsi,[rdi+rbp] + mov al,3 ;ds + call GetDataByte + jc .3 + lea edx,[Msg2ER] + call PrintS + mov al,'?' + jmp .5 +.3: call PrintAL + test al,al + jz .4 + cmp al,08h + jz .4 + cmp al,09h + jz .4 + cmp al,0Ah + jz .4 + cmp al,0Dh + jnz .5 +.4: mov al,'.' +.5: xchg [XPos],ch + call PrintC + xchg [XPos],ch + inc [XPos] + inc rbp + dec cl + jnz .2 + inc [YPos] + dec bl + jnz .1 + ret +;----------------------------------------------------------------------------- +ShowDataRBP: +.1: mov eax,[CurWidth] + sub eax,29+16 + mov [XPos],al + mov rax,rbp + test rbp,rbp + lea edx,[Msg2BPP] + jns .01 + lea edx,[Msg2BPM] + neg rax +.01: call PrintS + call PrintAL + mov al,']' + call PrintC + mov al,32 + test rbp,rbp + jnz .03 + mov al,10h +.03: call PrintC + inc [XPos] +.04: mov ecx,[CurWidth] + sub ecx,5+5 + shl ecx,8 + mov cl,8 +.2: lea rsi,[rdi+rbp] + mov al,2 ;ss + call GetDataByte + jc .3 + lea edx,[Msg2ER] + call PrintS + mov al,'?' + jmp .5 +.3: call PrintAL + test al,al + jz .4 + cmp al,08h + jz .4 + cmp al,09h + jz .4 + cmp al,0Ah + jz .4 + cmp al,0Dh + jnz .5 +.4: mov al,'.' +.5: xchg [XPos],ch + call PrintC + xchg [XPos],ch + inc [XPos] + inc rbp + dec cl + jnz .2 + inc [YPos] + dec bl + jnz .1 + ret +;----------------------------------------------------------------------------- +GetSeg: mov edx,TDS + cmp [Inst.DefSeg],VSS +ifz mov edx,TSS + mov al,[Inst.CurSeg] + or al,al + jz .SkipSegm + cmp al,[Inst.DefSeg] + jz .SkipSegm + mov dx,[Inst.SegmName] +.SkipSegm: + mov dx,[rdx+Names] + ret +;----------------------------------------------------------------------------- +GetSegm:mov dx,TDS + cmp [Inst.DefSeg],VSS +ifz mov dx,TSS + mov al,[Inst.CurSeg] + or al,al + jz @F + cmp al,[Inst.DefSeg] + jz @F + mov dx,[Inst.SegmName] + @@: + mov al,0 + cmp dx,TES + jz @F + mov al,1 + cmp dx,TCS + jz @F + mov al,2 + cmp dx,TSS + jz @F + mov al,3 + cmp dx,TDS + jz @F + mov al,4 + cmp dx,TFS + jz @F + mov al,5 + @@: + ret +;----------------------------------------------------------------------------- +GetMemAddress: + ; + xor ebx,ebx + mov ecx,1 + ; + movzx eax,[Inst.Scale] + cmp al,-1 + jz @F + mov cl,[eax+AnScale] + @@: + movzx eax,[Inst.Base] + cmp al,-1 + jz @F + mov eax,[rax*4+RegVTab] + mov rax,[rax] + call Address2Reg + add rbx,rax + @@: + movzx eax,[Inst.Indx] + cmp al,-1 + jz @F + mov eax,[rax*4+RegVTab] + mov rax,[rax] + call Address2Reg + mul rcx + add rbx,rax + @@: + cmp [Inst.DispSize],0 + jz @F + mov rax,[Inst.Disp] + call Address2Reg + add rbx,rax + @@: + mov rax,rbx + call Address2Reg + mov rbx,rax + ret +;----------------------------------------------------------------------------- +ShowAddress: + ; + mov [Color],3Fh + mov [XPos],15 + mov [YPos],ch + mov al,0xCD + mov ecx,[CurWidth] + sub ecx,21+16+1 +.LoopX: call PrintC + loop .LoopX + ; + mov al,[Inst.Arg1.Mem] + or al,[Inst.Arg2.Mem] + or al,[Inst.Arg3.Mem] + or al,[Inst.Arg4.Mem] + or al,[Inst.Arg5.Mem] +ifz ret + ; + call GetSeg + mov [AddressStr],dx + ; + call GetMemAddress +if %B=64 + rol rax,32 + mov edi,AddressStr+3 + call MakeHex + rol rax,32 + mov edi,AddressStr+3+8 + call MakeHex +else + mov edi,AddressStr+3 + call MakeHex +end if + mov edi,AddressFin + + movzx edx,[Inst.RandSize] + and dl,7Fh + movzx ebp,[rdx*2+RndSize+0] + movzx ecx,[rdx*2+RndSize+1] + jrcxz .Exit + lea rsi,[rbx+rcx] + ; + cmp edx,3 + jnz @F + cmp [Inst.Point],0 + jz @F + mov bp,2+1 + mov cx,2+2 + @@: + ; + .Loop: + dec rsi + sub ebp,1 + jnz @F + mov [rdi],byte ':' + inc edi + @@: + mov [rdi],word '--' + call GetSegm + call GetDataByte + jnc @F + movzx eax,al + mov ax,[rax*2+HexString] + mov [rdi],ax + @@: + add edi,2 + loop .Loop + .Exit: + mov [rdi],word 'h' + + sub edi,AddressStr + mov eax,[CurWidth] + sub eax,24 + sub eax,edi +ifc ret + mov [XPos],al + mov [YPos],0 + mov [Color],3Fh + mov edx,AddressStr + jmp PrintS +;----------------------------------------------------------------------------- +Address2Reg: + cmp [Inst.Address],2 + jz @F + cmp [Inst.Address],1 + mov eax,eax + jz @F + movzx eax,ax + @@: + ret +;----------------------------------------------------------------------------- +sglobal +if %B=32 +AddressStr: db '??:xxxxxxxx = ' +AddressFin: db 64*2+2 dup 0 +else +AddressStr: db '??:xxxxxxxxxxxxxxxx = ' +AddressFin db 64*2+2 dup 0 +end if +endg +;----------------------------------------------------------------------------- +iglobal +RndSize db 0,0 ;NULL + db 0,1 ;TWORD + db 0,2 ;SWORD + db 0,4 ;DWORD + db 0,8 ;QWORD + db 0,16 ;XWORD + db 0,32 ;YWORD + db 0,52 ;ZWORD -> 64 too large + db 2+1,4+2;FWORD + db 2+1,8+2;TWORD +AnScale db 1,2,4,8 +endg +;----------------------------------------------------------------------------- +ClearWindow: + mov ebp,[CurWidth] + mov eax,edi + imul eax,ebp + add eax,eax + lea edi,[rax+rsi*2] + add edi,ConsoleDataPtr + mov eax,edx + lea edx,[rcx*2] +.Loop: push rcx + shr ecx,1 + rep stosd + adc cl,cl + rep stosw + pop rcx + sub esi,edx + sub edi,edx + lea esi,[rsi+rbp*2] + lea edi,[rdi+rbp*2] + dec ebx + jnz .Loop + ret +;----------------------------------------------------------------------------- +ShowStack32: + mov [YPos],28 + mov [Color],30h + mov cl,28 + mov edi,[_ESP] + add rdi,[StckAddr] +.1: mov rax,rdi + sub rax,[_ESP] + mov edx,Msg3SPP + jns .2 + neg rax + mov edx,Msg3SPM +.2: mov ebx,[CurWidth] + sub ebx,21 + mov [XPos],bl + call PrintS + call PrintAX + mov al,']' + call PrintC +.20: + cmp edi,[_ESP] + mov al,10h + jz .3 + cmp edi,[_EBP] + mov al,'>' + jz .3 + mov al,20h +.3: call PrintC + lea rsi,[rdi+3] +rept 3 +{ + call GetDataByte + dec rsi + shl rax,8 +} + call GetDataByte + add rdi,4 + call PrintEAX + ;lea edx,[Spaces32+6] + ;call PrintS + dec [YPos] + dec cl + jnz .1 + cmp [CurrentWindow],3 + jz ShowAddrStk + ret +ShowAddrStk: + mov eax,[CurWidth] + sub eax,51-23-9 + mov [XPos],al + mov [YPos],60-2-9+10 + mov [Color],3Fh + mov rax,[StckAddr] + add eax,[_ESP] + call PrintEAX + add [XPos],3 + mov rsi,rax + call GetDataByte + jc PrintAL + lea edx,[Msg2ER] + jmp PrintS +;----------------------------------------------------------------------------- +FindCodeUp: + mov rax,[AddrBuffer] + sub rax,16 ; average opcode length +.1: inc rax + mov rbx,rax + mov rsi,rax +.2: mov rsi,rbx + mov rdx,rbx + call Decode + cmp rbx,rsi + ja .Done + mov rbx,rsi + sub rsi,[AddrBuffer] + jb .2 +.Done: mov rax,rdx + ret +;----------------------------------------------------------------------------- +CPUWindow: + cmp ah,0x0F + jz WindowSwitch + cmp ah,0x3B ; F1 - Toggle Show + jz ToggleShow + cmp ah,0x3C ; F2 - Toggle BP + jz ToggleBP + cmp ah,0x3D ; F3 - Return To + jz ReturnTo + cmp ah,0x3E ; F4 - Here + jz ComeHere + cmp ah,0x40 ; F6 - New EIP + jz NewAddress + cmp ah,0x41 ; F7 - Trace + jz F7 + cmp ah,0x42 ; F8 - Step over + jz F8 + cmp ah,0x43 ; F9 - Proceed + jz Proceed + cmp ah,0x44 ; F10 - Jump over + jz JumpOver + cmp al,0xB1 + jz CPUDn + cmp al,0xB2 + jz CPUUp + cmp al,0xB4 + jz CPUHome + cmp al,0xB7 + jz CPUPgDn + cmp al,0xB8 + jz CPUPgUp + cmp ah,0x4B + jz CPULeft + cmp ah,0x4D + jz CPURight + cmp ah,0xE + jz CPUGoToMem +; + cmp al,'a' + jb .Skip1 + cmp al,'z' + jbe DoCommandLine + .Skip1: + ; + cmp al,'A' + jb .Skip2 + cmp al,'Z' + jbe DoCommandLine + .Skip2: +; + jmp WaitEvent +RegWindow: + cmp ah,0x0F + jz WindowSwitch + cmp ah,0x01 + jz SwitchCPU + cmp ah,0x3B ; F1 - Toggle Show + jz ToggleShow +; + cmp al,0xB1 ; dn + jz RegDn + cmp al,0xB2 ; up + jz RegUp + cmp al,0xB4 ; home + jz RegHome + cmp al,0xB5 ; end + jz RegEnd + cmp ah,0x4B ; left + jz RegLeft + cmp ah,0x4D ; right + jz RegRight + cmp al,'+' ; '+' + jz RegIncR + cmp al,'-' ; '-' + jz RegDecR + cmp al,'*' ; '*' + jz RegNot + cmp al,'/' ; '/' + jz RegRes + cmp ah,0xE ; BackSpace - GoTo MemAddr + jz RegGoToMem + cmp ah,0x39 ; Space + jz RegXor +; + cmp al,'a' + jb .Skip1 + cmp al,'z' + jbe DoCommandLine + .Skip1: + ; + cmp al,'A' + jb .Skip2 + cmp al,'Z' + jbe DoCommandLine + .Skip2: +; + jmp WaitEvent +MemWindow: + cmp ah,0x0F + jz WindowSwitch + cmp ah,0x01 + jz SwitchCPU + cmp ah,0x3B ; F1 - Toggle Show + jz ToggleShow +; + cmp al,0xB1 ; down + jz MemDn + cmp al,0xB2 ; up + jz MemUp + cmp ah,0x4B ; left + jz MemLeft + cmp ah,0x4D ; right + jz MemRight + cmp al,0xB4 ; home + jz MemHome + cmp al,0xB7 ; page-dn + jz MemPageDn + cmp al,0xB8 ; page-up + jz MemPageUp +; + cmp al,'+' + jz MemIncB + cmp al,'-' + jz MemDecB + cmp al,'*' + jz MemNotB + cmp al,'/' + jz MemResB +; + cmp al,'a' + jb .Skip1 + cmp al,'z' + jbe DoCommandLine + .Skip1: + ; + cmp al,'A' + jb .Skip2 + cmp al,'Z' + jbe DoCommandLine + .Skip2: +; + jmp WaitEvent +StkWindow: + cmp ah,0x0F + jz WindowSwitch + cmp ah,0x01 + jz SwitchCPU + cmp ah,0x3B ; F1 - Toggle Show + jz ToggleShow + ; + cmp al,0xB1 ; dn + jz StkDn + cmp al,0xB2 ; up + jz StkUp + cmp al,0xB4 ; home + jz StkHome + cmp al,0xB7 ; page-dn + jz StkPgDn + cmp al,0xB8 ; page-up + jz StkPgUp + cmp al,'+' ; '+' + jz StkIncV + cmp al,'-' ; '-' + jz StkDecV + cmp al,'*' ; '*' + jz StkNotV + cmp al,'/' ; '/' + jz StkResV + cmp al,0xE ; BackSpace - GoTo MemAddr + jz StkGoToMem +; + cmp al,'a' + jb .Skip1 + cmp al,'z' + jbe DoCommandLine + .Skip1: + ; + cmp al,'A' + jb .Skip2 + cmp al,'Z' + jbe DoCommandLine + .Skip2: +; + jmp WaitEvent +;----------------------------------------------------------------------------- +DoCommandLine: + mov [CmdLineActive],1 + jmp GetCommandLine +;----------------------------------------------------------------------------- +Proceed:call GoOn + jmp WaitEvent +;----------------------------------------------------------------------------- +SwitchCPU: + and [CurrentWindow],0 + jmp WinSwitch +;----------------------------------------------------------------------------- +ToggleShow: + xor [ShowNames],-1 + jmp CPUCommon +;----------------------------------------------------------------------------- +StkUp: mov eax,2 + cmp [CodeType],16 + je .1 + mov eax,4 + cmp [CodeType],32 + je .1 + mov eax,8 + .1: + add [StckAddr],rax + jmp StkCommon +;----------------------------------------------------------------------------- +StkDn: mov eax,2 + cmp [CodeType],16 + je .1 + mov eax,4 + cmp [CodeType],32 + je .1 + mov eax,8 + .1: + sub [StckAddr],rax + jmp StkCommon +;----------------------------------------------------------------------------- +StkPgUp:mov eax,2*4 + cmp [CodeType],16 + je .1 + mov eax,4*4 + cmp [CodeType],32 + je .1 + mov eax,8*4 + .1: + add [StckAddr],rax + jmp StkCommon +;----------------------------------------------------------------------------- +StkPgDn:mov eax,2*4 + cmp [CodeType],16 + je .1 + mov eax,4*4 + cmp [CodeType],32 + je .1 + mov eax,8*4 + .1: + sub [StckAddr],rax + jmp StkCommon +;----------------------------------------------------------------------------- +StkHome: + and [StckAddr],0 +StkCommon: + jmp CPUCommon +;----------------------------------------------------------------------------- +StkGetAddress: + mov rax,[StckAddr] + add eax,[_ESP] + ret +;----------------------------------------------------------------------------- +StkIncV:call StkGetAddress + mov rsi,rax + mov rdi,rax + call SafeLoadDD + inc rax + call SafeStoreDD + jmp StkCommon +;----------------------------------------------------------------------------- +StkDecV:call StkGetAddress + mov rsi,rax + mov rdi,rax + call SafeLoadDD + dec rax + call SafeStoreDD + jmp StkCommon +;----------------------------------------------------------------------------- +StkNotV:call StkGetAddress + mov rsi,rax + mov rdi,rax + call SafeLoadDD + not rax + call SafeStoreDD + jmp StkCommon +;----------------------------------------------------------------------------- +StkResV:call StkGetAddress + mov rdi,rax + xor eax,eax + call SafeStoreDD + jmp StkCommon +;----------------------------------------------------------------------------- +StkGoToMem: + call StkGetAddress + mov [DataAddr],rax + jmp StkCommon +;----------------------------------------------------------------------------- +RegUp: mov ebp,[RegXPtr] + dec ebp + jns RegCommon + jmp WaitEvent +;----------------------------------------------------------------------------- +RegDn: mov ebp,[RegXPtr] + inc ebp + cmp ebp,17 + jb RegCommon + jmp WaitEvent +;----------------------------------------------------------------------------- +RegLeft: + mov ebp,[RegXPtr] + sub ebp,8 + jns RegCommon + xor ebp,ebp + jmp RegCommon +;----------------------------------------------------------------------------- +RegRight: + mov ebp,[RegXPtr] + add ebp,8 + cmp ebp,17 + jb RegCommon + jmp WaitEvent +;----------------------------------------------------------------------------- +RegHome:xor ebp,ebp + jmp RegCommon +;----------------------------------------------------------------------------- +RegEnd: mov ebp,16 + jmp RegCommon +;----------------------------------------------------------------------------- +RegXor: mov ebp,[RegXPtr] + cmp ebp,17-8 + jae RegIncR.0 + jmp WaitEvent +;----------------------------------------------------------------------------- +RegIncR:mov ebp,[RegXPtr] + cmp ebp,17-8 + jb .1 +.0: mov eax,[RegRTab+rbp*4] + xor [_EFL],eax + jmp RegCommon +.1: mov eax,[RegRTab+rbp*4] + inc dword [rax] + jmp RegCommon +;----------------------------------------------------------------------------- +RegDecR:mov ebp,[RegXPtr] + cmp ebp,17-8 + jb .1 + mov eax,[RegRTab+rbp*4] + xor [_EFL],eax + jmp RegCommon +.1: mov eax,[RegRTab+rbp*4] + dec dword [rax] + jmp RegCommon +;----------------------------------------------------------------------------- +RegRes: mov ebp,[RegXPtr] + cmp ebp,17-8 + jb .1 + mov eax,[RegRTab+rbp*4] + not eax + and [_EFL],eax + jmp RegCommon +.1: mov eax,[RegRTab+rbp*4] + and dword [rax],0 + jmp RegCommon +;----------------------------------------------------------------------------- +RegNot: mov ebp,[RegXPtr] + cmp ebp,17-8 + jb .1 + mov eax,[RegRTab+rbp*4] + xor [_EFL],eax + jmp RegCommon +.1: mov eax,[RegRTab+rbp*4] + not dword [rax] + ;jmp RegCommon +RegCommon: + mov [RegXPtr],ebp + mov eax,RegXTab + movzx eax,byte [rax+rbp] + mov [RegXPos],eax + mov eax,RegYTab + movzx eax,byte [rax+rbp] + mov [RegYPos],eax + mov eax,RegLTab + movzx eax,byte [rax+rbp] + mov [RegLDat],eax + call SetContext + jmp CPUCommon +;----------------------------------------------------------------------------- +RegGoToMem: + mov ebp,[RegXPtr] + cmp ebp,9 + jae GoToMemRAX.Next + mov eax,[RegRTab+rbp*4] + mov rax,[rax] +GoToMemRAX: + mov [DataAddr],rax +.Next: jmp CPUCommon +;----------------------------------------------------------------------------- +MemUp: dec [MemYPos] + cmp [MemYPos],40 + ja MemCommon + inc [MemYPos] + sub [DataAddr],8 + jmp MemCommon +;----------------------------------------------------------------------------- +MemDn: inc [MemYPos] + cmp [MemYPos],49 + jb MemCommon + dec [MemYPos] + add [DataAddr],8 + jmp MemCommon +;----------------------------------------------------------------------------- +MemPageUp: + sub [DataAddr],8*8 + jmp MemCommon +;----------------------------------------------------------------------------- +MemPageDn: + add [DataAddr],8*8 + jmp MemCommon +;----------------------------------------------------------------------------- +MemLeft:sub [MemXPos],3 + cmp [MemXPos],11-3 + ja MemCommon + add [MemXPos],3*8 + jmp MemUp +;----------------------------------------------------------------------------- +MemRight: + add [MemXPos],3 + cmp [MemXPos],11-1+3*8 + jb MemCommon + sub [MemXPos],3*8 + jmp MemDn +;----------------------------------------------------------------------------- +MemHome:and [DataAddr],0 + mov [MemXPos],11 +MemCommon: + jmp CPUCommon +;----------------------------------------------------------------------------- +MemGetAddress: + xor edx,edx + mov ebx,3 + mov eax,[MemXPos] + sub al,11 + div ebx + add rax,[DataAddr] + mov ecx,[MemYPos] + sub cl,41 + add ecx,ecx + lea rax,[rax+rcx*8] + ret +;----------------------------------------------------------------------------- +MemIncB:call MemGetAddress + mov rsi,rax + mov rdi,rax + call GetDataByte + inc al + call SafeStore + jmp MemCommon +;----------------------------------------------------------------------------- +MemDecB:call MemGetAddress + mov rsi,rax + mov rdi,rax + call GetDataByte + dec al + call SafeStore + jmp MemCommon +;----------------------------------------------------------------------------- +MemNotB:call MemGetAddress + mov rsi,rax + mov rdi,rax + call GetDataByte + not al + call SafeStore + jmp MemCommon +;----------------------------------------------------------------------------- +MemResB:call MemGetAddress + mov rdi,rax + mov al,0 + call SafeStore + jmp MemCommon +;----------------------------------------------------------------------------- +ToggleBP: + mov eax,[CPUYPos] + mov rax,[AddrBuffer+(rax-1)*sizeof.dq] + push rax + call FindBreakPoint + mov edx,eax + inc eax + pop rax + jz .NotFound + mov eax,edx + call ClearBreakPoint + jmp .Ret +.NotFound: + mov bl,1 + call AddBreakPoint + jnc .Ret + mov esi,aBreakpointLimitExceeded + .SayErr: + call PutMessage + .Ret: + jmp CPUCommon +;----------------------------------------------------------------------------- +ReturnTo: + mov ecx,1024 ; try 1024 instructions + mov esi,[_EIP] +.0: mov ebp,esi + call Decode + mov eax,[BufferO+35+SkipAddr] + mov ebx,'iret' + cmp eax,ebx ; check for IRET + jz .1 + and eax,00FFFFFFh + mov ebx,00746572h ;' ter' + cmp eax,ebx ; check for RET + jz .1 + mov ebx,00706D6Ah ;' pmj' + cmp eax,ebx ; check for JMP + jz .1 + loop .0 + jmp WaitEvent +.1: call OnResume.Jmp + jmp WaitEvent +;----------------------------------------------------------------------------- +JumpOver: + mov esi,[_EIP] + call Decode + mov eax,[BufferO+35+SkipAddr] + cmp eax,'call' ; check for CALL + jz .DoIt + cmp eax,'loop' ; check for LOOP.. + jz .DoIt + and eax,00FFFFFFh + mov ebx,00746E69h ;' tni' + cmp eax,ebx ; check for INT + jz .DoIt + mov ebx,00706572h ;' per' + cmp eax,ebx ; check for REP + jz .DoIt + mov ebx,00706D6Ah ;' pmj' + cmp eax,ebx ; check for JMP + jz .DoIt + mov ebx,006F6E6Ah ;' onj' + cmp eax,ebx ; check for JNO + jz .DoIt + mov ebx,0065616Ah ;' eaj' + cmp eax,ebx ; check for JAE + jz .DoIt + mov ebx,007A6E6Ah ;' znj' + cmp eax,ebx ; check for JNZ + jz .DoIt + mov ebx,0065626Ah ;' ebj' + cmp eax,ebx ; check for JBE + jz .DoIt + mov ebx,00736E6Ah ;' snj' + mov ebx,00736E6Ah ;' snj' + cmp eax,ebx ; check for JNS + jz .DoIt + mov ebx,0065706Ah ;' epj' + cmp eax,ebx ; check for JPE + jz .DoIt + mov ebx,006F706Ah ;' opj' + cmp eax,ebx ; check for JPO + jz .DoIt + mov ebx,0065676Ah ;' egj' + cmp eax,ebx ; check for JGE + jz .DoIt + mov ebx,00656C6Ah ;' elj' + cmp eax,ebx ; check for JLE + jz .DoIt + and eax,0000FFFFh + mov ebx,00006F6Ah ;' oj' + cmp eax,ebx ; check for JO + jz .DoIt + mov ebx,0000626Ah ;' bj' + cmp eax,ebx ; check for JB + jz .DoIt + mov ebx,00007A6Ah ;' zj' + cmp eax,ebx ; check for JZ + jz .DoIt + mov ebx,0000616Ah ;' aj' + cmp eax,ebx ; check for JA + jz .DoIt + mov ebx,0000736Ah ;' sj' + cmp eax,ebx ; check for JS + jz .DoIt + mov ebx,00006C6Ah ;' lj' + cmp eax,ebx ; check for JL + jz .DoIt + mov ebx,0000676Ah ;' gj' + cmp eax,ebx ; check for JG + jz .DoIt + jmp F7 +.DoIt: mov ebp,esi + call OnResume.Jmp + jmp WaitEvent +;----------------------------------------------------------------------------- +ComeHere: + mov eax,[CPUYPos] + mov rax,[AddrBuffer+(rax-1)*sizeof.dq] + push eax + call FindEnabledBreakPoint + pop eax + jz .GoOn + mov bl,5 ; valid enabled one-shot + call AddBreakPoint + jnc .GoOn + mov esi,aBreakpointLimitExceeded + call PutMessage + jmp WaitEvent +.GoOn: call GoOn + jmp WaitEvent +;----------------------------------------------------------------------------- +NewAddress: + mov eax,[CPUYPos] + mov rax,[AddrBuffer+(rax-1)*sizeof.dq] + mov [_EIP],eax + call SetContext + jmp CPUCommon +;----------------------------------------------------------------------------- +CPUUp: cmp [CPUYPos],1 + jbe .1 + dec [CPUYPos] + mov ebx,[CPUYPos] + mov rsi,[AddrBuffer+(rbx-1)*sizeof.dq] + call Decode + jmp CPUCommon +.1: call FindCodeUp + mov [CodeAddr],rax + jmp CPUCommon +;----------------------------------------------------------------------------- +CPUDn: cmp [CPUYPos],28 + jae .1 + inc [CPUYPos] + mov ebx,[CPUYPos] + mov rsi,[AddrBuffer+(rbx-1)*sizeof.dq] + call Decode + jmp CPUCommon +.1: mov rax,[AddrBuffer+sizeof.dq] + mov [CodeAddr],rax + jmp CPUCommon +;----------------------------------------------------------------------------- +CPULeft:dec [CodeAddr] + jmp CPUCommon +;----------------------------------------------------------------------------- +CPURight: + inc [CodeAddr] + jmp CPUCommon +;----------------------------------------------------------------------------- +CPUPgUp:mov ecx,28 +.1: call FindCodeUp + mov [AddrBuffer],rax + loop .1 + mov [CodeAddr],rax + jmp CPUCommon +;----------------------------------------------------------------------------- +CPUPgDn:mov rsi,[AddrBuffer+27*sizeof.dq] + call Decode + mov [CodeAddr],rsi + jmp CPUCommon +;----------------------------------------------------------------------------- +CPUHome:mov eax,[_EIP] + mov [CodeAddr],rax + mov [CPUYPos],1 +CPUCommon: + mov [AfterKey],1 + call ShowImage + jmp WaitEvent +;----------------------------------------------------------------------------- +SafeLoadDD: + push rcx rsi + mov ecx,4 +.Loop: call GetDataByte + ror rax,8 + inc rsi + loop .Loop + pop rsi rcx + ret +;----------------------------------------------------------------------------- +CPUGoToMem: + mov eax,[CPUYPos] + mov rsi,[(rax-1)*sizeof.dq+AddrBuffer] + call Decode + mov al,[Inst.Arg1.Mem] + or al,[Inst.Arg2.Mem] + or al,[Inst.Arg3.Mem] + or al,[Inst.Arg4.Mem] + or al,[Inst.Arg5.Mem] + jnz .Mem + ; + mov rdx,[Inst.Arg1.Imm] + cmp [Inst.IsAddress],0 ;relative + jnz .Ofs + + cmp [Inst.MemSeparator],0 + jz .NoFar + mov ax,[Inst.Point] + cmp ax,TDWORD + jz .DW2 + cmp ax,TFWORD + jz .FW2 + .NoFar: + jmp WaitEvent + .DW2: + sub rsi,4 + call SafeLoadDD + movzx edx,ax + shr eax,16 + jmp .All + .FW2: + sub rsi,6 + call SafeLoadDD + mov edx,eax + add rsi,4 + call SafeLoadDD + movzx eax,ax + jmp .All + ; + .Mem: + ; + cmp [Inst.Point],0 + jz .Ptr + movzx edx,[Inst.RandSize] + and dl,7Fh + push rdx + call GetLinAddr + pop rdx + cmp dl,3 + jz .DW + cmp dl,8 + jz .FW + cmp dl,9 + jz .TW + jmp WaitEvent + .DW: + mov rsi,rax + call SafeLoadDD + movzx edx,ax + shr eax,16 + jmp .All + .FW: + mov rsi,rax + call SafeLoadDD + mov edx,eax + add rsi,4 + call SafeLoadDD + movzx eax,ax + jmp .All + .TW: + mov rsi,rax + call SafeLoadDD + mov rdx,rax + add rsi,8 + call SafeLoadDD + movzx eax,ax + .All: + ;verr eax + ;jnz .Err + ;mov [Reg.CS],eax + ;call SelectorInit + .Ofs: + mov [CodeAddr],rdx + mov [CPUYPos],1 +if 0 + call RepaintText + jmp ShowRegs +else + jmp CPUCommon +end if + .Err: + jmp WaitEvent + .Ptr: + call GetMemAddress + jmp GoToMemRAX +;----------------------------------------------------------------------------- +GetLinAddr: + call GetSeg + mov [AddressStr],dx + ; + xor ebx,ebx + mov ecx,1 + ; + movzx eax,[Inst.Scale] + cmp al,-1 + jz @F + mov cl,[rax+AnScale] + @@: + movzx eax,[Inst.Base] + cmp al,-1 + jz @F + mov eax,[rax*4+RegVTab] + mov rax,[rax] + call Address2Reg + add rbx,rax + @@: + movzx eax,[Inst.Indx] + cmp al,-1 + jz @F + mov eax,[rax*4+RegVTab] + mov rax,[rax] + call Address2Reg + mul rcx + add rbx,rax + @@: + cmp [Inst.DispSize],0 + jz @F + mov rax,[Inst.Disp] + call Address2Reg + add rbx,rax + @@: + mov rax,rbx + call Address2Reg + mov rbx,rax + AddSeg: +if 0 + call GetSegm + movzx eax,al + mov rax,[rax*sizeof.dq+ESBase] + add rax,rbx +end if + ret +;----------------------------------------------------------------------------- +ShowFPURegs: +if 1 + mov ah,3Fh + xor ecx,ecx + mov edi,ConsoleDataPtr + mov al, 'Â' + imul edx,[CurWidth],49+1 + sub edx,31 + call DrawChar + mov al, 'Ä' + mov cl,28 + call DrawLine + imul edx,[CurWidth],50+1 + sub edx,31 + mov al, '³' + mov cl,9 + call DrawDown + mov al, 'º' + imul edx,[CurWidth],55 + dec edx + call DrawChar + if 0 + mov al, 'À' + imul edx,[CurWidth],49+1+10 + sub edx,31 + call DrawChar + mov al, 'Ä' + mov cl,28+1 + call DrawLine + end if +end if + mov ebp,[CurWidth] + lea eax,[ebp-28] + mov [Color],3Ah + mov [XPos],al + mov [YPos],49 + lea edx,[Msg10F] + call PrintS + mov [Color],30h + lea eax,[ebp-30] + mov [XPos],al + mov [YPos],50 + lea edx,[Msg11F] + call PrintS + lea eax,[ebp-30] + mov [XPos],al + inc [YPos] + lea edx,[Msg12F] + call PrintS + lea eax,[ebp-30] + mov [XPos],al + inc [YPos] + lea edx,[Msg13F] + call PrintS + lea eax,[ebp-30] + mov [XPos],al + inc [YPos] + lea edx,[Msg14F] + call PrintS + lea eax,[ebp-30] + mov [XPos],al + inc [YPos] + lea edx,[Msg15F] + call PrintS + lea eax,[ebp-30] + mov [XPos],al + inc [YPos] + lea edx,[Msg16F] + call PrintS + lea eax,[ebp-30] + mov [XPos],al + inc [YPos] + lea edx,[Msg17F] + call PrintS + lea eax,[ebp-30] + mov [XPos],al + inc [YPos] + lea edx,[Msg18F] + call PrintS + lea eax,[ebp-30] + mov [XPos],al + inc [YPos] + lea edx,[Msg19F] + call PrintS + fninit ; reinitialize FPU +.1: lea eax,[ebp-26] + mov [XPos],al + mov [YPos],50 + xor edi,edi ; displacement + mov bl,8 ; counter + movzx eax,word [_FTW] + mov [Temp],eax + movzx eax,[_FSW] + shr eax,11 + and eax,07h + lea ecx,[rax*2] + ror word [Temp],cl +.Loop: ; + mov [Color],30h + mov eax,dword [_ST0+rdi] + cmp eax,dword [_ST0+rdi+Plus] + jnz .NotEQ + mov eax,dword [_ST0+rdi+4] + cmp eax,dword [_ST0+rdi+Plus+4] + jnz .NotEQ + mov ax,word [_ST0+rdi+8] + cmp ax,word [_ST0+rdi+Plus+8] + jz .YeaEQ +.NotEQ: mov [Color],3Fh +.YeaEQ: + mov eax,[Temp] + ror word [Temp],02h + and eax,0003h + cmp eax,0003h + jz .__ftoa_empty + fld tbyte [_ST0+rdi] + fxam + fstsw ax + mov al,ah +; C= 3 210 + and al,01000101b + jz .__ftoa_err ; unsupported number + cmp al,00000001b + jz .__ftoa_NaN ; NaN number + cmp al,00000101b + jz .__ftoa_inf ; infinity + cmp al,01000000b + jz .__ftoa_zero ; zero + cmp al,01000100b + jz .__ftoa_den ; denormal + cmp al,01000001b + jz .__ftoa_unu ; unused + cmp al,01000101b + jz .__ftoa_unu ; unused + mov eax,57 + call _float2dec + add eax,17 + mov edx,eax ; save exponent in edx + + sub esp,12 + fbstp tbyte [rsp] + mov cx,[rsp+8] + mov esi,[rsp+4] + mov ebp,[rsp+0] + add esp,12 + + mov bh,15 + and ch,80h + mov al,'+' + jz .2 + mov al,'-' +.2: call PrintC + call __ftoa_char + call PrintC + mov al,'.' + call PrintC +.3: call __ftoa_char + call PrintC + dec bh + jnz .3 + + mov al,'E' + call PrintC + test edx,edx + mov al,'+' + jns .4 + mov al,'-' + neg edx +.4: call PrintC + + mov bh,4 + mov eax,edx + xor ebp,ebp +.5: mov ecx,10 + xor edx,edx + idiv ecx + shl ebp,8 + or ebp,edx + dec bh + jnz .5 + + mov bh,4 +.6: mov eax,ebp + add al,30h + shr ebp,8 + call PrintC + dec bh + jnz .6 + +.Next: add edi,16 + mov eax,[CurWidth] + sub eax,26 + mov [XPos],al + inc [YPos] + dec bl + jnz .Loop + + mov eax,[CurWidth] + sub eax,27 + mov [XPos],al + mov [Color],30h + mov ax,[_FCW] ; CW + cmp ax,[_FCW+Plus] +ifnz mov [Color],3Fh + call PrintAX + add [XPos],5 + mov [Color],30h + mov ax,[_FSW] ; SW + cmp ax,[_FSW+Plus] +ifnz mov [Color],3Fh + call PrintAX + add [XPos],6 + mov [Color],30h + mov ax,word [_FTW] ; Tag + cmp ax,word [_FTW+Plus] +ifnz mov [Color],3Fh + call PrintAX + fwait + ret + +.__ftoa_err: + lea edx,[Msg1EF1] + jmp .__ftoa_ +.__ftoa_NaN: + and ah,00000010h + mov al,'+' + jz .__ftoa_NaN_ + mov al,'-' +.__ftoa_NaN_: + lea edx,[Msg1EF2] + mov [rdx],al + jmp .__ftoa_ +.__ftoa_inf: + and ah,00000010h + mov al,'+' + jz .__ftoa_inf_ + mov al,'-' +.__ftoa_inf_: + lea edx,[Msg1EF3] + mov [rdx],al + jmp .__ftoa_ +.__ftoa_zero: + and ah,00000010h + mov al,'+' + jz .__ftoa_zero_ + mov al,'-' +.__ftoa_zero_: + lea edx,[Msg1EF4] + mov [rdx],al + jmp .__ftoa_ +.__ftoa_den: + and ah,00000010h + mov al,'+' + jz .__ftoa_den_ + mov al,'-' +.__ftoa_den_: + lea edx,[Msg1EF5] + mov [rdx],al + jmp .__ftoa_ +.__ftoa_unu: + lea edx,[Msg1EF6] + jmp .__ftoa_ +.__ftoa_empty: + lea edx,[Msg1EF7] +.__ftoa_: + call PrintS + jmp .Next + +__ftoa_char: + mov al,cl + shl ebp,1 + rcl esi,1 + rcl cl,1 + shl ebp,1 + rcl esi,1 + rcl cl,1 + shl ebp,1 + rcl esi,1 + rcl cl,1 + shl ebp,1 + rcl esi,1 + rcl cl,1 + shr al,4 + add al,30h + ret + +_float2dec: + sub esp,3*4 + fstcw word [rsp] + mov word [rsp+2],03BFh + fldcw word [rsp+2] + mov [rsp+4],eax + fld st0 + fxtract + fstp st0 + fisubr dword [rsp+4] + fldl2t + fdivp st1,st0 + frndint + fist dword [rsp+8] + call _exp10 + fmulp st1,st0 + fldcw word [rsp] + mov eax,[rsp+2*4] + add esp,3*4 + neg eax + ret + +_exp10: fldl2t + fmulp st1,st0 +_exp2: sub esp,2*4 + fstcw word [rsp] + mov word [rsp+2],03BFh + fldcw word [rsp+2] + fld st0 + frndint + fxch + fsub st0,st1 + ftst + fstsw word [rsp+4] + and byte [rsp+5],45h + cmp byte [rsp+5],01h + ja .Err + je .Neg + f2xm1 + fld1 + faddp st1,st0 + fxch + fld1 + fscale + fmulp st2,st0 + fstp st0 + jmp .Done +.Neg: fabs + f2xm1 + fld1 + faddp st1,st0 + fxch + fld1 + fscale + fdivrp st2,st0 + fstp st0 +.Done: fldcw word [rsp] + add esp,2*4 + ret +.Err: fstp st0 + fstp st0 + fld1 + jmp .Done +;----------------------------------------------------------------------------- +ShowMMXRegs: +if 1 + mov ah,3Fh + xor ecx,ecx + mov edi,ConsoleDataPtr + mov al, 'Â' + imul edx,[CurWidth],49+1 + sub edx,52 + call DrawChar + imul edx,[CurWidth],50+1 + sub edx,52 + mov al, '³' + mov cl,9 + call DrawDown + mov al, 'º' + imul edx,[CurWidth],54 + dec edx + call DrawChar +end if + mov ebx,[CurWidth] + mov bh,bl + sub bh,47 + sub bl,51 + + mov [Color],3Ah + mov [XPos],bl + add [XPos],2 + mov [YPos],49 + lea edx,[MsgMMX] + call PrintS + mov [Color],30h + mov [XPos],bl + mov [YPos],50 + lea edx,[MsgMM0] + call PrintS + mov [XPos],bl + inc [YPos] + lea edx,[MsgMM1] + call PrintS + mov [XPos],bl + inc [YPos] + lea edx,[MsgMM2] + call PrintS + mov [XPos],bl + inc [YPos] + lea edx,[MsgMM3] + call PrintS + mov [XPos],bl + inc [YPos] + lea edx,[MsgMM4] + call PrintS + mov [XPos],bl + inc [YPos] + lea edx,[MsgMM5] + call PrintS + mov [XPos],bl + inc [YPos] + lea edx,[MsgMM6] + call PrintS + mov [XPos],bl + inc [YPos] + lea edx,[MsgMM7] + call PrintS + mov [XPos],bl + inc [YPos] + lea edx,[MsgXMMX] + call PrintS + inc [XPos] + add edx,4 + mov [Color],3Eh + call PrintS + mov [YPos],50 + mov bl,8 ; counter + lea esi,[_MM0] +.Skip: lea ecx,[_MM0+Plus] +.Loop: mov [XPos],bh + mov [Color],30h + mov eax,[rsi+0] + cmp eax,[rcx+0] + jne @F + mov eax,[rsi+4] + cmp eax,[rcx+4] + je .@ +@@: mov [Color],3Fh +.@: mov eax,[rsi+4] + call PrintEAX + mov eax,[rsi+0] + call PrintEAX + inc [YPos] + add esi,16 + add ecx,16 + dec bl + jnz .Loop + ret +;----------------------------------------------------------------------------- +ShowXMMRegs: + mov [Color],3Ah + mov [XPos],3 + mov [YPos],49 + lea edx,[MsgXMM] + call PrintS + mov [Color],30h + mov [XPos],1 + mov [YPos],50 + lea edx,[MsgXM0] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[MsgXM1] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[MsgXM2] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[MsgXM3] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[MsgXM4] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[MsgXM5] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[MsgXM6] + call PrintS + mov [XPos],1 + inc [YPos] + lea edx,[MsgXM7] + call PrintS + mov [YPos],50 + mov bl,8 ; counter + lea esi,[_XMM0] +.Skip: lea ecx,[_XMM0+Plus] +.Loop: mov [XPos],6 + mov [Color],30h + mov eax,[rsi+4*0] + cmp eax,[rcx+4*0] + jne @F + mov eax,[rsi+4*1] + cmp eax,[rcx+4*1] + jne @F + mov eax,[rsi+4*2] + cmp eax,[rcx+4*2] + jne @F + mov eax,[rsi+4*3] + cmp eax,[rcx+4*3] + je .@ +@@: mov [Color],3Fh +.@: mov eax,[rsi+4*3] + call PrintEAX + mov eax,[rsi+4*2] + call PrintEAX + mov eax,[rsi+4*1] + call PrintEAX + mov eax,[rsi+4*0] + call PrintEAX + inc [YPos] + add esi,16 + add ecx,16 + dec bl + jnz .Loop + mov [XPos],1 + lea edx,[MsgXCSR] + call PrintS + mov [XPos],1+6+9 + lea edx,[MsgMCSR] + call PrintS + mov [XPos],7 + mov eax,[_MXCSR] + cmp eax,[_MXCSR+Plus] + mov [Color],30h +ifnz mov [Color],3Fh + call PrintEAX + mov [XPos],7+9+11 + mov eax,[_MXCSRM] + cmp eax,[_MXCSRM+Plus] + mov [Color],30h +ifnz mov [Color],3Fh + call PrintEAX + ret +;----------------------------------------------------------------------------- +Msg10 db 'CPU Registers',0 +;----------------------------------------------------------------------------- +Msg11 db 'EAX 00000000 EFL 00000000 ',0 +Msg12 db 'EBX 00000000 EIP 00000000 ',0 +Msg13 db 'ECX 00000000 CS 0000/00000000/0000 ',0 +Msg14 db 'EDX 00000000 DS 0000/00000000/0000 ',0 +Msg15 db 'ESI 00000000 ES 0000/00000000/0000 ',0 +Msg16 db 'EDI 00000000 FS 0000/00000000/0000 ',0 +Msg17 db 'EBP 00000000 GS 0000/00000000/0000 ',0 +Msg18 db 'ESP 00000000 SS 0000/00000000/0000 ',0 +Msg19 db 'V R N IO O D I T S Z A P C ',0 +Msg20 db '0 0 0 00 0 0 0 0 0 0 0 0 0 ',0 +;----------------------------------------------------------------------------- +Msg22 db '[ds:esi]',0 +Msg23 db '[es:edi]',0 +MsgX2 db '[ds:edx]',0 +MsgX3 db '[ds:ebx]',0 +MsgX4 db '[ss:ebp]',0 +MsgX5 db '[ds:ecx]',0 +;----------------------------------------------------------------------------- +Msg2SIP db '[esi+',0 +Msg2SIM db '[esi-',0 +Msg2DIP db '[edi+',0 +Msg2DIM db '[edi-',0 +Msg2BXP db '[ebx+',0 +Msg2BXM db '[ebx-',0 +Msg2DXP db '[edx+',0 +Msg2DXM db '[edx-',0 +Msg2BPP db '[ebp+',0 +Msg2BPM db '[ebp-',0 +Msg3SPP db '[esp+',0 +Msg3SPM db '[esp-',0 +Msg2ER db '--',0 +;----------------------------------------------------------------------------- +Msg00 db 'CPU ',0 +CPUTable \ + dd '8086' + dd '186' + dd '286' + dd '386' + dd '486' + dd '586' + dd '686' +FPUTable \ + db '/None',0,0,0 + db '/8087',0,0,0 + dd '/287',0 + dd '/387',0 + dd '/487',0 + dd '/587',0 + dd '/687',0 +;----------------------------------------------------------------------------- +Msg21 db 'Memory',0 +;----------------------------------------------------------------------------- +Msg30 db 'Stack',0 +;----------------------------------------------------------------------------- +Msg3M db 'Messages',0 +;----------------------------------------------------------------------------- +Msg40 db 'Address: ',8,3Fh,'00000000 ',8,3Ah,'=',8,3Fh,' 00h',0 +;----------------------------------------------------------------------------- +Msg10F db 'FPU Registers',0 +Msg11F db 'ST0',0 +Msg12F db 'ST1',0 +Msg13F db 'ST2',0 +Msg14F db 'ST3',0 +Msg15F db 'ST4',0 +Msg16F db 'ST5',0 +Msg17F db 'ST6',0 +Msg18F db 'ST7',0 +Msg19F db 'CW=0000 SW=0000 TAG=0000',0 +;----------------------------------------------------------------------------- +MsgMMX db 'MMX Registers',0 +MsgMM0 db 'MM0',0 +MsgMM1 db 'MM1',0 +MsgMM2 db 'MM2',0 +MsgMM3 db 'MM3',0 +MsgMM4 db 'MM4',0 +MsgMM5 db 'MM5',0 +MsgMM6 db 'MM6',0 +MsgMM7 db 'MM7',0 +;----------------------------------------------------------------------------- +MsgXMM db 'XMM Registers',0 +MsgXM0 db 'XMM0',0 +MsgXM1 db 'XMM1',0 +MsgXM2 db 'XMM2',0 +MsgXM3 db 'XMM3',0 +MsgXM4 db 'XMM4',0 +MsgXM5 db 'XMM5',0 +MsgXM6 db 'XMM6',0 +MsgXM7 db 'XMM7',0 +;----------------------------------------------------------------------------- +Msg1EF1 db 'Unsupported ',0 +Msg1EF2 db '+NaN ',0 +Msg1EF3 db '+Infinity ',0 +Msg1EF4 db '+0.0 ',0 +Msg1EF5 db '+Denormal ',0 +Msg1EF6 db 'Unused ',0 +Msg1EF7 db 'Empty ',0 +;----------------------------------------------------------------------------- +MsgXMMX db 'CPU',0,'GenuineIntel',0 +;----------------------------------------------------------------------------- +MsgXCSR db 'MXCSR=',0 +MsgMCSR db 'MXCSR_MASK=',0 +;----------------------------------------------------------------------------- +Msg50 db 8,74h,'F1',8,70h,'-Show ' + db 8,74h,'F2',8,70h,'-BreakPnt ' + db 8,74h,'F3',8,70h,'-Return ' + db 8,74h,'F4',8,70h,'-Here ' + db 8,74h,'F5',8,70h,'-Screen ' + db 8,74h,'F6',8,70h,'-New ' + db 8,74h,'F7',8,70h,'-Trace ' + db 8,74h,'F8',8,70h,'-Step ' + db 8,74h,'F9',8,70h,'-Run ' + db 8,74h,'F10',8,70h,'-Over ' + db 0 +;----------------------------------------------------------------------------- +even 4 +RegVTab dd _EAX,_ECX,_EDX,_EBX,_ESP,_EBP,_ESI,_EDI,_EIP +RegRTab dd _EAX,_EBX,_ECX,_EDX,_ESI,_EDI,_EBP,_ESP,_EIP + dd 0800h,0400h,0200h,0080h,0040h,0010h,0004h,0001h +;----------------------------------------------------------------------------- +RegXTab db 1, 1, 1, 1, 1, 1, 1, 1, 14, 10,12,14,18, 21,23,25,27 +RegYTab db 30,31,32,33,34,35,36,37, 31, 39,39,39,39, 39,39,39,39 +RegLTab db 12,12,12,12,12,12,12,12, 12, 1, 1, 1, 1, 1, 1, 1, 1 +;----------------------------------------------------------------------------- +CursorTab dd CPUCursor,RegCursor,MemCursor,StkCursor +WindowTab dd CPUWindow,RegWindow,MemWindow,StkWindow +;----------------------------------------------------------------------------- +HexBuf: db 8 dup 20h,0 +;----------------------------------------------------------------------------- +XPos db 0 +YPos db 0 +Color db 7 +;----------------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/develop/koldbg/koldbg.asm b/programs/develop/koldbg/koldbg.asm new file mode 100644 index 0000000000..6ba047276c --- /dev/null +++ b/programs/develop/koldbg/koldbg.asm @@ -0,0 +1,2911 @@ + use32 + db 'MENUET01' + dd 1 + dd Start + dd I_END +MemSize dd Mem + dd StackTop + dd 0,AppPath + +VERSION equ '0.01+' + +;----------------------------------------------------------------------------- +Bitness equ 32 +;----------------------------------------------------------------------------- +bit equ 1 shl +by equ shl 8 + + +%B = 32 + +macro even Value { rb (Value-1)-($+Value-1) mod Value } + +macro ifc Opc& +{ +local ..L + jnc ..L + Opc +..L: +} + +macro ifa Opc& +{ +local ..L + jna ..L + Opc +..L: +} + +macro ifae Opc& +{ +local ..L + jnae ..L + Opc +..L: +} + +macro ifb Opc& +{ +local ..L + jnb ..L + Opc +..L: +} + +macro ifbe Opc& +{ +local ..L + jnbe ..L + Opc +..L: +} + +macro ifg Opc& +{ +local ..L + jng ..L + Opc +..L: +} + +macro ifge Opc& +{ +local ..L + jnge ..L + Opc +..L: +} + +macro ifl Opc& +{ +local ..L + jnl ..L + Opc +..L: +} + +macro ifle Opc& +{ +local ..L + jnle ..L + Opc +..L: +} + +macro ifno Opc& +{ +local ..L + jo ..L + Opc +..L: +} + +macro ifnp Opc& +{ +local ..L + jp ..L + Opc +..L: +} + +macro ifns Opc& +{ +local ..L + js ..L + Opc +..L: +} + +macro ifnz Opc& +{ +local ..L + jz ..L + Opc +..L: +} + +macro ifo Opc& +{ +local ..L + jno ..L + Opc +..L: +} + +macro ifp Opc& +{ +local ..L + jnp ..L + Opc +..L: +} + +macro ifs Opc& +{ +local ..L + jns ..L + Opc +..L: +} + +macro ifz Opc& +{ +local ..L + jnz ..L + Opc +..L: +} + +macro lea Dst,Src +{ +local ..L,..H +virtual at 0 + mov al,byte Src +load ..L byte from 0x0 +if ..L = 0xA0 + load ..H dword from 0x1 +end if +end virtual +if ..L = 0xA0 + mov Dst,..H +else + lea Dst,Src +end if +} + +include 'kosfuncs.inc' +include '../../macros.inc' + +include 'font.inc' +include 'tools.inc' +include 'kernel.inc' + +virtual at rsp +All: +.edi dd ? +.esi dd ? +.ebp dd ? +.res dd ? +.ebx dd ? +.edx dd ? +.ecx dd ? +.eax dd ? +end virtual + +macro jecxnz Target +{ + inc ecx + loop Target +} + +TestFile db '/rd/1/develop/scancode',0 + +MinWidth = 90 +MaxWidth = 255 +MinHeight = 75 +MaxHeight = 255 + +DATA_WIDTH = 88 ; in characters, multiple of 4 + +CMD_WIDTH = DATA_WIDTH + +CursorNormSize = 2 +CursorBigsSize = FontHeight + +;----------------------------------------------------------------------------- +; Fast load test file event +DoLoad: mov esi,TestFile + mov edi,LoadName + jmp OnLoadInit +;----------------------------------------------------------------------------- +; Load executable event +OnLoad: mov esi,[CurArg] +OnLoadInit: + mov edi,LoadName + or [PrgNameLen],-1 + mov [PrgNamePtr],edi + .CopyName: + lodsb + stosb + inc [PrgNameLen] + cmp al,'/' + jnz @F + or [PrgNameLen],-1 + mov [PrgNamePtr],edi + @@: + cmp al,' ' + ja .CopyName + mov byte [edi-1],0 + and [LoadParams],0 + dec esi + call GetArg.SkipSpaces + cmp al,0 + jz @F + mov [LoadParams],esi + @@: + ;and [DumpPos],0 + mov ecx,[Symbols] + jecxz DoReLoad + mcall 68,13 + and [Symbols],0 + and [NumSymbols],0 +DoReLoad: + mcall 18,7 + mov [DbgWnd],eax + xchg ecx,eax + mcall 70,FN70LoadBlock + test eax,eax + jns .Loaded + + .LoadErr: + push eax + mov esi,LoadErrMsg + call PutMessage + pop eax + not eax + cmp eax,0x20 + jae .UnkErr + mov esi,[LoadErrMsgs+eax*4] + test esi,esi + jnz PutMessage + + .UnkErr: + mov esi,UnkErrMsg + inc eax + push eax + call PutMessageNoDraw + jmp DrawMessages + +.Loaded: + mov [DebuggeePID],eax + mov [bSuspended],1 + mcall 5,20 + push ecx + call GetContext + mov edi,OldContext + mov ecx,(CtxEnd-Context)/4 + rep movsd + ; activate debugger window + pop ecx + mcall 18,3 + call GetDump +if 1 + push dword [ShowNames] + mov [ShowNames],-1 +end if + mov [AfterKey],0 + call ShowImage + mov esi,LoadSuccMsg + push [DebuggeePID] + call PutMessageNoDraw + call DrawMessages + ; try to load symbols + mov esi,LoadName + mov edi,SymbolsFile + push edi + @@: + lodsb + stosb + test al,al + jnz @B + lea ecx,[edi-1] + @@: + dec edi + cmp edi,SymbolsFile + jb @F + cmp byte [edi],'/' + jz @F + cmp byte [edi],'.' + jnz @B + mov ecx,edi + @@: + mov dword [ecx],'.dbg' + mov byte [ecx+4],0 + pop esi + mov ebp,esi + push ecx esi + call OnLoadSymbols.Silent ; Try to load .dbg file + pop esi ecx + xor eax,eax + cmp [NumSymbols],eax + jne @F + mov dword [ecx],'.map' ; If failed, try .map file too + call OnLoadSymbols.Silent + @@: +if 1 + pop eax + mov [ShowNames],al + call DrawMessages +end if + ret + +;----------------------------------------------------------------------------- +; Working with debug context +GetNewContext: + mov esi,Context + mov edi,OldContext + mov ecx,(CtxEnd-Context)/4 + rep movsd + +GetContext: + mcall 69,1,[DebuggeePID],CtxEnd-Context,Context + ret + +SetContext: + mcall 69,2,[DebuggeePID],28h,Context + ret + +;----------------------------------------------------------------------------- +; Resume process event +DoResume: + mcall 69,5,[DebuggeePID] + mov [bSuspended],0 + ret + +;----------------------------------------------------------------------------- +; Breakpoints manipulation +OnBp: mov esi,[CurArg] + call CalcExpression + jc .Ret + xchg eax,ebp + push eax + call FindBreakPoint + inc eax + pop eax + jz .NotFound + mov esi,aDuplicateBreakpoint + jmp .SayErr + .NotFound: + mov bl,1 + call AddBreakPoint + jnc .Ret + mov esi,aBreakpointLimitExceeded + .SayErr: + call PutMessage + .Ret: + jmp DrawMessages;DrawDisAsm + +;----------------------------------------------------------------------------- +; Dump memory event +OnDump: mov esi,[CurArg] + cmp byte [esi],0 + jnz .Param + ;add [DumpPos],DUMP_HEIGHT*10h + add [DataAddr],8*8 + jmp .DoIt + + .Param: + call CalcExpression + jc .Ret + ;mov [DumpPos],ebp + mov [DataAddr],ebp + .DoIt: + ;call GetDump + ;call DrawDump.Redraw + call DrawMessages + .Ret: + ret + +OnBpmb: mov dh,0011b + jmp DoBpm + +OnBpmw: mov dh,0111b + jmp DoBpm + +OnBpmd: mov dh,1111b + +DoBpm: mov esi,[CurArg] + cmp byte [esi],'w' + jnz @F + and dh,not 2 + inc esi + @@: + push edx + call CalcExpression + pop edx + jnc @F + ret + ; ebp = expression, dh = flags + @@: + movzx eax,dh + shr eax,2 + test ebp,eax + jz @F + mov esi,aUnaligned + jmp PutMessage + @@: + mov eax,ebp + mov bl,0Bh + call AddBreakPoint + jnc @F + mov esi,aBreakpointLimitExceeded + jmp PutMessage + ; now find index + @@: + push eax + xor ecx,ecx + .L1: + cmp [DrXBreak+ecx*4],0 + jnz .L2 + push ecx + mov dl,cl + mov esi,ebp + mcall 69,9,[DebuggeePID] + test eax,eax + jz .OK + pop ecx + .L2: + inc ecx + cmp ecx,4 + jb .L1 + pop eax + call ClearBreakPoint + mov esi,aBreakpointLimitExceeded + jmp PutMessage + .OK: + pop ecx + pop eax + and byte [edi],not 2 ; breakpoint is enabled + shl dl,6 + or dl,dh + mov byte [edi+1],dl + inc eax + mov [DrXBreak+ecx*4],eax + ret + +OnBc: mov esi,[CurArg] + @@: + call GetHexNumber + jc OnBp.Ret + call ClearBreakPoint + jmp @B +OnBd: + mov esi,[CurArg] + @@: + call GetHexNumber + jc OnBp.Ret + call DisableBreakPoint + jmp @B +OnBe: + mov esi,[CurArg] + @@: + call GetHexNumber + jc OnBp.Ret + push eax + call FindEnabledBreakPoint + pop eax + jz .Err + call EnableBreakPoint + jmp @B + .Err: + mov esi,OnBeErrMsg + jmp PutMessage + +GetHexNumber: + call GetArg.SkipSpaces + xor ecx,ecx + xor edx,edx + @@: + lodsb + call IsHexDigit + jc .Ret + shl edx,4 + or dl,al + inc ecx + jmp @B + .Ret: + dec esi + cmp ecx,1 + xchg eax,edx + ret + +;----------------------------------------------------------------------------- +; Breakpoints list event +OnBl: mov esi,[CurArg] + cmp byte [esi],0 + jz .ListAll + call GetHexNumber + jc .Ret + cmp eax,BreakPointsN + jae .Err + push eax + add eax,eax + lea edi,[BreakPoints+eax+eax*2] + pop eax + test byte [edi+4],1 + jz .Err + call ShowBreakInfo + .Ret: + ret + .Err: + mov esi,aInvalidBreak + jmp PutMessage + + .ListAll: + mov edi,BreakPoints + xor eax,eax + @@: + test byte [edi+4],1 + jz .Cont + push edi eax + call ShowBreakInfo + pop eax edi + .Cont: + add edi,6 + inc eax + cmp eax,BreakPointsN + jb @B + ret + +ShowBreakInfo: + push edi + test byte [edi+4],8 + jnz .DR + push dword [edi] + push eax + mov esi,aBreakNum + call PutMessageNoDraw + jmp .CMN + .DR: + push eax + mov esi,aMemBreak1 + call PutMessageNoDraw + pop edi + push edi + mov esi,aMemBreak2 + test byte [edi+5],2 + jz @F + mov esi,aMemBreak3 + @@: + call PutMessageNoDraw + pop edi + push edi + mov esi,aMemBreak6 + test byte [edi+5],8 + jnz @F + mov esi,aMemBreak5 + test byte [edi+5],4 + jnz @F + mov esi,aMemBreak4 + @@: + call PutMessageNoDraw + pop edi + push edi + push dword [edi] + mov esi,aMemBreak7 + call PutMessageNoDraw + .CMN: + pop edi + test byte [edi+4],2 + jz @F + push edi + mov esi,aDisabled + call PutMessageNoDraw + pop edi + @@: + test byte [edi+4],4 + jz @F + mov esi,aOneShot + call PutMessageNoDraw + @@: + mov esi,NewLine + jmp PutMessage + +;----------------------------------------------------------------------------- +; Unpack executable event +OnUnpack: + ; program must be loaded - checked when command was parsed + ; program must be stopped + mov esi,aRunningErr + cmp [bSuspended],0 + jz PutMessage + ; all breakpoints must be disabled + mov edi,BreakPoints + @@: + test byte [edi+4],1 + jz .Cont + test byte [edi+4],2 + jnz .Cont + mov esi,aEnabledBreakErr + jmp PutMessage + .Cont: + add edi,6 + cmp edi,BreakPoints+BreakPointsN*6 + jb @B + ; ok, now do it + ; set breakpoint on 0xC dword access + push 9 + pop ebx + mov ecx,[DebuggeePID] + mov dx,1111b*256 + push 0xC + pop esi + @@: + mcall 69 + test eax,eax + jz .BreakOK + inc edx + cmp dl,4 + jb @B + .BreakOK: + call GoOn + ; now wait for event + .Wait: + mcall 10 + dec eax + jz .Redraw + dec eax + jz .Key + dec eax + jnz .Debug + ; button; we have only one button, close + or eax,-1 + mcall + + .Redraw: + mov [DoDraw],1 + call DrawWindow + jmp .Wait + + .Key: + mov al,2 + mcall + cmp ah,3 ; Ctrl+C + jnz .Wait + + .UserBreak: + mov esi,aInterrupted + .X1: + push edx esi + call PutMessage + pop esi edx + or dh,80h + mcall 69,9,[DebuggeePID] + cmp esi,aUnpacked + jnz OnSuspend + jmp AfterSuspend + + .Debug: + cmp [DbgBufLen],4*3 + jnz .NotOur + cmp dword [DbgBuf],3 + jnz .NotOur + test byte [DbgBuf+8],1 + jnz .Our + + .NotOur: + mov esi,aInterrupted + push edx + call PutMessage + pop edx + or dh,80h + mcall 69,9,[DebuggeePID] + jmp DebugMsg + + .Our: + and [DbgBufLen],0 + push edx + call GetContext + push eax + mcall 69,6,[DebuggeePID],4,0xC,esp + pop eax + pop edx + cmp eax,[_EIP] + jz .Done + call DoResume + jmp .Wait + + .Done: + mov esi,aUnpacked + jmp .X1 + +;----------------------------------------------------------------------------- +; Calculate expression event +OnCalc: mov esi,[CurArg] + call CalcExpression + jc .Ret + push ebp + mov esi,CalcString + call PutMessageNoDraw + jmp DrawMessages + .Ret: + ret + +;----------------------------------------------------------------------------- +; Access to register value event +OnReg: mov esi,[CurArg] + call GetArg.SkipSpaces + call FindReg + jnc @F + .Err: + mov esi,RSyntax + jmp PutMessage + @@: + call GetArg.SkipSpaces + test al,al + jz .Err + cmp al,'=' + jnz @F + inc esi + call GetArg.SkipSpaces + test al,al + jz .Err + @@: + push edi + call CalcExpression + pop edi + jc .Ret + ; now edi=register id, ebp=value + cmp [bSuspended],0 + mov esi,aRunningErr + jz PutMessage + xchg eax,ebp + cmp edi,24 + jz .EIP + sub edi,4 + jb .8LO + sub edi,4 + jb .8HI + sub edi,8 + jb .16 + mov [_EAX+edi*4],eax + jmp .Ret + .16: + mov word [_EAX+(edi+8)*4],ax + jmp .Ret + .8LO: + mov byte [_EAX+(edi+4)*4],al + jmp .Ret + .8HI: + mov byte [_EAX+(edi+4)*4+1],al + jmp .Ret + .EIP: + mov [_EIP],eax + ;call UpdateDisAsmEIP + .Ret: + call SetContext + jmp DrawMessages;DrawRegisters.ReDraw + +;----------------------------------------------------------------------------- +; Step execution event +;Here we get [] argument at do step times +OnStepMultiple: + cmp [bSuspended],0 + jz OnStep.Running + mov [StepNum],1 + mov esi,[CurArg] + test esi,esi + jz .Do + cmp byte [esi],0 + jz .Do + call GetHexNumber + jc .Ret + or eax,eax ; check if lesser or equal than 0 + jle .Ret + mov [StepNum],eax +.Do: call OnStep + dec [StepNum] + jnz .Do +.Ret: ret + +OnStep: + cmp [bSuspended],0 + jz .Running + call GetContext + or byte [_EFL+1],1 ; set TF + call SetContext + and byte [_EFL+1],not 1 + ; if instruction at eip is "int xx", set one-shot breakpoint immediately after + mov eax,[_EIP] + call FindEnabledBreakPoint + jnz @F + cmp byte [edi+5],0xCD + jz .Int + @@: + push 0 + mcall 69,6,[DebuggeePID],3,[_EIP],esp + cmp eax,edx + pop eax + jnz .DoIt + cmp al,0xCD + jz .Int + cmp ax,0x050F + jz .SysCall + cmp ax,0x340F + jz .SysEnter + ; resume process + .DoIt: + call GoOn + cmp [bAfterGo],0 + jz @F + mov [bAfterGo],2 + @@: + ret + + ; return address is [ebp-4] + .SysEnter: + push 0 + inc edx ; read 4 bytes + mov esi,[_EBP] + sub esi,4 + mcall 69 + cmp eax,edx + pop eax + jnz .SysCall + push eax + and byte [_EFL+1],not 1 + call SetContext + pop eax + jmp @F + + .SysCall: + and byte [_EFL+1],not 1 ; clear TF - avoid system halt (!) + call SetContext + .Int: + mov eax,[_EIP] + inc eax + inc eax + @@: + push eax + call FindEnabledBreakPoint + pop eax + jz .DoIt + ; there is no enabled breakpoint yet; set temporary breakpoint + mov bl,5 + call AddBreakPoint + jmp .DoIt + + .Running: + mov esi,aRunningErr + jmp PutMessage + +;----------------------------------------------------------------------------- +; Proceed process event +;Here we get [] argument at do step times +OnProceedMultiple: + cmp [bSuspended],0 + jz OnStep.Running + mov [ProcNum],1 + mov esi,[CurArg] + test esi,esi + jz .Do + cmp byte [esi],0 + jz .Do + call GetHexNumber + jc .Ret + or eax,eax ; check if lesser or equal than 0 + jle .Ret + mov [ProcNum],eax + and [CurArg],0 +.Do: + call OnProceed + dec [ProcNum] + jnz .Do +.Ret: + ret + +OnProceed: + cmp [bSuspended],0 + jz OnStep.Running + mov esi,[_EIP] + + @@: + call GetByteNoBreak + jc OnStep + inc esi + ; skip prefixes + call IsPrefix + jz @B + cmp al,0xE8 ; call + jnz @f + add esi,4 + jmp .DoIt + + ; A4,A5 = movs; A6,A7 = cmps + @@: + cmp al,0xA4 + jb @F + cmp al,0xA8 + jb .DoIt + + ; AA,AB = stos; AC,AD = lods; AE,AF = scas + @@: + cmp al,0xAA + jb @F + cmp al,0xB0 + jb .DoIt + + ; E0 = loopnz; E1 = loopz; E2 = loop + @@: + cmp al,0xE0 + jb .NoLoop + cmp al,0xE2 + ja .NoLoop + inc esi + jmp .DoIt + + ; FF /2 = call + .NoLoop: + cmp al,0xFF + jnz OnStep + call GetByteNoBreak + jc OnStep + inc esi + mov cl,al + and al,00111000b + cmp al,00010000b + jnz OnStep + ; skip instruction + mov al,cl + and eax,7 + shr cl,6 + jz .Mod0 + jp .DoIt + cmp al,4 + jnz @F + inc esi + @@: + inc esi + dec cl + jz @F + add esi,3 + @@: + jmp .DoIt + .Mod0: + cmp al,4 + jnz @F + call GetByteNoBreak + jc OnStep + inc esi + and al,7 + @@: + cmp al,5 + jnz .DoIt + add esi,4 + .DoIt: + ; insert one-shot breakpoint at esi and resume + call GetByteNoBreak + jc OnStep + mov eax,esi + call FindEnabledBreakPoint + jz @F + mov eax,esi + mov bl,5 + call AddBreakPoint + jmp OnStep.DoIt + @@: + ret + +;----------------------------------------------------------------------------- +; Read next byte of machine code +GetByteNoBreak: + mov eax,esi + call FindEnabledBreakPoint + jnz .NoBreak + mov al,[edi+5] + clc + ret + + .NoBreak: + xor edx,edx + push edx + inc edx + mov edi,esp + mcall 69,6,[DebuggeePID] + dec eax + clc + jz @F + stc + @@: + pop eax + ret + +IsPrefix: + cmp al,0x64 ; fs: + jz .Ret + cmp al,0x65 ; gs: + jz .Ret + cmp al,0x66 ; use16/32 + jz .Ret + cmp al,0x67 ; addr16/32 + jz .Ret + cmp al,0xF0 ; lock + jz .Ret + cmp al,0xF2 ; repnz + jz .Ret + cmp al,0xF3 ; rep(z) + jz .Ret + cmp al,0x2E ; cs: + jz .Ret + cmp al,0x36 ; ss: + jz .Ret + cmp al,0x3E ; ds: + jz .Ret + cmp al,0x26 ; es: + .Ret: + ret + +OnResume: + mov esi,[CurArg] + cmp byte [esi],0 + jz GoOn + call CalcExpression + jc .Ret + .Jmp: + mov eax,ebp + push eax + call FindEnabledBreakPoint + pop eax + jz GoOn + mov bl,5 ; valid enabled one-shot + call AddBreakPoint + jnc GoOn + mov esi,aBreakpointLimitExceeded + call PutMessage + .Ret: + ret + +;----------------------------------------------------------------------------- +; Jump event +OnJump: mov esi,[CurArg] + cmp byte [rsi],0 + jz .Ret + call CalcExpression + jc .Ret + mov ecx,[CurrentWindow] + mov [CodeAddr+rcx*4],ebp + jecxnz .Next + mov [CPUYPos],1 +.Next: + cmp ecx,1 ;Reg Window? + jnz .NReg + mov eax,[RegXPtr] + cmp eax,9 + jae .NReg + mov eax,[RegRTab+rax*4] + mov [rax],ebp + call SetContext +.NReg: + mov [AfterKey],1 + call ShowImage +.Ret: ret + +;----------------------------------------------------------------------------- +; Help event +OnHelp: mov esi,HelpMsg + mov edi,[CurArg] + cmp byte [edi],0 + jz .X + mov esi,HelpGroups + call FindCmd + jc .NoCmd + mov esi,[esi+12] + .X: + jmp PutMessage + + .NoCmd: + mov esi,aUnknownCommand + jmp .X + +;----------------------------------------------------------------------------- +; Detach process event +OnDetach: + mcall 69,3,[DebuggeePID] + and [DebuggeePID],0 + call FreeSymbols + mov esi,aContinued + jmp PutMessage + +;----------------------------------------------------------------------------- +; Reload executable event +OnReLoad: + cmp [DebuggeePID],0 + jnz TerminateReLoad + mov esi,NeedDebuggee + cmp byte [LoadName],0 + jnz DoReLoad + jz PutMessage + +TerminateReLoad: + mov [bReload],1 +;----------------------------------------------------------------------------- +; Terminate process event +OnTerminate: + mcall 69,8,[DebuggeePID] + ret + +;----------------------------------------------------------------------------- +; Suspend process event +AfterSuspend: + mov [bSuspended],1 + call GetNewContext + call GetDump + call ShowImage + ret + +OnSuspend: + mcall 69,4,[DebuggeePID] + call AfterSuspend + mov esi,aSuspended + jmp PutMessage +GoOn: + ; test for enabled breakpoint at eip + mov eax,[_EIP] + call FindEnabledBreakPoint + jnz .NoBreak + ; temporarily disable breakpoint, make step, enable breakpoint, continue + inc eax + mov [TempBreak],eax + mov [bAfterGo],1 + dec eax + call DisableBreakPoint + call GetContext + or byte [_EFL+1],1 ; set TF + call SetContext + and byte [_EFL+1],not 1 + call DoResume + ret + .NoBreak: + call DoResume +ShowImage: + pushad + call InitConsole + call DrawWindow + popad + ret + +even 4 +InitConsole: + mov eax,[CurWidth] + mul [CurHeight] + mov ecx,eax + mov edi,ConsoleDataPtr + mov eax,3F203F20h + shr ecx,1 + rep stosd + adc cl,cl + rep stosw + ; + mov ebx,MSG_HEIGHT ;dY + mov ecx,[CurWidth] ;\dX + sub ecx,2 ;/ + mov esi,1 ;X + mov edi,MinHeight-MSG_HEIGHT-1 ;Y + mov edx,87208720h + call ClearWindow + ; + call DrawFrame + ret + +InitCoords: + mov [CPUXPos],1 + mov [CPUYPos],1 + mov [CPUXPtr],0 + mov [MemXPos],11 + mov [MemYPos],41 + mov eax,[CurWidth] + SUB eax,21 + mov [StkXPos],eax + mov [StkYPos],28 + mov [RegXPos],1 + mov [RegYPos],30 + mov [RegLDat],12 + and [RegXPtr],0 + ret + +GetDataByte: +;I: esi - address +;O: al - byte + pushad + mov al,0 + push eax + mcall 69,6,[DebuggeePID],1,[All.esi+4],esp +if 1 + mov esi,[All.esi+4] + mov edi,esp + call RestoreFromBreaksOne +end if + cmp eax,-1 ;invalid PID? + jz @F ;Yes,CF=0 + cmp eax,1 ;CF=1,eax=1 if OK + cmc +@@: pop dword [esp+1Ch] + popad + ret + +SafeStoreDD: + pushad + mov eax,69 + mov ebx,7 + mov ecx,[DebuggeePID] + mov edx,4 + mov esi,edi + lea edi,[All.eax] + int 40h + popad + ret + +SafeStore: + pushad + mov eax,69 + mov ebx,7 + mov ecx,[DebuggeePID] + mov edx,1 + mov esi,edi + lea edi,[All.eax] + int 40h + popad + ret + +DrawWindow: + btr dword [DoDraw],0 + jc .CopyDraw + mov esi,ConsoleDataPtr + mov edi,ConsoleDataOld + mov ecx,[CurWidth] + imul ecx,[CurHeight] + shr ecx,1 + repz cmpsd + jnz .CopyDraw + adc cl,cl + repz cmpsw + jz .SkipDraw +.CopyDraw: + mov esi,ConsoleDataPtr + mov edi,ConsoleDataOld + mov ecx,[CurWidth] + imul ecx,[CurHeight] + shr ecx,1 + rep movsd + adc cl,cl + rep movsw + + push SF_REDRAW + pop eax + push SSF_BEGIN_DRAW + pop ebx + int 40h + mov al,SF_STYLE_SETTINGS + mov bl,SSF_GET_SKIN_HEIGHT + int 40h + mov [SkinH],eax + mov ebx,[CurWidth] + imul ebx,FontWidth + add ebx,100*65536+5*2-1 + mov ecx,[CurHeight] + imul ecx,FontHeight + lea ecx,[eax+ecx+5-1+100*65536] + xor eax,eax + mov edx,0x53000000 + + mov edi,HeaderN + cmp [DebuggeePID],0 + jz @F + mov edi,HeaderY + @@: int 40h + + mov al,SF_DRAW_RECT + xor edx,edx + cmp [FillWidth],0 + jz @F + mov ebx,[WndWidth] + sub ebx,[FillWidth] + sub ebx,5-1 + shl ebx,16 + mov bx,word [FillWidth] + mov ecx,[SkinH-2] + mov cx,word [WndHeight] + sub cx,word [SkinH] + sub cx,5-1 + int 40h +@@: + cmp [FillHeight],0 + jz @F + xor edx,edx + mov ebx,50000h + mov bx,word [WndWidth] + sub ebx,9 + mov ecx,[WndHeight] + sub ecx,[FillHeight] + sub ecx,5-1 + shl ecx,16 + mov cx,word [FillHeight] + int 40h +@@: + call DrawImage + mov al,SF_PUT_IMAGE_EXT + mov ebx,[MemForImage] + test ebx,ebx + jz @F + mov ecx,[CurWidth] + imul ecx,FontWidth*10000h + mov cx,word [CurHeight] + imul cx,FontHeight + mov edx,[SkinH] + add edx,5*10000h + mov esi,8 + mov edi,ConsoleColors + xor ebp,ebp + int 40h +@@: + mov al,SF_REDRAW + push SSF_END_DRAW + pop ebx + int 40h +.SkipDraw: + ret + +align 16 +DrawImage: + mov [bMemForImageValidData],byte 1 + cmp [MemForImage],0 + jnz .Allocated +; allocate memory for image + mov ecx,[CurWidth] + imul ecx,[CurHeight] + imul ecx,FontWidth*FontHeight + call PGAlloc + test eax,eax +ifz ret + mov [MemForImage],eax + mov [bMemForImageValidData],byte 0 +.Allocated: + push ebp + and [MaxX],0 + or [MinX],-1 + and [MaxY],0 + or [MinY],-1 + mov eax,[CursorY] + mul [CurWidth] + add eax,[CursorX] + add eax,eax + add eax,ConsoleDataPtr + xchg [CurCursorPos],eax + mov [OldCursorPos],eax + mov edi,[MemForImage] + mov esi,ConsoleDataPtr + mov ecx,[CurHeight] +.LH: + push ecx + mov ecx,[CurWidth] +.LW: + push ecx + mov eax,[CurWidth] + imul eax,[CurHeight] + mov ebx,[esi] + cmp [bMemForImageValidData],0 + jz @F + cmp esi,[CurCursorPos] + jz @F + cmp esi,[OldCursorPos] + jz @F + cmp bx,[eax*2+esi] + jnz @F + inc esi + inc esi + jmp .SkipSymbol +@@: + mov [eax*2+esi],bx + cmp ecx,[MinX] + ja @F + mov [MinX],ecx +@@: + cmp ecx,[MaxX] + jb @F + mov [MaxX],ecx +@@: + mov eax,[esp+4] + mov [MinY],eax + cmp eax,[MaxY] + jb @F + mov [MaxY],eax +@@: + push edi + xor eax,eax + mov al,[esi+1] + and al,0xF + mov ebx,eax + mov al,[esi+1] + shr al,4 + mov ebp,eax + sub ebx,ebp + lodsb + inc esi +if FontWidth > 8 + lea edx,[eax+eax+Font] +else + lea edx,[eax+Font] +end if +.SH: + mov ecx,[edx] +repeat FontWidth + shr ecx,1 + sbb eax,eax + and eax,ebx + add eax,ebp + mov [edi+%-1],al +end repeat + mov eax,[CurWidth] +if FontWidth = 6 + lea eax,[eax*2+eax] + lea edi,[edi+eax*2] +else if FontWidth = 7 + lea edi,[edi+eax*8] + sub edi,eax +else if FontWidth = 8 + lea edi,[edi+eax*8] +else if FontWidth = 9 + lea edi,[edi+eax*8] + add edi,eax +else if FontWidth = 10 + lea eax,[eax*4+eax] + lea edi,[edi+eax*2] +else +Unknown FontWidth Value! +end if +if FontWidth > 8 + add edx,256*2 + cmp edx,Font+256*2*FontHeight +else + add edx,256 + cmp edx,Font+256*FontHeight +end if + jb .SH + pop edi +.SkipSymbol: + pop ecx + add edi,FontWidth + dec ecx + jnz .LW + mov eax,[CurWidth] + imul eax,(FontHeight-1)*FontWidth + add edi,eax + pop ecx + dec ecx + jnz .LH +; cursor + mov eax,[CursorY] + inc eax + jz .NoCursor + mul [CurWidth] + imul eax,FontHeight*FontWidth + mov edx,[CursorX] + inc edx + imul edx,FontWidth + add eax,edx + add eax,[MemForImage] + mov edx,[CurWidth] + imul edx,FontWidth + neg edx + mov ecx,[CursorSize] +.CursorLoop: + push ecx + mov ecx,FontWidth + add eax,edx + push eax +@@: + xor byte [eax-1],7 + sub eax,1 + loop @B + pop eax + pop ecx + loop .CursorLoop +.NoCursor: + cmp [MinY],-1 + jz .NoDraw + mov ecx,[CurWidth] + mov ebx,[CurHeight] + mov eax,ebx + sub ebx,[MaxY] + sub eax,[MinY] + sub eax,ebx + inc eax + imul ebp,eax,FontHeight + mov edx,ecx + sub edx,[MaxX] + imul edx,FontWidth + mov eax,edx + shl edx,16 + imul dx,bx,FontHeight + imul ebx,[CurWidth] + mov ecx,[MaxX] + sub ecx,[MinX] + inc ecx + imul ecx,FontWidth*10000h + add ecx,ebp + imul ebx,FontWidth*FontHeight + add ebx,[MemForImage] + add ebx,eax + add edx,[SkinH] + add edx,5*10000h + imul esi,[CurWidth],FontWidth + mov ebp,ecx + shr ebp,16 + sub esi,ebp + mov ebp,esi + push SF_PUT_IMAGE_EXT + pop eax + mov edi,ConsoleColors + push 8 + pop esi + int 40h +.NoDraw: + pop ebp + ret +even 4 +Redraw: + mov al,SF_THREAD_INFO + mov ebx,ProcInfo + or ecx,-1 + int 40h +; test if rolled up +; height of rolled up window is [skinh]+3 + mov eax,[ebx+46] + sub eax,[SkinH] + cmp eax,5 + ja @F + mov al,SF_REDRAW + push SSF_BEGIN_DRAW + pop ebx + int 0x40 + xor eax,eax +; ebx, ecx, edi are ignored by function 0 after first redraw + mov edx,0x53000000 + int 0x40 + mov al,SF_REDRAW + inc ebx + int 0x40 + jmp WaitEvent +@@: + xor ecx,ecx + mov eax,[ebx+42] + mov [WndWidth],eax + sub eax,5*2-1 + jae @F + xor eax,eax +@@: + cdq + mov esi,FontWidth + div esi + cmp eax,MinWidth + jae @F + mov al,MinWidth + mov ch,1 +@@: + cmp eax,MaxWidth + jbe @F + mov eax,MaxWidth + mov ch,1 +@@: + cmp eax,[CurWidth] + mov [CurWidth],eax + setnz cl + or cl,ch + test edx,edx + mov [FillWidth],edx + setnz ch + mov eax,[ebx+46] + mov [WndHeight],eax + sub eax,[SkinH] + sub eax,5-1 + jns @F + xor eax,eax +@@: + cdq + mov esi,FontHeight + div esi + cmp eax,MinHeight + jae @F + mov al,MinHeight + mov cl,1 +@@: + cmp eax,MaxHeight + jbe @F + mov eax,MaxHeight + mov cl,1 +@@: + mov [FillHeight],edx + cmp eax,[CurHeight] + mov [CurHeight],eax + jnz .ReSize + test cl,cl + jnz .ReSize + test edx,edx + setnz cl + or cl,ch + jz @F + test byte [ebx+70],1 + jnz @F +.ReSize: + push SF_CHANGE_WINDOW + pop eax + or ebx,-1 + or ecx,-1 + mov edx,[CurWidth] + imul edx,FontWidth + add edx,5*2-1 + mov esi,[CurHeight] + imul esi,FontHeight + add esi,[SkinH] + add esi,5-1 + int 40h +.ReSizeDraw: + mov ecx,[MemForImage] + call PGFree + and [MemForImage],0 + call InitConsole + call InitCoords + jmp WaitEvent +@@: mov [DoDraw],1 + call DrawWindow + jmp WaitEvent + +even 4 +Start: + xor eax,eax + mov edi,NeedZeroStart + mov ecx,(NeedZeroEnd-NeedZeroStart+3)/4 + rep stosd + + call DetectCPU + mov [CPUType],dl + call DetectFPU + mov [FPUType],al + + cmp [CPUType],5 + jb @F + xor eax,eax + cpuid + mov edi,MsgXMMX+4 + mov [edi+0],ebx + mov [edi+4],edx + mov [edi+8],ecx + cmp eax,1 + jl .L1 + xor eax,eax + inc eax + cpuid + xchg eax,edx + jmp .L2 +.L1: xor eax,eax +.L2: test eax,00800000h ; CPU have MMX? + setnz [MMXType] + test eax,02000000h ; CPU have SSE? + setnz [XMMType] + @@: + + push SF_SYS_MISC + pop eax + push SSF_HEAP_INIT + pop ebx + int 40h + + call InitCmdHistBuffer + call InitDefault + + call InitCoords + call ShowImage + + ; set event mask - default events and debugging events + mcall 40,EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_DEBUG + ; set debug messages buffer + mov ecx,DbgBufSize + mov dword [ecx],256 + xor ebx,ebx + mov [ecx+4],ebx + mov al,69 + mcall + + call ShowImage + +WaitEvent: + push SF_WAIT_EVENT + pop eax + int 40h + + cmp al,9 + jz DebugMsg + dec eax + jz Redraw + dec eax + jz Key + sub eax,4 + jz Mouse +; button - we have only one button, close +;----------------------------------------------------------------------------- +; Quit event +OnQuit: + or eax,-1 + int 40h +Key: + mov al,SF_KEYBOARD + push SSF_GET_CONTROL_KEYS + pop ebx + int 0x40 + and eax,0x3F + mov [CtrlState],al + + mov al,SF_GET_KEY + int 40h + test al,al + jnz WaitEvent + + shr eax,8 + + cmp ah,5Dh +ifz call DumpScreen + + cmp [DebuggeePID],0 + jz DoCommandLine + cmp [CmdLineActive],0 + jnz GetCommandLine + + jmp WinSwitch + +F7: cmp [DebuggeePID],0 + jz .No + call OnStep + .No:jmp WaitEvent + +F8: cmp [DebuggeePID],0 + jz F7.No + call OnProceed + jmp F7.No + +even 16 +Mouse: +if 0 + mov eax,SF_MOUSE_GET + mov ebx,SSF_BUTTON_EXT + int 0x40 + mov byte [MouseState],1 + bt eax,24 ;left but. double click + jc @F + mov byte [MouseState],0 + bt eax,8 ;left but. down + jc @F + jmp WaitEvent +@@: + mov eax,SF_MOUSE_GET + mov ebx,SSF_WINDOW_POSITION + int 0x40 +end if + jmp WaitEvent + +DumpScreen: + pushad + mov dword [DumpName+4],'0000' +.1: + mov [DumpBlock.Func],SSF_GET_INFO + mcall 70,DumpBlock + or eax,eax + jnz .2 + inc byte [DumpName+7] + cmp byte [DumpName+7],'9' + jbe .1 + mov byte [DumpName+7],'0' + inc byte [DumpName+6] + cmp byte [DumpName+6],'9' + jbe .1 + mov byte [DumpName+6],'0' + popad + ret +.2: mov [DumpBlock.Func],SSF_CREATE_FILE + mcall 70,DumpBlock + or eax,eax + jnz .Err + mov ebx,[CurHeight] + mov esi,ConsoleDataPtr + mov edi,ConsoleDataOld +.3: mov ecx,[CurWidth] +.4: mov al,[rsi] + test al,al + jz .5 + cmp al,0Ah + jz .5 + cmp al,0Dh + jz .5 + cmp al,10h + jb .X + jmp .6 +.5: mov al,20h + jmp .6 +.X: mov al,'.' +.6: mov [rdi],al + add esi,2 + inc edi + loop .4 + mov byte [rdi],13 + inc edi + dec ebx + jnz .3 + mov ecx,[CurWidth] + inc ecx + imul ecx,[CurHeight] + mov [DumpBlock.Size],ecx + mov [DumpBlock.Func],SSF_WRITE_FILE + mcall 70,DumpBlock +.Err: popad + ret + +AfterGoException: + push eax + mov eax,[TempBreak] + dec eax + push esi + call EnableBreakPoint + ; in any case, clear TF and RF + call GetNewContext + and [_EFL],not 10100h ; clear TF,RF + call SetContext + xor edx,edx + mov [TempBreak],edx + xchg dl,[bAfterGo] + pop esi + pop eax + cmp dl,2 + jnz @F + lodsd + push esi + call GetDump + jmp Exception.Done + @@: + test eax,eax + jz .NotInt1 + ; if exception is result of single step, simply ignore it and continue + test dword [esi],0xF + jnz DbgMsgStart.5 + lodsd + push esi + mov esi,OldContext + mov edi,Context + mov ecx,28h/4 + rep movsd + call DoResume + jmp DbgMsgEnd + .NotInt1: + ; in other case, work as without temp_break + lodsd + push esi + push eax + jmp Exception.4 + + .NoTour: + +DebugMsg: + neg [DbgBufSize] + mov esi,DbgBuf +DbgMsgStart: + lodsd + add esi,4 + dec eax + jz Exception + dec eax + jz Terminated + dec eax + jnz DbgNotify + + mov [bSuspended],1 + cmp [bAfterGo],0 + jnz AfterGoException + push esi + call GetNewContext + and [_EFL],not 10100h ; clear TF,RF + call SetContext + pop esi + .5: + push esi + call GetDump + pop esi + lodsd + xor ecx,ecx + .6: + bt eax,ecx + jnc .7 + mov ebx,[DrXBreak+ecx*4] + test ebx,ebx + jz .7 + pushad + dec ebx + push ebx + mov esi,aBreakStop + call PutMessageNoDraw + popad + .7: + inc ecx + cmp cl,4 + jb .6 + push esi + jmp Exception.DoneDraw + +DbgNotify: + int3 + add esi,32 + push esi + jmp DbgMsgEnd + +Terminated: + push esi + mov esi,TerminatedMsg + call PutMessage + and [DebuggeePID],0 + and [TempBreak],0 + mov [bAfterGo],0 + xor eax,eax + mov ecx,BreakPointsN*6/4+4 + mov edi,BreakPoints + rep stosd + cmp [bReload],1 + sbb [bReload],-1 + jnz Exception.Done + call FreeSymbols + jmp Exception.Done + +Exception: + mov [bSuspended],1 + cmp [bAfterGo],0 + jnz AfterGoException + lodsd + push esi + push eax + call GetNewContext + and [_EFL],not 10100h ; clear TF,RF + call SetContext + .4: + call GetDump + pop eax + ; int3 command generates exception 0x0D, #GP + push eax + cmp al,0x0D + jnz .NotDbg + ; check for 0xCC byte at eip + push 0 + mcall 69,6,[DebuggeePID],1,[_EIP],esp + pop eax + cmp al,0xCC + je .Int3 + ; check for 0xCD03 word at eip + push 0 + inc edx + mcall 69;,6,[DebuggeePID],2,[_EIP],esp + pop eax + cmp ax,0x03CD + jne .NotDbg + mov eax,[_EIP] + inc [_EIP] + inc [_EIP] + jmp .UserINT3 + .Int3: + ; this is either dbg breakpoint or int3 cmd in debuggee + mov eax,[_EIP] + call FindEnabledBreakPoint + jnz .UserINT3 + ; dbg breakpoint; clear if one-shot + pop ecx + push eax + mov esi,aBreakStop + test byte [edi+4],4 + jz .PutMsgEAX + pop ecx + call ClearBreakPoint + jmp .Done + + .UserINT3: + mov eax,[_EIP] + inc [_EIP] + .UserINT3_: + pop ecx + push eax + call SetContext + mov esi,aUserBreak + jmp .PutMsgEAX + + .NotDbg: + pop eax + push eax + push eax + mov esi,aException + call PutMessageNoDraw + pop eax + + cmp al,16 + ja .Suspended + mov esi,[MsgFaultSel+eax*4] + .ShowMess: + call PutMessageNoDraw + .Suspended: + mov esi,aSuspended + .PutMsgEAX: + call PutMessageNoDraw + .DoneDraw: + call DrawMessages + .Done: + mcall 18,3,[DbgWnd] ; activate dbg window + call ShowImage + +DbgMsgEnd: + pop esi + mov ecx,[DbgBufLen] + add ecx,DbgBuf + cmp esi,ecx + jnz DbgMsgStart + and [DbgBufLen],0 + neg [DbgBufSize] + cmp [bReload],2 + jnz @F + mov [bReload],0 + call DoReLoad + @@: + jmp WaitEvent + +;----------------------------------------------------------------------------- +; Add breakpoint +; in: EAX = address; BL = flags +; out: CF = 1 => error +; CF = 0 and EAX = breakpoint number +AddBreakPoint: + xor ecx,ecx + mov edi,BreakPoints + @@: + test byte [edi+4],1 + jz .Found + add edi,6 + inc ecx + cmp ecx,BreakPointsN + jb @B + stc + ret + .Found: + stosd + xchg eax,ecx + mov [edi],bl + test bl,2 + jnz @F + or byte [edi],2 + push eax + call EnableBreakPoint + pop eax + @@: + clc + ret +;----------------------------------------------------------------------------- +; Remove breakpoint +ClearBreakPoint: + cmp eax,BreakPointsN + jae .Ret + mov ecx,4 + inc eax + .1: + cmp [DrXBreak-4+ecx*4],eax + jnz @F + and [DrXBreak-4+ecx*4],0 + @@: + loop .1 + dec eax + push eax + add eax,eax + lea edi,[BreakPoints+eax+eax*2+4] + test byte [edi],1 + pop eax + jz .Ret + push edi + call DisableBreakPoint + pop edi + mov byte [edi],0 + .Ret: + ret +;----------------------------------------------------------------------------- +; Disable breakpoint +DisableBreakPoint: + cmp eax,BreakPointsN + jae .Ret + add eax,eax + lea edi,[BreakPoints+eax+eax*2+5] + test byte [edi-1],1 + jz .Ret + test byte [edi-1],2 + jnz .Ret + or byte [edi-1],2 + test byte [edi-1],8 + jnz .DR + push esi + mcall 69,7,[DebuggeePID],1,[edi-5] + pop esi + .Ret: + ret + .DR: + mov dl,[edi] + shr dl,6 + mov dh,80h + mcall 69,9,[DebuggeePID] + ret +;----------------------------------------------------------------------------- +; Enable breakpoint +EnableBreakPoint: + push esi + cmp eax,BreakPointsN + jae .Ret + add eax,eax + lea edi,[BreakPoints+eax+eax*2+5] + test byte [edi-1],1 + jz .Ret + test byte [edi-1],2 + jz .Ret + and byte [edi-1],not 2 + test byte [edi-1],8 + jnz .DR + mcall 69,6,[DebuggeePID],1,[edi-5] + dec eax + jnz .Err + push 0xCC + mov edi,esp + inc ebx + mcall 69 + pop eax + .Ret: + pop esi + ret + .Err: + or byte [edi-1],2 + mov esi,aBreakErr + call PutMessage + pop esi + ret + .DR: + mov esi,[edi-5] + mov dl,[edi] + shr dl,6 + mov dh,[edi] + and dh,0xF + mcall 69,9,[DebuggeePID] + test eax,eax + jnz .Err + pop esi + ret +;----------------------------------------------------------------------------- +; Find breakpoint +FindBreakPoint: + xor ecx,ecx + xchg eax,ecx + mov edi,BreakPoints + @@: + test byte [edi+4],1 + jz .Cont + test byte [edi+4],8 + jnz .Cont + cmp [edi],ecx + jz .Found + .Cont: + add edi,6 + inc eax + cmp eax,BreakPointsN + jb @B + or eax,-1 + .Found: + ret +;----------------------------------------------------------------------------- +; +FindEnabledBreakPoint: + xor ecx,ecx + xchg eax,ecx + mov edi,BreakPoints + @@: + test byte [edi+4],1 + jz .Cont + test byte [edi+4],2 or 8 + jnz .Cont + cmp [edi],ecx + jz .Found + .Cont: + add edi,6 + inc eax + cmp eax,BreakPointsN + jb @B + or eax,-1 + .Found: + ret + +GetDump: +if 0 + mov edi,DumpData + mov esi,[edi-4] + mov edx,DUMP_HEIGHT*10h + mov ecx,edx + xor eax,eax + push edi + rep stosb + pop edi + mcall 69,6,[DebuggeePID] + cmp eax,-1 + jnz @F + mov esi,ReadMemErr + call PutMessage + xor eax,eax + @@: + mov [edi-8],eax +; in: edi=buffer,eax=size,esi=address +RestoreFromBreaks: + mov ebx,BreakPoints + @@: + test byte [ebx+4],1 + jz .Cont ; ignore invalid + test byte [ebx+4],2 or 8 + jnz .Cont ; ignore disabled and memory breaks + mov ecx,[ebx] + sub ecx,esi + cmp ecx,eax + jae .Cont + mov dl,[ebx+5] + mov [edi+ecx],dl + .Cont: + add ebx,6 + cmp ebx,BreakPoints+BreakPointsN*6 + jb @B +end if + ret + +; in: edi=buffer,esi=address +RestoreFromBreaksOne: + mov ebx,BreakPoints + @@: + test byte [ebx+4],1 + jz .Cont ; ignore invalid + test byte [ebx+4],2 or 8 + jnz .Cont ; ignore disabled and memory breaks + mov ecx,[ebx] + sub ecx,esi + cmp ecx,1 + jae .Cont + mov dl,[ebx+5] + mov [edi+ecx],dl + jmp .Exit + .Cont: + add ebx,6 + cmp ebx,BreakPoints+BreakPointsN*6 + jb @B + .Exit: + ret + +GetCommandLine: + cmp ah,0x01 + jz .Esc + cmp al,8 + jz .Backspace + cmp al,0xB0 + jz .Left + cmp al,0xB3 + jz .Right + cmp al,0x0D + jz .Enter + cmp al,0xB6 + jz .Del + cmp al,0xB4 + jz .Home + cmp al,0xB5 + jz .End + cmp al,0xB1 + jz .Dn + cmp al,0xB2 + jz .Up + mov [CmdHistBuffer.TmpLineFlag],0 + cmp [CmdLineLen],CMD_WIDTH + jae WaitEvent + push eax + call ClearCmdLineEnd + pop eax + mov edi,CmdLine + mov ecx,[CmdLineLen] + add edi,ecx + lea esi,[edi-1] + sub ecx,[CmdLinePos] + std + rep movsb + cld + stosb + inc [CmdLineLen] + call DrawCmdLineEnd + inc [CmdLinePos] + call DrawCursor + jmp WaitEvent + + + .Esc: + xor eax,eax + mov [CmdLinePos],eax + mov [CmdLineLen],eax + mov [CmdLineActive],al + call DrawCursor + jmp WaitEvent + + .Backspace: + mov [CmdHistBuffer.TmpLineFlag],0 + cmp [CmdLinePos],0 + jz WaitEvent + dec [CmdLinePos] + + .DelChar: + mov [CmdHistBuffer.TmpLineFlag],0 + call ClearCmdLineEnd + mov edi,[CmdLinePos] + dec [CmdLineLen] + mov ecx,[CmdLineLen] + sub ecx,edi + add edi,CmdLine + lea esi,[edi+1] + rep movsb + call DrawCmdLineEnd + call DrawCursor + jmp WaitEvent + + .Del: + mov eax,[CmdLinePos] + cmp eax,[CmdLineLen] + jae WaitEvent + jmp .DelChar + + .Left: + cmp [CmdLinePos],0 + jz WaitEvent + call HideCursor + dec [CmdLinePos] + call DrawCursor + jmp WaitEvent + + .Right: + mov eax,[CmdLinePos] + cmp eax,[CmdLineLen] + jae WaitEvent + call HideCursor + inc [CmdLinePos] + call DrawCursor + jmp WaitEvent + + .Home: + call HideCursor + and [CmdLinePos],0 + call DrawCursor + jmp WaitEvent + + .End: + call HideCursor + mov eax,[CmdLineLen] + mov [CmdLinePos],eax + call DrawCursor + jmp WaitEvent + + .Up: + xor edx,edx + jmp .Hist + .Dn: + xor edx,edx + inc edx + .Hist: + cmp [CmdHistBuffer.TmpLineFlag],1 + je @F + mov eax,CmdLine + mov ecx,[CmdLineLen] + mov byte [eax+ecx],0 + call AddCmdHistTmpLine + @@: + test edx,edx + jnz .Hist.Next + cmp [CmdHistBuffer.NFlag],0 + jne @F + call GetCmdHistLine + inc [CmdHistBuffer.NFlag] + jmp .Hist.CPLine + + @@: + call PrevCmdHistLine + jc WaitEvent + call GetCmdHistLine + inc [CmdHistBuffer.NFlag] + jmp .Hist.CPLine + + .Hist.Next: + cmp [CmdHistBuffer.NFlag],0 + je WaitEvent + + call NextCmdHistLine + call GetCmdHistLine + jnc .Hist.CPLine + call GetCmdHistTmpLine + mov [CmdHistBuffer.TmpLineFlag],0 + mov [CmdHistBuffer.NFlag],0 + + .Hist.CPLine: + + mov esi,eax + mov edi,CmdLine + xor ecx,ecx + @@: + inc ecx + lodsb + stosb + test al,al + jnz @B + + dec ecx + mov [CmdLinePos],0 + call ClearCmdLineEnd + mov [CmdLineLen],ecx + mov [CmdLinePos],ecx + call DrawCmdLine + call DrawCursor + + jmp WaitEvent + + ; We also trying to execute previous command, if empty command_line + .Enter: + mov [CmdLineActive],0 + + mov ecx,[CmdLineLen] + test ecx,ecx + jnz .ExecCur + mov cl,byte [CmdLinePrev] + cmp cl,0 + jz WaitEvent + + .ExecPrev: + mov esi,CmdLinePrev + jmp .Exec + + .ExecCur: + mov esi,CmdLine + + .Exec: + mov byte [esi+ecx],0 + + mov eax,esi + call AddCmdHistLine + mov [CmdHistBuffer.NFlag],0 + + and [CmdLinePos],0 + push esi + call ClearCmdLineEnd + call DrawCursor + pop esi + and [CmdLineLen],0 + ; skip leading spaces + call GetArg.SkipSpaces + cmp al,0 + jz WaitEvent + ; now esi points to command + push esi + mov esi,Prompt + call PutMessageNoDraw + pop esi + push esi + call PutMessageNoDraw +Z1: + mov esi,NewLine + call PutMessage + pop esi + push esi + call GetArg + mov [CurArg],esi + pop edi + mov esi,Commands + call FindCmd + mov eax,aUnknownCommand + jc .X11 + + ; check command requirements + ; flags field: + ; &1: command may be called without parameters + ; &2: command may be called with parameters + ; &4: command may be called without loaded program + ; &8: command may be called with loaded program + mov eax,[esi+8] + mov ecx,[CurArg] + cmp byte [ecx],0 + jz .NoArgs + test byte [esi+16],2 + jz .X11 + jmp @F + + .NoArgs: + test byte [esi+16],1 + jz .X11 + @@: + cmp [DebuggeePID],0 + jz .NoDebuggee + mov eax,aAlreadyLoaded + test byte [esi+16],8 + jz .X11 + jmp .X9 + + .NoDebuggee: + mov eax,NeedDebuggee + test byte [esi+16],4 + jnz .X9 + .X11: + xchg esi,eax + call PutMessage + ; store cmdline for repeating + .X10: + mov esi,CmdLine + mov ecx,[CmdLineLen] + @@: + or ecx,ecx + jle .We + mov al,[esi+ecx] + mov [CmdLinePrev+ecx],al + dec ecx + jmp @B + + .We: + mov [CmdLineLen],0 + jmp WaitEvent + + .X9: + call dword [esi+4] + jmp .X10 + +PutMessage: + call PutMessageNoDraw +DrawMessages: + mov [AfterKey],1 + call ShowImage + ret + +include "cmdhist.inc" +include "parser.inc" +include "message.inc" + +HeaderN db 'SunSys Debugger ver ',VERSION,' - No program loaded',0 +HeaderY db 'SunSys Debugger ver ',VERSION,' - ',60 dup 32,0 +HeaderE: +; +LoadErrMsg db 'Cannot load program. ',0 +UnkErrMsg db 'Unknown error code -%4X',10,0 +aCannotLoadFile db 'Cannot load file. ',0 +UnkErrMsg2 db 'Unknown error code %4X.',10,0 +LoadErrMsgs: + dd .1,0,.3,0,.5,.6,0,0,.9,.A,0,0,0,0,0,0 + dd 0,0,0,0,0,0,0,0,0,0,0,0,0,.1E,.1F,.20 +.1 db 'HD undefined.',10,0 +.3 db 'Unknown FS.',10,0 +.5 db 'File not found.',10,0 +.6 db 'Unexpected EOF.',10,0 +.9 db 'FAT table corrupted.',10,0 +.A db 'Access denied.',10,0 +.1E db 'No memory.',10,0 +.1F db 'Not Menuet/Kolibri executable.',10,0 +.20 db 'Too many processes.',10,0 +LoadSuccMsg db 'Program loaded successfully! PID=%4X. Use "g" to run.',10,0 +TerminatedMsg db 'Program terminated.',10,0 +MsgFaultSel dd aDivide,aDebug,aNonMask,aUndefined,aOverflow + dd aBounds,aInvalid,aCoProcessorNA,aDoubleFault + dd aUndefined,aInvalidTSS,aSegment,aStack + dd aProtection,aPageFault,aUndefined,aCoProcessor +aDivide db '(Divide error)',10,0 +aDebug db '(Single-step/debug exception)',10,0 +aNonMask db '(Nonmaskable interrupt)',10,0 +aOverflow db '(Overflow)',10,0 +aBounds db '(Bounds check)',10,0 +aInvalid db '(Invalid opcode)',10,0 +aCoProcessorNA db '(Coprocessor not available)',10,0 +aDoubleFault db '(Double fault)',10,0 +aUndefined db '(Undefined fault)',10,0 +aInvalidTSS db '(Invalid TSS)',10,0 +aSegment db '(Segment not present)',10,0 +aStack db '(Stack fault)',10,0 +aProtection db '(General protection fault)',10,0 +aPageFault db '(Page fault)',10,0 +aCoProcessor db '(Coprocessor error)',10,0 +aSuspended db 'Suspended',10,0 +aContinued db 'Continuing',10,0 +aRunningErr db 'Program is running',10,0 +aException db 'Debugged program caused an exception %2X. ',0 +aBreakErr db 'Cannot activate breakpoint, it will be disabled',10,0 +aDuplicateBreakpoint db 'Duplicate breakpoint',10,0 +aInvalidBreak db 'Invalid breakpoint number',10,0 +aBreakNum db '%2X: at %8X',0 +aMemBreak1 db '%2X: on ',0 +aMemBreak2 db 'read from ',0 +aMemBreak3 db 'access of ',0 +aMemBreak4 db 'byte',0 +aMemBreak5 db 'word',0 +aMemBreak6 db 'dword',0 +aMemBreak7 db ' at %8X',0 +aOneShot db ', one-shot',0 +aDisabled db ', disabled',0 +aBreakStop db 'Breakpoint #%2X',10,0 +aUserBreak db 'int3 command at %8X',10,0 +ReadMemErr db 'ERROR: cannot read process memory!!!',10,0 +aBreakpointLimitExceeded db 'Breakpoint limit exceeded',10,0 +aUnknownCommand db 'Unknown command',10,0 +NeedDebuggee db 'No program loaded. Use "load" command.',10,0 +aAlreadyLoaded db 'Program is already loaded. Use "terminate" or "detach" commands',10,0 +aParseError db 'Parse error',10,0 +aDivByZero db 'Division by 0',10,0 +CalcString db '%8X',10,0 +aNoMemory db 'No memory',10,0 +aSymbolsLoaded db 'Symbols loaded',10,0 +aUnaligned db 'Unaligned address',10,0 +aEnabledBreakErr db 'Enabled breakpoints are not allowed',10,0 +aInterrupted db 'Interrupted',10,0 +aUnpacked db 'Unpacked successful!',10,0 +OnBeErrMsg db 'There is already enabled breakpoint on this address',10,0 + +DumpPath db '/TMP0/1/' +DumpName db 'DUMP0000.TXT',0 + +even 4 +ConsoleColors dd 0x000000,0x000080,0x008000,0x008080 + dd 0x800000,0x800080,0x808000,0xC0C0C0 + dd 0x1D272F,0x0000FF,0x00FF00,0x00FFFF;0x808080,0x0000FF,0x00FF00,0x00FFFF + dd 0xFF0000,0xFF00FF,0xFFFF00,0xFFFFFF + +CurWidth dd MinWidth +CurHeight dd MinHeight +FillWidth dd 0 +FillHeight dd 0 + +MemForImage dd 0 + +bWasE0 db 0 +CtrlState db 0 +MouseState db 0 +bMemForImageValidData db 0 + +bReload db 0 +bAfterGo db 0 +bSuspended db 0 +CodeType db 32 + +DoDraw db 0 +SymbolSection db 0 +CmdLineActive db 0,? + +CursorX dd -1 +CursorY dd -1 +CursorSize dd CursorNormSize +CurCursorPos dd -1 +OldCursorPos dd -1 + +DebuggeePID dd 0 + +DumpBlock: +.Func dd 0 + dd 0 + dd 0 +.Size dd 0 + dd ConsoleDataOld + db 0 + dd DumpPath + +FN70LoadBlock: dd 7 + dd 1 +LoadParams dd 0 + dd 0 + dd 0 +LoadName: db 0 + rb 255 + +FN70ReadBlock: dd 0 + rq 1 + dd ? + dd ? + db 0 + dd ? + +FN70AttrBlock: dd 5 + dd 0,0,0 + dd FileAttr + db 0 + dd ? + +IncludeAllGlobals + +DbgWnd dd ? +TempBreak dd ? + +WndWidth dd ? +WndHeight dd ? + +MinY dd ? +MaxY dd ? +MinX dd ? +MaxX dd ? + +Tmp dd ? +SkinH dd ? +StdColors rd 10 + +AppPath rb 4096 +ProcInfo rb 1024 + +even 16 +ConsoleDataPtr rw (MaxWidth+0)*MaxHeight +even 16 +ConsoleDataOld rw (MaxWidth+1)*MaxHeight + +even 16 +NeedZeroStart: + +DbgBufSize dd ? +DbgBufLen dd ? +DbgBuf rb 256 + +FileAttr rb 40 + +even 4 +Context: +_EIP dd ? +_EFL dd ? +_EAX dd ? +_ECX dd ? +_EDX dd ? +_EBX dd ? +_ESP dd ? +_EBP dd ? +_ESI dd ? +_EDI dd ? + +_CTX_FLAGS: + dd ? + dd ? + +_SSE_FLAGS: + +_FCW dw ? +_FSW dw ? +_FTW db ? + db ? +_FOP dw ? +_FPU_IP dd ? + dw ? + dw ? + +_FPU_DP dd ? + dw ? + dw ? + +_MXCSR dd ? +_MXCSRM dd ? + +FPU_CONTEXT: +MMX_CONTEXT: +_ST0: +_MM0: rq 2 +_ST1: +_MM1: rq 2 +_ST2: +_MM2: rq 2 +_ST3: +_MM3: rq 2 +_ST4: +_MM4: rq 2 +_ST5: +_MM5: rq 2 +_ST6: +_MM6: rq 2 +_ST7: +_MM7: rq 2 + +SSE_CONTEXT: +_XMM0 rq 2 +_XMM1 rq 2 +_XMM2 rq 2 +_XMM3 rq 2 +_XMM4 rq 2 +_XMM5 rq 2 +_XMM6 rq 2 +_XMM7 rq 2 +CtxEnd: + +OldContext rb (CtxEnd-Context) + +Plus = (OldContext-Context) + +StepNum dd ? +ProcNum dd ? +if 0 +DUMP_HEIGHT = 6 ; in text lines +; +DumpRead dd ? +DumpPos dd ? +DumpData rb DUMP_HEIGHT*10h +end if + +CmdLine rb CMD_WIDTH+1 +CmdLineLen dd ? +CmdLinePos dd ? +CurArg dd ? + +CmdLinePrev rb CMD_WIDTH+1 + +SymbolsFile rb 260 + +PrgNamePtr dd ? +PrgNameLen dd ? + +Symbols dd ? +NumSymbols dd ? + +CmdHistBuffer: +.Ptr dd ? +.Size dd ? +.LastNodeOffset dd ? +.NewNodeOffset dd ? +.CurNodeOffset dd ? +.TmpLineFlag db ? +.NFlag db ? + +; breakpoint structure: +; dword +0: address +; byte +4: flags +; bit 0: 1 <=> breakpoint valid +; bit 1: 1 <=> breakpoint disabled +; bit 2: 1 <=> one-shot breakpoint +; bit 3: 1 <=> DRx breakpoint +; byte +5: overwritten byte +; for DRx breaks: flags + (index shl 6) +BreakPointsN = 256 +BreakPoints rb BreakPointsN*6 +DrXBreak rd 4 +;----------------------------------------------------------------------------- +CurrentWindow dd ? +CPUXPos dd ? ; coordinates of cursor in windows +CPUYPos dd ? +CPUXPtr dd ? +MemXPos dd ? +MemYPos dd ? +StkXPos dd ? +StkYPos dd ? +RegXPos dd ? +RegYPos dd ? +RegLDat dd ? +RegXPtr dd ? +CPUType db ? +FPUType db ? +MMXType db ? +XMMType db ? +JumpTaken db ? +AfterKey db ? +;----------------------------------------------------------------------------- +TmpB rb 0 +Temp dd ? +;----------------------------------------------------------------------------- +CodeAddr dd ? ;0 order +RegsAddr dd ? ;1 +DataAddr dd ? ;2 +StckAddr dd ? ;3 +OriginPtr: rd 2 +AddrBuffer: rd 30 +;----------------------------------------------------------------------------- +NeedZeroEnd: +;----------------------------------------------------------------------------- +BufferI: rb 1024 +BufferO: rb 1024 +;----------------------------------------------------------------------------- +; stack +even 4 + rb 32768 +StackTop: +;----------------------------------------------------------------------------- +Mem: +;----------------------------------------------------------------------------- +I_END = UDataStr ;%v +;----------------------------------------------------------------------------- diff --git a/programs/develop/koldbg/kosfuncs.inc b/programs/develop/koldbg/kosfuncs.inc new file mode 100644 index 0000000000..4c484ae25b --- /dev/null +++ b/programs/develop/koldbg/kosfuncs.inc @@ -0,0 +1,298 @@ + +; KolibriOS system functions: +SF_TERMINATE_PROCESS=-1 +SF_CREATE_WINDOW=0 ; define and draw the window +SF_PUT_PIXEL=1 ; draw pixel to the window +SF_GET_KEY=2 ; get code of the pressed key +SF_GET_SYS_TIME=3 +SF_DRAW_TEXT=4 +SF_SLEEP=5 ; pause process +SF_PUT_IMAGE=7 ; draw image to the window +SF_DEFINE_BUTTON=8 ; define/delete the button +SF_THREAD_INFO=9 ; information on execution thread +SF_WAIT_EVENT=10 ; wait for event +SF_CHECK_EVENT=11 ; check for event and return +SF_REDRAW=12 + SSF_BEGIN_DRAW=1 + SSF_END_DRAW=2 +SF_DRAW_RECT=13 ; draw rectangle to the window +SF_GET_SCREEN_SIZE=14 ; get screen resolution +SF_BACKGROUND_SET=15 ; work with desktop background graphics + SSF_SIZE_BG=1 ; set a size of the background image + SSF_PIXEL_BG=2 ; put pixel on the background image + SSF_REDRAW_BG=3 ; redraw background + SSF_MODE_BG=4 ; set drawing mode for the background + SSF_IMAGE_BG=5 ; put block of pixels on the background image + SSF_MAP_BG=6 ; map background image to the address space of the process + SSF_UNMAP_BG=7 ; close mapped background data + SSF_LAST_DRAW=8 ; get coordinates of the last draw to the background + SSF_REDRAW_RECT=9 ; redraws a rectangular part of the background +SF_RD_TO_FLOPPY=16 ; save ramdisk on the floppy +SF_GET_BUTTON=17 ; get ID of the pressed button +SF_SYSTEM=18 + SSF_UNFOCUS_WINDOW=1 ; take focus from the window of the given thread + SSF_TERMINATE_THREAD=2 ; terminate process/thread by the slot number + SSF_FOCUS_WINDOW=3 ; give focus to the window of the given thread + SSF_GET_IDLE_COUNT=4 ; get counter of idle cycles per second + SSF_GET_CPU_FREQUENCY=5 ; get CPU clock rate + SSF_RD_TO_HDD=6 ; save ramdisk to the file on hard disk + SSF_GET_ACTIVE_WINDOW=7 ; get slot number of the active window + SSF_SPEAKER=8 + SSSF_GET_STATE=1 + SSSF_TOGGLE=2 + SSF_SHUTDOWN=9 ; system shutdown/reboot + SSF_MINIMIZE_WINDOW=10 ; minimize active window + SSF_INFO_DISC_SYS=11 ; get disk subsystem information + SSF_KERNEL_VERSION=13 ; get kernel version + SSF_WAIT_RETRACE=14 ; wait for screen retrace + SSF_CURSOR_CENTER=15 ; center mouse cursor on the screen + SSF_GET_FREE_RAM=16 ; get size of free RAM + SSF_GET_TOTAL_RAM=17 ; get total amount of RAM + SSF_TERMINATE_THREAD_ID=18 ; Terminate process/thread by the ID + SSF_MOUSE_SETTINGS=19 + SSSF_GET_SPEED=0 + SSSF_SET_SPEED=1 + SSSF_GET_SPEEDUP=2 + SSSF_SET_SPEEDUP=3 ; set mouse acceleration + SSSF_SET_POS=4 ; set mouse pointer position + SSSF_SET_BUTTON=5 ; simulate state of mouse buttons + SSSF_GET_DOUBLE_CLICK_DELAY=6 + SSSF_SET_DOUBLE_CLICK_DELAY=7 + SSF_GET_RAM_INFO=20 ; get information on RAM + SSF_GET_THREAD_SLOT=21 ; get slot number of process/thread by the ID + SSF_FOREIGN_WINDOW=22 ; operations with window of another thread by slot/ID + SSSF_MINIMIZE=0 + SSSF_MINIMIZE_ID=1 + SSSF_RESTORE=2 + SSSF_RESTORE_ID=3 + SSF_MINIMIZE_ALL=23 + SSF_SET_SCREEN_LIMITS=24 + SSF_WINDOW_BEHAVIOR=25 ; window focus relation with other windows + SSSF_GET_WB=1 + SSSF_SET_WB=2 +SF_MIDI=20 + SSF_RESET=1 + SSF_OUTPUT=2 +SF_SYSTEM_SET=21 + SSF_MPU_MIDI_BASE=1 + SSF_KEYBOARD_LAYOUT=2 + SSF_SYS_LANG=5 + SSF_ACCESS_HD_LBA=11 ; setting of low-level access to HD + SSF_ACCESS_PCI=12 ; setting of low-level access to PCI +SF_SET_TIME_DATE=22 +SF_WAIT_EVENT_TIMEOUT=23; wait for event with timeout +SF_CD=24 + SSF_EJECT_TRAY=4 + SSF_INSERT_TRAY=5 +SF_SCREEN_PUT_IMAGE=25 ; put image on the background layer +SF_SYSTEM_GET=26 + ; Same as SF_SYSTEM_SET, plus: + SSF_TIME_COUNT=9 + SSF_TIME_COUNT_PRO=10 ; get value of the high precision time counter +SF_GET_SYS_DATE=29 +SF_CURRENT_FOLDER=30 + SSF_SET_CF=1 ; set current folder for the thread + SSF_GET_CF=2 + SSF_ADD_SYS_FOLDER=3 ; install the add.system directory for the kernel +SF_GET_PIXEL_OWNER=34 ; get slot number of the screen pixel owner +SF_GET_PIXEL=35 ; read the screen pixel color +SF_GET_IMAGE=36 ; read the screen area +SF_MOUSE_GET=37 + SSF_SCREEN_POSITION=0 + SSF_WINDOW_POSITION=1 + SSF_BUTTON=2 ; states of the mouse buttons + SSF_BUTTON_EXT=3 ; states and events of the mouse buttons + SSF_LOAD_CURSOR=4 + SSF_SET_CURSOR=5 + SSF_DEL_CURSOR=6 + SSF_SCROLL_DATA=7 +SF_DRAW_LINE=38 +SF_BACKGROUND_GET=39 + ;SSF_SIZE_BG=1 + ;SSF_PIXEL_BG=2 + ;SSF_MODE_BG=4 +SF_SET_EVENTS_MASK=40 ; turn on/off desired events +SF_PORT_IN_OUT=43 ; input/output to a port +SF_SET_PORTS=46 ; reserve/free a group of input/output ports +SF_DRAW_NUMBER=47 ; draw number to the window +SF_STYLE_SETTINGS=48 + SSF_APPLY=0 ; apply screen settings + SSF_SET_BUTTON_STYLE=1 + SSF_SET_COLORS=2 + SSF_GET_COLORS=3 ; get standard window colors + SSF_GET_SKIN_HEIGHT=4 + SSF_GET_SCREEN_AREA=5 ; get screen working area + SSF_SET_SCREEN_AREA=6 + SSF_GET_SKIN_MARGINS=7 + SSF_SET_SKIN=8 + SSF_GET_FONT_SMOOTH=9 + SSF_SET_FONT_SMOOTH=10 + SSF_GET_FONT_SIZE=11 + SSF_SET_FONT_SIZE=12 +SF_APM=49 +SF_SET_WINDOW_SHAPE=50 +SF_CREATE_THREAD=51 +SF_CLIPBOARD=54 + SSF_GET_SLOT_COUNT=0 ; get the number of slots in the clipboard + SSF_READ_CB=1 + SSF_WRITE_CB=2 + SSF_DEL_SLOT=3 ; delete the last slot in the clipboard + SSF_UNLOCK_BUFFER=4 ; emergency buffer unlock +SF_SPEAKER_PLAY=55 +SF_PCI_BIOS=57 +SF_IPC=60 ; Inter Process Communication + SSF_SET_AREA=1 ; set area for IPC receiving + SSF_SEND_MESSAGE=2 +SF_GET_GRAPHICAL_PARAMS=61 + SSF_SCREEN_SIZE=1 + SSF_BITS_PER_PIXEL=2 + SSF_BYTES_PER_LINE=3 +SF_PCI=62 + SSF_GET_VERSION=0 ; get version of PCI-interface + SSF_GET_LAST_BUS=1 ; get number of the last PCI-bus + SSF_GET_ADRR_MODE=2 ; get addressing mode of the PCI configuration space + SSF_READ_BYTE=4 + SSF_READ_WORD=5 + SSF_READ_DWORD=6 + SSF_WRITE_BYTE=8 + SSF_WRITE_WORD=9 + SSF_WRITE_DWORD=10 +SF_BOARD=63 + SSF_DEBUG_WRITE=1 + SSF_DEBUG_READ=2 +SF_MEMORY_RESIZE=64 ; resize total application memory +SF_PUT_IMAGE_EXT=65 ; draw image with palette to the window +SF_KEYBOARD=66 + SSF_SET_INPUT_MODE=1 + SSF_GET_INPUT_MODE=2 + SSF_GET_CONTROL_KEYS=3; get status of control keys + SSF_SET_SYS_HOTKEY=4 + SSF_DEL_SYS_HOTKEY=5 + SSF_LOCK_INPUT=6 ; block normal input + SSF_UNLOCK_INPUT=7 ; restore normal input +SF_CHANGE_WINDOW=67 ; change position/sizes of the window +SF_SYS_MISC=68 + SSF_GET_TASK_SWITCH_COUNT=0 + SSF_SWITCH_TASK=1 + SSF_PERFORMANCE=2 + SSSF_ALLOW_RDPMC=0 + SSSF_CACHE_STATUS=1 + SSSF_CACHE_ON=2 + SSSF_CACHE_OFF=3 + SSF_READ_MSR=3 + SSF_WRITE_MSR=4 + SSF_HEAP_INIT=11 + SSF_MEM_ALLOC=12 + SSF_MEM_FREE=13 + SSF_WAIT_SIGNAL=14 ; wait for signal from another program/driver + SSF_LOAD_DRIVER=16 + SSF_CONTROL_DRIVER=17 + SSF_LOAD_DLL=19 + SSF_MEM_REALLOC=20 + SSF_LOAD_DRIVER_PE=21 + SSF_MEM_OPEN=22 ; open named memory area + SSF_MEM_CLOSE=23 + SSF_SET_EXCEPTION_HANDLER=24 + SSF_SET_EXCEPTION_STATE=25 + SSF_MEM_FREE_EXT=26 + SSF_LOAD_FILE=27 +SF_DEBUG=69 + SSF_SET_MESSAGE_AREA=0 + SSF_GET_REGISTERS=1 + SSF_SET_REGISTERS=2 + SSF_DETACH=3 + SSF_SUSPEND=4 + SSF_RESUME=5 + SSF_READ_MEMORY=6 + SSF_WRITE_MEMORY=7 + SSF_TERMINATE=8 + SSF_DEFINE_BREAKPOINT=9 +SF_FILE=70 + SSF_READ_FILE=0 + SSF_READ_FOLDER=1 + SSF_CREATE_FILE=2 + SSF_WRITE_FILE=3 + SSF_SET_END=4 + SSF_GET_INFO=5 + SSF_SET_INFO=6 + SSF_START_APP=7 + SSF_DELETE=8 + SSF_CREATE_FOLDER=9 +SF_SET_CAPTION=71 +SF_SEND_MESSAGE=72 +SF_BLITTER=73 +SF_NETWORK_DEVICE=74 + SSF_DEVICE_COUNT=255 ; get number of active network devices + SSF_DEVICE_TYPE=0 + SSF_DEVICE_NAME=1 + SSF_RESET_DEVICE=2 + SSF_STOP_DEVICE=3 + SSF_DEVICE_POINTER=4 + SSF_TX_PACKET_COUNT=6 + SSF_RX_PACKET_COUNT=7 + SSF_TX_BYTE_COUNT=8 + SSF_RX_BYTE_COUNT=9 + SSF_LINK_STATUS=10 + SSF_TX_PACKET_ERROR_COUNT=11 + SSF_TX_PACKET_DROP_COUNT=12 + SSF_TX_PACKET_MISS_COUNT=13 + SSF_RX_PACKET_ERROR_COUNT=14 + SSF_RX_PACKET_DROP_COUNT=15 + SSF_RX_PACKET_MISS_COUNT=16 +SF_NETWORK_SOCKET=75 + SSF_OPEN=0 + SSF_CLOSE=1 + SSF_BIND=2 + SSF_LISTEN=3 + SSF_CONNECT=4 + SSF_ACCEPT=5 + SSF_SEND=6 + SSF_RECEIVE=7 + SSF_SET_OPTIONS=8 + SSF_GET_OPTIONS=9 + SSF_SOCKET_PAIR=10 +SF_NETWORK_PROTOCOL=76 + SSF_ETHERNET_READ_MAC=0 + SSF_IP4_PACKETS_SENT=10000h + SSF_IP4_PACKETS_RECEIVED=10001h + SSF_IP4_READ_IP=10002h + SSF_IP4_WRITE_IP=10003h + SSF_IP4_READ_DNS=10004h + SSF_IP4_WRITE_DNS=10005h + SSF_IP4_READ_SUBNET=10006h + SSF_IP4_WRITE_SUBNET=10007h + SSF_IP4_READ_GATEWAY=10008h + SSF_IP4_WRITE_GATEWAY=10009h + SSF_ICMP_PACKETS_SENT=20000h + SSF_ICMP_PACKETS_RECEIVED=20001h + SSF_ICMP_ECHO_REPLY=20003h + SSF_UDP_PACKETS_SENT=30000h + SSF_UDP_PACKETS_RECEIVED=30001h + SSF_TCP_PACKETS_SENT=40000h + SSF_TCP_PACKETS_RECEIVED=40001h + SSF_ARP_PACKETS_SENT=50000h + SSF_ARP_PACKETS_RECEIVED=50001h + SSF_ARP_GET_ENTRY_COUNT=50002h + SSF_ARP_READ_ENTRY=50003h + SSF_ARP_ADD_STATIC_ENTRY=50004h + SSF_ARP_DEL_ENTRY=50005h + SSF_ARP_SEND_ANNOUNCE=50006h + SSF_ARP_CONFLICTS_COUNT=50007h +SF_FUTEX=77 + SSF_CREATE=0 + SSF_DESTROY=1 + SSF_WAIT=2 + SSF_WAKE=3 + +; File system errors: +FSERR_SUCCESS=0 +FSERR_UNSUPPORTED=2 +FSERR_UNKNOWN=3 +FSERR_FILE_NOT_FOUND=5 +FSERR_END_OF_FILE=6 +FSERR_INVALID_BUFFER=7 +FSERR_DISK_FULL=8 +FSERR_FAIL=9 +FSERR_ACCESS_DENIED=10 +FSERR_DEVICE_FAIL=11 +FSERR_OUT_OF_MEMORY=12 diff --git a/programs/develop/koldbg/loadmap.inc b/programs/develop/koldbg/loadmap.inc new file mode 100644 index 0000000000..8134476767 --- /dev/null +++ b/programs/develop/koldbg/loadmap.inc @@ -0,0 +1,43 @@ +uglobal +LastNames dq ? +ShowNames db ? +endg + +FindEAX:push esi + and [LastNames],0 + cmp [ShowNames],0 + jnz .NoSymb + cmp eax,0x80 + jl .NoSymb + lea esi,[eax-1] + test eax,esi + jz .NoSymb + call FindSymbol + jc .NoSymb + mov [LastNames],esi + cmp rdi,[TheBufferO] + jz .SetCol ;Skip starting address + push edi + @@: + lodsb + test al,al + jz @F + stosb + jmp @B + .SetCol: + mov [BufferO-1],byte 31h ;Label Color + .NoSymb: + stc + pop esi + ret + @@: mov ecx,edi + sub ecx,[esp] + cmp ecx,255 +ifa mov ecx,255 + pop edi + add edi,ecx + clc + pop esi + ret + +include "symbols.inc" diff --git a/programs/develop/koldbg/make.bat b/programs/develop/koldbg/make.bat new file mode 100644 index 0000000000..7dfb9512b7 --- /dev/null +++ b/programs/develop/koldbg/make.bat @@ -0,0 +1 @@ +fasm koldbg.asm koldbg diff --git a/programs/develop/koldbg/message.inc b/programs/develop/koldbg/message.inc new file mode 100644 index 0000000000..c7736085bc --- /dev/null +++ b/programs/develop/koldbg/message.inc @@ -0,0 +1,120 @@ +;----------------------------------------------------------------------------- +; Working with messages +; in: esi->ASCIIZ message +PutMessageNoDraw: + mov edx,[MessagesPos] + .M: + lea edi,[Messages+edx] + .L: + lodsb + cmp al,0 + jz .Done + call TestScroll + cmp al,10 + jz .NewLine + cmp al,'%' + jnz @F + cmp dword [esp],Z1 + jnz .Format + @@: + stosb + inc edx + jmp .L + + .NewLine: + push edx + mov ecx,MSG_WIDTH + xor eax,eax + xchg eax,edx + div ecx + xchg eax,edx + pop edx + test eax,eax + jz .M + sub edx,eax + add edx,ecx + jmp .M + + .Done: +if 0 + cmp byte [esi-2],10 + jz .Exit + call TestScroll +if 1 + push edx + mov ecx,MSG_WIDTH + xor eax,eax + xchg eax,edx + div ecx + xchg eax,edx + pop edx + test eax,eax + jz .Exit + sub edx,eax + add edx,ecx +end if +end if + .Exit: + mov [MessagesPos],edx + ret + + ; at this moment all format specs must be %X + .Format: + lodsb ; get + sub al,'0' + movzx ecx,al + lodsb + pop eax + pop ebp + push eax + ; write number in ebp with ecx digits + dec ecx + shl ecx,2 + + .WriteNibble: + push ecx + call TestScroll + pop ecx + mov eax,ebp + shr eax,cl + and al,0xF + cmp al,10 + sbb al,69h + das + stosb + inc edx + sub ecx,4 + jns .WriteNibble + jmp .L + +TestScroll: + cmp edx,MSG_WIDTH*MSG_HEIGHT + jnz .Ret + push esi + mov edi,Messages + lea esi,[edi+MSG_WIDTH] + mov ecx,(MSG_HEIGHT-1)*MSG_WIDTH/4 + rep movsd + push eax + mov al,' ' + push edi + push MSG_WIDTH + pop ecx + sub edx,ecx + rep stosb + pop edi + pop eax + pop esi + .Ret: + ret + +MSG_WIDTH = DATA_WIDTH +MSG_HEIGHT = 14 ; in text lines + +NewLine db 10,0 +Prompt db '> ',0 + +uglobal +MessagesPos dd ? +Messages rb MSG_HEIGHT*MSG_WIDTH +endg \ No newline at end of file diff --git a/programs/develop/koldbg/parser.inc b/programs/develop/koldbg/parser.inc new file mode 100644 index 0000000000..c2ff283e20 --- /dev/null +++ b/programs/develop/koldbg/parser.inc @@ -0,0 +1,396 @@ +;----------------------------------------------------------------------------- +TokenEnd = 1 +TokenReg = 2 +TokenHex = 3 +TokenOr = 4 +TokenAnd = 5 +TokenXor = 6 +TokenAdd = 7 +TokenSub = 8 +TokenMul = 9 +TokenDiv = 10 +TokenLP = 11 +TokenRP = 12 +TokenErr = -1 +;----------------------------------------------------------------------------- +RegTable: + db 2,'al',0 + db 2,'cl',1 + db 2,'dl',2 + db 2,'bl',3 + db 2,'ah',4 + db 2,'ch',5 + db 2,'dh',6 + db 2,'bh',7 + db 2,'ax',8 + db 2,'cx',9 + db 2,'dx',10 + db 2,'bx',11 + db 2,'sp',12 + db 2,'bp',13 + db 2,'si',14 + db 2,'di',15 + db 3,'eax',16 + db 3,'ecx',17 + db 3,'edx',18 + db 3,'ebx',19 + db 3,'esp',20 + db 3,'ebp',21 + db 3,'esi',22 + db 3,'edi',23 + db 3,'eip',24 + db 0 +;----------------------------------------------------------------------------- +; Check if byte is hex digit +IsHexDigit: + cmp al,'0' + jb .No + cmp al,'9' + jbe .09 + cmp al,'A' + jb .No + cmp al,'F' + jbe .AF + cmp al,'a' + jb .No + cmp al,'f' + jbe .FA + .No: + stc + ret + .09: + sub al,'0' +; clc + ret + .AF: + sub al,'A'-10 +; clc + ret + .FA: + sub al,'a'-10 +; clc + ret + +;----------------------------------------------------------------------------- +; Find register in the table +FindReg: + mov edi,RegTable + .FindReg: + movzx ecx,byte [edi] + stc + jecxz .RegNotFound + inc edi + push esi edi ecx + @@: + lodsb + or al,20h + scasb + loopz @B + pop ecx edi esi + lea edi,[edi+ecx+1] + jnz .FindReg + movzx edi,byte [edi-1] + add esi,ecx + .RegNotFound: + ret + +;----------------------------------------------------------------------------- +; Tokenize expressions +ExprGetToken: + lodsb + cmp al,0 + jz .EndToken + cmp al,' ' + jbe ExprGetToken + cmp al,'|' + jz .Or + cmp al,'&' + jz .And + cmp al,'^' + jz .Xor + cmp al,'+' + jz .Add + cmp al,'-' + jz .Sub + cmp al,'*' + jz .Mul + cmp al,'/' + jz .Div + cmp al,'(' + jz .LP + cmp al,')' + jnz .NotSign + .RP: + mov al,TokenRP + ret + .Or: + mov al,TokenOr + ret + .And: + mov al,TokenAnd + ret + .Xor: + mov al,TokenXor + ret + .Div: + mov al,TokenDiv + ret + .EndToken: + mov al,TokenEnd + ret + .Add: + mov al,TokenAdd + ret + .Sub: + mov al,TokenSub + ret + .Mul: + mov al,TokenMul + ret + .LP: + mov al,TokenLP + ret + .NotSign: + dec esi + call FindReg + jc .RegNotFound + mov al,TokenReg + ret + .RegNotFound: + ; test for symbol + push esi + @@: + lodsb + cmp al,' ' + ja @B + push eax + mov byte [esi],0 + xchg esi,[esp+4] + call FindSymbolName + mov edi,eax + pop eax + xchg esi,[esp] + mov byte [esi],al + jc @F + add esp,4 + mov al,TokenHex + ret + @@: + pop esi + ; test for hex number + xor ecx,ecx + xor edi,edi + xor eax,eax + @@: + lodsb + call IsHexDigit + jc @F + shl edi,4 + or edi,eax + inc ecx + jmp @B + @@: + dec esi + jecxz .Err + cmp ecx,8 + ja .Err + mov al,TokenHex + ret + .Err: + mov al,TokenErr + mov esi,aParseError + ret + +;----------------------------------------------------------------------------- +ExprRead2: + cmp al,TokenHex + jz .Hex + cmp al,TokenReg + jz .Reg + cmp al,TokenLP + jz .LP + mov al,TokenErr + mov esi,aParseError + ret + .Hex: + mov ebp,edi + .Ret: + jmp ExprGetToken + .Reg: + cmp edi,24 + jz .EIP + sub edi,4 + jb .8LO + sub edi,4 + jb .8HI + sub edi,8 + jb .16 + mov ebp,[_EAX+edi*4] + jmp .Ret + .16: + movzx ebp,word [_EAX+(edi+8)*4] + jmp .Ret + .8LO: + movzx ebp,byte [_EAX+(edi+4)*4] + jmp .Ret + .8HI: + movzx ebp,byte [_EAX+(edi+4)*4+1] + jmp .Ret + .EIP: + mov ebp,[_EIP] + jmp .Ret + .LP: + call ExprGetToken + call ExprRead0 + cmp al,TokenErr + jz @F + cmp al,TokenRP + jz ExprGetToken + mov al,TokenErr + mov esi,aParseError + @@: + ret + +;----------------------------------------------------------------------------- +ExprRead1: + call ExprRead2 + .1: + cmp al,TokenMul + jz .Mul + cmp al,TokenDiv + jz .Div + ret + .Mul: + push ebp + call ExprGetToken + call ExprRead2 + pop edx + ; ebp := edx*ebp + imul ebp,edx + jmp .1 + .Div: + push ebp + call ExprGetToken + call ExprRead2 + pop edx + ; ebp := edx/ebp + test ebp,ebp + jz .Div0 + push eax + xor eax,eax + xchg eax,edx + div ebp + xchg eax,ebp + pop eax + jmp .1 + .Div0: + mov al,TokenErr + mov esi,aDivByZero + ret + +;----------------------------------------------------------------------------- +ExprRead0: + xor ebp,ebp + cmp al,TokenOr + jz .Or + cmp al,TokenAnd + jz .And + cmp al,TokenXor + jz .Xor + cmp al,TokenAdd + jz .Add + cmp al,TokenSub + jz .Sub + call ExprRead1 + .1: + cmp al,TokenOr + jz .Or + cmp al,TokenAnd + jz .And + cmp al,TokenXor + jz .Xor + cmp al,TokenAdd + jz .Add + cmp al,TokenSub + jz .Sub + ret + .Or: + push ebp + call ExprGetToken + call ExprRead1 + pop edx + ; ebp := edx | ebp + or ebp,edx + jmp .1 + .And: + push ebp + call ExprGetToken + call ExprRead1 + pop edx + ; ebp := edx & ebp + and ebp,edx + jmp .1 + .Xor: + push ebp + call ExprGetToken + call ExprRead1 + pop edx + ; ebp := edx ^ ebp + xor ebp,edx + jmp .1 + .Add: + push ebp + call ExprGetToken + call ExprRead1 + pop edx + ; ebp := edx+ebp + add ebp,edx + jmp .1 + .Sub: + push ebp + call ExprGetToken + call ExprRead1 + pop edx + ; ebp := edx-ebp + xchg edx,ebp + sub ebp,edx + jmp .1 + +;----------------------------------------------------------------------------- +; in: esi->expression +; out: CF=1 if error +; CF=0 and ebp=value if ok +CalcExpression: + call ExprGetToken + call ExprRead0 + cmp al,TokenEnd + jz .End + cmp al,TokenErr + jz @F + mov esi,aParseError + @@: + call PutMessage + stc + ret + .End: + clc + ret + +GetArg: + lodsb + cmp al,' ' + ja GetArg + mov byte [esi-1],0 + cmp al,0 + jnz .SkipSpaces + dec esi + + .SkipSpaces: + lodsb + cmp al,0 + jz @F + cmp al,' ' + jbe .SkipSpaces + @@: + dec esi + ret diff --git a/programs/develop/koldbg/readme.txt b/programs/develop/koldbg/readme.txt new file mode 100644 index 0000000000..f35b86f789 --- /dev/null +++ b/programs/develop/koldbg/readme.txt @@ -0,0 +1,119 @@ +Ââåäåíèå. + +koldbg ïðåäñòàâëÿåò ñîáîé èíòåðàêòèâíûé îòëàä÷èê äëÿ îïåðàöèîííîé ñèñòåìû KolibriOS. Àâòîð ïðîãðàììû - Åâãåíèé Ãðå÷íèêîâ (Diamond). Äàííàÿ äîêóìåíòàöèÿ îïèñûâàåò âîçìîæíîñòè îòëàä÷èêà è ðàáîòó ñ íèì. Åñëè ó âàñ åñòü êàêèå-ëèáî âîïðîñû ïî ðàáîòå ñ ïðîãðàììîé èëè íóæíû êàêèå-òî âîçìîæíîñòè îòëàä÷èêà, êîòîðûõ åù¸ íåò, îáðàùàéòåñü íà ôîðóì board.kolibrios.org â ñîîòâåòñòâóþùóþ òåìó - http://board.kolibrios.org/viewtopic.php?f=45&t=358, èëè ïî àäðåñó àâòîðà - mailto:diamondz@land.ru. + +Îáùåå îïèñàíèå. + + êàæäûé ìîìåíò âðåìåíè koldbg ìîæåò îòëàæèâàòü òîëüêî îäíó ïðîãðàììó. Íàçîâ¸ì òàêóþ ïðîãðàììó çàãðóæåííîé äëÿ îòëàäêè. Åñëè íèêàêàÿ ïðîãðàììà íå çàãðóæåíà, àáñîëþòíîå áîëüøèíñòâî äåéñòâèé ïî îòëàäêå íåäîñòóïíî. + +koldbg óïðàâëÿåòñÿ êîìàíäíîé ñòðîêîé, ââîäèìîé ñ êëàâèàòóðû. Êîìàíäíàÿ ñòðîêà èçîáðàæàåòñÿ â íèæíåé ÷àñòè îêíà îòëàä÷èêà. Îáðàáàòûâàþòñÿ ñòàíäàðòíûå êëàâèøè ââîäà Backspace, Delete, Home, End, ñòðåëêè âëåâî/âïðàâî, ñòðåëêè ââåðõ/âíèç (ïðîêðó÷èâàíèå èñòîðèè êîìàíä). Êîìàíäû íå÷óâñòâèòåëüíû ê ðåãèñòðó ñèìâîëîâ.  êà÷åñòâå ðàçäåëèòåëÿ èñïîëüçóåòñÿ ïðîèçâîëüíîå íåíóëåâîå ÷èñëî ïðîáåëîâ. + + ëþáîé ìîìåíò îòëàä÷èê ìîæíî çàâåðøèòü êîìàíäîé "quit" (áåç àðãóìåíòîâ). Âïðî÷åì, ìîæíî è ïðîñòî íàæàòü íà êíîïêó çàêðûòèÿ â ïðàâîì âåðõíåì óãëó îêíà. + +Çàïóñê îòëàä÷èêà áåç ïàðàìåòðîâ êîìàíäíîé ñòðîêè ïðèâîäèò ê òîìó, ÷òî íèêàêàÿ ïðîãðàììà íå çàãðóæåíà. Òàêæå koldbg ìîæíî çàïóñêàòü ñ êîìàíäíîé +ñòðîêîé, â ýòîì ñëó÷àå îí ïîïûòàåòñÿ çàãðóçèòü ïðîãðàììó ñ èìåíåì, óêàçàííûì êàê ïåðâûé àðãóìåíò êîìàíäíîé ñòðîêè, è ïàðàìåòðàìè, óêàçàííûìè êàê +ïîñëåäóþùèå (åñëè îíè åñòü). + +Åñëè íèêàêàÿ ïðîãðàììà íå çàãðóæåíà, òî ìîæíî çàãðóçèòü ïðîãðàììó êîìàíäîé load: +load <ïîëíîå èìÿ èñïîëíÿåìîãî ôàéëà> [<àðãóìåíòû>] +Íàïðèìåð: +load /rd/1/example +LOAD /rd/1/aclock w200 h200 + LoaD /hd0/1/menuetos/dosbox/dosbox +Âñ¸, ÷òî ñòîèò ïîñëå ïåðâîãî ïðîáåëà ïîñëå èìåíè èñïîëíÿåìîãî ôàéëà, äîñëîâíî ïåðåäà¸òñÿ ïðîãðàììå â êà÷åñòâå êîìàíäíîé ñòðîêè. +Êîìàíäà load ñîîáùàåò î ðåçóëüòàòå â îêíå ñîîáùåíèé (íåìíîãî âûøå îêíà êîìàíäíîé ñòðîêè). Åñëè ïðîãðàììó óäàëîñü çàãðóçèòü, òî îá ýòîì ïîÿâèòñÿ ñîîòâåòñòâóþùåå ñîîáùåíèå; åñëè íå óäàëîñü, òî â ñîîáùåíèè áóäåò óêàçàíà ïðè÷èíà îøèáêè. Íàèáîëåå âåðîÿòíàÿ - "file not found", åñëè íåïðàâèëüíî óêàçàíî èìÿ ôàéëà. + +Îòëàä÷èê ìîæåò çàãðóæàòü ôàéëû ñ èíôîðìàöèåé îá èìåíàõ â ïðîãðàììå (ìåòêè, ãëîáàëüíûå ïåðåìåííûå) - òåêñòîâûå ôàéëû, êàæäàÿ ñòðîêà êîòîðûõ èìååò âèä 0x <èìÿ> (ñòðîêè, íå èìåþùèå òàêîé âèä, èãíîðèðóþòñÿ). Òàêîé ôàéë ìîæåò áûòü ñîçäàí âðó÷íóþ èëè ñãåíåðèðîâàí àâòîìàòè÷åñêè ïðè êîìïèëÿöèè èñõîäíèêà fasm'îì. +ßâíàÿ çàãðóçêà îñóùåñòâëÿåòñÿ êîìàíäîé load-symbols: +load-symbols <ïîëíîå èìÿ ôàéëà ñèìâîëîâ> +Êðîìå òîãî, ïðè âûïîëíåíèè êîìàíäû load îòëàä÷èê ïðîâåðÿåò íàëè÷èå ôàéëà ñ òàêèì æå èìåíåì, êàê çàãðóæàåìûé áèíàðíèê, è ðàñøèðåíèåì .dbg (/rd/1/example.dbg äëÿ ïåðâîãî èç ïðèìåðîâ âûøå), è åñëè òàêîé åñòü, çàãðóæàåò åãî àâòîìàòè÷åñêè (âûäàâàÿ ñîîáùåíèå "Symbols loaded", åñëè âñ¸ â +ïîðÿäêå). + +Ìîæåò ñëó÷èòüñÿ òàê, ÷òî çàãðóæåííàÿ ïðîãðàììà óïàêîâàíà. Îáùèé ïðèíöèï óïàêîâêè ïðîãðàìì ñëåäóþùèé: ñíà÷àëà èñõîäíûé ôàéë ïàêóåòñÿ (êàêèì-íèáóäü àëãîðèòìîì ñæàòèÿ), ïîòîì ïðèïèñûâàåòñÿ íåáîëüøîé ïî ðàçìåðó êîä, êîòîðûé ïîëó÷àåò óïðàâëåíèå ïðè çàïóñêå ïðîãðàììû, ðàñïàêîâûâàåò â ïàìÿòè èñõîäíûé êîä, ïîñëå ÷åãî ïåðåäà¸ò åìó óïðàâëåíèå. Åñëè ïðîãðàììà óïàêîâàíà, òî å¸ "íàñòîÿùèé" êîä íå âèäåí è äëÿ îòëàäêè íóæíî ïðåäâàðèòåëüíî ïðîéòè êîä ðàñïàêîâùèêà. koldbg îïðåäåëÿåò áîëüøèíñòâî ñóùåñòâóþùèõ óïàêîâùèêîâ (mxp, mxp_lzo, mxp_nrv, mtappack) è â ýòîì ñëó÷àå ïðåäëàãàåò àâòîìàòè÷åñêè ïðîéòè äî "íàñòîÿùåãî" êîäà. Ðåêîìåíäóåòñÿ ñîãëàñèòüñÿ (íàæàòü 'y' èëè ), íî ìîæíî è îòêàçàòüñÿ. Ïðè îòêàçå è â ñëó÷àå, êîãäà ïðîãðàììà óïàêîâàíà ÷åì-òî íåèçâåñòíûì, ìîæíî èñïîëüçîâàòü êîìàíäó "unpack" (áåç àðãóìåíòîâ). Âûçûâàéòå å¸ òîëüêî â ñëó÷àå, +êîãäà âû óâåðåíû, ÷òî ïðîãðàììà óïàêîâàíà è ÷òî óïðàâëåíèå åù¸ íå äîøëî äî îñíîâíîãî êîäà! [Íà÷èíàÿ ñ âåðñèè Kolibri 0.6.5.0, âåñü ýòîò àáçàö óæå íåàêòóàëåí, ïîñêîëüêó ïðèëîæåíèÿ ìîæíî óïàêîâûâàòü êàê è ëþáûå äâîè÷íûå ôàéëû kpack'îì è ïðè ýòîì êîä ðàñïàêîâùèêà íàõîäèòñÿ â ÿäðå è ðàñïàêîâêà ïðîçðà÷íà äëÿ îòëàäêè.] + +Çàãðóæåííóþ ïðîãðàììó ìîæíî ïðèáèòü êîìàíäîé "terminate" (áåç àðãóìåíòîâ). Êîìàíäà "detach" (áåç àðãóìåíòîâ) îòêëþ÷àåòñÿ îò ïðîãðàììû, ïîñëå ÷åãî ïðîãðàììà ïðîäîëæàåò âûïîëíÿòüñÿ íîðìàëüíî, êàê åñëè áû îòëàä÷èêà íå áûëî. Ïîñëå îáåèõ ýòèõ êîìàíä ïðîãðàììà ïåðåñòà¸ò áûòü îòëàæèâàåìîé. + +Ìîæíî çàíîâî çàãðóçèòü ïðîãðàììó äëÿ îòëàäêè êîìàíäîé "reload" (áåç àðãóìåíòîâ). Åñëè óæå åñòü çàãðóæåííàÿ ïðîãðàììà, òî îíà ïðèáèâàåòñÿ è +çàïóñêàåòñÿ (ñ ñàìîãî íà÷àëà) íîâûé ýêçåìïëÿð (ñ òîé æå êîìàíäíîé ñòðîêîé), â ýòîì ñëó÷àå êîìàíäà àíàëîãè÷íà êîìàíäàì: +terminate +load + ïðîòèâíîì ñëó÷àå çàíîâî çàãðóæàåòñÿ ïðîãðàììà, êîòîðóþ îòëàæèâàëè ïîñëåäíåé (â òåêóùåì ñåàíñå ðàáîòû ñ koldbg) (ñ òîé æå êîìàíäíîé ñòðîêîé), ò.å. ïî÷òè òî æå ñàìîå, ÷òî è load , íî êîìàíäà reload â îáîèõ ñëó÷àÿõ êîðî÷å è óäîáíåå; êðîìå òîãî, load ñ÷èòàåò, ÷òî çàãðóæàåòñÿ íîâàÿ ïðîãðàììà, è ïåðåâîäèò îêíî äàííûõ (ñì. íèæå) íà íóëåâîé àäðåñ, à reload ñîõðàíÿåò òåêóùèé àäðåñ. + +Âñåãäà äîñòóïíà êîìàíäà "help", êîòîðóþ ìîæíî ñîêðàùàòü äî "h". +Âñå êîìàíäû ðàçáèòû íà ãðóïïû. +help áåç àðãóìåíòîâ ïîêàçûâàåò ñïèñîê ãðóïï êîìàíä. +help ñ óêàçàíèåì ãðóïïû âûâîäèò ñïèñîê êîìàíä ýòîé ãðóïïû ñ êðàòêèìè +êîììåíòàðèÿìè. +help ñ óêàçàíèåì êîìàíäû âûâîäèò èíôîðìàöèþ î çàäàííîé êîìàíäå. +Íàïðèìåð: +help +help control +h LoaD + +Îêíî îòëàä÷èêà ñîñòîèò èç ñëåäóþùèõ ýëåìåíòîâ, ïåðå÷èñëÿåìûõ ñâåðõó âíèç: +- ñòðîêà ñîñòîÿíèÿ. Ïðè íàëè÷èè çàãðóæåííîé ïðîãðàììû ïîêàçûâàåò åå èìÿ è ñîñòîÿíèå ("Running"/"Paused"), ïðè îòñóòñòâèè ñîîáùàåò "No program loaded". +- îêíî ðåãèñòðîâ - ïîêàçûâàåò çíà÷åíèÿ ðåãèñòðîâ îáùåãî íàçíà÷åíèÿ, ðåãèñòðà eip, ðåãèñòðà ôëàãîâ è ðåãèñòðîâ FPU/MMX. Ðåãèñòð ôëàãîâ îòîáðàæàåòñÿ äâóìÿ ñïîñîáàìè: ïîëíîå hex-çíà÷åíèå è ñîñòîÿíèÿ îòäåëüíûõ ôëàãîâ: CF,PF,AF,ZF,SF,DF,OF: åñëè ôëàã ñáðîøåí, òî èçîáðàæàåòñÿ ìàëåíüêàÿ áóêâà, åñëè óñòàíîâëåí, òî çàãëàâíàÿ. Ðåãèñòðû, èçìåíèâøèåñÿ ñ ïðåäûäóùåãî ìîìåíòà, ïîäñâå÷èâàþòñÿ îðàíæåâûì. +- îêíî äàííûõ (îêíî äàìïà) - ïîêàçûâàåò ñîäåðæèìîå ïàìÿòè çàãðóæåííîé ïðîãðàììû +- îêíî êîäà (îêíî äèçàññåìáëåðà) - ïîêàçûâàåò êîä ïðîãðàììû â âèäå äèçàññåìáëèðîâàííûõ èíñòðóêöèé +- îêíî ñîîáùåíèé +- îêíî êîìàíäíîé ñòðîêè + + îêíå äàìïà ìîæíî ïðîñìàòðèâàòü äàííûå, íà÷èíàÿ ñ ëþáîãî àäðåñà, äëÿ ýòîãî åñòü êîìàíäà: +d <âûðàæåíèå> +Êîìàíäà d áåç àðãóìåíòîâ ïðîëèñòûâàåò îêíî äàìïà âíèç. Òî æå ñàìîå îòíîñèòñÿ ê îêíó êîäà è êîìàíäå u <âûðàæåíèå> èëè ïðîñòî u. +Íàïðèìåð: +d esi - ïîêàçûâàåò äàííûå, íàõîäÿùèåñÿ ïî àäðåñó esi (íàïðèìåð, ïîëåçíà ïåðåä âûïîëíåíèåì èíñòðóêöèè rep movsb) +d esp - ïîêàçûâàåò ñòåê +u eip - äèçàññåìáëèðóåò èíñòðóêöèè, íà÷èíàÿ ñ òåêóùåé + +Âûðàæåíèÿ â koldbg ìîãóò âêëþ÷àòü +- øåñòíàäöàòåðè÷íûå êîíñòàíòû +- èìåíà âñåõ ðåãèñòðîâ îáùåãî íàçíà÷åíèÿ (8 32-áèòíûõ, 8 16-áèòíûõ è 8 8-áèòíûõ) è ðåãèñòðà eip; çíà÷åíèÿ 16- è 8-áèòíûõ ðåãèñòðîâ ðàñøèðÿþòñÿ + íóëÿìè äî 32 áèò +- ÷åòûðå àðèôìåòè÷åñêèå îïåðàöèè +,-,*,/ (ñî ñòàíäàðòíûìè ïðèîðèòåòàìè) è ñêîáêè +- [åñëè åñòü èíôîðìàöèÿ î ñèìâîëàõ] èìåíà, çàãðóæåííûå èç dbg-ôàéëà +Âñå âû÷èñëåíèÿ ïðîèçâîäÿòñÿ ïî ìîäóëþ 2^32. +Ïðèìåðû âûðàæåíèé: +eax +eip+2 +ecx-esi-1F +al+AH*bl +ax + 2* bH*(eip+a73) +3*esi*di/EAX +Êîìàíäà +? <âûðàæåíèå> âû÷èñëÿåò çíà÷åíèå óêàçàííîãî âûðàæåíèÿ. + +Çíà÷åíèÿ ðåãèñòðîâ çàãðóæåííîé ïðîãðàììû ìîæíî èçìåíÿòü êîìàíäîé r, èìåþùåé äâå àáñîëþòíî ýêâèâàëåíòíûå ôîðìû: +r <ðåãèñòð> <âûðàæåíèå> +r <ðåãèñòð>=<âûðàæåíèå> +(â îáîèõ ñëó÷àÿõ ìîæíî ðàññòàâëÿòü ïðîáåëû ïî âêóñó).  êà÷åñòâå ðåãèñòðà ìîæíî óêàçûâàòü ëþáîé èç âûøåóïîìÿíóòûõ - 24 ðåãèñòðà îáùåãî íàçíà÷åíèÿ è eip. + + +Äîïóñòèì, êîìàíäà load óñïåøíî çàãðóçèëà ïðîãðàììó äëÿ îòëàäêè. Ñðàçó ïîñëå çàãðóçêè ïðîãðàììà ïðèîñòàíîâëåíà è íå âûïîëíÿåòñÿ. +Íàæàòèå F7 (àíàëîã êîìàíäíîé ñòðîêè - êîìàíäà "s") äåëàåò îäèí øàã â çàãðóæåííîé ïðîãðàììå, ïîñëå ÷åãî óïðàâëåíèå âîçâðàùàåòñÿ îòëàä÷èêó, êîòîðûé ïîêàçûâàåò íîâîå ñîäåðæèìîå ðåãèñòðîâ è ïàìÿòè. Ñèñòåìíûé âûçîâ int 40h (à òàêæå èíñòðóêöèè sysenter è syscall) ïðè ýòîì ñ÷èòàåòñÿ îäíèì øàãîì. +Íàæàòèå F8 (àíàëîã êîìàíäíîé ñòðîêè - êîìàíäà "p") òàêæå äåëàåò øàã â çàãðóæåííîé ïðîãðàììå, íî ïðè ýòîì âûçîâû ïðîöåäóð, ñòðîêîâûå îïåðàöèè ñ +ïðåôèêñîì rep/repz/repnz è öèêëû loop âûïîëíÿþòñÿ êàê îäèí øàã. +Êîìàíäû ïîøàãîâîãî âûïîëíåíèÿ èñïîëüçóþòñÿ, êàê ïðàâèëî, íà îòäåëüíûõ ó÷àñòêàõ ïðîãðàììû, êîãäà íóæíî, íàïðèìåð, ðåãóëÿðíî îòñëåæèâàòü çíà÷åíèÿ ðåãèñòðîâ è/èëè êàêèõ-òî ïåðåìåííûõ â ïàìÿòè. +Êîìàíäà g <âûðàæåíèå> âîçîáíîâëÿåò âûïîëíåíèå ïðîãðàììû è æä¸ò, ïîêà óïðàâëåíèå äîéä¸ò äî eip=ñîîòâåòñòâóþùåìó àäðåñó, è â ýòîò ìîìåíò ïðèîñòàíàâëèâàåò ïðîãðàììó. Êîìàíäà "g" áåç àðãóìåíòîâ ïðîñòî âîçîáíîâëÿåò âûïîëíåíèå ïðîãðàììû. + +Ïðèîñòàíîâèòü âûïîëíåíèå ïðîãðàììû ìîæíî êîìàíäîé "stop" (áåç àðãóìåíòîâ). + +Îáû÷íî òðåáóåòñÿ, ÷òîáû ïðîãðàììà íîðìàëüíî âûïîëíÿëàñü, íî ïðè íàñòóïëåíèè îïðåäåë¸ííûõ óñëîâèé ïðîãðàììà ïðèîñòàíàâàëàñü è óïðàâëåíèå ïîëó÷àë îòëàä÷èê. Ñîîòâåòñòâóþùèå óñëîâèÿ íàçûâàþòñÿ òî÷êàìè îñòàíîâà, breakpoint(s), â ïðîñòîðå÷èè - áðÿêàìè. Ïðîñòåéøèé òèï òî÷åê îñòàíîâà - íà êîíêðåòíûé àäðåñ, ò.å. ïðåðûâàòü âûïîëíåíèå ïðè eip=<çàäàííîå çíà÷åíèå>. Òàêèå òî÷êè îñòàíîâà óñòàíàâëèâàþòñÿ êîìàíäîé: +bp <âûðàæåíèå> +Çàìå÷àíèå. Åñëè åñòü òîëüêî îäíà òàêàÿ òî÷êà îñòàíîâà, óäîáíåå âìåñòî íå¸ èñïîëüçîâàòü êîìàíäó "g" ñ àðãóìåíòîì. + +Äðóãîé òèï òî÷åê îñòàíîâà - ïî îáðàùåíèþ ê çàäàííîìó ó÷àñòêó ïàìÿòè. Òàêèõ òî÷åê îñòàíîâà ìîæåò áûòü íå áîëüøå ÷åòûð¸õ (ïîñêîëüêó èñïîëüçóþòñÿ +àïïàðàòíûå âîçìîæíîñòè ïðîöåññîðîâ x86, ãäå äîïóñêàþòñÿ òîëüêî 4 òàêèõ òî÷êè). +bpm <âûðàæåíèå> - áðÿêàåòñÿ íà ëþáîé äîñòóï ê áàéòó ïî óêàçàííîìó àäðåñó +bpm w <âûðàæåíèå> - áðÿêàåòñÿ íà çàïèñü áàéòà ïî óêàçàííîìó àäðåñó +bpmb/bpmw/bpmd <âûðàæåíèå> - áðÿêàþòñÿ íà äîñòóï ê ñîîòâåòñòâåííî áàéòó, ñëîâó è äâîéíîìó ñëîâó ïî óêàçàííîìó àäðåñó. bpm è bpmb - ñèíîíèìû. Ïðè èñïîëüçîâàíèè bpmw/bpmd àäðåñ äîëæåí áûòü âûðîâíåí ñîîòâåòñòâåííî íà ãðàíèöó ñëîâà (ò.å. áûòü ÷¸òíûì) èëè íà ãðàíèöó äâîéíîãî ñëîâà (ò.å. äåëèòüñÿ íà 4). +bpmb,bpmw,bpmd w <âûðàæåíèå> - àíàëîãè÷íî äëÿ áðÿêà íà çàïèñü. + +Ñïèñîê óñòàíîâëåííûõ òî÷åê îñòàíîâà ìîæíî ïðîñìîòðåòü êîìàíäîé "bl", èíôîðìàöèþ î êîíêðåòíîé òî÷êå îñòàíîâà ìîæíî ïîëó÷èòü ñ ïîìîùüþ "bl <íîìåð>". Íåíóæíûå òî÷êè îñòàíîâà óäàëÿþòñÿ êîìàíäîé "bc <íîìåð>", âðåìåííî íåíóæíûå ìîæíî çàïðåòèòü êîìàíäîé "bd <íîìåð>", êîãäà îíè ñòàíóò ñíîâà íóæíû, èñïîëüçóéòå êîìàíäó "be <íîìåð>". + +Çàìå÷àíèÿ. + +1. Ïðè îòëàäêå ñîáñòâåííûõ ïðîãðàìì ìîæíî âñòàâëÿòü â êîä èíñòðóêöèè int3 (îáðàòèòå âíèìàíèå íà îòñóòñòâèå ïðîáåëà!). Òàêàÿ èíñòðóêöèÿ âûçûâàåò èñêëþ÷åíèå ïðè íîðìàëüíîì çàïóñêå, ÷òî ïðèâåä¸ò ê çàâåðøåíèþ ïðîöåññà, íî ïðè ðàáîòå ïîä îòëàä÷èêîì ïðîñòî àêòèâèçèðóåòñÿ îòëàä÷èê (ñ ñîîáùåíèåì "int3 command at xxx"). Ýòî ïîçâîëÿåò íå äóìàòü î òîì, êàêèå àäðåñà èñïîëüçîâàòü â êîìàíäàõ g è/èëè bp. Ìîæíî òàêæå ãåíåðèðîâàòü ôàéë ñ èíôîðìàöèåé î ñèìâîëàõ è çàãðóæàòü åãî, òîãäà íå òîëüêî íåò íóæäû ñàìîñòîÿòåëüíî âû÷èñëÿòü àäðåñà äëÿ "g" è "bp", íî è "u","d","?" áóäóò ïîíèìàòü óêàçàíèå èìåíè ìåòêè/ïåðåìåííîé. +2. Âåñü âûâîä è âåñü ââîä îðèåíòèðîâàí íà 16-ðè÷íóþ ñèñòåìó ñ÷èñëåíèÿ. +3. Êîãäà ïðîãðàììà âûïîëíÿåòñÿ, îêíà ðåãèñòðîâ è äàííûõ ïîêàçûâàþò èíôîðìàöèþ, îòíîñÿùóþñÿ ê ìîìåíòó äî âîçîáíîâëåíèÿ; óñòàíîâêà çíà÷åíèé ðåãèñòðîâ â ýòîì ðåæèìå íåâîçìîæíà. Âïðî÷åì, êîìàíäà "d" â ýòîì ðåæèìå ïîêàçûâàåò èíôîðìàöèþ, âåðíóþ â ìîìåíò âûäà÷è êîìàíäû. diff --git a/programs/develop/koldbg/sort.inc b/programs/develop/koldbg/sort.inc new file mode 100644 index 0000000000..8179bb26ba --- /dev/null +++ b/programs/develop/koldbg/sort.inc @@ -0,0 +1,68 @@ +; Sorting bunch of dwords, count = ecx, locating at address = edx, +; comparison function at ebx +; Destroy content of eax, ecx, esi, edi +Sort: + jecxz .Done + mov eax,ecx + @@: + push eax + call .Restore + pop eax + dec eax + jnz @B + @@: + cmp ecx,1 + jz .Done + mov esi,1 + mov edi,ecx + call .Exchange + dec ecx + mov eax,1 + call .Restore + jmp @B + .Done: + ret + + .Exchange: + push eax ecx + mov eax,[edx+esi*4-4] + mov ecx,[edx+edi*4-4] + mov [edx+esi*4-4],ecx + mov [edx+edi*4-4],eax + pop ecx eax + ret + + .Restore: + lea esi,[eax+eax] + cmp esi,ecx + ja .DonErr + push esi + mov esi,[edx+esi*4-4] + mov edi,[edx+eax*4-4] + call ebx + pop esi + ja .NeedXchg + cmp esi,ecx + jae .DonErr + push esi + mov esi,[edx+esi*4] + mov edi,[edx+eax*4-4] + call ebx + pop esi + jbe .DonErr + .NeedXchg: + cmp esi,ecx + jz .DoXchg + push esi + mov edi,[edx+esi*4-4] + mov esi,[edx+esi*4] + call ebx + pop esi + sbb esi,-1 + .DoXchg: + mov edi,eax + call .Exchange + mov eax,esi + jmp .Restore + .DonErr: + ret diff --git a/programs/develop/koldbg/symbols.inc b/programs/develop/koldbg/symbols.inc new file mode 100644 index 0000000000..7a98bec1ad --- /dev/null +++ b/programs/develop/koldbg/symbols.inc @@ -0,0 +1,415 @@ + +include 'sort.inc' + +; compare proc for sorter +Compare: + cmpsd + jnz @F + cmp esi,edi + @@: + ret + +; compare proc for sorter 2 +Compare2: + cmpsd + @@: + cmpsb + jnz @F + cmp byte [esi-1],0 + jnz @B + cmp esi,edi + @@: + ret + +FreeSymbols: + mov ecx,[Symbols] + jecxz @F + mcall 68,13 + and [Symbols],0 + and [NumSymbols],0 + @@: + ret + +;----------------------------------------------------------------------------- +; Load symbols event + +OnLoadSymbols.FileErr: + test ebp,ebp + jz @f + mcall 68,13,edi + ret + @@: + push eax + mcall 68,13,edi + mov esi,aCannotLoadFile + call PutMessageNoDraw + pop eax + cmp eax,0x20 + jae .Unk + mov esi,[LoadErrMsgs+eax*4] + test esi,esi + jnz PutMessage + .Unk: + mov esi,UnkErrMsg2 + jmp PutMessage + +OnLoadSymbols: + xor ebp,ebp +; load input file + mov esi,[CurArg] + call FreeSymbols + .Silent: +; esi = ptr to symbols filename + xor edi,edi + cmp [NumSymbols],edi ; Any previously loaded symbols? + je .LoadFile + call FreeSymbols ; Yep, free them + .LoadFile: + mov ebx,FN70AttrBlock ; Get file attributes + mov [ebx+21],esi + mcall 70 + test eax,eax + jnz .FileErr + cmp dword [FileAttr+36],edi ; Is upper dword of filesize larger then 0? + jnz .MemErr + mov ecx,dword [FileAttr+32] ; Lower dword of filesize + mcall 68,12 ; allocate the memory + test eax,eax + jz .MemErr + mov edi,eax + mov ebx,FN70ReadBlock + mov [ebx+12],ecx + mov [ebx+16],edi + mov [ebx+21],esi + mcall 70 ; Read the file into the allocated buffer + test eax,eax + jnz .FileErr + +; calculate memory requirements to load debug symbols + + lea edx,[ecx+edi-1] ; edx = EOF-1 + mov esi,edi + xor ecx,ecx + + mov [SymbolSection],1 ;;;;; + .CalcLoop: + cmp esi,edx + jae .CalcDone + cmp byte [esi],' ' ; skip spaces at the beginning of a line + jne .NotSpace + inc esi + jmp .CalcLoop + .NotSpace: + cmp byte [esi],'.' + jne .NotSection + inc esi + mov [SymbolSection],0 + cmp dword [esi],'text' + je .SectionOK + cmp dword [esi],'data' + je .SectionOK + cmp dword [esi],'bss ' + jne .SkipLine + .SectionOK: + inc [SymbolSection] + jmp .SkipLine + .NotSection: + cmp [SymbolSection],0 + je .SkipLine + + cmp word [esi],'0x' + jne .SkipLine + inc esi + inc esi + @@: + cmp esi,edx + jae .CalcDone + lodsb + or al,20h + sub al,'0' + cmp al,9 + jbe @B + sub al,'a'-'0'-10 + cmp al,15 + jbe @B + dec esi + @@: + cmp esi,edx + ja .CalcDone + lodsb + cmp al,20h + je @B + jb .CalcLoop + cmp al,9 + jz @B + add ecx,12+1 + inc [NumSymbols] + @@: + inc ecx + cmp esi,edx + ja .CalcDone + lodsb + cmp al,0xD + jz .CalcLoop + cmp al,0xA + jz .CalcLoop + jmp @B + + .SkipLine: + cmp esi,edx + jae .CalcDone + lodsb + cmp al,0xD + jz .CalcLoop + cmp al,0xA + jz .CalcLoop + jmp .SkipLine + + .CalcDone: + +; Allocate memory to place the debug symbols in + mcall 68,12 + test eax,eax + jnz .MemOK + inc ebx + mov ecx,edi + mov al,68 + mcall + .MemErr: + mov esi,aNoMemory + jmp PutMessage + .MemOK: + mov [Symbols],eax + mov ebx,eax + push edi + mov esi,edi + mov edi,[NumSymbols] + lea ebp,[eax+edi*4] + lea edi,[eax+edi*8] + +; Actual loading of the debug symbols +; esi->input, edx->EOF, ebx->ptrs, edi->names + + mov [SymbolSection],1 ;;;;; + .ReadLoop: + cmp esi,edx + jae .ReadDone + cmp byte [esi],' ' + jne .NotSpace2 + inc esi + jmp .ReadLoop + .NotSpace2: + cmp byte [esi],'.' + jne .NotSection2 + inc esi + mov [SymbolSection],0 + cmp dword [esi],'text' + je .SectionOK2 + cmp dword [esi],'data' + je .SectionOK2 + cmp dword [esi],'bss ' + jne .ReadLine + .SectionOK2: + inc [SymbolSection] + jmp .ReadLine + .NotSection2: + cmp [SymbolSection],0 + je .ReadLine + + cmp word [esi],'0x' + jnz .ReadLine + inc esi + inc esi + xor eax,eax + xor ecx,ecx + @@: + shl ecx,4 + add ecx,eax + cmp esi,edx + jae .ReadDone + lodsb + or al,20h + sub al,'0' + cmp al,9 + jbe @B + sub al,'a'-'0'-10 + cmp al,15 + jbe @B + dec esi + @@: + cmp esi,edx + ja .ReadDone + lodsb + cmp al,20h + jz @B + jb .ReadLoop + cmp al,9 + jz @B + mov dword [ebx],edi + add ebx,4 + mov dword [ebp],edi + add ebp,4 + mov dword [edi],ecx + add edi,4 + stosb + @@: + xor eax,eax + stosb + cmp esi,edx + ja .ReadDone + lodsb + cmp al,0xD + jz .ReadLoop + cmp al,0xA + jz .ReadLoop + mov byte [edi-1],al + jmp @B + + .ReadLine: + cmp esi,edx + jae .ReadDone + lodsb + cmp al,0xD + jz .ReadLoop + cmp al,0xA + jz .ReadLoop + jmp .ReadLine + + .ReadDone: + pop ecx + mcall 68,13 + mov ecx,[NumSymbols] + mov edx,[Symbols] + mov ebx,Compare + call Sort + mov ecx,[NumSymbols] + lea edx,[edx+ecx*4] + mov ebx,Compare2 + call Sort + mov esi,aSymbolsLoaded + call PutMessage + jmp DrawMessages;DrawDisAsm + +; +; in: EAX = address +; out: ESI, CF +FindSymbol: + cmp [NumSymbols],0 + jnz @F + .Ret0: + xor esi,esi + stc + ret + @@: + push ebx ecx edx + xor edx,edx + mov esi,[Symbols] + mov ecx,[NumSymbols] + mov ebx,[esi] + cmp [ebx],eax + jz .DoneZ + jb @F + pop edx ecx ebx + jmp .Ret0 + @@: + ; invariant: symbols_addr[edx] < eax < symbols_addr[ecx] + ; TODO: add meaningful label names + .0: + push edx + .1: + add edx,ecx + sar edx,1 + cmp edx,[esp] + jz .Done2 + mov ebx,[esi+edx*4] + cmp [ebx],eax + jz .Done + ja .2 + mov [esp],edx + jmp .1 + .2: + mov ecx,edx + pop edx + jmp .0 + + .DoneCont: + dec edx + .Done: + test edx,edx + jz @F + mov ebx,[esi+edx*4-4] + cmp [ebx],eax + jz .DoneCont + @@: + pop ecx + .DoneZ: + mov esi,[esi+edx*4] + add esi,4 + pop edx ecx ebx + clc + ret + .Done2: + lea esi,[esi+edx*4] + pop ecx edx ecx ebx + stc + ret + +;----------------------------------------------------------------------------- +; in: esi->name +; out: if found: CF = 0, EAX = value +; otherwise CF = 1 +FindSymbolName: + cmp [NumSymbols],0 + jnz @F + .StcRet: + stc + ret + @@: + push ebx ecx edx edi + push -1 + pop edx + mov ebx,[Symbols] + mov ecx,[NumSymbols] + lea ebx,[ebx+ecx*4] + ; invariant: symbols_name[edx] < name < symbols_name[ecx] + .0: + push edx + .1: + add edx,ecx + sar edx,1 + cmp edx,[esp] + jz .Done2 + call .Cmp + jz .Done + jb .2 + mov [esp],edx + jmp .1 + .2: + mov ecx,edx + pop edx + jmp .0 + .Done: + pop ecx + .DoneZ: + mov eax,[ebx+edx*4] + mov eax,[eax] + pop edi edx ecx ebx + clc + ret + + .Done2: + pop edx edi edx ecx ebx + stc + ret + .Cmp: + mov edi,[ebx+edx*4] + push esi + add edi,4 + @@: + cmpsb + jnz @F + cmp byte [esi-1],0 + jnz @B + @@: + pop esi + ret diff --git a/programs/develop/koldbg/tools.inc b/programs/develop/koldbg/tools.inc new file mode 100644 index 0000000000..7fd3459d27 --- /dev/null +++ b/programs/develop/koldbg/tools.inc @@ -0,0 +1,22 @@ +PGAlloc: +; in: ecx=size +; out: eax=pointer or NULL + push ebx + push 68 + pop eax + push 12 + pop ebx + int 40h + pop ebx + ret +PGFree: +; in: ecx=pointer +; destroys eax + push ebx + push 68 + pop eax + push 13 + pop ebx + int 40h + pop ebx + ret