Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
3341e30f
提交
3341e30f
8月 28, 2007
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
nit
上级
a759b8a4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
11 行增加
和
13 行删除
+11
-13
cat.c
cat.c
+3
-3
fcntl.h
fcntl.h
+1
-1
fs.c
fs.c
+3
-3
main.c
main.c
+4
-6
没有找到文件。
cat.c
浏览文件 @
3341e30f
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
char
buf
[
512
];
char
buf
[
512
];
void
void
rfile
(
int
fd
)
cat
(
int
fd
)
{
{
int
n
;
int
n
;
...
@@ -23,7 +23,7 @@ main(int argc, char *argv[])
...
@@ -23,7 +23,7 @@ main(int argc, char *argv[])
int
fd
,
i
;
int
fd
,
i
;
if
(
argc
<=
1
)
{
if
(
argc
<=
1
)
{
rfile
(
0
);
cat
(
0
);
exit
();
exit
();
}
}
...
@@ -32,7 +32,7 @@ main(int argc, char *argv[])
...
@@ -32,7 +32,7 @@ main(int argc, char *argv[])
printf
(
1
,
"cat: cannot open %s
\n
"
,
argv
[
i
]);
printf
(
1
,
"cat: cannot open %s
\n
"
,
argv
[
i
]);
exit
();
exit
();
}
}
rfile
(
fd
);
cat
(
fd
);
close
(
fd
);
close
(
fd
);
}
}
exit
();
exit
();
...
...
fcntl.h
浏览文件 @
3341e30f
#define O_CREATE 0x200
#define O_RDONLY 0x000
#define O_RDONLY 0x000
#define O_WRONLY 0x001
#define O_WRONLY 0x001
#define O_RDWR 0x002
#define O_RDWR 0x002
#define O_CREATE 0x200
fs.c
浏览文件 @
3341e30f
...
@@ -205,7 +205,7 @@ ilock(struct inode *ip)
...
@@ -205,7 +205,7 @@ ilock(struct inode *ip)
if
(
!
(
ip
->
flags
&
I_VALID
)){
if
(
!
(
ip
->
flags
&
I_VALID
)){
bp
=
bread
(
ip
->
dev
,
IBLOCK
(
ip
->
inum
));
bp
=
bread
(
ip
->
dev
,
IBLOCK
(
ip
->
inum
));
dip
=
&
((
struct
dinode
*
)(
bp
->
data
))[
ip
->
inum
%
IPB
]
;
dip
=
(
struct
dinode
*
)
bp
->
data
+
ip
->
inum
%
IPB
;
ip
->
type
=
dip
->
type
;
ip
->
type
=
dip
->
type
;
ip
->
major
=
dip
->
major
;
ip
->
major
=
dip
->
major
;
ip
->
minor
=
dip
->
minor
;
ip
->
minor
=
dip
->
minor
;
...
@@ -275,7 +275,7 @@ ialloc(uint dev, short type)
...
@@ -275,7 +275,7 @@ ialloc(uint dev, short type)
readsb
(
dev
,
&
sb
);
readsb
(
dev
,
&
sb
);
for
(
inum
=
1
;
inum
<
sb
.
ninodes
;
inum
++
)
{
// loop over inode blocks
for
(
inum
=
1
;
inum
<
sb
.
ninodes
;
inum
++
)
{
// loop over inode blocks
bp
=
bread
(
dev
,
IBLOCK
(
inum
));
bp
=
bread
(
dev
,
IBLOCK
(
inum
));
dip
=
(
struct
dinode
*
)
(
bp
->
data
)
+
inum
%
IPB
;
dip
=
(
struct
dinode
*
)
bp
->
data
+
inum
%
IPB
;
if
(
dip
->
type
==
0
)
{
// a free inode
if
(
dip
->
type
==
0
)
{
// a free inode
memset
(
dip
,
0
,
sizeof
(
*
dip
));
memset
(
dip
,
0
,
sizeof
(
*
dip
));
dip
->
type
=
type
;
dip
->
type
=
type
;
...
@@ -296,7 +296,7 @@ iupdate(struct inode *ip)
...
@@ -296,7 +296,7 @@ iupdate(struct inode *ip)
struct
dinode
*
dip
;
struct
dinode
*
dip
;
bp
=
bread
(
ip
->
dev
,
IBLOCK
(
ip
->
inum
));
bp
=
bread
(
ip
->
dev
,
IBLOCK
(
ip
->
inum
));
dip
=
(
struct
dinode
*
)
(
bp
->
data
)
+
ip
->
inum
%
IPB
;
dip
=
(
struct
dinode
*
)
bp
->
data
+
ip
->
inum
%
IPB
;
dip
->
type
=
ip
->
type
;
dip
->
type
=
ip
->
type
;
dip
->
major
=
ip
->
major
;
dip
->
major
=
ip
->
major
;
dip
->
minor
=
ip
->
minor
;
dip
->
minor
=
ip
->
minor
;
...
...
main.c
浏览文件 @
3341e30f
...
@@ -5,9 +5,7 @@
...
@@ -5,9 +5,7 @@
#include "proc.h"
#include "proc.h"
#include "x86.h"
#include "x86.h"
extern
char
edata
[],
end
[];
static
void
bootothers
(
void
);
void
bootothers
(
void
);
// Bootstrap processor starts running C code here.
// Bootstrap processor starts running C code here.
int
int
...
@@ -15,6 +13,7 @@ main(void)
...
@@ -15,6 +13,7 @@ main(void)
{
{
int
i
;
int
i
;
static
volatile
int
bcpu
;
// cannot be on stack
static
volatile
int
bcpu
;
// cannot be on stack
extern
char
edata
[],
end
[];
// clear BSS
// clear BSS
memset
(
edata
,
0
,
end
-
edata
);
memset
(
edata
,
0
,
end
-
edata
);
...
@@ -65,7 +64,6 @@ mpmain(void)
...
@@ -65,7 +64,6 @@ mpmain(void)
idtinit
();
idtinit
();
lapic_init
(
cpu
());
lapic_init
(
cpu
());
setupsegs
(
0
);
setupsegs
(
0
);
cpuid
(
0
,
0
,
0
,
0
,
0
);
// memory barrier
cpuid
(
0
,
0
,
0
,
0
,
0
);
// memory barrier
cpus
[
cpu
()].
booted
=
1
;
cpus
[
cpu
()].
booted
=
1
;
...
@@ -76,7 +74,7 @@ mpmain(void)
...
@@ -76,7 +74,7 @@ mpmain(void)
scheduler
();
scheduler
();
}
}
void
static
void
bootothers
(
void
)
bootothers
(
void
)
{
{
extern
uchar
_binary_bootother_start
[],
_binary_bootother_size
[];
extern
uchar
_binary_bootother_start
[],
_binary_bootother_size
[];
...
@@ -91,7 +89,7 @@ bootothers(void)
...
@@ -91,7 +89,7 @@ bootothers(void)
if
(
c
==
cpus
+
cpu
())
// We've started already.
if
(
c
==
cpus
+
cpu
())
// We've started already.
continue
;
continue
;
//
Set target %esp, %eip
//
Fill in %esp, %eip and start code on cpu.
*
(
void
**
)(
code
-
4
)
=
c
->
mpstack
+
MPSTACK
;
*
(
void
**
)(
code
-
4
)
=
c
->
mpstack
+
MPSTACK
;
*
(
void
**
)(
code
-
8
)
=
mpmain
;
*
(
void
**
)(
code
-
8
)
=
mpmain
;
lapic_startap
(
c
->
apicid
,
(
uint
)
code
);
lapic_startap
(
c
->
apicid
,
(
uint
)
code
);
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论