Skip to content

Commit

Permalink
Add GCC version check to support building with toolchains based on GC…
Browse files Browse the repository at this point in the history
…C 4.7 or 4.9 
  • Loading branch information
lcirani committed May 25, 2020
1 parent 8308bee commit 32a28d3
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions source/lv1/startup.S
Original file line number Diff line number Diff line change
@@ -1,4 1,7 @@
#include "xenonsprs.h"
#define GCC_VERSION (__GNUC__ * 10000 \
__GNUC_MINOR__ * 100 \
__GNUC_PATCHLEVEL__)

.globl _start
_start:
Expand Down Expand Up @@ -63,13 66,21 @@ start_from_rom:

lis %r3, 0x8000
rldicr %r3, %r3, 32,31
oris %r3, %r3, start@high
#if GCC_VERSION >= 40900
oris %r3, %r3, start@high
#else
oris %r3, %r3, start@h
#endif
ori %r3, %r3, start@l
ld %r2, 8(%r3)

lis %r3, 0x8000
sldi %r3, %r3, 32
oris %r3, %r3, 1f@high
#if GCC_VERSION >= 40900
oris %r3, %r3, 1f@high
#else
oris %r3, %r3, 1f@h
#endif
ori %r3, %r3, 1f@l
mtctr %r3
bctr
Expand All @@ -85,7 96,11 @@ start_from_rom:
b 1b

start_from_libxenon:
lis %r3, wakeup_cpus@high
#if GCC_VERSION >= 40900
lis %r3, wakeup_cpus@high
#else
lis %r3, wakeup_cpus@h
#endif
ori %r3, %r3, wakeup_cpus@l
li %r4, 1
std %r4, 0(%r3)
Expand All @@ -96,7 111,11 @@ start_from_libxenon:
other_threads_waiter:
lis %r4, 0x8000
rldicr %r4, %r4, 32,31
oris %r4, %r4, processors_online@high
#if GCC_VERSION >= 40900
oris %r4, %r4, processors_online@high
#else
oris %r4, %r4, processors_online@h
#endif
ori %r4, %r4, processors_online@l
slwi %r3, %r3, 2
add %r4, %r4, %r3
Expand All @@ -105,7 124,11 @@ other_threads_waiter:

lis %r3, 0x8000
rldicr %r3, %r3, 32,31
oris %r3, %r3, secondary_hold_addr@high
#if GCC_VERSION >= 40900
oris %r3, %r3, secondary_hold_addr@high
#else
oris %r3, %r3, secondary_hold_addr@h
#endif
ori %r3, %r3, secondary_hold_addr@l

1:
Expand Down Expand Up @@ -148,8 171,11 @@ other_threads_startup:
mfmsr %r3
andc %r3,%r3,%r4
mtsrr1 %r3

lis %r3, start_from_rom@high
#if GCC_VERSION >= 40900
lis %r3, start_from_rom@high
#else
lis %r3, start_from_rom@h
#endif
ori %r3, %r3, start_from_rom@l

mtsrr0 %r3
Expand Down

0 comments on commit 32a28d3

Please sign in to comment.