/* SPDX-License-Identifier: GPL-2.0-or-later */1/* -----------------------------------------------------------------------2*3* Copyright 2009-2014 Intel Corporation; author H. Peter Anvin4*5* ----------------------------------------------------------------------- */67/*8* "Glove box" for BIOS calls. Avoids the constant problems with BIOSes9* touching registers they shouldn't be.10*/1112.code1613.section ".inittext","ax"14.globl intcall15.type intcall, @function16intcall:17/* Self-modify the INT instruction. Ugly, but works. */18cmpb %al, 3f19je 1f20movb %al, 3f21jmp 1f /* Synchronize pipeline */221:23/* Save state */24pushfl25pushw %fs26pushw %gs27pushal2829/* Copy input state to stack frame */30subw $44, %sp31movw %dx, %si32movw %sp, %di33movw $11, %cx34rep movsl3536/* Pop full state from the stack */37popal38popw %gs39popw %fs40popw %es41popw %ds42popfl4344/* Actual INT */45.byte 0xcd /* INT opcode */463: .byte 04748/* Push full state to the stack */49pushfl50pushw %ds51pushw %es52pushw %fs53pushw %gs54pushal5556/* Re-establish C environment invariants */57cld58movzwl %sp, %esp59movw %cs, %ax60movw %ax, %ds61movw %ax, %es6263/* Copy output state from stack frame */64movw 68(%esp), %di /* Original %cx == 3rd argument */65andw %di, %di66jz 4f67movw %sp, %si68movw $11, %cx69rep movsl704: addw $44, %sp7172/* Restore state and return */73popal74popw %gs75popw %fs76popfl77retl78.size intcall, .-intcall798081