2020-09-06 04:35:32 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <gzip/tinf.h>
|
|
|
|
|
|
|
|
__attribute__((noreturn))
|
2020-11-05 03:37:45 +03:00
|
|
|
void entry(uint8_t *compressed_stage2, size_t stage2_size, uint8_t boot_drive, int pxe) {
|
2020-09-25 23:36:26 +03:00
|
|
|
// The decompressor should decompress compressed_stage2 to address 0x8000.
|
|
|
|
uint8_t *dest = (uint8_t *)0x8000;
|
2020-09-06 04:35:32 +03:00
|
|
|
|
|
|
|
tinf_gzip_uncompress(dest, compressed_stage2, stage2_size);
|
|
|
|
|
2020-11-15 19:56:10 +03:00
|
|
|
asm volatile (
|
|
|
|
"mov esp, 0x7c00\n\t"
|
|
|
|
"xor ebp, ebp\n\t"
|
2020-12-27 02:27:47 +03:00
|
|
|
"push %2\n\t"
|
2020-11-15 19:56:10 +03:00
|
|
|
"push %1\n\t"
|
|
|
|
"push %0\n\t"
|
|
|
|
"push 0\n\t"
|
|
|
|
"jmp 0x8000\n\t"
|
|
|
|
:
|
2020-12-27 02:27:47 +03:00
|
|
|
: "r" ((uint32_t)boot_drive), "r" (pxe), "r" (tinf_gzip_uncompress)
|
2020-11-15 19:56:10 +03:00
|
|
|
: "memory"
|
|
|
|
);
|
2020-09-06 04:35:32 +03:00
|
|
|
|
2020-11-15 19:56:10 +03:00
|
|
|
for (;;);
|
2020-09-06 04:35:32 +03:00
|
|
|
}
|