1180767Simp/*- 2180767Simp * Copyright (c) 1997 Jonathan Lemon 3180767Simp * All rights reserved. 4180767Simp * 5180767Simp * Redistribution and use in source and binary forms, with or without 6180767Simp * modification, are permitted provided that the following conditions 7180767Simp * are met: 8238405Sjkim * 1. Redistributions of source code must retain the above copyright 9238405Sjkim * notice, this list of conditions and the following disclaimer. 10238405Sjkim * 2. Redistributions in binary form must reproduce the above copyright 11180767Simp * notice, this list of conditions and the following disclaimer in the 12238405Sjkim * documentation and/or other materials provided with the distribution. 13238405Sjkim * 14194207Ssimon * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15194207Ssimon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16194207Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17194207Ssimon * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18180767Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19180767Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20180767Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21238405Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22238405Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23238405Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24238405Sjkim * SUCH DAMAGE. 25238405Sjkim * 26238405Sjkim * $FreeBSD: releng/11.0/sys/pc98/apm/apm_bioscall.S 145326 2005-04-20 12:28:20Z nyan $ 27238405Sjkim */ 28238405Sjkim 29238405Sjkim/* 30180767Simp * Functions for calling x86 BIOS functions from the BSD kernel 31180767Simp */ 32238405Sjkim 33180767Simp#include <machine/asmacros.h> 34180767Simp 35180767Simp .text 36238405Sjkim 37238405Sjkim/* 38238405Sjkim * bios32_apm98(regs, offset, segment) 39180767Simp * struct bios_regs *regs; 40180767Simp * u_int offset; 41180767Simp * u_short segment; 42180767Simp */ 43180767SimpENTRY(bios32_apm98) 44180767Simp pushl %ebp 45180767Simp movl 16(%esp),%ebp 46180767Simp mov %bp,bioscall_vector+4 47180767Simp movl 12(%esp),%ebp 48238405Sjkim movl %ebp,bioscall_vector 49238405Sjkim movl 8(%esp),%ebp 50238405Sjkim pushl %ebx 51180767Simp pushl %esi 52180767Simp pushl %edi 53180767Simp movl 0(%ebp),%eax 54238405Sjkim movl 4(%ebp),%ebx 55238405Sjkim movl 8(%ebp),%ecx 56238405Sjkim movl 12(%ebp),%edx 57180767Simp movl 16(%ebp),%esi 58180767Simp movl 20(%ebp),%edi 59180767Simp pushl %ebp 60238405Sjkim pushfl 61238405Sjkim cli 62180767Simp lcall *bioscall_vector 63238405Sjkim movl %eax,%edi 64238405Sjkim movl %edx,%esi 65180767Simp lahf 66238405Sjkim movl apm_necsmm_addr,%edx 67238405Sjkim andl %edx,%edx 68238405Sjkim jz 9f 69180767Simp inb %dx,%al 70180767Simp andl apm_necsmm_mask,%eax 71180767Simp outb %al,%dx 72180767Simp9: 73180767Simp sti 74180767Simp popl %ebp 75180767Simp movl %edi,0(%ebp) 76180767Simp movl %ebx,4(%ebp) 77180767Simp movl %ecx,8(%ebp) 78180767Simp movl %esi,12(%ebp) 79180767Simp movl $0,16(%ebp) /* esi is cannot get */ 80180767Simp movl $0,20(%ebp) /* edi is cannot get */ 81180767Simp movl %edi,%eax 82180767Simp andl $0x100,%eax 83180767Simp popl %edi 84180767Simp popl %esi 85180767Simp popl %ebx 86180767Simp popl %ebp 87180767Simp ret 88180767Simp