This commit is contained in:
Calascibetta Romain 2024-12-23 23:44:47 +01:00
parent 40cc5affc0
commit 10b97045df
35 changed files with 395 additions and 958 deletions

View file

@ -15,16 +15,6 @@ $(TOPDIR)/Makeconf:
include $(TOPDIR)/Makeconf
# armstub8.bin: armstub8.S
# @echo "CC -DGIC=1 $<"
# @$(CC) -DGIC=1 -o ${<:S=o} -c $<
# @echo "LD --section-start=.text=0 ${<:S=o}"
# @$(LD) --section-start=.text=0 -o ${<:S=elf} ${<:S=o}
# @echo "DUMP ${<:S=elf}"
# @$(OBJDUMP) -D ${<:S=elf} > ${<:S=lst}
# @echo "COPY ${<:S=elf}"
# @$(OBJCOPY) ${<:S=elf} -O binary $@
include/$(CONFIG_TARGET_TRIPLE):
@echo "GEN $@"
@./gen-headers.sh $@
@ -55,6 +45,9 @@ SRCS= kernel.c timer.c led.c interrupt_handler.c exception_handler.c \
ASMS= startup.S exception_stub.S
SRCS:=$(addprefix kernel/,$(SRCS))
ASMS:=$(addprefix kernel/,$(ASMS))
OBJS= $(SRCS:c=o) $(ASMS:S=o)
%.o: %.S
@ -65,7 +58,7 @@ OBJS= $(SRCS:c=o) $(ASMS:S=o)
@echo "CC $@"
@$(CC) $(CFLAGS) -c -o $@ $<
libgilbraltar.a: $(OBJS)
kernel/libgilbraltar.a: $(OBJS)
@echo "AR $@"
@rm -f $@
@$(AR) cr $@ $^
@ -77,6 +70,37 @@ phony-openlibm: include/$(CONFIG_TARGET_TRIPLE)
openlibm/libopenlibm.a: phony-openlibm
ocaml:
test ! -d $@
cp -r "$$(ocamlfind query ocaml-src)" $@
VERSION="$$(head -n1 ocaml/VERSION)" ; \
if test -d "patches/$$VERSION" ; then \
git apply --directory=$@ "patches/$$VERSION"/*; \
fi
ocaml/Makefile.config: | ocaml
PATH="$$PWD/$(TOOLDIR_FOR_BUILD):$$PATH" ;
cd ocaml && \
./configure \
--target="$(MAKECONF_TARGET_ARCH)-gilbraltar-ocaml" \
--prefix="$(MAKECONF_SYSROOT)" \
--disable-shared \
--disable-systhreads \
--disable-unix-lib \
--disable-instrumented-runtime \
--disable-debug-runtime \
--disable-ocamltest \
--disable-ocamldoc \
--disable-zstd \
$(MAKECONF_OCAML_CONFIGURE_OPTIONS)
OCAML_IS_BUILT := _build/ocaml_is_built
$(OCAML_IS_BUILT): ocaml/Makefile.config | _build
PATH="$$PWD/$(TOOLDIR_FOR_BUILD):$$PATH" $(MAKE) -C ocaml cross.opt
cd ocaml && ocamlrun tools/stripdebug ocamlc ocamlc.tmp
cd ocaml && ocamlrun tools/stripdebug ocalmopt ocamlopt.tmp
touch $@
NOLIBC_CFLAGS= $(CFLAGS) -I $(TOPDIR)/nolibc/include -I $(TOPDIR)/openlibm/src -I $(TOPDIR)/openlibm/include
.PHONY: phony-nolibc
@ -87,35 +111,28 @@ phony-nolibc: include/$(CONFIG_TARGET_TRIPLE)
nolibc/libnolibc.a: phony-nolibc
.PHONY: all
all: libgilbraltar.a
all: kernel/libgilbraltar.a
.PHONY: clean
clean:
$(RM) -f *.o *.a *.elf *.bin *.lst *.img
$(RM) -f kernel/*.o kernel/*.a *.elf *.bin *.img *.map
$(RM) -rf include/$(CONFIG_TARGET_TRIPLE)
$(RM) -rf _build
if [ -d ocaml ] ; then $(MAKE) -C ocaml clean ; fi
$(RM) -f test/*.o
$(MAKE) -C openlibm clean
$(MAKE) -C nolibc clean FREESTANDING_CFLAGS=_
.PHONY: distclean
distclean: clean
$(RM) -f Makeconf
$(RM) -f Makeconf Makeconf.sh
if [ -d ocaml ] ; then $(MAKE) -C ocaml distclean ; fi
test/%.o: test/%.c
@echo "CC $@"
@$(CC) $(CFLAGS) -c -o $@ $<
test01.img: libgilbraltar.a nolibc/libnolibc.a openlibm/libopenlibm.a test/test01.o
kernel_2712.img: kernel/libgilbraltar.a nolibc/libnolibc.a openlibm/libopenlibm.a test/test.o
@echo "LD ${@:img=elf}"
@$(LD) test/${@:img=o} -o ${@:img=elf} $(LDFLAGS) -Wl,-T gilbraltar.ld
@$(OBJCOPY) ${@:img=elf} -O binary $@
test02.img: libgilbraltar.a nolibc/libnolibc.a openlibm/libopenlibm.a test/test02.o
@echo "LD ${@:img=elf}"
@$(LD) test/${@:img=o} -o ${@:img=elf} $(LDFLAGS) -Wl,-T gilbraltar.ld
@$(OBJCOPY) ${@:img=elf} -O binary $@
test03.img: libgilbraltar.a nolibc/libnolibc.a openlibm/libopenlibm.a test/test03.o
@echo "LD ${@:img=elf}"
@$(LD) test/${@:img=o} -o ${@:img=elf} $(LDFLAGS) -Wl,-Map ${@:img=map} -Wl,-T gilbraltar.ld
@$(LD) test/test.o -o ${@:img=elf} $(LDFLAGS) -Wl,-Map ${@:img=map} -Wl,-T gilbraltar.ld
@$(OBJCOPY) ${@:img=elf} -O binary $@

View file

@ -1,213 +0,0 @@
/*
* Copyright (c) 2024 Romain Calascibetta <romain.calascibetta@gmail.com>
* Copyright (c) 2016-2019 Raspberry Pi (Trading) Ltd.
* Copyright (c) 2016 Stephen Warren <swarren@wwwdotorg.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#define BIT(x) (1 << (x))
#define LOCAL_CONTROL 0xff800000
#define LOCAL_PRESCALER 0xff800008
#define GIC_DISTB 0xff841000
#define GIC_CPUB 0xff842000
#define OSC_FREQ 54000000
#define SCR_RW BIT(10)
#define SCR_HCE BIT(8)
#define SCR_SMD BIT(7)
#define SCR_RES1_5 BIT(5)
#define SCR_RES1_4 BIT(4)
#define SCR_NS BIT(0)
#define SCR_VAL \
(SCR_RW | SCR_HCE | SCR_SMD | SCR_RES1_5 | SCR_RES1_4 | SCR_NS)
#define ACTLR_VAL \
(BIT(0) | BIT(1) | BIT(4) | BIT(5) | BIT(6))
#define CPUECTLR_EL1 S3_1_C15_C2_1
#define CPUECTLR_EL1_SMPEN BIT(6)
#define SPSR_EL3_D BIT(9)
#define SPSR_EL3_A BIT(8)
#define SPSR_EL3_I BIT(7)
#define SPSR_EL3_F BIT(6)
#define SPSR_EL3_MODE_EL2H 9
#define SPSR_EL3_VAL \
(SPSR_EL3_D | SPSR_EL3_A | SPSR_EL3_I | SPSR_EL3_F | SPSR_EL3_MODE_EL2H)
#define L2CTLR_EL1 S3_1_C11_C0_2
#define GICC_CTRLR 0x0
#define GICC_PMR 0x4
#define IT_NR 0x8 // Number of interrupt enable registers (256 total irqs)
#define GICD_CTRLR 0x0
#define GICD_IGROUPR 0x80
.globl _start
_start:
// LOCAL_CONTROL:
// Bit 9 clear: Increment by 1 (vs. 2).
// Bit 8 clear: Timer source is 19.2MHz crystal (vs. APB).
ldr x0, =LOCAL_CONTROL
str wzr, [x0]
// LOCAL_PRESCALER; divide-by (0x80000000 / register_val) == 1
mov w1, 0x80000000
str w1, [x0, #(LOCAL_PRESCALER - LOCAL_CONTROL)]
// Set L2 read/write cache latency to 3
mrs x0, L2CTLR_EL1
mov x1, #0x22
orr x0, x0, x1
msr L2CTLR_EL1, x0
// Set up CNTFRQ_EL0
ldr x0, =OSC_FREQ
msr CNTFRQ_EL0, x0
// Set up CNTVOFF_EL2
msr CNTVOFF_EL2, xzr
// Enable FP/SIMD
// Bit 10 (TFP) is set to 0
msr CPTR_EL3, xzr
// Set up SCR
mov x0, #SCR_VAL
msr SCR_EL3, x0
// Set up ACTLR
mov x0, #ACTLR_VAL
msr ACTLR_EL3, x0
// Set SMPEN
mov x0, #CPUECTLR_EL1_SMPEN
msr CPUECTLR_EL1, x0
#ifdef GIC
bl setup_gic
#endif
// Set up SCTLR_EL2
// All set bits below are res1. LE, no WXN/I/SA/C/A/M
ldr x0, =0x30c50830
msr SCTLR_EL2, x0
// Switch to EL2
mov x0, #SPSR_EL3_VAL
msr spsr_el3, x0
adr x0, in_el2
msr elr_el3, x0
eret
in_el2:
mrs x6, MPIDR_EL1
and x6, x6, #0x3
cbz x6, primary_cpu
adr x5, spin_cpu0
secondary_spin:
wfe
ldr x4, [x5, x6, lsl #3]
cbz x4, secondary_spin
mov x0, #0
b boot_kernel
primary_cpu:
ldr w4, kernel_entry32
ldr w0, dtb_ptr32
boot_kernel:
mov x1, #0
mov x2, #0
mov x3, #0
br x4
.ltorg
.org 0xd8
.globl spin_cpu0
spin_cpu0:
.quad 0
.org 0xe0
.globl spin_cpu1
spin_cpu1:
.quad 0
.org 0xe8
.globl spin_cpu2
spin_cpu2:
.quad 0
.org 0xf0
.globl spin_cpu3
spin_cpu3:
# Shared with next two symbols/.word
# FW clears the next 8 bytes after reading the initial value, leaving
# the location suitable for use as spin_cpu3
.org 0xf0
.globl stub_magic
stub_magic:
.word 0x5afe570b
.org 0xf4
.globl stub_version
stub_version:
.word 0
.org 0xf8
.globl dtb_ptr32
dtb_ptr32:
.word 0x0
.org 0xfc
.globl kernel_entry32
kernel_entry32:
.word 0x0
.org 0x100
#ifdef GIC
setup_gic: // Called from secure mode - set all interrupts to group 1 and enable.
mrs x0, MPIDR_EL1
ldr x2, =GIC_DISTB
tst x0, #0x3
b.eq 2f // primary core
mov w0, #3 // Enable group 0 and 1 IRQs from distributor
str w0, [x2, #GICD_CTRLR]
2:
add x1, x2, #(GIC_CPUB - GIC_DISTB)
mov w0, #0x1e7
str w0, [x1, #GICC_CTRLR] // Enable group 1 IRQs from CPU interface
mov w0, #0xff
str w0, [x1, #GICC_PMR] // priority mask
add x2, x2, #GICD_IGROUPR
mov x0, #(IT_NR * 4)
mov w1, #~0 // group 1 all the things
3:
subs x0, x0, #4
str w1, [x2, x0]
b.ne 3b
ret
#endif
.globl dtb_space
dtb_space:

View file

@ -47,12 +47,11 @@ BCM2712 is the Broadcom chip used by Raspberry Pi 5
| 00350000 | 32 KByte | for Core 2 |
| 00358000 | 32 KByte | for Core 3 |
| 00360000 | | End of FIQ stacks |
| | Page Table | |
| 00360000 | 16 KByte | |
| 00364000 | | End of page table |
| 00500000 | 4 MByte | Coherent region |
| 00900000 | | |
| 1b000000 | 16 MByte | Pager |
| 1c000000 | | |
| 40000000 | | Heap |
| ...
| 1FFFFFFFF | 8192 MB | Heap |
| 100000000 | 8192 MB | Heap |
| 1000000000 | 16 MByte | AXI peripherals |

133
gen_toolchain_tool.sh Executable file
View file

@ -0,0 +1,133 @@
#!/bin/sh
# Generate a wrapper for Gilbraltar (G)CC, ld, objcopy and any other binutil
# Expected argument: the tool to generate
# Expected environment variables:
# ARCH: the target architecture (x86_64 or aarch64)
# TOOL_CFLAGS and TOOL_LDFLAGS: extra flags
# GILBRALTAR_TOOLCHAIN: the target for the wrapped Gilbraltar toolchain
# OTHERTOOLPREFIX: the prefix for tools not in the Gilbraltar toolchain
# TARGET_X: overrides the command for binutil X
gen_cc() {
# Note that -nostdlib is not required, as it is injected by Solo5' cc, ld
CFLAGS="$TOOL_CFLAGS"
LDFLAGS="$TOOL_LDFLAGS"
EXTRALIBS=""
case "$ARCH" in
aarch64)
EXTRALIBS="-lgcc"
;;
esac
# Add the -Wno-unused-command-line-argument option for clang, as we always
# give it compiling options, even if it will be only linking
# Reuse the test from Solo5 to detect clang
if "$SOLO5_TOOLCHAIN-cc" -dM -E - </dev/null | grep -Eq '^#define __clang__ 1$'
then CFLAGS="-Wno-unused-command-line-argument $CFLAGS"
fi
cat << EOF
#!/bin/sh
# Just like the Solo5 cc, we assume that we are linking, unless we find an
# argument suggesting we are compiling but we call Solo5' cc regardless
compiling=
for arg in "\$@"; do
case "\$arg" in
-[cSE])
compiling="\$arg"
break
;;
esac
done
set -- \\
$CFLAGS \\
-include _solo5/overrides.h \\
-D__BSD_VISIBLE=0 \\
-D__XSI_VISIBLE=0 \\
"\$@"
if [ -z "\$compiling" ]; then
# linking options
set -- \\
"\$@" \\
$LDFLAGS \\
-Wl,--start-group \\
-lnolibc \\
-lopenlibm \\
$EXTRALIBS \\
-Wl,--end-group
fi
[ -n "\${__V}" ] && set -x
exec "$SOLO5_TOOLCHAIN-cc" "\$@"
EOF
}
gen_tool() {
TOOL="$1"
case "$TOOL" in
ar)
TARGET_TOOL="$TARGET_AR"
;;
as)
TARGET_TOOL="$TARGET_AS"
;;
ld)
TARGET_TOOL="$TARGET_LD"
;;
nm)
TARGET_TOOL="$TARGET_NM"
;;
objcopy)
TARGET_TOOL="$TARGET_OBJCOPY"
;;
objdump)
TARGET_TOOL="$TARGET_OBJDUMP"
;;
ranlib)
TARGET_TOOL="$TARGET_RANLIB"
;;
readelf)
TARGET_TOOL="$TARGET_READELF"
;;
strip)
TARGET_TOOL="$TARGET_STRIP"
;;
esac
if test "$TARGET_TOOL" ; then
TOOL="$TARGET_TOOL"
elif command -v -- "$SOLO5_TOOLCHAIN-$TOOL" > /dev/null; then
TOOL="$SOLO5_TOOLCHAIN-$TOOL"
else
case "$TOOL" in
as)
TOOL="$SOLO5_TOOLCHAIN-cc -c"
;;
*)
if command -v -- "$OTHERTOOLPREFIX$TOOL" > /dev/null; then
TOOL="$OTHERTOOLPREFIX$TOOL"
fi
;;
esac
fi
cat << EOF
#!/bin/sh
exec $TOOL "\$@"
EOF
}
case "$1" in
cc|gcc)
gen_cc
;;
*)
gen_tool "$1"
;;
esac

View file

@ -2,5 +2,6 @@
#define __GILBRALTAR_MEMORY__
void gilbraltar_memory_init(void);
void gilbraltar_get_heap(uintptr_t *, uintptr_t *);
#endif

View file

@ -1,78 +0,0 @@
#include <crt.h>
#include <dtb.h>
#include <log.h>
#include <mem.h>
#include <memory.h>
#include <power.h>
#include <serial.h>
#include <stdlib.h>
#include <string.h>
#include <synchronize.h>
#include <tag.h>
extern int main(int, char *const *);
extern char __bss_start;
extern char _etext[];
extern char _end[];
#define PROPTAG_GET_COMMAND_LINE 0x00050001
struct __attribute__((packed)) command_line {
uint32_t id;
uint32_t value_len;
uint32_t param_len;
uint8_t str[2048];
};
static size_t split(char *src, char *dst[], size_t len) {
int i = 0;
char *rem = src;
while (rem != NULL && *rem != '\0' && i < len) {
char *e = strstr(rem, " ");
dst[i++] = rem;
if (e != NULL) {
*e = '\0';
while (*(++e) == ' ')
;
}
rem = e;
}
return (i);
}
void gilbraltar_sysinit(void) {
enable_fiqs();
enable_irqs();
memset(&__bss_start, 0, (uintptr_t)_end - (uintptr_t)__bss_start);
crt_init_ssp();
gilbraltar_serial_init();
gilbraltar_memory_init();
struct command_line p;
char *cmdline[64] = {NULL};
size_t ac = 1;
cmdline[0] = "gilbraltar";
if (!gilbraltar_get_tag(PROPTAG_GET_COMMAND_LINE, &p, sizeof(p), 2048)) {
gilbraltar_log(ERROR, "Impossible to retrieve cmdline.txt.\r\n");
ac = 1;
} else if (p.param_len >= sizeof(p.str)) {
gilbraltar_log(ERROR, "cmdline.txt too long.\r\n");
ac = 1;
} else {
p.str[p.param_len] = '\0';
ac = split((char *)p.str, cmdline + 1, 62);
}
gilbraltar_dtb_init();
int ret = main(ac + 1, cmdline);
gilbraltar_log(DEBUG, "End of program: %3d.", ret);
if (ret == 0)
poweroff();
}

View file

View file

@ -39,10 +39,5 @@ bool gilbraltar_dtb_init(void) {
if (total_size < sizeof(struct header) || total_size > DTB_MAX_SIZE)
return false;
gilbraltar_log(INFO, " dtb magic : %04x\r\n", be32toh(hdr->magic));
gilbraltar_log(INFO, "dtb version : %d\r\n", be32toh(hdr->last_comp_version));
gilbraltar_log(INFO, " dtb size : %d byte(s)\r\n",
be32toh(hdr->total_size));
return true;
}

126
kernel/kernel.c Normal file
View file

@ -0,0 +1,126 @@
#include <crt.h>
#include <dtb.h>
#include <log.h>
#include <mem.h>
#include <memory.h>
#include <power.h>
#include <serial.h>
#include <stdlib.h>
#include <string.h>
#include <synchronize.h>
#include <sysconfig.h>
#include <tag.h>
extern int main(int, char *const *);
extern char __bss_start;
extern char _etext[];
extern char _end[];
#define PROPTAG_GET_COMMAND_LINE 0x00050001
struct __attribute__((packed)) command_line {
uint32_t id;
uint32_t value_len;
uint32_t param_len;
uint8_t str[2048];
};
static size_t split(char *src, char *dst[], size_t len) {
int i = 0;
char *rem = src;
while (rem != NULL && *rem != '\0' && i < len) {
char *e = strstr(rem, " ");
dst[i++] = rem;
if (e != NULL) {
*e = '\0';
while (*(++e) == ' ')
;
}
rem = e;
}
return (i);
}
void gilbraltar_dump(void) {
uintptr_t heap_start;
uintptr_t heap_end;
gilbraltar_get_heap(&heap_start, &heap_end);
uintptr_t kernel_start = MEM_KERNEL_START;
uintptr_t kernel_end = (uintptr_t)_etext;
uintptr_t kernel_top = (uintptr_t)_end;
uintptr_t kernel_stack_start = MEM_KERNEL_STACK - KERNEL_STACK_SIZE;
uintptr_t kernel_stack_end = MEM_KERNEL_STACK;
uintptr_t exn_stack_start = MEM_EXCEPTION_STACK - EXCEPTION_STACK_SIZE;
uintptr_t exn_stack_end = MEM_EXCEPTION_STACK;
uintptr_t irq_stack_start = MEM_IRQ_STACK - EXCEPTION_STACK_SIZE;
uintptr_t irq_stack_end = MEM_IRQ_STACK;
uintptr_t fiq_stack_start = MEM_FIQ_STACK - EXCEPTION_STACK_SIZE;
uintptr_t fiq_stack_end = MEM_FIQ_STACK;
uintptr_t page_table_start = MEM_PAGE_TABLE1;
uintptr_t page_table_end = MEM_PAGE_TABLE1_END;
uintptr_t coherent_region_start = MEM_COHERENT_REGION;
uintptr_t coherent_region_end = MEM_COHERENT_REGION + 4 * MEGABYTE;
gilbraltar_log(INFO, " _____ _ _ _ _ _ \r\n");
gilbraltar_log(INFO, "| __|_| | |_ ___ ___| | |_ ___ ___ \r\n");
gilbraltar_log(INFO, "| | | | | . | _| .'| | _| .'| _|\r\n");
gilbraltar_log(INFO, "|_____|_|_|___|_| |__,|_|_| |__,|_| \r\n");
gilbraltar_log(INFO, " BL31 @ 0x%08x - 0x%08x\r\n", 0x0, 0x8000);
gilbraltar_log(INFO, " EL3 stack @ 0x%08x\r\n", 0x6f000);
gilbraltar_log(INFO, " kernel @ 0x%08lx - 0x%08lx | 0x%08lx\r\n",
kernel_start, kernel_end, kernel_top);
gilbraltar_log(INFO, " stack @ 0x%08lx - 0x%08lx\r\n",
kernel_stack_start, kernel_stack_end);
gilbraltar_log(INFO, "exception stack @ 0x%08lx - 0x%08lx\r\n",
exn_stack_start, exn_stack_end);
gilbraltar_log(INFO, " irq stack @ 0x%08lx - 0x%08lx\r\n",
irq_stack_start, irq_stack_end);
gilbraltar_log(INFO, " fiq stack @ 0x%08lx - 0x%08lx\r\n",
fiq_stack_start, fiq_stack_end);
gilbraltar_log(INFO, " pages table @ 0x%08lx - 0x%08lx\r\n",
page_table_start, page_table_end);
gilbraltar_log(INFO, "coherent region @ 0x%08lx - 0x%08lx\r\n",
coherent_region_start, coherent_region_end);
gilbraltar_log(INFO, " heap @ 0x%08lx - 0x%08lx\r\n", heap_start,
heap_end);
gilbraltar_log(INFO, "\r\n");
}
void gilbraltar_sysinit(void) {
enable_fiqs();
enable_irqs();
memset(&__bss_start, 0, (uintptr_t)_end - (uintptr_t)__bss_start);
crt_init_ssp();
gilbraltar_serial_init();
gilbraltar_memory_init();
struct command_line p;
char *cmdline[64] = {NULL};
size_t ac = 1;
cmdline[0] = "gilbraltar";
if (!gilbraltar_get_tag(PROPTAG_GET_COMMAND_LINE, &p, sizeof(p), 2048)) {
gilbraltar_log(ERROR, "Impossible to retrieve cmdline.txt.\r\n");
ac = 1;
} else if (p.param_len >= sizeof(p.str)) {
gilbraltar_log(ERROR, "cmdline.txt too long.\r\n");
ac = 1;
} else {
p.str[p.param_len] = '\0';
ac = split((char *)p.str, cmdline + 1, 62);
}
gilbraltar_dtb_init();
gilbraltar_dump();
int ret = main(ac + 1, cmdline);
gilbraltar_log(DEBUG, "End of program: %3d.", ret);
if (ret == 0)
poweroff();
}

View file

View file

@ -2,7 +2,7 @@
#include <serial.h>
#include <stdio.h>
static enum log_level actual_level = DEBUG;
static enum log_level actual_level = INFO;
size_t gilbraltar_log(enum log_level level, const char *fmt, ...) {
if (actual_level < level)

View file

@ -1,7 +1,9 @@
#include <assert.h>
#include <log.h>
#include <mem.h>
#include <pager.h>
#include <stdint.h>
#include <stdlib.h>
#include <sysconfig.h>
#include <tag.h>
#include <translation_table.h>
@ -84,14 +86,89 @@ static void enable_mmu(void) {
__asm__ __volatile("msr sctlr_el1, %0" : : "r"(sctlr_el1) : "memory");
}
static uintptr_t sbrk_start;
static uintptr_t sbrk_end;
static uintptr_t sbrk_cur;
static uintptr_t sbrk_guard_size;
void *sbrk(intptr_t increment) {
uintptr_t prev, brk;
uintptr_t max = (uintptr_t)&prev - sbrk_guard_size;
prev = brk = sbrk_cur;
brk += increment;
if (brk >= max || brk >= sbrk_end || brk < sbrk_start)
return ((void *)(-1));
sbrk_cur = brk;
return ((void *)prev);
}
#define PROPTAG_GET_BOARD_REVISION 0x00010002
struct __attribute__((packed)) board_revision {
uint32_t id;
uint32_t value_len;
uint32_t param_len;
uint32_t revision;
};
void gilbraltar_memory_init(void) {
size_t rsv = ARM_MEM_SIZE - MEM_HEAP_START - PAGE_RESERVE;
gilbraltar_pager_init(MEM_HEAP_START + rsv, PAGE_RESERVE);
gilbraltar_log(INFO, " pager @ 0x%08lx - 0x%08lx\r\n",
MEM_HEAP_START + rsv, MEM_HEAP_START + rsv + PAGE_RESERVE);
gilbraltar_translation_table_init(ARM_MEM_SIZE);
enable_mmu();
instruction_sync_barrier();
struct board_revision b;
if (!gilbraltar_get_tag(PROPTAG_GET_BOARD_REVISION, &b, sizeof(b), 4)) {
gilbraltar_log(ERROR, "Impossible to retrieve the board revision.\r\n");
abort();
}
assert(b.revision & (1 << 23)); // new revision scheme
size_t ram_size = 256 << ((b.revision >> 20) & 7);
size_t heap_size = (ram_size - 1024) * MEGABYTE;
heap_size = (heap_size > (8 * GIGABYTE) - GIGABYTE)
? (8 * GIGABYTE) - GIGABYTE
: heap_size;
sbrk_guard_size = (heap_size >= MEGABYTE) ? MEGABYTE : (heap_size / 2);
sbrk_start = sbrk_cur = GIGABYTE;
sbrk_end = GIGABYTE + heap_size;
}
void gilbraltar_get_heap(uintptr_t *start, uintptr_t *end) {
*start = sbrk_start;
*end = sbrk_end;
}
#include <assert.h>
#define ABORT_ON_ASSERT_FAILURE 0
#undef WIN32
#define HAVE_MMAP 0
#define HAVE_MREMAP 0
#define MMAP_CLEARS 0
#define NO_MALLOC_STATS 1
#define LACKS_FCNTL_H
#define LACKS_SYS_PARAM_H
#define LACKS_SYS_MMAN_H
#define LACKS_STRINGS_H
#define LACKS_SYS_TYPES_H
#define LACKS_SCHED_H
#define LACKS_TIME_H
#define MALLOC_FAILURE_ACTION
#define USE_LOCKS 0 // TODO(dinosaure): for multicore.
#define STRUCT_MALLINFO_DECLARED 1
#define FOOTERS 1
/* disable null-pointer-arithmetic warning on clang */
#if defined(__clang__) && __clang_major__ >= 6
#pragma clang diagnostic ignored "-Wnull-pointer-arithmetic"
#endif
/* inline the dlmalloc implementation into this module */
#include "dlmalloc.i"

View file

View file

@ -60,7 +60,7 @@ uintptr_t gilbraltar_translation_table_base(void) {
void gilbraltar_translation_table_init(size_t size) {
l2_table = (union TARMV8MMU_LEVEL2_DESCRIPTOR *)gilbraltar_palloc();
gilbraltar_log(INFO, "L2 table allocated.\r\n");
gilbraltar_log(DEBUG, "L2 table allocated.\r\n");
memset(l2_table, 0, PAGE_SIZE);
@ -74,7 +74,7 @@ void gilbraltar_translation_table_init(size_t size) {
!(MEM_IOMEM_PCIE_START <= base_addr && base_addr <= MEM_IOMEM_PCIE_END))
continue; // as far as we can
gilbraltar_log(INFO, "New L3 table.\r\n");
gilbraltar_log(DEBUG, "New L3 table.\r\n");
union TARMV8MMU_LEVEL3_DESCRIPTOR *l3_table = new_level_l3_table(base_addr);
struct TARMV8MMU_LEVEL2_TABLE_DESCRIPTOR *desc = &l2_table[entry].table;

BIN
libgilbraltar.a Normal file

Binary file not shown.

6
test/test.c Normal file
View file

@ -0,0 +1,6 @@
#include <log.h>
int main(int ac, const char *av[]) {
gilbraltar_log(INFO, "Hello World!\r\n");
return (0);
}

View file

@ -1,15 +0,0 @@
#include <led.h>
#include <timer.h>
/* The kernel should start and the LED should blink.
* The time between blinks should be "fairly" long (around 1s).
*/
void main(void) {
while (1) {
gilbraltar_led(false);
gilbraltar_delay_hot_loop(0x3f0000);
gilbraltar_led(true);
gilbraltar_delay_hot_loop(0x3f0000);
}
}

View file

@ -1,9 +0,0 @@
#include <serial.h>
/* The kernel should start and you should see
* "Hello World!" in your terminal!
*/
void main(void) {
gilbraltar_serial_init();
gilbraltar_serial_puts("Hello World!\r\n");
}

View file

@ -1,28 +0,0 @@
#include <log.h>
#include <sysconfig.h>
extern char _etext[];
void main(void) {
gilbraltar_log(INFO, " _____ _ _ _ _ _ \r\n");
gilbraltar_log(INFO, "| __|_| | |_ ___ ___| | |_ ___ ___ \r\n");
gilbraltar_log(INFO, "| | | | | . | _| .'| | _| .'| _|\r\n");
gilbraltar_log(INFO, "|_____|_|_|___|_| |__,|_|_| |__,|_| \r\n");
gilbraltar_log(INFO, " BL31 @ 0x%08x - 0x%08x\r\n", 0x0, 0x8000);
gilbraltar_log(INFO, " EL3 stack @ 0x%08x\r\n", 0x6f000);
gilbraltar_log(INFO, " kernel @ 0x%08x - 0x%08lx\r\n",
MEM_KERNEL_START, (uintptr_t) _etext);
gilbraltar_log(INFO, " stack @ 0x%08x - 0x%08x\r\n",
MEM_KERNEL_STACK - KERNEL_STACK_SIZE, MEM_KERNEL_STACK);
gilbraltar_log(INFO, "exception stack @ 0x%08x - 0x%08x\r\n",
MEM_EXCEPTION_STACK - EXCEPTION_STACK_SIZE,
MEM_EXCEPTION_STACK);
gilbraltar_log(INFO, " irq stack @ 0x%08x - 0x%08x\r\n",
MEM_IRQ_STACK - EXCEPTION_STACK_SIZE, MEM_IRQ_STACK);
gilbraltar_log(INFO, " fiq stack @ 0x%08x - 0x%08x\r\n",
MEM_FIQ_STACK - EXCEPTION_STACK_SIZE, MEM_FIQ_STACK);
gilbraltar_log(INFO, " pages table @ 0x%08x - 0x%08x\r\n", MEM_PAGE_TABLE1,
MEM_PAGE_TABLE1_END);
gilbraltar_log(INFO, "coherent region @ 0x%08x - 0x%08x\r\n",
MEM_COHERENT_REGION, MEM_COHERENT_REGION + 4 * MEGABYTE);
}

View file

@ -1,574 +0,0 @@
Archive member included to satisfy reference by file (symbol)
./libgilbraltar.a(log.o) test/test03.o (gilbraltar_log)
./libgilbraltar.a(startup.o) (_start)
./libgilbraltar.a(exception_stub.o)
./libgilbraltar.a(startup.o) (VectorTable)
./libgilbraltar.a(kernel.o) ./libgilbraltar.a(startup.o) (gilbraltar_sysinit)
./libgilbraltar.a(interrupt_handler.o)
./libgilbraltar.a(exception_stub.o) (gilbraltar_interrupt_handler)
./libgilbraltar.a(exception_handler.o)
./libgilbraltar.a(exception_stub.o) (gilbraltar_exception_handler)
./libgilbraltar.a(crt.o) ./libgilbraltar.a(log.o) (__stack_chk_guard)
./libgilbraltar.a(serial.o) ./libgilbraltar.a(kernel.o) (gilbraltar_serial_init)
./libgilbraltar.a(power.o) ./libgilbraltar.a(kernel.o) (poweroff)
./libgilbraltar.a(tag.o) ./libgilbraltar.a(kernel.o) (gilbraltar_get_tag)
./libgilbraltar.a(coherent_page.o)
./libgilbraltar.a(tag.o) (get_coherent_page)
./libgilbraltar.a(dtb.o) ./libgilbraltar.a(kernel.o) (gilbraltar_dtb_init)
./libgilbraltar.a(memory.o) ./libgilbraltar.a(kernel.o) (gilbraltar_memory_init)
./libgilbraltar.a(pager.o) ./libgilbraltar.a(memory.o) (gilbraltar_pager_init)
./libgilbraltar.a(translation_table.o)
./libgilbraltar.a(memory.o) (gilbraltar_translation_table_base)
./libgilbraltar.a(mbox.o) ./libgilbraltar.a(tag.o) (gilbraltar_mbox_write_read)
./libgilbraltar.a(clock.o) ./libgilbraltar.a(serial.o) (gilbraltar_get_rate_of_clock)
./libgilbraltar.a(spinlock.o)
./libgilbraltar.a(pager.o) (gilbraltar_spinlock_acquire)
./libgilbraltar.a(synchronize.o)
./libgilbraltar.a(spinlock.o) (gilbraltar_enter_critical)
nolibc/libnolibc.a(assert.o) ./libgilbraltar.a(serial.o) (_assert_fail)
nolibc/libnolibc.a(memcpy.o) ./libgilbraltar.a(tag.o) (memcpy)
nolibc/libnolibc.a(memset.o) ./libgilbraltar.a(kernel.o) (memset)
nolibc/libnolibc.a(strstr.o) ./libgilbraltar.a(kernel.o) (strstr)
nolibc/libnolibc.a(puts.o) nolibc/libnolibc.a(assert.o) (puts)
nolibc/libnolibc.a(vsnprintf.o)
./libgilbraltar.a(log.o) (vsnprintf)
nolibc/libnolibc.a(sysdeps.o)
./libgilbraltar.a(coherent_page.o) (abort)
nolibc/libnolibc.a(memchr.o) nolibc/libnolibc.a(strstr.o) (memchr)
nolibc/libnolibc.a(memcmp.o) nolibc/libnolibc.a(strstr.o) (memcmp)
nolibc/libnolibc.a(strlen.o) nolibc/libnolibc.a(puts.o) (strlen)
nolibc/libnolibc.a(strchr.o) nolibc/libnolibc.a(strstr.o) (strchr)
nolibc/libnolibc.a(strchrnul.o)
nolibc/libnolibc.a(strchr.o) (__strchrnul)
nolibc/libnolibc.a(vfprintf.o)
nolibc/libnolibc.a(vsnprintf.o) (vfprintf)
nolibc/libnolibc.a(ctype.o) nolibc/libnolibc.a(vfprintf.o) (isdigit)
nolibc/libnolibc.a(stubs.o) nolibc/libnolibc.a(vfprintf.o) (strerror)
nolibc/libnolibc.a(printf.o) nolibc/libnolibc.a(stubs.o) (printf)
openlibm/libopenlibm.a(s_frexp.c.o)
nolibc/libnolibc.a(vfprintf.o) (frexp)
openlibm/libopenlibm.a(s_isfinite.c.o)
nolibc/libnolibc.a(vfprintf.o) (__isfinite)
openlibm/libopenlibm.a(s_signbit.c.o)
nolibc/libnolibc.a(vfprintf.o) (__signbit)
/usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
nolibc/libnolibc.a(vfprintf.o) (__extenddftf2)
/usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
nolibc/libnolibc.a(vfprintf.o) (__trunctfdf2)
/usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
/usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o) (__sfp_handle_exceptions)
There are no discarded input sections
Memory Configuration
Name Origin Length Attributes
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
LOAD test/test03.o
Address of section .init set to 0x80000
START GROUP
LOAD ./libgilbraltar.a
LOAD nolibc/libnolibc.a
LOAD openlibm/libopenlibm.a
LOAD /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a
END GROUP
.init 0x0000000000080000 0xa8
*(.init)
.init 0x0000000000080000 0xa8 ./libgilbraltar.a(startup.o)
0x0000000000080000 _start
.text 0x0000000000080800 0x7960
*(.text*)
.text 0x0000000000080800 0x7c test/test03.o
0x0000000000080800 main
.text 0x000000000008087c 0x1b0 ./libgilbraltar.a(log.o)
0x000000000008087c gilbraltar_log
0x0000000000080a08 gilbraltar_log_set
.text 0x0000000000080a2c 0x0 ./libgilbraltar.a(startup.o)
*fill* 0x0000000000080a2c 0x5d4
.text 0x0000000000081000 0x9d8 ./libgilbraltar.a(exception_stub.o)
0x0000000000081000 VectorTable
0x0000000000081784 unexpected_stub
0x00000000000817bc synchronous_stub
0x00000000000817f4 system_error_stub
0x000000000008182c IRQ_stub
0x00000000000818dc FIQ_stub
0x0000000000081988 SMC_stub
.text 0x00000000000819d8 0x2dc ./libgilbraltar.a(kernel.o)
0x0000000000081ac0 gilbraltar_sysinit
.text 0x0000000000081cb4 0x28 ./libgilbraltar.a(interrupt_handler.o)
0x0000000000081cb4 gilbraltar_interrupt_handler
0x0000000000081cd4 gilbraltar_secure_monitor_handler
.text 0x0000000000081cdc 0x400 ./libgilbraltar.a(exception_handler.o)
0x0000000000081cdc gilbraltar_exception_handler
.text 0x00000000000820dc 0x1c ./libgilbraltar.a(crt.o)
0x00000000000820dc __stack_chk_fail
.text 0x00000000000820f8 0x440 ./libgilbraltar.a(serial.o)
0x0000000000082224 gilbraltar_serial_init
0x0000000000082354 gilbraltar_serial_send
0x000000000008243c gilbraltar_serial_recv
0x0000000000082484 gilbraltar_serial_puts
0x00000000000824c8 gilbraltar_serial_putchar
0x00000000000824ec gilbraltar_serial_write
.text 0x0000000000082538 0x7c ./libgilbraltar.a(power.o)
0x000000000008255c reboot
0x000000000008259c poweroff
.text 0x00000000000825b4 0x5ac ./libgilbraltar.a(tag.o)
0x00000000000825b4 gilbraltar_get_tags
0x0000000000082810 gilbraltar_get_tag
.text 0x0000000000082b60 0x44 ./libgilbraltar.a(coherent_page.o)
0x0000000000082b60 get_coherent_page
.text 0x0000000000082ba4 0x20c ./libgilbraltar.a(dtb.o)
0x0000000000082ba4 gilbraltar_dtb_init
.text 0x0000000000082db0 0x104 ./libgilbraltar.a(memory.o)
0x0000000000082e50 gilbraltar_memory_init
.text 0x0000000000082eb4 0x268 ./libgilbraltar.a(pager.o)
0x0000000000082eb4 gilbraltar_pager_init
0x0000000000082f0c gilbraltar_pager_free_space
0x0000000000082f2c gilbraltar_palloc
0x00000000000830a8 gilbraltar_pager_free
.text 0x000000000008311c 0x554 ./libgilbraltar.a(translation_table.o)
0x00000000000833d8 gilbraltar_translation_table_base
0x00000000000833e8 gilbraltar_translation_table_init
.text 0x0000000000083670 0x10c ./libgilbraltar.a(mbox.o)
0x00000000000836ac gilbraltar_mbox_write_read
.text 0x000000000008377c 0x184 ./libgilbraltar.a(clock.o)
0x000000000008377c gilbraltar_get_rate_of_clock
.text 0x0000000000083900 0x108 ./libgilbraltar.a(spinlock.o)
0x0000000000083900 gilbraltar_spinlock_init
0x0000000000083918 gilbraltar_spinlock_acquire
0x00000000000839b8 gilbraltar_spinlock_release
.text 0x0000000000083a08 0x21c ./libgilbraltar.a(synchronize.o)
0x0000000000083a08 gilbraltar_enter_critical
0x0000000000083b44 gilbraltar_leave_critical
*fill* 0x0000000000083c24 0x1c
.text 0x0000000000083c40 0x50 nolibc/libnolibc.a(assert.o)
0x0000000000083c40 _assert_fail
*fill* 0x0000000000083c90 0x10
.text 0x0000000000083ca0 0x3e0 nolibc/libnolibc.a(memcpy.o)
0x0000000000083ca0 memcpy
.text 0x0000000000084080 0xe0 nolibc/libnolibc.a(memset.o)
0x0000000000084080 memset
.text 0x0000000000084160 0x584 nolibc/libnolibc.a(strstr.o)
0x0000000000084520 strstr
*fill* 0x00000000000846e4 0x1c
.text 0x0000000000084700 0x64 nolibc/libnolibc.a(puts.o)
0x0000000000084700 puts
0x0000000000084740 putchar
*fill* 0x0000000000084764 0x1c
.text 0x0000000000084780 0x14c nolibc/libnolibc.a(vsnprintf.o)
0x00000000000847d0 vsnprintf
*fill* 0x00000000000848cc 0x14
.text 0x00000000000848e0 0xbc nolibc/libnolibc.a(sysdeps.o)
0x000000000008490c write
0x0000000000084960 exit
0x0000000000084968 abort
0x0000000000084988 __getauxval
*fill* 0x000000000008499c 0x4
.text 0x00000000000849a0 0xbc nolibc/libnolibc.a(memchr.o)
0x00000000000849a0 memchr
*fill* 0x0000000000084a5c 0x4
.text 0x0000000000084a60 0x38 nolibc/libnolibc.a(memcmp.o)
0x0000000000084a60 memcmp
*fill* 0x0000000000084a98 0x8
.text 0x0000000000084aa0 0x78 nolibc/libnolibc.a(strlen.o)
0x0000000000084aa0 strlen
*fill* 0x0000000000084b18 0x8
.text 0x0000000000084b20 0x2c nolibc/libnolibc.a(strchr.o)
0x0000000000084b20 strchr
*fill* 0x0000000000084b4c 0x14
.text 0x0000000000084b60 0xd8 nolibc/libnolibc.a(strchrnul.o)
0x0000000000084b60 __strchrnul
*fill* 0x0000000000084c38 0x8
.text 0x0000000000084c40 0x1e38 nolibc/libnolibc.a(vfprintf.o)
0x0000000000084f88 printf_core
0x00000000000869c8 vfprintf
*fill* 0x0000000000086a78 0x8
.text 0x0000000000086a80 0x70 nolibc/libnolibc.a(ctype.o)
0x0000000000086a80 isalpha
0x0000000000086aa0 isdigit
0x0000000000086ab0 isprint
0x0000000000086ac0 isspace
0x0000000000086ae0 isupper
*fill* 0x0000000000086af0 0x10
.text 0x0000000000086b00 0xec0 nolibc/libnolibc.a(stubs.o)
0x0000000000086b00 fflush
0x0000000000086b6c rename
0x0000000000086b8c sscanf
0x0000000000086bac fread
0x0000000000086c20 getc
0x0000000000086c90 ungetc
0x0000000000086d00 fwrite
0x0000000000086d70 fputc
0x0000000000086de0 fputs
0x0000000000086e50 putc
0x0000000000086ec0 ferror
0x0000000000086f30 fopen
0x0000000000086fa0 fclose
0x0000000000087010 getenv
0x0000000000087080 secure_getenv
0x00000000000870f0 system
0x0000000000087110 chdir
0x0000000000087180 close
0x00000000000871a0 getcwd
0x00000000000871c0 getpid
0x0000000000087230 getppid
0x00000000000872a0 isatty
0x00000000000872c0 lseek
0x00000000000872e0 read
0x0000000000087300 readlink
0x0000000000087320 unlink
0x0000000000087340 rmdir
0x0000000000087360 ftruncate
0x0000000000087380 execv
0x00000000000873a0 closedir
0x0000000000087410 opendir
0x0000000000087480 readdir
0x00000000000874f0 fcntl
0x0000000000087510 open
0x0000000000087580 setjmp
0x00000000000875a0 signal
0x00000000000875c0 raise
0x00000000000875e0 strerror
0x0000000000087600 stat
0x0000000000087670 mkdir
0x0000000000087690 pthread_join
0x00000000000876a4 pthread_create
0x00000000000876c0 pthread_attr_init
0x00000000000876e0 pthread_cleanup_push
0x0000000000087700 pthread_cleanup_pop
0x0000000000087720 pthread_mutex_lock
0x0000000000087740 pthread_mutex_trylock
0x0000000000087760 pthread_mutex_unlock
0x0000000000087780 pthread_mutex_destroy
0x00000000000877a0 pthread_mutex_init
0x00000000000877c0 pthread_mutexattr_init
0x00000000000877e0 pthread_mutexattr_destroy
0x0000000000087800 pthread_mutexattr_settype
0x0000000000087820 pthread_sigmask
0x0000000000087840 pthread_equal
0x0000000000087860 pthread_condattr_init
0x0000000000087880 pthread_cond_init
0x00000000000878a0 pthread_cond_destroy
0x00000000000878c0 pthread_cond_wait
0x00000000000878e0 pthread_cond_signal
0x0000000000087900 pthread_cond_broadcast
0x0000000000087920 pthread_self
0x0000000000087940 pthread_detach
0x0000000000087960 sigfillset
0x0000000000087980 sigwait
0x00000000000879a0 usleep
.text 0x00000000000879c0 0xbc nolibc/libnolibc.a(printf.o)
0x00000000000879c0 printf
*fill* 0x0000000000087a7c 0x4
.text 0x0000000000087a80 0x78 openlibm/libopenlibm.a(s_frexp.c.o)
0x0000000000087a80 frexp
*fill* 0x0000000000087af8 0x8
.text 0x0000000000087b00 0x64 openlibm/libopenlibm.a(s_isfinite.c.o)
0x0000000000087b00 __isfinite
0x0000000000087b20 __isfinitef
0x0000000000087b40 __isfinitel
*fill* 0x0000000000087b64 0x1c
.text 0x0000000000087b80 0x38 openlibm/libopenlibm.a(s_signbit.c.o)
0x0000000000087b80 __signbit
0x0000000000087b8c __signbitf
0x0000000000087ba0 __signbitl
.text 0x0000000000087bb8 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
*fill* 0x0000000000087bb8 0x8
.text.__extenddftf2
0x0000000000087bc0 0x158 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
0x0000000000087bc0 __extenddftf2
.text 0x0000000000087d18 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
*fill* 0x0000000000087d18 0x8
.text.__trunctfdf2
0x0000000000087d20 0x3c4 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
0x0000000000087d20 __trunctfdf2
.text 0x00000000000880e4 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
*fill* 0x00000000000880e4 0xc
.text.__sfp_handle_exceptions
0x00000000000880f0 0x70 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
0x00000000000880f0 __sfp_handle_exceptions
0x0000000000088160 _etext = .
.iplt 0x0000000000088160 0x0
.iplt 0x0000000000088160 0x0 test/test03.o
.rodata 0x0000000000088160 0xa40
*(.rodata*)
.rodata 0x0000000000088160 0x22 test/test03.o
*fill* 0x0000000000088182 0x6
.rodata 0x0000000000088188 0x6d ./libgilbraltar.a(kernel.o)
*fill* 0x00000000000881f5 0x3
.rodata 0x00000000000881f8 0x10 ./libgilbraltar.a(interrupt_handler.o)
.rodata 0x0000000000088208 0x97 ./libgilbraltar.a(exception_handler.o)
*fill* 0x000000000008829f 0x1
.rodata 0x00000000000882a0 0x23 ./libgilbraltar.a(crt.o)
*fill* 0x00000000000882c3 0x5
.rodata 0x00000000000882c8 0x21 ./libgilbraltar.a(serial.o)
*fill* 0x00000000000882e9 0x7
.rodata 0x00000000000882f0 0x8b ./libgilbraltar.a(tag.o)
*fill* 0x000000000008837b 0x5
.rodata 0x0000000000088380 0x4b ./libgilbraltar.a(dtb.o)
*fill* 0x00000000000883cb 0x5
.rodata 0x00000000000883d0 0x26 ./libgilbraltar.a(memory.o)
*fill* 0x00000000000883f6 0x2
.rodata 0x00000000000883f8 0x9c ./libgilbraltar.a(pager.o)
*fill* 0x0000000000088494 0x4
.rodata 0x0000000000088498 0x28 ./libgilbraltar.a(translation_table.o)
.rodata 0x00000000000884c0 0x1f ./libgilbraltar.a(mbox.o)
*fill* 0x00000000000884df 0x1
.rodata 0x00000000000884e0 0x9b ./libgilbraltar.a(clock.o)
*fill* 0x000000000008857b 0x5
.rodata 0x0000000000088580 0x2a ./libgilbraltar.a(spinlock.o)
*fill* 0x00000000000885aa 0x6
.rodata 0x00000000000885b0 0xf2 ./libgilbraltar.a(synchronize.o)
*fill* 0x00000000000886a2 0x6
.rodata.str1.8
0x00000000000886a8 0x297 nolibc/libnolibc.a(assert.o)
0x23 (size before relaxing)
.rodata.str1.8
0x000000000008893f 0xa nolibc/libnolibc.a(sysdeps.o)
*fill* 0x000000000008893f 0x1
.rodata 0x0000000000088940 0x260 nolibc/libnolibc.a(vfprintf.o)
.rodata.str1.8
0x0000000000088ba0 0x52 nolibc/libnolibc.a(vfprintf.o)
.rodata.str1.8
0x0000000000088ba0 0x207 nolibc/libnolibc.a(stubs.o)
.rela.dyn 0x0000000000088ba0 0x0
.rela.iplt 0x0000000000088ba0 0x0 test/test03.o
.rela.text 0x0000000000088ba0 0x0 test/test03.o
.ARM.exidx 0x0000000000088ba0 0x0
0x0000000000088ba0 __exidx_start = .
*(.ARM.exidx*)
0x0000000000088ba0 __exidx_end = .
.eh_frame
*(.eh_frame*)
.data 0x0000000000088ba0 0xc4
*(.data*)
.data 0x0000000000088ba0 0x0 test/test03.o
.data 0x0000000000088ba0 0x4 ./libgilbraltar.a(log.o)
.data 0x0000000000088ba4 0x0 ./libgilbraltar.a(startup.o)
*fill* 0x0000000000088ba4 0x4
.data 0x0000000000088ba8 0x20 ./libgilbraltar.a(exception_stub.o)
0x0000000000088ba8 FIQ_data
0x0000000000088bc0 IRQ_return_address
.data 0x0000000000088bc8 0x0 ./libgilbraltar.a(kernel.o)
.data 0x0000000000088bc8 0x0 ./libgilbraltar.a(interrupt_handler.o)
.data 0x0000000000088bc8 0x18 ./libgilbraltar.a(exception_handler.o)
.data 0x0000000000088be0 0x8 ./libgilbraltar.a(crt.o)
0x0000000000088be0 __stack_chk_guard
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(serial.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(power.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(tag.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(coherent_page.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(dtb.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(memory.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(pager.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(translation_table.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(mbox.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(clock.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(spinlock.o)
.data 0x0000000000088be8 0x0 ./libgilbraltar.a(synchronize.o)
.data 0x0000000000088be8 0x0 nolibc/libnolibc.a(assert.o)
.data 0x0000000000088be8 0x0 nolibc/libnolibc.a(memcpy.o)
.data 0x0000000000088be8 0x0 nolibc/libnolibc.a(memset.o)
.data 0x0000000000088be8 0x0 nolibc/libnolibc.a(strstr.o)
.data 0x0000000000088be8 0x0 nolibc/libnolibc.a(puts.o)
.data 0x0000000000088be8 0x0 nolibc/libnolibc.a(vsnprintf.o)
.data 0x0000000000088be8 0x28 nolibc/libnolibc.a(sysdeps.o)
0x0000000000088be8 stdout
0x0000000000088bf0 stderr
.data 0x0000000000088c10 0x0 nolibc/libnolibc.a(memchr.o)
.data 0x0000000000088c10 0x0 nolibc/libnolibc.a(memcmp.o)
.data 0x0000000000088c10 0x0 nolibc/libnolibc.a(strlen.o)
.data 0x0000000000088c10 0x0 nolibc/libnolibc.a(strchr.o)
.data 0x0000000000088c10 0x0 nolibc/libnolibc.a(strchrnul.o)
.data 0x0000000000088c10 0x0 nolibc/libnolibc.a(vfprintf.o)
.data 0x0000000000088c10 0x0 nolibc/libnolibc.a(ctype.o)
.data 0x0000000000088c10 0x54 nolibc/libnolibc.a(stubs.o)
.data 0x0000000000088c64 0x0 nolibc/libnolibc.a(printf.o)
.data 0x0000000000088c64 0x0 openlibm/libopenlibm.a(s_frexp.c.o)
.data 0x0000000000088c64 0x0 openlibm/libopenlibm.a(s_isfinite.c.o)
.data 0x0000000000088c64 0x0 openlibm/libopenlibm.a(s_signbit.c.o)
.data 0x0000000000088c64 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.data 0x0000000000088c64 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.data 0x0000000000088c64 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.igot.plt 0x0000000000088c68 0x0
.igot.plt 0x0000000000088c68 0x0 test/test03.o
.tdata 0x0000000000088c64 0x0
0x0000000000088c64 _stdata = .
*(.tdata)
0x0000000000088c64 _edata = .
.tbss
*(.tbss)
.bss 0x0000000000088c70 0x1364
0x0000000000088c70 __bss_start = .
*(.bss*)
.bss 0x0000000000088c70 0x0 test/test03.o
.bss 0x0000000000088c70 0x0 ./libgilbraltar.a(log.o)
.bss 0x0000000000088c70 0x0 ./libgilbraltar.a(startup.o)
.bss 0x0000000000088c70 0x80 ./libgilbraltar.a(exception_stub.o)
.bss 0x0000000000088cf0 0x0 ./libgilbraltar.a(kernel.o)
.bss 0x0000000000088cf0 0x0 ./libgilbraltar.a(interrupt_handler.o)
.bss 0x0000000000088cf0 0x0 ./libgilbraltar.a(exception_handler.o)
.bss 0x0000000000088cf0 0x0 ./libgilbraltar.a(crt.o)
.bss 0x0000000000088cf0 0x100a ./libgilbraltar.a(serial.o)
.bss 0x0000000000089cfa 0x0 ./libgilbraltar.a(power.o)
.bss 0x0000000000089cfa 0x0 ./libgilbraltar.a(tag.o)
.bss 0x0000000000089cfa 0x0 ./libgilbraltar.a(coherent_page.o)
*fill* 0x0000000000089cfa 0x6
.bss 0x0000000000089d00 0x8 ./libgilbraltar.a(dtb.o)
.bss 0x0000000000089d08 0x0 ./libgilbraltar.a(memory.o)
.bss 0x0000000000089d08 0x1c ./libgilbraltar.a(pager.o)
*fill* 0x0000000000089d24 0x4
.bss 0x0000000000089d28 0x10 ./libgilbraltar.a(translation_table.o)
.bss 0x0000000000089d38 0x0 ./libgilbraltar.a(mbox.o)
.bss 0x0000000000089d38 0x0 ./libgilbraltar.a(clock.o)
.bss 0x0000000000089d38 0x1 ./libgilbraltar.a(spinlock.o)
*fill* 0x0000000000089d39 0x7
.bss 0x0000000000089d40 0x290 ./libgilbraltar.a(synchronize.o)
.bss 0x0000000000089fd0 0x0 nolibc/libnolibc.a(assert.o)
.bss 0x0000000000089fd0 0x0 nolibc/libnolibc.a(memcpy.o)
.bss 0x0000000000089fd0 0x0 nolibc/libnolibc.a(memset.o)
.bss 0x0000000000089fd0 0x0 nolibc/libnolibc.a(strstr.o)
.bss 0x0000000000089fd0 0x0 nolibc/libnolibc.a(puts.o)
.bss 0x0000000000089fd0 0x0 nolibc/libnolibc.a(vsnprintf.o)
.bss 0x0000000000089fd0 0x4 nolibc/libnolibc.a(sysdeps.o)
0x0000000000089fd0 errno
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(memchr.o)
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(memcmp.o)
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(strlen.o)
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(strchr.o)
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(strchrnul.o)
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(vfprintf.o)
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(ctype.o)
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(stubs.o)
.bss 0x0000000000089fd4 0x0 nolibc/libnolibc.a(printf.o)
.bss 0x0000000000089fd4 0x0 openlibm/libopenlibm.a(s_frexp.c.o)
.bss 0x0000000000089fd4 0x0 openlibm/libopenlibm.a(s_isfinite.c.o)
.bss 0x0000000000089fd4 0x0 openlibm/libopenlibm.a(s_signbit.c.o)
.bss 0x0000000000089fd4 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.bss 0x0000000000089fd4 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.bss 0x0000000000089fd4 0x0 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
*(COMMON)
0x0000000000089fd4 _end = .
OUTPUT(test03.elf elf64-littleaarch64)
LOAD linker stubs
.comment 0x0000000000000000 0x45
.comment 0x0000000000000000 0x45 test/test03.o
0x46 (size before relaxing)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(log.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(kernel.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(interrupt_handler.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(exception_handler.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(crt.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(serial.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(power.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(tag.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(coherent_page.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(dtb.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(memory.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(pager.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(translation_table.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(mbox.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(clock.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(spinlock.o)
.comment 0x0000000000000045 0x46 ./libgilbraltar.a(synchronize.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(assert.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(memcpy.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(memset.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(strstr.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(puts.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(vsnprintf.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(sysdeps.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(memchr.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(memcmp.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(strlen.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(strchr.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(strchrnul.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(vfprintf.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(ctype.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(stubs.o)
.comment 0x0000000000000045 0x46 nolibc/libnolibc.a(printf.o)
.comment 0x0000000000000045 0x46 openlibm/libopenlibm.a(s_frexp.c.o)
.comment 0x0000000000000045 0x46 openlibm/libopenlibm.a(s_isfinite.c.o)
.comment 0x0000000000000045 0x46 openlibm/libopenlibm.a(s_signbit.c.o)
.comment 0x0000000000000045 0x46 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.comment 0x0000000000000045 0x46 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.comment 0x0000000000000045 0x46 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_info 0x0000000000000000 0x76a
.debug_info 0x0000000000000000 0x2ef /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.debug_info 0x00000000000002ef 0x39e /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_info 0x000000000000068d 0xdd /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_abbrev 0x0000000000000000 0x35e
.debug_abbrev 0x0000000000000000 0x159 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.debug_abbrev 0x0000000000000159 0x183 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_abbrev 0x00000000000002dc 0x82 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_loclists
0x0000000000000000 0xacb
.debug_loclists
0x0000000000000000 0x451 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.debug_loclists
0x0000000000000451 0x653 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_loclists
0x0000000000000aa4 0x27 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_aranges 0x0000000000000000 0x90
.debug_aranges
0x0000000000000000 0x30 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.debug_aranges
0x0000000000000030 0x30 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_aranges
0x0000000000000060 0x30 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_rnglists
0x0000000000000000 0x1d6
.debug_rnglists
0x0000000000000000 0x84 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.debug_rnglists
0x0000000000000084 0x13b /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_rnglists
0x00000000000001bf 0x17 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_line 0x0000000000000000 0xb07
.debug_line 0x0000000000000000 0x276 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.debug_line 0x0000000000000276 0x7f9 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_line 0x0000000000000a6f 0x98 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_str 0x0000000000000000 0x294
.debug_str 0x0000000000000000 0x294 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
0x1f3 (size before relaxing)
.debug_str 0x0000000000000294 0x252 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_str 0x0000000000000294 0x11c /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_line_str
0x0000000000000000 0x213
.debug_line_str
0x0000000000000000 0x213 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
0x19c (size before relaxing)
.debug_line_str
0x0000000000000213 0x199 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_line_str
0x0000000000000213 0x193 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)
.debug_frame 0x0000000000000000 0xb0
.debug_frame 0x0000000000000000 0x38 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(extenddftf2.o)
.debug_frame 0x0000000000000038 0x50 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(trunctfdf2.o)
.debug_frame 0x0000000000000088 0x28 /usr/bin/../lib/gcc/aarch64-none-elf/13.3.1/libgcc.a(sfp-exceptions.o)