arm linux进程切换,arm进程调度中的上下文切换

arm进程调度中的上下文切换

发布时间:2006-08-16 10:03:21来源:红联作者:邓西村

前段时间,偷懒了。

上次到了cpu_switch_mm,它是:

#define cpu_switch_mm(pgd,tsk) cpu_set_pgd(__virt_to_phys((unsigned long)(pgd)))

上面引用到了:

#define cpu_set_pgd(pgd) processor.pgtable.set_pgd(pgd)

#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET) (摘自AT9200,所有ARM体系的都差不多)

processor是processor结构体的实例,processor定义如下,是个很负责的结构。

/*

* Don't change this structure - ASM code

* relies on it.

*/

extern struct processor {

/* MISC

* get data abort address/flags

*/

void (*_data_abort)(unsigned long pc);

/*

* check for any bugs

*/

void (*_check_bugs)(void);

/*

* Set up any processor specifics

*/

void (*_proc_init)(void);

/*

* Disable any processor specifics

*/

void (*_proc_fin)(void);

/*

* Special stuff for a reset

*/

volatile void (*reset)(unsigned long addr);

/*

* Idle the processor

*/

int (*_do_idle)(void);

/*

* Processor architecture specific

*/

struct { /* CACHE */

/*

* flush all caches

*/

void (*clean_invalidate_all)(void);

/*

* flush a specific page or pages

*/

void (*clean_invalidate_range)(unsigned long address, unsigned long end, int flags);

/*

* flush a page to RAM

*/

void (*_flush_ram_page)(void *virt_page);

} cache;

struct { /* D-cache */

/*

* invalidate the specified data range

*/

void (*invalidate_range)(unsigned long start, unsigned long end);

/*

* clean specified data range

*/

void (*clean_range)(unsigned long start, unsigned long end);

/*

* obsolete flush cache entry

*/

void (*clean_page)(void *virt_page);

/*

* clean a virtual address range from the

* D-cache without flushing the cache.

*/

void (*clean_entry)(unsigned long start);

} dcache;

struct { /* I-cache */

/*

* invalidate the I-cache for the specified range

*/

void (*invalidate_range)(unsigned long start, unsigned long end);

/*

* invalidate the I-cache for the specified virtual page

*/

void (*invalidate_page)(void *virt_page);

} icache;

struct { /* TLB */

/*

* flush all TLBs

*/

void (*invalidate_all)(void);

/*

* flush a specific TLB

*/

void (*invalidate_range)(unsigned long address, unsigned long end);

/*

* flush a specific TLB

*/

void (*invalidate_page)(unsigned long address, int flags);

} tlb;

struct { /* PageTable */

/*

* Set the page table

*/

void (*set_pgd)(unsigned long pgd_phys);

/*

* Set a PMD (handling IMP bit 4)

*/

void (*set_pmd)(pmd_t *pmdp, pmd_t pmd);

/*

* Set a PTE

*/

void (*set_pte)(pte_t *ptep, pte_t pte);

} pgtable;

} processor;

可以想象每个处理器都应该有一个processor实例与之对应。ARM的内存管理是怎样的呢?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值