zoukankan      html  css  js  c++  java
  • Mac操作系统XNU内核(九)系统调用过程代码某些细节:系统调用BSD和mach

    众所周知,BSD系统调用号,都是正值;mach系统调用号,都是负值。

    在这里判断(汇编代码osfmk/x86_64/idt64.s):

    /* Syscall dispatch routines! */
    
    /*
     *
     * 32bit Tasks
     * System call entries via INTR_GATE or sysenter:
     *
     *    r15     x86_saved_state32_t
     *    rsp     kernel stack
     *
     *    both rsp and r15 are 16-byte aligned
     *    interrupts disabled
     *    direction flag cleared
     */
    
    Entry(hndl_sysenter)
        /*
         * We can be here either for a mach syscall or a unix syscall,
         * as indicated by the sign of the code:
         */
        movl    R32_EAX(%r15),%eax
        testl    %eax,%eax
        js    EXT(hndl_mach_scall)        /* < 0 => mach */
                                    /* > 0 => unix */
        

    指令test1判断寄存器EAX的值,如果正,就继续执行到hndl_unix_scall;如果负,就跳到hndl_mach_scall。

    说明:上述逻辑仅限于32位时,64位有其他逻辑(在上一篇中)

  • 相关阅读:
    python 全栈基础作业题
    计算机基础之二:操作系统的发展史
    计算机基础系列之一:计算机硬件概述
    饼图
    折线图
    win_diy_monkey demo
    csv,Excel
    uiautomator2
    win ui自动化测试
    html
  • 原文地址:https://www.cnblogs.com/andypeker/p/4390093.html
Copyright © 2011-2022 走看看