diff options
author | Renaud Barbier <renaud.barbier@ge.com> | 2012-05-10 14:56:46 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-05-11 09:06:44 +0200 |
commit | 6cd96bded74a23f2edd2a917bef45a705a4bb374 (patch) | |
tree | 0fbc9292821446fa7e183123109289fb5828ddac /arch/ppc/lib | |
parent | f755d703c450c8c828c4eb503e6a61a5c1e2c38e (diff) | |
download | barebox-6cd96bded74a23f2edd2a917bef45a705a4bb374.tar.gz barebox-6cd96bded74a23f2edd2a917bef45a705a4bb374.tar.xz |
ppc reloc.S: use a common trap relocation function
The trap relocation function trap_reloc can be used across several PPC
platforms and is added to the ppc library. Accordingly, the definition
of trap_reloc is removed from mach-mpc5xxx/start.S
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/ppc/lib')
-rw-r--r-- | arch/ppc/lib/Makefile | 1 | ||||
-rw-r--r-- | arch/ppc/lib/reloc.S | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile index 0f5e01761d..ba2f078b62 100644 --- a/arch/ppc/lib/Makefile +++ b/arch/ppc/lib/Makefile @@ -8,4 +8,5 @@ obj-y += misc.o obj-$(CONFIG_CMD_BOOTM) += ppclinux.o obj-$(CONFIG_MODULES) += module.o obj-y += crtsavres.o +obj-y += reloc.o diff --git a/arch/ppc/lib/reloc.S b/arch/ppc/lib/reloc.S new file mode 100644 index 0000000000..92ee189494 --- /dev/null +++ b/arch/ppc/lib/reloc.S @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Wolfgang Denk <wd@denx.de> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <asm/ppc_asm.tmpl> + + .file "reloc.S" + + .text + /* + * Function: relocate entries for one exception vector + */ + .globl trap_reloc + .type trap_reloc, @function +trap_reloc: + lwz r0, 0(r7) /* hdlr ... */ + add r0, r0, r3 /* ... += dest_addr */ + stw r0, 0(r7) + + lwz r0, 4(r7) /* int_return ... */ + add r0, r0, r3 /* ... += dest_addr */ + stw r0, 4(r7) + + lwz r0, 8(r7) /* transfer_to_handler ...*/ + add r0, r0, r3 /* ... += dest_addr */ + stw r0, 8(r7) + + blr + .size trap_reloc, .-trap_reloc |