27 lines
680 B
C
Raw Permalink Normal View History

#include <stdint.h>
#include <stddef.h>
2021-02-22 04:34:36 +01:00
#include <tinf/tinf.h>
__attribute__((noreturn))
2020-11-05 01:37:45 +01:00
void entry(uint8_t *compressed_stage2, size_t stage2_size, uint8_t boot_drive, int pxe) {
// The decompressor should decompress compressed_stage2 to address 0x8000.
uint8_t *dest = (uint8_t *)0x8000;
tinf_gzip_uncompress(dest, compressed_stage2, stage2_size);
2020-11-15 17:56:10 +01:00
asm volatile (
"movl $0x7c00, %%esp\n\t"
"xorl %%ebp, %%ebp\n\t"
"pushl %1\n\t"
"pushl %0\n\t"
"pushl $0\n\t"
"pushl $0x8000\n\t"
"ret\n\t"
2020-11-15 17:56:10 +01:00
:
: "r" ((uint32_t)boot_drive), "r" (pxe)
2020-11-15 17:56:10 +01:00
: "memory"
);
2021-04-03 22:12:40 +02:00
__builtin_unreachable();
}