Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
a650c606
提交
a650c606
9月 06, 2006
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
spacing fixes: no tabs, 2-space indents (for rtm)
上级
45854caa
显示空白字符变更
内嵌
并排
正在显示
33 个修改的文件
包含
32 行增加
和
24 行删除
+32
-24
asm.h
asm.h
+1
-0
bootasm.S
bootasm.S
+12
-5
bootmain.c
bootmain.c
+0
-0
bootother.S
bootother.S
+2
-1
cat.c
cat.c
+0
-0
console.c
console.c
+0
-0
elf.h
elf.h
+0
-0
fs.c
fs.c
+0
-0
ide.c
ide.c
+1
-0
ioapic.c
ioapic.c
+0
-0
ioapic.h
ioapic.h
+0
-0
ls.c
ls.c
+0
-0
main.c
main.c
+0
-0
mkfs.c
mkfs.c
+1
-1
mmu.h
mmu.h
+0
-0
mp.c
mp.c
+0
-0
mp.h
mp.h
+0
-0
picirq.c
picirq.c
+0
-0
printf.c
printf.c
+0
-0
setjmp.S
setjmp.S
+0
-2
sh.c
sh.c
+0
-0
sign.pl
sign.pl
+0
-0
spinlock.c
spinlock.c
+0
-0
string.c
string.c
+0
-0
trap.c
trap.c
+0
-0
trapasm.S
trapasm.S
+1
-1
traps.h
traps.h
+0
-0
ulib.c
ulib.c
+3
-3
umalloc.c
umalloc.c
+0
-0
userfs.c
userfs.c
+0
-0
usys.S
usys.S
+0
-0
vectors.pl
vectors.pl
+4
-4
x86.h
x86.h
+7
-7
没有找到文件。
asm.h
浏览文件 @
a650c606
...
...
@@ -5,6 +5,7 @@
#define SEG_NULLASM \
.word 0, 0; \
.byte 0, 0, 0, 0
#define SEG_ASM(type,base,lim) \
.word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \
.byte (((base) >> 16) & 0xff), (0x90 | (type)), \
...
...
bootasm.S
浏览文件 @
a650c606
...
...
@@ -18,7 +18,8 @@
###################################################################################
.globl start # Entry point
start: .code16 # This runs in real mode
start:
.code16 # This runs in real mode
cli # Disable interrupts
cld # String operations increment
...
...
@@ -39,12 +40,15 @@ start: .code16 # This runs in real mode
#### Obviously this a bit of a drag for us, especially when trying to
#### address memory above 1MB. This code undoes this.
seta20.1: inb $0x64,%al # Get status
seta20.1:
inb $0x64,%al # Get status
testb $0x2,%al # Busy?
jnz seta20.1 # Yes
movb $0xd1,%al # Command: Write
outb %al,$0x64 # output port
seta20.2: inb $0x64,%al # Get status
seta20.2:
inb $0x64,%al # Get status
testb $0x2,%al # Busy?
jnz seta20.2 # Yes
movb $0xdf,%al # Enable
...
...
@@ -60,7 +64,8 @@ seta20.2: inb $0x64,%al # Get status
#### This initial NOP-translation setup is required by the processor
#### to ensure that the transition to protected mode occurs smoothly.
real_to_prot: cli # Mandatory since we dont set up an IDT
real_to_prot:
cli # Mandatory since we dont set up an IDT
lgdt gdtdesc # load GDT -- mandatory in protected mode
movl %cr0, %eax # turn on protected mode
orl $CR0_PE_ON, %eax #
...
...
@@ -83,7 +88,9 @@ protcseg:
call cmain # finish the boot load from C.
# cmain() should not return
spin: jmp spin # ..but in case it does, spin
spin:
jmp spin # ..but in case it does, spin
.p2align 2 # force 4 byte alignment
gdt:
...
...
bootmain.c
浏览文件 @
a650c606
bootother.S
浏览文件 @
a650c606
...
...
@@ -21,7 +21,8 @@
.set CR0_PE_ON,0x1 # protected mode enable flag
.globl start
start: .code16 # This runs in real mode
start:
.code16 # This runs in real mode
cli # Disable interrupts
cld # String operations increment
...
...
cat.c
浏览文件 @
a650c606
console.c
浏览文件 @
a650c606
elf.h
浏览文件 @
a650c606
fs.c
浏览文件 @
a650c606
ide.c
浏览文件 @
a650c606
...
...
@@ -23,6 +23,7 @@ struct ide_request {
uint
nsecs
;
uint
read
;
};
struct
ide_request
request
[
NREQUEST
];
int
head
,
tail
;
struct
spinlock
ide_lock
;
...
...
ioapic.c
浏览文件 @
a650c606
ioapic.h
浏览文件 @
a650c606
ls.c
浏览文件 @
a650c606
main.c
浏览文件 @
a650c606
mkfs.c
浏览文件 @
a650c606
...
...
@@ -81,7 +81,7 @@ main(int argc, char *argv[])
usedblocks
=
ninodes
/
IPB
+
3
+
bitblocks
;
freeblock
=
usedblocks
;
printf
(
"used %d (bit %d ninode %d) free %d total %d
\n
"
,
usedblocks
,
printf
(
"used %d (bit %d ninode %d) free %d total %d
\n
"
,
usedblocks
,
bitblocks
,
ninodes
/
IPB
+
1
,
freeblock
,
nblocks
+
usedblocks
);
assert
(
nblocks
+
usedblocks
==
size
);
...
...
mmu.h
浏览文件 @
a650c606
mp.c
浏览文件 @
a650c606
mp.h
浏览文件 @
a650c606
picirq.c
浏览文件 @
a650c606
printf.c
浏览文件 @
a650c606
setjmp.S
浏览文件 @
a650c606
...
...
@@ -33,5 +33,3 @@ longjmp:
movl $1, %eax /* return value (appears to come from setjmp!) */
ret
sh.c
浏览文件 @
a650c606
sign.pl
浏览文件 @
a650c606
spinlock.c
浏览文件 @
a650c606
string.c
浏览文件 @
a650c606
trap.c
浏览文件 @
a650c606
trapasm.S
浏览文件 @
a650c606
.text
.text
.globl trap
.globl trapret1
...
...
traps.h
浏览文件 @
a650c606
ulib.c
浏览文件 @
a650c606
...
...
@@ -37,7 +37,7 @@ strlen(char *s)
return
n
;
}
void
*
void
*
memset
(
void
*
dst
,
int
c
,
unsigned
int
n
)
{
char
*
d
=
(
char
*
)
dst
;
...
...
@@ -48,7 +48,7 @@ memset(void *dst, int c, unsigned int n)
return
dst
;
}
char
*
char
*
strchr
(
const
char
*
s
,
char
c
)
{
for
(;
*
s
;
s
++
)
...
...
@@ -57,7 +57,7 @@ strchr(const char *s, char c)
return
0
;
}
char
*
char
*
gets
(
char
*
buf
,
int
max
)
{
int
i
=
0
,
cc
;
...
...
umalloc.c
浏览文件 @
a650c606
userfs.c
浏览文件 @
a650c606
usys.S
浏览文件 @
a650c606
vectors.pl
浏览文件 @
a650c606
...
...
@@ -13,10 +13,10 @@ for(my $i = 0; $i < 256; $i++){
print
".globl vector$i\n"
;
print
"vector$i:\n"
;
if
((
$i
<
8
||
$i
>
14
)
&&
$i
!=
17
){
print
"
\t
pushl \$0\n"
;
print
"
pushl \$0\n"
;
}
print
"
\t
pushl \$$i\n"
;
print
"
\t
jmp alltraps\n"
;
print
"
pushl \$$i\n"
;
print
"
jmp alltraps\n"
;
}
print
"\n/* vector table */\n"
;
...
...
@@ -24,5 +24,5 @@ print ".data\n";
print
".globl vectors\n"
;
print
"vectors:\n"
;
for
(
my
$i
=
0
;
$i
<
256
;
$i
++
){
print
"
\t
.long vector$i\n"
;
print
"
.long vector$i\n"
;
}
x86.h
浏览文件 @
a650c606
...
...
@@ -88,9 +88,9 @@ static __inline void
cpuid
(
uint
info
,
uint
*
eaxp
,
uint
*
ebxp
,
uint
*
ecxp
,
uint
*
edxp
)
{
uint
eax
,
ebx
,
ecx
,
edx
;
asm
volatile
(
"cpuid"
:
"=a"
(
eax
),
"=b"
(
ebx
),
"=c"
(
ecx
),
"=d"
(
edx
)
:
"a"
(
info
));
asm
volatile
(
"cpuid"
:
"=a"
(
eax
),
"=b"
(
ebx
),
"=c"
(
ecx
),
"=d"
(
edx
)
:
"a"
(
info
));
if
(
eaxp
)
*
eaxp
=
eax
;
if
(
ebxp
)
...
...
@@ -105,10 +105,10 @@ static __inline uint
cmpxchg
(
uint
oldval
,
uint
newval
,
volatile
uint
*
lock_addr
)
{
uint
result
;
__asm__
__volatile__
(
"lock; cmpxchgl %2, %0"
:
"+m"
(
*
lock_addr
),
"=a"
(
result
)
:
"r"
(
newval
),
"1"
(
oldval
)
:
"cc"
);
__asm__
__volatile__
(
"lock; cmpxchgl %2, %0"
:
"+m"
(
*
lock_addr
),
"=a"
(
result
)
:
"r"
(
newval
),
"1"
(
oldval
)
:
"cc"
);
return
result
;
}
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论