Skip to content

Commit

Permalink
Make hardware_init_hook() and software_init_hook() available in semih…
Browse files Browse the repository at this point in the history
…osting as well.
  • Loading branch information
alfedotov committed Feb 4, 2019
1 parent 4cabb1f commit 7d38977
Showing 1 changed file with 24 additions and 31 deletions.
55 changes: 24 additions & 31 deletions libgloss/arm/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@
ldr sl, .LC2
add sl, sl, #256
#endif
#else
#ifdef ARM_RDI_MONITOR
#elif defined (ARM_RDI_MONITOR)
/* Issue Angel SWI to read stack info */
movs r0, #AngelSWI_Reason_HeapInfo
adr r1, .LC0 /* point at ptr to 4 words to receive data */
Expand Down Expand Up @@ -286,7 +285,7 @@
sub sl, r3, #64 << 10 /* Still assumes 256bytes below sl */
#endif
#endif
#endif

/* Zero the memory in the .bss section. */
movs a2, #0 /* Second arg: fill value */
mov fp, a2 /* Null frame pointer */
Expand All @@ -309,22 +308,20 @@ __change_mode:
#endif

bl FUNCTION (memset)
#if !defined (ARM_RDP_MONITOR) && !defined (ARM_RDI_MONITOR)
/* Changes by toralf: Taken from libgloss/m68k/crt0.S
* initialize target specific stuff. Only execute these
* functions it they exist.
*/

/* Initialize target specific stuff. Only execute these
functions it they exist. */
ldr r3, .Lhwinit
cmp r3, #0
beq .LC24
beq .Lno_hwinit
indirect_call r3
.LC24:
.Lno_hwinit:
ldr r3, .Lswinit
cmp r3, #0
beq .LC25
beq .Lno_swinit
indirect_call r3

.LC25:
.Lno_swinit:
#if !defined (ARM_RDP_MONITOR) && !defined (ARM_RDI_MONITOR)
movs r0, #0 /* no arguments */
movs r1, #0 /* no argv either */
#else
Expand Down Expand Up @@ -494,35 +491,31 @@ change_back:
.LC0:
#ifdef ARM_RDI_MONITOR
.word HeapBase
#else
#ifndef ARM_RDP_MONITOR
/* Changes by toralf: Provide alternative "stack" variable whose value
may be defined externally; .Lstack will be used instead of .LC0 if
it points to a non-0 value. Also set up references to "hooks" that
may be used by the application to provide additional init code. */

#elif defined (ARM_RDP_MONITOR)
/* Changes by toralf: Provide alternative "stack" variable whose value
may be defined externally; .Lstack will be used instead of .LC0 if
it points to a non-0 value. Also set up references to "hooks" that
may be used by the application to provide additional init code. */

#ifdef __pe__
.word 0x800000
#else
.word 0x80000 /* Top of RAM on the PIE board. */
#endif
.Lhwinit:
.word FUNCTION (hardware_init_hook)
.Lswinit:
.word FUNCTION (software_init_hook)
#endif

/* Set up defaults for the above variables in the form of weak symbols
- so that application will link correctly, and get value 0 in
runtime (meaning "ignore setting") for the variables, when the user
does not provide the symbols. (The linker uses a weak symbol if,
and only if, a normal version of the same symbol isn't provided
e.g. by a linker script or another object file.) */

.weak FUNCTION (hardware_init_hook)
.weak FUNCTION (software_init_hook)
#endif

#endif
e.g. by a linker script or another object file.) */
.Lhwinit:
.word FUNCTION (hardware_init_hook)
.weak FUNCTION (hardware_init_hook)
.Lswinit:
.word FUNCTION (software_init_hook)
.weak FUNCTION (software_init_hook)

.Lstack:
.word __stack
Expand Down

0 comments on commit 7d38977

Please sign in to comment.