Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
030a4773
提交
030a4773
5月 31, 2009
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tab police
上级
21573833
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
42 行增加
和
42 行删除
+42
-42
kill.c
kill.c
+1
-1
lapic.c
lapic.c
+1
-1
proc.h
proc.h
+1
-1
uart.c
uart.c
+39
-39
没有找到文件。
kill.c
浏览文件 @
030a4773
...
...
@@ -6,7 +6,7 @@ int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
if
(
argc
<
1
){
printf
(
2
,
"usage: kill pid...
\n
"
);
exit
();
...
...
lapic.c
浏览文件 @
030a4773
...
...
@@ -156,7 +156,7 @@ lapicstartap(uchar apicid, uint addr)
lapicw
(
ICRLO
,
INIT
|
LEVEL
|
ASSERT
);
microdelay
(
200
);
lapicw
(
ICRLO
,
INIT
|
LEVEL
);
microdelay
(
100
);
// should be 10ms, but too slow in Bochs!
microdelay
(
100
);
// should be 10ms, but too slow in Bochs!
// Send startup IPI (twice!) to enter bootstrap code.
// Regular hardware is supposed to only accept a STARTUP
...
...
proc.h
浏览文件 @
030a4773
...
...
@@ -32,7 +32,7 @@ struct proc {
uint
sz
;
// Size of process memory (bytes)
char
*
kstack
;
// Bottom of kernel stack for this process
enum
proc_state
state
;
// Process state
int
pid
;
// Process ID
volatile
int
pid
;
// Process ID
struct
proc
*
parent
;
// Parent process
struct
trapframe
*
tf
;
// Trap frame for current syscall
struct
context
*
context
;
// Switch here to run process
...
...
uart.c
浏览文件 @
030a4773
...
...
@@ -10,67 +10,67 @@
#include "proc.h"
#include "x86.h"
#define COM1
0x3f8
#define COM1
0x3f8
static
int
uart
;
// is there a uart?
static
int
uart
;
// is there a uart?
void
uartinit
(
void
)
{
char
*
p
;
char
*
p
;
// Turn off the FIFO
outb
(
COM1
+
2
,
0
);
// 9600 baud, 8 data bits, 1 stop bit, parity off.
outb
(
COM1
+
3
,
0x80
);
// Unlock divisor
outb
(
COM1
+
0
,
115200
/
9600
);
outb
(
COM1
+
1
,
0
);
outb
(
COM1
+
3
,
0x03
);
// Lock divisor, 8 data bits.
outb
(
COM1
+
4
,
0
);
outb
(
COM1
+
1
,
0x01
);
// Enable receive interrupts.
// Turn off the FIFO
outb
(
COM1
+
2
,
0
);
// 9600 baud, 8 data bits, 1 stop bit, parity off.
outb
(
COM1
+
3
,
0x80
);
// Unlock divisor
outb
(
COM1
+
0
,
115200
/
9600
);
outb
(
COM1
+
1
,
0
);
outb
(
COM1
+
3
,
0x03
);
// Lock divisor, 8 data bits.
outb
(
COM1
+
4
,
0
);
outb
(
COM1
+
1
,
0x01
);
// Enable receive interrupts.
// If status is 0xFF, no serial port.
if
(
inb
(
COM1
+
5
)
==
0xFF
)
return
;
uart
=
1
;
// If status is 0xFF, no serial port.
if
(
inb
(
COM1
+
5
)
==
0xFF
)
return
;
uart
=
1
;
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb
(
COM1
+
2
);
inb
(
COM1
+
0
);
picenable
(
IRQ_COM1
);
ioapicenable
(
IRQ_COM1
,
0
);
// Announce that we're here.
for
(
p
=
"xv6...
\n
"
;
*
p
;
p
++
)
uartputc
(
*
p
);
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb
(
COM1
+
2
);
inb
(
COM1
+
0
);
picenable
(
IRQ_COM1
);
ioapicenable
(
IRQ_COM1
,
0
);
// Announce that we're here.
for
(
p
=
"xv6...
\n
"
;
*
p
;
p
++
)
uartputc
(
*
p
);
}
void
uartputc
(
int
c
)
{
int
i
;
int
i
;
if
(
!
uart
)
return
;
for
(
i
=
0
;
i
<
128
&&
!
(
inb
(
COM1
+
5
)
&
0x20
);
i
++
)
microdelay
(
10
);
outb
(
COM1
+
0
,
c
);
if
(
!
uart
)
return
;
for
(
i
=
0
;
i
<
128
&&
!
(
inb
(
COM1
+
5
)
&
0x20
);
i
++
)
microdelay
(
10
);
outb
(
COM1
+
0
,
c
);
}
static
int
uartgetc
(
void
)
{
if
(
!
uart
)
return
-
1
;
if
(
!
(
inb
(
COM1
+
5
)
&
0x01
))
return
-
1
;
return
inb
(
COM1
+
0
);
if
(
!
uart
)
return
-
1
;
if
(
!
(
inb
(
COM1
+
5
)
&
0x01
))
return
-
1
;
return
inb
(
COM1
+
0
);
}
void
uartintr
(
void
)
{
consoleintr
(
uartgetc
);
consoleintr
(
uartgetc
);
}
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论