kernel_thread中设置的tf_regs.reg_ebx和 tf_regs.reg_edx是何时保存在相应寄存器中的?
匿名2023/07/31 19:51:38提问
    lab4student
355

kernel_thread_entry函数如下:

kernel_thread_entry:        # void kernel_thread(void)

    pushl %edx              # push arg
    call *%ebx              # call fn

    pushl %eax              # save the return value of fn(arg)
    call do_exit            # call do_exit to terminate current thread

在kernel_thread函数中有如下语句:

    tf.tf_regs.reg_ebx = (uint32_t)fn;
    tf.tf_regs.reg_edx = (uint32_t)arg;

可以看到reg_ebx里存的就是init_main的入口地址,reg_edx里存的是"Hello world!!"这个字符串的指针.但是这些值是存在tf.tf_regs的变量里的,是什么时候存入寄存器的呢?貌似恢复寄存器只有在switch_to里做,而switch_to里恢复的是context中保存的值,那tf.tf_regs中保存的值是在哪里恢复的?

回答(0
    推荐问答
      Simple Empty
      暂无数据