├── mission5817 ├── Readme.md ├── lib │ ├── errno.c │ ├── string.c │ ├── setsid.c │ ├── dup.c │ ├── close.c │ ├── write.c │ ├── _exit.c │ ├── execve.c │ ├── makefile │ ├── wait.c │ ├── open.c │ └── ctype.c ├── fs │ ├── select.c │ ├── file_table.c │ └── makefile ├── .gitignore ├── include │ ├── sys │ │ ├── times.h │ │ ├── utsname.h │ │ ├── types.h │ │ └── wait.h │ ├── utime.h │ ├── linux │ │ ├── mm.h │ │ ├── head.h │ │ └── kernel.h │ ├── const.h │ ├── stddef.h │ ├── asm │ │ ├── io.h │ │ └── memory.h │ ├── stdarg.h │ └── time.h ├── init │ └── makefile ├── kernel │ ├── math │ │ └── makefile │ ├── blk_drv │ │ └── makefile │ ├── panic.c │ ├── chr_drv │ │ └── makefile │ └── makefile └── mm │ ├── makefile │ └── page.s ├── mission5818 ├── Readme.md ├── newapp │ ├── add.c │ ├── main.c │ └── makefile ├── linuxapp.h ├── .gitignore └── linuxapp.c ├── mission5820 ├── Readme.md ├── lib │ ├── errno.c │ ├── string.c │ ├── setsid.c │ ├── dup.c │ ├── close.c │ ├── write.c │ ├── _exit.c │ ├── execve.c │ ├── makefile │ ├── wait.c │ ├── open.c │ └── ctype.c ├── fs │ ├── select.c │ ├── file_table.c │ └── makefile ├── .gitignore ├── include │ ├── sys │ │ ├── times.h │ │ ├── utsname.h │ │ ├── types.h │ │ └── wait.h │ ├── utime.h │ ├── linux │ │ ├── mm.h │ │ ├── head.h │ │ └── kernel.h │ ├── const.h │ ├── stddef.h │ ├── asm │ │ ├── io.h │ │ └── memory.h │ └── stdarg.h ├── init │ └── makefile ├── kernel │ ├── math │ │ └── makefile │ ├── blk_drv │ │ └── makefile │ ├── panic.c │ ├── chr_drv │ │ └── makefile │ └── makefile └── mm │ ├── makefile │ └── page.s ├── mission5826 ├── Readme.md ├── lib │ ├── errno.c │ ├── string.c │ ├── setsid.c │ ├── dup.c │ ├── close.c │ ├── write.c │ ├── _exit.c │ ├── execve.c │ ├── makefile │ ├── wait.c │ ├── open.c │ └── ctype.c ├── fs │ ├── select.c │ ├── file_table.c │ └── makefile ├── .gitignore ├── include │ ├── sys │ │ ├── times.h │ │ ├── utsname.h │ │ ├── types.h │ │ └── wait.h │ ├── utime.h │ ├── linux │ │ ├── mm.h │ │ ├── head.h │ │ └── kernel.h │ ├── const.h │ ├── stddef.h │ ├── asm │ │ ├── io.h │ │ └── memory.h │ └── stdarg.h ├── main.c ├── init │ └── makefile ├── kernel │ ├── math │ │ └── makefile │ ├── blk_drv │ │ └── makefile │ ├── panic.c │ ├── chr_drv │ │ └── makefile │ └── makefile └── mm │ ├── makefile │ └── page.s ├── mission5827 ├── Readme.md ├── lib │ ├── errno.c │ ├── string.c │ ├── setsid.c │ ├── dup.c │ ├── close.c │ ├── write.c │ ├── _exit.c │ ├── execve.c │ ├── makefile │ ├── wait.c │ ├── open.c │ └── ctype.c ├── fs │ ├── select.c │ ├── file_table.c │ └── makefile ├── new.c ├── old.c ├── .gitignore ├── include │ ├── sys │ │ ├── times.h │ │ ├── utsname.h │ │ ├── types.h │ │ └── wait.h │ ├── utime.h │ ├── linux │ │ ├── mm.h │ │ ├── head.h │ │ └── kernel.h │ ├── const.h │ ├── stddef.h │ ├── asm │ │ ├── io.h │ │ └── memory.h │ └── stdarg.h ├── init │ └── makefile ├── kernel │ ├── math │ │ └── makefile │ ├── blk_drv │ │ └── makefile │ ├── panic.c │ ├── chr_drv │ │ └── makefile │ └── makefile └── mm │ ├── makefile │ └── page.s ├── mission5834 ├── Readme.md ├── lib │ ├── errno.c │ ├── string.c │ ├── setsid.c │ ├── dup.c │ ├── close.c │ ├── write.c │ ├── _exit.c │ ├── execve.c │ ├── makefile │ ├── wait.c │ ├── open.c │ └── ctype.c ├── fs │ ├── select.c │ ├── file_table.c │ └── makefile ├── newapp │ └── main.c ├── .gitignore ├── include │ ├── sys │ │ ├── times.h │ │ ├── utsname.h │ │ ├── types.h │ │ └── wait.h │ ├── utime.h │ ├── linux │ │ ├── mm.h │ │ ├── head.h │ │ └── kernel.h │ ├── const.h │ ├── stddef.h │ ├── asm │ │ ├── io.h │ │ └── memory.h │ └── stdarg.h ├── init │ └── makefile ├── kernel │ ├── math │ │ └── makefile │ ├── blk_drv │ │ └── makefile │ ├── panic.c │ ├── chr_drv │ │ └── makefile │ └── makefile └── mm │ ├── makefile │ └── page.s ├── mission5835 ├── Readme.md ├── lib │ ├── errno.c │ ├── string.c │ ├── setsid.c │ ├── dup.c │ ├── close.c │ ├── write.c │ ├── _exit.c │ ├── execve.c │ ├── makefile │ ├── wait.c │ ├── open.c │ └── ctype.c ├── fs │ ├── select.c │ ├── file_table.c │ └── makefile ├── newapp │ └── loop.c ├── .gitignore ├── include │ ├── sys │ │ ├── times.h │ │ ├── utsname.h │ │ ├── types.h │ │ └── wait.h │ ├── utime.h │ ├── linux │ │ ├── mm.h │ │ ├── head.h │ │ └── kernel.h │ ├── const.h │ ├── stddef.h │ ├── asm │ │ ├── io.h │ │ └── memory.h │ └── stdarg.h ├── init │ └── makefile ├── kernel │ ├── math │ │ └── makefile │ ├── blk_drv │ │ └── makefile │ ├── panic.c │ ├── chr_drv │ │ └── makefile │ └── makefile └── mm │ ├── makefile │ └── page.s ├── mission5846 ├── Readme.md ├── lib │ ├── errno.c │ ├── string.c │ ├── setsid.c │ ├── dup.c │ ├── close.c │ ├── write.c │ ├── _exit.c │ ├── execve.c │ ├── makefile │ ├── wait.c │ ├── open.c │ └── ctype.c ├── fs │ ├── select.c │ ├── file_table.c │ └── makefile ├── .gitignore ├── include │ ├── sys │ │ ├── times.h │ │ ├── utsname.h │ │ ├── types.h │ │ └── wait.h │ ├── utime.h │ ├── linux │ │ ├── mm.h │ │ ├── head.h │ │ └── kernel.h │ ├── const.h │ ├── stddef.h │ ├── asm │ │ ├── io.h │ │ └── memory.h │ └── stdarg.h ├── init │ └── makefile ├── kernel │ ├── math │ │ └── makefile │ ├── blk_drv │ │ └── makefile │ ├── panic.c │ ├── chr_drv │ │ └── makefile │ └── makefile └── mm │ ├── makefile │ └── page.s ├── .gitattributes ├── 学生包.zip ├── 实验报告要求及模版.doc ├── Linux内核实验教程_4.10.pdf ├── 实验要求 ├── 第三讲 进程的创建(要求).ppt ├── 第一讲 实验环境的使用(要求).ppt ├── 第二讲 操作系统的启动(要求).ppt ├── 第五讲 proc文件系统 (要求).ppt ├── 第四讲 地址映射与内存共享(要求).ppt └── 第六讲 华为OpenEuler系统安装及使用(要求).ppt └── Linux011操作系统实验vi编辑器逃课教程.pdf /mission5817/Readme.md: -------------------------------------------------------------------------------- 1 | 用于完成Linux 0.11内核的实验。 -------------------------------------------------------------------------------- /mission5818/Readme.md: -------------------------------------------------------------------------------- 1 | 用于完成Linux 0.11应用程序的实验 -------------------------------------------------------------------------------- /mission5820/Readme.md: -------------------------------------------------------------------------------- 1 | 用于完成Linux 0.11内核的实验。 -------------------------------------------------------------------------------- /mission5826/Readme.md: -------------------------------------------------------------------------------- 1 | 用于完成Linux 0.11内核的实验。 -------------------------------------------------------------------------------- /mission5827/Readme.md: -------------------------------------------------------------------------------- 1 | 用于完成Linux 0.11内核的实验。 -------------------------------------------------------------------------------- /mission5834/Readme.md: -------------------------------------------------------------------------------- 1 | 用于完成Linux 0.11内核的实验。 -------------------------------------------------------------------------------- /mission5835/Readme.md: -------------------------------------------------------------------------------- 1 | 用于完成Linux 0.11内核的实验。 -------------------------------------------------------------------------------- /mission5846/Readme.md: -------------------------------------------------------------------------------- 1 | 用于完成Linux 0.11内核的实验。 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | **/* linguist-generated=true 2 | -------------------------------------------------------------------------------- /mission5818/newapp/add.c: -------------------------------------------------------------------------------- 1 | int add(int x,int y){ 2 | return x+y; 3 | } 4 | -------------------------------------------------------------------------------- /学生包.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/学生包.zip -------------------------------------------------------------------------------- /实验报告要求及模版.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/实验报告要求及模版.doc -------------------------------------------------------------------------------- /Linux内核实验教程_4.10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/Linux内核实验教程_4.10.pdf -------------------------------------------------------------------------------- /实验要求/第三讲 进程的创建(要求).ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/实验要求/第三讲 进程的创建(要求).ppt -------------------------------------------------------------------------------- /实验要求/第一讲 实验环境的使用(要求).ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/实验要求/第一讲 实验环境的使用(要求).ppt -------------------------------------------------------------------------------- /实验要求/第二讲 操作系统的启动(要求).ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/实验要求/第二讲 操作系统的启动(要求).ppt -------------------------------------------------------------------------------- /Linux011操作系统实验vi编辑器逃课教程.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/Linux011操作系统实验vi编辑器逃课教程.pdf -------------------------------------------------------------------------------- /mission5817/lib/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/errno.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | int errno; 8 | -------------------------------------------------------------------------------- /mission5820/lib/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/errno.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | int errno; 8 | -------------------------------------------------------------------------------- /mission5826/lib/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/errno.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | int errno; 8 | -------------------------------------------------------------------------------- /mission5827/lib/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/errno.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | int errno; 8 | -------------------------------------------------------------------------------- /mission5834/lib/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/errno.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | int errno; 8 | -------------------------------------------------------------------------------- /mission5835/lib/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/errno.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | int errno; 8 | -------------------------------------------------------------------------------- /mission5846/lib/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/errno.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | int errno; 8 | -------------------------------------------------------------------------------- /实验要求/第五讲 proc文件系统 (要求).ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/实验要求/第五讲 proc文件系统 (要求).ppt -------------------------------------------------------------------------------- /实验要求/第四讲 地址映射与内存共享(要求).ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/实验要求/第四讲 地址映射与内存共享(要求).ppt -------------------------------------------------------------------------------- /实验要求/第六讲 华为OpenEuler系统安装及使用(要求).ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/only9464/Operating-System-Experiment/HEAD/实验要求/第六讲 华为OpenEuler系统安装及使用(要求).ppt -------------------------------------------------------------------------------- /mission5817/fs/select.c: -------------------------------------------------------------------------------- 1 | /* nothing , only the stub */ 2 | /* gohigh */ 3 | 4 | #include 5 | 6 | int sys_select() 7 | { 8 | return -ENOSYS; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /mission5820/fs/select.c: -------------------------------------------------------------------------------- 1 | /* nothing , only the stub */ 2 | /* gohigh */ 3 | 4 | #include 5 | 6 | int sys_select() 7 | { 8 | return -ENOSYS; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /mission5826/fs/select.c: -------------------------------------------------------------------------------- 1 | /* nothing , only the stub */ 2 | /* gohigh */ 3 | 4 | #include 5 | 6 | int sys_select() 7 | { 8 | return -ENOSYS; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /mission5827/fs/select.c: -------------------------------------------------------------------------------- 1 | /* nothing , only the stub */ 2 | /* gohigh */ 3 | 4 | #include 5 | 6 | int sys_select() 7 | { 8 | return -ENOSYS; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /mission5834/fs/select.c: -------------------------------------------------------------------------------- 1 | /* nothing , only the stub */ 2 | /* gohigh */ 3 | 4 | #include 5 | 6 | int sys_select() 7 | { 8 | return -ENOSYS; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /mission5835/fs/select.c: -------------------------------------------------------------------------------- 1 | /* nothing , only the stub */ 2 | /* gohigh */ 3 | 4 | #include 5 | 6 | int sys_select() 7 | { 8 | return -ENOSYS; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /mission5846/fs/select.c: -------------------------------------------------------------------------------- 1 | /* nothing , only the stub */ 2 | /* gohigh */ 3 | 4 | #include 5 | 6 | int sys_select() 7 | { 8 | return -ENOSYS; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /mission5818/linuxapp.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX011APP_ 2 | #define _LINUX011APP_ 3 | 4 | 5 | /* 包含 C 运行时库相关头文件 */ 6 | #include 7 | #include 8 | 9 | #endif //_LINUX011APP_ 10 | -------------------------------------------------------------------------------- /mission5827/new.c: -------------------------------------------------------------------------------- 1 | #define __LIBRARY__ 2 | #include 3 | #include 4 | int main( int argc, char * argv[] ) 5 | { 6 | printf("PID:%d new process.\n", getpid()); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /mission5834/newapp/main.c: -------------------------------------------------------------------------------- 1 | #define __LIBRARY__ 2 | #include 3 | #define __NR_dump_physical_mem 87 4 | _syscall0(int, dump_physical_mem) 5 | int main() 6 | { 7 | dump_physical_mem(); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /mission5835/newapp/loop.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(void) 3 | { 4 | int i = 0x12345678; 5 | printf("The logical/virtual address of i is 0x%08x\n", &i); 6 | fflush(stdout); 7 | while(i) 8 | ; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /mission5817/fs/file_table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/fs/file_table.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 文件系统头文件。定义文件表结构(file,buffer_head, m_inode等). 8 | 9 | struct file file_table[NR_FILE]; // 文件表数组 (64项) 10 | -------------------------------------------------------------------------------- /mission5820/fs/file_table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/fs/file_table.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 文件系统头文件。定义文件表结构(file,buffer_head, m_inode等). 8 | 9 | struct file file_table[NR_FILE]; // 文件表数组 (64项) 10 | -------------------------------------------------------------------------------- /mission5826/fs/file_table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/fs/file_table.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 文件系统头文件。定义文件表结构(file,buffer_head, m_inode等). 8 | 9 | struct file file_table[NR_FILE]; // 文件表数组 (64项) 10 | -------------------------------------------------------------------------------- /mission5827/fs/file_table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/fs/file_table.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 文件系统头文件。定义文件表结构(file,buffer_head, m_inode等). 8 | 9 | struct file file_table[NR_FILE]; // 文件表数组 (64项) 10 | -------------------------------------------------------------------------------- /mission5834/fs/file_table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/fs/file_table.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 文件系统头文件。定义文件表结构(file,buffer_head, m_inode等). 8 | 9 | struct file file_table[NR_FILE]; // 文件表数组 (64项) 10 | -------------------------------------------------------------------------------- /mission5835/fs/file_table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/fs/file_table.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 文件系统头文件。定义文件表结构(file,buffer_head, m_inode等). 8 | 9 | struct file file_table[NR_FILE]; // 文件表数组 (64项) 10 | -------------------------------------------------------------------------------- /mission5846/fs/file_table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/fs/file_table.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 文件系统头文件。定义文件表结构(file,buffer_head, m_inode等). 8 | 9 | struct file file_table[NR_FILE]; // 文件表数组 (64项) 10 | -------------------------------------------------------------------------------- /mission5818/newapp/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | int add(int x,int y); 3 | int main(){ 4 | int a; 5 | int b; 6 | int sum; 7 | printf("Please input two number:\n"); 8 | scanf("%d %d",&a,&b); 9 | sum=add(a,b); 10 | printf("The result is:%d\n",sum); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /mission5817/lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/string.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #ifndef __GNUC__ // 需要GNU 的C 编译器编译。 8 | #error I want gcc! 9 | #endif 10 | 11 | #define extern 12 | #define inline 13 | #define __LIBRARY__ 14 | #include 15 | -------------------------------------------------------------------------------- /mission5820/lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/string.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #ifndef __GNUC__ // 需要GNU 的C 编译器编译。 8 | #error I want gcc! 9 | #endif 10 | 11 | #define extern 12 | #define inline 13 | #define __LIBRARY__ 14 | #include 15 | -------------------------------------------------------------------------------- /mission5826/lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/string.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #ifndef __GNUC__ // 需要GNU 的C 编译器编译。 8 | #error I want gcc! 9 | #endif 10 | 11 | #define extern 12 | #define inline 13 | #define __LIBRARY__ 14 | #include 15 | -------------------------------------------------------------------------------- /mission5827/lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/string.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #ifndef __GNUC__ // 需要GNU 的C 编译器编译。 8 | #error I want gcc! 9 | #endif 10 | 11 | #define extern 12 | #define inline 13 | #define __LIBRARY__ 14 | #include 15 | -------------------------------------------------------------------------------- /mission5834/lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/string.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #ifndef __GNUC__ // 需要GNU 的C 编译器编译。 8 | #error I want gcc! 9 | #endif 10 | 11 | #define extern 12 | #define inline 13 | #define __LIBRARY__ 14 | #include 15 | -------------------------------------------------------------------------------- /mission5835/lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/string.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #ifndef __GNUC__ // 需要GNU 的C 编译器编译。 8 | #error I want gcc! 9 | #endif 10 | 11 | #define extern 12 | #define inline 13 | #define __LIBRARY__ 14 | #include 15 | -------------------------------------------------------------------------------- /mission5846/lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/string.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #ifndef __GNUC__ // 需要GNU 的C 编译器编译。 8 | #error I want gcc! 9 | #endif 10 | 11 | #define extern 12 | #define inline 13 | #define __LIBRARY__ 14 | #include 15 | -------------------------------------------------------------------------------- /mission5827/old.c: -------------------------------------------------------------------------------- 1 | #define __LIBRARY__ 2 | #include 3 | #include 4 | int main( int argc, char * argv[] ) 5 | { 6 | printf("PID:%d old process start.\n", getpid()); 7 | execve("new", NULL, NULL ); 8 | printf("PID:%d old process exit.\n", getpid()); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /mission5817/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | 4 | *.img 5 | *.o 6 | *.lst 7 | *.bxrc 8 | *.exe 9 | *.dll 10 | *.a 11 | *.i 12 | 13 | VGABIOS-lgpl-latest 14 | BIOS-bochs-latest 15 | bochsout.txt 16 | linux011.bin 17 | boot/bootsect.bin 18 | boot/setup.bin 19 | artifact.done 20 | harddisk.img.lock 21 | -------------------------------------------------------------------------------- /mission5818/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | 4 | *.img 5 | *.o 6 | *.lst 7 | *.bxrc 8 | *.exe 9 | *.dll 10 | *.a 11 | *.i 12 | 13 | VGABIOS-lgpl-latest 14 | BIOS-bochs-latest 15 | bochsout.txt 16 | linux011.bin 17 | boot/bootsect.bin 18 | boot/setup.bin 19 | artifact.done 20 | harddisk.img.lock 21 | -------------------------------------------------------------------------------- /mission5820/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | 4 | *.img 5 | *.o 6 | *.lst 7 | *.bxrc 8 | *.exe 9 | *.dll 10 | *.a 11 | *.i 12 | 13 | VGABIOS-lgpl-latest 14 | BIOS-bochs-latest 15 | bochsout.txt 16 | linux011.bin 17 | boot/bootsect.bin 18 | boot/setup.bin 19 | artifact.done 20 | harddisk.img.lock 21 | -------------------------------------------------------------------------------- /mission5826/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | 4 | *.img 5 | *.o 6 | *.lst 7 | *.bxrc 8 | *.exe 9 | *.dll 10 | *.a 11 | *.i 12 | 13 | VGABIOS-lgpl-latest 14 | BIOS-bochs-latest 15 | bochsout.txt 16 | linux011.bin 17 | boot/bootsect.bin 18 | boot/setup.bin 19 | artifact.done 20 | harddisk.img.lock 21 | -------------------------------------------------------------------------------- /mission5827/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | 4 | *.img 5 | *.o 6 | *.lst 7 | *.bxrc 8 | *.exe 9 | *.dll 10 | *.a 11 | *.i 12 | 13 | VGABIOS-lgpl-latest 14 | BIOS-bochs-latest 15 | bochsout.txt 16 | linux011.bin 17 | boot/bootsect.bin 18 | boot/setup.bin 19 | artifact.done 20 | harddisk.img.lock 21 | -------------------------------------------------------------------------------- /mission5834/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | 4 | *.img 5 | *.o 6 | *.lst 7 | *.bxrc 8 | *.exe 9 | *.dll 10 | *.a 11 | *.i 12 | 13 | VGABIOS-lgpl-latest 14 | BIOS-bochs-latest 15 | bochsout.txt 16 | linux011.bin 17 | boot/bootsect.bin 18 | boot/setup.bin 19 | artifact.done 20 | harddisk.img.lock 21 | -------------------------------------------------------------------------------- /mission5835/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | 4 | *.img 5 | *.o 6 | *.lst 7 | *.bxrc 8 | *.exe 9 | *.dll 10 | *.a 11 | *.i 12 | 13 | VGABIOS-lgpl-latest 14 | BIOS-bochs-latest 15 | bochsout.txt 16 | linux011.bin 17 | boot/bootsect.bin 18 | boot/setup.bin 19 | artifact.done 20 | harddisk.img.lock 21 | -------------------------------------------------------------------------------- /mission5846/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | 4 | *.img 5 | *.o 6 | *.lst 7 | *.bxrc 8 | *.exe 9 | *.dll 10 | *.a 11 | *.i 12 | 13 | VGABIOS-lgpl-latest 14 | BIOS-bochs-latest 15 | bochsout.txt 16 | linux011.bin 17 | boot/bootsect.bin 18 | boot/setup.bin 19 | artifact.done 20 | harddisk.img.lock 21 | -------------------------------------------------------------------------------- /mission5818/newapp/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CFLAGS = -Wall -g 3 | SRC = add.c main.c 4 | OBJ = $(SRC:.c=.o) 5 | TARGET = app 6 | all: $(TARGET) 7 | $(TARGET): $(OBJ) 8 | $(CC) $(CFLAGS) -o $@ $^ 9 | %.o: %.c 10 | $(CC) $(CFLAGS) -c $< -o $@ 11 | clean: 12 | rm -f $(OBJ) $(TARGET) 13 | .PHONY: all clean 14 | -------------------------------------------------------------------------------- /mission5818/linuxapp.c: -------------------------------------------------------------------------------- 1 | #define __LIBRARY__ 2 | #include "linuxapp.h" 3 | 4 | int main(int argc, char* argv[]) 5 | { 6 | /* 注意: 在应用程序中不能使用断点等调试功能 */ 7 | 8 | /* TODO: 在此处添加自己的代码 */ 9 | printf("Hello world!\n"); 10 | /* ATTENTION: 此处的中文无法输出,原因很简单 */ 11 | printf("天生的coder!\n"); 12 | printf("Github: https://github.com/only9464\n"); 13 | 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /mission5817/lib/setsid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/setsid.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 创建一个会话并设置进程组号。 12 | // 下面系统调用宏对应于函数:pid_t setsid()。 13 | // 返回:调用进程的会话标识符(session ID)。 14 | _syscall0(pid_t,setsid) 15 | -------------------------------------------------------------------------------- /mission5820/lib/setsid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/setsid.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 创建一个会话并设置进程组号。 12 | // 下面系统调用宏对应于函数:pid_t setsid()。 13 | // 返回:调用进程的会话标识符(session ID)。 14 | _syscall0(pid_t,setsid) 15 | -------------------------------------------------------------------------------- /mission5826/lib/setsid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/setsid.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 创建一个会话并设置进程组号。 12 | // 下面系统调用宏对应于函数:pid_t setsid()。 13 | // 返回:调用进程的会话标识符(session ID)。 14 | _syscall0(pid_t,setsid) 15 | -------------------------------------------------------------------------------- /mission5827/lib/setsid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/setsid.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 创建一个会话并设置进程组号。 12 | // 下面系统调用宏对应于函数:pid_t setsid()。 13 | // 返回:调用进程的会话标识符(session ID)。 14 | _syscall0(pid_t,setsid) 15 | -------------------------------------------------------------------------------- /mission5834/lib/setsid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/setsid.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 创建一个会话并设置进程组号。 12 | // 下面系统调用宏对应于函数:pid_t setsid()。 13 | // 返回:调用进程的会话标识符(session ID)。 14 | _syscall0(pid_t,setsid) 15 | -------------------------------------------------------------------------------- /mission5835/lib/setsid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/setsid.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 创建一个会话并设置进程组号。 12 | // 下面系统调用宏对应于函数:pid_t setsid()。 13 | // 返回:调用进程的会话标识符(session ID)。 14 | _syscall0(pid_t,setsid) 15 | -------------------------------------------------------------------------------- /mission5846/lib/setsid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/setsid.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 创建一个会话并设置进程组号。 12 | // 下面系统调用宏对应于函数:pid_t setsid()。 13 | // 返回:调用进程的会话标识符(session ID)。 14 | _syscall0(pid_t,setsid) 15 | -------------------------------------------------------------------------------- /mission5817/lib/dup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/dup.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 复制文件描述符函数。 12 | // 下面该调用宏函数对应:int dup(int fd)。直接调用了系统中断int 0x80,参数是__NR_dup。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,dup,int,fd) 15 | -------------------------------------------------------------------------------- /mission5820/lib/dup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/dup.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 复制文件描述符函数。 12 | // 下面该调用宏函数对应:int dup(int fd)。直接调用了系统中断int 0x80,参数是__NR_dup。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,dup,int,fd) 15 | -------------------------------------------------------------------------------- /mission5826/lib/dup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/dup.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 复制文件描述符函数。 12 | // 下面该调用宏函数对应:int dup(int fd)。直接调用了系统中断int 0x80,参数是__NR_dup。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,dup,int,fd) 15 | -------------------------------------------------------------------------------- /mission5827/lib/dup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/dup.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 复制文件描述符函数。 12 | // 下面该调用宏函数对应:int dup(int fd)。直接调用了系统中断int 0x80,参数是__NR_dup。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,dup,int,fd) 15 | -------------------------------------------------------------------------------- /mission5834/lib/dup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/dup.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 复制文件描述符函数。 12 | // 下面该调用宏函数对应:int dup(int fd)。直接调用了系统中断int 0x80,参数是__NR_dup。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,dup,int,fd) 15 | -------------------------------------------------------------------------------- /mission5835/lib/dup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/dup.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 复制文件描述符函数。 12 | // 下面该调用宏函数对应:int dup(int fd)。直接调用了系统中断int 0x80,参数是__NR_dup。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,dup,int,fd) 15 | -------------------------------------------------------------------------------- /mission5846/lib/dup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/dup.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 复制文件描述符函数。 12 | // 下面该调用宏函数对应:int dup(int fd)。直接调用了系统中断int 0x80,参数是__NR_dup。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,dup,int,fd) 15 | -------------------------------------------------------------------------------- /mission5817/lib/close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/close.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | // 关闭文件函数。 12 | // 下面该调用宏函数对应:int close(int fd)。直接调用了系统中断int 0x80,参数是__NR_close。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,close,int,fd) 15 | -------------------------------------------------------------------------------- /mission5820/lib/close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/close.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | // 关闭文件函数。 12 | // 下面该调用宏函数对应:int close(int fd)。直接调用了系统中断int 0x80,参数是__NR_close。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,close,int,fd) 15 | -------------------------------------------------------------------------------- /mission5826/lib/close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/close.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | // 关闭文件函数。 12 | // 下面该调用宏函数对应:int close(int fd)。直接调用了系统中断int 0x80,参数是__NR_close。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,close,int,fd) 15 | -------------------------------------------------------------------------------- /mission5827/lib/close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/close.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | // 关闭文件函数。 12 | // 下面该调用宏函数对应:int close(int fd)。直接调用了系统中断int 0x80,参数是__NR_close。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,close,int,fd) 15 | -------------------------------------------------------------------------------- /mission5834/lib/close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/close.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | // 关闭文件函数。 12 | // 下面该调用宏函数对应:int close(int fd)。直接调用了系统中断int 0x80,参数是__NR_close。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,close,int,fd) 15 | -------------------------------------------------------------------------------- /mission5835/lib/close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/close.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | // 关闭文件函数。 12 | // 下面该调用宏函数对应:int close(int fd)。直接调用了系统中断int 0x80,参数是__NR_close。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,close,int,fd) 15 | -------------------------------------------------------------------------------- /mission5846/lib/close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/close.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | // 关闭文件函数。 12 | // 下面该调用宏函数对应:int close(int fd)。直接调用了系统中断int 0x80,参数是__NR_close。 13 | // 其中fd 是文件描述符。 14 | _syscall1(int,close,int,fd) 15 | -------------------------------------------------------------------------------- /mission5817/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIMES_H 2 | #define _TIMES_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct tms 7 | { 8 | time_t tms_utime; // 用户使用的CPU 时间。 9 | time_t tms_stime; // 系统(内核)CPU 时间。 10 | time_t tms_cutime; // 已终止的子进程使用的用户CPU 时间。 11 | time_t tms_cstime; // 已终止的子进程使用的系统CPU 时间。 12 | }; 13 | 14 | extern time_t times(struct tms * tp); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5820/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIMES_H 2 | #define _TIMES_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct tms 7 | { 8 | time_t tms_utime; // 用户使用的CPU 时间。 9 | time_t tms_stime; // 系统(内核)CPU 时间。 10 | time_t tms_cutime; // 已终止的子进程使用的用户CPU 时间。 11 | time_t tms_cstime; // 已终止的子进程使用的系统CPU 时间。 12 | }; 13 | 14 | extern time_t times(struct tms * tp); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5826/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIMES_H 2 | #define _TIMES_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct tms 7 | { 8 | time_t tms_utime; // 用户使用的CPU 时间。 9 | time_t tms_stime; // 系统(内核)CPU 时间。 10 | time_t tms_cutime; // 已终止的子进程使用的用户CPU 时间。 11 | time_t tms_cstime; // 已终止的子进程使用的系统CPU 时间。 12 | }; 13 | 14 | extern time_t times(struct tms * tp); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5827/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIMES_H 2 | #define _TIMES_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct tms 7 | { 8 | time_t tms_utime; // 用户使用的CPU 时间。 9 | time_t tms_stime; // 系统(内核)CPU 时间。 10 | time_t tms_cutime; // 已终止的子进程使用的用户CPU 时间。 11 | time_t tms_cstime; // 已终止的子进程使用的系统CPU 时间。 12 | }; 13 | 14 | extern time_t times(struct tms * tp); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5834/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIMES_H 2 | #define _TIMES_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct tms 7 | { 8 | time_t tms_utime; // 用户使用的CPU 时间。 9 | time_t tms_stime; // 系统(内核)CPU 时间。 10 | time_t tms_cutime; // 已终止的子进程使用的用户CPU 时间。 11 | time_t tms_cstime; // 已终止的子进程使用的系统CPU 时间。 12 | }; 13 | 14 | extern time_t times(struct tms * tp); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5835/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIMES_H 2 | #define _TIMES_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct tms 7 | { 8 | time_t tms_utime; // 用户使用的CPU 时间。 9 | time_t tms_stime; // 系统(内核)CPU 时间。 10 | time_t tms_cutime; // 已终止的子进程使用的用户CPU 时间。 11 | time_t tms_cstime; // 已终止的子进程使用的系统CPU 时间。 12 | }; 13 | 14 | extern time_t times(struct tms * tp); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5846/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIMES_H 2 | #define _TIMES_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct tms 7 | { 8 | time_t tms_utime; // 用户使用的CPU 时间。 9 | time_t tms_stime; // 系统(内核)CPU 时间。 10 | time_t tms_cutime; // 已终止的子进程使用的用户CPU 时间。 11 | time_t tms_cstime; // 已终止的子进程使用的系统CPU 时间。 12 | }; 13 | 14 | extern time_t times(struct tms * tp); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5817/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIME_H 2 | #define _UTIME_H 3 | 4 | #include /* I know - shouldn't do this, but .. */ 5 | /* 我知道 - 不应该这样做,但是.. */ 6 | 7 | struct utimbuf { 8 | time_t actime; // 文件访问时间。 从1970.1.1:0:0:0开始的秒数. 9 | time_t modtime; // 文件修改时间。 从1970.1.1:0:0:0开始的秒数. 10 | }; 11 | 12 | // 设置文件访问和修改时间函数. 13 | extern int utime(const char *filename, struct utimbuf *times); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /mission5820/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIME_H 2 | #define _UTIME_H 3 | 4 | #include /* I know - shouldn't do this, but .. */ 5 | /* 我知道 - 不应该这样做,但是.. */ 6 | 7 | struct utimbuf { 8 | time_t actime; // 文件访问时间。 从1970.1.1:0:0:0开始的秒数. 9 | time_t modtime; // 文件修改时间。 从1970.1.1:0:0:0开始的秒数. 10 | }; 11 | 12 | // 设置文件访问和修改时间函数. 13 | extern int utime(const char *filename, struct utimbuf *times); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /mission5826/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIME_H 2 | #define _UTIME_H 3 | 4 | #include /* I know - shouldn't do this, but .. */ 5 | /* 我知道 - 不应该这样做,但是.. */ 6 | 7 | struct utimbuf { 8 | time_t actime; // 文件访问时间。 从1970.1.1:0:0:0开始的秒数. 9 | time_t modtime; // 文件修改时间。 从1970.1.1:0:0:0开始的秒数. 10 | }; 11 | 12 | // 设置文件访问和修改时间函数. 13 | extern int utime(const char *filename, struct utimbuf *times); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /mission5827/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIME_H 2 | #define _UTIME_H 3 | 4 | #include /* I know - shouldn't do this, but .. */ 5 | /* 我知道 - 不应该这样做,但是.. */ 6 | 7 | struct utimbuf { 8 | time_t actime; // 文件访问时间。 从1970.1.1:0:0:0开始的秒数. 9 | time_t modtime; // 文件修改时间。 从1970.1.1:0:0:0开始的秒数. 10 | }; 11 | 12 | // 设置文件访问和修改时间函数. 13 | extern int utime(const char *filename, struct utimbuf *times); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /mission5834/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIME_H 2 | #define _UTIME_H 3 | 4 | #include /* I know - shouldn't do this, but .. */ 5 | /* 我知道 - 不应该这样做,但是.. */ 6 | 7 | struct utimbuf { 8 | time_t actime; // 文件访问时间。 从1970.1.1:0:0:0开始的秒数. 9 | time_t modtime; // 文件修改时间。 从1970.1.1:0:0:0开始的秒数. 10 | }; 11 | 12 | // 设置文件访问和修改时间函数. 13 | extern int utime(const char *filename, struct utimbuf *times); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /mission5835/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIME_H 2 | #define _UTIME_H 3 | 4 | #include /* I know - shouldn't do this, but .. */ 5 | /* 我知道 - 不应该这样做,但是.. */ 6 | 7 | struct utimbuf { 8 | time_t actime; // 文件访问时间。 从1970.1.1:0:0:0开始的秒数. 9 | time_t modtime; // 文件修改时间。 从1970.1.1:0:0:0开始的秒数. 10 | }; 11 | 12 | // 设置文件访问和修改时间函数. 13 | extern int utime(const char *filename, struct utimbuf *times); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /mission5846/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIME_H 2 | #define _UTIME_H 3 | 4 | #include /* I know - shouldn't do this, but .. */ 5 | /* 我知道 - 不应该这样做,但是.. */ 6 | 7 | struct utimbuf { 8 | time_t actime; // 文件访问时间。 从1970.1.1:0:0:0开始的秒数. 9 | time_t modtime; // 文件修改时间。 从1970.1.1:0:0:0开始的秒数. 10 | }; 11 | 12 | // 设置文件访问和修改时间函数. 13 | extern int utime(const char *filename, struct utimbuf *times); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /mission5817/include/linux/mm.h: -------------------------------------------------------------------------------- 1 | #ifndef _MM_H 2 | #define _MM_H 3 | 4 | #define PAGE_SIZE 4096 // 定义内存页面的大小(字节数)。 5 | 6 | // 取空闲页面函数。返回页面地址。扫描页面映射数组mem_map[]取空闲页面。 7 | extern unsigned long get_free_page (void); 8 | // 在指定物理地址处放置一页面。在页目录和页表中放置指定页面信息。 9 | extern unsigned long put_page (unsigned long page, unsigned long address); 10 | // 释放物理地址addr 开始的一页面内存。修改页面映射数组mem_map[]中引用次数信息。 11 | extern void free_page (unsigned long addr); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mission5820/include/linux/mm.h: -------------------------------------------------------------------------------- 1 | #ifndef _MM_H 2 | #define _MM_H 3 | 4 | #define PAGE_SIZE 4096 // 定义内存页面的大小(字节数)。 5 | 6 | // 取空闲页面函数。返回页面地址。扫描页面映射数组mem_map[]取空闲页面。 7 | extern unsigned long get_free_page (void); 8 | // 在指定物理地址处放置一页面。在页目录和页表中放置指定页面信息。 9 | extern unsigned long put_page (unsigned long page, unsigned long address); 10 | // 释放物理地址addr 开始的一页面内存。修改页面映射数组mem_map[]中引用次数信息。 11 | extern void free_page (unsigned long addr); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mission5826/include/linux/mm.h: -------------------------------------------------------------------------------- 1 | #ifndef _MM_H 2 | #define _MM_H 3 | 4 | #define PAGE_SIZE 4096 // 定义内存页面的大小(字节数)。 5 | 6 | // 取空闲页面函数。返回页面地址。扫描页面映射数组mem_map[]取空闲页面。 7 | extern unsigned long get_free_page (void); 8 | // 在指定物理地址处放置一页面。在页目录和页表中放置指定页面信息。 9 | extern unsigned long put_page (unsigned long page, unsigned long address); 10 | // 释放物理地址addr 开始的一页面内存。修改页面映射数组mem_map[]中引用次数信息。 11 | extern void free_page (unsigned long addr); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mission5827/include/linux/mm.h: -------------------------------------------------------------------------------- 1 | #ifndef _MM_H 2 | #define _MM_H 3 | 4 | #define PAGE_SIZE 4096 // 定义内存页面的大小(字节数)。 5 | 6 | // 取空闲页面函数。返回页面地址。扫描页面映射数组mem_map[]取空闲页面。 7 | extern unsigned long get_free_page (void); 8 | // 在指定物理地址处放置一页面。在页目录和页表中放置指定页面信息。 9 | extern unsigned long put_page (unsigned long page, unsigned long address); 10 | // 释放物理地址addr 开始的一页面内存。修改页面映射数组mem_map[]中引用次数信息。 11 | extern void free_page (unsigned long addr); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mission5834/include/linux/mm.h: -------------------------------------------------------------------------------- 1 | #ifndef _MM_H 2 | #define _MM_H 3 | 4 | #define PAGE_SIZE 4096 // 定义内存页面的大小(字节数)。 5 | 6 | // 取空闲页面函数。返回页面地址。扫描页面映射数组mem_map[]取空闲页面。 7 | extern unsigned long get_free_page (void); 8 | // 在指定物理地址处放置一页面。在页目录和页表中放置指定页面信息。 9 | extern unsigned long put_page (unsigned long page, unsigned long address); 10 | // 释放物理地址addr 开始的一页面内存。修改页面映射数组mem_map[]中引用次数信息。 11 | extern void free_page (unsigned long addr); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mission5835/include/linux/mm.h: -------------------------------------------------------------------------------- 1 | #ifndef _MM_H 2 | #define _MM_H 3 | 4 | #define PAGE_SIZE 4096 // 定义内存页面的大小(字节数)。 5 | 6 | // 取空闲页面函数。返回页面地址。扫描页面映射数组mem_map[]取空闲页面。 7 | extern unsigned long get_free_page (void); 8 | // 在指定物理地址处放置一页面。在页目录和页表中放置指定页面信息。 9 | extern unsigned long put_page (unsigned long page, unsigned long address); 10 | // 释放物理地址addr 开始的一页面内存。修改页面映射数组mem_map[]中引用次数信息。 11 | extern void free_page (unsigned long addr); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mission5846/include/linux/mm.h: -------------------------------------------------------------------------------- 1 | #ifndef _MM_H 2 | #define _MM_H 3 | 4 | #define PAGE_SIZE 4096 // 定义内存页面的大小(字节数)。 5 | 6 | // 取空闲页面函数。返回页面地址。扫描页面映射数组mem_map[]取空闲页面。 7 | extern unsigned long get_free_page (void); 8 | // 在指定物理地址处放置一页面。在页目录和页表中放置指定页面信息。 9 | extern unsigned long put_page (unsigned long page, unsigned long address); 10 | // 释放物理地址addr 开始的一页面内存。修改页面映射数组mem_map[]中引用次数信息。 11 | extern void free_page (unsigned long addr); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mission5817/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTSNAME_H 2 | #define _SYS_UTSNAME_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct utsname 7 | { 8 | char sysname[9]; // 本版本操作系统的名称。 9 | char nodename[9]; // 与实现相关的网络中节点名称。 10 | char release[9]; // 本实现的当前发行级别。 11 | char version[9]; // 本次发行的版本级别。 12 | char machine[9]; // 系统运行的硬件类型名称。 13 | }; 14 | 15 | extern int uname (struct utsname *utsbuf); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mission5820/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTSNAME_H 2 | #define _SYS_UTSNAME_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct utsname 7 | { 8 | char sysname[9]; // 本版本操作系统的名称。 9 | char nodename[9]; // 与实现相关的网络中节点名称。 10 | char release[9]; // 本实现的当前发行级别。 11 | char version[9]; // 本次发行的版本级别。 12 | char machine[9]; // 系统运行的硬件类型名称。 13 | }; 14 | 15 | extern int uname (struct utsname *utsbuf); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mission5826/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTSNAME_H 2 | #define _SYS_UTSNAME_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct utsname 7 | { 8 | char sysname[9]; // 本版本操作系统的名称。 9 | char nodename[9]; // 与实现相关的网络中节点名称。 10 | char release[9]; // 本实现的当前发行级别。 11 | char version[9]; // 本次发行的版本级别。 12 | char machine[9]; // 系统运行的硬件类型名称。 13 | }; 14 | 15 | extern int uname (struct utsname *utsbuf); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mission5827/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTSNAME_H 2 | #define _SYS_UTSNAME_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct utsname 7 | { 8 | char sysname[9]; // 本版本操作系统的名称。 9 | char nodename[9]; // 与实现相关的网络中节点名称。 10 | char release[9]; // 本实现的当前发行级别。 11 | char version[9]; // 本次发行的版本级别。 12 | char machine[9]; // 系统运行的硬件类型名称。 13 | }; 14 | 15 | extern int uname (struct utsname *utsbuf); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mission5834/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTSNAME_H 2 | #define _SYS_UTSNAME_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct utsname 7 | { 8 | char sysname[9]; // 本版本操作系统的名称。 9 | char nodename[9]; // 与实现相关的网络中节点名称。 10 | char release[9]; // 本实现的当前发行级别。 11 | char version[9]; // 本次发行的版本级别。 12 | char machine[9]; // 系统运行的硬件类型名称。 13 | }; 14 | 15 | extern int uname (struct utsname *utsbuf); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mission5835/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTSNAME_H 2 | #define _SYS_UTSNAME_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct utsname 7 | { 8 | char sysname[9]; // 本版本操作系统的名称。 9 | char nodename[9]; // 与实现相关的网络中节点名称。 10 | char release[9]; // 本实现的当前发行级别。 11 | char version[9]; // 本次发行的版本级别。 12 | char machine[9]; // 系统运行的硬件类型名称。 13 | }; 14 | 15 | extern int uname (struct utsname *utsbuf); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mission5846/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTSNAME_H 2 | #define _SYS_UTSNAME_H 3 | 4 | #include // 类型头文件。定义了基本的系统数据类型。 5 | 6 | struct utsname 7 | { 8 | char sysname[9]; // 本版本操作系统的名称。 9 | char nodename[9]; // 与实现相关的网络中节点名称。 10 | char release[9]; // 本实现的当前发行级别。 11 | char version[9]; // 本次发行的版本级别。 12 | char machine[9]; // 系统运行的硬件类型名称。 13 | }; 14 | 15 | extern int uname (struct utsname *utsbuf); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mission5817/lib/write.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/write.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 写文件系统调用函数。 12 | // 该宏结构对应于函数:int write(int fd, const char * buf, off_t count) 13 | // 参数:fd - 文件描述符;buf - 写缓冲区指针;count - 写字节数。 14 | // 返回:成功时返回写入的字节数(0 表示写入0 字节);出错时将返回-1,并且设置了出错号。 15 | _syscall3(int,write,int,fd,const char *,buf,off_t,count) 16 | -------------------------------------------------------------------------------- /mission5820/lib/write.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/write.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 写文件系统调用函数。 12 | // 该宏结构对应于函数:int write(int fd, const char * buf, off_t count) 13 | // 参数:fd - 文件描述符;buf - 写缓冲区指针;count - 写字节数。 14 | // 返回:成功时返回写入的字节数(0 表示写入0 字节);出错时将返回-1,并且设置了出错号。 15 | _syscall3(int,write,int,fd,const char *,buf,off_t,count) 16 | -------------------------------------------------------------------------------- /mission5826/lib/write.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/write.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 写文件系统调用函数。 12 | // 该宏结构对应于函数:int write(int fd, const char * buf, off_t count) 13 | // 参数:fd - 文件描述符;buf - 写缓冲区指针;count - 写字节数。 14 | // 返回:成功时返回写入的字节数(0 表示写入0 字节);出错时将返回-1,并且设置了出错号。 15 | _syscall3(int,write,int,fd,const char *,buf,off_t,count) 16 | -------------------------------------------------------------------------------- /mission5827/lib/write.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/write.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 写文件系统调用函数。 12 | // 该宏结构对应于函数:int write(int fd, const char * buf, off_t count) 13 | // 参数:fd - 文件描述符;buf - 写缓冲区指针;count - 写字节数。 14 | // 返回:成功时返回写入的字节数(0 表示写入0 字节);出错时将返回-1,并且设置了出错号。 15 | _syscall3(int,write,int,fd,const char *,buf,off_t,count) 16 | -------------------------------------------------------------------------------- /mission5834/lib/write.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/write.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 写文件系统调用函数。 12 | // 该宏结构对应于函数:int write(int fd, const char * buf, off_t count) 13 | // 参数:fd - 文件描述符;buf - 写缓冲区指针;count - 写字节数。 14 | // 返回:成功时返回写入的字节数(0 表示写入0 字节);出错时将返回-1,并且设置了出错号。 15 | _syscall3(int,write,int,fd,const char *,buf,off_t,count) 16 | -------------------------------------------------------------------------------- /mission5835/lib/write.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/write.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 写文件系统调用函数。 12 | // 该宏结构对应于函数:int write(int fd, const char * buf, off_t count) 13 | // 参数:fd - 文件描述符;buf - 写缓冲区指针;count - 写字节数。 14 | // 返回:成功时返回写入的字节数(0 表示写入0 字节);出错时将返回-1,并且设置了出错号。 15 | _syscall3(int,write,int,fd,const char *,buf,off_t,count) 16 | -------------------------------------------------------------------------------- /mission5846/lib/write.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/write.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 写文件系统调用函数。 12 | // 该宏结构对应于函数:int write(int fd, const char * buf, off_t count) 13 | // 参数:fd - 文件描述符;buf - 写缓冲区指针;count - 写字节数。 14 | // 返回:成功时返回写入的字节数(0 表示写入0 字节);出错时将返回-1,并且设置了出错号。 15 | _syscall3(int,write,int,fd,const char *,buf,off_t,count) 16 | -------------------------------------------------------------------------------- /mission5826/main.c: -------------------------------------------------------------------------------- 1 | #define _LIBRARY_ 2 | #include 3 | #include 4 | int main(){ 5 | int pid; 6 | printf("PID:%D parent process start.\n",getpid()); 7 | pid = fork(); 8 | if(pid != 0 ) 9 | { 10 | wait(NULL); 11 | printf("PID:%d parent process continue.\n",getpid()); 12 | } 13 | else 14 | { 15 | printf("PID:%d child process start.\n",getpid()); 16 | printf("PID:%d child process exit.\n",getpid()); 17 | return 0; 18 | } 19 | printf("PID:%d parent process exit.\n",getpid()); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /mission5817/init/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = main.o 12 | 13 | ${TARGET}: 14 | 15 | %.o: %.c $(INCLUDES) $(INC) 16 | @echo - 17 | @echo -------- Compile $< -------- 18 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 19 | 20 | clean: 21 | del /Q *.o 22 | 23 | -------------------------------------------------------------------------------- /mission5820/init/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = main.o 12 | 13 | ${TARGET}: 14 | 15 | %.o: %.c $(INCLUDES) $(INC) 16 | @echo - 17 | @echo -------- Compile $< -------- 18 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 19 | 20 | clean: 21 | del /Q *.o 22 | 23 | -------------------------------------------------------------------------------- /mission5826/init/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = main.o 12 | 13 | ${TARGET}: 14 | 15 | %.o: %.c $(INCLUDES) $(INC) 16 | @echo - 17 | @echo -------- Compile $< -------- 18 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 19 | 20 | clean: 21 | del /Q *.o 22 | 23 | -------------------------------------------------------------------------------- /mission5827/init/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = main.o 12 | 13 | ${TARGET}: 14 | 15 | %.o: %.c $(INCLUDES) $(INC) 16 | @echo - 17 | @echo -------- Compile $< -------- 18 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 19 | 20 | clean: 21 | del /Q *.o 22 | 23 | -------------------------------------------------------------------------------- /mission5834/init/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = main.o 12 | 13 | ${TARGET}: 14 | 15 | %.o: %.c $(INCLUDES) $(INC) 16 | @echo - 17 | @echo -------- Compile $< -------- 18 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 19 | 20 | clean: 21 | del /Q *.o 22 | 23 | -------------------------------------------------------------------------------- /mission5835/init/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = main.o 12 | 13 | ${TARGET}: 14 | 15 | %.o: %.c $(INCLUDES) $(INC) 16 | @echo - 17 | @echo -------- Compile $< -------- 18 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 19 | 20 | clean: 21 | del /Q *.o 22 | 23 | -------------------------------------------------------------------------------- /mission5846/init/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = main.o 12 | 13 | ${TARGET}: 14 | 15 | %.o: %.c $(INCLUDES) $(INC) 16 | @echo - 17 | @echo -------- Compile $< -------- 18 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 19 | 20 | clean: 21 | del /Q *.o 22 | 23 | -------------------------------------------------------------------------------- /mission5817/lib/_exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/_exit.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ // 定义一个符号常量,见下行说明。 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 内核使用的程序(退出)终止函数。 12 | // 直接调用系统中断int 0x80,功能号__NR_exit。 13 | // 参数:exit_code - 退出码。 14 | volatile void _exit(int exit_code) 15 | { 16 | __asm("INT $0x03"); 17 | // %0 - eax(系统调用号__NR_exit);%1 - ebx(退出码exit_code)。 18 | __asm__("int $0x80"::"a" (__NR_exit),"b" (exit_code)); 19 | } 20 | -------------------------------------------------------------------------------- /mission5820/lib/_exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/_exit.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ // 定义一个符号常量,见下行说明。 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 内核使用的程序(退出)终止函数。 12 | // 直接调用系统中断int 0x80,功能号__NR_exit。 13 | // 参数:exit_code - 退出码。 14 | volatile void _exit(int exit_code) 15 | { 16 | __asm("INT $0x03"); 17 | // %0 - eax(系统调用号__NR_exit);%1 - ebx(退出码exit_code)。 18 | __asm__("int $0x80"::"a" (__NR_exit),"b" (exit_code)); 19 | } 20 | -------------------------------------------------------------------------------- /mission5826/lib/_exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/_exit.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ // 定义一个符号常量,见下行说明。 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 内核使用的程序(退出)终止函数。 12 | // 直接调用系统中断int 0x80,功能号__NR_exit。 13 | // 参数:exit_code - 退出码。 14 | volatile void _exit(int exit_code) 15 | { 16 | __asm("INT $0x03"); 17 | // %0 - eax(系统调用号__NR_exit);%1 - ebx(退出码exit_code)。 18 | __asm__("int $0x80"::"a" (__NR_exit),"b" (exit_code)); 19 | } 20 | -------------------------------------------------------------------------------- /mission5827/lib/_exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/_exit.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ // 定义一个符号常量,见下行说明。 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 内核使用的程序(退出)终止函数。 12 | // 直接调用系统中断int 0x80,功能号__NR_exit。 13 | // 参数:exit_code - 退出码。 14 | volatile void _exit(int exit_code) 15 | { 16 | __asm("INT $0x03"); 17 | // %0 - eax(系统调用号__NR_exit);%1 - ebx(退出码exit_code)。 18 | __asm__("int $0x80"::"a" (__NR_exit),"b" (exit_code)); 19 | } 20 | -------------------------------------------------------------------------------- /mission5834/lib/_exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/_exit.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ // 定义一个符号常量,见下行说明。 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 内核使用的程序(退出)终止函数。 12 | // 直接调用系统中断int 0x80,功能号__NR_exit。 13 | // 参数:exit_code - 退出码。 14 | volatile void _exit(int exit_code) 15 | { 16 | __asm("INT $0x03"); 17 | // %0 - eax(系统调用号__NR_exit);%1 - ebx(退出码exit_code)。 18 | __asm__("int $0x80"::"a" (__NR_exit),"b" (exit_code)); 19 | } 20 | -------------------------------------------------------------------------------- /mission5835/lib/_exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/_exit.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ // 定义一个符号常量,见下行说明。 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 内核使用的程序(退出)终止函数。 12 | // 直接调用系统中断int 0x80,功能号__NR_exit。 13 | // 参数:exit_code - 退出码。 14 | volatile void _exit(int exit_code) 15 | { 16 | __asm("INT $0x03"); 17 | // %0 - eax(系统调用号__NR_exit);%1 - ebx(退出码exit_code)。 18 | __asm__("int $0x80"::"a" (__NR_exit),"b" (exit_code)); 19 | } 20 | -------------------------------------------------------------------------------- /mission5846/lib/_exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/_exit.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ // 定义一个符号常量,见下行说明。 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 内核使用的程序(退出)终止函数。 12 | // 直接调用系统中断int 0x80,功能号__NR_exit。 13 | // 参数:exit_code - 退出码。 14 | volatile void _exit(int exit_code) 15 | { 16 | __asm("INT $0x03"); 17 | // %0 - eax(系统调用号__NR_exit);%1 - ebx(退出码exit_code)。 18 | __asm__("int $0x80"::"a" (__NR_exit),"b" (exit_code)); 19 | } 20 | -------------------------------------------------------------------------------- /mission5817/lib/execve.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/execve.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 加载并执行子进程(其它程序)函数。 12 | // 下面该调用宏函数对应:int execve(const char * file, char ** argv, char ** envp)。 13 | // 参数:file - 被执行程序文件名;argv - 命令行参数指针数组;envp - 环境变量指针数组。 14 | 15 | // 直接调用了系统中断int 0x80,参数是__NR_execve。参见include/unistd.h 和fs/exec.c 程序。 16 | _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 17 | -------------------------------------------------------------------------------- /mission5820/lib/execve.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/execve.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 加载并执行子进程(其它程序)函数。 12 | // 下面该调用宏函数对应:int execve(const char * file, char ** argv, char ** envp)。 13 | // 参数:file - 被执行程序文件名;argv - 命令行参数指针数组;envp - 环境变量指针数组。 14 | 15 | // 直接调用了系统中断int 0x80,参数是__NR_execve。参见include/unistd.h 和fs/exec.c 程序。 16 | _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 17 | -------------------------------------------------------------------------------- /mission5826/lib/execve.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/execve.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 加载并执行子进程(其它程序)函数。 12 | // 下面该调用宏函数对应:int execve(const char * file, char ** argv, char ** envp)。 13 | // 参数:file - 被执行程序文件名;argv - 命令行参数指针数组;envp - 环境变量指针数组。 14 | 15 | // 直接调用了系统中断int 0x80,参数是__NR_execve。参见include/unistd.h 和fs/exec.c 程序。 16 | _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 17 | -------------------------------------------------------------------------------- /mission5827/lib/execve.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/execve.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 加载并执行子进程(其它程序)函数。 12 | // 下面该调用宏函数对应:int execve(const char * file, char ** argv, char ** envp)。 13 | // 参数:file - 被执行程序文件名;argv - 命令行参数指针数组;envp - 环境变量指针数组。 14 | 15 | // 直接调用了系统中断int 0x80,参数是__NR_execve。参见include/unistd.h 和fs/exec.c 程序。 16 | _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 17 | -------------------------------------------------------------------------------- /mission5834/lib/execve.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/execve.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 加载并执行子进程(其它程序)函数。 12 | // 下面该调用宏函数对应:int execve(const char * file, char ** argv, char ** envp)。 13 | // 参数:file - 被执行程序文件名;argv - 命令行参数指针数组;envp - 环境变量指针数组。 14 | 15 | // 直接调用了系统中断int 0x80,参数是__NR_execve。参见include/unistd.h 和fs/exec.c 程序。 16 | _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 17 | -------------------------------------------------------------------------------- /mission5835/lib/execve.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/execve.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 加载并执行子进程(其它程序)函数。 12 | // 下面该调用宏函数对应:int execve(const char * file, char ** argv, char ** envp)。 13 | // 参数:file - 被执行程序文件名;argv - 命令行参数指针数组;envp - 环境变量指针数组。 14 | 15 | // 直接调用了系统中断int 0x80,参数是__NR_execve。参见include/unistd.h 和fs/exec.c 程序。 16 | _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 17 | -------------------------------------------------------------------------------- /mission5846/lib/execve.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/execve.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | 11 | //// 加载并执行子进程(其它程序)函数。 12 | // 下面该调用宏函数对应:int execve(const char * file, char ** argv, char ** envp)。 13 | // 参数:file - 被执行程序文件名;argv - 命令行参数指针数组;envp - 环境变量指针数组。 14 | 15 | // 直接调用了系统中断int 0x80,参数是__NR_execve。参见include/unistd.h 和fs/exec.c 程序。 16 | _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 17 | -------------------------------------------------------------------------------- /mission5817/include/const.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONST_H 2 | #define _CONST_H 3 | 4 | #define BUFFER_END 0x200000 // 定义缓冲使用内存的末端(代码中没有使用该常量) 5 | 6 | // i节点数据结构中 i_mode 字段的个标志位 7 | #define I_TYPE 0170000 // 指明i节点类型(类型屏蔽码) 8 | #define I_DIRECTORY 0040000 // 是目录文件。 9 | #define I_REGULAR 0100000 // 是常规文件,不是目录文件或特殊文件 10 | #define I_BLOCK_SPECIAL 0060000 // 是块设备特殊文件 11 | #define I_CHAR_SPECIAL 0020000 // 是字符设备特殊文件 12 | #define I_NAMED_PIPE 0010000 // 是命名管道节点 13 | #define I_SET_UID_BIT 0004000 // 在执行时设置有效用户ID类型 14 | #define I_SET_GID_BIT 0002000 // 在执行时设置有效组 ID类型 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5820/include/const.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONST_H 2 | #define _CONST_H 3 | 4 | #define BUFFER_END 0x200000 // 定义缓冲使用内存的末端(代码中没有使用该常量) 5 | 6 | // i节点数据结构中 i_mode 字段的个标志位 7 | #define I_TYPE 0170000 // 指明i节点类型(类型屏蔽码) 8 | #define I_DIRECTORY 0040000 // 是目录文件。 9 | #define I_REGULAR 0100000 // 是常规文件,不是目录文件或特殊文件 10 | #define I_BLOCK_SPECIAL 0060000 // 是块设备特殊文件 11 | #define I_CHAR_SPECIAL 0020000 // 是字符设备特殊文件 12 | #define I_NAMED_PIPE 0010000 // 是命名管道节点 13 | #define I_SET_UID_BIT 0004000 // 在执行时设置有效用户ID类型 14 | #define I_SET_GID_BIT 0002000 // 在执行时设置有效组 ID类型 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5826/include/const.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONST_H 2 | #define _CONST_H 3 | 4 | #define BUFFER_END 0x200000 // 定义缓冲使用内存的末端(代码中没有使用该常量) 5 | 6 | // i节点数据结构中 i_mode 字段的个标志位 7 | #define I_TYPE 0170000 // 指明i节点类型(类型屏蔽码) 8 | #define I_DIRECTORY 0040000 // 是目录文件。 9 | #define I_REGULAR 0100000 // 是常规文件,不是目录文件或特殊文件 10 | #define I_BLOCK_SPECIAL 0060000 // 是块设备特殊文件 11 | #define I_CHAR_SPECIAL 0020000 // 是字符设备特殊文件 12 | #define I_NAMED_PIPE 0010000 // 是命名管道节点 13 | #define I_SET_UID_BIT 0004000 // 在执行时设置有效用户ID类型 14 | #define I_SET_GID_BIT 0002000 // 在执行时设置有效组 ID类型 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5827/include/const.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONST_H 2 | #define _CONST_H 3 | 4 | #define BUFFER_END 0x200000 // 定义缓冲使用内存的末端(代码中没有使用该常量) 5 | 6 | // i节点数据结构中 i_mode 字段的个标志位 7 | #define I_TYPE 0170000 // 指明i节点类型(类型屏蔽码) 8 | #define I_DIRECTORY 0040000 // 是目录文件。 9 | #define I_REGULAR 0100000 // 是常规文件,不是目录文件或特殊文件 10 | #define I_BLOCK_SPECIAL 0060000 // 是块设备特殊文件 11 | #define I_CHAR_SPECIAL 0020000 // 是字符设备特殊文件 12 | #define I_NAMED_PIPE 0010000 // 是命名管道节点 13 | #define I_SET_UID_BIT 0004000 // 在执行时设置有效用户ID类型 14 | #define I_SET_GID_BIT 0002000 // 在执行时设置有效组 ID类型 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5834/include/const.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONST_H 2 | #define _CONST_H 3 | 4 | #define BUFFER_END 0x200000 // 定义缓冲使用内存的末端(代码中没有使用该常量) 5 | 6 | // i节点数据结构中 i_mode 字段的个标志位 7 | #define I_TYPE 0170000 // 指明i节点类型(类型屏蔽码) 8 | #define I_DIRECTORY 0040000 // 是目录文件。 9 | #define I_REGULAR 0100000 // 是常规文件,不是目录文件或特殊文件 10 | #define I_BLOCK_SPECIAL 0060000 // 是块设备特殊文件 11 | #define I_CHAR_SPECIAL 0020000 // 是字符设备特殊文件 12 | #define I_NAMED_PIPE 0010000 // 是命名管道节点 13 | #define I_SET_UID_BIT 0004000 // 在执行时设置有效用户ID类型 14 | #define I_SET_GID_BIT 0002000 // 在执行时设置有效组 ID类型 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5835/include/const.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONST_H 2 | #define _CONST_H 3 | 4 | #define BUFFER_END 0x200000 // 定义缓冲使用内存的末端(代码中没有使用该常量) 5 | 6 | // i节点数据结构中 i_mode 字段的个标志位 7 | #define I_TYPE 0170000 // 指明i节点类型(类型屏蔽码) 8 | #define I_DIRECTORY 0040000 // 是目录文件。 9 | #define I_REGULAR 0100000 // 是常规文件,不是目录文件或特殊文件 10 | #define I_BLOCK_SPECIAL 0060000 // 是块设备特殊文件 11 | #define I_CHAR_SPECIAL 0020000 // 是字符设备特殊文件 12 | #define I_NAMED_PIPE 0010000 // 是命名管道节点 13 | #define I_SET_UID_BIT 0004000 // 在执行时设置有效用户ID类型 14 | #define I_SET_GID_BIT 0002000 // 在执行时设置有效组 ID类型 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5846/include/const.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONST_H 2 | #define _CONST_H 3 | 4 | #define BUFFER_END 0x200000 // 定义缓冲使用内存的末端(代码中没有使用该常量) 5 | 6 | // i节点数据结构中 i_mode 字段的个标志位 7 | #define I_TYPE 0170000 // 指明i节点类型(类型屏蔽码) 8 | #define I_DIRECTORY 0040000 // 是目录文件。 9 | #define I_REGULAR 0100000 // 是常规文件,不是目录文件或特殊文件 10 | #define I_BLOCK_SPECIAL 0060000 // 是块设备特殊文件 11 | #define I_CHAR_SPECIAL 0020000 // 是字符设备特殊文件 12 | #define I_NAMED_PIPE 0010000 // 是命名管道节点 13 | #define I_SET_UID_BIT 0004000 // 在执行时设置有效用户ID类型 14 | #define I_SET_GID_BIT 0002000 // 在执行时设置有效组 ID类型 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mission5817/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | #ifndef _PTRDIFF_T 5 | #define _PTRDIFF_T 6 | typedef long ptrdiff_t; // 两个指针相减结果的类型. 7 | #endif 8 | 9 | #ifndef _SIZE_T 10 | #define _SIZE_T 11 | typedef unsigned long size_t; // sizeof返回的类型. 12 | #endif 13 | 14 | #undef NULL 15 | #define NULL ((void *)0) // 空指针 16 | 17 | // 下面定义了一个计算某成员在类型中偏移位置的宏。使用该宏可以确定一个成员(字段) 18 | // 在包含它的结构类型中从结构开始处算起的字节偏移量。宏的结果时类型位size_t的整数 19 | // 常量表达式。这里是一个技巧手法。((TYPE *)0)是将一个整数0类型投射(typecast) 20 | // 成数据对象指针类型,然后在该结果上进行运算. 21 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /mission5820/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | #ifndef _PTRDIFF_T 5 | #define _PTRDIFF_T 6 | typedef long ptrdiff_t; // 两个指针相减结果的类型. 7 | #endif 8 | 9 | #ifndef _SIZE_T 10 | #define _SIZE_T 11 | typedef unsigned long size_t; // sizeof返回的类型. 12 | #endif 13 | 14 | #undef NULL 15 | #define NULL ((void *)0) // 空指针 16 | 17 | // 下面定义了一个计算某成员在类型中偏移位置的宏。使用该宏可以确定一个成员(字段) 18 | // 在包含它的结构类型中从结构开始处算起的字节偏移量。宏的结果时类型位size_t的整数 19 | // 常量表达式。这里是一个技巧手法。((TYPE *)0)是将一个整数0类型投射(typecast) 20 | // 成数据对象指针类型,然后在该结果上进行运算. 21 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /mission5826/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | #ifndef _PTRDIFF_T 5 | #define _PTRDIFF_T 6 | typedef long ptrdiff_t; // 两个指针相减结果的类型. 7 | #endif 8 | 9 | #ifndef _SIZE_T 10 | #define _SIZE_T 11 | typedef unsigned long size_t; // sizeof返回的类型. 12 | #endif 13 | 14 | #undef NULL 15 | #define NULL ((void *)0) // 空指针 16 | 17 | // 下面定义了一个计算某成员在类型中偏移位置的宏。使用该宏可以确定一个成员(字段) 18 | // 在包含它的结构类型中从结构开始处算起的字节偏移量。宏的结果时类型位size_t的整数 19 | // 常量表达式。这里是一个技巧手法。((TYPE *)0)是将一个整数0类型投射(typecast) 20 | // 成数据对象指针类型,然后在该结果上进行运算. 21 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /mission5827/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | #ifndef _PTRDIFF_T 5 | #define _PTRDIFF_T 6 | typedef long ptrdiff_t; // 两个指针相减结果的类型. 7 | #endif 8 | 9 | #ifndef _SIZE_T 10 | #define _SIZE_T 11 | typedef unsigned long size_t; // sizeof返回的类型. 12 | #endif 13 | 14 | #undef NULL 15 | #define NULL ((void *)0) // 空指针 16 | 17 | // 下面定义了一个计算某成员在类型中偏移位置的宏。使用该宏可以确定一个成员(字段) 18 | // 在包含它的结构类型中从结构开始处算起的字节偏移量。宏的结果时类型位size_t的整数 19 | // 常量表达式。这里是一个技巧手法。((TYPE *)0)是将一个整数0类型投射(typecast) 20 | // 成数据对象指针类型,然后在该结果上进行运算. 21 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /mission5834/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | #ifndef _PTRDIFF_T 5 | #define _PTRDIFF_T 6 | typedef long ptrdiff_t; // 两个指针相减结果的类型. 7 | #endif 8 | 9 | #ifndef _SIZE_T 10 | #define _SIZE_T 11 | typedef unsigned long size_t; // sizeof返回的类型. 12 | #endif 13 | 14 | #undef NULL 15 | #define NULL ((void *)0) // 空指针 16 | 17 | // 下面定义了一个计算某成员在类型中偏移位置的宏。使用该宏可以确定一个成员(字段) 18 | // 在包含它的结构类型中从结构开始处算起的字节偏移量。宏的结果时类型位size_t的整数 19 | // 常量表达式。这里是一个技巧手法。((TYPE *)0)是将一个整数0类型投射(typecast) 20 | // 成数据对象指针类型,然后在该结果上进行运算. 21 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /mission5835/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | #ifndef _PTRDIFF_T 5 | #define _PTRDIFF_T 6 | typedef long ptrdiff_t; // 两个指针相减结果的类型. 7 | #endif 8 | 9 | #ifndef _SIZE_T 10 | #define _SIZE_T 11 | typedef unsigned long size_t; // sizeof返回的类型. 12 | #endif 13 | 14 | #undef NULL 15 | #define NULL ((void *)0) // 空指针 16 | 17 | // 下面定义了一个计算某成员在类型中偏移位置的宏。使用该宏可以确定一个成员(字段) 18 | // 在包含它的结构类型中从结构开始处算起的字节偏移量。宏的结果时类型位size_t的整数 19 | // 常量表达式。这里是一个技巧手法。((TYPE *)0)是将一个整数0类型投射(typecast) 20 | // 成数据对象指针类型,然后在该结果上进行运算. 21 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /mission5846/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | #ifndef _PTRDIFF_T 5 | #define _PTRDIFF_T 6 | typedef long ptrdiff_t; // 两个指针相减结果的类型. 7 | #endif 8 | 9 | #ifndef _SIZE_T 10 | #define _SIZE_T 11 | typedef unsigned long size_t; // sizeof返回的类型. 12 | #endif 13 | 14 | #undef NULL 15 | #define NULL ((void *)0) // 空指针 16 | 17 | // 下面定义了一个计算某成员在类型中偏移位置的宏。使用该宏可以确定一个成员(字段) 18 | // 在包含它的结构类型中从结构开始处算起的字节偏移量。宏的结果时类型位size_t的整数 19 | // 常量表达式。这里是一个技巧手法。((TYPE *)0)是将一个整数0类型投射(typecast) 20 | // 成数据对象指针类型,然后在该结果上进行运算. 21 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /mission5817/fs/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = fs.o 12 | 13 | ${TARGET}: ${OBJS} 14 | @echo - 15 | @echo -------- Build library file $@ -------- 16 | $(LD) -r -o ${TARGET} $(OBJS) 17 | 18 | %.o: %.c $(INCLUDES) $(INC) 19 | @echo - 20 | @echo -------- Compile $< -------- 21 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 22 | 23 | clean: 24 | del /Q *.o 25 | 26 | -------------------------------------------------------------------------------- /mission5820/fs/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = fs.o 12 | 13 | ${TARGET}: ${OBJS} 14 | @echo - 15 | @echo -------- Build library file $@ -------- 16 | $(LD) -r -o ${TARGET} $(OBJS) 17 | 18 | %.o: %.c $(INCLUDES) $(INC) 19 | @echo - 20 | @echo -------- Compile $< -------- 21 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 22 | 23 | clean: 24 | del /Q *.o 25 | 26 | -------------------------------------------------------------------------------- /mission5826/fs/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = fs.o 12 | 13 | ${TARGET}: ${OBJS} 14 | @echo - 15 | @echo -------- Build library file $@ -------- 16 | $(LD) -r -o ${TARGET} $(OBJS) 17 | 18 | %.o: %.c $(INCLUDES) $(INC) 19 | @echo - 20 | @echo -------- Compile $< -------- 21 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 22 | 23 | clean: 24 | del /Q *.o 25 | 26 | -------------------------------------------------------------------------------- /mission5827/fs/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = fs.o 12 | 13 | ${TARGET}: ${OBJS} 14 | @echo - 15 | @echo -------- Build library file $@ -------- 16 | $(LD) -r -o ${TARGET} $(OBJS) 17 | 18 | %.o: %.c $(INCLUDES) $(INC) 19 | @echo - 20 | @echo -------- Compile $< -------- 21 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 22 | 23 | clean: 24 | del /Q *.o 25 | 26 | -------------------------------------------------------------------------------- /mission5834/fs/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = fs.o 12 | 13 | ${TARGET}: ${OBJS} 14 | @echo - 15 | @echo -------- Build library file $@ -------- 16 | $(LD) -r -o ${TARGET} $(OBJS) 17 | 18 | %.o: %.c $(INCLUDES) $(INC) 19 | @echo - 20 | @echo -------- Compile $< -------- 21 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 22 | 23 | clean: 24 | del /Q *.o 25 | 26 | -------------------------------------------------------------------------------- /mission5835/fs/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = fs.o 12 | 13 | ${TARGET}: ${OBJS} 14 | @echo - 15 | @echo -------- Build library file $@ -------- 16 | $(LD) -r -o ${TARGET} $(OBJS) 17 | 18 | %.o: %.c $(INCLUDES) $(INC) 19 | @echo - 20 | @echo -------- Compile $< -------- 21 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 22 | 23 | clean: 24 | del /Q *.o 25 | 26 | -------------------------------------------------------------------------------- /mission5846/fs/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | 5 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 6 | INC = $(wildcard ./*.h) 7 | 8 | SRC = $(wildcard *.c) 9 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 10 | 11 | TARGET = fs.o 12 | 13 | ${TARGET}: ${OBJS} 14 | @echo - 15 | @echo -------- Build library file $@ -------- 16 | $(LD) -r -o ${TARGET} $(OBJS) 17 | 18 | %.o: %.c $(INCLUDES) $(INC) 19 | @echo - 20 | @echo -------- Compile $< -------- 21 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 22 | 23 | clean: 24 | del /Q *.o 25 | 26 | -------------------------------------------------------------------------------- /mission5817/lib/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = lib.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5820/lib/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = lib.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5826/lib/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = lib.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5827/lib/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = lib.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5834/lib/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = lib.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5835/lib/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = lib.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5846/lib/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = lib.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5817/kernel/math/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | 6 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = math.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5820/kernel/math/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | 6 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = math.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5826/kernel/math/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | 6 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = math.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5827/kernel/math/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | 6 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = math.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5834/kernel/math/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | 6 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = math.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5835/kernel/math/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | 6 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = math.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5846/kernel/math/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | 6 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 11 | 12 | TARGET = math.a 13 | 14 | ${TARGET}: ${OBJS} 15 | @echo - 16 | @echo -------- Build library file $@ -------- 17 | $(AR) rcs ${TARGET} $(OBJS) 18 | 19 | %.o: %.c $(INCLUDES) $(INC) 20 | @echo - 21 | @echo -------- Compile $< -------- 22 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 23 | 24 | clean: 25 | del /Q *.o *.a 26 | 27 | -------------------------------------------------------------------------------- /mission5817/include/linux/head.h: -------------------------------------------------------------------------------- 1 | #ifndef _HEAD_H 2 | #define _HEAD_H 3 | 4 | typedef struct desc_struct 5 | { // 定义了段描述符的数据结构。该结构仅说明每个描述 6 | unsigned long a, b; // 符是由8 个字节构成,每个描述符表共有256 项。 7 | } 8 | desc_table[256]; 9 | 10 | extern unsigned long pg_dir[1024]; // 内存页目录数组。每个目录项为4 字节。从物理地址0 开始。 11 | extern desc_table idt, gdt; // 中断描述符表,全局描述符表。 12 | 13 | #define GDT_NUL 0 // 全局描述符表的第0 项,不用。 14 | #define GDT_CODE 1 // 第1 项,是内核代码段描述符项。 15 | #define GDT_DATA 2 // 第2 项,是内核数据段描述符项。 16 | #define GDT_TMP 3 // 第3 项,系统段描述符,Linux 没有使用。 17 | 18 | #define LDT_NUL 0 // 每个局部描述符表的第0 项,不用。 19 | #define LDT_CODE 1 // 第1 项,是用户程序代码段描述符项。 20 | #define LDT_DATA 2 // 第2 项,是用户程序数据段描述符项。 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /mission5820/include/linux/head.h: -------------------------------------------------------------------------------- 1 | #ifndef _HEAD_H 2 | #define _HEAD_H 3 | 4 | typedef struct desc_struct 5 | { // 定义了段描述符的数据结构。该结构仅说明每个描述 6 | unsigned long a, b; // 符是由8 个字节构成,每个描述符表共有256 项。 7 | } 8 | desc_table[256]; 9 | 10 | extern unsigned long pg_dir[1024]; // 内存页目录数组。每个目录项为4 字节。从物理地址0 开始。 11 | extern desc_table idt, gdt; // 中断描述符表,全局描述符表。 12 | 13 | #define GDT_NUL 0 // 全局描述符表的第0 项,不用。 14 | #define GDT_CODE 1 // 第1 项,是内核代码段描述符项。 15 | #define GDT_DATA 2 // 第2 项,是内核数据段描述符项。 16 | #define GDT_TMP 3 // 第3 项,系统段描述符,Linux 没有使用。 17 | 18 | #define LDT_NUL 0 // 每个局部描述符表的第0 项,不用。 19 | #define LDT_CODE 1 // 第1 项,是用户程序代码段描述符项。 20 | #define LDT_DATA 2 // 第2 项,是用户程序数据段描述符项。 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /mission5826/include/linux/head.h: -------------------------------------------------------------------------------- 1 | #ifndef _HEAD_H 2 | #define _HEAD_H 3 | 4 | typedef struct desc_struct 5 | { // 定义了段描述符的数据结构。该结构仅说明每个描述 6 | unsigned long a, b; // 符是由8 个字节构成,每个描述符表共有256 项。 7 | } 8 | desc_table[256]; 9 | 10 | extern unsigned long pg_dir[1024]; // 内存页目录数组。每个目录项为4 字节。从物理地址0 开始。 11 | extern desc_table idt, gdt; // 中断描述符表,全局描述符表。 12 | 13 | #define GDT_NUL 0 // 全局描述符表的第0 项,不用。 14 | #define GDT_CODE 1 // 第1 项,是内核代码段描述符项。 15 | #define GDT_DATA 2 // 第2 项,是内核数据段描述符项。 16 | #define GDT_TMP 3 // 第3 项,系统段描述符,Linux 没有使用。 17 | 18 | #define LDT_NUL 0 // 每个局部描述符表的第0 项,不用。 19 | #define LDT_CODE 1 // 第1 项,是用户程序代码段描述符项。 20 | #define LDT_DATA 2 // 第2 项,是用户程序数据段描述符项。 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /mission5827/include/linux/head.h: -------------------------------------------------------------------------------- 1 | #ifndef _HEAD_H 2 | #define _HEAD_H 3 | 4 | typedef struct desc_struct 5 | { // 定义了段描述符的数据结构。该结构仅说明每个描述 6 | unsigned long a, b; // 符是由8 个字节构成,每个描述符表共有256 项。 7 | } 8 | desc_table[256]; 9 | 10 | extern unsigned long pg_dir[1024]; // 内存页目录数组。每个目录项为4 字节。从物理地址0 开始。 11 | extern desc_table idt, gdt; // 中断描述符表,全局描述符表。 12 | 13 | #define GDT_NUL 0 // 全局描述符表的第0 项,不用。 14 | #define GDT_CODE 1 // 第1 项,是内核代码段描述符项。 15 | #define GDT_DATA 2 // 第2 项,是内核数据段描述符项。 16 | #define GDT_TMP 3 // 第3 项,系统段描述符,Linux 没有使用。 17 | 18 | #define LDT_NUL 0 // 每个局部描述符表的第0 项,不用。 19 | #define LDT_CODE 1 // 第1 项,是用户程序代码段描述符项。 20 | #define LDT_DATA 2 // 第2 项,是用户程序数据段描述符项。 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /mission5834/include/linux/head.h: -------------------------------------------------------------------------------- 1 | #ifndef _HEAD_H 2 | #define _HEAD_H 3 | 4 | typedef struct desc_struct 5 | { // 定义了段描述符的数据结构。该结构仅说明每个描述 6 | unsigned long a, b; // 符是由8 个字节构成,每个描述符表共有256 项。 7 | } 8 | desc_table[256]; 9 | 10 | extern unsigned long pg_dir[1024]; // 内存页目录数组。每个目录项为4 字节。从物理地址0 开始。 11 | extern desc_table idt, gdt; // 中断描述符表,全局描述符表。 12 | 13 | #define GDT_NUL 0 // 全局描述符表的第0 项,不用。 14 | #define GDT_CODE 1 // 第1 项,是内核代码段描述符项。 15 | #define GDT_DATA 2 // 第2 项,是内核数据段描述符项。 16 | #define GDT_TMP 3 // 第3 项,系统段描述符,Linux 没有使用。 17 | 18 | #define LDT_NUL 0 // 每个局部描述符表的第0 项,不用。 19 | #define LDT_CODE 1 // 第1 项,是用户程序代码段描述符项。 20 | #define LDT_DATA 2 // 第2 项,是用户程序数据段描述符项。 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /mission5835/include/linux/head.h: -------------------------------------------------------------------------------- 1 | #ifndef _HEAD_H 2 | #define _HEAD_H 3 | 4 | typedef struct desc_struct 5 | { // 定义了段描述符的数据结构。该结构仅说明每个描述 6 | unsigned long a, b; // 符是由8 个字节构成,每个描述符表共有256 项。 7 | } 8 | desc_table[256]; 9 | 10 | extern unsigned long pg_dir[1024]; // 内存页目录数组。每个目录项为4 字节。从物理地址0 开始。 11 | extern desc_table idt, gdt; // 中断描述符表,全局描述符表。 12 | 13 | #define GDT_NUL 0 // 全局描述符表的第0 项,不用。 14 | #define GDT_CODE 1 // 第1 项,是内核代码段描述符项。 15 | #define GDT_DATA 2 // 第2 项,是内核数据段描述符项。 16 | #define GDT_TMP 3 // 第3 项,系统段描述符,Linux 没有使用。 17 | 18 | #define LDT_NUL 0 // 每个局部描述符表的第0 项,不用。 19 | #define LDT_CODE 1 // 第1 项,是用户程序代码段描述符项。 20 | #define LDT_DATA 2 // 第2 项,是用户程序数据段描述符项。 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /mission5846/include/linux/head.h: -------------------------------------------------------------------------------- 1 | #ifndef _HEAD_H 2 | #define _HEAD_H 3 | 4 | typedef struct desc_struct 5 | { // 定义了段描述符的数据结构。该结构仅说明每个描述 6 | unsigned long a, b; // 符是由8 个字节构成,每个描述符表共有256 项。 7 | } 8 | desc_table[256]; 9 | 10 | extern unsigned long pg_dir[1024]; // 内存页目录数组。每个目录项为4 字节。从物理地址0 开始。 11 | extern desc_table idt, gdt; // 中断描述符表,全局描述符表。 12 | 13 | #define GDT_NUL 0 // 全局描述符表的第0 项,不用。 14 | #define GDT_CODE 1 // 第1 项,是内核代码段描述符项。 15 | #define GDT_DATA 2 // 第2 项,是内核数据段描述符项。 16 | #define GDT_TMP 3 // 第3 项,系统段描述符,Linux 没有使用。 17 | 18 | #define LDT_NUL 0 // 每个局部描述符表的第0 项,不用。 19 | #define LDT_CODE 1 // 第1 项,是用户程序代码段描述符项。 20 | #define LDT_DATA 2 // 第2 项,是用户程序数据段描述符项。 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /mission5817/kernel/blk_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | 13 | TARGET = blk_drv.a 14 | 15 | ${TARGET}: ${OBJS} 16 | @echo - 17 | @echo -------- Build library file $@ -------- 18 | $(AR) rcs $(TARGET) $(OBJS) 19 | 20 | %.o: %.c $(INCLUDES) $(INC) 21 | @echo - 22 | @echo -------- Compile $< -------- 23 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 24 | 25 | clean: 26 | del /Q *.o *.a 27 | 28 | -------------------------------------------------------------------------------- /mission5820/kernel/blk_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | 13 | TARGET = blk_drv.a 14 | 15 | ${TARGET}: ${OBJS} 16 | @echo - 17 | @echo -------- Build library file $@ -------- 18 | $(AR) rcs $(TARGET) $(OBJS) 19 | 20 | %.o: %.c $(INCLUDES) $(INC) 21 | @echo - 22 | @echo -------- Compile $< -------- 23 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 24 | 25 | clean: 26 | del /Q *.o *.a 27 | 28 | -------------------------------------------------------------------------------- /mission5826/kernel/blk_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | 13 | TARGET = blk_drv.a 14 | 15 | ${TARGET}: ${OBJS} 16 | @echo - 17 | @echo -------- Build library file $@ -------- 18 | $(AR) rcs $(TARGET) $(OBJS) 19 | 20 | %.o: %.c $(INCLUDES) $(INC) 21 | @echo - 22 | @echo -------- Compile $< -------- 23 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 24 | 25 | clean: 26 | del /Q *.o *.a 27 | 28 | -------------------------------------------------------------------------------- /mission5827/kernel/blk_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | 13 | TARGET = blk_drv.a 14 | 15 | ${TARGET}: ${OBJS} 16 | @echo - 17 | @echo -------- Build library file $@ -------- 18 | $(AR) rcs $(TARGET) $(OBJS) 19 | 20 | %.o: %.c $(INCLUDES) $(INC) 21 | @echo - 22 | @echo -------- Compile $< -------- 23 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 24 | 25 | clean: 26 | del /Q *.o *.a 27 | 28 | -------------------------------------------------------------------------------- /mission5834/kernel/blk_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | 13 | TARGET = blk_drv.a 14 | 15 | ${TARGET}: ${OBJS} 16 | @echo - 17 | @echo -------- Build library file $@ -------- 18 | $(AR) rcs $(TARGET) $(OBJS) 19 | 20 | %.o: %.c $(INCLUDES) $(INC) 21 | @echo - 22 | @echo -------- Compile $< -------- 23 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 24 | 25 | clean: 26 | del /Q *.o *.a 27 | 28 | -------------------------------------------------------------------------------- /mission5835/kernel/blk_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | 13 | TARGET = blk_drv.a 14 | 15 | ${TARGET}: ${OBJS} 16 | @echo - 17 | @echo -------- Build library file $@ -------- 18 | $(AR) rcs $(TARGET) $(OBJS) 19 | 20 | %.o: %.c $(INCLUDES) $(INC) 21 | @echo - 22 | @echo -------- Compile $< -------- 23 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 24 | 25 | clean: 26 | del /Q *.o *.a 27 | 28 | -------------------------------------------------------------------------------- /mission5846/kernel/blk_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | 13 | TARGET = blk_drv.a 14 | 15 | ${TARGET}: ${OBJS} 16 | @echo - 17 | @echo -------- Build library file $@ -------- 18 | $(AR) rcs $(TARGET) $(OBJS) 19 | 20 | %.o: %.c $(INCLUDES) $(INC) 21 | @echo - 22 | @echo -------- Compile $< -------- 23 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 24 | 25 | clean: 26 | del /Q *.o *.a 27 | 28 | -------------------------------------------------------------------------------- /mission5817/lib/wait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/wait.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 等待调用头文件。定义系统调用wait()和waitpid()及相关常数符号。 11 | 12 | //// 等待进程终止系统调用函数。 13 | // 该下面宏结构对应于函数:pid_t waitpid(pid_t pid, int * wait_stat, int options) 14 | // 15 | // 参数:pid - 等待被终止进程的进程id,或者是用于指定特殊情况的其它特定数值; 16 | // wait_stat - 用于存放状态信息;options - WNOHANG 或WUNTRACED 或是0。 17 | _syscall3 (pid_t, waitpid, pid_t, pid, int *, wait_stat, int, options) 18 | 19 | //// wait()系统调用。直接调用waitpid()函数。 20 | pid_t wait (int *wait_stat) 21 | { 22 | return waitpid (-1, wait_stat, 0); 23 | } 24 | -------------------------------------------------------------------------------- /mission5820/lib/wait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/wait.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 等待调用头文件。定义系统调用wait()和waitpid()及相关常数符号。 11 | 12 | //// 等待进程终止系统调用函数。 13 | // 该下面宏结构对应于函数:pid_t waitpid(pid_t pid, int * wait_stat, int options) 14 | // 15 | // 参数:pid - 等待被终止进程的进程id,或者是用于指定特殊情况的其它特定数值; 16 | // wait_stat - 用于存放状态信息;options - WNOHANG 或WUNTRACED 或是0。 17 | _syscall3 (pid_t, waitpid, pid_t, pid, int *, wait_stat, int, options) 18 | 19 | //// wait()系统调用。直接调用waitpid()函数。 20 | pid_t wait (int *wait_stat) 21 | { 22 | return waitpid (-1, wait_stat, 0); 23 | } 24 | -------------------------------------------------------------------------------- /mission5826/lib/wait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/wait.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 等待调用头文件。定义系统调用wait()和waitpid()及相关常数符号。 11 | 12 | //// 等待进程终止系统调用函数。 13 | // 该下面宏结构对应于函数:pid_t waitpid(pid_t pid, int * wait_stat, int options) 14 | // 15 | // 参数:pid - 等待被终止进程的进程id,或者是用于指定特殊情况的其它特定数值; 16 | // wait_stat - 用于存放状态信息;options - WNOHANG 或WUNTRACED 或是0。 17 | _syscall3 (pid_t, waitpid, pid_t, pid, int *, wait_stat, int, options) 18 | 19 | //// wait()系统调用。直接调用waitpid()函数。 20 | pid_t wait (int *wait_stat) 21 | { 22 | return waitpid (-1, wait_stat, 0); 23 | } 24 | -------------------------------------------------------------------------------- /mission5827/lib/wait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/wait.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 等待调用头文件。定义系统调用wait()和waitpid()及相关常数符号。 11 | 12 | //// 等待进程终止系统调用函数。 13 | // 该下面宏结构对应于函数:pid_t waitpid(pid_t pid, int * wait_stat, int options) 14 | // 15 | // 参数:pid - 等待被终止进程的进程id,或者是用于指定特殊情况的其它特定数值; 16 | // wait_stat - 用于存放状态信息;options - WNOHANG 或WUNTRACED 或是0。 17 | _syscall3 (pid_t, waitpid, pid_t, pid, int *, wait_stat, int, options) 18 | 19 | //// wait()系统调用。直接调用waitpid()函数。 20 | pid_t wait (int *wait_stat) 21 | { 22 | return waitpid (-1, wait_stat, 0); 23 | } 24 | -------------------------------------------------------------------------------- /mission5834/lib/wait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/wait.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 等待调用头文件。定义系统调用wait()和waitpid()及相关常数符号。 11 | 12 | //// 等待进程终止系统调用函数。 13 | // 该下面宏结构对应于函数:pid_t waitpid(pid_t pid, int * wait_stat, int options) 14 | // 15 | // 参数:pid - 等待被终止进程的进程id,或者是用于指定特殊情况的其它特定数值; 16 | // wait_stat - 用于存放状态信息;options - WNOHANG 或WUNTRACED 或是0。 17 | _syscall3 (pid_t, waitpid, pid_t, pid, int *, wait_stat, int, options) 18 | 19 | //// wait()系统调用。直接调用waitpid()函数。 20 | pid_t wait (int *wait_stat) 21 | { 22 | return waitpid (-1, wait_stat, 0); 23 | } 24 | -------------------------------------------------------------------------------- /mission5835/lib/wait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/wait.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 等待调用头文件。定义系统调用wait()和waitpid()及相关常数符号。 11 | 12 | //// 等待进程终止系统调用函数。 13 | // 该下面宏结构对应于函数:pid_t waitpid(pid_t pid, int * wait_stat, int options) 14 | // 15 | // 参数:pid - 等待被终止进程的进程id,或者是用于指定特殊情况的其它特定数值; 16 | // wait_stat - 用于存放状态信息;options - WNOHANG 或WUNTRACED 或是0。 17 | _syscall3 (pid_t, waitpid, pid_t, pid, int *, wait_stat, int, options) 18 | 19 | //// wait()系统调用。直接调用waitpid()函数。 20 | pid_t wait (int *wait_stat) 21 | { 22 | return waitpid (-1, wait_stat, 0); 23 | } 24 | -------------------------------------------------------------------------------- /mission5846/lib/wait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/wait.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 等待调用头文件。定义系统调用wait()和waitpid()及相关常数符号。 11 | 12 | //// 等待进程终止系统调用函数。 13 | // 该下面宏结构对应于函数:pid_t waitpid(pid_t pid, int * wait_stat, int options) 14 | // 15 | // 参数:pid - 等待被终止进程的进程id,或者是用于指定特殊情况的其它特定数值; 16 | // wait_stat - 用于存放状态信息;options - WNOHANG 或WUNTRACED 或是0。 17 | _syscall3 (pid_t, waitpid, pid_t, pid, int *, wait_stat, int, options) 18 | 19 | //// wait()系统调用。直接调用waitpid()函数。 20 | pid_t wait (int *wait_stat) 21 | { 22 | return waitpid (-1, wait_stat, 0); 23 | } 24 | -------------------------------------------------------------------------------- /mission5817/include/asm/io.h: -------------------------------------------------------------------------------- 1 | //// 硬件端口字节输出函数。 2 | // 参数:value - 欲输出字节;port - 端口。 3 | #define outb(value,port) \ 4 | __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port)) 5 | 6 | 7 | //// 硬件端口字节输入函数。 8 | // 参数:port - 端口。返回读取的字节。 9 | #define inb(port) ({ \ 10 | unsigned char _v; \ 11 | __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \ 12 | _v; \ 13 | }) 14 | 15 | //// 带延迟的硬件端口字节输出函数。 16 | // 参数:value - 欲输出字节;port - 端口。 17 | #define outb_p(value,port) \ 18 | __asm__ ("outb %%al,%%dx\n" \ 19 | "\tjmp 1f\n" \ 20 | "1:\tjmp 1f\n" \ 21 | "1:"::"a" (value),"d" (port)) 22 | 23 | //// 带延迟的硬件端口字节输入函数。 24 | // 参数:port - 端口。返回读取的字节。 25 | #define inb_p(port) ({ \ 26 | unsigned char _v; \ 27 | __asm__ volatile ("inb %%dx,%%al\n" \ 28 | "\tjmp 1f\n" \ 29 | "1:\tjmp 1f\n" \ 30 | "1:":"=a" (_v):"d" (port)); \ 31 | _v; \ 32 | }) 33 | -------------------------------------------------------------------------------- /mission5820/include/asm/io.h: -------------------------------------------------------------------------------- 1 | //// 硬件端口字节输出函数。 2 | // 参数:value - 欲输出字节;port - 端口。 3 | #define outb(value,port) \ 4 | __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port)) 5 | 6 | 7 | //// 硬件端口字节输入函数。 8 | // 参数:port - 端口。返回读取的字节。 9 | #define inb(port) ({ \ 10 | unsigned char _v; \ 11 | __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \ 12 | _v; \ 13 | }) 14 | 15 | //// 带延迟的硬件端口字节输出函数。 16 | // 参数:value - 欲输出字节;port - 端口。 17 | #define outb_p(value,port) \ 18 | __asm__ ("outb %%al,%%dx\n" \ 19 | "\tjmp 1f\n" \ 20 | "1:\tjmp 1f\n" \ 21 | "1:"::"a" (value),"d" (port)) 22 | 23 | //// 带延迟的硬件端口字节输入函数。 24 | // 参数:port - 端口。返回读取的字节。 25 | #define inb_p(port) ({ \ 26 | unsigned char _v; \ 27 | __asm__ volatile ("inb %%dx,%%al\n" \ 28 | "\tjmp 1f\n" \ 29 | "1:\tjmp 1f\n" \ 30 | "1:":"=a" (_v):"d" (port)); \ 31 | _v; \ 32 | }) 33 | -------------------------------------------------------------------------------- /mission5826/include/asm/io.h: -------------------------------------------------------------------------------- 1 | //// 硬件端口字节输出函数。 2 | // 参数:value - 欲输出字节;port - 端口。 3 | #define outb(value,port) \ 4 | __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port)) 5 | 6 | 7 | //// 硬件端口字节输入函数。 8 | // 参数:port - 端口。返回读取的字节。 9 | #define inb(port) ({ \ 10 | unsigned char _v; \ 11 | __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \ 12 | _v; \ 13 | }) 14 | 15 | //// 带延迟的硬件端口字节输出函数。 16 | // 参数:value - 欲输出字节;port - 端口。 17 | #define outb_p(value,port) \ 18 | __asm__ ("outb %%al,%%dx\n" \ 19 | "\tjmp 1f\n" \ 20 | "1:\tjmp 1f\n" \ 21 | "1:"::"a" (value),"d" (port)) 22 | 23 | //// 带延迟的硬件端口字节输入函数。 24 | // 参数:port - 端口。返回读取的字节。 25 | #define inb_p(port) ({ \ 26 | unsigned char _v; \ 27 | __asm__ volatile ("inb %%dx,%%al\n" \ 28 | "\tjmp 1f\n" \ 29 | "1:\tjmp 1f\n" \ 30 | "1:":"=a" (_v):"d" (port)); \ 31 | _v; \ 32 | }) 33 | -------------------------------------------------------------------------------- /mission5827/include/asm/io.h: -------------------------------------------------------------------------------- 1 | //// 硬件端口字节输出函数。 2 | // 参数:value - 欲输出字节;port - 端口。 3 | #define outb(value,port) \ 4 | __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port)) 5 | 6 | 7 | //// 硬件端口字节输入函数。 8 | // 参数:port - 端口。返回读取的字节。 9 | #define inb(port) ({ \ 10 | unsigned char _v; \ 11 | __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \ 12 | _v; \ 13 | }) 14 | 15 | //// 带延迟的硬件端口字节输出函数。 16 | // 参数:value - 欲输出字节;port - 端口。 17 | #define outb_p(value,port) \ 18 | __asm__ ("outb %%al,%%dx\n" \ 19 | "\tjmp 1f\n" \ 20 | "1:\tjmp 1f\n" \ 21 | "1:"::"a" (value),"d" (port)) 22 | 23 | //// 带延迟的硬件端口字节输入函数。 24 | // 参数:port - 端口。返回读取的字节。 25 | #define inb_p(port) ({ \ 26 | unsigned char _v; \ 27 | __asm__ volatile ("inb %%dx,%%al\n" \ 28 | "\tjmp 1f\n" \ 29 | "1:\tjmp 1f\n" \ 30 | "1:":"=a" (_v):"d" (port)); \ 31 | _v; \ 32 | }) 33 | -------------------------------------------------------------------------------- /mission5834/include/asm/io.h: -------------------------------------------------------------------------------- 1 | //// 硬件端口字节输出函数。 2 | // 参数:value - 欲输出字节;port - 端口。 3 | #define outb(value,port) \ 4 | __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port)) 5 | 6 | 7 | //// 硬件端口字节输入函数。 8 | // 参数:port - 端口。返回读取的字节。 9 | #define inb(port) ({ \ 10 | unsigned char _v; \ 11 | __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \ 12 | _v; \ 13 | }) 14 | 15 | //// 带延迟的硬件端口字节输出函数。 16 | // 参数:value - 欲输出字节;port - 端口。 17 | #define outb_p(value,port) \ 18 | __asm__ ("outb %%al,%%dx\n" \ 19 | "\tjmp 1f\n" \ 20 | "1:\tjmp 1f\n" \ 21 | "1:"::"a" (value),"d" (port)) 22 | 23 | //// 带延迟的硬件端口字节输入函数。 24 | // 参数:port - 端口。返回读取的字节。 25 | #define inb_p(port) ({ \ 26 | unsigned char _v; \ 27 | __asm__ volatile ("inb %%dx,%%al\n" \ 28 | "\tjmp 1f\n" \ 29 | "1:\tjmp 1f\n" \ 30 | "1:":"=a" (_v):"d" (port)); \ 31 | _v; \ 32 | }) 33 | -------------------------------------------------------------------------------- /mission5835/include/asm/io.h: -------------------------------------------------------------------------------- 1 | //// 硬件端口字节输出函数。 2 | // 参数:value - 欲输出字节;port - 端口。 3 | #define outb(value,port) \ 4 | __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port)) 5 | 6 | 7 | //// 硬件端口字节输入函数。 8 | // 参数:port - 端口。返回读取的字节。 9 | #define inb(port) ({ \ 10 | unsigned char _v; \ 11 | __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \ 12 | _v; \ 13 | }) 14 | 15 | //// 带延迟的硬件端口字节输出函数。 16 | // 参数:value - 欲输出字节;port - 端口。 17 | #define outb_p(value,port) \ 18 | __asm__ ("outb %%al,%%dx\n" \ 19 | "\tjmp 1f\n" \ 20 | "1:\tjmp 1f\n" \ 21 | "1:"::"a" (value),"d" (port)) 22 | 23 | //// 带延迟的硬件端口字节输入函数。 24 | // 参数:port - 端口。返回读取的字节。 25 | #define inb_p(port) ({ \ 26 | unsigned char _v; \ 27 | __asm__ volatile ("inb %%dx,%%al\n" \ 28 | "\tjmp 1f\n" \ 29 | "1:\tjmp 1f\n" \ 30 | "1:":"=a" (_v):"d" (port)); \ 31 | _v; \ 32 | }) 33 | -------------------------------------------------------------------------------- /mission5846/include/asm/io.h: -------------------------------------------------------------------------------- 1 | //// 硬件端口字节输出函数。 2 | // 参数:value - 欲输出字节;port - 端口。 3 | #define outb(value,port) \ 4 | __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port)) 5 | 6 | 7 | //// 硬件端口字节输入函数。 8 | // 参数:port - 端口。返回读取的字节。 9 | #define inb(port) ({ \ 10 | unsigned char _v; \ 11 | __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \ 12 | _v; \ 13 | }) 14 | 15 | //// 带延迟的硬件端口字节输出函数。 16 | // 参数:value - 欲输出字节;port - 端口。 17 | #define outb_p(value,port) \ 18 | __asm__ ("outb %%al,%%dx\n" \ 19 | "\tjmp 1f\n" \ 20 | "1:\tjmp 1f\n" \ 21 | "1:"::"a" (value),"d" (port)) 22 | 23 | //// 带延迟的硬件端口字节输入函数。 24 | // 参数:port - 端口。返回读取的字节。 25 | #define inb_p(port) ({ \ 26 | unsigned char _v; \ 27 | __asm__ volatile ("inb %%dx,%%al\n" \ 28 | "\tjmp 1f\n" \ 29 | "1:\tjmp 1f\n" \ 30 | "1:":"=a" (_v):"d" (port)); \ 31 | _v; \ 32 | }) 33 | -------------------------------------------------------------------------------- /mission5817/mm/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = mm.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | 34 | -------------------------------------------------------------------------------- /mission5820/mm/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = mm.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | 34 | -------------------------------------------------------------------------------- /mission5826/mm/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = mm.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | 34 | -------------------------------------------------------------------------------- /mission5827/mm/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = mm.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | 34 | -------------------------------------------------------------------------------- /mission5834/mm/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = mm.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | 34 | -------------------------------------------------------------------------------- /mission5835/mm/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = mm.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | 34 | -------------------------------------------------------------------------------- /mission5846/mm/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = mm.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | 34 | -------------------------------------------------------------------------------- /mission5817/kernel/panic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/kernel/panic.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * This function is used through-out the kernel (includeinh mm and fs) 9 | * to indicate a major problem. 10 | */ 11 | /* 12 | * 该函数在整个内核中使用(包括在 头文件*.h, 内存管理程序mm 和文件系统fs 中), 13 | * 用以指出主要的出错问题。 14 | */ 15 | #define PANIC 16 | #include // 内核头文件。含有一些内核常用函数的原形定义。 17 | #include // 调度程序头文件,定义了任务结构task_struct、初始任务0 的数据, 18 | // 还有一些有关描述符参数设置和获取的嵌入式汇编函数宏语句。 19 | 20 | void sys_sync (void); /* it's really int *//* 实际上是整型int (fs/buffer.c) */ 21 | 22 | // 该函数用来显示内核中出现的重大错误信息,并运行文件系统同步函数,然后进入死循环 -- 死机。 23 | // 如果当前进程是任务0 的话,还说明是交换任务出错,并且还没有运行文件系统同步函数。 24 | volatile void 25 | panic (const char *s) 26 | { 27 | printk ("Kernel panic: %s\n\r", s); 28 | if (current == task[0]) 29 | printk ("In swapper task - not syncing\n\r"); 30 | else 31 | sys_sync (); 32 | for (;;); 33 | } 34 | -------------------------------------------------------------------------------- /mission5820/kernel/panic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/kernel/panic.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * This function is used through-out the kernel (includeinh mm and fs) 9 | * to indicate a major problem. 10 | */ 11 | /* 12 | * 该函数在整个内核中使用(包括在 头文件*.h, 内存管理程序mm 和文件系统fs 中), 13 | * 用以指出主要的出错问题。 14 | */ 15 | #define PANIC 16 | #include // 内核头文件。含有一些内核常用函数的原形定义。 17 | #include // 调度程序头文件,定义了任务结构task_struct、初始任务0 的数据, 18 | // 还有一些有关描述符参数设置和获取的嵌入式汇编函数宏语句。 19 | 20 | void sys_sync (void); /* it's really int *//* 实际上是整型int (fs/buffer.c) */ 21 | 22 | // 该函数用来显示内核中出现的重大错误信息,并运行文件系统同步函数,然后进入死循环 -- 死机。 23 | // 如果当前进程是任务0 的话,还说明是交换任务出错,并且还没有运行文件系统同步函数。 24 | volatile void 25 | panic (const char *s) 26 | { 27 | printk ("Kernel panic: %s\n\r", s); 28 | if (current == task[0]) 29 | printk ("In swapper task - not syncing\n\r"); 30 | else 31 | sys_sync (); 32 | for (;;); 33 | } 34 | -------------------------------------------------------------------------------- /mission5826/kernel/panic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/kernel/panic.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * This function is used through-out the kernel (includeinh mm and fs) 9 | * to indicate a major problem. 10 | */ 11 | /* 12 | * 该函数在整个内核中使用(包括在 头文件*.h, 内存管理程序mm 和文件系统fs 中), 13 | * 用以指出主要的出错问题。 14 | */ 15 | #define PANIC 16 | #include // 内核头文件。含有一些内核常用函数的原形定义。 17 | #include // 调度程序头文件,定义了任务结构task_struct、初始任务0 的数据, 18 | // 还有一些有关描述符参数设置和获取的嵌入式汇编函数宏语句。 19 | 20 | void sys_sync (void); /* it's really int *//* 实际上是整型int (fs/buffer.c) */ 21 | 22 | // 该函数用来显示内核中出现的重大错误信息,并运行文件系统同步函数,然后进入死循环 -- 死机。 23 | // 如果当前进程是任务0 的话,还说明是交换任务出错,并且还没有运行文件系统同步函数。 24 | volatile void 25 | panic (const char *s) 26 | { 27 | printk ("Kernel panic: %s\n\r", s); 28 | if (current == task[0]) 29 | printk ("In swapper task - not syncing\n\r"); 30 | else 31 | sys_sync (); 32 | for (;;); 33 | } 34 | -------------------------------------------------------------------------------- /mission5827/kernel/panic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/kernel/panic.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * This function is used through-out the kernel (includeinh mm and fs) 9 | * to indicate a major problem. 10 | */ 11 | /* 12 | * 该函数在整个内核中使用(包括在 头文件*.h, 内存管理程序mm 和文件系统fs 中), 13 | * 用以指出主要的出错问题。 14 | */ 15 | #define PANIC 16 | #include // 内核头文件。含有一些内核常用函数的原形定义。 17 | #include // 调度程序头文件,定义了任务结构task_struct、初始任务0 的数据, 18 | // 还有一些有关描述符参数设置和获取的嵌入式汇编函数宏语句。 19 | 20 | void sys_sync (void); /* it's really int *//* 实际上是整型int (fs/buffer.c) */ 21 | 22 | // 该函数用来显示内核中出现的重大错误信息,并运行文件系统同步函数,然后进入死循环 -- 死机。 23 | // 如果当前进程是任务0 的话,还说明是交换任务出错,并且还没有运行文件系统同步函数。 24 | volatile void 25 | panic (const char *s) 26 | { 27 | printk ("Kernel panic: %s\n\r", s); 28 | if (current == task[0]) 29 | printk ("In swapper task - not syncing\n\r"); 30 | else 31 | sys_sync (); 32 | for (;;); 33 | } 34 | -------------------------------------------------------------------------------- /mission5834/kernel/panic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/kernel/panic.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * This function is used through-out the kernel (includeinh mm and fs) 9 | * to indicate a major problem. 10 | */ 11 | /* 12 | * 该函数在整个内核中使用(包括在 头文件*.h, 内存管理程序mm 和文件系统fs 中), 13 | * 用以指出主要的出错问题。 14 | */ 15 | #define PANIC 16 | #include // 内核头文件。含有一些内核常用函数的原形定义。 17 | #include // 调度程序头文件,定义了任务结构task_struct、初始任务0 的数据, 18 | // 还有一些有关描述符参数设置和获取的嵌入式汇编函数宏语句。 19 | 20 | void sys_sync (void); /* it's really int *//* 实际上是整型int (fs/buffer.c) */ 21 | 22 | // 该函数用来显示内核中出现的重大错误信息,并运行文件系统同步函数,然后进入死循环 -- 死机。 23 | // 如果当前进程是任务0 的话,还说明是交换任务出错,并且还没有运行文件系统同步函数。 24 | volatile void 25 | panic (const char *s) 26 | { 27 | printk ("Kernel panic: %s\n\r", s); 28 | if (current == task[0]) 29 | printk ("In swapper task - not syncing\n\r"); 30 | else 31 | sys_sync (); 32 | for (;;); 33 | } 34 | -------------------------------------------------------------------------------- /mission5835/kernel/panic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/kernel/panic.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * This function is used through-out the kernel (includeinh mm and fs) 9 | * to indicate a major problem. 10 | */ 11 | /* 12 | * 该函数在整个内核中使用(包括在 头文件*.h, 内存管理程序mm 和文件系统fs 中), 13 | * 用以指出主要的出错问题。 14 | */ 15 | #define PANIC 16 | #include // 内核头文件。含有一些内核常用函数的原形定义。 17 | #include // 调度程序头文件,定义了任务结构task_struct、初始任务0 的数据, 18 | // 还有一些有关描述符参数设置和获取的嵌入式汇编函数宏语句。 19 | 20 | void sys_sync (void); /* it's really int *//* 实际上是整型int (fs/buffer.c) */ 21 | 22 | // 该函数用来显示内核中出现的重大错误信息,并运行文件系统同步函数,然后进入死循环 -- 死机。 23 | // 如果当前进程是任务0 的话,还说明是交换任务出错,并且还没有运行文件系统同步函数。 24 | volatile void 25 | panic (const char *s) 26 | { 27 | printk ("Kernel panic: %s\n\r", s); 28 | if (current == task[0]) 29 | printk ("In swapper task - not syncing\n\r"); 30 | else 31 | sys_sync (); 32 | for (;;); 33 | } 34 | -------------------------------------------------------------------------------- /mission5846/kernel/panic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/kernel/panic.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * This function is used through-out the kernel (includeinh mm and fs) 9 | * to indicate a major problem. 10 | */ 11 | /* 12 | * 该函数在整个内核中使用(包括在 头文件*.h, 内存管理程序mm 和文件系统fs 中), 13 | * 用以指出主要的出错问题。 14 | */ 15 | #define PANIC 16 | #include // 内核头文件。含有一些内核常用函数的原形定义。 17 | #include // 调度程序头文件,定义了任务结构task_struct、初始任务0 的数据, 18 | // 还有一些有关描述符参数设置和获取的嵌入式汇编函数宏语句。 19 | 20 | void sys_sync (void); /* it's really int *//* 实际上是整型int (fs/buffer.c) */ 21 | 22 | // 该函数用来显示内核中出现的重大错误信息,并运行文件系统同步函数,然后进入死循环 -- 死机。 23 | // 如果当前进程是任务0 的话,还说明是交换任务出错,并且还没有运行文件系统同步函数。 24 | volatile void 25 | panic (const char *s) 26 | { 27 | printk ("Kernel panic: %s\n\r", s); 28 | if (current == task[0]) 29 | printk ("In swapper task - not syncing\n\r"); 30 | else 31 | sys_sync (); 32 | for (;;); 33 | } 34 | -------------------------------------------------------------------------------- /mission5817/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This 3 | * goes for all kernel functions (ds=es=kernel space, fs=local data, 4 | * gs=null), as well as for all well-behaving user programs (ds=es= 5 | * user data space). This is NOT a bug, as any user program that changes 6 | * es deserves to die if it isn't careful. 7 | */ 8 | /* 9 | * 注意!!!memcpy(dest,src,n)假设段寄存器ds=es=通常数据段。在内核中使用的 10 | * 所有函数都基于该假设(ds=es=内核空间,fs=局部数据空间,gs=null),具有良好 11 | * 行为的应用程序也是这样(ds=es=用户数据空间)。如果任何用户程序随意改动了 12 | * es 寄存器而出错,则并不是由于系统程序错误造成的。 13 | */ 14 | //// 内存块复制。从源地址src 处开始复制n 个字节到目的地址dest 处。 15 | // 参数:dest - 复制的目的地址,src - 复制的源地址,n - 复制字节数。 16 | // %0 - edi(目的地址dest),%1 - esi(源地址src),%2 - ecx(字节数n), 17 | #define memcpy(dest,src,n) ({ \ 18 | void * _res = dest; \ 19 | __asm__ ("cld;rep;movsb" \ 20 | ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \ 21 | ); \ 22 | _res; \ 23 | }) 24 | -------------------------------------------------------------------------------- /mission5820/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This 3 | * goes for all kernel functions (ds=es=kernel space, fs=local data, 4 | * gs=null), as well as for all well-behaving user programs (ds=es= 5 | * user data space). This is NOT a bug, as any user program that changes 6 | * es deserves to die if it isn't careful. 7 | */ 8 | /* 9 | * 注意!!!memcpy(dest,src,n)假设段寄存器ds=es=通常数据段。在内核中使用的 10 | * 所有函数都基于该假设(ds=es=内核空间,fs=局部数据空间,gs=null),具有良好 11 | * 行为的应用程序也是这样(ds=es=用户数据空间)。如果任何用户程序随意改动了 12 | * es 寄存器而出错,则并不是由于系统程序错误造成的。 13 | */ 14 | //// 内存块复制。从源地址src 处开始复制n 个字节到目的地址dest 处。 15 | // 参数:dest - 复制的目的地址,src - 复制的源地址,n - 复制字节数。 16 | // %0 - edi(目的地址dest),%1 - esi(源地址src),%2 - ecx(字节数n), 17 | #define memcpy(dest,src,n) ({ \ 18 | void * _res = dest; \ 19 | __asm__ ("cld;rep;movsb" \ 20 | ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \ 21 | ); \ 22 | _res; \ 23 | }) 24 | -------------------------------------------------------------------------------- /mission5826/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This 3 | * goes for all kernel functions (ds=es=kernel space, fs=local data, 4 | * gs=null), as well as for all well-behaving user programs (ds=es= 5 | * user data space). This is NOT a bug, as any user program that changes 6 | * es deserves to die if it isn't careful. 7 | */ 8 | /* 9 | * 注意!!!memcpy(dest,src,n)假设段寄存器ds=es=通常数据段。在内核中使用的 10 | * 所有函数都基于该假设(ds=es=内核空间,fs=局部数据空间,gs=null),具有良好 11 | * 行为的应用程序也是这样(ds=es=用户数据空间)。如果任何用户程序随意改动了 12 | * es 寄存器而出错,则并不是由于系统程序错误造成的。 13 | */ 14 | //// 内存块复制。从源地址src 处开始复制n 个字节到目的地址dest 处。 15 | // 参数:dest - 复制的目的地址,src - 复制的源地址,n - 复制字节数。 16 | // %0 - edi(目的地址dest),%1 - esi(源地址src),%2 - ecx(字节数n), 17 | #define memcpy(dest,src,n) ({ \ 18 | void * _res = dest; \ 19 | __asm__ ("cld;rep;movsb" \ 20 | ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \ 21 | ); \ 22 | _res; \ 23 | }) 24 | -------------------------------------------------------------------------------- /mission5827/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This 3 | * goes for all kernel functions (ds=es=kernel space, fs=local data, 4 | * gs=null), as well as for all well-behaving user programs (ds=es= 5 | * user data space). This is NOT a bug, as any user program that changes 6 | * es deserves to die if it isn't careful. 7 | */ 8 | /* 9 | * 注意!!!memcpy(dest,src,n)假设段寄存器ds=es=通常数据段。在内核中使用的 10 | * 所有函数都基于该假设(ds=es=内核空间,fs=局部数据空间,gs=null),具有良好 11 | * 行为的应用程序也是这样(ds=es=用户数据空间)。如果任何用户程序随意改动了 12 | * es 寄存器而出错,则并不是由于系统程序错误造成的。 13 | */ 14 | //// 内存块复制。从源地址src 处开始复制n 个字节到目的地址dest 处。 15 | // 参数:dest - 复制的目的地址,src - 复制的源地址,n - 复制字节数。 16 | // %0 - edi(目的地址dest),%1 - esi(源地址src),%2 - ecx(字节数n), 17 | #define memcpy(dest,src,n) ({ \ 18 | void * _res = dest; \ 19 | __asm__ ("cld;rep;movsb" \ 20 | ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \ 21 | ); \ 22 | _res; \ 23 | }) 24 | -------------------------------------------------------------------------------- /mission5834/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This 3 | * goes for all kernel functions (ds=es=kernel space, fs=local data, 4 | * gs=null), as well as for all well-behaving user programs (ds=es= 5 | * user data space). This is NOT a bug, as any user program that changes 6 | * es deserves to die if it isn't careful. 7 | */ 8 | /* 9 | * 注意!!!memcpy(dest,src,n)假设段寄存器ds=es=通常数据段。在内核中使用的 10 | * 所有函数都基于该假设(ds=es=内核空间,fs=局部数据空间,gs=null),具有良好 11 | * 行为的应用程序也是这样(ds=es=用户数据空间)。如果任何用户程序随意改动了 12 | * es 寄存器而出错,则并不是由于系统程序错误造成的。 13 | */ 14 | //// 内存块复制。从源地址src 处开始复制n 个字节到目的地址dest 处。 15 | // 参数:dest - 复制的目的地址,src - 复制的源地址,n - 复制字节数。 16 | // %0 - edi(目的地址dest),%1 - esi(源地址src),%2 - ecx(字节数n), 17 | #define memcpy(dest,src,n) ({ \ 18 | void * _res = dest; \ 19 | __asm__ ("cld;rep;movsb" \ 20 | ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \ 21 | ); \ 22 | _res; \ 23 | }) 24 | -------------------------------------------------------------------------------- /mission5835/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This 3 | * goes for all kernel functions (ds=es=kernel space, fs=local data, 4 | * gs=null), as well as for all well-behaving user programs (ds=es= 5 | * user data space). This is NOT a bug, as any user program that changes 6 | * es deserves to die if it isn't careful. 7 | */ 8 | /* 9 | * 注意!!!memcpy(dest,src,n)假设段寄存器ds=es=通常数据段。在内核中使用的 10 | * 所有函数都基于该假设(ds=es=内核空间,fs=局部数据空间,gs=null),具有良好 11 | * 行为的应用程序也是这样(ds=es=用户数据空间)。如果任何用户程序随意改动了 12 | * es 寄存器而出错,则并不是由于系统程序错误造成的。 13 | */ 14 | //// 内存块复制。从源地址src 处开始复制n 个字节到目的地址dest 处。 15 | // 参数:dest - 复制的目的地址,src - 复制的源地址,n - 复制字节数。 16 | // %0 - edi(目的地址dest),%1 - esi(源地址src),%2 - ecx(字节数n), 17 | #define memcpy(dest,src,n) ({ \ 18 | void * _res = dest; \ 19 | __asm__ ("cld;rep;movsb" \ 20 | ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \ 21 | ); \ 22 | _res; \ 23 | }) 24 | -------------------------------------------------------------------------------- /mission5846/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This 3 | * goes for all kernel functions (ds=es=kernel space, fs=local data, 4 | * gs=null), as well as for all well-behaving user programs (ds=es= 5 | * user data space). This is NOT a bug, as any user program that changes 6 | * es deserves to die if it isn't careful. 7 | */ 8 | /* 9 | * 注意!!!memcpy(dest,src,n)假设段寄存器ds=es=通常数据段。在内核中使用的 10 | * 所有函数都基于该假设(ds=es=内核空间,fs=局部数据空间,gs=null),具有良好 11 | * 行为的应用程序也是这样(ds=es=用户数据空间)。如果任何用户程序随意改动了 12 | * es 寄存器而出错,则并不是由于系统程序错误造成的。 13 | */ 14 | //// 内存块复制。从源地址src 处开始复制n 个字节到目的地址dest 处。 15 | // 参数:dest - 复制的目的地址,src - 复制的源地址,n - 复制字节数。 16 | // %0 - edi(目的地址dest),%1 - esi(源地址src),%2 - ecx(字节数n), 17 | #define memcpy(dest,src,n) ({ \ 18 | void * _res = dest; \ 19 | __asm__ ("cld;rep;movsb" \ 20 | ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \ 21 | ); \ 22 | _res; \ 23 | }) 24 | -------------------------------------------------------------------------------- /mission5817/mm/page.s: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mm/page.s 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * page.s contains the low-level page-exception code. 9 | * the real work is done in mm.c 10 | */ 11 | /* 12 | * page.s 程序包含底层页异常处理代码。实际的工作在memory.c 中完成。 13 | */ 14 | 15 | .globl _page_fault 16 | 17 | _page_fault: 18 | xchgl %eax,(%esp) # 取出错码到eax。 19 | pushl %ecx 20 | pushl %edx 21 | push %ds 22 | push %es 23 | push %fs 24 | movl $0x10,%edx # 置内核数据段选择符。 25 | mov %dx,%ds 26 | mov %dx,%es 27 | mov %dx,%fs 28 | movl %cr2,%edx # 取引起页面异常的线性地址 29 | pushl %edx # 将该线性地址和出错码压入堆栈,作为调用函数的参数。 30 | pushl %eax 31 | testl $1,%eax # 测试标志P,如果不是缺页引起的异常则跳转。 32 | jne 1f 33 | call _do_no_page # 调用缺页处理函数(mm/memory.c)。 34 | jmp 2f 35 | 1: call _do_wp_page # 调用写保护处理函数(mm/memory.c)。 36 | 2: addl $8,%esp # 丢弃压入栈的两个参数。 37 | pop %fs 38 | pop %es 39 | pop %ds 40 | popl %edx 41 | popl %ecx 42 | popl %eax 43 | iret 44 | -------------------------------------------------------------------------------- /mission5820/mm/page.s: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mm/page.s 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * page.s contains the low-level page-exception code. 9 | * the real work is done in mm.c 10 | */ 11 | /* 12 | * page.s 程序包含底层页异常处理代码。实际的工作在memory.c 中完成。 13 | */ 14 | 15 | .globl _page_fault 16 | 17 | _page_fault: 18 | xchgl %eax,(%esp) # 取出错码到eax。 19 | pushl %ecx 20 | pushl %edx 21 | push %ds 22 | push %es 23 | push %fs 24 | movl $0x10,%edx # 置内核数据段选择符。 25 | mov %dx,%ds 26 | mov %dx,%es 27 | mov %dx,%fs 28 | movl %cr2,%edx # 取引起页面异常的线性地址 29 | pushl %edx # 将该线性地址和出错码压入堆栈,作为调用函数的参数。 30 | pushl %eax 31 | testl $1,%eax # 测试标志P,如果不是缺页引起的异常则跳转。 32 | jne 1f 33 | call _do_no_page # 调用缺页处理函数(mm/memory.c)。 34 | jmp 2f 35 | 1: call _do_wp_page # 调用写保护处理函数(mm/memory.c)。 36 | 2: addl $8,%esp # 丢弃压入栈的两个参数。 37 | pop %fs 38 | pop %es 39 | pop %ds 40 | popl %edx 41 | popl %ecx 42 | popl %eax 43 | iret 44 | -------------------------------------------------------------------------------- /mission5826/mm/page.s: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mm/page.s 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * page.s contains the low-level page-exception code. 9 | * the real work is done in mm.c 10 | */ 11 | /* 12 | * page.s 程序包含底层页异常处理代码。实际的工作在memory.c 中完成。 13 | */ 14 | 15 | .globl _page_fault 16 | 17 | _page_fault: 18 | xchgl %eax,(%esp) # 取出错码到eax。 19 | pushl %ecx 20 | pushl %edx 21 | push %ds 22 | push %es 23 | push %fs 24 | movl $0x10,%edx # 置内核数据段选择符。 25 | mov %dx,%ds 26 | mov %dx,%es 27 | mov %dx,%fs 28 | movl %cr2,%edx # 取引起页面异常的线性地址 29 | pushl %edx # 将该线性地址和出错码压入堆栈,作为调用函数的参数。 30 | pushl %eax 31 | testl $1,%eax # 测试标志P,如果不是缺页引起的异常则跳转。 32 | jne 1f 33 | call _do_no_page # 调用缺页处理函数(mm/memory.c)。 34 | jmp 2f 35 | 1: call _do_wp_page # 调用写保护处理函数(mm/memory.c)。 36 | 2: addl $8,%esp # 丢弃压入栈的两个参数。 37 | pop %fs 38 | pop %es 39 | pop %ds 40 | popl %edx 41 | popl %ecx 42 | popl %eax 43 | iret 44 | -------------------------------------------------------------------------------- /mission5827/mm/page.s: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mm/page.s 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * page.s contains the low-level page-exception code. 9 | * the real work is done in mm.c 10 | */ 11 | /* 12 | * page.s 程序包含底层页异常处理代码。实际的工作在memory.c 中完成。 13 | */ 14 | 15 | .globl _page_fault 16 | 17 | _page_fault: 18 | xchgl %eax,(%esp) # 取出错码到eax。 19 | pushl %ecx 20 | pushl %edx 21 | push %ds 22 | push %es 23 | push %fs 24 | movl $0x10,%edx # 置内核数据段选择符。 25 | mov %dx,%ds 26 | mov %dx,%es 27 | mov %dx,%fs 28 | movl %cr2,%edx # 取引起页面异常的线性地址 29 | pushl %edx # 将该线性地址和出错码压入堆栈,作为调用函数的参数。 30 | pushl %eax 31 | testl $1,%eax # 测试标志P,如果不是缺页引起的异常则跳转。 32 | jne 1f 33 | call _do_no_page # 调用缺页处理函数(mm/memory.c)。 34 | jmp 2f 35 | 1: call _do_wp_page # 调用写保护处理函数(mm/memory.c)。 36 | 2: addl $8,%esp # 丢弃压入栈的两个参数。 37 | pop %fs 38 | pop %es 39 | pop %ds 40 | popl %edx 41 | popl %ecx 42 | popl %eax 43 | iret 44 | -------------------------------------------------------------------------------- /mission5834/mm/page.s: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mm/page.s 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * page.s contains the low-level page-exception code. 9 | * the real work is done in mm.c 10 | */ 11 | /* 12 | * page.s 程序包含底层页异常处理代码。实际的工作在memory.c 中完成。 13 | */ 14 | 15 | .globl _page_fault 16 | 17 | _page_fault: 18 | xchgl %eax,(%esp) # 取出错码到eax。 19 | pushl %ecx 20 | pushl %edx 21 | push %ds 22 | push %es 23 | push %fs 24 | movl $0x10,%edx # 置内核数据段选择符。 25 | mov %dx,%ds 26 | mov %dx,%es 27 | mov %dx,%fs 28 | movl %cr2,%edx # 取引起页面异常的线性地址 29 | pushl %edx # 将该线性地址和出错码压入堆栈,作为调用函数的参数。 30 | pushl %eax 31 | testl $1,%eax # 测试标志P,如果不是缺页引起的异常则跳转。 32 | jne 1f 33 | call _do_no_page # 调用缺页处理函数(mm/memory.c)。 34 | jmp 2f 35 | 1: call _do_wp_page # 调用写保护处理函数(mm/memory.c)。 36 | 2: addl $8,%esp # 丢弃压入栈的两个参数。 37 | pop %fs 38 | pop %es 39 | pop %ds 40 | popl %edx 41 | popl %ecx 42 | popl %eax 43 | iret 44 | -------------------------------------------------------------------------------- /mission5835/mm/page.s: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mm/page.s 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * page.s contains the low-level page-exception code. 9 | * the real work is done in mm.c 10 | */ 11 | /* 12 | * page.s 程序包含底层页异常处理代码。实际的工作在memory.c 中完成。 13 | */ 14 | 15 | .globl _page_fault 16 | 17 | _page_fault: 18 | xchgl %eax,(%esp) # 取出错码到eax。 19 | pushl %ecx 20 | pushl %edx 21 | push %ds 22 | push %es 23 | push %fs 24 | movl $0x10,%edx # 置内核数据段选择符。 25 | mov %dx,%ds 26 | mov %dx,%es 27 | mov %dx,%fs 28 | movl %cr2,%edx # 取引起页面异常的线性地址 29 | pushl %edx # 将该线性地址和出错码压入堆栈,作为调用函数的参数。 30 | pushl %eax 31 | testl $1,%eax # 测试标志P,如果不是缺页引起的异常则跳转。 32 | jne 1f 33 | call _do_no_page # 调用缺页处理函数(mm/memory.c)。 34 | jmp 2f 35 | 1: call _do_wp_page # 调用写保护处理函数(mm/memory.c)。 36 | 2: addl $8,%esp # 丢弃压入栈的两个参数。 37 | pop %fs 38 | pop %es 39 | pop %ds 40 | popl %edx 41 | popl %ecx 42 | popl %eax 43 | iret 44 | -------------------------------------------------------------------------------- /mission5846/mm/page.s: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mm/page.s 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * page.s contains the low-level page-exception code. 9 | * the real work is done in mm.c 10 | */ 11 | /* 12 | * page.s 程序包含底层页异常处理代码。实际的工作在memory.c 中完成。 13 | */ 14 | 15 | .globl _page_fault 16 | 17 | _page_fault: 18 | xchgl %eax,(%esp) # 取出错码到eax。 19 | pushl %ecx 20 | pushl %edx 21 | push %ds 22 | push %es 23 | push %fs 24 | movl $0x10,%edx # 置内核数据段选择符。 25 | mov %dx,%ds 26 | mov %dx,%es 27 | mov %dx,%fs 28 | movl %cr2,%edx # 取引起页面异常的线性地址 29 | pushl %edx # 将该线性地址和出错码压入堆栈,作为调用函数的参数。 30 | pushl %eax 31 | testl $1,%eax # 测试标志P,如果不是缺页引起的异常则跳转。 32 | jne 1f 33 | call _do_no_page # 调用缺页处理函数(mm/memory.c)。 34 | jmp 2f 35 | 1: call _do_wp_page # 调用写保护处理函数(mm/memory.c)。 36 | 2: addl $8,%esp # 丢弃压入栈的两个参数。 37 | pop %fs 38 | pop %es 39 | pop %ds 40 | popl %edx 41 | popl %ecx 42 | popl %eax 43 | iret 44 | -------------------------------------------------------------------------------- /mission5817/kernel/chr_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | SRC_S = $(wildcard *.s) 12 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 13 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 14 | 15 | TARGET = chr_drv.a 16 | 17 | ${TARGET}: ${OBJS} ${OBJS_S} 18 | @echo - 19 | @echo -------- Build library file $@ -------- 20 | $(AR) rcs $(TARGET) $(OBJS) $(OBJS_S) 21 | 22 | %.o: %.c $(INCLUDES) $(INC) 23 | @echo - 24 | @echo -------- Compile $< -------- 25 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 26 | 27 | %.o: %.s $(INCLUDES) $(INC) 28 | @echo - 29 | @echo -------- Compile $< -------- 30 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 31 | 32 | clean: 33 | del /Q *.o *.a 34 | 35 | -------------------------------------------------------------------------------- /mission5820/kernel/chr_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | SRC_S = $(wildcard *.s) 12 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 13 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 14 | 15 | TARGET = chr_drv.a 16 | 17 | ${TARGET}: ${OBJS} ${OBJS_S} 18 | @echo - 19 | @echo -------- Build library file $@ -------- 20 | $(AR) rcs $(TARGET) $(OBJS) $(OBJS_S) 21 | 22 | %.o: %.c $(INCLUDES) $(INC) 23 | @echo - 24 | @echo -------- Compile $< -------- 25 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 26 | 27 | %.o: %.s $(INCLUDES) $(INC) 28 | @echo - 29 | @echo -------- Compile $< -------- 30 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 31 | 32 | clean: 33 | del /Q *.o *.a 34 | 35 | -------------------------------------------------------------------------------- /mission5826/kernel/chr_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | SRC_S = $(wildcard *.s) 12 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 13 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 14 | 15 | TARGET = chr_drv.a 16 | 17 | ${TARGET}: ${OBJS} ${OBJS_S} 18 | @echo - 19 | @echo -------- Build library file $@ -------- 20 | $(AR) rcs $(TARGET) $(OBJS) $(OBJS_S) 21 | 22 | %.o: %.c $(INCLUDES) $(INC) 23 | @echo - 24 | @echo -------- Compile $< -------- 25 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 26 | 27 | %.o: %.s $(INCLUDES) $(INC) 28 | @echo - 29 | @echo -------- Compile $< -------- 30 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 31 | 32 | clean: 33 | del /Q *.o *.a 34 | 35 | -------------------------------------------------------------------------------- /mission5827/kernel/chr_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | SRC_S = $(wildcard *.s) 12 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 13 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 14 | 15 | TARGET = chr_drv.a 16 | 17 | ${TARGET}: ${OBJS} ${OBJS_S} 18 | @echo - 19 | @echo -------- Build library file $@ -------- 20 | $(AR) rcs $(TARGET) $(OBJS) $(OBJS_S) 21 | 22 | %.o: %.c $(INCLUDES) $(INC) 23 | @echo - 24 | @echo -------- Compile $< -------- 25 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 26 | 27 | %.o: %.s $(INCLUDES) $(INC) 28 | @echo - 29 | @echo -------- Compile $< -------- 30 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 31 | 32 | clean: 33 | del /Q *.o *.a 34 | 35 | -------------------------------------------------------------------------------- /mission5834/kernel/chr_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | SRC_S = $(wildcard *.s) 12 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 13 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 14 | 15 | TARGET = chr_drv.a 16 | 17 | ${TARGET}: ${OBJS} ${OBJS_S} 18 | @echo - 19 | @echo -------- Build library file $@ -------- 20 | $(AR) rcs $(TARGET) $(OBJS) $(OBJS_S) 21 | 22 | %.o: %.c $(INCLUDES) $(INC) 23 | @echo - 24 | @echo -------- Compile $< -------- 25 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 26 | 27 | %.o: %.s $(INCLUDES) $(INC) 28 | @echo - 29 | @echo -------- Compile $< -------- 30 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 31 | 32 | clean: 33 | del /Q *.o *.a 34 | 35 | -------------------------------------------------------------------------------- /mission5835/kernel/chr_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | SRC_S = $(wildcard *.s) 12 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 13 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 14 | 15 | TARGET = chr_drv.a 16 | 17 | ${TARGET}: ${OBJS} ${OBJS_S} 18 | @echo - 19 | @echo -------- Build library file $@ -------- 20 | $(AR) rcs $(TARGET) $(OBJS) $(OBJS_S) 21 | 22 | %.o: %.c $(INCLUDES) $(INC) 23 | @echo - 24 | @echo -------- Compile $< -------- 25 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 26 | 27 | %.o: %.s $(INCLUDES) $(INC) 28 | @echo - 29 | @echo -------- Compile $< -------- 30 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 31 | 32 | clean: 33 | del /Q *.o *.a 34 | 35 | -------------------------------------------------------------------------------- /mission5846/kernel/chr_drv/makefile: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = gcc 3 | LD = ld 4 | CFLAGS = -g -pipe -Wall -nostdinc -fno-builtin -I../../include 5 | SFLAGS = -g -pipe 6 | 7 | INCLUDES = $(wildcard ../../include/*.h ../../include/asm/*.h ../../include/linux/*.h ../../include/sys/*.h) 8 | INC = $(wildcard ./*.h) 9 | 10 | SRC = $(wildcard *.c) 11 | SRC_S = $(wildcard *.s) 12 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 13 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 14 | 15 | TARGET = chr_drv.a 16 | 17 | ${TARGET}: ${OBJS} ${OBJS_S} 18 | @echo - 19 | @echo -------- Build library file $@ -------- 20 | $(AR) rcs $(TARGET) $(OBJS) $(OBJS_S) 21 | 22 | %.o: %.c $(INCLUDES) $(INC) 23 | @echo - 24 | @echo -------- Compile $< -------- 25 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 26 | 27 | %.o: %.s $(INCLUDES) $(INC) 28 | @echo - 29 | @echo -------- Compile $< -------- 30 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 31 | 32 | clean: 33 | del /Q *.o *.a 34 | 35 | -------------------------------------------------------------------------------- /mission5817/kernel/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = kernel.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -nostdlib -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | (cd chr_drv && make clean) 34 | (cd blk_drv && make clean) 35 | (cd math && make clean) 36 | -------------------------------------------------------------------------------- /mission5820/kernel/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = kernel.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -nostdlib -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | (cd chr_drv && make clean) 34 | (cd blk_drv && make clean) 35 | (cd math && make clean) 36 | -------------------------------------------------------------------------------- /mission5826/kernel/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = kernel.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -nostdlib -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | (cd chr_drv && make clean) 34 | (cd blk_drv && make clean) 35 | (cd math && make clean) 36 | -------------------------------------------------------------------------------- /mission5827/kernel/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = kernel.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -nostdlib -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | (cd chr_drv && make clean) 34 | (cd blk_drv && make clean) 35 | (cd math && make clean) 36 | -------------------------------------------------------------------------------- /mission5834/kernel/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = kernel.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -nostdlib -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | (cd chr_drv && make clean) 34 | (cd blk_drv && make clean) 35 | (cd math && make clean) 36 | -------------------------------------------------------------------------------- /mission5835/kernel/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = kernel.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -nostdlib -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | (cd chr_drv && make clean) 34 | (cd blk_drv && make clean) 35 | (cd math && make clean) 36 | -------------------------------------------------------------------------------- /mission5846/kernel/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LD = ld 3 | CFLAGS = -g -pipe -O -Wall -nostdinc -fno-builtin -I../include 4 | SFLAGS = -g -pipe 5 | 6 | INCLUDES = $(wildcard ../include/*.h ../include/asm/*.h ../include/linux/*.h ../include/sys/*.h) 7 | INC = $(wildcard ./*.h) 8 | 9 | SRC = $(wildcard *.c) 10 | SRC_S = $(wildcard *.s) 11 | OBJS = $(patsubst %.c,%.o,$(notdir ${SRC})) 12 | OBJS_S = $(patsubst %.s,%.o,$(notdir ${SRC_S})) 13 | 14 | TARGET = kernel.o 15 | 16 | ${TARGET}: ${OBJS} ${OBJS_S} 17 | @echo - 18 | @echo -------- Build library file $@ -------- 19 | $(LD) -nostdlib -r -o ${TARGET} $(OBJS) ${OBJS_S} 20 | 21 | %.o: %.c $(INCLUDES) $(INC) 22 | @echo - 23 | @echo -------- Compile $< -------- 24 | $(CC) $(CFLAGS) -c "$(abspath $<)" -o $@ 25 | 26 | %.o: %.s $(INCLUDES) $(INC) 27 | @echo - 28 | @echo -------- Compile $< -------- 29 | $(CC) $(SFLAGS) -c "$(abspath $<)" -o $@ 30 | 31 | clean: 32 | del /Q *.o 33 | (cd chr_drv && make clean) 34 | (cd blk_drv && make clean) 35 | (cd math && make clean) 36 | -------------------------------------------------------------------------------- /mission5817/lib/open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/open.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 标准参数头文件。以宏的形式定义变量参数列表。主要说明了-个 11 | // 类型(va_list)和三个宏(va_start, va_arg 和va_end),用于 12 | // vsprintf、vprintf、vfprintf 函数。 13 | 14 | //// 打开文件函数。 15 | // 打开并有可能创建一个文件。 16 | // 参数:filename - 文件名;flag - 文件打开标志;... 17 | // 返回:文件描述符,若出错则置出错码,并返回-1。 18 | int open (const char *filename, int flag, ...) 19 | { 20 | register int res; 21 | va_list arg; 22 | 23 | // 利用va_start()宏函数,取得flag 后面参数的指针,然后调用系统中断int 0x80,功能open 进行 24 | // 文件打开操作。 25 | // %0 - eax(返回的描述符或出错码);%1 - eax(系统中断调用功能号__NR_open); 26 | // %2 - ebx(文件名filename);%3 - ecx(打开文件标志flag);%4 - edx(后随参数文件属性mode)。 27 | va_start(arg,flag); 28 | __asm__("int $0x80" 29 | :"=a" (res) 30 | :"0" (__NR_open),"b" (filename),"c" (flag), 31 | "d" (va_arg(arg,int))); 32 | // 系统中断调用返回值大于或等于0,表示是一个文件描述符,则直接返回之。 33 | if (res >= 0) 34 | return res; 35 | // 否则说明返回值小于0,则代表一个出错码。设置该出错码并返回-1。 36 | errno = -res; 37 | return -1; 38 | } 39 | -------------------------------------------------------------------------------- /mission5820/lib/open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/open.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 标准参数头文件。以宏的形式定义变量参数列表。主要说明了-个 11 | // 类型(va_list)和三个宏(va_start, va_arg 和va_end),用于 12 | // vsprintf、vprintf、vfprintf 函数。 13 | 14 | //// 打开文件函数。 15 | // 打开并有可能创建一个文件。 16 | // 参数:filename - 文件名;flag - 文件打开标志;... 17 | // 返回:文件描述符,若出错则置出错码,并返回-1。 18 | int open (const char *filename, int flag, ...) 19 | { 20 | register int res; 21 | va_list arg; 22 | 23 | // 利用va_start()宏函数,取得flag 后面参数的指针,然后调用系统中断int 0x80,功能open 进行 24 | // 文件打开操作。 25 | // %0 - eax(返回的描述符或出错码);%1 - eax(系统中断调用功能号__NR_open); 26 | // %2 - ebx(文件名filename);%3 - ecx(打开文件标志flag);%4 - edx(后随参数文件属性mode)。 27 | va_start(arg,flag); 28 | __asm__("int $0x80" 29 | :"=a" (res) 30 | :"0" (__NR_open),"b" (filename),"c" (flag), 31 | "d" (va_arg(arg,int))); 32 | // 系统中断调用返回值大于或等于0,表示是一个文件描述符,则直接返回之。 33 | if (res >= 0) 34 | return res; 35 | // 否则说明返回值小于0,则代表一个出错码。设置该出错码并返回-1。 36 | errno = -res; 37 | return -1; 38 | } 39 | -------------------------------------------------------------------------------- /mission5826/lib/open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/open.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 标准参数头文件。以宏的形式定义变量参数列表。主要说明了-个 11 | // 类型(va_list)和三个宏(va_start, va_arg 和va_end),用于 12 | // vsprintf、vprintf、vfprintf 函数。 13 | 14 | //// 打开文件函数。 15 | // 打开并有可能创建一个文件。 16 | // 参数:filename - 文件名;flag - 文件打开标志;... 17 | // 返回:文件描述符,若出错则置出错码,并返回-1。 18 | int open (const char *filename, int flag, ...) 19 | { 20 | register int res; 21 | va_list arg; 22 | 23 | // 利用va_start()宏函数,取得flag 后面参数的指针,然后调用系统中断int 0x80,功能open 进行 24 | // 文件打开操作。 25 | // %0 - eax(返回的描述符或出错码);%1 - eax(系统中断调用功能号__NR_open); 26 | // %2 - ebx(文件名filename);%3 - ecx(打开文件标志flag);%4 - edx(后随参数文件属性mode)。 27 | va_start(arg,flag); 28 | __asm__("int $0x80" 29 | :"=a" (res) 30 | :"0" (__NR_open),"b" (filename),"c" (flag), 31 | "d" (va_arg(arg,int))); 32 | // 系统中断调用返回值大于或等于0,表示是一个文件描述符,则直接返回之。 33 | if (res >= 0) 34 | return res; 35 | // 否则说明返回值小于0,则代表一个出错码。设置该出错码并返回-1。 36 | errno = -res; 37 | return -1; 38 | } 39 | -------------------------------------------------------------------------------- /mission5827/lib/open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/open.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 标准参数头文件。以宏的形式定义变量参数列表。主要说明了-个 11 | // 类型(va_list)和三个宏(va_start, va_arg 和va_end),用于 12 | // vsprintf、vprintf、vfprintf 函数。 13 | 14 | //// 打开文件函数。 15 | // 打开并有可能创建一个文件。 16 | // 参数:filename - 文件名;flag - 文件打开标志;... 17 | // 返回:文件描述符,若出错则置出错码,并返回-1。 18 | int open (const char *filename, int flag, ...) 19 | { 20 | register int res; 21 | va_list arg; 22 | 23 | // 利用va_start()宏函数,取得flag 后面参数的指针,然后调用系统中断int 0x80,功能open 进行 24 | // 文件打开操作。 25 | // %0 - eax(返回的描述符或出错码);%1 - eax(系统中断调用功能号__NR_open); 26 | // %2 - ebx(文件名filename);%3 - ecx(打开文件标志flag);%4 - edx(后随参数文件属性mode)。 27 | va_start(arg,flag); 28 | __asm__("int $0x80" 29 | :"=a" (res) 30 | :"0" (__NR_open),"b" (filename),"c" (flag), 31 | "d" (va_arg(arg,int))); 32 | // 系统中断调用返回值大于或等于0,表示是一个文件描述符,则直接返回之。 33 | if (res >= 0) 34 | return res; 35 | // 否则说明返回值小于0,则代表一个出错码。设置该出错码并返回-1。 36 | errno = -res; 37 | return -1; 38 | } 39 | -------------------------------------------------------------------------------- /mission5834/lib/open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/open.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 标准参数头文件。以宏的形式定义变量参数列表。主要说明了-个 11 | // 类型(va_list)和三个宏(va_start, va_arg 和va_end),用于 12 | // vsprintf、vprintf、vfprintf 函数。 13 | 14 | //// 打开文件函数。 15 | // 打开并有可能创建一个文件。 16 | // 参数:filename - 文件名;flag - 文件打开标志;... 17 | // 返回:文件描述符,若出错则置出错码,并返回-1。 18 | int open (const char *filename, int flag, ...) 19 | { 20 | register int res; 21 | va_list arg; 22 | 23 | // 利用va_start()宏函数,取得flag 后面参数的指针,然后调用系统中断int 0x80,功能open 进行 24 | // 文件打开操作。 25 | // %0 - eax(返回的描述符或出错码);%1 - eax(系统中断调用功能号__NR_open); 26 | // %2 - ebx(文件名filename);%3 - ecx(打开文件标志flag);%4 - edx(后随参数文件属性mode)。 27 | va_start(arg,flag); 28 | __asm__("int $0x80" 29 | :"=a" (res) 30 | :"0" (__NR_open),"b" (filename),"c" (flag), 31 | "d" (va_arg(arg,int))); 32 | // 系统中断调用返回值大于或等于0,表示是一个文件描述符,则直接返回之。 33 | if (res >= 0) 34 | return res; 35 | // 否则说明返回值小于0,则代表一个出错码。设置该出错码并返回-1。 36 | errno = -res; 37 | return -1; 38 | } 39 | -------------------------------------------------------------------------------- /mission5835/lib/open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/open.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 标准参数头文件。以宏的形式定义变量参数列表。主要说明了-个 11 | // 类型(va_list)和三个宏(va_start, va_arg 和va_end),用于 12 | // vsprintf、vprintf、vfprintf 函数。 13 | 14 | //// 打开文件函数。 15 | // 打开并有可能创建一个文件。 16 | // 参数:filename - 文件名;flag - 文件打开标志;... 17 | // 返回:文件描述符,若出错则置出错码,并返回-1。 18 | int open (const char *filename, int flag, ...) 19 | { 20 | register int res; 21 | va_list arg; 22 | 23 | // 利用va_start()宏函数,取得flag 后面参数的指针,然后调用系统中断int 0x80,功能open 进行 24 | // 文件打开操作。 25 | // %0 - eax(返回的描述符或出错码);%1 - eax(系统中断调用功能号__NR_open); 26 | // %2 - ebx(文件名filename);%3 - ecx(打开文件标志flag);%4 - edx(后随参数文件属性mode)。 27 | va_start(arg,flag); 28 | __asm__("int $0x80" 29 | :"=a" (res) 30 | :"0" (__NR_open),"b" (filename),"c" (flag), 31 | "d" (va_arg(arg,int))); 32 | // 系统中断调用返回值大于或等于0,表示是一个文件描述符,则直接返回之。 33 | if (res >= 0) 34 | return res; 35 | // 否则说明返回值小于0,则代表一个出错码。设置该出错码并返回-1。 36 | errno = -res; 37 | return -1; 38 | } 39 | -------------------------------------------------------------------------------- /mission5846/lib/open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/open.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #define __LIBRARY__ 8 | #include // Linux 标准头文件。定义了各种符号常数和类型,并申明了各种函数。 9 | // 如定义了__LIBRARY__,则还包括系统调用号和内嵌汇编_syscall0()等。 10 | #include // 标准参数头文件。以宏的形式定义变量参数列表。主要说明了-个 11 | // 类型(va_list)和三个宏(va_start, va_arg 和va_end),用于 12 | // vsprintf、vprintf、vfprintf 函数。 13 | 14 | //// 打开文件函数。 15 | // 打开并有可能创建一个文件。 16 | // 参数:filename - 文件名;flag - 文件打开标志;... 17 | // 返回:文件描述符,若出错则置出错码,并返回-1。 18 | int open (const char *filename, int flag, ...) 19 | { 20 | register int res; 21 | va_list arg; 22 | 23 | // 利用va_start()宏函数,取得flag 后面参数的指针,然后调用系统中断int 0x80,功能open 进行 24 | // 文件打开操作。 25 | // %0 - eax(返回的描述符或出错码);%1 - eax(系统中断调用功能号__NR_open); 26 | // %2 - ebx(文件名filename);%3 - ecx(打开文件标志flag);%4 - edx(后随参数文件属性mode)。 27 | va_start(arg,flag); 28 | __asm__("int $0x80" 29 | :"=a" (res) 30 | :"0" (__NR_open),"b" (filename),"c" (flag), 31 | "d" (va_arg(arg,int))); 32 | // 系统中断调用返回值大于或等于0,表示是一个文件描述符,则直接返回之。 33 | if (res >= 0) 34 | return res; 35 | // 否则说明返回值小于0,则代表一个出错码。设置该出错码并返回-1。 36 | errno = -res; 37 | return -1; 38 | } 39 | -------------------------------------------------------------------------------- /mission5817/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TYPES_H 2 | #define _SYS_TYPES_H 3 | 4 | #ifndef _SIZE_T 5 | #define _SIZE_T 6 | typedef unsigned int size_t; // 用于对象的大小(长度)。 7 | #endif 8 | 9 | #ifndef _TIME_T 10 | #define _TIME_T 11 | typedef long time_t; // 用于时间(以秒计)。 12 | #endif 13 | 14 | #ifndef _PTRDIFF_T 15 | #define _PTRDIFF_T 16 | typedef long ptrdiff_t; 17 | #endif 18 | 19 | #ifndef NULL 20 | #define NULL ((void *) 0) 21 | #endif 22 | 23 | typedef int pid_t; // 用于进程号和进程组号。 24 | typedef unsigned short uid_t; // 用于用户号(用户标识号)。 25 | typedef unsigned char gid_t; // 用于组号。 26 | typedef unsigned short dev_t; // 用于设备号。 27 | typedef unsigned short ino_t; // 用于文件序列号。 28 | typedef unsigned short mode_t; // 用于某些文件属性。 29 | typedef unsigned short umode_t; // 30 | typedef unsigned char nlink_t; // 用于连接计数。 31 | typedef int daddr_t; 32 | typedef long off_t; // 用于文件长度(大小)。 33 | typedef unsigned char u_char; // 无符号字符类型。 34 | typedef unsigned short ushort; // 无符号短整数类型。 35 | 36 | typedef struct 37 | { 38 | int quot, rem; 39 | } 40 | div_t; // 用于DIV 操作。 41 | typedef struct 42 | { 43 | long quot, rem; 44 | } 45 | ldiv_t; // 用于长DIV 操作。 46 | 47 | struct ustat 48 | { 49 | daddr_t f_tfree; 50 | ino_t f_tinode; 51 | char f_fname[6]; 52 | char f_fpack[6]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /mission5820/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TYPES_H 2 | #define _SYS_TYPES_H 3 | 4 | #ifndef _SIZE_T 5 | #define _SIZE_T 6 | typedef unsigned int size_t; // 用于对象的大小(长度)。 7 | #endif 8 | 9 | #ifndef _TIME_T 10 | #define _TIME_T 11 | typedef long time_t; // 用于时间(以秒计)。 12 | #endif 13 | 14 | #ifndef _PTRDIFF_T 15 | #define _PTRDIFF_T 16 | typedef long ptrdiff_t; 17 | #endif 18 | 19 | #ifndef NULL 20 | #define NULL ((void *) 0) 21 | #endif 22 | 23 | typedef int pid_t; // 用于进程号和进程组号。 24 | typedef unsigned short uid_t; // 用于用户号(用户标识号)。 25 | typedef unsigned char gid_t; // 用于组号。 26 | typedef unsigned short dev_t; // 用于设备号。 27 | typedef unsigned short ino_t; // 用于文件序列号。 28 | typedef unsigned short mode_t; // 用于某些文件属性。 29 | typedef unsigned short umode_t; // 30 | typedef unsigned char nlink_t; // 用于连接计数。 31 | typedef int daddr_t; 32 | typedef long off_t; // 用于文件长度(大小)。 33 | typedef unsigned char u_char; // 无符号字符类型。 34 | typedef unsigned short ushort; // 无符号短整数类型。 35 | 36 | typedef struct 37 | { 38 | int quot, rem; 39 | } 40 | div_t; // 用于DIV 操作。 41 | typedef struct 42 | { 43 | long quot, rem; 44 | } 45 | ldiv_t; // 用于长DIV 操作。 46 | 47 | struct ustat 48 | { 49 | daddr_t f_tfree; 50 | ino_t f_tinode; 51 | char f_fname[6]; 52 | char f_fpack[6]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /mission5826/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TYPES_H 2 | #define _SYS_TYPES_H 3 | 4 | #ifndef _SIZE_T 5 | #define _SIZE_T 6 | typedef unsigned int size_t; // 用于对象的大小(长度)。 7 | #endif 8 | 9 | #ifndef _TIME_T 10 | #define _TIME_T 11 | typedef long time_t; // 用于时间(以秒计)。 12 | #endif 13 | 14 | #ifndef _PTRDIFF_T 15 | #define _PTRDIFF_T 16 | typedef long ptrdiff_t; 17 | #endif 18 | 19 | #ifndef NULL 20 | #define NULL ((void *) 0) 21 | #endif 22 | 23 | typedef int pid_t; // 用于进程号和进程组号。 24 | typedef unsigned short uid_t; // 用于用户号(用户标识号)。 25 | typedef unsigned char gid_t; // 用于组号。 26 | typedef unsigned short dev_t; // 用于设备号。 27 | typedef unsigned short ino_t; // 用于文件序列号。 28 | typedef unsigned short mode_t; // 用于某些文件属性。 29 | typedef unsigned short umode_t; // 30 | typedef unsigned char nlink_t; // 用于连接计数。 31 | typedef int daddr_t; 32 | typedef long off_t; // 用于文件长度(大小)。 33 | typedef unsigned char u_char; // 无符号字符类型。 34 | typedef unsigned short ushort; // 无符号短整数类型。 35 | 36 | typedef struct 37 | { 38 | int quot, rem; 39 | } 40 | div_t; // 用于DIV 操作。 41 | typedef struct 42 | { 43 | long quot, rem; 44 | } 45 | ldiv_t; // 用于长DIV 操作。 46 | 47 | struct ustat 48 | { 49 | daddr_t f_tfree; 50 | ino_t f_tinode; 51 | char f_fname[6]; 52 | char f_fpack[6]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /mission5827/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TYPES_H 2 | #define _SYS_TYPES_H 3 | 4 | #ifndef _SIZE_T 5 | #define _SIZE_T 6 | typedef unsigned int size_t; // 用于对象的大小(长度)。 7 | #endif 8 | 9 | #ifndef _TIME_T 10 | #define _TIME_T 11 | typedef long time_t; // 用于时间(以秒计)。 12 | #endif 13 | 14 | #ifndef _PTRDIFF_T 15 | #define _PTRDIFF_T 16 | typedef long ptrdiff_t; 17 | #endif 18 | 19 | #ifndef NULL 20 | #define NULL ((void *) 0) 21 | #endif 22 | 23 | typedef int pid_t; // 用于进程号和进程组号。 24 | typedef unsigned short uid_t; // 用于用户号(用户标识号)。 25 | typedef unsigned char gid_t; // 用于组号。 26 | typedef unsigned short dev_t; // 用于设备号。 27 | typedef unsigned short ino_t; // 用于文件序列号。 28 | typedef unsigned short mode_t; // 用于某些文件属性。 29 | typedef unsigned short umode_t; // 30 | typedef unsigned char nlink_t; // 用于连接计数。 31 | typedef int daddr_t; 32 | typedef long off_t; // 用于文件长度(大小)。 33 | typedef unsigned char u_char; // 无符号字符类型。 34 | typedef unsigned short ushort; // 无符号短整数类型。 35 | 36 | typedef struct 37 | { 38 | int quot, rem; 39 | } 40 | div_t; // 用于DIV 操作。 41 | typedef struct 42 | { 43 | long quot, rem; 44 | } 45 | ldiv_t; // 用于长DIV 操作。 46 | 47 | struct ustat 48 | { 49 | daddr_t f_tfree; 50 | ino_t f_tinode; 51 | char f_fname[6]; 52 | char f_fpack[6]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /mission5834/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TYPES_H 2 | #define _SYS_TYPES_H 3 | 4 | #ifndef _SIZE_T 5 | #define _SIZE_T 6 | typedef unsigned int size_t; // 用于对象的大小(长度)。 7 | #endif 8 | 9 | #ifndef _TIME_T 10 | #define _TIME_T 11 | typedef long time_t; // 用于时间(以秒计)。 12 | #endif 13 | 14 | #ifndef _PTRDIFF_T 15 | #define _PTRDIFF_T 16 | typedef long ptrdiff_t; 17 | #endif 18 | 19 | #ifndef NULL 20 | #define NULL ((void *) 0) 21 | #endif 22 | 23 | typedef int pid_t; // 用于进程号和进程组号。 24 | typedef unsigned short uid_t; // 用于用户号(用户标识号)。 25 | typedef unsigned char gid_t; // 用于组号。 26 | typedef unsigned short dev_t; // 用于设备号。 27 | typedef unsigned short ino_t; // 用于文件序列号。 28 | typedef unsigned short mode_t; // 用于某些文件属性。 29 | typedef unsigned short umode_t; // 30 | typedef unsigned char nlink_t; // 用于连接计数。 31 | typedef int daddr_t; 32 | typedef long off_t; // 用于文件长度(大小)。 33 | typedef unsigned char u_char; // 无符号字符类型。 34 | typedef unsigned short ushort; // 无符号短整数类型。 35 | 36 | typedef struct 37 | { 38 | int quot, rem; 39 | } 40 | div_t; // 用于DIV 操作。 41 | typedef struct 42 | { 43 | long quot, rem; 44 | } 45 | ldiv_t; // 用于长DIV 操作。 46 | 47 | struct ustat 48 | { 49 | daddr_t f_tfree; 50 | ino_t f_tinode; 51 | char f_fname[6]; 52 | char f_fpack[6]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /mission5835/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TYPES_H 2 | #define _SYS_TYPES_H 3 | 4 | #ifndef _SIZE_T 5 | #define _SIZE_T 6 | typedef unsigned int size_t; // 用于对象的大小(长度)。 7 | #endif 8 | 9 | #ifndef _TIME_T 10 | #define _TIME_T 11 | typedef long time_t; // 用于时间(以秒计)。 12 | #endif 13 | 14 | #ifndef _PTRDIFF_T 15 | #define _PTRDIFF_T 16 | typedef long ptrdiff_t; 17 | #endif 18 | 19 | #ifndef NULL 20 | #define NULL ((void *) 0) 21 | #endif 22 | 23 | typedef int pid_t; // 用于进程号和进程组号。 24 | typedef unsigned short uid_t; // 用于用户号(用户标识号)。 25 | typedef unsigned char gid_t; // 用于组号。 26 | typedef unsigned short dev_t; // 用于设备号。 27 | typedef unsigned short ino_t; // 用于文件序列号。 28 | typedef unsigned short mode_t; // 用于某些文件属性。 29 | typedef unsigned short umode_t; // 30 | typedef unsigned char nlink_t; // 用于连接计数。 31 | typedef int daddr_t; 32 | typedef long off_t; // 用于文件长度(大小)。 33 | typedef unsigned char u_char; // 无符号字符类型。 34 | typedef unsigned short ushort; // 无符号短整数类型。 35 | 36 | typedef struct 37 | { 38 | int quot, rem; 39 | } 40 | div_t; // 用于DIV 操作。 41 | typedef struct 42 | { 43 | long quot, rem; 44 | } 45 | ldiv_t; // 用于长DIV 操作。 46 | 47 | struct ustat 48 | { 49 | daddr_t f_tfree; 50 | ino_t f_tinode; 51 | char f_fname[6]; 52 | char f_fpack[6]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /mission5846/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TYPES_H 2 | #define _SYS_TYPES_H 3 | 4 | #ifndef _SIZE_T 5 | #define _SIZE_T 6 | typedef unsigned int size_t; // 用于对象的大小(长度)。 7 | #endif 8 | 9 | #ifndef _TIME_T 10 | #define _TIME_T 11 | typedef long time_t; // 用于时间(以秒计)。 12 | #endif 13 | 14 | #ifndef _PTRDIFF_T 15 | #define _PTRDIFF_T 16 | typedef long ptrdiff_t; 17 | #endif 18 | 19 | #ifndef NULL 20 | #define NULL ((void *) 0) 21 | #endif 22 | 23 | typedef int pid_t; // 用于进程号和进程组号。 24 | typedef unsigned short uid_t; // 用于用户号(用户标识号)。 25 | typedef unsigned char gid_t; // 用于组号。 26 | typedef unsigned short dev_t; // 用于设备号。 27 | typedef unsigned short ino_t; // 用于文件序列号。 28 | typedef unsigned short mode_t; // 用于某些文件属性。 29 | typedef unsigned short umode_t; // 30 | typedef unsigned char nlink_t; // 用于连接计数。 31 | typedef int daddr_t; 32 | typedef long off_t; // 用于文件长度(大小)。 33 | typedef unsigned char u_char; // 无符号字符类型。 34 | typedef unsigned short ushort; // 无符号短整数类型。 35 | 36 | typedef struct 37 | { 38 | int quot, rem; 39 | } 40 | div_t; // 用于DIV 操作。 41 | typedef struct 42 | { 43 | long quot, rem; 44 | } 45 | ldiv_t; // 用于长DIV 操作。 46 | 47 | struct ustat 48 | { 49 | daddr_t f_tfree; 50 | ino_t f_tinode; 51 | char f_fname[6]; 52 | char f_fpack[6]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /mission5817/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #include 5 | 6 | #define _LOW(v) ( (v) & 0377) // 取低字节(8 进制表示)。 7 | #define _HIGH(v) ( ((v) >> 8) & 0377) // 取高字节。 8 | 9 | /* options for waitpid, WUNTRACED not supported */ 10 | /* waitpid 的选项,其中WUNTRACED 未被支持 */ 11 | #define WNOHANG 1 // 如果没有状态也不要挂起,并立刻返回。 12 | #define WUNTRACED 2 // 报告停止执行的子进程状态。 13 | 14 | #define WIFEXITED(s) (!((s)&0xFF) // 如果子进程正常退出,则为真。 15 | #define WIFSTOPPED(s) (((s)&0xFF)==0x7F) // 如果子进程正停止着,则为true。 16 | #define WEXITSTATUS(s) (((s)>>8)&0xFF) // 返回退出状态。 17 | #define WTERMSIG(s) ((s)&0x7F) // 返回导致进程终止的信号值(信号量)。 18 | #define WSTOPSIG(s) (((s)>>8)&0xFF) // 返回导致进程停止的信号值。 19 | #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) // 如果由于未捕捉到信号 20 | // 而导致子进程退出则为真。 21 | 22 | // wait()和waitpit()函数允许进程获取与其子进程之一的状态信息。各种选项允许获取已经终止或 23 | // 停止的子进程状态信息。如果存在两个或两个以上子进程的状态信息,则报告的顺序是不指定的。 24 | // wait()将挂起当前进程,直到其子进程之一退出(终止),或者收到要求终止该进程的信号, 25 | // 或者是需要调用一个信号句柄(信号处理程序)。 26 | // waitpid()挂起当前进程,直到pid 指定的子进程退出(终止)或者收到要求终止该进程的信号, 27 | // 或者是需要调用一个信号句柄(信号处理程序)。 28 | // 如果pid= -1,options=0,则waitpid()的作用与wait()函数一样。否则其行为将随pid 和options 29 | // 参数的不同而不同。(参见kernel/exit.c) 30 | pid_t wait (int *stat_loc); 31 | pid_t waitpid (pid_t pid, int *stat_loc, int options); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mission5820/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #include 5 | 6 | #define _LOW(v) ( (v) & 0377) // 取低字节(8 进制表示)。 7 | #define _HIGH(v) ( ((v) >> 8) & 0377) // 取高字节。 8 | 9 | /* options for waitpid, WUNTRACED not supported */ 10 | /* waitpid 的选项,其中WUNTRACED 未被支持 */ 11 | #define WNOHANG 1 // 如果没有状态也不要挂起,并立刻返回。 12 | #define WUNTRACED 2 // 报告停止执行的子进程状态。 13 | 14 | #define WIFEXITED(s) (!((s)&0xFF) // 如果子进程正常退出,则为真。 15 | #define WIFSTOPPED(s) (((s)&0xFF)==0x7F) // 如果子进程正停止着,则为true。 16 | #define WEXITSTATUS(s) (((s)>>8)&0xFF) // 返回退出状态。 17 | #define WTERMSIG(s) ((s)&0x7F) // 返回导致进程终止的信号值(信号量)。 18 | #define WSTOPSIG(s) (((s)>>8)&0xFF) // 返回导致进程停止的信号值。 19 | #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) // 如果由于未捕捉到信号 20 | // 而导致子进程退出则为真。 21 | 22 | // wait()和waitpit()函数允许进程获取与其子进程之一的状态信息。各种选项允许获取已经终止或 23 | // 停止的子进程状态信息。如果存在两个或两个以上子进程的状态信息,则报告的顺序是不指定的。 24 | // wait()将挂起当前进程,直到其子进程之一退出(终止),或者收到要求终止该进程的信号, 25 | // 或者是需要调用一个信号句柄(信号处理程序)。 26 | // waitpid()挂起当前进程,直到pid 指定的子进程退出(终止)或者收到要求终止该进程的信号, 27 | // 或者是需要调用一个信号句柄(信号处理程序)。 28 | // 如果pid= -1,options=0,则waitpid()的作用与wait()函数一样。否则其行为将随pid 和options 29 | // 参数的不同而不同。(参见kernel/exit.c) 30 | pid_t wait (int *stat_loc); 31 | pid_t waitpid (pid_t pid, int *stat_loc, int options); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mission5826/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #include 5 | 6 | #define _LOW(v) ( (v) & 0377) // 取低字节(8 进制表示)。 7 | #define _HIGH(v) ( ((v) >> 8) & 0377) // 取高字节。 8 | 9 | /* options for waitpid, WUNTRACED not supported */ 10 | /* waitpid 的选项,其中WUNTRACED 未被支持 */ 11 | #define WNOHANG 1 // 如果没有状态也不要挂起,并立刻返回。 12 | #define WUNTRACED 2 // 报告停止执行的子进程状态。 13 | 14 | #define WIFEXITED(s) (!((s)&0xFF) // 如果子进程正常退出,则为真。 15 | #define WIFSTOPPED(s) (((s)&0xFF)==0x7F) // 如果子进程正停止着,则为true。 16 | #define WEXITSTATUS(s) (((s)>>8)&0xFF) // 返回退出状态。 17 | #define WTERMSIG(s) ((s)&0x7F) // 返回导致进程终止的信号值(信号量)。 18 | #define WSTOPSIG(s) (((s)>>8)&0xFF) // 返回导致进程停止的信号值。 19 | #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) // 如果由于未捕捉到信号 20 | // 而导致子进程退出则为真。 21 | 22 | // wait()和waitpit()函数允许进程获取与其子进程之一的状态信息。各种选项允许获取已经终止或 23 | // 停止的子进程状态信息。如果存在两个或两个以上子进程的状态信息,则报告的顺序是不指定的。 24 | // wait()将挂起当前进程,直到其子进程之一退出(终止),或者收到要求终止该进程的信号, 25 | // 或者是需要调用一个信号句柄(信号处理程序)。 26 | // waitpid()挂起当前进程,直到pid 指定的子进程退出(终止)或者收到要求终止该进程的信号, 27 | // 或者是需要调用一个信号句柄(信号处理程序)。 28 | // 如果pid= -1,options=0,则waitpid()的作用与wait()函数一样。否则其行为将随pid 和options 29 | // 参数的不同而不同。(参见kernel/exit.c) 30 | pid_t wait (int *stat_loc); 31 | pid_t waitpid (pid_t pid, int *stat_loc, int options); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mission5827/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #include 5 | 6 | #define _LOW(v) ( (v) & 0377) // 取低字节(8 进制表示)。 7 | #define _HIGH(v) ( ((v) >> 8) & 0377) // 取高字节。 8 | 9 | /* options for waitpid, WUNTRACED not supported */ 10 | /* waitpid 的选项,其中WUNTRACED 未被支持 */ 11 | #define WNOHANG 1 // 如果没有状态也不要挂起,并立刻返回。 12 | #define WUNTRACED 2 // 报告停止执行的子进程状态。 13 | 14 | #define WIFEXITED(s) (!((s)&0xFF) // 如果子进程正常退出,则为真。 15 | #define WIFSTOPPED(s) (((s)&0xFF)==0x7F) // 如果子进程正停止着,则为true。 16 | #define WEXITSTATUS(s) (((s)>>8)&0xFF) // 返回退出状态。 17 | #define WTERMSIG(s) ((s)&0x7F) // 返回导致进程终止的信号值(信号量)。 18 | #define WSTOPSIG(s) (((s)>>8)&0xFF) // 返回导致进程停止的信号值。 19 | #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) // 如果由于未捕捉到信号 20 | // 而导致子进程退出则为真。 21 | 22 | // wait()和waitpit()函数允许进程获取与其子进程之一的状态信息。各种选项允许获取已经终止或 23 | // 停止的子进程状态信息。如果存在两个或两个以上子进程的状态信息,则报告的顺序是不指定的。 24 | // wait()将挂起当前进程,直到其子进程之一退出(终止),或者收到要求终止该进程的信号, 25 | // 或者是需要调用一个信号句柄(信号处理程序)。 26 | // waitpid()挂起当前进程,直到pid 指定的子进程退出(终止)或者收到要求终止该进程的信号, 27 | // 或者是需要调用一个信号句柄(信号处理程序)。 28 | // 如果pid= -1,options=0,则waitpid()的作用与wait()函数一样。否则其行为将随pid 和options 29 | // 参数的不同而不同。(参见kernel/exit.c) 30 | pid_t wait (int *stat_loc); 31 | pid_t waitpid (pid_t pid, int *stat_loc, int options); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mission5834/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #include 5 | 6 | #define _LOW(v) ( (v) & 0377) // 取低字节(8 进制表示)。 7 | #define _HIGH(v) ( ((v) >> 8) & 0377) // 取高字节。 8 | 9 | /* options for waitpid, WUNTRACED not supported */ 10 | /* waitpid 的选项,其中WUNTRACED 未被支持 */ 11 | #define WNOHANG 1 // 如果没有状态也不要挂起,并立刻返回。 12 | #define WUNTRACED 2 // 报告停止执行的子进程状态。 13 | 14 | #define WIFEXITED(s) (!((s)&0xFF) // 如果子进程正常退出,则为真。 15 | #define WIFSTOPPED(s) (((s)&0xFF)==0x7F) // 如果子进程正停止着,则为true。 16 | #define WEXITSTATUS(s) (((s)>>8)&0xFF) // 返回退出状态。 17 | #define WTERMSIG(s) ((s)&0x7F) // 返回导致进程终止的信号值(信号量)。 18 | #define WSTOPSIG(s) (((s)>>8)&0xFF) // 返回导致进程停止的信号值。 19 | #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) // 如果由于未捕捉到信号 20 | // 而导致子进程退出则为真。 21 | 22 | // wait()和waitpit()函数允许进程获取与其子进程之一的状态信息。各种选项允许获取已经终止或 23 | // 停止的子进程状态信息。如果存在两个或两个以上子进程的状态信息,则报告的顺序是不指定的。 24 | // wait()将挂起当前进程,直到其子进程之一退出(终止),或者收到要求终止该进程的信号, 25 | // 或者是需要调用一个信号句柄(信号处理程序)。 26 | // waitpid()挂起当前进程,直到pid 指定的子进程退出(终止)或者收到要求终止该进程的信号, 27 | // 或者是需要调用一个信号句柄(信号处理程序)。 28 | // 如果pid= -1,options=0,则waitpid()的作用与wait()函数一样。否则其行为将随pid 和options 29 | // 参数的不同而不同。(参见kernel/exit.c) 30 | pid_t wait (int *stat_loc); 31 | pid_t waitpid (pid_t pid, int *stat_loc, int options); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mission5835/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #include 5 | 6 | #define _LOW(v) ( (v) & 0377) // 取低字节(8 进制表示)。 7 | #define _HIGH(v) ( ((v) >> 8) & 0377) // 取高字节。 8 | 9 | /* options for waitpid, WUNTRACED not supported */ 10 | /* waitpid 的选项,其中WUNTRACED 未被支持 */ 11 | #define WNOHANG 1 // 如果没有状态也不要挂起,并立刻返回。 12 | #define WUNTRACED 2 // 报告停止执行的子进程状态。 13 | 14 | #define WIFEXITED(s) (!((s)&0xFF) // 如果子进程正常退出,则为真。 15 | #define WIFSTOPPED(s) (((s)&0xFF)==0x7F) // 如果子进程正停止着,则为true。 16 | #define WEXITSTATUS(s) (((s)>>8)&0xFF) // 返回退出状态。 17 | #define WTERMSIG(s) ((s)&0x7F) // 返回导致进程终止的信号值(信号量)。 18 | #define WSTOPSIG(s) (((s)>>8)&0xFF) // 返回导致进程停止的信号值。 19 | #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) // 如果由于未捕捉到信号 20 | // 而导致子进程退出则为真。 21 | 22 | // wait()和waitpit()函数允许进程获取与其子进程之一的状态信息。各种选项允许获取已经终止或 23 | // 停止的子进程状态信息。如果存在两个或两个以上子进程的状态信息,则报告的顺序是不指定的。 24 | // wait()将挂起当前进程,直到其子进程之一退出(终止),或者收到要求终止该进程的信号, 25 | // 或者是需要调用一个信号句柄(信号处理程序)。 26 | // waitpid()挂起当前进程,直到pid 指定的子进程退出(终止)或者收到要求终止该进程的信号, 27 | // 或者是需要调用一个信号句柄(信号处理程序)。 28 | // 如果pid= -1,options=0,则waitpid()的作用与wait()函数一样。否则其行为将随pid 和options 29 | // 参数的不同而不同。(参见kernel/exit.c) 30 | pid_t wait (int *stat_loc); 31 | pid_t waitpid (pid_t pid, int *stat_loc, int options); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mission5846/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #include 5 | 6 | #define _LOW(v) ( (v) & 0377) // 取低字节(8 进制表示)。 7 | #define _HIGH(v) ( ((v) >> 8) & 0377) // 取高字节。 8 | 9 | /* options for waitpid, WUNTRACED not supported */ 10 | /* waitpid 的选项,其中WUNTRACED 未被支持 */ 11 | #define WNOHANG 1 // 如果没有状态也不要挂起,并立刻返回。 12 | #define WUNTRACED 2 // 报告停止执行的子进程状态。 13 | 14 | #define WIFEXITED(s) (!((s)&0xFF) // 如果子进程正常退出,则为真。 15 | #define WIFSTOPPED(s) (((s)&0xFF)==0x7F) // 如果子进程正停止着,则为true。 16 | #define WEXITSTATUS(s) (((s)>>8)&0xFF) // 返回退出状态。 17 | #define WTERMSIG(s) ((s)&0x7F) // 返回导致进程终止的信号值(信号量)。 18 | #define WSTOPSIG(s) (((s)>>8)&0xFF) // 返回导致进程停止的信号值。 19 | #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) // 如果由于未捕捉到信号 20 | // 而导致子进程退出则为真。 21 | 22 | // wait()和waitpit()函数允许进程获取与其子进程之一的状态信息。各种选项允许获取已经终止或 23 | // 停止的子进程状态信息。如果存在两个或两个以上子进程的状态信息,则报告的顺序是不指定的。 24 | // wait()将挂起当前进程,直到其子进程之一退出(终止),或者收到要求终止该进程的信号, 25 | // 或者是需要调用一个信号句柄(信号处理程序)。 26 | // waitpid()挂起当前进程,直到pid 指定的子进程退出(终止)或者收到要求终止该进程的信号, 27 | // 或者是需要调用一个信号句柄(信号处理程序)。 28 | // 如果pid= -1,options=0,则waitpid()的作用与wait()函数一样。否则其行为将随pid 和options 29 | // 参数的不同而不同。(参见kernel/exit.c) 30 | pid_t wait (int *stat_loc); 31 | pid_t waitpid (pid_t pid, int *stat_loc, int options); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mission5817/include/linux/kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 'kernel.h' contains some often-used function prototypes etc 3 | */ 4 | /* 5 | * 'kernel.h'定义了一些常用函数的原型等。 6 | */ 7 | // 验证给定地址开始的内存块是否超限。若超限则追加内存。( kernel/fork.c)。 8 | void verify_area (void *addr, int count); 9 | // 显示内核出错信息,然后进入死循环。( kernel/panic.c)。 10 | volatile void panic (const char *str); 11 | // 标准打印(显示)函数。( init/main.c)。 12 | int printf (const char *fmt, ...); 13 | // 内核专用的打印信息函数,功能与printf()相同。( kernel/printk.c)。 14 | int printk (const char *fmt, ...); 15 | // 往tty 上写指定长度的字符串。( kernel/chr_drv/tty_io.c)。 16 | int tty_write (unsigned ch, char *buf, int count); 17 | // 通用内核内存分配函数。( lib/malloc.c)。 18 | void *malloc (unsigned int size); 19 | // 释放指定对象占用的内存。( lib/malloc.c)。 20 | void free_s (void *obj, int size); 21 | 22 | #define free(x) free_s((x), 0) 23 | 24 | /* 25 | * This is defined as a macro, but at some point this might become a 26 | * real subroutine that sets a flag if it returns true (to do 27 | * BSD-style accounting where the process is flagged if it uses root 28 | * privs). The implication of this is that you should do normal 29 | * permissions checks first, and check suser() last. 30 | */ 31 | /* 32 | * 下面函数是以宏的形式定义的,但是在某方面来看它可以成为一个真正的子程序, 33 | * 如果返回是true 时它将设置标志(如果使用root 用户权限的进程设置了标志,则用 34 | * 于执行BSD 方式的计帐处理)。这意味着你应该首先执行常规权限检查,最后再 35 | * 检测suser()。 36 | */ 37 | #define suser() (current->euid == 0) // 检测是否是超级用户。 38 | -------------------------------------------------------------------------------- /mission5820/include/linux/kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 'kernel.h' contains some often-used function prototypes etc 3 | */ 4 | /* 5 | * 'kernel.h'定义了一些常用函数的原型等。 6 | */ 7 | // 验证给定地址开始的内存块是否超限。若超限则追加内存。( kernel/fork.c)。 8 | void verify_area (void *addr, int count); 9 | // 显示内核出错信息,然后进入死循环。( kernel/panic.c)。 10 | volatile void panic (const char *str); 11 | // 标准打印(显示)函数。( init/main.c)。 12 | int printf (const char *fmt, ...); 13 | // 内核专用的打印信息函数,功能与printf()相同。( kernel/printk.c)。 14 | int printk (const char *fmt, ...); 15 | // 往tty 上写指定长度的字符串。( kernel/chr_drv/tty_io.c)。 16 | int tty_write (unsigned ch, char *buf, int count); 17 | // 通用内核内存分配函数。( lib/malloc.c)。 18 | void *malloc (unsigned int size); 19 | // 释放指定对象占用的内存。( lib/malloc.c)。 20 | void free_s (void *obj, int size); 21 | 22 | #define free(x) free_s((x), 0) 23 | 24 | /* 25 | * This is defined as a macro, but at some point this might become a 26 | * real subroutine that sets a flag if it returns true (to do 27 | * BSD-style accounting where the process is flagged if it uses root 28 | * privs). The implication of this is that you should do normal 29 | * permissions checks first, and check suser() last. 30 | */ 31 | /* 32 | * 下面函数是以宏的形式定义的,但是在某方面来看它可以成为一个真正的子程序, 33 | * 如果返回是true 时它将设置标志(如果使用root 用户权限的进程设置了标志,则用 34 | * 于执行BSD 方式的计帐处理)。这意味着你应该首先执行常规权限检查,最后再 35 | * 检测suser()。 36 | */ 37 | #define suser() (current->euid == 0) // 检测是否是超级用户。 38 | -------------------------------------------------------------------------------- /mission5826/include/linux/kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 'kernel.h' contains some often-used function prototypes etc 3 | */ 4 | /* 5 | * 'kernel.h'定义了一些常用函数的原型等。 6 | */ 7 | // 验证给定地址开始的内存块是否超限。若超限则追加内存。( kernel/fork.c)。 8 | void verify_area (void *addr, int count); 9 | // 显示内核出错信息,然后进入死循环。( kernel/panic.c)。 10 | volatile void panic (const char *str); 11 | // 标准打印(显示)函数。( init/main.c)。 12 | int printf (const char *fmt, ...); 13 | // 内核专用的打印信息函数,功能与printf()相同。( kernel/printk.c)。 14 | int printk (const char *fmt, ...); 15 | // 往tty 上写指定长度的字符串。( kernel/chr_drv/tty_io.c)。 16 | int tty_write (unsigned ch, char *buf, int count); 17 | // 通用内核内存分配函数。( lib/malloc.c)。 18 | void *malloc (unsigned int size); 19 | // 释放指定对象占用的内存。( lib/malloc.c)。 20 | void free_s (void *obj, int size); 21 | 22 | #define free(x) free_s((x), 0) 23 | 24 | /* 25 | * This is defined as a macro, but at some point this might become a 26 | * real subroutine that sets a flag if it returns true (to do 27 | * BSD-style accounting where the process is flagged if it uses root 28 | * privs). The implication of this is that you should do normal 29 | * permissions checks first, and check suser() last. 30 | */ 31 | /* 32 | * 下面函数是以宏的形式定义的,但是在某方面来看它可以成为一个真正的子程序, 33 | * 如果返回是true 时它将设置标志(如果使用root 用户权限的进程设置了标志,则用 34 | * 于执行BSD 方式的计帐处理)。这意味着你应该首先执行常规权限检查,最后再 35 | * 检测suser()。 36 | */ 37 | #define suser() (current->euid == 0) // 检测是否是超级用户。 38 | -------------------------------------------------------------------------------- /mission5827/include/linux/kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 'kernel.h' contains some often-used function prototypes etc 3 | */ 4 | /* 5 | * 'kernel.h'定义了一些常用函数的原型等。 6 | */ 7 | // 验证给定地址开始的内存块是否超限。若超限则追加内存。( kernel/fork.c)。 8 | void verify_area (void *addr, int count); 9 | // 显示内核出错信息,然后进入死循环。( kernel/panic.c)。 10 | volatile void panic (const char *str); 11 | // 标准打印(显示)函数。( init/main.c)。 12 | int printf (const char *fmt, ...); 13 | // 内核专用的打印信息函数,功能与printf()相同。( kernel/printk.c)。 14 | int printk (const char *fmt, ...); 15 | // 往tty 上写指定长度的字符串。( kernel/chr_drv/tty_io.c)。 16 | int tty_write (unsigned ch, char *buf, int count); 17 | // 通用内核内存分配函数。( lib/malloc.c)。 18 | void *malloc (unsigned int size); 19 | // 释放指定对象占用的内存。( lib/malloc.c)。 20 | void free_s (void *obj, int size); 21 | 22 | #define free(x) free_s((x), 0) 23 | 24 | /* 25 | * This is defined as a macro, but at some point this might become a 26 | * real subroutine that sets a flag if it returns true (to do 27 | * BSD-style accounting where the process is flagged if it uses root 28 | * privs). The implication of this is that you should do normal 29 | * permissions checks first, and check suser() last. 30 | */ 31 | /* 32 | * 下面函数是以宏的形式定义的,但是在某方面来看它可以成为一个真正的子程序, 33 | * 如果返回是true 时它将设置标志(如果使用root 用户权限的进程设置了标志,则用 34 | * 于执行BSD 方式的计帐处理)。这意味着你应该首先执行常规权限检查,最后再 35 | * 检测suser()。 36 | */ 37 | #define suser() (current->euid == 0) // 检测是否是超级用户。 38 | -------------------------------------------------------------------------------- /mission5835/include/linux/kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 'kernel.h' contains some often-used function prototypes etc 3 | */ 4 | /* 5 | * 'kernel.h'定义了一些常用函数的原型等。 6 | */ 7 | // 验证给定地址开始的内存块是否超限。若超限则追加内存。( kernel/fork.c)。 8 | void verify_area (void *addr, int count); 9 | // 显示内核出错信息,然后进入死循环。( kernel/panic.c)。 10 | volatile void panic (const char *str); 11 | // 标准打印(显示)函数。( init/main.c)。 12 | int printf (const char *fmt, ...); 13 | // 内核专用的打印信息函数,功能与printf()相同。( kernel/printk.c)。 14 | int printk (const char *fmt, ...); 15 | // 往tty 上写指定长度的字符串。( kernel/chr_drv/tty_io.c)。 16 | int tty_write (unsigned ch, char *buf, int count); 17 | // 通用内核内存分配函数。( lib/malloc.c)。 18 | void *malloc (unsigned int size); 19 | // 释放指定对象占用的内存。( lib/malloc.c)。 20 | void free_s (void *obj, int size); 21 | 22 | #define free(x) free_s((x), 0) 23 | 24 | /* 25 | * This is defined as a macro, but at some point this might become a 26 | * real subroutine that sets a flag if it returns true (to do 27 | * BSD-style accounting where the process is flagged if it uses root 28 | * privs). The implication of this is that you should do normal 29 | * permissions checks first, and check suser() last. 30 | */ 31 | /* 32 | * 下面函数是以宏的形式定义的,但是在某方面来看它可以成为一个真正的子程序, 33 | * 如果返回是true 时它将设置标志(如果使用root 用户权限的进程设置了标志,则用 34 | * 于执行BSD 方式的计帐处理)。这意味着你应该首先执行常规权限检查,最后再 35 | * 检测suser()。 36 | */ 37 | #define suser() (current->euid == 0) // 检测是否是超级用户。 38 | -------------------------------------------------------------------------------- /mission5846/include/linux/kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 'kernel.h' contains some often-used function prototypes etc 3 | */ 4 | /* 5 | * 'kernel.h'定义了一些常用函数的原型等。 6 | */ 7 | // 验证给定地址开始的内存块是否超限。若超限则追加内存。( kernel/fork.c)。 8 | void verify_area (void *addr, int count); 9 | // 显示内核出错信息,然后进入死循环。( kernel/panic.c)。 10 | volatile void panic (const char *str); 11 | // 标准打印(显示)函数。( init/main.c)。 12 | int printf (const char *fmt, ...); 13 | // 内核专用的打印信息函数,功能与printf()相同。( kernel/printk.c)。 14 | int printk (const char *fmt, ...); 15 | // 往tty 上写指定长度的字符串。( kernel/chr_drv/tty_io.c)。 16 | int tty_write (unsigned ch, char *buf, int count); 17 | // 通用内核内存分配函数。( lib/malloc.c)。 18 | void *malloc (unsigned int size); 19 | // 释放指定对象占用的内存。( lib/malloc.c)。 20 | void free_s (void *obj, int size); 21 | 22 | #define free(x) free_s((x), 0) 23 | 24 | /* 25 | * This is defined as a macro, but at some point this might become a 26 | * real subroutine that sets a flag if it returns true (to do 27 | * BSD-style accounting where the process is flagged if it uses root 28 | * privs). The implication of this is that you should do normal 29 | * permissions checks first, and check suser() last. 30 | */ 31 | /* 32 | * 下面函数是以宏的形式定义的,但是在某方面来看它可以成为一个真正的子程序, 33 | * 如果返回是true 时它将设置标志(如果使用root 用户权限的进程设置了标志,则用 34 | * 于执行BSD 方式的计帐处理)。这意味着你应该首先执行常规权限检查,最后再 35 | * 检测suser()。 36 | */ 37 | #define suser() (current->euid == 0) // 检测是否是超级用户。 38 | -------------------------------------------------------------------------------- /mission5834/include/linux/kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 'kernel.h' contains some often-used function prototypes etc 3 | */ 4 | /* 5 | * 'kernel.h'定义了一些常用函数的原型等。 6 | */ 7 | // 验证给定地址开始的内存块是否超限。若超限则追加内存。( kernel/fork.c)。 8 | void verify_area (void *addr, int count); 9 | // 显示内核出错信息,然后进入死循环。( kernel/panic.c)。 10 | volatile void panic (const char *str); 11 | // 标准打印(显示)函数。( init/main.c)。 12 | int printf (const char *fmt, ...); 13 | // 内核专用的打印信息函数,功能与printf()相同。( kernel/printk.c)。 14 | int printk (const char *fmt, ...); 15 | // 往tty 上写指定长度的字符串。( kernel/chr_drv/tty_io.c)。 16 | int tty_write (unsigned ch, char *buf, int count); 17 | // 通用内核内存分配函数。( lib/malloc.c)。 18 | void *malloc (unsigned int size); 19 | // 释放指定对象占用的内存。( lib/malloc.c)。 20 | void free_s (void *obj, int size); 21 | 22 | int physical_mem(); 23 | 24 | #define free(x) free_s((x), 0) 25 | 26 | /* 27 | * This is defined as a macro, but at some point this might become a 28 | * real subroutine that sets a flag if it returns true (to do 29 | * BSD-style accounting where the process is flagged if it uses root 30 | * privs). The implication of this is that you should do normal 31 | * permissions checks first, and check suser() last. 32 | */ 33 | /* 34 | * 下面函数是以宏的形式定义的,但是在某方面来看它可以成为一个真正的子程序, 35 | * 如果返回是true 时它将设置标志(如果使用root 用户权限的进程设置了标志,则用 36 | * 于执行BSD 方式的计帐处理)。这意味着你应该首先执行常规权限检查,最后再 37 | * 检测suser()。 38 | */ 39 | #define suser() (current->euid == 0) // 检测是否是超级用户。 40 | -------------------------------------------------------------------------------- /mission5817/lib/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/ctype.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 字符类型头文件。定义了一些有关字符类型判断和转换的宏 8 | 9 | char _ctmp; // 一个临时字符变量,供ctype.h 文件中转换字符宏函数使用。 10 | // 字符特性数组(表),定义了各个字符对应的属性,这些属性类型(如_C 等)在ctype.h 中定义。 11 | // 用于判断字符是控制字符(_C)、大写字符(_U)、小写字符(_L)等所属类型。 12 | unsigned char _ctype[] = {0x00, /* EOF */ 13 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 14 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 15 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 16 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 17 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 18 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 19 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 20 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 21 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 22 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 23 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 24 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 25 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 26 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 27 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 28 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 29 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 30 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 31 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */ 32 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */ 33 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */ 34 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */ 35 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ 36 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ 37 | 38 | -------------------------------------------------------------------------------- /mission5820/lib/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/ctype.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 字符类型头文件。定义了一些有关字符类型判断和转换的宏 8 | 9 | char _ctmp; // 一个临时字符变量,供ctype.h 文件中转换字符宏函数使用。 10 | // 字符特性数组(表),定义了各个字符对应的属性,这些属性类型(如_C 等)在ctype.h 中定义。 11 | // 用于判断字符是控制字符(_C)、大写字符(_U)、小写字符(_L)等所属类型。 12 | unsigned char _ctype[] = {0x00, /* EOF */ 13 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 14 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 15 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 16 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 17 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 18 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 19 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 20 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 21 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 22 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 23 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 24 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 25 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 26 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 27 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 28 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 29 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 30 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 31 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */ 32 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */ 33 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */ 34 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */ 35 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ 36 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ 37 | 38 | -------------------------------------------------------------------------------- /mission5826/lib/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/ctype.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 字符类型头文件。定义了一些有关字符类型判断和转换的宏 8 | 9 | char _ctmp; // 一个临时字符变量,供ctype.h 文件中转换字符宏函数使用。 10 | // 字符特性数组(表),定义了各个字符对应的属性,这些属性类型(如_C 等)在ctype.h 中定义。 11 | // 用于判断字符是控制字符(_C)、大写字符(_U)、小写字符(_L)等所属类型。 12 | unsigned char _ctype[] = {0x00, /* EOF */ 13 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 14 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 15 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 16 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 17 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 18 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 19 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 20 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 21 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 22 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 23 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 24 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 25 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 26 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 27 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 28 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 29 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 30 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 31 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */ 32 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */ 33 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */ 34 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */ 35 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ 36 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ 37 | 38 | -------------------------------------------------------------------------------- /mission5827/lib/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/ctype.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 字符类型头文件。定义了一些有关字符类型判断和转换的宏 8 | 9 | char _ctmp; // 一个临时字符变量,供ctype.h 文件中转换字符宏函数使用。 10 | // 字符特性数组(表),定义了各个字符对应的属性,这些属性类型(如_C 等)在ctype.h 中定义。 11 | // 用于判断字符是控制字符(_C)、大写字符(_U)、小写字符(_L)等所属类型。 12 | unsigned char _ctype[] = {0x00, /* EOF */ 13 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 14 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 15 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 16 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 17 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 18 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 19 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 20 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 21 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 22 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 23 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 24 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 25 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 26 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 27 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 28 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 29 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 30 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 31 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */ 32 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */ 33 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */ 34 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */ 35 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ 36 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ 37 | 38 | -------------------------------------------------------------------------------- /mission5834/lib/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/ctype.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 字符类型头文件。定义了一些有关字符类型判断和转换的宏 8 | 9 | char _ctmp; // 一个临时字符变量,供ctype.h 文件中转换字符宏函数使用。 10 | // 字符特性数组(表),定义了各个字符对应的属性,这些属性类型(如_C 等)在ctype.h 中定义。 11 | // 用于判断字符是控制字符(_C)、大写字符(_U)、小写字符(_L)等所属类型。 12 | unsigned char _ctype[] = {0x00, /* EOF */ 13 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 14 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 15 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 16 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 17 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 18 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 19 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 20 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 21 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 22 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 23 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 24 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 25 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 26 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 27 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 28 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 29 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 30 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 31 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */ 32 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */ 33 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */ 34 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */ 35 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ 36 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ 37 | 38 | -------------------------------------------------------------------------------- /mission5835/lib/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/ctype.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 字符类型头文件。定义了一些有关字符类型判断和转换的宏 8 | 9 | char _ctmp; // 一个临时字符变量,供ctype.h 文件中转换字符宏函数使用。 10 | // 字符特性数组(表),定义了各个字符对应的属性,这些属性类型(如_C 等)在ctype.h 中定义。 11 | // 用于判断字符是控制字符(_C)、大写字符(_U)、小写字符(_L)等所属类型。 12 | unsigned char _ctype[] = {0x00, /* EOF */ 13 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 14 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 15 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 16 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 17 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 18 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 19 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 20 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 21 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 22 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 23 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 24 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 25 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 26 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 27 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 28 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 29 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 30 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 31 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */ 32 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */ 33 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */ 34 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */ 35 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ 36 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ 37 | 38 | -------------------------------------------------------------------------------- /mission5846/lib/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/ctype.c 3 | * 4 | * (C) 1991 Linus Torvalds 5 | */ 6 | 7 | #include // 字符类型头文件。定义了一些有关字符类型判断和转换的宏 8 | 9 | char _ctmp; // 一个临时字符变量,供ctype.h 文件中转换字符宏函数使用。 10 | // 字符特性数组(表),定义了各个字符对应的属性,这些属性类型(如_C 等)在ctype.h 中定义。 11 | // 用于判断字符是控制字符(_C)、大写字符(_U)、小写字符(_L)等所属类型。 12 | unsigned char _ctype[] = {0x00, /* EOF */ 13 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 14 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 15 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 16 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 17 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 18 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 19 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 20 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 21 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 22 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 23 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 24 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 25 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 26 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 27 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 28 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 29 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 30 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 31 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */ 32 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */ 33 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */ 34 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */ 35 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ 36 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ 37 | 38 | -------------------------------------------------------------------------------- /mission5817/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | typedef char *va_list; // 定义va_list 是一个字符指针类型。 5 | 6 | /* Amount of space required in an argument list for an arg of type TYPE. 7 | TYPE may alternatively be an expression whose type is used. */ 8 | /* 下面给出了类型为TYPE 的arg 参数列表所要求的空间容量。 9 | TYPE 也可以是使用该类型的一个表达式 */ 10 | 11 | // 下面这句定义了取整后的TYPE 类型的字节长度值。是int 长度(4)的倍数。 12 | #define __va_rounded_size(TYPE) \ 13 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) 14 | 15 | // 下面这个函数(用宏实现)使AP 指向传给函数的可变参数表的第一个参数。 16 | // 在第一次调用va_arg 或va_end 之前,必须首先调用该函数。 17 | // 下面的__builtin_saveregs()是在gcc 的库程序libgcc2.c 中定义的,用于保存寄存器。 18 | // 它的说明可参见gcc 手册章节“Target Description Macros”中的 19 | // “Implementing the Varargs Macros”小节。 20 | #ifndef __sparc__ 21 | #define va_start(AP, LASTARG) \ 22 | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 23 | #else 24 | #define va_start(AP, LASTARG) \ 25 | (__builtin_saveregs (), \ 26 | AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 27 | #endif 28 | 29 | // 下面该宏用于被调用函数完成一次正常返回。va_end 可以修改AP 使其在重新调用 30 | // va_start 之前不能被使用。va_end 必须在va_arg 读完所有的参数后再被调用。 31 | void va_end (va_list); /* Defined in gnulib *//* 在gnulib 中定义 */ 32 | #define va_end(AP) 33 | 34 | // 下面该宏用于扩展表达式使其与下一个被传递参数具有相同的类型和值。 35 | // 对于缺省值,va_arg 可以用字符、无符号字符和浮点类型。 36 | // 在第一次使用va_arg 时,它返回表中的第一个参数,后续的每次调用都将返回表中的 37 | // 下一个参数。这是通过先访问AP,然后把它增加以指向下一项来实现的。 38 | // va_arg 使用TYPE 来完成访问和定位下一项,每调用一次va_arg,它就修改AP 以指示 39 | // 表中的下一参数。 40 | #define va_arg(AP, TYPE) \ 41 | (AP += __va_rounded_size (TYPE), \ 42 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) 43 | 44 | #endif /* _STDARG_H */ 45 | -------------------------------------------------------------------------------- /mission5820/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | typedef char *va_list; // 定义va_list 是一个字符指针类型。 5 | 6 | /* Amount of space required in an argument list for an arg of type TYPE. 7 | TYPE may alternatively be an expression whose type is used. */ 8 | /* 下面给出了类型为TYPE 的arg 参数列表所要求的空间容量。 9 | TYPE 也可以是使用该类型的一个表达式 */ 10 | 11 | // 下面这句定义了取整后的TYPE 类型的字节长度值。是int 长度(4)的倍数。 12 | #define __va_rounded_size(TYPE) \ 13 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) 14 | 15 | // 下面这个函数(用宏实现)使AP 指向传给函数的可变参数表的第一个参数。 16 | // 在第一次调用va_arg 或va_end 之前,必须首先调用该函数。 17 | // 下面的__builtin_saveregs()是在gcc 的库程序libgcc2.c 中定义的,用于保存寄存器。 18 | // 它的说明可参见gcc 手册章节“Target Description Macros”中的 19 | // “Implementing the Varargs Macros”小节。 20 | #ifndef __sparc__ 21 | #define va_start(AP, LASTARG) \ 22 | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 23 | #else 24 | #define va_start(AP, LASTARG) \ 25 | (__builtin_saveregs (), \ 26 | AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 27 | #endif 28 | 29 | // 下面该宏用于被调用函数完成一次正常返回。va_end 可以修改AP 使其在重新调用 30 | // va_start 之前不能被使用。va_end 必须在va_arg 读完所有的参数后再被调用。 31 | void va_end (va_list); /* Defined in gnulib *//* 在gnulib 中定义 */ 32 | #define va_end(AP) 33 | 34 | // 下面该宏用于扩展表达式使其与下一个被传递参数具有相同的类型和值。 35 | // 对于缺省值,va_arg 可以用字符、无符号字符和浮点类型。 36 | // 在第一次使用va_arg 时,它返回表中的第一个参数,后续的每次调用都将返回表中的 37 | // 下一个参数。这是通过先访问AP,然后把它增加以指向下一项来实现的。 38 | // va_arg 使用TYPE 来完成访问和定位下一项,每调用一次va_arg,它就修改AP 以指示 39 | // 表中的下一参数。 40 | #define va_arg(AP, TYPE) \ 41 | (AP += __va_rounded_size (TYPE), \ 42 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) 43 | 44 | #endif /* _STDARG_H */ 45 | -------------------------------------------------------------------------------- /mission5826/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | typedef char *va_list; // 定义va_list 是一个字符指针类型。 5 | 6 | /* Amount of space required in an argument list for an arg of type TYPE. 7 | TYPE may alternatively be an expression whose type is used. */ 8 | /* 下面给出了类型为TYPE 的arg 参数列表所要求的空间容量。 9 | TYPE 也可以是使用该类型的一个表达式 */ 10 | 11 | // 下面这句定义了取整后的TYPE 类型的字节长度值。是int 长度(4)的倍数。 12 | #define __va_rounded_size(TYPE) \ 13 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) 14 | 15 | // 下面这个函数(用宏实现)使AP 指向传给函数的可变参数表的第一个参数。 16 | // 在第一次调用va_arg 或va_end 之前,必须首先调用该函数。 17 | // 下面的__builtin_saveregs()是在gcc 的库程序libgcc2.c 中定义的,用于保存寄存器。 18 | // 它的说明可参见gcc 手册章节“Target Description Macros”中的 19 | // “Implementing the Varargs Macros”小节。 20 | #ifndef __sparc__ 21 | #define va_start(AP, LASTARG) \ 22 | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 23 | #else 24 | #define va_start(AP, LASTARG) \ 25 | (__builtin_saveregs (), \ 26 | AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 27 | #endif 28 | 29 | // 下面该宏用于被调用函数完成一次正常返回。va_end 可以修改AP 使其在重新调用 30 | // va_start 之前不能被使用。va_end 必须在va_arg 读完所有的参数后再被调用。 31 | void va_end (va_list); /* Defined in gnulib *//* 在gnulib 中定义 */ 32 | #define va_end(AP) 33 | 34 | // 下面该宏用于扩展表达式使其与下一个被传递参数具有相同的类型和值。 35 | // 对于缺省值,va_arg 可以用字符、无符号字符和浮点类型。 36 | // 在第一次使用va_arg 时,它返回表中的第一个参数,后续的每次调用都将返回表中的 37 | // 下一个参数。这是通过先访问AP,然后把它增加以指向下一项来实现的。 38 | // va_arg 使用TYPE 来完成访问和定位下一项,每调用一次va_arg,它就修改AP 以指示 39 | // 表中的下一参数。 40 | #define va_arg(AP, TYPE) \ 41 | (AP += __va_rounded_size (TYPE), \ 42 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) 43 | 44 | #endif /* _STDARG_H */ 45 | -------------------------------------------------------------------------------- /mission5827/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | typedef char *va_list; // 定义va_list 是一个字符指针类型。 5 | 6 | /* Amount of space required in an argument list for an arg of type TYPE. 7 | TYPE may alternatively be an expression whose type is used. */ 8 | /* 下面给出了类型为TYPE 的arg 参数列表所要求的空间容量。 9 | TYPE 也可以是使用该类型的一个表达式 */ 10 | 11 | // 下面这句定义了取整后的TYPE 类型的字节长度值。是int 长度(4)的倍数。 12 | #define __va_rounded_size(TYPE) \ 13 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) 14 | 15 | // 下面这个函数(用宏实现)使AP 指向传给函数的可变参数表的第一个参数。 16 | // 在第一次调用va_arg 或va_end 之前,必须首先调用该函数。 17 | // 下面的__builtin_saveregs()是在gcc 的库程序libgcc2.c 中定义的,用于保存寄存器。 18 | // 它的说明可参见gcc 手册章节“Target Description Macros”中的 19 | // “Implementing the Varargs Macros”小节。 20 | #ifndef __sparc__ 21 | #define va_start(AP, LASTARG) \ 22 | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 23 | #else 24 | #define va_start(AP, LASTARG) \ 25 | (__builtin_saveregs (), \ 26 | AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 27 | #endif 28 | 29 | // 下面该宏用于被调用函数完成一次正常返回。va_end 可以修改AP 使其在重新调用 30 | // va_start 之前不能被使用。va_end 必须在va_arg 读完所有的参数后再被调用。 31 | void va_end (va_list); /* Defined in gnulib *//* 在gnulib 中定义 */ 32 | #define va_end(AP) 33 | 34 | // 下面该宏用于扩展表达式使其与下一个被传递参数具有相同的类型和值。 35 | // 对于缺省值,va_arg 可以用字符、无符号字符和浮点类型。 36 | // 在第一次使用va_arg 时,它返回表中的第一个参数,后续的每次调用都将返回表中的 37 | // 下一个参数。这是通过先访问AP,然后把它增加以指向下一项来实现的。 38 | // va_arg 使用TYPE 来完成访问和定位下一项,每调用一次va_arg,它就修改AP 以指示 39 | // 表中的下一参数。 40 | #define va_arg(AP, TYPE) \ 41 | (AP += __va_rounded_size (TYPE), \ 42 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) 43 | 44 | #endif /* _STDARG_H */ 45 | -------------------------------------------------------------------------------- /mission5834/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | typedef char *va_list; // 定义va_list 是一个字符指针类型。 5 | 6 | /* Amount of space required in an argument list for an arg of type TYPE. 7 | TYPE may alternatively be an expression whose type is used. */ 8 | /* 下面给出了类型为TYPE 的arg 参数列表所要求的空间容量。 9 | TYPE 也可以是使用该类型的一个表达式 */ 10 | 11 | // 下面这句定义了取整后的TYPE 类型的字节长度值。是int 长度(4)的倍数。 12 | #define __va_rounded_size(TYPE) \ 13 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) 14 | 15 | // 下面这个函数(用宏实现)使AP 指向传给函数的可变参数表的第一个参数。 16 | // 在第一次调用va_arg 或va_end 之前,必须首先调用该函数。 17 | // 下面的__builtin_saveregs()是在gcc 的库程序libgcc2.c 中定义的,用于保存寄存器。 18 | // 它的说明可参见gcc 手册章节“Target Description Macros”中的 19 | // “Implementing the Varargs Macros”小节。 20 | #ifndef __sparc__ 21 | #define va_start(AP, LASTARG) \ 22 | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 23 | #else 24 | #define va_start(AP, LASTARG) \ 25 | (__builtin_saveregs (), \ 26 | AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 27 | #endif 28 | 29 | // 下面该宏用于被调用函数完成一次正常返回。va_end 可以修改AP 使其在重新调用 30 | // va_start 之前不能被使用。va_end 必须在va_arg 读完所有的参数后再被调用。 31 | void va_end (va_list); /* Defined in gnulib *//* 在gnulib 中定义 */ 32 | #define va_end(AP) 33 | 34 | // 下面该宏用于扩展表达式使其与下一个被传递参数具有相同的类型和值。 35 | // 对于缺省值,va_arg 可以用字符、无符号字符和浮点类型。 36 | // 在第一次使用va_arg 时,它返回表中的第一个参数,后续的每次调用都将返回表中的 37 | // 下一个参数。这是通过先访问AP,然后把它增加以指向下一项来实现的。 38 | // va_arg 使用TYPE 来完成访问和定位下一项,每调用一次va_arg,它就修改AP 以指示 39 | // 表中的下一参数。 40 | #define va_arg(AP, TYPE) \ 41 | (AP += __va_rounded_size (TYPE), \ 42 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) 43 | 44 | #endif /* _STDARG_H */ 45 | -------------------------------------------------------------------------------- /mission5835/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | typedef char *va_list; // 定义va_list 是一个字符指针类型。 5 | 6 | /* Amount of space required in an argument list for an arg of type TYPE. 7 | TYPE may alternatively be an expression whose type is used. */ 8 | /* 下面给出了类型为TYPE 的arg 参数列表所要求的空间容量。 9 | TYPE 也可以是使用该类型的一个表达式 */ 10 | 11 | // 下面这句定义了取整后的TYPE 类型的字节长度值。是int 长度(4)的倍数。 12 | #define __va_rounded_size(TYPE) \ 13 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) 14 | 15 | // 下面这个函数(用宏实现)使AP 指向传给函数的可变参数表的第一个参数。 16 | // 在第一次调用va_arg 或va_end 之前,必须首先调用该函数。 17 | // 下面的__builtin_saveregs()是在gcc 的库程序libgcc2.c 中定义的,用于保存寄存器。 18 | // 它的说明可参见gcc 手册章节“Target Description Macros”中的 19 | // “Implementing the Varargs Macros”小节。 20 | #ifndef __sparc__ 21 | #define va_start(AP, LASTARG) \ 22 | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 23 | #else 24 | #define va_start(AP, LASTARG) \ 25 | (__builtin_saveregs (), \ 26 | AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 27 | #endif 28 | 29 | // 下面该宏用于被调用函数完成一次正常返回。va_end 可以修改AP 使其在重新调用 30 | // va_start 之前不能被使用。va_end 必须在va_arg 读完所有的参数后再被调用。 31 | void va_end (va_list); /* Defined in gnulib *//* 在gnulib 中定义 */ 32 | #define va_end(AP) 33 | 34 | // 下面该宏用于扩展表达式使其与下一个被传递参数具有相同的类型和值。 35 | // 对于缺省值,va_arg 可以用字符、无符号字符和浮点类型。 36 | // 在第一次使用va_arg 时,它返回表中的第一个参数,后续的每次调用都将返回表中的 37 | // 下一个参数。这是通过先访问AP,然后把它增加以指向下一项来实现的。 38 | // va_arg 使用TYPE 来完成访问和定位下一项,每调用一次va_arg,它就修改AP 以指示 39 | // 表中的下一参数。 40 | #define va_arg(AP, TYPE) \ 41 | (AP += __va_rounded_size (TYPE), \ 42 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) 43 | 44 | #endif /* _STDARG_H */ 45 | -------------------------------------------------------------------------------- /mission5846/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | typedef char *va_list; // 定义va_list 是一个字符指针类型。 5 | 6 | /* Amount of space required in an argument list for an arg of type TYPE. 7 | TYPE may alternatively be an expression whose type is used. */ 8 | /* 下面给出了类型为TYPE 的arg 参数列表所要求的空间容量。 9 | TYPE 也可以是使用该类型的一个表达式 */ 10 | 11 | // 下面这句定义了取整后的TYPE 类型的字节长度值。是int 长度(4)的倍数。 12 | #define __va_rounded_size(TYPE) \ 13 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) 14 | 15 | // 下面这个函数(用宏实现)使AP 指向传给函数的可变参数表的第一个参数。 16 | // 在第一次调用va_arg 或va_end 之前,必须首先调用该函数。 17 | // 下面的__builtin_saveregs()是在gcc 的库程序libgcc2.c 中定义的,用于保存寄存器。 18 | // 它的说明可参见gcc 手册章节“Target Description Macros”中的 19 | // “Implementing the Varargs Macros”小节。 20 | #ifndef __sparc__ 21 | #define va_start(AP, LASTARG) \ 22 | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 23 | #else 24 | #define va_start(AP, LASTARG) \ 25 | (__builtin_saveregs (), \ 26 | AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) 27 | #endif 28 | 29 | // 下面该宏用于被调用函数完成一次正常返回。va_end 可以修改AP 使其在重新调用 30 | // va_start 之前不能被使用。va_end 必须在va_arg 读完所有的参数后再被调用。 31 | void va_end (va_list); /* Defined in gnulib *//* 在gnulib 中定义 */ 32 | #define va_end(AP) 33 | 34 | // 下面该宏用于扩展表达式使其与下一个被传递参数具有相同的类型和值。 35 | // 对于缺省值,va_arg 可以用字符、无符号字符和浮点类型。 36 | // 在第一次使用va_arg 时,它返回表中的第一个参数,后续的每次调用都将返回表中的 37 | // 下一个参数。这是通过先访问AP,然后把它增加以指向下一项来实现的。 38 | // va_arg 使用TYPE 来完成访问和定位下一项,每调用一次va_arg,它就修改AP 以指示 39 | // 表中的下一参数。 40 | #define va_arg(AP, TYPE) \ 41 | (AP += __va_rounded_size (TYPE), \ 42 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) 43 | 44 | #endif /* _STDARG_H */ 45 | -------------------------------------------------------------------------------- /mission5817/include/time.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIME_H 2 | #define _TIME_H 3 | 4 | #ifndef _TIME_T 5 | #define _TIME_T 6 | typedef long time_t; // 从GMT 1970 年1 月1 日开始的以秒计数的时间(日历时间)。 7 | #endif 8 | 9 | #ifndef _SIZE_T 10 | #define _SIZE_T 11 | typedef unsigned int size_t; 12 | #endif 13 | 14 | #define CLOCKS_PER_SEC 100 // 系统时钟滴答频率,100HZ。 15 | 16 | typedef long clock_t; // 从进程开始系统经过的时钟滴答数。 17 | 18 | struct tm 19 | { 20 | int tm_sec; // 秒数 [0,59]。 21 | int tm_min; // 分钟数 [ 0,59]。 22 | int tm_hour; // 小时数 [0,59]。 23 | int tm_mday; // 1 个月的天数 [0,31]。 24 | int tm_mon; // 1 年中月份 [0,11]。 25 | int tm_year; // 从1900 年开始的年数。 26 | int tm_wday; // 1 星期中的某天 [0,6](星期天 =0)。 27 | int tm_yday; // 1 年中的某天 [0,365]。 28 | int tm_isdst; // 夏令时标志。 29 | }; 30 | 31 | // 以下是有关时间操作的函数原型。 32 | // 确定处理器使用时间。返回程序所用处理器时间(滴答数)的近似值。 33 | clock_t clock (void); 34 | // 取时间(秒数)。返回从1970.1.1:0:0:0 开始的秒数(称为日历时间)。 35 | time_t time (time_t * tp); 36 | // 计算时间差。返回时间time2 与time1 之间经过的秒数。 37 | double difftime (time_t time2, time_t time1); 38 | // 将tm 结构表示的时间转换成日历时间。 39 | time_t mktime (struct tm *tp); 40 | 41 | // 将tm 结构表示的时间转换成一个字符串。返回指向该串的指针。 42 | char *asctime (const struct tm *tp); 43 | // 将日历时间转换成一个字符串形式,如“Wed Jun 30 21:49:08:1993\n”。 44 | char *ctime (const time_t * tp); 45 | // 将日历时间转换成tm 结构表示的UTC 时间(UTC - 世界时间代码Universal Time Code)。 46 | struct tm *gmtime (const time_t * tp); 47 | // 将日历时间转换成tm 结构表示的指定时间区(timezone)的时间。 48 | struct tm *localtime (const time_t * tp); 49 | // 将tm 结构表示的时间利用格式字符串fmt 转换成最大长度为smax 的字符串并将结果存储在s 中。 50 | size_t strftime (char *s, size_t smax, const char *fmt, const struct tm *tp); 51 | // 初始化时间转换信息,使用环境变量TZ,对zname 变量进行初始化。 52 | // 在与时间区相关的时间转换函数中将自动调用该函数。 53 | void tzset (void); 54 | 55 | #endif 56 | --------------------------------------------------------------------------------