void start_kernel(void)分析 ! \linux-1.0\init\main.c

//启动系统内核
//asmlinkage 为通过堆栈传递参数,默认为通过寄存器传递参数。
asmlinkage void start_kernel(void)
{
/** Interrupts are still disabled. Do necessary setups, then* enable them*///设置中断向量表set_call_gate(&default_ldt,lcall7);//设定初始化设备地址ROOT_DEV = ORIG_ROOT_DEV;// 设定设备信息地址drive_info = DRIVE_INFO;//设定屏幕信息地址screen_info = SCREEN_INFO;//设定aux 设备当前地址aux_device_present = AUX_DEVICE_INFO;//设定内存末端值memory_end = (1<<20) + (EXT_MEM_K<<10);memory_end &= PAGE_MASK;//设定临时盘的大小ramdisk_size = RAMDISK_SIZE;//拷贝命令行copy_options(command_line,COMMAND_LINE);//如果内存大于16M 设定内存末端为16M
#ifdef CONFIG_MAX_16Mif (memory_end > 16*1024*1024)memory_end = 16*1024*1024;
#endif//设定root 的多位标志位if (MOUNT_ROOT_RDONLY)root_mountflags |= MS_RDONLY;//如果最末端大于1M 设定内存开始点和最低内存开始点if ((unsigned long)&end >= (1024*1024)) {memory_start = (unsigned long) &end;low_memory_start = PAGE_SIZE;} else{//如果内存不大于1M ;设定内存开始点为1M处, 最低内存开始为end;memory_start = 1024*1024;low_memory_start = (unsigned long) &end;}//低内存开始点对齐low_memory_start = PAGE_ALIGN(low_memory_start);//页缓存区初始化memory_start = paging_init(memory_start,memory_end);//设定EISA 线路标志	if (strncmp((char*)0x0FFFD9, "EISA", 4) == 0)EISA_bus = 1;//设置各个中断向量表.trap_init();//初始化中断请求init_IRQ();//日程初始化sched_init();//解析命令行parse_options(command_line);
#ifdef CONFIG_PROFILEprof_buffer = (unsigned long *) memory_start;prof_len = (unsigned long) &end;prof_len >>= 2;memory_start += prof_len * sizeof(unsigned long);
#endif//分配内存 初始化memory_start = kmalloc_init(memory_start,memory_end);//memory_start = chr_dev_init(memory_start,memory_end);memory_start = blk_dev_init(memory_start,memory_end);//设定允许中断sti();//校准延时calibrate_delay();
#ifdef CONFIG_INET//网络初始化memory_start = net_dev_init(memory_start,memory_end);
#endif
#ifdef CONFIG_SCSI//scsi 设备初始化memory_start = scsi_dev_init(memory_start,memory_end);
#endif//节点初始化memory_start = inode_init(memory_start,memory_end);//文件表初始化memory_start = file_table_init(memory_start,memory_end);//内存区初始化mem_init(low_memory_start,memory_start,memory_end);//缓存初始化buffer_init();// 时间初始化time_init();//软盘初始化floppy_init();//sock 初始化sock_init();
#ifdef CONFIG_SYSVIPC//ipc 初始化ipc_init();
#endif//设定允许中断sti();/** check if exception 16 works correctly.. This is truly evil* code: it disables the high 8 interrupts to make sure that* the irq13 doesn't happen. But as this will lead to a lockup* if no exception16 arrives, it depends on the fact that the* high 8 interrupts will be re-enabled by the next timer tick.* So the irq13 will happen eventually, but the exception 16* should get there first..*///hard_math设定为是时进行响应处理if (hard_math) {unsigned short control_word;printk("Checking 386/387 coupling... ");timer_table[COPRO_TIMER].expires = jiffies+50;timer_table[COPRO_TIMER].fn = copro_timeout;timer_active |= 1<<COPRO_TIMER;__asm__("clts ; fninit ; fnstcw %0 ; fwait":"=m" (*&control_word));control_word &= 0xffc0;__asm__("fldcw %0 ; fwait": :"m" (*&control_word));outb_p(inb_p(0x21) | (1 << 2), 0x21);__asm__("fldz ; fld1 ; fdiv %st,%st(1) ; fwait");timer_active &= ~(1<<COPRO_TIMER);if (!fpu_error)printk("Ok, fpu using %s error reporting.\n",ignore_irq13?"exception 16":"irq13");}//如果没有设定数字仿真设定进行报错
#ifndef CONFIG_MATH_EMULATIONelse {printk("No coprocessor found and no math emulation present.\n");printk("Giving up.\n");for (;;) ;}
#endif//设定系统版本 并打印出来system_utsname.machine[1] = '0' + x86;printk(linux_banner);//设定到用户模式move_to_user_mode();//初始化完成, 创建子进程进入到shell界面.if (!fork())		/* we count on this going ok */init();
/** task[0] is meant to be used as an "idle" task: it may not sleep, but* it might do some general things like count free pages or it could be* used to implement a reasonable LRU algorithm for the paging routines:* anything that can be useful, but shouldn't take time from the real* processes.** Right now task[0] just does a infinite idle loop.*///父进程进行休眠。for(;;)idle();
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/462408.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ASP.NET MVC3源码下载

这个貌似是微软官方的源代码 我收藏了 有时间在来研究研究 下载地址&#xff1a;http://files.cnblogs.com/happyyouandme/mvc3%E6%A1%86%E6%9E%B6%E6%BA%90%E7%A0%81.zip 转载于:https://www.cnblogs.com/happyyouandme/archive/2011/11/22/2259108.html

H3C交换机配置学习随笔

1、交换机配置VLAN vlan 创建VLAN: <h3c>system-view [h3c]vlan 10 删除ID为10的vlan&#xff1a;undo vlan 10 注&#xff1a;任何型号的交换机&#xff0c;都支持4096个vlan vlan ID 从0--4095 vlan 0是保留vlan vlan 1是默认vlan display vlan查看本机有多少个vlan&am…

Linux系统目录结构及主要内容

为什么80%的码农都做不了架构师&#xff1f;>>> 文件结构 &#xff1a; /&#xff1a;根目录&#xff0c;所有的目录、文件、设备都在/之下&#xff0c;/就是Linux文件系统的组织者&#xff0c;也是最上级的领导者。 /bin&#xff1a; bin 就是二进制&#xff08;b…

select + 线程池 回应服务器(windows)

//为了支持移植 沿用Ptypes的头文件 #define WIN32 1 #include "ptime.h" #include "pinet.h" #include "ptypes.h" #include "pasync.h"#ifdef WIN32 #pragma comment(lib, "ptypes.lib") #pragma comment(lib, "ws2_…

一个程序员的创业失败教训

原文链接 http://blog.jobbole.com/6752/ 这段经历是悲伤的&#xff0c;也是快乐的&#xff0c;毕竟创业是充满激情的&#xff0c;想着自己以后可以不再给人打工了&#xff0c;可以给自己打工了&#xff0c;一个程序员写了很多年的程序之后&#xff0c;能够有机会给自己写程序&…

学习《深度学习入门:基于Python的理论与实现》高清中文版PDF+源代码

入门神经网络深度学习&#xff0c;推荐学习《深度学习入门&#xff1a;基于Python的理论与实现》&#xff0c;这本书不来虚的&#xff0c;一上来就是手把手教你一步步搭建出一个神经网络&#xff0c;还能把每一步的出处讲明白。理解神经网络&#xff0c;很容易就能入门。 深度学…

每日英文2013.06.19

1.contact /ˈkɑnˌtkt/ v. 接觸;聯繫 (1) Customers may contact any of our location to inquire about car rentals. a.inquire /ɪnˈkwaɪr/ v. to ask someone for information about something b.rental /ˈrent(ə)l/ n. an amount of money that you pay for rentin…

JavaScript 刷新当前页面

1 history.go(0) 2 location.reload() 3 locationlocation 4 location.assign(location) 5 document.execCommand(Refresh) 6 window.navigate(location) 7 location.replace(location) 8 document.URLlocation.href 转载于:https://www.cnblogs.com/SUPERAI/archive/2011/11/2…

学习《PythonWeb开发实战(董伟明)》中文PDF+源代码

python可以用了进行数据分析&#xff0c;也可以进行Web开发&#xff0c;一般会使用django或者flask等进行开发。 国内介绍python web的书有写的不错的&#xff0c;推荐看看《PythonWeb开发实战》 他的定位是进阶读者&#xff0c;介绍了Python web的生态&#xff0c;有些包介绍得…

周鸿祎:在360新员工入职培训上的讲话

这个是周鸿祎给入司360新员工的一段话&#xff0c;不但适合360&#xff0c;也适合所有的公司员工。特此分享。我想给新入职的同事讲一讲我的期望&#xff0c;再提几个建议。我这个人喜欢说真话&#xff0c;不喜欢说漂亮话&#xff0c;因为漂亮话没用。但说真话&#xff0c;大家…

file_exists函数总是返回false

今天在一台开发服务器上遇到一个奇怪的问题&#xff0c;通过WEB方式访问PHP程序 file_exists() 总是返回false&#xff0c;试了很多文件和目录都不行。开始以为是 safe mode 的问题&#xff0c;但是 php.ini 中的safe_mode 选项值是 Off。接着又在命令行以 root 账号执行测试程…

简单的web框架(python)

1、web框架介绍 Web框架&#xff08;Web framework&#xff09;是一种开发框架&#xff0c;用来支持动态网站、网络应用和网络服务的开发。这大多数的web框架提供了一套开发和部署网站的方式&#xff0c;也为web行为提供了一套通用的方法。web框架已经实现了很多功能&#xff0…

set_bit() 等位函数分析! \linux-1.0\linux\include\asm\bitops.h

//将addr的第nr(nr为0-31)位置值置为1; //nr大于31时&#xff0c;把高27的值做为当前地址的偏移&#xff0c;低5位的值为要置为1的位数 extern __inline__ int set_bit(int nr,int * addr) { int mask, retval; addr nr >> 5; //nr大于31时&…

使用面向对象技术创建高级 Web 应用程序

作者&#xff1a; 出处&#xff1a; 使用面向对象技术创建高级 Web 应用程序 来源:开源中国社区 作者:oschina最近&#xff0c;我面试了一位具有5年Web应用开发经验的软件开发人员。她有4年半的JavaScript编程经验&#xff0c;自认为自己具有非常优秀的JavaScript技能&#xff…

[翻译]DirectX 状态( 转)

[翻译]DirectX 状态状态 Direct3D设备使用状态来配置所有的管道处理。采样器状态通过例如定义纹理寻址方式(texture addressing)和过滤模式控制纹理采样器设置。纹理状态设置用于控制纹理如何被组合以及相互之间如何混合的多重纹理混合器。渲染状态控制大多数管道状态。 状态块…

【转载】浅谈React编程思想

React是Facebook推出的面向视图层开发的一个框架&#xff0c;用于解决大型应用&#xff0c;包括如何很好地管理DOM结构&#xff0c;是构建大型&#xff0c;快速Web app的首选方式。 React使用JavaScript来构建用户界面&#xff0c;因此可以说是一个用来构建用户界面的JavaScrip…

a.out.h 头文件分析 \linux-1.0\linux\include\linux\a.out.h

#ifndef __A_OUT_GNU_H__ #define __A_OUT_GNU_H__#define __GNU_EXEC_MACROS__#ifndef __STRUCT_EXEC_OVERRIDE__//定义执行文件结构 struct exec {unsigned long a_info; /* Use macros N_MAGIC, etc for access */unsigned a_text; /* length of text, in bytes */unsigne…

[TypeScript] vs code TSLint常见错误解决方案

TSLint是一个Typescrip{过滤}t验证工具&#xff0c;用于检测代码。 TSLint: comment must start with a space (comment-format)注释必须从一个空格开始(comment-format)也就是说//之后必须跟随一个空格。“Missing semicolon.” : “缺少分号.”,“Use the function form of \…

ios开发笔记之 线程间通信

performSelectorOnMainThread:selector:waitUntilDone: 用于线程间通信 使两个线程同步或者时异步执行。 block阻塞转载于:https://www.cnblogs.com/vincent-lu/archive/2011/11/29/2267974.html

SQL Cookbook—数字、日期

1、计算不包含最大值和最小值的均值2、把字母数字串转换为数值3、更改累计和中的值–显示存款或取款后的值4、加减日、月、年5、计算两个日期之间的天数6、确定两个日期之间的工作日数目表EMP中&#xff0c;计算BLAKE和JONES的hiredate&#xff08;聘用日期&#xff09;之间的工…