2020-09-06 04:35:32 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
2021-12-31 12:58:05 +03:00
|
|
|
#include <stdnoreturn.h>
|
2021-10-22 21:08:11 +03:00
|
|
|
#include <tinf.h>
|
2020-09-06 04:35:32 +03:00
|
|
|
|
2021-12-31 12:58:05 +03:00
|
|
|
noreturn 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 (
|
2021-05-29 19:07:28 +03:00
|
|
|
"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 19:56:10 +03:00
|
|
|
:
|
2021-02-21 07:01:18 +03:00
|
|
|
: "r" ((uint32_t)boot_drive), "r" (pxe)
|
2020-11-15 19:56:10 +03:00
|
|
|
: "memory"
|
|
|
|
);
|
2020-09-06 04:35:32 +03:00
|
|
|
|
2021-04-03 23:12:40 +03:00
|
|
|
__builtin_unreachable();
|
2020-09-06 04:35:32 +03:00
|
|
|
}
|