First, through the disassembly language, let's take a look at the relationship between the simplest recursive function and the stack.
In Visual Studio 2008 and debug environments, you can view the language after disassembly in debug/Windows/disassembly. Now let's take a look at factorial n! Implementation
The C language implementation code is as follows:
#include
The language after disassembly is as follows:
Main Program
int main(void){00DB1FD0 push ebp 00DB1FD1 mov ebp,esp
at the disassembly below:C code same as above Ubuntu +Bit disassembly:intMain () {804846D: - Push %EBP 804846E: theE5 mov%esp,%EBP 8048470: theE4 f0 and $Xfffffff0,%esp 8048473: theEcTen Sub $0x10,%esp Test (1, 2); 8048476: C7 - - Geneva Geneva xx xxMovl $X2,0x4(%esp)804847D:xx 804847E:c7Geneva - on xx xx xxMovl $X1, (%esp)8048485: E88A FF FF call8048414return 0;804848A:b8xx xx xx xxmov $x0,%eax}intTestintAintb) {8048414: -
of instruction (below) are to assign a value of 0CCCCCCCCh to the memory area of the 48h that was just left out.00401039 Lea edi,[ebp-48h]0040103C mov ecx,12h00401041 mov eax,0cccccccch00401046 Rep stos dword ptr [edi].The next three stack instructions, respectively, Ebx,esi,edi into the stack, which is also part of the "protection scene", these are part of the
MOV Esi,offset @s1MOV Edi,offset @s2MOV ecx,10CldRep Movsd1.Rep Movsd every ecx! =0 executes Movsd, then ecx=ecx-1 movsd move Ds:[si] to Es:[di], in 32-bit assembler can replace the Si,edi with ESI instead of Di
2. at the same time because in general exe DS = ES program starting position so another ESI = offset @s1 can find the variable s1, edi= offset @s2 can f
locate the memory segment Descriptor mov es, ax xor edi, edi mov edi, (up to ten +) //screen 10th, No. 0 column br> mov ah, 0ch //0000: Black bottom 1100: Red word mov al, ' G ' mov [es:edi],ax jmp $nbs P LenOfCode32 equ $-label_code32 ===================================
The approximate meaning of this piece of code is:First in the 16-bit code segment
Assembly language: Movsb,movsw,movsdTransferred from: http://blog.csdn.net/zhenyongyuan123/article/details/8364011Currently, the 80386 series of processors provide several sets of instructions for handling byte, Word, and double-word values, although these directives become basic string directives, but their usage is not limited to character arrays.Instructions:MOVSB, MOVSW, Movsd Describe:Moves the string data, copying the data at the memory address addressed by the ESI register to the memory a
))LSet L = bIp2long = L.valEnd Function
It's good and powerful to copy mybytes type variables to MyLong type variables with LSet. Look at the generated assembly code:
Copy Code code as follows:
00401A0E Lea eax, DWORD ptr [ebp-0x20]; Address of variable B
00401A11 push EAX
00401a12 Lea eax, DWORD ptr [ebp-0x14]; The address of the variable L
00401A15 push EAX
00401A16 Push 0x4
00401a18 call __vbacopybytes; JMP to Msvbvm60.__vbacopybytes
Called is the __v
The usage of "[]" has been described in "FAQ" and is cited as follows:
1, push DWORD ptr [024c1100] pressure stack 024c1100 value of two words2, CMP eax,[ebp+14] eax-ebp+14 valid value, does not retain the value, mainly looks at the sign bit3, CMP byte ptr [eax],46 byte type eax-46, see sign bit4, Lea eax,[edx-02] edx-02 valid value (an address value) to EAX5, MOV ecx,[edx+08] edx+8 value as the address, this address points to the value of ECX
I am going to add a few more examples of what I have
, the maximum bandwidth of data transmission depends on the width and transmission frequency of all data transmitted simultaneously, that is, the data bandwidth = bus frequency × data Bit Width limit 8. For example, Intel pⅱ 333 uses 66 MHz Front-End bus, so the data exchange bandwidth between it and the memory is 528 MB/S= (66 × 64)/8, while its P ⅱ 350 uses a 800 MHz Front-End bus, so its peak bandwidth for data exchange is 100 Mb/s = (× 64)/8. For example, IntelThe
bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x0004a6baDevice Boot Start End Blocks Id System/Dev/sda1 × 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./Dev/sda2 26 7859 62914560 8e Linux LVM/Dev/sda3 7859 9164 10489446 83 Linux
Partx-a actually means to notify (tell) the kernel that the disk information has changed. You need to update it once, but it is not displayed once. We can execute it to check the result, if it is 10 Gb, the primary pa
the use of mobile phone habits, active cleaning memory, closed background programs and other services. All of this is done locally on the phone, and users do not have to worry about their personal privacy being uploaded to the public space in the cloud, with the ability to enjoy better battery life and running speed.This may be somewhat different from the user's traditional perception of AI, after all, the majority of manufacturers now focus on promoting the ability to take pictures of mobile A
Lenovo's Notebook, the graphics card nvidia gt218m, defaults to using open source drivers, but hangs and then wakes up on the black screen without returning to the desktop.1. WORKAROUND: Install nvidia proprietary driver $sudo Apt-get installation nvidia-currentNew problem: Boot logo and on/Off animation are not normal, only display text logoWorkaround: 1, edit/etc/default/grub file$sudo Gedit/etc/default/grubWillgrub_cmdline_linux_default= "Quiet Splash"Switchgrub_cmdline_linux_default= "VIDEO=
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.