Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
fa1c3ff9
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fa1c3ff9
编写于
1月 29, 2013
作者:
V
Vineet Gupta
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ARC: Module support
Signed-off-by:
N
Vineet Gupta
<
vgupta@synopsys.com
>
上级
4788a594
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
93 addition
and
0 deletion
+93
-0
arch/arc/include/asm/module.h
arch/arc/include/asm/module.h
+4
-0
arch/arc/kernel/Makefile
arch/arc/kernel/Makefile
+2
-0
arch/arc/kernel/module.c
arch/arc/kernel/module.c
+87
-0
未找到文件。
arch/arc/include/asm/module.h
浏览文件 @
fa1c3ff9
...
...
@@ -14,4 +14,8 @@
#include <asm-generic/module.h>
#define MODULE_PROC_FAMILY "ARC700"
#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
#endif
/* _ASM_ARC_MODULE_H */
arch/arc/kernel/Makefile
浏览文件 @
fa1c3ff9
...
...
@@ -12,6 +12,8 @@ obj-y := arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o
obj-y
+=
signal.o traps.o sys.o troubleshoot.o stacktrace.o clk.o
obj-y
+=
devtree.o
obj-$(CONFIG_MODULES)
+=
arcksyms.o module.o
obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)
+=
fpu.o
CFLAGS_fpu.o
+=
-mdpfp
...
...
arch/arc/kernel/module.c
0 → 100644
浏览文件 @
fa1c3ff9
/*
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/moduleloader.h>
#include <linux/kernel.h>
#include <linux/elf.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/string.h>
static
inline
void
arc_write_me
(
unsigned
short
*
addr
,
unsigned
long
value
)
{
*
addr
=
(
value
&
0xffff0000
)
>>
16
;
*
(
addr
+
1
)
=
(
value
&
0xffff
);
}
int
apply_relocate_add
(
Elf32_Shdr
*
sechdrs
,
const
char
*
strtab
,
unsigned
int
symindex
,
/* sec index for sym tbl */
unsigned
int
relsec
,
/* sec index for relo sec */
struct
module
*
module
)
{
int
i
,
n
;
Elf32_Rela
*
rel_entry
=
(
void
*
)
sechdrs
[
relsec
].
sh_addr
;
Elf32_Sym
*
sym_entry
,
*
sym_sec
;
Elf32_Addr
relocation
;
Elf32_Addr
location
;
Elf32_Addr
sec_to_patch
;
int
relo_type
;
sec_to_patch
=
sechdrs
[
sechdrs
[
relsec
].
sh_info
].
sh_addr
;
sym_sec
=
(
Elf32_Sym
*
)
sechdrs
[
symindex
].
sh_addr
;
n
=
sechdrs
[
relsec
].
sh_size
/
sizeof
(
*
rel_entry
);
pr_debug
(
"
\n
========== Module Sym reloc ===========================
\n
"
);
pr_debug
(
"Section to fixup %x
\n
"
,
sec_to_patch
);
pr_debug
(
"=========================================================
\n
"
);
pr_debug
(
"rela->r_off | rela->addend | sym->st_value | ADDR | VALUE
\n
"
);
pr_debug
(
"=========================================================
\n
"
);
/* Loop thru entries in relocation section */
for
(
i
=
0
;
i
<
n
;
i
++
)
{
/* This is where to make the change */
location
=
sec_to_patch
+
rel_entry
[
i
].
r_offset
;
/* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym_entry
=
sym_sec
+
ELF32_R_SYM
(
rel_entry
[
i
].
r_info
);
relocation
=
sym_entry
->
st_value
+
rel_entry
[
i
].
r_addend
;
pr_debug
(
"
\t
%x
\t\t
%x
\t\t
%x %x %x [%s]
\n
"
,
rel_entry
[
i
].
r_offset
,
rel_entry
[
i
].
r_addend
,
sym_entry
->
st_value
,
location
,
relocation
,
strtab
+
sym_entry
->
st_name
);
/* This assumes modules are built with -mlong-calls
* so any branches/jumps are absolute 32 bit jmps
* global data access again is abs 32 bit.
* Both of these are handled by same relocation type
*/
relo_type
=
ELF32_R_TYPE
(
rel_entry
[
i
].
r_info
);
if
(
likely
(
R_ARC_32_ME
==
relo_type
))
arc_write_me
((
unsigned
short
*
)
location
,
relocation
);
else
if
(
R_ARC_32
==
relo_type
)
*
((
Elf32_Addr
*
)
location
)
=
relocation
;
else
goto
relo_err
;
}
return
0
;
relo_err:
pr_err
(
"%s: unknown relocation: %u
\n
"
,
module
->
name
,
ELF32_R_TYPE
(
rel_entry
[
i
].
r_info
));
return
-
ENOEXEC
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录