UnnamedOS
vm86_asm.S
1 .global vm86_call_bios_start, vm86_interrupt_hook, vm86_call_bios_end
2 
3 vm86_call_bios_start: // This is where our VM86 task's entry point is. We
4 .code16 // tell GAS that now we are in 16-bit/real mode.
5  //... // Here we could add instructions.
6 vm86_interrupt_hook: // This label tells the kernel about where the operand
7  int $0x00 // $0x00 is in memory, therefore it can be set dynamically.
8  //... // Here we could add instructions.
9 vm86_call_bios_end: // This is the task's last byte of code (the kernel copies
10  int $0x3 // the code up to this byte). The int $0x3 signals the
11  // kernel to terminate a VM86 task - it consists of only
12  // one byte, otherwise the label would be incorrect!
13 .code32 // Finally, we switch back to 32-bit/protected mode code.
14 
15 // To make your own VM86 task, use the following structure:
16 // code_start:
17 // .code16
18 // // your 16-bit code
19 // code_end:
20 // int $0x3
21 // .code32
22 // Note that this code must be position independent (no jumps / addresses)!
23 // This is a huge limitation, but not needed for our purposes (calling the BIOS).