Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
4b757419
提交
4b757419
10月 26, 2011
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update ioapic.c.
上级
732f7c4c
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
26 行删除
+18
-26
ioapic.c
ioapic.c
+18
-26
没有找到文件。
ioapic.c
浏览文件 @
4b757419
...
...
@@ -3,10 +3,10 @@
// See also picirq.c.
#include "types.h"
#include "defs.h"
#include "traps.h"
#include "kernel.h"
#define IOAPIC
0xFEC00000
// Default physical address of IO APIC
#define IOAPIC
(PBASE + 0xFEC00000)
// Default physical address of IO APIC
#define REG_ID 0x00 // Register index: ID
#define REG_VER 0x01 // Register index: version
...
...
@@ -26,12 +26,12 @@ volatile struct ioapic *ioapic;
// IO APIC MMIO structure: write reg, then read or write data.
struct
ioapic
{
u
int
reg
;
u
int
pad
[
3
];
u
int
data
;
u
32
reg
;
u
32
pad
[
3
];
u
32
data
;
};
static
u
int
static
u
32
ioapicread
(
int
reg
)
{
ioapic
->
reg
=
reg
;
...
...
@@ -39,25 +39,30 @@ ioapicread(int reg)
}
static
void
ioapicwrite
(
int
reg
,
u
int
data
)
ioapicwrite
(
int
reg
,
u
32
data
)
{
ioapic
->
reg
=
reg
;
ioapic
->
data
=
data
;
}
void
ioapic
init
(
void
)
ioapic
enable
(
int
irq
,
int
cpunum
)
{
int
i
,
id
,
maxintr
;
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite
(
REG_TABLE
+
2
*
irq
,
T_IRQ0
+
irq
);
ioapicwrite
(
REG_TABLE
+
2
*
irq
+
1
,
cpunum
<<
24
);
}
if
(
!
ismp
)
return
;
void
initioapic
(
void
)
{
int
i
,
id
,
maxintr
;
ioapic
=
(
volatile
struct
ioapic
*
)
IOAPIC
;
maxintr
=
(
ioapicread
(
REG_VER
)
>>
16
)
&
0xFF
;
id
=
ioapicread
(
REG_ID
)
>>
24
;
if
(
id
!=
ioapicid
)
cprintf
(
"ioapicinit: id isn't equal to ioapicid; not a MP
\n
"
);
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
...
...
@@ -66,16 +71,3 @@ ioapicinit(void)
ioapicwrite
(
REG_TABLE
+
2
*
i
+
1
,
0
);
}
}
void
ioapicenable
(
int
irq
,
int
cpunum
)
{
if
(
!
ismp
)
return
;
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite
(
REG_TABLE
+
2
*
irq
,
T_IRQ0
+
irq
);
ioapicwrite
(
REG_TABLE
+
2
*
irq
+
1
,
cpunum
<<
24
);
}
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论