Author: afaerber Date: Sun Nov 28 12:40:42 2010 New Revision: 976 URL: http://tracker.coreboot.org/trac/openbios/changeset/976
Log: ppc: Create function descriptors for global functions on ppc64
This should also fix linker errors observed by Blue.
v2: * __divide_error is called from C code, too. Spotted by Blue.
Cc: Blue Swirl blauwirbel@gmail.com Cc: Alexander Graf agraf@suse.de Signed-off-by: Andreas Färber andreas.faerber@web.de
Modified: trunk/openbios-devel/arch/ppc/qemu/start.S trunk/openbios-devel/include/arch/ppc/asmdefs.h
Modified: trunk/openbios-devel/arch/ppc/qemu/start.S ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/start.S Sat Nov 27 23:37:46 2010 (r975) +++ trunk/openbios-devel/arch/ppc/qemu/start.S Sun Nov 28 12:40:42 2010 (r976) @@ -285,8 +285,7 @@ exception_return: EXCEPTION_EPILOGUE
- .globl __divide_error -__divide_error: +_GLOBAL(__divide_error): trap_error: mflr r3 b BRANCH_LABEL(unexpected_excep) @@ -473,7 +472,7 @@ .long 0 .previous /* void call_elf( arg1, arg2, entry ) */ -GLOBL(call_elf): +_GLOBAL(call_elf): mflr r0 stwu r1,-16(r1) stw r0,20(r1) @@ -633,7 +632,7 @@ #define LG_CACHE_LINE_SIZE 5
/* flush_icache_range( unsigned long start, unsigned long stop) */ -GLOBL(flush_icache_range): +_GLOBAL(flush_icache_range): li r5,CACHE_LINE_SIZE-1 andc r3,r3,r5 subf r4,r3,r4
Modified: trunk/openbios-devel/include/arch/ppc/asmdefs.h ============================================================================== --- trunk/openbios-devel/include/arch/ppc/asmdefs.h Sat Nov 27 23:37:46 2010 (r975) +++ trunk/openbios-devel/include/arch/ppc/asmdefs.h Sun Nov 28 12:40:42 2010 (r976) @@ -118,6 +118,24 @@ #define EXTERN( name ) _##name #endif
+#if defined(__powerpc64__) && !defined(__darwin__) +#define _GLOBAL(name) \ + .align 2 ; \ + .section ".opd", "aw" ; \ + .globl name ; \ + .globl .##name ; \ + name: \ + .quad .##name ; \ + .quad .TOC.@tocbase ; \ + .quad 0 ; \ + .previous ; \ + .type .##name, @function ; \ + .##name +#else +#define _GLOBAL(name) \ + GLOBL(name) +#endif + #define BIT(n) (1<<(31-(n)))
#endif /* _H_ASMDEFS */
On Sun, Nov 28, 2010 at 11:40 AM, repository service svn@openbios.org wrote:
Author: afaerber Date: Sun Nov 28 12:40:42 2010 New Revision: 976 URL: http://tracker.coreboot.org/trac/openbios/changeset/976
Log: ppc: Create function descriptors for global functions on ppc64
This should also fix linker errors observed by Blue.
Not yet: LINK openbios-qemu.elf libdrivers.a(timer.o): In function `udelay': /src/openbios-devel/obj-ppc64/../drivers/timer.c:91: undefined reference to `._wait_ticks'
How about this change (get_ticks is not used elsewhere, no need to export it):
diff --git a/arch/ppc/timebase.S b/arch/ppc/timebase.S index c519511..38d2566 100644 --- a/arch/ppc/timebase.S +++ b/arch/ppc/timebase.S @@ -4,7 +4,7 @@ /* * unsigned long long _get_ticks(void); */ -GLOBL(_get_ticks): +get_ticks: 1: mftbu r3 mftb r4 mftbu r5 @@ -15,16 +15,16 @@ GLOBL(_get_ticks): /* * Delay for a number of ticks */ -GLOBL(_wait_ticks): +_GLOBAL(_wait_ticks): mflr r8 /* save link register */ mr r7, r3 /* save tick count */ - bl _get_ticks /* Get start time */ + bl get_ticks /* Get start time */
/* Calculate end time */ addc r7, r4, r7 /* Compute end time lower */ addze r6, r3 /* and end time upper */
-1: bl _get_ticks /* Get current time */ +1: bl get_ticks /* Get current time */ subfc r4, r4, r7 /* Subtract current time from end time */ subfe. r3, r3, r6 bge 1b /* Loop until time expired */
Fix an error in generic ppc code as well. Reported by Blue.
Cc: Blue Swirl blauwirbel@gmail.com Signed-off-by: Andreas Färber andreas.faerber@web.de --- arch/ppc/timebase.S | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/ppc/timebase.S b/arch/ppc/timebase.S index c519511..19faed4 100644 --- a/arch/ppc/timebase.S +++ b/arch/ppc/timebase.S @@ -4,7 +4,7 @@ /* * unsigned long long _get_ticks(void); */ -GLOBL(_get_ticks): +_GLOBAL(_get_ticks): 1: mftbu r3 mftb r4 mftbu r5 @@ -15,16 +15,16 @@ GLOBL(_get_ticks): /* * Delay for a number of ticks */ -GLOBL(_wait_ticks): +_GLOBAL(_wait_ticks): mflr r8 /* save link register */ mr r7, r3 /* save tick count */ - bl _get_ticks /* Get start time */ + bl BRANCH_LABEL(_get_ticks) /* Get start time */
/* Calculate end time */ addc r7, r4, r7 /* Compute end time lower */ addze r6, r3 /* and end time upper */
-1: bl _get_ticks /* Get current time */ +1: bl BRANCH_LABEL(_get_ticks) /* Get current time */ subfc r4, r4, r7 /* Subtract current time from end time */ subfe. r3, r3, r6 bge 1b /* Loop until time expired */
On Sun, Nov 28, 2010 at 12:58 PM, Andreas Färber andreas.faerber@web.de wrote:
Fix an error in generic ppc code as well. Reported by Blue.
Cc: Blue Swirl blauwirbel@gmail.com Signed-off-by: Andreas Färber andreas.faerber@web.de
Acked-by: Blue Swirl blauwirbel@gmail.com
This fixes the build for me.
_get_ticks is not declared in any header, so exporting the symbol does not seem useful.
Am 28.11.2010 um 14:04 schrieb Blue Swirl:
On Sun, Nov 28, 2010 at 12:58 PM, Andreas Färber <andreas.faerber@web.de
wrote: Fix an error in generic ppc code as well. Reported by Blue.
Cc: Blue Swirl blauwirbel@gmail.com Signed-off-by: Andreas Färber andreas.faerber@web.de
Acked-by: Blue Swirl blauwirbel@gmail.com
This fixes the build for me.
Thanks, applied as r977.
_get_ticks is not declared in any header, so exporting the symbol does not seem useful.
We generally seem to be lacking suitable headers (and a dedicated source file in libopenbios/) for helpers like these. Other assembler functions called from C are declared in the source file before use.
Andreas
Am 28.11.2010 um 12:56 schrieb Blue Swirl:
On Sun, Nov 28, 2010 at 11:40 AM, repository service svn@openbios.org wrote:
Author: afaerber Date: Sun Nov 28 12:40:42 2010 New Revision: 976 URL: http://tracker.coreboot.org/trac/openbios/changeset/976
Log: ppc: Create function descriptors for global functions on ppc64
This should also fix linker errors observed by Blue.
Not yet: LINK openbios-qemu.elf libdrivers.a(timer.o): In function `udelay': /src/openbios-devel/obj-ppc64/../drivers/timer.c:91: undefined reference to `._wait_ticks'
How about this change (get_ticks is not used elsewhere, no need to export it):
It's documented as a C function in the comment above and may get handy later on, so I'd prefer to change the calling code. Mind to check and add your Tested-by?
diff --git a/arch/ppc/timebase.S b/arch/ppc/timebase.S index c519511..38d2566 100644 --- a/arch/ppc/timebase.S +++ b/arch/ppc/timebase.S @@ -4,7 +4,7 @@ /*
- unsigned long long _get_ticks(void);
*/ -GLOBL(_get_ticks): +get_ticks:
Any technical reason for changing the name? I'd assume it's copied from Linux or somewhere. __divide_error isn't exactly nice either.
Andreas
1: mftbu r3 mftb r4 mftbu r5 @@ -15,16 +15,16 @@ GLOBL(_get_ticks): /*
- Delay for a number of ticks
*/ -GLOBL(_wait_ticks): +_GLOBAL(_wait_ticks): mflr r8 /* save link register */ mr r7, r3 /* save tick count */
bl _get_ticks /* Get start time */
bl get_ticks /* Get start time */ /* Calculate end time */ addc r7, r4, r7 /* Compute end time lower */ addze r6, r3 /* and end time upper */
-1: bl _get_ticks /* Get current time */ +1: bl get_ticks /* Get current time */ subfc r4, r4, r7 /* Subtract current time from end time */ subfe. r3, r3, r6 bge 1b /* Loop until time expired */
On Sun, Nov 28, 2010 at 1:05 PM, Andreas Färber andreas.faerber@web.de wrote:
Am 28.11.2010 um 12:56 schrieb Blue Swirl:
On Sun, Nov 28, 2010 at 11:40 AM, repository service svn@openbios.org wrote:
Author: afaerber Date: Sun Nov 28 12:40:42 2010 New Revision: 976 URL: http://tracker.coreboot.org/trac/openbios/changeset/976
Log: ppc: Create function descriptors for global functions on ppc64
This should also fix linker errors observed by Blue.
Not yet: LINK openbios-qemu.elf libdrivers.a(timer.o): In function `udelay': /src/openbios-devel/obj-ppc64/../drivers/timer.c:91: undefined reference to `._wait_ticks'
How about this change (get_ticks is not used elsewhere, no need to export it):
It's documented as a C function in the comment above and may get handy later on, so I'd prefer to change the calling code.
Then it should be declared in some C header. It's like forgetting to use 'static' in C.
Mind to check and add your Tested-by?
I sent an Acked-by, though it also passed my compile test, so feel free to change that to Tested-by or even add both.
diff --git a/arch/ppc/timebase.S b/arch/ppc/timebase.S index c519511..38d2566 100644 --- a/arch/ppc/timebase.S +++ b/arch/ppc/timebase.S @@ -4,7 +4,7 @@ /* * unsigned long long _get_ticks(void); */ -GLOBL(_get_ticks): +get_ticks:
Any technical reason for changing the name? I'd assume it's copied from Linux or somewhere. __divide_error isn't exactly nice either.
After removing the export, we don't need to use underscore anymore. __divide_error is called from libgcc.
Am 28.11.2010 um 14:12 schrieb Blue Swirl:
On Sun, Nov 28, 2010 at 1:05 PM, Andreas Färber <andreas.faerber@web.de
wrote: Am 28.11.2010 um 12:56 schrieb Blue Swirl:
On Sun, Nov 28, 2010 at 11:40 AM, repository service <svn@openbios.org
wrote:
Author: afaerber Date: Sun Nov 28 12:40:42 2010 New Revision: 976 URL: http://tracker.coreboot.org/trac/openbios/changeset/976
Log: ppc: Create function descriptors for global functions on ppc64
This should also fix linker errors observed by Blue.
Not yet: LINK openbios-qemu.elf libdrivers.a(timer.o): In function `udelay': /src/openbios-devel/obj-ppc64/../drivers/timer.c:91: undefined reference to `._wait_ticks'
How about this change (get_ticks is not used elsewhere, no need to export it):
It's documented as a C function in the comment above and may get handy later on, so I'd prefer to change the calling code.
Then it should be declared in some C header. It's like forgetting to use 'static' in C.
Mind to check and add your Tested-by?
I sent an Acked-by, though it also passed my compile test, so feel free to change that to Tested-by or even add both.
diff --git a/arch/ppc/timebase.S b/arch/ppc/timebase.S index c519511..38d2566 100644 --- a/arch/ppc/timebase.S +++ b/arch/ppc/timebase.S @@ -4,7 +4,7 @@ /*
- unsigned long long _get_ticks(void);
*/ -GLOBL(_get_ticks): +get_ticks:
Any technical reason for changing the name? I'd assume it's copied from Linux or somewhere. __divide_error isn't exactly nice either.
After removing the export, we don't need to use underscore anymore.
So I gather, pure cosmetics. Feel free to commit a rename but please update the comment as well.
Andreas