Skip to content

Commit

Permalink
lz_header.S,setup.c: fix issues with stack management
Browse files Browse the repository at this point in the history
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
  • Loading branch information
krystian-hebel authored and dpsmith committed Aug 16, 2019
1 parent 1647007 commit 948bf04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lz_header.S
Expand Up @@ -221,8 +221,9 @@ print_char:

.globl load_stack
load_stack:
movq (%rsp), %rax /* Return address */
movq %rdi, %rsp
movq %rsp, %rbp /* For consistency */
pushq %rax
retq

.globl stgi
Expand Down
10 changes: 8 additions & 2 deletions setup.c
Expand Up @@ -33,10 +33,16 @@ static __text SHA1_CONTEXT sha1ctx;

void setup2(void);

static void print(char * txt) {
while (*txt != '\0') print_char(*txt++);
print_char('\r');
print_char('\n');
}

void setup(void *_lz_base)
{
void *dev_table;
void **second_stack;
void *second_stack;
u32 *tb_dev_map;
u64 pfn, end_pfn;
u32 dev;
Expand Down Expand Up @@ -85,7 +91,7 @@ void setup(void *_lz_base)
* landing zone and of course grows down.
*/
second_stack = lz_base - LZ_SECOND_STAGE_STACK_OFFSET;
load_stack(*second_stack);
load_stack(second_stack);

/* Call secondary setup on new stack */
setup2();
Expand Down

0 comments on commit 948bf04

Please sign in to comment.