course, the disadvantage of simple instruction is inefficiency.The virtual machine protection technique we're talking about here is to change the register-based CPU code to the pseudo-code of the stack-based CPU. The pseudo-code is then interpreted by the stack-based virtual machine (CPU).Instruction SystemThe key is to design a virtual stack-based virtual machine (CPU) instruction system. The more concise the command system, the better the reusability.Or take the add command as an example. The
First of all, the children who have assembled the computer should know that the computer is composed of CPU, memory, hard disk, motherboard, power supply, of course, playing games of children's shoes will also be obsessed with video cards (such as GTX980 Tactical nuclear graphics)As long as these things are available, the computer can run.But how do these things work together and let the program run?First, we need to know something called the operating system, essentially, it is also a program,
", and then press into the function return address (RET), and then jump to the function address followed by execution (here to add, The article describing the principle of buffer overflow under Unix mentions that after the RET is pressed in, it continues to press into the current EBP and replaces the EBP with the current ESP. However, there is an article that describes a function call under Windows that also has this step, but according to my actual d
From: http://blog.codingnow.com/2005/10/vc_memcpy.html
In many compilers, memcpy is an intrinsic function, that is, this function is implemented by the compiler. It is easier to be optimized during compilation than the inline function. The compiler can make multiple versions based on whether the memcpy parameter is a constant or a variable to achieve optimal performance. This cannot be done using inline or template.
Let's take a look at the optimization of memcpy by VC. (Vc6)
Void Fo
conventions;
(PS: although many compilations are listed later, I have made detailed comments. I hope those who are "afraid" of compilationIt can also be smoothly read, and provide some help for those who want to use the Assembly in VC
A:Test code:
Int X;Int _ cdecl add (int A, int B) {return a + B;} // call convention using _ cdeclInt main (INT argc, char * argv []){X = add (1, 2 );Return 0;}
Compiled assembly code in debug mode
Public? X @ 3ha; x_ BSS segment? X @ 3ha dd 01 h dup (?) ; X vari
address in the register EBX and adds 4 points to the memory;A few important assembly instructions
Example instruction
What it does
PUSHL%eax
Subl $4,%ESP//stack top pointer minus 4, stack grows down one positionMovl%eax, (%ESP)//The memory location where the value in the EAX is placed on the top of the stack pointer
POPL%eax
MOVL (%
,
unsigned short seg)
{
gate->a = (seg A careful analysis of Pack_gate's code will show that it is consistent with the definition in the picture above.
Through the above analysis we found that: int $80 the execution of the program to the kernel function System_call. Before we analyze this function, we first introduce the concept of the kernel stack. For each user process, there is a kernel stack and a user stack. Used to store function call parameters, local variables, and other secondary da
Student Bérénice Angremy
Course Content
Three magic weapon of computer• Stored program computer working model, the most basic logical structure of computer system;• Function call stack, the basis for high-level language operation, only machine language and assembly language when the stack mechanism for the computer is not so important, but with high-level language and functions, the stack becomes the basic function of the computer;• Interrupts, the base point of the multi-cha
, where the compaction stack is not really a stack, but the data is stored in a stacked way.Then there are two loops to place p corresponding byte values, note that this is p++, because the previous copy of the time is--p.Returns the SP when the data population is complete.Next, assign the start_stack of the current process to the page where P is located.Finally, it is worth noting that:Replace the code pointer on the stack with the program that originally called the system break with the entry
dtor_idx.7023
080483C0 T Frame_dummy
080483e4 T Main//Address of main function
U [email protected] @GLIBC_2.0
Call Gcc-s xx.c to get the assembly code:[CPP]View Plaincopy
. File "name_of_array.c"
. Globl A
. Data
. Align 4
. Type A, @object
. Size A, 8 //From here we know that sizeof (a) equals 8
A:
. long 1 //From here you can see that the compiler directly converts the int in the. c file to a long type
. Long 2
. section. Rodata
. LC0:
. String "a =
Author: Sandy Original works reproduced please indicate the source"Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000 "Experimental environment: C+linux64 bit (32-bit system may result in different)In accordance with the academic integrity of the terms, I guarantee that the answer for my original, all the references to the external materials have been marked by provenance.
———————————-Everyone, I'm a split line ————————————————
C source code is as follows
/******
.
Now we WinDbg stopped on mysqld!mysql_parse .
The one million question Is:everytime that any MYSQL Query executes something, it'll freeze my app until press F5 app? The answer is no, if we use a more intelligent breakpoint. We know the function mysql_parse , but are which memory address it is stored? A Call stack theory:
Let's explain this if the process is starting a function and it pushes the function parameters to be used. Then what happens with
currently executing statement will be displayed each time the next assembly statement is executed. The following shows the changes in%esp,%EBP, and stack contents at each step:
Procedure (the instruction in the command is actually a pending command)
Initial
Push $0x7
Call 0x80483e8 calls F (0x80483e8)
Push%EBP executes the F function, F initializes the frame pointer, moves the base address of the
Label:1. Memory view command x.x/x with hexadecimal outputX/D Output in decimalX/C output with single characterX/i Disassembly – Typically, we will usex/10i $ip-20 来查看当前的汇编($ip是指令寄存器)X/S output as a string(GDB) x/10i main 0X80483BB Push%ebp 0X80483BC 1:mov%esp,%ebp 0x80483be 3: and$0xfffffff0,%esp 0x80483c1 6:Sub$0x20,%esp 0x80483c4 9: Movl $0x0,0x1c (%
it, I couldn't understand it even though it was "kingftp Simplified Chinese version 1.1. Take care of him.
This software Icon has not been changed. You can see that it is VC. There is no shell. That's exactly what I want to do. Then I will look at it.
After my analysis, this software did not even detect the input. So I entered the Email: B Registration Code: 1 because there is a loop in it, so try to save
The string looks for "incorrect registration code. Please register again !". Get:
00414C80
= OPEN_EXISTING0012FD40 00000080 | Attributes = NORMAL0012fd4400000000 hTemplateFile = NULL0012FD48 00424552 riijjcm1.000000552
Here we know that the key file name is dinner. bin. Create a blank text file, enter some text, name it dinner. bin, and copy it to the folder where Crackme is located.Ctrl + F2 run the program again, and then run the breakpoint bp ReadFile and F9. Stack after disconnection:
0012FD20 0041F9C5/CALL to ReadFile from riijjcm1.0041F9BF0012FD24 00000080 | hFile = 00000080 (w
From: http://stackoverflow.com/questions/2515598/push-ebp-movlesp-ebp
When we analyze the att Assembly statements generated by GCC through disassembly, we often find that there are always the following two Assembly statements at the beginning of function calling:
Push % EBP
Movl % ESP, % EBP
At the end of the function call, you can see:
Leave
RET
Here I searched for some instructions on the Internet. tenfy simply translated the corresponding Englis
programs on the CPU use stacks to support function call operations. Stack is used to pass function parameters, store returned information, temporarily save original register values for recovery, and store local data. The stack used by a single function call operation is called the stack frame structure. The stack frame structure is generally 3-4. The two ends of the stack frame structure are specified by two pointers. The register EBP is usually used as a frame pointer, while
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.