Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
人间散章
rt-thread
提交
6b662070
R
rt-thread
项目概览
人间散章
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6b662070
编写于
10月 19, 2021
作者:
B
BernardXiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[libcpu] fix s-mode issue
上级
bcdd4a62
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
10 deletion
+21
-10
libcpu/risc-v/virt64/interrupt.c
libcpu/risc-v/virt64/interrupt.c
+6
-3
libcpu/risc-v/virt64/riscv_io.h
libcpu/risc-v/virt64/riscv_io.h
+5
-5
libcpu/risc-v/virt64/startup_gcc.S
libcpu/risc-v/virt64/startup_gcc.S
+10
-2
未找到文件。
libcpu/risc-v/virt64/interrupt.c
浏览文件 @
6b662070
...
...
@@ -14,7 +14,6 @@
#include "riscv.h"
#include "interrupt.h"
#define CPU_NUM 2
#define MAX_HANDLERS 128
static
struct
rt_irq_desc
irq_desc
[
MAX_HANDLERS
];
...
...
@@ -60,7 +59,6 @@ void rt_hw_interrupt_init(void)
/* init exceptions table */
for
(
idx
=
0
;
idx
<
MAX_HANDLERS
;
idx
++
)
{
//rt_hw_interrupt_mask(idx);
irq_desc
[
idx
].
handler
=
(
rt_isr_handler_t
)
rt_hw_interrupt_handle
;
irq_desc
[
idx
].
param
=
RT_NULL
;
#ifdef RT_USING_INTERRUPT_INFO
...
...
@@ -68,6 +66,8 @@ void rt_hw_interrupt_init(void)
irq_desc
[
idx
].
counter
=
0
;
#endif
}
plic_set_threshold
(
0
);
}
/**
...
...
@@ -86,7 +86,7 @@ void rt_hw_interrupt_mask(int vector)
void
rt_hw_interrupt_umask
(
int
vector
)
{
plic_set_priority
(
vector
,
1
);
plic_set_threshold
(
0
);
rt_hw_plic_irq_enable
(
vector
);
}
...
...
@@ -182,6 +182,7 @@ void handle_trap(rt_size_t xcause,rt_size_t xtval,rt_size_t xepc,struct rt_hw_st
{
int
cause
=
(
xcause
&
0xFFFFFFFF
);
int
plic_irq
=
0
;
if
(
xcause
&
(
1UL
<<
63
))
{
switch
(
cause
)
...
...
@@ -197,11 +198,13 @@ void handle_trap(rt_size_t xcause,rt_size_t xtval,rt_size_t xepc,struct rt_hw_st
case
IRQ_S_TIMER
:
tick_isr
();
break
;
case
IRQ_S_EXT
:
plic_irq
=
plic_claim
();
plic_complete
(
plic_irq
);
irq_desc
[
plic_irq
].
handler
(
plic_irq
,
irq_desc
[
plic_irq
].
param
);
break
;
case
IRQ_M_EXT
:
plic_irq
=
plic_claim
();
plic_complete
(
plic_irq
);
...
...
libcpu/risc-v/virt64/riscv_io.h
浏览文件 @
6b662070
...
...
@@ -10,15 +10,15 @@
#ifndef __RISCV_IO_H__
#define __RISCV_IO_H__
// which hart (core) is this?
static
inline
uint32_t
r_mhartid
()
static
inline
uint32_t
__raw_hartid
(
void
)
{
#ifndef RISCV_S_MODE
#ifdef RISCV_S_MODE
extern
int
boot_hartid
;
return
boot_hartid
;
#else
uint32_t
x
;
asm
volatile
(
"csrr %0, mhartid"
:
"=r"
(
x
)
);
return
x
;
#else
return
0
;
#endif
}
...
...
libcpu/risc-v/virt64/startup_gcc.S
浏览文件 @
6b662070
...
...
@@ -14,10 +14,18 @@
#define XSTATUS_PUM (1 << 18)
#include <cpuport.h>
boot_hartid
:
.
int
.
global
boot_hartid
.
global
_start
.
section
".start"
,
"ax"
_start
:
#ifndef RISCV_S_MODE
#ifdef RISCV_S_MODE
#
save
hartid
la
t0
,
boot_hartid
#
global
varible
rt_boot_hartid
mv
t1
,
a0
#
get
hartid
in
S
-
mode
frome
a0
register
sw
t1
,
(
t0
)
#
store
t1
register
low
4
bits
in
memory
address
which
is
stored
in
t0
#else
#
setup
stacks
per
hart
csrr
t0
,
mhartid
#
read
current
hart
id
slli
t0
,
t0
,
10
#
shift
left
the
hart
id
by
1024
...
...
@@ -54,4 +62,4 @@ _start:
park
:
wfi
j
park
\ No newline at end of file
j
park
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录