8 Star 27 Fork 6

Gitee 极速下载 / smash

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/wangzq0807/smash
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

SMASH

简介

smash是一个类Unix的内核,实现了基于分段和分页的内存管理,单个进程最大4GB虚拟地址空间,支持minix-v2l文件系统,实现了写实复制(fork),管道等机制。

smash

开发环境

  • Ubuntu 18.04
  • gcc 7.4.0
  • bochs-x 2.6.5+
  • cmake 3.0+

编译内核

cd smash/_build
cmake ../
make

运行

在_build目录下执行

make run

系统调用一览

extern int exit(int code);
extern int fork(void);
extern int read(int fd, char *buf, int count);
extern int write(int fd, const char *buf, int count);
extern int open(const char *pathname, int flags, int mode);
extern int close(int fd);
extern int waitpid(int pid, int *status, int options);
extern int creat(const char *pathname, int mode);
extern int link(const char *oldpath, const char *newpath);
extern int unlink(const char *pathname);
extern int execve(const char *pathname, char *const argv[], char *const envp[]);
extern int chdir(const char *pathname);
extern int mkdir(const char *pathname, int mode);
extern int rmdir(const char *pathname);
extern int pause(void);
extern int getpid(void);
extern int pipe(int fd[2]);
extern int dup(int fd);

参考

License

  • MIT License

一些细节

目录结构

├── boot
│   ├── loader
│   └── mbr
├── _build
├── include
├── kernel
├── tools
└── usr

  • boot : 存放引导程序
  • kernel : 内核代码
  • include : unix标准头文件
  • usr : 应用程序

kernel设计

CMake

  • 使用config.h.in来生成配置选项

GCC

  • 不使用标准库的头文件(用自定义的): -nostdinc

Bochs

  • IO debugger : 在bochsrc中添加"port_e9_hack: enabled=1"
  • GUI Debug : 安装libgtk2.0-dev, 然后添加编译选项--enable-debugger --enable-disasm --enable-debugger-gui,编译bochs. 然后在bochsrc中添加"display_library: x, options="gui_debug""
Copyright (c) 2018-2019 Zhengqiang Wang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

前言 每一个蹩脚的程序员都有一颗做操作系统内核的心 展开 收起
C/C++ 等 6 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C/C++
1
https://gitee.com/mirrors/smash.git
git@gitee.com:mirrors/smash.git
mirrors
smash
smash
master

搜索帮助