已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 部编人教版八年级上册道德与法治(课件)第一单元 走进社会生活单元思考与行动一
- 房屋安全鉴定考核试卷(含答案解析)1
- 护理质量管理规范考核试题及答案
- 教师招聘考试教育综合知识题库103名校含答案解析
- 2025 年大学冰雪运动(滑雪技能训练)试题及答案
- 2025 年大学软件工程(软件工程导论)试题及答案
- 新员工考试试题(第二部分)要点
- 施工员岗位面试题库及答案解析(版)
- 氯碱公司从业人员安全培训复习题(附答案)
- 2025年刑警学院考研题库及答案
- 2025年及未来5年中国机电安装工程市场竞争态势及行业投资潜力预测报告
- 道路运输企业档案管理制度
- 术中输血安全管理
- 黑龙江省哈尔滨市九中2025-2026学年高一上学期期中语文试题(含答案及解析)
- 2025年乌苏市公安局开招聘警务辅助人员(67人)笔试考试参考试题附答案解析
- 2025重庆医科大学附属大足医院招聘4人笔试考试参考试题及答案解析
- DB5201-T 126-2022 商务楼宇等级划分与评定
- 2025北京国家电投集团创新投资招聘1人笔试历年常考点试题专练附带答案详解2套试卷
- 2025广东深圳市罗山科技园开发运营服务有限公司第二批招聘4人笔试考试参考试题及答案解析
- 学堂在线 人工智能 章节测试答案
- 彼得·蒂尔:硅谷教父的叛逆人生
评论
0/150
提交评论