Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
89bfdd4d
提交
89bfdd4d
1月 11, 2011
创建
作者:
Russ Cox
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
multiboot support and memory-only (no disk) kernel
上级
af6a6a47
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
97 行增加
和
2 行删除
+97
-2
Makefile
Makefile
+22
-2
multiboot.S
multiboot.S
+75
-0
没有找到文件。
Makefile
浏览文件 @
89bfdd4d
...
@@ -82,6 +82,11 @@ xv6.img: bootblock kernel fs.img
...
@@ -82,6 +82,11 @@ xv6.img: bootblock kernel fs.img
dd
if
=
bootblock
of
=
xv6.img
conv
=
notrunc
dd
if
=
bootblock
of
=
xv6.img
conv
=
notrunc
dd
if
=
kernel
of
=
xv6.img
seek
=
1
conv
=
notrunc
dd
if
=
kernel
of
=
xv6.img
seek
=
1
conv
=
notrunc
xv6memfs.img
:
bootblock kernelmemfs
dd
if
=
/dev/zero
of
=
xv6memfs.img
count
=
10000
dd
if
=
bootblock
of
=
xv6memfs.img
conv
=
notrunc
dd
if
=
kernelmemfs
of
=
xv6memfs.img
seek
=
1
conv
=
notrunc
bootblock
:
bootasm.S bootmain.c
bootblock
:
bootasm.S bootmain.c
$(CC)
$(CFLAGS)
-fno-pic
-O
-nostdinc
-I
.
-c
bootmain.c
$(CC)
$(CFLAGS)
-fno-pic
-O
-nostdinc
-I
.
-c
bootmain.c
$(CC)
$(CFLAGS)
-fno-pic
-nostdinc
-I
.
-c
bootasm.S
$(CC)
$(CFLAGS)
-fno-pic
-nostdinc
-I
.
-c
bootasm.S
...
@@ -102,11 +107,23 @@ initcode: initcode.S
...
@@ -102,11 +107,23 @@ initcode: initcode.S
$(OBJCOPY)
-S
-O
binary initcode.out initcode
$(OBJCOPY)
-S
-O
binary initcode.out initcode
$(OBJDUMP)
-S
initcode.o
>
initcode.asm
$(OBJDUMP)
-S
initcode.o
>
initcode.asm
kernel
:
$(OBJS) bootother initcode
kernel
:
$(OBJS)
multiboot.o
bootother initcode
$(LD)
$(LDFLAGS)
-Ttext
0x100000
-e
main
-o
kernel
$(OBJS)
-b
binary initcode bootother
$(LD)
$(LDFLAGS)
-Ttext
0x100000
-e
main
-o
kernel
multiboot.o
$(OBJS)
-b
binary initcode bootother fs.img
$(OBJDUMP)
-S
kernel
>
kernel.asm
$(OBJDUMP)
-S
kernel
>
kernel.asm
$(OBJDUMP)
-t
kernel |
sed
'1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d'
>
kernel.sym
$(OBJDUMP)
-t
kernel |
sed
'1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d'
>
kernel.sym
# kernelmemfs is a copy of kernel that maintains the
# disk image in memory instead of writing to a disk.
# This is not so useful for testing persistent storage or
# exploring disk buffering implementations, but it is
# great for testing the kernel on real hardware without
# needing a scratch disk.
MEMFSOBJS
=
$
(
filter-out ide.o,
$(OBJS)
)
memide.o
kernelmemfs
:
$(MEMFSOBJS) multiboot.o bootother initcode fs.img
$(LD)
$(LDFLAGS)
-Ttext
0x100000
-e
main
-o
kernelmemfs multiboot.o
$(MEMFSOBJS)
-b
binary initcode bootother fs.img
$(OBJDUMP)
-S
kernelmemfs
>
kernelmemfs.asm
$(OBJDUMP)
-t
kernelmemfs |
sed
'1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d'
>
kernelmemfs.sym
tags
:
$(OBJS) bootother.S _init
tags
:
$(OBJS) bootother.S _init
etags
*
.S
*
.c
etags
*
.S
*
.c
...
@@ -187,6 +204,9 @@ QEMUOPTS = -hdb fs.img xv6.img -smp $(CPUS)
...
@@ -187,6 +204,9 @@ QEMUOPTS = -hdb fs.img xv6.img -smp $(CPUS)
qemu
:
fs.img xv6.img
qemu
:
fs.img xv6.img
$(QEMU)
-serial
mon:stdio
$(QEMUOPTS)
$(QEMU)
-serial
mon:stdio
$(QEMUOPTS)
qemu-memfs
:
xv6memfs.img
$(QEMU)
xv6memfs.img
-smp
$(CPUS)
qemu-nox
:
fs.img xv6.img
qemu-nox
:
fs.img xv6.img
$(QEMU)
-nographic
$(QEMUOPTS)
$(QEMU)
-nographic
$(QEMUOPTS)
...
...
multiboot.S
0 → 100644
浏览文件 @
89bfdd4d
# Multiboot header, for multiboot boot loaders like GNU Grub.
# http://www.gnu.org/software/grub/manual/multiboot/multiboot.html
#
# Using GRUB 2, you can boot xv6 from a file stored in a
# Linux file system by copying kernel or kernelmemfs to /boot
# and then adding this menu entry:
#
# menuentry "xv6" {
# insmod ext2
# set root='(hd0,msdos1)'
# set kernel='/boot/kernel'
# echo "Loading ${kernel}..."
# multiboot ${kernel} ${kernel}
# boot
# }
#include "asm.h"
#define STACK 4096
#define SEG_KCODE 1 // kernel code
#define SEG_KDATA 2 // kernel data+stack
# Multiboot header. Data to direct multiboot loader.
.p2align 2
.text
.globl multiboot_header
multiboot_header:
#define magic 0x1badb002
#define flags (1<<16 | 1<<0)
.long magic
.long flags
.long (-magic-flags)
.long multiboot_header # beginning of image
.long multiboot_header
.long edata
.long end
.long multiboot_entry
# Multiboot entry point. Machine is mostly set up.
# Configure the GDT to match the environment that our usual
# boot loader - bootasm.S - sets up.
.globl multiboot_entry
multiboot_entry:
lgdt gdtdesc
ljmp $(SEG_KCODE<<3), $mbstart32
mbstart32:
# Set up the protected-mode data segment registers
movw $(SEG_KDATA<<3), %ax # Our data segment selector
movw %ax, %ds # -> DS: Data Segment
movw %ax, %es # -> ES: Extra Segment
movw %ax, %ss # -> SS: Stack Segment
movw $0, %ax # Zero segments not ready for use
movw %ax, %fs # -> FS
movw %ax, %gs # -> GS
# Set up the stack pointer and call into C.
movl $(stack + STACK), %esp
call main
spin:
jmp spin
# Bootstrap GDT
.p2align 2 # force 4 byte alignment
gdt:
SEG_NULLASM # null seg
SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code seg
SEG_ASM(STA_W, 0x0, 0xffffffff) # data seg
gdtdesc:
.word (gdtdesc - gdt - 1) # sizeof(gdt) - 1
.long gdt # address gdt
.comm stack, STACK
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论