Get_free_page Analysis in Linux 0.11

Source: Internet
Author: User

Unsigned long get_free_page (void)
{
Register unsigned long _ res ASM ("ax ");

_ ASM _ ("STD; repne; scasb \ n \ t"
"JNE 1f \ n \ t"
"Movb $1,1 (% EDI) \ n \ t"
"Sall $12, % ECx \ n \ t"
"Addl % 2, % ECx \ n \ t"
"Movl % ECx, % edX \ n \ t"
"Movl $1024, % ECx \ n \ t"
"Leal 4092 (% EDX), % EDI \ n \ t"
"Rep; stosl \ n \ t"
"Movl % edX, % eax \ n"
"1 :"
: "= A" (_ res)
: "0" (0), "I" (low_mem), "C" (paging_pages ),
"D" (mem_map + PAGING_PAGES-1)
);
Return _ res;
}

 

00000880 <_ get_free_page>:
880: 57 push % EDI
881: B8 00 00 00 mov $0x0, % eax
886: B9 00 0f 00 00 mov $0xf00, % ECx
88b: BF 1f 0f 00 00 mov $ 0xf1f, % EDI
890: FD std
891: F2 AE repnz SCAs % es :( % EDI), % Al
893: 75 1E JNE 8b3 <_ get_free_page + 0x33>
895: C6 47 01 01 movb $0x1, 0x1 (% EDI)
899: C1 E1 0C SHL $ 0xc, % ECx
89c: 81 C1 00 00 10 00 add $0x100000, % ECx
8a2: 89 ca mov % ECx, % edX
8a4: B9 00 04 00 00 mov $0x400, % ECx
8a9: 8d Ba FC 0f 00 00 Lea 0 xffc (% EDX), % EDI
8af: F3 AB rep STOs % eax, % es :( % EDI)
8b1: 89 D0 mov % edX, % eax
8b3: 5f pop % EDI
8b4: C3 RET

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.