linux 进程管理---硬件上下文切换

本文详细介绍了Linux系统中硬件上下文切换的过程,包括struct cpu_context和struct thread_struct的数据结构,以及switch_to、__switch_to、tls_thread_switch和cpu_switch_to等关键函数的功能。通过这些函数,系统实现了对进程的fpsimd状态、线程局部存储和寄存器的保存与恢复,确保进程切换的顺利进行。
摘要由CSDN通过智能技术生成

struct cpu_context {
        unsigned long x19;
        unsigned long x20;
        unsigned long x21;
        unsigned long x22;
        unsigned long x23;
        unsigned long x24;
        unsigned long x25;
        unsigned long x26;
        unsigned long x27;
        unsigned long x28;
        unsigned long fp;
        unsigned long sp;
        unsigned long pc;
};

struct thread_struct {
        struct cpu_context      cpu_context;   //保存非通用寄存器的值
        unsigned long           tp_value;        //指向线程私有的内存区域
#ifdef CONFIG_COMPAT
        unsigned long           tp2_value;
#endif
        struct fpsimd_state     fpsimd_state; 
        unsigned long           fault_address;  /* fault info */
        unsigned long           fault_code;     /* ESR_EL1 value */
        struct debug_info       debug;          /* debugging */

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值