多进程

修改后的如下chapter6E的Makefile如下所示如下

#########################
# Makefile for Orange'S #
########################## Entry point of Orange'S
# It must have the same value with 'KernelEntryPointPhyAddr' in load.inc!
ENTRYPOINT  = 0x30400# Offset of entry point in kernel file
# It depends on ENTRYPOINT
ENTRYOFFSET =   0x400# Programs, flags, etc.
ASM     = nasm
DASM        = ndisasm
CC      = gcc
LD      = ld
ASMBFLAGS   = -I boot/include/
ASMKFLAGS   = -I include/ -f elf
CFLAGS      = -I include/ -c -fno-builtin -m32 -fno-stack-protector
LDFLAGS = -s -Ttext $(ENTRYPOINT) -m elf_i386
DASMFLAGS   = -u -o $(ENTRYPOINT) -e $(ENTRYOFFSET)# This Program
ORANGESBOOT = boot/boot.bin boot/loader.bin
ORANGESKERNEL   = kernel.bin
OBJS        = kernel/kernel.o kernel/start.o kernel/main.o kernel/clock.o\kernel/i8259.o kernel/global.o kernel/protect.o\lib/kliba.o lib/klib.o lib/string.o
DASMOUTPUT  = kernel.bin.asmIMG:=a.img
# All Phony Targets
.PHONY : everything final image clean realclean disasm all buildimg# Default starting position
everything : $(ORANGESBOOT) $(ORANGESKERNEL)all : realclean everythingimage : realclean everything clean buildimgclean :rm -f $(OBJS)realclean :rm -f $(OBJS) $(ORANGESBOOT) $(ORANGESKERNEL)disasm :$(DASM) $(DASMFLAGS) $(ORANGESKERNEL) > $(DASMOUTPUT)# We assume that "a.img" exists in current folder
buildimg :dd if=boot/boot.bin of=a.img bs=512 count=1 conv=notruncsudo mount -o loop a.img /mnt/floppy/sudo cp -fv boot/loader.bin /mnt/floppy/sudo cp -fv kernel.bin /mnt/floppysudo umount /mnt/floppycreateFp :bximage -mode=create -fd=1.44M -q $(IMG)qemu :qemu-system-i386 -fda $(IMG)boot/boot.bin : boot/boot.asm boot/include/load.inc boot/include/fat12hdr.inc$(ASM) $(ASMBFLAGS) -o $@ $<boot/loader.bin : boot/loader.asm boot/include/load.inc boot/include/fat12hdr.inc boot/include/pm.inc$(ASM) $(ASMBFLAGS) -o $@ $<$(ORANGESKERNEL) : $(OBJS)$(LD) $(LDFLAGS) -o $(ORANGESKERNEL) $(OBJS)kernel/kernel.o : kernel/kernel.asm include/sconst.inc$(ASM) $(ASMKFLAGS) -o $@ $<kernel/start.o: kernel/start.c include/type.h include/const.h include/protect.h include/string.h include/proc.h include/proto.h \include/global.h$(CC) $(CFLAGS) -o $@ $<kernel/main.o: kernel/main.c include/type.h include/const.h include/protect.h include/string.h include/proc.h include/proto.h \include/global.h$(CC) $(CFLAGS) -o $@ $<kernel/clock.o: kernel/clock.c$(CC) $(CFLAGS) -o $@ $<kernel/i8259.o: kernel/i8259.c include/type.h include/const.h include/protect.h include/proto.h$(CC) $(CFLAGS) -o $@ $<kernel/global.o: kernel/global.c include/type.h include/const.h include/protect.h include/proc.h \include/global.h include/proto.h$(CC) $(CFLAGS) -o $@ $<kernel/protect.o: kernel/protect.c include/type.h include/const.h include/protect.h include/proc.h include/proto.h \include/global.h$(CC) $(CFLAGS) -o $@ $<lib/klib.o: lib/klib.c include/type.h include/const.h include/protect.h include/string.h include/proc.h include/proto.h \include/global.h$(CC) $(CFLAGS) -o $@ $<lib/kliba.o : lib/kliba.asm$(ASM) $(ASMKFLAGS) -o $@ $<lib/string.o : lib/string.asm$(ASM) $(ASMKFLAGS) -o $@ $<

运行过程如下所示:

as@as-virtual-machine:~/osdir/chapter6E$ make clean
rm -f kernel/kernel.o kernel/start.o kernel/main.o kernel/clock.o kernel/i8259.o kernel/global.o kernel/protect.o lib/kliba.o lib/klib.o lib/string.o
as@as-virtual-machine:~/osdir/chapter6E$ make createFP
make: *** No rule to make target 'createFP'.  Stop.
as@as-virtual-machine:~/osdir/chapter6E$ make createFp
bximage -mode=create -fd=1.44M -q a.img
========================================================================bximageDisk Image Creation / Conversion / Resize and Commit Tool for Bochs$Id: bximage.cc 13481 2018-03-30 21:04:04Z vruppert $
========================================================================Creating floppy image 'a.img' with 2880 sectorsThe following line should appear in your bochsrc:floppya: image="a.img", status=inserted
as@as-virtual-machine:~/osdir/chapter6E$ make everything
nasm -I boot/include/ -o boot/boot.bin boot/boot.asm
nasm -I boot/include/ -o boot/loader.bin boot/loader.asm
nasm -I include/ -f elf -o kernel/kernel.o kernel/kernel.asm
gcc -I include/ -c -fno-builtin -m32 -fno-stack-protector -o kernel/start.o kernel/start.c
gcc -I include/ -c -fno-builtin -m32 -fno-stack-protector -o kernel/main.o kernel/main.c
kernel/main.c: In function ‘kernel_main’:
kernel/main.c:30:3: warning: implicit declaration of function ‘strcpy’ [-Wimplicit-function-declaration]30 |   strcpy(p_proc->p_name, p_task->name); // name of the process|   ^~~~~~
kernel/main.c:15:1: note: ‘strcpy’ is defined in header ‘<string.h>’; did you forget to ‘#include <string.h>’?14 | #include "global.h"+++ |+#include <string.h>15 |
kernel/main.c: In function ‘TestA’:
kernel/main.c:80:3: warning: implicit declaration of function ‘disp_int’ [-Wimplicit-function-declaration]80 |   disp_int(i++);|   ^~~~~~~~
gcc -I include/ -c -fno-builtin -m32 -fno-stack-protector -o kernel/clock.o kernel/clock.c
gcc -I include/ -c -fno-builtin -m32 -fno-stack-protector -o kernel/i8259.o kernel/i8259.c
kernel/i8259.c: In function ‘spurious_irq’:
kernel/i8259.c:39:2: warning: implicit declaration of function ‘disp_int’ [-Wimplicit-function-declaration]39 |  disp_int(irq);|  ^~~~~~~~
gcc -I include/ -c -fno-builtin -m32 -fno-stack-protector -o kernel/global.o kernel/global.c
gcc -I include/ -c -fno-builtin -m32 -fno-stack-protector -o kernel/protect.o kernel/protect.c
kernel/protect.c: In function ‘init_prot’:
kernel/protect.c:63:2: warning: implicit declaration of function ‘init_8259A’ [-Wimplicit-function-declaration]63 |  init_8259A();|  ^~~~~~~~~~
kernel/protect.c:100:2: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]100 |  memset(&tss, 0, sizeof(tss));|  ^~~~~~
kernel/protect.c:14:1: note: ‘memset’ is defined in header ‘<string.h>’; did you forget to ‘#include <string.h>’?13 | #include "global.h"+++ |+#include <string.h>14 |
kernel/protect.c: In function ‘exception_handler’:
kernel/protect.c:211:2: warning: implicit declaration of function ‘disp_int’ [-Wimplicit-function-declaration]211 |  disp_int(eflags);|  ^~~~~~~~
nasm -I include/ -f elf -o lib/kliba.o lib/kliba.asm
gcc -I include/ -c -fno-builtin -m32 -fno-stack-protector -o lib/klib.o lib/klib.c
nasm -I include/ -f elf -o lib/string.o lib/string.asm
ld -s -Ttext 0x30400 -m elf_i386 -o kernel.bin kernel/kernel.o kernel/start.o kernel/main.o kernel/clock.o kernel/i8259.o kernel/global.o kernel/protect.o lib/kliba.o lib/klib.o lib/string.o
as@as-virtual-machine:~/osdir/chapter6E$ make buildimg
dd if=boot/boot.bin of=a.img bs=512 count=1 conv=notrunc
1+0 records in
1+0 records out
512 bytes copied, 0.00043859 s, 1.2 MB/s
sudo mount -o loop a.img /mnt/floppy/
[sudo] password for as:
sudo cp -fv boot/loader.bin /mnt/floppy/
'boot/loader.bin' -> '/mnt/floppy/loader.bin'
sudo cp -fv kernel.bin /mnt/floppy
'kernel.bin' -> '/mnt/floppy/kernel.bin'
sudo umount /mnt/floppy
as@as-virtual-machine:~/osdir/chapter6E$ make qemu
qemu-system-i386 -fda a.img
WARNING: Image format was not specified for 'a.img' and probing guessed raw.Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.Specify the 'raw' format explicitly to remove the restrictions.

运行结果如下所示

与原书中图6.18基本一致。

【日拱一卒行而不辍20221010】自制操作系统相关推荐

  1. 【日拱一卒行而不辍20220926】自制操作系统

    分页原理 在汇编文件chapter3/f/pmtest6.asm中,关于分页设置的代码如下. 此时还未开启多进程,仅有的一个进程中这个表有什么作用吗?页表需要进行切换吗? 每一个进程都会形成这样一个完 ...

  2. 【日拱一卒行而不辍20220921】自制操作系统

    8086内存安排 8086实模式的寻址范围只有1MB.其中: 系统硬件使用的存储器地址被安排在高端,地址从0xA0000H(684KB)开始的384KB中,其中有用于显示的视频缓冲区: 内存低端安排了 ...

  3. 【日拱一卒行而不辍20220925】自制操作系统

    下面这段系统联调的代码始终没有调通.需要进一步排查. 在汇编层面,下述代码已经进入了综合的深水区. ; ========================================== ; pmt ...

  4. 【日拱一卒行而不辍20220924】自制操作系统

    8086内存地址变换过程 80x86在从逻辑地址到物理地址变换过程中使用了分段和分页二种机制. 第一阶段使用分段机制将程序的逻辑地址变换成可寻址内存空间的线性地址. 第二阶段用分页机制把线性地址转换成 ...

  5. 日拱一卒,功不唐捐 | 每日思考俱乐部 专栏更新通知

    缘起 在 2019 年七月份,我写了一篇文章<我为什么要写反思录>.文中提到了我做记录和思考的初衷,起初写在了自己的私密仓库中,也就是其他人都看不到. 持续了一段时间后,我发现,没有分享的 ...

  6. 日拱一卒,“功不唐捐

    据说,世界上只有两种动物能够登上金字塔顶,一种是老鹰,一种是蜗牛.他们是如此不同,老鹰矫健,敏捷,蜗牛弱小,迟钝,可是蜗牛仍然与老鹰一样能达到金字塔顶端.它凭的就是永不停息的执着精神. "日 ...

  7. 社区人物志|李昊鹏:日拱一卒,功不唐捐

    「社区人物志」是 Apache Doris 社区推出的系列专栏,我们关注每一个对 Doris 做出过贡献的 Contributor ,会定期从对 Doris 做出突出贡献的小伙伴中选出一位「社区之星」 ...

  8. #研发解决方案#大数据协作平台魔盒——日拱一卒,功不唐捐

    郑昀 创建于2017/6/29 最后更新于2017/6/30 关键词:大数据,Spark,SparkSQL,HBase,HDFS,工作流,任务,Flow,Job,监控报警 提纲: 为什么要大数据协作? ...

  9. 日拱一卒,集小胜为大胜; 学以致用,在战争中学习战争;

    项目,证明自己的学习能力: 短期掌握尽可能多的知识,并且连线总结成为网络 : 日拱一卒,集小胜为大胜: 学以致用,在战争中学习战争: 投入足够的时间: 学习中的总结,理解 ,应用,等编程套路: 目的性 ...

最新文章

  1. node-serialport —— Node.js 串口数据读写包
  2. malloc线程安全
  3. 设置iis网页服务器cpu占比,为什么iis的一个线程池占了100%cpu
  4. ADF BC:创建绑定到业务组件的UI表
  5. mysql备份管家婆_管家婆怎么恢复数据,备份数据
  6. 超好玩的msn自制动画头像
  7. 郭盛华:互联网安全可能是下一个热门投资主题
  8. 电动自行车UL认证安全标准UL2849
  9. 关于SharePoint中文翻译的吐槽
  10. 毕业4年年薪200万是怎样的一种体验?
  11. 酒店标识的要求不同其设计也不同
  12. 微服务资源库太强了,学习手册限时开源
  13. 入门级蓝牙遥控小车制作教程
  14. KVM-虚拟化技术之Hypervisor-架构
  15. 电子信息 物联网 微电子等专业毕业设计选题表1-20
  16. 体验真真的webQQ
  17. 常用汉字的UNICODE和对应的繁体字
  18. 【VB与数据库】——机房收费系统之结账
  19. centios修改盘符
  20. 【数据结构】链表:看我如何顺藤摸瓜

热门文章

  1. Java实现多重继承
  2. Apollo(一)-基本介绍
  3. performance性能监控
  4. 安全设计 -- 会话安全
  5. 数据分析报告常见步骤
  6. 2021-2027全球与中国射频屏蔽窗市场现状及未来发展趋势
  7. TM1650读取按键值异常
  8. FTP协议(指令集)
  9. confluence 删除_知识管理平台Confluence教程:如何删除或还原页面?
  10. 顺序表的基本操作——初始化表