Skip to content

Commit 6fdab75

Browse files
committed
fix: use a dedicated section for stack
1 parent 2cdff1c commit 6fdab75

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Sources/AsmSupport/aarch64/boot.S

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ from_el3:
6161
eret
6262

6363
el1_entry:
64-
// set top of stack just before our code
65-
ldr x1, =_start
66-
mov sp, x1
64+
ldr x0, =__stack_top
65+
mov sp, x0
6766

6867
jump_to_main:
6968
// jump to Swift code, should not return

linker.ld

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ SECTIONS {
1111
. = ALIGN(8);
1212
__bss_end = .;
1313
}
14-
__kernel_end = .;
14+
__kernel_end = ALIGN(16);
15+
.stack (NOLOAD) : ALIGN(16) {
16+
__stack_bottom = .;
17+
. += 0x20000; /* 128 KiB */
18+
__stack_top = .;
19+
}
20+
__kernel_image_end = .;
1521
.nonalloc (NOLOAD) : {
1622
*(.symtab)
1723
*(.strtab)

0 commit comments

Comments
 (0)