Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
a938d2bd
提交
a938d2bd
10月 27, 2011
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Measure APIC frequency, set tick length to 10msec.
上级
d8bcc4f2
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
23 行增加
和
10 行删除
+23
-10
Makefile
Makefile
+1
-1
TODO
TODO
+0
-2
lapic.c
lapic.c
+21
-7
param.h
param.h
+1
-0
没有找到文件。
Makefile
浏览文件 @
a938d2bd
...
...
@@ -101,7 +101,7 @@ fs.img: mkfs README $(UPROGS)
clean
:
rm
-f
*
.o
*
.d
*
.asm
*
.sym initcode kernel bootother mkfs fs.img
QEMUOPTS
=
-smp
$(CPUS)
-m
512
-nographic
QEMUOPTS
=
-smp
$(CPUS)
-m
512
-
serial
mon:stdio
-
nographic
qemu
:
kernel
$(QEMU)
$(QEMUOPTS)
-kernel
kernel
gdb
:
kernel
...
...
TODO
浏览文件 @
a938d2bd
...
...
@@ -3,8 +3,6 @@
* get something like asm labels working in clang
- (is there a way to use address_space(256) attributes?)
* bring mtrace back
* clock APIC with PIT
* implement microdelay
* finish syscall/sysret implementation
- pass syscall args via argument registers
- (adjust argint and friends)
...
...
lapic.c
浏览文件 @
a938d2bd
...
...
@@ -39,7 +39,10 @@
#define TCCR (0x0390/4) // Timer Current Count
#define TDCR (0x03E0/4) // Timer Divide Configuration
volatile
u32
*
lapic
=
(
u32
*
)(
PBASE
+
0xfee00000
);
#define IO_RTC 0x70
static
volatile
u32
*
lapic
=
(
u32
*
)(
PBASE
+
0xfee00000
);
static
u64
lapichz
;
static
void
lapicw
(
int
index
,
int
value
)
...
...
@@ -72,17 +75,30 @@ lapicwait()
void
initlapic
(
void
)
{
u64
count
;
// Enable local APIC; set spurious interrupt vector.
lapicw
(
SVR
,
ENABLE
|
(
T_IRQ0
+
IRQ_SPURIOUS
));
// XXX(sbw)
if
(
lapichz
==
0
)
{
// Measure the TICR frequency
lapicw
(
TDCR
,
X1
);
lapicw
(
TICR
,
0xffffffff
);
u64
ccr0
=
lapicr
(
TCCR
);
microdelay
(
10
*
1000
);
// 1/100th of a second
u64
ccr1
=
lapicr
(
TCCR
);
lapichz
=
100
*
(
ccr0
-
ccr1
);
}
count
=
(
QUANTUN
*
lapichz
)
/
1000
;
if
(
count
>
0xffffffff
)
panic
(
"initlapic: QUANTUN too large"
);
// The timer repeatedly counts down at bus frequency
// from lapic[TICR] and then issues an interrupt.
// If xv6 cared more about precise timekeeping,
// TICR would be calibrated using an external time source.
lapicw
(
TDCR
,
X1
);
lapicw
(
TIMER
,
PERIODIC
|
(
T_IRQ0
+
IRQ_TIMER
));
lapicw
(
TICR
,
10000000
);
lapicw
(
TICR
,
count
);
// Disable logical interrupt lines.
lapicw
(
LINT0
,
MASKED
);
...
...
@@ -159,8 +175,6 @@ lapic_tlbflush(u32 cpu)
lapic_ipi
(
cpu
,
T_TLBFLUSH
);
}
#define IO_RTC 0x70
// Start additional processor running bootstrap code at addr.
// See Appendix B of MultiProcessor Specification.
void
...
...
param.h
浏览文件 @
a938d2bd
...
...
@@ -15,3 +15,4 @@
#define MTRACE 0
#define PHYSTOP 0xE000000 // use phys mem up to here as free pool
#define CPUKSTACKS (NPROC + NCPU)
#define QUANTUN 10 // scheduling time quantum and tick length (in msec)
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论