Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
nexus-am
提交
9d9187db
N
nexus-am
项目概览
OpenXiangShan
/
nexus-am
10 个月 前同步成功
通知
0
Star
21
Fork
25
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nexus-am
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9d9187db
编写于
8月 08, 2018
作者:
Y
Yanyan Jiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add message in _Event
上级
1e8eeff1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
31 deletion
+57
-31
am/am.h
am/am.h
+1
-0
am/arch/x86-qemu/include/x86.h
am/arch/x86-qemu/include/x86.h
+4
-4
am/arch/x86-qemu/src/asye.c
am/arch/x86-qemu/src/asye.c
+52
-27
未找到文件。
am/am.h
浏览文件 @
9d9187db
...
...
@@ -53,6 +53,7 @@ typedef struct _Device {
typedef
struct
_Event
{
int
event
;
uintptr_t
cause
,
ref
;
const
char
*
msg
;
}
_Event
;
typedef
struct
_Context
_Context
;
...
...
am/arch/x86-qemu/include/x86.h
浏览文件 @
9d9187db
...
...
@@ -57,11 +57,11 @@
#define NR_IRQ 256 // IDT size
// interrupts
#define T_IRQ0 32
#define IRQ_TIMER 0
#define IRQ_KBD 1
#define T_IRQ0
32
#define IRQ_TIMER
0
#define IRQ_KBD
1
#define IRQ_SPURIOUS 31
#define IRQ_ERROR 19
#define IRQ_ERROR
19
// The following macros will not be seen by the assembler
...
...
am/arch/x86-qemu/src/asye.c
浏览文件 @
9d9187db
...
...
@@ -24,6 +24,12 @@ void vec14();
void
vecsys
();
void
irqall
();
#define IRQ T_IRQ0 +
#define SYSCALL 0x80
#define E_GP 13
#define E_PF 14
#define MSG(m) : ev.msg = m;
void
irq_handle
(
struct
TrapFrame
*
tf
)
{
_Context
ctx
=
{
.
eax
=
tf
->
eax
,
.
ebx
=
tf
->
ebx
,
.
ecx
=
tf
->
ecx
,
.
edx
=
tf
->
edx
,
...
...
@@ -43,37 +49,56 @@ void irq_handle(struct TrapFrame *tf) {
ctx
.
esp0
=
(
uint32_t
)
tf
+
60
;
// the %esp before interrupt
}
if
(
tf
->
irq
>=
32
&&
tf
->
irq
<
64
)
{
if
(
IRQ
0
<=
tf
->
irq
&&
tf
->
irq
<
IRQ
32
)
{
lapic_eoi
();
}
_Event
ev
=
{
.
event
=
_EVENT_NULL
};
_Event
ev
=
{
.
event
=
_EVENT_NULL
,
.
cause
=
0
,
.
ref
=
0
,
.
msg
=
"(no message)"
,
};
// TODO: make this code more clear
// TODO: add cause string for _EVENT_ERROR
if
(
tf
->
irq
==
32
)
{
ev
.
event
=
_EVENT_IRQ_TIMER
;
}
else
if
(
tf
->
irq
==
33
)
ev
.
event
=
_EVENT_IRQ_IODEV
;
else
if
(
tf
->
irq
==
0x80
)
{
if
((
int32_t
)
tf
->
eax
==
-
1
)
{
ev
.
event
=
_EVENT_YIELD
;
}
else
{
ev
.
event
=
_EVENT_SYSCALL
;
}
}
else
if
(
tf
->
irq
==
14
)
{
uint32_t
err
=
tf
->
err
,
cause
=
0
;
ev
.
event
=
_EVENT_PAGEFAULT
;
if
(
err
&
0x1
)
{
cause
|=
_PROT_NONE
;
}
if
(
err
&
0x2
)
{
cause
|=
_PROT_WRITE
;
}
else
{
cause
|=
_PROT_READ
;
}
ev
.
cause
=
cause
;
ev
.
ref
=
get_cr2
();
}
else
if
(
tf
->
irq
<
32
)
ev
.
event
=
_EVENT_ERROR
;
uint32_t
err
=
tf
->
err
,
cause
=
0
;
switch
(
tf
->
irq
)
{
case
IRQ
0
MSG
(
"timer interrupt (lapic)"
)
ev
.
event
=
_EVENT_IRQ_TIMER
;
break
;
case
IRQ
1
MSG
(
"I/O device IRQ1 (keyboard)"
)
ev
.
event
=
_EVENT_IRQ_IODEV
;
break
;
case
SYSCALL
MSG
(
"int $0x80 trap: _yield() or system call"
)
if
((
int32_t
)
tf
->
eax
==
-
1
)
{
ev
.
event
=
_EVENT_YIELD
;
}
else
{
ev
.
event
=
_EVENT_SYSCALL
;
}
break
;
case
E_PF
MSG
(
"page fault, @cause: _PROT_XXX"
)
ev
.
event
=
_EVENT_PAGEFAULT
;
if
(
err
&
0x1
)
{
cause
|=
_PROT_NONE
;
}
if
(
err
&
0x2
)
{
cause
|=
_PROT_WRITE
;
}
else
{
cause
|=
_PROT_READ
;
}
ev
.
cause
=
cause
;
ev
.
ref
=
get_cr2
();
break
;
case
E_GP
MSG
(
"GP #13, general protection failure"
)
ev
.
event
=
_EVENT_ERROR
;
break
;
default:
if
(
tf
->
irq
<
T_IRQ0
)
{
ev
.
event
=
_EVENT_ERROR
;
ev
.
msg
=
"exceptions"
;
}
else
{
panic
(
"some mysterious interrupts"
);
}
break
;
}
_Context
*
ret
=
&
ctx
;
if
(
H
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录