Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
9f7470bf
Commit
9f7470bf
authored
Jan 10, 2003
by
Miles Bader
Committed by
Linus Torvalds
Jan 10, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] Update v850 module support for 2.5.55
parent
63986a43
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
27 deletions
+53
-27
arch/v850/kernel/module.c
arch/v850/kernel/module.c
+32
-18
include/asm-v850/module.h
include/asm-v850/module.h
+21
-9
No files found.
arch/v850/kernel/module.c
View file @
9f7470bf
/*
* arch/v850/kernel/module.c -- Architecture-specific module functions
*
* Copyright (C) 2002
NEC
Corporation
* Copyright (C) 2002 Miles Bader <miles@gnu.org>
* Copyright (C) 2001 Rusty Russell
* Copyright (C) 2002
,03 NEC Electronics
Corporation
* Copyright (C) 2002
,03
Miles Bader <miles@gnu.org>
* Copyright (C) 2001
,03
Rusty Russell
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
...
...
@@ -100,18 +100,31 @@ static unsigned long get_plt_size(const Elf32_Ehdr *hdr,
return
ret
;
}
long
module_core_size
(
const
Elf32_Ehdr
*
hdr
,
const
Elf32_Shdr
*
sechdrs
,
const
char
*
secstrings
,
struct
module
*
mod
)
int
module_frob_arch_sections
(
Elf32_Ehdr
*
hdr
,
Elf32_Shdr
*
sechdrs
,
char
*
secstrings
,
struct
module
*
me
)
{
mod
->
arch
.
core_plt_offset
=
(
mod
->
core_size
+
3
)
&
~
3
;
return
mod
->
core_size
+
get_plt_size
(
hdr
,
sechdrs
,
secstrings
,
1
);
}
unsigned
int
i
;
long
module_init_size
(
const
Elf32_Ehdr
*
hdr
,
const
Elf32_Shdr
*
sechdrs
,
const
char
*
secstrings
,
struct
module
*
mod
)
{
mod
->
arch
.
init_plt_offset
=
(
mod
->
init_size
+
3
)
&
~
3
;
return
mod
->
init_size
+
get_plt_size
(
hdr
,
sechdrs
,
secstrings
,
1
);
/* Find .plt and .pltinit sections */
for
(
i
=
0
;
i
<
hdr
->
e_shnum
;
i
++
)
{
if
(
strcmp
(
secstrings
+
sechdrs
[
i
].
sh_name
,
".init.plt"
)
==
0
)
me
->
arch
.
init_plt_section
=
i
;
else
if
(
strcmp
(
secstrings
+
sechdrs
[
i
].
sh_name
,
".plt"
)
==
0
)
me
->
arch
.
core_plt_section
=
i
;
}
if
(
!
me
->
arch
.
core_plt_section
||
!
me
->
arch
.
init_plt_section
)
{
printk
(
"Module doesn't contain .plt or .plt.init sections.
\n
"
);
return
-
ENOEXEC
;
}
/* Override their sizes */
sechdrs
[
me
->
arch
.
core_plt_section
].
sh_size
=
get_plt_size
(
hdr
,
sechdrs
,
secstrings
,
0
);
sechdrs
[
me
->
arch
.
init_plt_section
].
sh_size
=
get_plt_size
(
hdr
,
sechdrs
,
secstrings
,
1
);
return
0
;
}
int
apply_relocate
(
Elf32_Shdr
*
sechdrs
,
const
char
*
strtab
,
...
...
@@ -123,7 +136,8 @@ int apply_relocate (Elf32_Shdr *sechdrs, const char *strtab,
}
/* Set up a trampoline in the PLT to bounce us to the distant function */
static
uint32_t
do_plt_call
(
void
*
location
,
Elf32_Addr
val
,
struct
module
*
mod
)
static
uint32_t
do_plt_call
(
void
*
location
,
Elf32_Addr
val
,
Elf32_Shdr
*
sechdrs
,
struct
module
*
mod
)
{
struct
v850_plt_entry
*
entry
;
/* Instructions used to do the indirect jump. */
...
...
@@ -137,10 +151,10 @@ static uint32_t do_plt_call(void *location, Elf32_Addr val, struct module *mod)
/* Init, or core PLT? */
if
(
location
>=
mod
->
module_core
&&
location
<
mod
->
module_core
+
mod
->
arch
.
core_plt_offset
)
entry
=
mod
->
module_core
+
mod
->
arch
.
core_plt_offset
;
&&
location
<
mod
->
module_core
+
mod
->
core_size
)
entry
=
(
void
*
)
sechdrs
[
mod
->
arch
.
core_plt_section
].
sh_addr
;
else
entry
=
mod
->
module_init
+
mod
->
arch
.
init_plt_offset
;
entry
=
(
void
*
)
sechdrs
[
mod
->
arch
.
init_plt_section
].
sh_addr
;
/* Find this entry, or if that fails, the next avail. entry */
while
(
entry
->
tramp
[
0
])
...
...
@@ -199,7 +213,7 @@ int apply_relocate_add (Elf32_Shdr *sechdrs, const char *strtab,
/* Maybe jump indirectly via a PLT table entry. */
if
((
int32_t
)(
val
-
(
uint32_t
)
loc
)
>
0x1fffff
||
(
int32_t
)(
val
-
(
uint32_t
)
loc
)
<
-
0x200000
)
val
=
do_plt_call
(
loc
,
val
,
mod
);
val
=
do_plt_call
(
loc
,
val
,
sechdrs
,
mod
);
val
-=
(
uint32_t
)
loc
;
...
...
include/asm-v850/module.h
View file @
9f7470bf
/*
* include/asm-v850/module.h -- Architecture-specific module hooks
*
* Copyright (C) 2001,02 NEC Corporation
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
* Copyright (C) 2001 Rusty Russell
* Copyright (C) 2001,02
,03
NEC Corporation
* Copyright (C) 2001,02
,03
Miles Bader <miles@gnu.org>
* Copyright (C) 2001
,03
Rusty Russell
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
...
...
@@ -27,16 +27,28 @@ struct v850_plt_entry
struct
mod_arch_specific
{
/* How much of the core is actually taken up with core (then
we know the rest is for the PLT). */
unsigned
int
core_plt_offset
;
/* Same for init. */
unsigned
int
init_plt_offset
;
/* Indices of PLT sections within module. */
unsigned
int
core_plt_section
,
init_plt_section
;
};
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Ehdr Elf32_Ehdr
/* Make empty sections for module_frob_arch_sections to expand. */
#ifdef MODULE
asm
(
".section .plt,
\"
ax
\"
,@nobits; .align 3; .previous"
);
asm
(
".section .init.plt,
\"
ax
\"
,@nobits; .align 3; .previous"
);
#endif
/* We don't do exception tables. */
struct
exception_table_entry
;
static
inline
const
struct
exception_table_entry
*
search_extable
(
const
struct
exception_table_entry
*
first
,
const
struct
exception_table_entry
*
last
,
unsigned
long
value
)
{
return
0
;
}
#endif
/* __V850_MODULE_H__ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment