Skip to content

Commit

Permalink
BootShim: Publish code for LinuxLoader and XBL Reload [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
gus33000 committed Sep 11, 2022
1 parent d9ff2f9 commit 33deaa1
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
47 changes: 47 additions & 0 deletions BootShim/BootShim.Zeta.LinuxLoader.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
_Head:
/* Set _Entry address */
adr x1, _Payload

/* Jump to the real code */
b _Start

/* Fake Linux kernel header */

/* Text Offset */
.quad 0x9F000000

_StackSize:
/* Image Size */
.quad 0x01DF5200

/* Flags */
.quad 0

/* Reserved */
.quad 0

/* Reserved */
.quad 0

/* Reserved */
.quad 0

/* ARM64 Magic */
.ascii "ARM\x64"

/* Reserved */
.long 0

_Start:
/* Location of the device tree for said kernel image */
ldr x0, _StackSize
add x0, x0, x1

/* Reserved */
mov x1, #0

.text
.align 4

_Payload:
/* Your code will get ran right after this binary */
74 changes: 74 additions & 0 deletions BootShim/BootShim.Zeta.XBLReload.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
_Head:
/* Set _Entry address */
adr x1, #0xA0

/* Jump to the real code */
b _Start

/* Fake Linux kernel header */

_StackBase:
/* Text Offset */
.quad 0x9FC00000

_StackSize:
/* Image Size */
.quad 0x00300000

_Test1:
/* Flags */
.quad 0x9B800000

_Test2:
/* Reserved */
.quad 0x03C00000

/* Reserved */
.quad 0

/* Reserved */
.quad 0

/* ARM64 Magic */
.ascii "ARM\x64"

/* Reserved */
.long 0

_Start:
mov x4, x1
ldr x5, _StackBase
cmp x4, x5
beq _Entry
ldr x6, _StackSize

_CopyLoop:
ldp x2, x3, [x4], #16
stp x2, x3, [x5], #16
subs x6, x6, #16
b.ne _CopyLoop

nop
ldr x8, _Test1
ldr x9, _Test2
_Cleanup:
mov x2, #0
mov x3, #0
stp xzr, xzr, [x8], #16
subs x9, x9, #16
b.ne _Cleanup
nop
nop
nop
nop

ldr x5, _StackBase

_Entry:
br x5

dead:
/* We should never get here */
b dead

/* Your code will get ran right after this binary */

0 comments on commit 33deaa1

Please sign in to comment.