




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
一、 find_first_bit(2)static inline int find_first_bit(const unsigned long *vaddr, unsigned size)const unsigned long *p = vaddr;int res = 32;unsigned long num;if (!size)return 0;size = (size + 31) 5;while (!(num = *p+) if (!-size)goto out;_asm_ _volatile_ (bfffo %1#0,#0,%0 : =d (res) : d (num & -num);res = 31;out:return (long)p - (long)vaddr - 4) * 8 + res;二、 find_next_bit(2)static inline int find_next_bit(const unsigned long *vaddr, int size,int offset)const unsigned long *p = vaddr + (offset 5);int bit = offset & 31UL, res;if (offset = size)return size;if (bit) unsigned long num = *p+ & (0UL bit);offset -= bit;/* Look for one in first longword */_asm_ _volatile_ (bfffo %1#0,#0,%0 : =d (res) : d (num & -num);if (res bits);四、 _cpu_clear(2人)static inline void _cpu_clear(int cpu, volatile cpumask_t *dstp)clear_bit(cpu, dstp-bits);五、 virt_to_phys(2人)static inline unsigned long virt_to_phys(volatile void * address)return _pa(void *) address);static inline void * phys_to_virt(unsigned long address)return _va(address);六、 smp_alloc_memory(2人)/* * We are called very early to get the low memory for the * SMP bootup trampoline page. */void _init smp_alloc_memory(void)trampoline_base = (void *) alloc_bootmem_low_pages(PAGE_SIZE);/* * Has to be in very low memory so we can execute * real-mode AP code. */if (_pa(trampoline_base) = 0x9F000)BUG();/* * Make the SMP trampoline executable: */trampoline_exec = set_kernel_exec(unsigned long)trampoline_base, 1);七、 current_thread_info(2人)来自# define smp_processor_id() raw_smp_processor_id()(smp.h)/* Return a thread_info struct. */static inline struct thread_info *current_thread_info(void)struct thread_info *ti;_asm_ _volatile_ (and.d $sp, %0 : =r (ti) : 0 (8191UL);return ti;八、 cpu_idle(2人)(kernelprocess.c)Void cpu_idle(void)set_thread_flag(TIF_POLLING_NRFLAG);while (1) /* FIXME - EV6 and LCA45 know how to power down the CPU. */while (!need_resched()cpu_relax();schedule();九、 fork_idle(2人)(kernelfrok.c)task_t * _devinit fork_idle(int cpu)task_t *task;struct pt_regs regs;task = copy_process(CLONE_VM, 0, idle_regs(®s), 0, NULL, NULL, 0);if (!task)return ERR_PTR(-ENOMEM);init_idle(task, cpu);unhash_process(task);return task;十、 for_each_cpu_mask(12)(kernelcpumask.h)#define for_each_cpu_mask(cpu, mask)for (cpu) = first_cpu(mask);(cpu) bits, nbits);十二、 _first_cpu(12)(kernelcpumask.h)static inline int _first_cpu(const cpumask_t *srcp, int nbits)return min_t(int, nbits, find_first_bit(srcp-bits, nbits);static inline int _next_cpu(int n, const cpumask_t *srcp, int nbits)return min_t(int, nbits, find_next_bit(srcp-bits, nbits, n+1);十三、 initialize_secondary(2 smpboot.c)/* * Everything has been set up for the secondary * CPUs - they just need to reload everything * from the task structure * This function must not return. */void _devinit initialize_secondary(void)/* * We dont actually need to load the full TSS, * basically just the stack pointer and the eip. */asm volatile(movl %0,%espntjmp *%1:r (current-thread.esp),r (current-thread.eip);十四、 alloc_cpu_id(2smpboot.c)static inline int alloc_cpu_id(void)cpumask_ttmp_map;int cpu;cpus_complement(tmp_map, cpu_present_map);cpu = first_cpu(tmp_map);if (cpu = NR_CPUS)return -ENODEV;return cpu;十五、 double_lock_balance(3人)/* * double_lock_balance - lock the busiest runqueue, this_rq is locked already. */static void double_lock_balance(runqueue_t *this_rq, runqueue_t *busiest)_releases(this_rq-lock)_acquires(busiest-lock)_acquires(this_rq-lock)if (unlikely(!spin_trylock(&busiest-lock) if (busiest lock);spin_lock(&busiest-lock);spin_lock(&this_rq-lock); elsespin_lock(&busiest-lock);十六、 cpu_isset(2人)/* No static inline type checking - see Subtlety (1) above. */#define cpu_isset(cpu, cpumask) test_bit(cpu), (cpumask).bits)十七、 spin_unlock(2人)# define spin_unlock(lock)_raw_spin_unlock(&(lock)-raw_lock)十八、 kernel_thread(3人) arch/arm/kernel/process.casm( .section .textn .alignn .type kernel_thread_helper, #functionnkernel_thread_helper:n mov r0, r1n mov lr, r3n mov pc, r2n .size kernel_thread_helper, . - kernel_thread_helpern .previous);/* * Create a kernel thread. */pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) struct pt_regs regs; memset(®s, 0, sizeof(regs); regs.ARM_r1 = (unsigned long)arg; regs.ARM_r2 = (unsigned long)fn; regs.ARM_r3 = (unsigned long)do_exit; regs.ARM_pc = (unsigned long)kernel_thread_helper | MODE_SVC26; return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, ®s, 0, NULL, NULL);十九、 _cpu_up(2 smpboot.c)int _devinit _cpu_up(unsigned int cpu)/* In case one didnt come up */if (!cpu_isset(cpu, cpu_callin_map) printk(KERN_DEBU
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 丽水市辅警考试题库2025
- 2024年中国工商银行集约运营中心招聘真题
- 2024年安徽阜阳市市直机关遴选公务员真题
- 2025新款合同样本大全
- 2025办公家具采购合同
- 2025年农业合作社合作合同范本
- 2025【合同范本】企业员工制服采购招标合同
- 2025注册会计师《会计》知识点行纪合同和委托合同
- 2025装修材料定期维护服务合同
- 火灾安全培训考题课件
- 黑河市重点中学2025届八下数学期末统考模拟试题含解析
- 郑远元加盟合同协议
- 慢性粒细胞白血病汇报课件
- 石化金属管道工程施工质量验收规范
- 口腔科病历书写规范课件
- 2025年湖南科技职业学院单招职业适应性测试题库必考题
- 《社会工作伦理》课件:实践原则与案例分析
- 建筑工程三级安全教育内容
- 采购作业流程管理细则
- 泥工 清包合同
- 儿童肥胖症心理干预-全面剖析
评论
0/150
提交评论