Skip to content

fh87lm/papaya

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

【1】 
papaya内核是我学习linux的一个习作。
很多人是通过读源码来学习它,我觉得写一个与它平行的内核,是另一种方式。

每开始写一个模块,都是先把《linux内核情景分析》的章节看一遍,在纸上涂涂画画,心里有一个蓝图,再开始写。

早期的时候,会翻看linux的源码,希望跟它一致,papaya的初衷就是modern linux的简化版。但慢慢发现,尤其是写过块设备层之后发现,刻意的模仿linux,写的很累,而且收获很小。
跟它保持差异,反而能能体会到它为什么会那样设计。。。等等。。。其它学习方式的细节,也都是不断摸索的。

在写的时候,一直告诉自己,这个内核不重要,重要的是你通过它学到多少。
  
虽然这样,还是希望把这个内核写到某种极致。

【2】
papaya os目前的代码量约一万行(*.c + *.asm + *.cn)。
只能在x86下运行。为了减少调试的工作量,也没有支持多核。
目前完成的部分有:
	>内存管理:
			* buddy system			<mmzone.c>
			* slab allocator		<mm/slab.c>
			+ slab分配器是不带color的。

	>网络:
			* 8139网卡驱动		<drivers/net/8139.c>
			* arp协议				<net/ipv4/arp.c>
			* 简单的ip协议		<net/ipv4/ip.c>
			* 部分udp协议			<net/ipv4/udp.c>			
			* 部分icmp协议		<net/ipv4/icmp.c>
			* 部分tcp协议			<net/ipv4/tcp.cn>
			+ papaya支持多网卡,这是我很骄傲的一点。
			+ 我在tcp.cn里尝试了中文编程。感觉还好。
		
	
	>文件系统:
			* vfs					<fs/*>
			* cell文件系统		<fs/cell/*>
			+ vfs实现了open, read, lseek, close接口。 还有mount。
			+ cell文件系统是我自己"发明"的,顾名思义,就是“划格子”,很简单
				的一个文件系统,它好在自己没有inode等概念,但却跟vfs配合的很好。

	>块设备:	
			* IDE驱动			<drivers/ide/ide.c>
			* 块设备层		<drivers/block/ll_rw_blk.c>
			+ 块设备层是不带buffer的。

	>基础:
			* fork()			<fork.c>
			* schedule()		<schedule.c>
			* kmalloc()		<pmm.c>
			* bottom half		<kernel/bh.c>
			* printf()		<lib/printf.c>
			+ papaya os的进程调度算法几乎没有。
			+ 基于slab的kmalloc叫做kmalloc2(), 因为papaya还保留着一个早期的
			   堆,是链表实现的。
			+ papaya的bh.c实现的很简单,跟linux不太一样。

	>几个入口文件:
			boot.asm	==>		kernel.asm		==>		kernel.c

计划12月前完成的模块有:
	> 进程  fork() exec() exit() wait() 
	> 动态连接器
	> ext2文件系统
	> 键盘driver, 字符设备层,以及vfs层的完善
	> 进程通信 signal() pipe()


【3】
src/ 下面是源码
cmd/ 调试时用到的小工具。包括刻录到虚拟img,刻录到usb等等。
lsh/ 我平时工作时用到的shell。 自己写的,叫lua shell。因为有还在完善中,工作时遇到bug随手改过来,所以也一并上传。


【4】
[2016,9,24] Version 0.609
==========update===========
1, Implementaion of vm_area, mm_struct 
2, execve()		1/2 done 		see fs/exec.c  fs/binfmt_elf.c
3, fork() 		2/3 done		see kernel/fork.c   mm/memory.c
4, mmap(), brk()	1/2 done	see mm/mmap.c

[2016,7,27] Version 0.607b
==========update===========
1, TCP implementation. Receive only.  See net/ipv4/tcp.cn
2, Chinese Programming introduced. 	  Also see tcp.cn
3, Mutliple NICs support.			  See net/core/dev.c @pick_nic()

[2016,7,12] Version 0.607
==========update==========
1, New feature: bottom monitor window.   see lib/printf.c
2, The driver for RTL8139.
3, ARP layer, IP layer.


[2016,6,5]Version 0.606
==========update==========
1, memory management module: SLAB (without colouring)	
   see src/mm/slab.c


[2016,5] Version 0.605
==========update===============
1, block device layer without buffer
2, ide driver
3, virtual filesystem( interfaces: open(), read(), close() implemented, write() not yet)


【4】
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
空间博客:http://user.qzone.qq.com/2106507650/2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 36.1%
  • C++ 18.6%
  • Lua 15.7%
  • Objective-C 15.5%
  • HTML 10.7%
  • Vim Script 1.5%
  • Other 1.9%