In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
What are the assembly language instructions X86 and X87 assembly instructions respectively? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
I. data transmission instructions
They transfer data between memory and registers, registers and input and output ports.
1. General data transfer instruction.
MOV transmits words or bytes.
MOVSX extends symbols first, then transmits them.
MOVZX first zero expansion, and then transfer.
PUSH pushes the words into the stack.
POP pops the word off the stack.
PUSHA pushes AX,CX,DX,BX,SP,BP,SI,DI into the stack in turn.
POPA pops DI,SI,BP,SP,BX,DX,CX,AX off the stack in turn.
PUSHAD pushes EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI into the stack in turn.
POPAD pops EDI,ESI,EBP,ESP,EBX,EDX,ECX,EAX off the stack in turn.
BSWAP swaps the order of bytes in 32-bit registers
XCHG exchanges words or bytes. (at least one Operand is a register, and the segment register cannot be used as an Operand)
CMPXCHG compares and exchanges operands. (the second Operand must be the accumulator AL/AX/EAX)
XADD exchanges first and then accumulates. (the result is in the first Operand)
XLAT byte lookup table conversion.-BX points to the starting point of a 256byte table, where AL is the index value of the table (0-FFH); returns AL as the lookup result. ([BX+AL]-> AL)
two。 The input and output port transmits instructions.
IN I PUBO port input. (syntax: IN accumulator, {port number │ DX})
OUT I Dot O port output. (syntax: OUT {port number │ DX}, accumulator) the range of input and output ports is 0-255 when specified by immediate mode, and 0-65535 when specified by register DX.
3. The destination address transmits instructions.
LEA loads a valid address. Example: LEA DX,string; save the offset address to DX.
LDS transmits the target pointer and loads the contents of the pointer into DS. Example: LDS SI,string; save the segment address: offset address to DS:SI.
LES transmits the target pointer and loads the contents of the pointer into ES. Example: LES DI,string; save the segment address: offset address to ES:DI.
LFS transmits the target pointer and loads the contents of the pointer into FS. Example: LFS DI,string; save the segment address: offset address to FS:DI.
LGS transmits the target pointer and loads the contents of the pointer into GS. Example: LGS DI,string; save the segment address: offset address to GS:DI.
LSS transmits the target pointer and loads the contents of the pointer into SS. Example: LSS DI,string; save the segment address: offset address to SS:DI.
4. Flag to transmit instructions.
LAHF flag register transfer, loading the logo into AH.
SAHF flag register transfer, the AH content into the flag register.
The PUSHF flag goes into the stack.
POPF flag off the stack.
The PUSHD 32-bit flag enters the stack.
POPD 32-bit flag off the stack.
2. Arithmetic operation instruction
ADD addition.
ADC carries carry addition.
INC plus 1.
ASCII code adjustment for AAA addition.
Decimal adjustment of DAA addition.
SUB subtraction.
SBB with debit subtraction.
DEC minus 1.
NEG is reversed (minus 0).
CMP comparison. Subtract two operands, change only the flag bits, and do not send back the result.
ASCII code adjustment of AAS subtraction.
Decimal adjustment of DAS subtraction.
MUL unsigned multiplication. Results are sent back to AH and AL (byte operation), or DX and AX (word operation)
IMUL integer multiplication. Results are sent back to AH and AL (byte operation), or DX and AX (word operation)
ASCII code adjustment for AAM multiplication.
DIV unsigned division. Result echo: quotient echo AL, remainder echo AH, (byte operation); or quotient echo AX, remainder echo DX, (word operation).
IDIV integer division. Result echo: quotient echo AL, remainder echo AH, (byte operation); or quotient echo AX, remainder echo DX, (word operation).
ASCII code adjustment for AAD division.
CBW bytes are converted to words. (extend the symbols of bytes in AL to AH)
CWD words are converted into double words. (extend the symbols of words in AX to DX)
CWDE words are converted into double words. (extend the word symbols in AX to EAX)
CDQ double word extension. (extend the symbols of words in EAX to EDX)
Logical operation instruction
AND and Computing.
OR or arithmetic.
XOR XOR operation.
NOT is reversed.
TEST test. The two operands operate together, only the flag bits are modified, and the results are not sent back.
SHL logic moves to the left.
SAL arithmetic moves to the left. (= SHL)
SHR logic moves to the right.
SAR arithmetic moves to the right. (= SHR)
ROL loop moves to the left.
The ROR loop moves to the right.
The RCL moves to the left through the carry loop.
The RCR moves to the right through the carry loop.
Of the above eight shift instructions, the number of shifts can reach 255.
When you shift once, you can use the opcode directly. Such as SHL AX,1.
When the shift is more than 1, the number of shifts is given by the register CL.
Such as MOV CL,04 SHL AX,CL
IV. String instruction
DS:SI source segment register: source string indexing.
ES:DI target segment register: target string indexing.
CX repeat count.
AL/AX scan value.
D flag 0 indicates that SI and DI should be incremented automatically during repeated operations; 1 indicates that they should be automatically reduced.
The Z flag is used to control the end of a scan or comparison operation.
MOVS string transfer. (MOVSB transfers characters. MOVSW transfer word. MOVSD transmits two words. )
CMPS string comparison. (CMPSB compare characters. CMPSW comparison words. )
SCAS string scan. Compare the content of AL or AX with the target string, and the result is reflected in the flag bit.
LODS loads the string. Load the elements (words or bytes) in the source string into AL or AX one by one. (LODSB transmits characters. LODSW transfer word. LODSD transmits two words. )
STOS save string. It is the reverse process of LODS.
REP repeats when CX/ECX0.
REPE/REPZ repeats when ZF=1 or comparison results are equal and CX/ECX0.
REPNE/REPNZ repeats when ZF=0 or comparison results are not equal and CX/ECX0.
REPC repeats when CF=1 and CX/ECX0.
REPNC repeats when CF=0 and CX/ECX0.
5. Program transfer instruction
1. Unconditional transfer instruction (long transfer)
JMP unconditional transfer instruction
CALL procedure call
The RET/RETF procedure returns.
two。 Conditional transfer instruction (short transfer, within the distance of-128to + 127if and only if (SF XOR OF) = 1 OP10 2-> 1 machine code D9 F6 FINCSTP increases stack pointer 0-> 11-> 2 machine code D9 F7 FSETPM floating point setting protection machine code DB E42, Data transfer instruction FLDZ loads 0.0 into ST (0) machine code D9 EE FLD1 loads 1.0 into ST (0) machine code D9 E8 FLDPI loads π into ST (0) machine code D9 EB FLDL2T ln10 / ln2 load ST (0) machine code D9 E9 FLDL2E load 1/ln2 into ST (0) machine code D9 EA FLDLG2 load ln2/ln10 into ST (0) machine code D9 EC FLDLN2 load ln2 into ST (0) machine code D9 ED FLD Real4 ptr mem loaded mem single precision floating point machine code D9 mm000mmm FLD real8 ptr mem loaded mem double precision floating point machine code DD mm000mmm FLD real10 ptr mem loaded mem ten byte floating point machine code DB mm101mmm FILD word ptr mem loaded mem two byte integer machine code DF mm000mmm FILD dword ptr mem Load mem four-byte integer machine code DB mm000mmm FILD qword ptr mem load mem eight-byte integer machine code DF mm101mmm FBLD tbyte ptr mem load mem ten-byte BCD number machine code DF mm100mmm FST real4 ptr mem save single-precision floating point to mem machine code D9 mm010mmm FST real8 ptr mem save double-precision float Point to mem machine code DD mm010mmm FIST word ptr mem save two-byte integers to mem machine code DF mm010mmm FIST dword ptr mem save four-byte integers to mem machine code DB mm010mmm FSTP real4 ptr mem save single-precision floating point to mem and stack machine code D9 mm011mmm FSTP real8 ptr mem save double-precision floating point to mem and output Stack machine code DD mm011mmm FSTP real10 ptr mem saves ten-byte floating point to mem and stack machine code DB mm111mmm FISTP word ptr mem saves two-byte integers to mem and stack machine code DF mm011mmm FISTP dword ptr mem saves four-byte integers to mem and stack machine code DB mm011mmm FISTP qword ptr mem saves eight-byte integers to mem and leaves the stack Machine code DF mm111mmm FBSTP tbyte ptr mem saves ten bytes of BCD to mem and puts out stack machine code DF mm110mmm FCMOVB ST (0) Machine code DB D0iii FCMOVNE ST (0) when ST (I), machine code DB C1iii FCMOVNU ST (0) when ST (I)! =, machine code DB D1iii FCMOVU ST (0) when ST (I) is ordered. ST (I) transfer machine code DA D1iii3, comparison instruction FCOM ST (0)-ST (1) machine code D8 D1 FCOMI ST (0), ST (I) ST (0)-ST (1) machine code DB F0iii FCOMIP ST (0) ST (I) ST (0)-ST (1) and stack machine code DF F0iii FCOM real4 ptr mem ST (0)-real mem machine code D8 mm010mmm FCOM real8 ptr mem ST (0)-real mem machine code DC mm010mmm FICOM word ptr mem ST (0)-integer mem machine code DE mm010mmm FICOM dword ptr mem ST (0)-integer mem machine code DA mm010mmm FICOMP word ptr mem ST (0)-integer mem and stack machine code DE mm011mmm FICOMP dword ptr mem ST (0)-integer mem and stack machine code DA mm011mmm FTST ST (0)-0 machine code D9 E4 FUCOM ST (I) ST (0)-ST (I) machine code DD E0iii FUCOMP ST (I) ST (0)-ST (I) and stack machine code DD E1iii FUCOMPP ST (0)-ST (1) and secondary stack machine code DA E9 FXAM ST (0) Specification type machine code D9 E54, The operation instruction FADD adds the destination Operand (the variable or stack buffer directly after the instruction) to the source Operand (the variable or stack buffer that follows the destination Operand) The result is stored in the destination Operand FADDP ST (I). The instruction ST is to add the ST buffer to the destination Operand and pop up the ST buffer, and the destination Operand must be one of the stack buffers. Finally, no matter what the destination Operand is, after popping up once, the destination Operand will become the last stack buffer. FIADD FIADD adds ST to the source Operand. And then store it in the ST buffer. The source Operand must be a variable in the form of an integer or a short integer FSUB minus FSUBP FSUBR minus and subtracted FSUBRP FISUB FISUBR FMUL multiplied by FMULP FIMUL FDIV divided by FDIVP FDIVR FDIVRP FIDIV FIDIVR FCHS to change the positive and negative values of ST FABS to take out the value of ST Take its absolute value and save it back. FSQRT takes out the value of ST, opens the root, and then saves it back. The FSCALE instruction calculates the value of ST* 2 ^ St (1) and stores the result in ST without changing the value of ST (1). ST (1) must be an integer between-32768 and 32768. If the result cannot be determined beyond this range, if it is not an integer, ST (1) will be rounded to zero before it is calculated. So for security reasons, it is best to load the word group integers into ST (1). FRNDINT this instruction is to round the value of ST to integers. FPU provides four rounding methods. The RC in the control word group (control word) of FPU determines that the RC rounding control 00 rounds 01 to negative infinity and rounds 10 to positive infinity. 11 to zero give up the other one. Mechanical code, also known as machine code.
When ultraedit is opened, you will see when editing the exe file
There are a lot of numbers made up of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, these numbers
It is the machine code.
When you modify the program, you must modify the exe file by modifying the machine code.
two。 All the compilation knowledge that needs to be skillfully mastered (only so much)
It's not easy to understand, but you can memorize it by force, get familiar with your face, and then you'll understand it slowly.
Cmp an and b compare an and b
Mov a _ r _ b sends the value of b to a
Ret returns the main program
Nop has no effect. For the abbreviation of "no operation", which means "do nothing" (machine code 90) * machine code, see above.
(explanation: when ultraedit opens the edit exe file, you see 90, which is equivalent to the assembly statement nop)
Call call subroutine
Jump if je or jz are equal (machine code 74 or 0F84)
Jump if jne or jnz are not equal (machine code 75 or 0F85)
Jmp unconditional hop (machine code EB)
Jump if jb is less than
Jump if ja is greater than
Jump if jg is greater than
Jump if jge is greater than or equal to
Jump if jl is less than
Jump if jle is less than or equal to
Pop out of stack
Push stack
three。 Common modifications (machine code)
74 = > 75 74 = > 90 74 = > EB
75 = > 74 75 = > 90 75 = > EB
Jnz- > nop
75-> 90 (corresponding machine code modification)
Jnz-> jmp
75-> EB (corresponding machine code modification)
Jnz-> jz
75-> 74 (normal) 0F 85-> 0F 84 (in special cases, sometimes, corresponding machine code modification)
four。 Different modification methods for two different situations
1. Change to jmp
Je (jne,jz,jnz) = > jmp the corresponding machine code EB (the first jump found up by the error message) the function of jmp is to jump absolutely, unconditionally, thus skipping the following error message
Xxxxxxxxxxxx error message, such as: wrong registration code, sorry, unregistered version cannot..., "Function Not Avaible in Demo" or "Command Not Avaible" or "Can't save in Shareware/Demo", etc. (we want to skip it and prevent it from appearing)
. . .
. . .
Where is the correct route of xxxxxxxxxxxx
two。 Change to nop
Je (jne,jz,jnz) = > nop the corresponding machine code 90 (the first jump found up with the correct information) the function of nop is to erase the jump, invalidate the jump and lose its effect, thus making the program go smoothly to the correct information immediately following it.
Xxxxxxxxxxxx correct information, such as: registration is successful, thank you for your support, etc. (we hope it will not be skipped, let it appear, and the program must come here smoothly)
. . .
. . .
Xxxxxxxxxxxx error messages (we hope not to jump here, do not let it appear) they transfer data between memory and registers, registers and input and output ports.
The answers to the questions about the assembly language instructions Daquan X86 and X87 assembly instructions are shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.