Re: Question about "intcall" function
From: H. Peter Anvin
Date: Fri Sep 18 2026 - 15:37:40 EST
On September 18, 2026 11:46:20 AM PDT, Alexandre <alexramos25.pt@xxxxxxxxx> wrote:
>How can a 32 bit C code call 16 bit code functions without any mode switch (CR0)
>
>arch/x86/boot/bioscall.S:
>.code16
>.section ".inittext","ax"
>.globl intcall
>.type intcall, @function
>intcall:
>/* Self-modify the INT instruction. Ugly, but works. */
>cmpb %al, 3f
>...
>
>arch/x86/boot/video-bios.c:
>static int set_bios_mode(u8 mode)
>{
>struct biosregs ireg, oreg;
>u8 new_mode;
>
>initregs(&ireg);
>ireg.al = mode; /* AH=0x00 Set Video Mode */
>intcall(0x10, &ireg, NULL);
>...
>
>Kind regards,
>Alexandre Ramos
Because it isn't 32-bit code, it is 16-not code.