Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
f3f8c351
提交
f3f8c351
4月 21, 2012
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reset code and vector handling from Linux
上级
7a34e712
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
33 行增加
和
22 行删除
+33
-22
main.cc
kernel/main.cc
+33
-0
x2apic.cc
kernel/x2apic.cc
+0
-12
xapic.cc
kernel/xapic.cc
+0
-10
没有找到文件。
kernel/main.cc
浏览文件 @
f3f8c351
...
@@ -43,6 +43,8 @@ void initfutex(void);
...
@@ -43,6 +43,8 @@ void initfutex(void);
void
initcmdline
(
void
);
void
initcmdline
(
void
);
void
idleloop
(
void
);
void
idleloop
(
void
);
#define IO_RTC 0x70
static
volatile
int
bstate
;
static
volatile
int
bstate
;
void
void
...
@@ -59,6 +61,34 @@ mpboot(void)
...
@@ -59,6 +61,34 @@ mpboot(void)
}
}
static
void
static
void
warmreset
(
u32
addr
)
{
volatile
u16
*
wrv
;
// "The BSP must initialize CMOS shutdown code to 0AH
// and the warm reset vector (DWORD based at 40:67) to point at
// the AP startup code prior to the [universal startup algorithm]."
outb
(
IO_RTC
,
0xF
);
// offset 0xF is shutdown code
outb
(
IO_RTC
+
1
,
0x0A
);
wrv
=
(
u16
*
)(
0x40
<<
4
|
0x67
);
// Warm reset vector
wrv
[
0
]
=
0
;
wrv
[
1
]
=
addr
>>
4
;
}
static
void
rstrreset
(
void
)
{
volatile
u16
*
wrv
;
// Paranoid: set warm reset code and vector back to defaults
outb
(
IO_RTC
,
0xF
);
outb
(
IO_RTC
+
1
,
0
);
wrv
=
(
u16
*
)(
0x40
<<
4
|
0x67
);
wrv
[
0
]
=
0
;
wrv
[
1
]
=
0
;
}
static
void
bootothers
(
void
)
bootothers
(
void
)
{
{
extern
u8
_bootother_start
[];
extern
u8
_bootother_start
[];
...
@@ -78,6 +108,8 @@ bootothers(void)
...
@@ -78,6 +108,8 @@ bootothers(void)
if
(
c
==
cpus
+
myid
())
// We've started already.
if
(
c
==
cpus
+
myid
())
// We've started already.
continue
;
continue
;
warmreset
(
v2p
(
code
));
// Tell bootother.S what stack to use and the address of apstart;
// Tell bootother.S what stack to use and the address of apstart;
// it expects to find these two addresses stored just before
// it expects to find these two addresses stored just before
// its first instruction.
// its first instruction.
...
@@ -92,6 +124,7 @@ bootothers(void)
...
@@ -92,6 +124,7 @@ bootothers(void)
// Wait for cpu to finish mpmain()
// Wait for cpu to finish mpmain()
while
(
bstate
==
0
)
while
(
bstate
==
0
)
;
;
rstrreset
();
}
}
}
}
...
...
kernel/x2apic.cc
浏览文件 @
f3f8c351
...
@@ -33,8 +33,6 @@
...
@@ -33,8 +33,6 @@
#define TCCR 0x839 // Timer Current Count
#define TCCR 0x839 // Timer Current Count
#define TDCR 0x83e // Timer Divide Configuration
#define TDCR 0x83e // Timer Divide Configuration
#define IO_RTC 0x70
static
u64
x2apichz
;
static
u64
x2apichz
;
static
int
static
int
...
@@ -65,16 +63,6 @@ void
...
@@ -65,16 +63,6 @@ void
x2apicstartap
(
hwid_t
id
,
u32
addr
)
x2apicstartap
(
hwid_t
id
,
u32
addr
)
{
{
int
i
;
int
i
;
volatile
u16
*
wrv
;
// "The BSP must initialize CMOS shutdown code to 0AH
// and the warm reset vector (DWORD based at 40:67) to point at
// the AP startup code prior to the [universal startup algorithm]."
outb
(
IO_RTC
,
0xF
);
// offset 0xF is shutdown code
outb
(
IO_RTC
+
1
,
0x0A
);
wrv
=
(
u16
*
)(
0x40
<<
4
|
0x67
);
// Warm reset vector
wrv
[
0
]
=
0
;
wrv
[
1
]
=
addr
>>
4
;
// Be paranoid about clearing APIC errors
// Be paranoid about clearing APIC errors
writemsr
(
ESR
,
0
);
writemsr
(
ESR
,
0
);
...
...
kernel/xapic.cc
浏览文件 @
f3f8c351
...
@@ -187,16 +187,6 @@ void
...
@@ -187,16 +187,6 @@ void
xapicstartap
(
hwid
hwid
,
u32
addr
)
xapicstartap
(
hwid
hwid
,
u32
addr
)
{
{
int
i
;
int
i
;
volatile
u16
*
wrv
;
// "The BSP must initialize CMOS shutdown code to 0AH
// and the warm reset vector (DWORD based at 40:67) to point at
// the AP startup code prior to the [universal startup algorithm]."
outb
(
IO_RTC
,
0xF
);
// offset 0xF is shutdown code
outb
(
IO_RTC
+
1
,
0x0A
);
wrv
=
(
u16
*
)(
0x40
<<
4
|
0x67
);
// Warm reset vector
wrv
[
0
]
=
0
;
wrv
[
1
]
=
addr
>>
4
;
// "Universal startup algorithm."
// "Universal startup algorithm."
// Send INIT (level-triggered) interrupt to reset other CPU.
// Send INIT (level-triggered) interrupt to reset other CPU.
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论