diff options
Diffstat (limited to 'src/arch/i386/init/bootblock.c')
-rw-r--r-- | src/arch/i386/init/bootblock.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/arch/i386/init/bootblock.c b/src/arch/i386/init/bootblock.c new file mode 100644 index 0000000000..eea0198d00 --- /dev/null +++ b/src/arch/i386/init/bootblock.c @@ -0,0 +1,24 @@ +static unsigned long findstage(char* target) +{ + unsigned long entry; + asm volatile ( + "mov $1f, %%esp\n\t" + "jmp walkcbfs\n\t" + "1:\n\t" : "=a" (entry) : "S" (target) : "ebx", "ecx", "edx", "edi", "ebp", "esp"); + return entry; +} + +static void call(unsigned long addr) +{ + asm volatile ("jmp %0\n\t" : : "r" (addr)); +} + +static void main(void) +{ + const char* target1 = "fallback/romstage"; + unsigned long entry; + entry = findstage(target1); + if (entry) call(entry); + asm volatile ("1:\n\thlt\n\tjmp 1b\n\t"); +} + |