Linux 0.11的get_free_page分析

來源:互聯網
上載者: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 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    0xffc(%edx),%edi
8af:    f3 ab                    rep stos %eax,%es:(%edi)
8b1:    89 d0                    mov    %edx,%eax
8b3:    5f                       pop    %edi
8b4:    c3                       ret   

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.