[coreboot] How can I call the interrupt of SeaBIOS in coreboot?

Kevin O'Connor kevin at koconnor.net
Wed Aug 6 02:34:21 CEST 2008

On Tue, Aug 05, 2008 at 12:50:54PM +0800, Zhang Rui wrote:
> Hello,
> 	I am blocked with calling interrupt in coreboot.
> 	I tryed these ways:
> 	1. use "asm("int $0x19 \n");".  Qemu has no output when executeed
> here and nothing happens. The reason is that it should jump to real
> mode before calling int 19.

Right.  You'd need to call "int 0x19" after transitioning to real

> 	2. write a function boot_coreboot() in seabios. like:
> 	void VISIBLE32 boot_coreboot()
> 	{
> 		struct bregs br;
> 		dprintf(1, "boot_coreboot: begin\n");
> 		memset(&br, 0, sizeof(br));
> 		dprintf(1, "boot_coreboot: call int 19\n");
> 		call16_int(0x19, &br);
> 		dprintf(1, "boot_coreboot: end\n");
> 	}
> 	then call boot_coreboot() in seabios. It booted successfully.
> 	I have read the source code of call16_int, it jump to real mode and
> jump to the int 19 handler function directly, but do not use "int
> $0x19" asm code. why?

No.  The call_int16(0x19, ...) function will call irq_trampoline_0x19
in real mode (see src/util.h).  The irq_trampoline_0x19 code is
defined in src/romlayout.S (see macro "IRQ_TRAMPOLINE 19") which runs
"int 0x19".

> 	3. write asm code to jump to real mode and call int 19.
> 	but in coreboot there is compiling errors when I write asm codes with
> lables in it in vm86.c.
> 	for a simple example:
> 	__asm__ __volatile__ (
> 			/* paranoia -- does ecx get saved? not sure. This is
> 			 * the easiest safe thing to do. */
> 			"	pushal			\n"
> 			"	ljmp 	$0x28, $cbint16bit\n"
> 			"cbint16bit:		\n"
> 			"	.code16			\n"
> 			"	popal\n"
> 			);
> 	will cause errors:
> 	{standard input}: Assembler messages:
> 	{standard input}:746: Error: symbol `cbint16bit' is already defined
> 	in seabios there is compiling errors because of ".code16":
> 	out/../src/post.c:349: relocation truncated to fit: R_386_16 against `.text'
> 	what is wrong here?

I'm guessing you didn't issue a ".code32" after the ".code16".  Not
putting the assembler back into 32bit mode will totally confuse it.

Also, you may be running into trouble with the segmented memory model
- the 32bit code runs at 0xfxxxx and uses 32bit offsets, while the
16bit code runs at 0xf000:xxxx and uses 16bit offsets.

I'm not sure why you'd want to do this in seabios though - option 2
above would be the preferred way to call int19.


More information about the coreboot mailing list