x1000: add simple binary header to declare the load address

The header format is basic, a variable length list of values
tagged by 4-byte strings. The main application to to allow a
loader to determine the load address of the binary at runtime
instead of using a hardcoded address. But the header contents
aren't fixed and it could be extended for other purposes too.

Change-Id: If51d85b4c2eb53c919a91b54985b157e8e5c20ef
This commit is contained in:
Aidan MacDonald 2022-03-03 19:17:00 +00:00
parent 19d95d7b56
commit ca12478df6

View file

@ -25,6 +25,7 @@
.text
.extern main
.extern system_early_init
.extern _loadaddress
.global _start
.set push
@ -35,6 +36,19 @@
.section .init.text
_start:
b _realstart
nop
/* Header entries are 4-byte string labels (not null terminated!) followed
* by 4-byte values. Header should begin in the first 128 bytes and should
* be no more than 256 bytes in length. */
_header:
.ascii "BEGINHDR" /* beginning of header */
.ascii "LOAD"
.word _loadaddress
.ascii "ENDH" /* end of header structure */
_realstart:
/* Cache init */
li v0, 0x80000000
ori v1, v0, 0x4000