summaryrefslogtreecommitdiff
path: root/src/arch/i386/init/bootblock.c
blob: eea0198d00e34f53faddf071c1fc80ed849b39b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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");
}