Skip to content

Commit 6f1adf3

Browse files
committed
.
1 parent 55cdf52 commit 6f1adf3

File tree

1 file changed

+9
-8
lines changed
  • packages/std/packages/stub/src

1 file changed

+9
-8
lines changed

packages/std/packages/stub/src/stub.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ static inline void* prepare_stack (
125125
rlimit_t rlim;
126126
ABORT_IF(getrlimit(RLIMIT_STACK, &rlim), "failed to get the stack size");
127127

128-
// Allocate the stack. On x86_64, the stack "grows down" meaning that the address returned by mmap is actually the lowest possible address for the stack. The "top" of the new stack is the address of one page past it.
128+
// Allocate the stack. On x86_64, the stack "grows down" meaning that the address returned by mmap is actually the lowest possible address for the stack. The "top" of the new stack is the address of one page past it.
129129
// TODO: we could use MMAP_GROWSDOWN and get growable stacks. Unsure if this is necessary or even workable.
130130
// TODO: should we add a guard page for stack overflow?
131131
void* bp = mmap(
132-
0,
133-
(size_t)rlim.soft,
134-
PROT_READ | PROT_WRITE,
135-
MAP_ANONYMOUS | MAP_PRIVATE,
136-
-1,
132+
0,
133+
(size_t)rlim.soft,
134+
PROT_READ | PROT_WRITE,
135+
MAP_ANONYMOUS | MAP_PRIVATE,
136+
-1,
137137
0
138138
);
139139
void* sp = bp + rlim.soft;
@@ -387,8 +387,8 @@ static LoadedInterpreter load_interpreter(
387387
if (p == MAP_FAILED) ABORT("mmap failed");
388388
mapped += (memsz - filesz);
389389
}
390-
391-
// If the page is marked writeable, make sure to zero-out any excess between the file end and the end of the segment.
390+
391+
// If the page is marked writeable, make sure to zero-out any excess between the file end and the end of the segment.
392392
if (prot & PF_W) {
393393
uintptr_t offset = misalignment + itr->p_filesz;
394394
uintptr_t length = mapped - itr->p_filesz - misalignment;
@@ -670,6 +670,7 @@ void _stub_start (void *sp) {
670670
// Set the entrypoint. TODO: use manifest.
671671
stack.auxv[nentry].a_un.a_val = (uintptr_t)base_address + footer.entry;
672672
DBG("entrypoint: 0x%lx\n", stack.auxv[nentry].a_un.a_val);
673+
673674
// Fix program headers.
674675
Arena preserved_memory;
675676
create_arena(&preserved_memory);

0 commit comments

Comments
 (0)