Commit Graph

11 Commits

Author SHA1 Message Date
Alexander Fedotov f6ef29c48f Fixed semihosting for AArch64 when heapinfo parameters are not provided by debugger 2017-10-24 17:27:51 +02:00
Alexander Fedotov-B55613 3ec9892f5d move ILP32 sanity check on heap base code under ARM_RDI_MONITOR 2017-08-24 14:41:19 +02:00
Szabolcs Nagy cfa64a86d1 Fix crt0 init fini code
__USES_INITFINI__ ifdef was incorrectly copied from arm
(it's an arm backend thing in gcc, not meaningful on aarch64)
2017-08-17 13:45:26 +02:00
Alexander Fedotov-B55613 7e69f983a4 fix typo in AArch64 crt0 2017-08-15 16:19:25 +02:00
Alexander Fedotov-B55613 1f6644876e use stack from linker script when nosys 2017-08-14 10:18:14 +02:00
Yao Qi 32ca315312 Don't fetch command line options without semi-hosting
Nowadays, the code fetching command line options via semi-hosting are
unconditionally pulled in, so that the semi-hosting code is still
there even I compile with option --specs=nosys.specs.

gdb ./aarch64-none-elf/libgloss/aarch64/crt0.o

(gdb) disassemble _start

   0x0000000000000050 <+80>:	ldr	x1, 0x128 <_cpu_init_hook+48>
   0x0000000000000054 <+84>:	mov	w0, #0x15
   0x0000000000000058 <+88>:	hlt	#0xf000

This patch fixes this problem by wrapping the code by ARM_RDI_MONITOR.
When semi-hosting is not used, set command line options to NULL.
2017-08-09 17:43:09 +02:00
Tamar Christina 13665a7c30 Fix link when nosys.specs is used to link
This patch fixes the issue where nosys.specs is used to link.
e.g. The use of crt0 without any support for semihosting requested.

The AArch64 crt0 was missing an #ifdef for the initialise_monitor_handles
which was causing the link to fail. Sorry for missing this before.
2017-07-14 10:36:32 +02:00
Laurent ALFONSI 9b1167219a ARM/AArch64: Fix GetCmdLine semihosting directives
When simulating arm code, the target program startup code (crt0) uses
semihosting invocations to get the command line from the simulator. The
simulator returns the command line and its size into the area passed in
parameter. (ARM 32-bit specifications :
http://infocenter.arm.com/help/topic/com.arm.doc.dui0058d/DUI0058.pdf
chapter "5.4.19 SYS_GET_CMDLINE").

The memory area pointed by the semihosting register argument is located
in .text section (usually not writtable (RX)).

If we run this code on a simulator that respects this rights properties
(qemu user-mode for instance), the command line will not be written to
the .text program memory, in particular the length of the string. The
program runs with an empty command line. This problem hasn't been seen
earlier probably because qemu user-mode is not so much used, but this can
happen with another simulator that refuse to write in a read-only segment.

With this modification, the command line can be correctly passed to the
target program.

Changes:
- libgloss/arm/crt0.S : Arguments passed to the AngelSWI_Reason_GetCmdLine
  semihosting invocation are placed into .data section instead of .text
- libgloss/aarch64/crt0.S : Idem for aarch64 AngelSVC_Reason_GetCmdLine
  semihosting.
2017-05-19 15:45:58 -04:00
Corinna Vinschen 387b584725 * aarch64/crt0.S: Remove 'start'.
* arm/crt0.S: Ditto.
	* arm/redboot-crt0.S: Ditto.
2013-08-12 11:27:37 +00:00
Corinna Vinschen 15b1ed6dc7 * aarch64/crt0.S (GEN_DWORD): New macro definition.
(PTR_REG): Ditto.
	(PTR_SIZE): Ditto.
	(PTR_LOG_SIZE): Ditto.
	(start): Use GEN_DWORD to replace the .dword of HeapBase,
	__bss_start__, __bss_end__, FUNCTION(_fini), env and
	CommandLine; when __ILP32__ is defined, set the stack base to
	the top end of the 32-bit address space if the returned value
	from the Angel API call is larger than or equal to 4 GiB.
	Also carry out sanity check on the heap base; abort if the
	base is larger than or equal to 4 GiB.  Use other new
	macros in the instructions that processes the argv arrays.
	(StackBase): New lable; replace __stack_base__.
	(__stack_base__): Set with StackBase or StackBase + 4.
2013-06-25 12:06:15 +00:00
Jeff Johnston cdf81c0c4c 2012-09-26 Ian Bolton <ian.bolton@arm.com>
Jim MacArthur  <jim.macarthur@arm.com>
        Marcus Shawcroft  <marcus.shawcroft@arm.com>
        Nigel Stephens  <nigel.stephens@arm.com>
        Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
        Richard Earnshaw  <rearnsha@arm.com>
        Sofiane Naci  <sofiane.naci@arm.com>
        Tejas Belagod  <tejas.belagod@arm.com>
        Yufeng Zhang  <yufeng.zhang@arm.com>

        * aarch64/Makefile.in: New file.
        * aarch64/_exit.c: New file.
        * aarch64/_kill.c: New file.
        * aarch64/aclocal.m4: Generated.
        * aarch64/configure: Generated.
        * aarch64/configure.in: New file.
        * aarch64/cpu-init/Makefile.in: New file.
        * aarch64/cpu-init/rdimon-aem-el3.S: New file.
        * aarch64/crt0.S: New file.
        * aarch64/elf-rdimon.specs: New file.
        * aarch64/libcfunc.c: New file.
        * aarch64/svc.h: New file.
        * aarch64/syscalls.c: New file.
        * configure.in: Add AArch64.
        * configure: Re-generated.
2012-09-26 20:11:54 +00:00