Skip to content

Commit

Permalink
modify README.md move devel directory to top
Browse files Browse the repository at this point in the history
  • Loading branch information
yifengyou committed May 9, 2018
1 parent cc84d42 commit 767b23c
Show file tree
Hide file tree
Showing 125 changed files with 12,321 additions and 0 deletions.
Binary file added c99-div/a.tar.gz
Binary file not shown.
46 changes: 46 additions & 0 deletions c99-div/a/bochsrc.disk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
###############################################
# Configuration file for Bochs
###############################################

# 第一步,首先设置Bochs在运行过程中能够使用的内存,本例为32MB。
# 关键字为:megs

megs: 32

# 第二步,设置对应真实机器的BIOS和VGA BIOS.
# 对应两个关键字为:romimage 和 vgaromimage

#romimage: file=/home/work/bochs/share/bochs/BIOS-bochs-latest
#vgaromimage: file=/home/work/bochs/share/bochs/VGABIOS-lgpl-latest
#romimage: file=/usr/local//Cellar/bochs/2.6.1/share/bochs/BIOS-bochs-latest
#romimage: file=/usr/local/Cellar/bochs/2.6.8/share/bochs/BIOS-bochs-latest
romimage: file=/usr/share/bochs/BIOS-bochs-latest
#vgaromimage: file=/usr/local//Cellar/bochs/2.6.1/share/bochs/VGABIOS-lgpl-latest
#vgaromimage: file=/usr/local//Cellar/bochs/2.6.8/share/bochs/VGABIOS-lgpl-latest
vgaromimage: file=/usr/share/vgabios/vgabios.bin

# 第三步,设置Bochs所使用的磁盘,软盘的关键字为floppy。
# 若只有一个软盘,则使用floppya即可,若有多个,则为floppya,floppyb...
#floppya: 1_44=a.img, status=inserted

# 第四步,选择启动盘符。
#boot: floppy
boot: disk

# 第五步,设置日志文件的输出。
log: log.bochsrc.disk

# 第六步,开启或关闭某些功能。
# 下面是关闭鼠标,并打开键盘。
mouse: enabled=0
#keyboard_mapping: enabled=1, map=/home/work/bochs/share/bochs/keymaps/x11-pc-us.map
#keyboard_mapping: enabled=1, map=/usr/local//Cellar/bochs/2.6.8/share/bochs/keymaps/x11-pc-us.map
#keyboard:keymap=/usr/local//Cellar/bochs/2.6.8/share/bochs/keymaps/x11-pc-us.map
keyboard_mapping: enabled=1, map=/usr/share/bochs/keymaps/x11-pc-us.map

# 硬盘设置
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="hd3M.img", mode=flat, cylinders=6, heads=16, spt=63
ata0-slave: type=disk, path="hd50M.img", mode=flat, cylinders=101, heads=16, spt=63

#gdbstub: enabled=1, port=1234, text_base=0, data_base=0, bss_base=0
56 changes: 56 additions & 0 deletions c99-div/a/boot/include/boot.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
;------------- loader和kernel ----------

LOADER_BASE_ADDR equ 0x900
LOADER_STACK_TOP equ LOADER_BASE_ADDR
LOADER_START_SECTOR equ 0x2

KERNEL_BIN_BASE_ADDR equ 0x70000
KERNEL_START_SECTOR equ 0x9
KERNEL_ENTRY_POINT equ 0xc0001500

;------------- 页表配置 ----------------
PAGE_DIR_TABLE_POS equ 0x100000

;-------------- gdt描述符属性 -----------
DESC_G_4K equ 1_00000000000000000000000b
DESC_D_32 equ 1_0000000000000000000000b
DESC_L equ 0_000000000000000000000b ; 64位代码标记,此处标记为0便可。
DESC_AVL equ 0_00000000000000000000b ; cpu不用此位,暂置为0
DESC_LIMIT_CODE2 equ 1111_0000000000000000b
DESC_LIMIT_DATA2 equ DESC_LIMIT_CODE2
DESC_LIMIT_VIDEO2 equ 0000_000000000000000b
DESC_P equ 1_000000000000000b
DESC_DPL_0 equ 00_0000000000000b
DESC_DPL_1 equ 01_0000000000000b
DESC_DPL_2 equ 10_0000000000000b
DESC_DPL_3 equ 11_0000000000000b
DESC_S_CODE equ 1_000000000000b
DESC_S_DATA equ DESC_S_CODE
DESC_S_sys equ 0_000000000000b
DESC_TYPE_CODE equ 1000_00000000b ;x=1,c=0,r=0,a=0 代码段是可执行的,非依从的,不可读的,已访问位a清0.
DESC_TYPE_DATA equ 0010_00000000b ;x=0,e=0,w=1,a=0 数据段是不可执行的,向上扩展的,可写的,已访问位a清0.

DESC_CODE_HIGH4 equ (0x00 << 24) + DESC_G_4K + DESC_D_32 + DESC_L + DESC_AVL + DESC_LIMIT_CODE2 + DESC_P + DESC_DPL_0 + DESC_S_CODE + DESC_TYPE_CODE + 0x00
DESC_DATA_HIGH4 equ (0x00 << 24) + DESC_G_4K + DESC_D_32 + DESC_L + DESC_AVL + DESC_LIMIT_DATA2 + DESC_P + DESC_DPL_0 + DESC_S_DATA + DESC_TYPE_DATA + 0x00
DESC_VIDEO_HIGH4 equ (0x00 << 24) + DESC_G_4K + DESC_D_32 + DESC_L + DESC_AVL + DESC_LIMIT_VIDEO2 + DESC_P + DESC_DPL_0 + DESC_S_DATA + DESC_TYPE_DATA + 0x0b

;-------------- 选择子属性 ---------------
RPL0 equ 00b
RPL1 equ 01b
RPL2 equ 10b
RPL3 equ 11b
TI_GDT equ 000b
TI_LDT equ 100b


;---------------- 页表相关属性 --------------
PG_P equ 1b
PG_RW_R equ 00b
PG_RW_W equ 10b
PG_US_S equ 000b
PG_US_U equ 100b


;------------- program type 定义 --------------
PT_NULL equ 0

Loading

0 comments on commit 767b23c

Please sign in to comment.