首页 > 系统相关 >Linux0.11 新体验

Linux0.11 新体验

时间:2022-09-22 17:22:31浏览次数:84  
标签:新体验 format 0000000000 raw 内核 Linux0.11 pages

WHY

为什么是新体验,目前的Linux内核代码对于学习操作系统来说不太合适,其代码量非常庞大,而被用来学习Linux内核的0.11版本和现代的操作系统相比较有如下缺点:

1,Linux0.11的进程共享一个页表,每个进程的地址空间有64MB,第一个进程是0-64MB,第二个进程是64-128MB,以此类推,而目前的32位Linux操作系统是每个进程有自己独立的页表,每个进程有4GB的虚拟内存空间,其中0-3GB位用户空间,3GB-4GB位内核空间,通过目前的Linux0.11的代码不能学习现在操作系统的内核分配机制,

2,Linux0.11使用TSS进行任务切换,而现在的操作系统使用内核堆栈进行任务切换,在网络上虽然有一些通过修改Linux0.11的代码实现内核堆栈任务切换的代码,如哈工大李治军老师的课程,虽然如此但其代码有在挂在hdc-0.11.img后,在编译虚拟机内的操作系统后会出现不明原因的崩溃

基于以上两点,为了学习操作系统,我将网上找到的一个可运行Linux0.11的代码进行修改,实现了每个进程都有自己4GB空间的Linux0.11,并且根据现有的内核堆栈任务切换进行优化实现完美的内核堆栈切换代码

在学习的过程中修改了一些函数,增加了一下打印,目前我修改过的Linux0.11能很好的运行,启动日志如下:

qemu-system-i386 -nographic -serial mon:stdio -m 64M -boot a -fda Image -fdb ./rootfs/rootimage-0.11.img -hda ./rootfs/hdc-0.11.img 
WARNING: Image format was not specified for 'Image' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
WARNING: Image format was not specified for './rootfs/rootimage-0.11.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
WARNING: Image format was not specified for './rootfs/hdc-0.11.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
[0000000000] params a=6 b=7 c=8
[0000000000] mem_start is 6MB
[0000000000] men_end is 16MB
[0000000000] system has 2560 pages omg
[0000000000] ramdisk size is 2MB
[0000000000] task switch use KERNEL STACK
[0000000000] init_task use GTD[4] for TSS
[0000000000] init_task use GTD[5] for LDT
[0000000000] Enable timer_interrupt
[0000000001] Enable system_call
[0000000001] Mem-info 4096 pages:
[0000000001] Buffer blocks: 3413 blocks(1KB) 3MB
[0000000001] Tatal pages: 4096 pages(4KB) 16MB
[0000000001] Free pages: 2560 pages(4KB) 10MB
[0000000001] Reserved pages: 1536 pages(4KB) 6MB
[0000000002] Shared pages: 0 pages(4KB) 0MB
[0000000002] HD_TYPE undefined, Query by BIOS
[0000000003] Query 0 HardDisk
[0000000003] Query 1 HardDisk
[0000000003] hd[0] start_sect 0 nr_sects 121968
[0000000004]    hd[1] start_sect 1 nr_sects 120959
[0000000004]    hd[2] start_sect 0 nr_sects 0
[0000000005]    hd[3] start_sect 0 nr_sects 0
[0000000005]    hd[4] start_sect 0 nr_sects 0
[0000000005] Partition table ok.
[0000000006] Ram disk: 2048 KB, starting at 0x400000
[0000000006] Ram disk: not floppy
[0000000006] read_super bread dev is 0x301
[0000000006] SuperBlock sectors is 3 0x600 offset in disk
[0000000006] read_super s_imap_blocks for inodes bit map is 3
[0000000006] read_super s_zmap_blocks for data block bit map is 8
[0000000007] mount_root 47933/60000 free blocks
[0000000007] mount_root 19305/20000 free inodes
[0000000008] mount_root 638 is firstdatazone
3413 buffers = 3494912 bytes buffer space
Free mem: 10485760 bytes
init current pid is 1
init fork current pid is 2
Ok. Rootfs is HD
[/usr/root]# ls
README	      gcclib140	    hello.c	  mtools.howto


github的地址如下:https://github.com/sudochen/Linux0.11

标签:新体验,format,0000000000,raw,内核,Linux0.11,pages
From: https://www.cnblogs.com/sudochen/p/16720034.html

相关文章

  • Linux0.11 sleep_on wake_up函数理解和纠正
    /**将当前进程设置为不可中断的睡眠状态*只有明确进程唤醒才可以*/voidsleep_on(structtask_struct**p){structtask_struct*tmp;if(!p)......
  • Linux0.11 move_to_user_mode分析
    /**IRET*当使用IRET指令返回到相同保护级别的任务时,也就是当前的CS中的DPL和堆栈中的DPL相同时*IRET会从堆栈弹出代码段选择子及指令指针分别到CS与IP寄存器,*......
  • Linux0.11源码学习(四)
    Linux0.11源码学习(四)linux0.11源码学习笔记参考资料:https://github.com/sunym1993/flash-linux0.11-talkhttps://github.com/Akagi201/linux-0.11http://xiehongfeng1......