Page fault

这段bug越是浪漫越美妙, 离别最是吃不消

我最不忍看你 背向我转面
要走一刻请不必诸多眷恋
浮沉浪似人潮 哪会没有思念
你我伤心到讲不出再见
——-《讲不出再见》

好,Page fault exceptions 准备揭开它的神秘面纱……

先从根源说起

Indicates that, with paging enabled (the PG flag in the CR0 register is set), the processor detected one of the following conditions
while using the page-translation mechanism to translate a linear address to a physical address

    /**
         传递给 thread_state_suspend()三个参数
         wo: 
            即x0  
            #define THREAD_FLAGS_EXIT_ON_FOREIGN_INTR   (1 << 2)

            在整个os中仅有两处调用 thread_state_suspend ,

            另一处是在thread_rpc中 : 

            FUNC thread_rpc , 
            .....
            mov w0, #THREAD_FLAGS_COPY_ARGS_ON_RETURN
            bl  thread_state_suspend

            当thread_resume_from_rpc()的时候,会检查该flags,

            Return From RPC To Request Service of a foreign interrupt must not
            get parameters from non-secure world

            if (threads[n].flags & THREAD_FLAGS_COPY_ARGS_ON_RETURN) {
                ....
            }
            两者不只是调用同一个函数,且都是运行在屏蔽intr环境中,都是一个密室
            这里是和linux kernel intr top half 是相似的地方 

            好了,那么会问 : 到底什么是intr ? 
            为什么这么重要,为什么要处处防着它 ?

            牙膏厂给intr下了一个定义 : 

            Interrupts and exceptions are events that indicate that
            a condition exists Somewhere In The System

            哈哈,感觉起来是不是如沐春风呢! 
    */
    mov w0, #THREAD_FLAGS_EXIT_ON_FOREIGN_INTR
    mrs x1, spsr_el1
    mrs x2, elr_el1
    bl  thread_state_suspend
    mov w4, w0      /* Supply thread index */

猜你喜欢

转载自blog.csdn.net/leesagacious/article/details/81953050