mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-08 18:19:08 +08:00
libgloss: aarch64: Add support for Armv8-R AArch64
This patch adds support for Armv8-R AArch64. Armv8-R AArch64 has no EL3, so we don't set vbar_el3, and adjust the code to set up the MPU for Armv8-R. So build a different flavour of the startup code to support that. We also add a specs file that uses this alternative startup code which can be used with Armv8-R AArch64 models.
This commit is contained in:
parent
57b622e902
commit
2c792cb780
@ -85,7 +85,8 @@ RDIMON_BSP = librdimon${${MULTILIBNAME}}.a
|
|||||||
RDIMON_OBJS = $(patsubst %,rdimon-%,$(OBJS))
|
RDIMON_OBJS = $(patsubst %,rdimon-%,$(OBJS))
|
||||||
RDIMON_SCRIPTS = rdimon${${MULTILIBNAME}}.specs \
|
RDIMON_SCRIPTS = rdimon${${MULTILIBNAME}}.specs \
|
||||||
aem-ve${${MULTILIBNAME}}.specs \
|
aem-ve${${MULTILIBNAME}}.specs \
|
||||||
aem-validation${${MULTILIBNAME}}.specs
|
aem-validation${${MULTILIBNAME}}.specs \
|
||||||
|
aem-v8-r${${MULTILIBNAME}}.specs
|
||||||
RDIMON_INSTALL = install-rdimon
|
RDIMON_INSTALL = install-rdimon
|
||||||
|
|
||||||
CFLAGS = -g
|
CFLAGS = -g
|
||||||
|
@ -62,7 +62,7 @@ AR = @AR@
|
|||||||
LD = @LD@
|
LD = @LD@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
||||||
CPU_INIT_OBJS = rdimon-aem-el3.o
|
CPU_INIT_OBJS = rdimon-aem-el3.o rdimon-aem-v8-r.o
|
||||||
CPU_INIT_INSTALL = install-cpu-init
|
CPU_INIT_INSTALL = install-cpu-init
|
||||||
|
|
||||||
CFLAGS = -g
|
CFLAGS = -g
|
||||||
@ -79,10 +79,12 @@ all: ${CPU_INIT_OBJS}
|
|||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
|
|
||||||
# Static pattern rule for assembling cpu init files to object files.
|
rdimon-aem-el3.o : rdimon-aem-el3.S
|
||||||
${CPU_INIT_OBJS}: %.o: %.S
|
|
||||||
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||||
|
|
||||||
|
rdimon-aem-v8-r.o : rdimon-aem-el3.S
|
||||||
|
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -DBUILD_FOR_R_PROFILE -o $@ -c $<
|
||||||
|
|
||||||
clean mostlyclean:
|
clean mostlyclean:
|
||||||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x
|
rm -f a.out core *.i *.o *-test *.srec *.dis *.x
|
||||||
|
|
||||||
|
@ -43,7 +43,9 @@ _init_vectors:
|
|||||||
/* Installs a table of exception vectors to catch and handle all
|
/* Installs a table of exception vectors to catch and handle all
|
||||||
exceptions by terminating the process with a diagnostic. */
|
exceptions by terminating the process with a diagnostic. */
|
||||||
adr x0, vectors
|
adr x0, vectors
|
||||||
|
#ifndef BUILD_FOR_R_PROFILE
|
||||||
msr vbar_el3, x0
|
msr vbar_el3, x0
|
||||||
|
#endif
|
||||||
msr vbar_el2, x0
|
msr vbar_el2, x0
|
||||||
msr vbar_el1, x0
|
msr vbar_el1, x0
|
||||||
ret
|
ret
|
||||||
@ -110,6 +112,14 @@ vectors:
|
|||||||
.text
|
.text
|
||||||
.align 2
|
.align 2
|
||||||
_flat_map:
|
_flat_map:
|
||||||
|
#ifdef BUILD_FOR_R_PROFILE
|
||||||
|
mrs x0, sctlr_el2
|
||||||
|
orr x0, x0, #1 // SCTLR_EL2.M (enable MPU)
|
||||||
|
orr x0, x0, #(1 << 17) // SCTLR_EL2.BR (background regions)
|
||||||
|
msr sctlr_el2, x0
|
||||||
|
isb
|
||||||
|
ret
|
||||||
|
#else
|
||||||
/* Page table setup (identity mapping). */
|
/* Page table setup (identity mapping). */
|
||||||
adrp x0, ttb
|
adrp x0, ttb
|
||||||
add x0, x0, :lo12:ttb
|
add x0, x0, :lo12:ttb
|
||||||
@ -173,6 +183,7 @@ _flat_map:
|
|||||||
isb
|
isb
|
||||||
.Lnosve:
|
.Lnosve:
|
||||||
ret
|
ret
|
||||||
|
#endif
|
||||||
|
|
||||||
.data
|
.data
|
||||||
.align 12
|
.align 12
|
||||||
|
20
libgloss/aarch64/elf-aem-v8-r.specs
Normal file
20
libgloss/aarch64/elf-aem-v8-r.specs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# elf-aem-v8-r.specs
|
||||||
|
#
|
||||||
|
# Spec file for AArch64 baremetal newlib, libgloss on Armv8-R with version 2 of
|
||||||
|
# AngelAPI semi-hosting.
|
||||||
|
|
||||||
|
%rename link old_link
|
||||||
|
|
||||||
|
*link:
|
||||||
|
-Ttext-segment 0x10000 %(old_link)
|
||||||
|
|
||||||
|
%rename lib libc
|
||||||
|
|
||||||
|
*libgloss:
|
||||||
|
-lrdimon
|
||||||
|
|
||||||
|
*lib:
|
||||||
|
cpu-init/rdimon-aem-v8-r.o%s --start-group %(libc) %(libgloss) --end-group
|
||||||
|
|
||||||
|
*startfile:
|
||||||
|
crti%O%s crtbegin%O%s %{!pg:rdimon-crt0%O%s} %{pg:rdimon-crt0%O%s}
|
Loading…
x
Reference in New Issue
Block a user