Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
okll00
rt-thread
提交
b31888de
R
rt-thread
项目概览
okll00
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b31888de
编写于
11月 01, 2018
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Kernel] Fix the rt_memset/memcpy issue under 64bit ARCH.
上级
43221080
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
9 deletion
+10
-9
src/kservice.c
src/kservice.c
+10
-9
未找到文件。
src/kservice.c
浏览文件 @
b31888de
...
...
@@ -137,16 +137,17 @@ void *rt_memset(void *s, int c, rt_ubase_t count)
#define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1))
#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE)
int
i
;
unsigned
int
i
;
char
*
m
=
(
char
*
)
s
;
rt_uint32_t
buffer
;
rt_uint32_t
*
aligned_addr
;
rt_uint32_t
d
=
c
&
0xff
;
unsigned
long
buffer
;
unsigned
long
*
aligned_addr
;
unsigned
int
d
=
c
&
0xff
;
/* To avoid sign extension, copy C to an
unsigned variable. */
if
(
!
TOO_SMALL
(
count
)
&&
!
UNALIGNED
(
s
))
{
/* If we get this far, we know that n is large and m is word-aligned. */
aligned_addr
=
(
rt_uint32_t
*
)
s
;
aligned_addr
=
(
unsigned
long
*
)
s
;
/* Store D into each char sized location in BUFFER so that
* we can set large blocks quickly.
...
...
@@ -234,16 +235,16 @@ void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
char
*
dst_ptr
=
(
char
*
)
dst
;
char
*
src_ptr
=
(
char
*
)
src
;
rt_int32_t
*
aligned_dst
;
rt_int32_t
*
aligned_src
;
long
*
aligned_dst
;
long
*
aligned_src
;
int
len
=
count
;
/* If the size is small, or either SRC or DST is unaligned,
then punt into the byte copy loop. This should be rare. */
if
(
!
TOO_SMALL
(
len
)
&&
!
UNALIGNED
(
src_ptr
,
dst_ptr
))
{
aligned_dst
=
(
rt_int32_t
*
)
dst_ptr
;
aligned_src
=
(
rt_int32_t
*
)
src_ptr
;
aligned_dst
=
(
long
*
)
dst_ptr
;
aligned_src
=
(
long
*
)
src_ptr
;
/* Copy 4X long words at a time if possible. */
while
(
len
>=
BIGBLOCKSIZE
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录