1*58a2b000SEvgeniy Ivanov/* $NetBSD: cpufunc.S,v 1.4 2011/06/08 16:03:42 joerg Exp $ */ 2*58a2b000SEvgeniy Ivanov 3*58a2b000SEvgeniy Ivanov/*- 4*58a2b000SEvgeniy Ivanov * Copyright (c) 2007 The NetBSD Foundation, Inc. 5*58a2b000SEvgeniy Ivanov * All rights reserved. 6*58a2b000SEvgeniy Ivanov * 7*58a2b000SEvgeniy Ivanov * This code is derived from software contributed to The NetBSD Foundation 8*58a2b000SEvgeniy Ivanov * by Andrew Doran. 9*58a2b000SEvgeniy Ivanov * 10*58a2b000SEvgeniy Ivanov * Redistribution and use in source and binary forms, with or without 11*58a2b000SEvgeniy Ivanov * modification, are permitted provided that the following conditions 12*58a2b000SEvgeniy Ivanov * are met: 13*58a2b000SEvgeniy Ivanov * 1. Redistributions of source code must retain the above copyright 14*58a2b000SEvgeniy Ivanov * notice, this list of conditions and the following disclaimer. 15*58a2b000SEvgeniy Ivanov * 2. Redistributions in binary form must reproduce the above copyright 16*58a2b000SEvgeniy Ivanov * notice, this list of conditions and the following disclaimer in the 17*58a2b000SEvgeniy Ivanov * documentation and/or other materials provided with the distribution. 18*58a2b000SEvgeniy Ivanov * 19*58a2b000SEvgeniy Ivanov * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*58a2b000SEvgeniy Ivanov * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*58a2b000SEvgeniy Ivanov * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*58a2b000SEvgeniy Ivanov * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*58a2b000SEvgeniy Ivanov * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*58a2b000SEvgeniy Ivanov * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*58a2b000SEvgeniy Ivanov * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*58a2b000SEvgeniy Ivanov * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*58a2b000SEvgeniy Ivanov * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*58a2b000SEvgeniy Ivanov * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*58a2b000SEvgeniy Ivanov * POSSIBILITY OF SUCH DAMAGE. 30*58a2b000SEvgeniy Ivanov */ 31*58a2b000SEvgeniy Ivanov 32*58a2b000SEvgeniy Ivanov#include <machine/asm.h> 33*58a2b000SEvgeniy Ivanov 34*58a2b000SEvgeniy IvanovNENTRY(x86_read_psl) 35*58a2b000SEvgeniy Ivanov pushfl 36*58a2b000SEvgeniy Ivanov popl %eax 37*58a2b000SEvgeniy Ivanov ret 38*58a2b000SEvgeniy Ivanov 39*58a2b000SEvgeniy IvanovNENTRY(x86_write_psl) 40*58a2b000SEvgeniy Ivanov movl 4(%esp), %eax 41*58a2b000SEvgeniy Ivanov pushl %eax 42*58a2b000SEvgeniy Ivanov popfl 43*58a2b000SEvgeniy Ivanov ret 44*58a2b000SEvgeniy Ivanov 45*58a2b000SEvgeniy IvanovNENTRY(x86_disable_intr) 46*58a2b000SEvgeniy Ivanov cli 47*58a2b000SEvgeniy Ivanov ret 48*58a2b000SEvgeniy Ivanov 49*58a2b000SEvgeniy IvanovNENTRY(x86_enable_intr) 50*58a2b000SEvgeniy Ivanov sti 51*58a2b000SEvgeniy Ivanov ret 52*58a2b000SEvgeniy Ivanov 53*58a2b000SEvgeniy IvanovNENTRY(inb) 54*58a2b000SEvgeniy Ivanov movl 4(%esp), %edx 55*58a2b000SEvgeniy Ivanov xorl %eax, %eax 56*58a2b000SEvgeniy Ivanov inb %dx, %al 57*58a2b000SEvgeniy Ivanov ret 58*58a2b000SEvgeniy Ivanov 59*58a2b000SEvgeniy IvanovNENTRY(insb) 60*58a2b000SEvgeniy Ivanov pushl %edi 61*58a2b000SEvgeniy Ivanov movl 8(%esp), %edx 62*58a2b000SEvgeniy Ivanov movl 12(%esp), %edi 63*58a2b000SEvgeniy Ivanov movl 16(%esp), %ecx 64*58a2b000SEvgeniy Ivanov cld 65*58a2b000SEvgeniy Ivanov rep 66*58a2b000SEvgeniy Ivanov insb 67*58a2b000SEvgeniy Ivanov popl %edi 68*58a2b000SEvgeniy Ivanov ret 69*58a2b000SEvgeniy Ivanov 70*58a2b000SEvgeniy IvanovNENTRY(inw) 71*58a2b000SEvgeniy Ivanov movl 4(%esp), %edx 72*58a2b000SEvgeniy Ivanov xorl %eax, %eax 73*58a2b000SEvgeniy Ivanov inw %dx, %ax 74*58a2b000SEvgeniy Ivanov ret 75*58a2b000SEvgeniy Ivanov 76*58a2b000SEvgeniy IvanovNENTRY(insw) 77*58a2b000SEvgeniy Ivanov pushl %edi 78*58a2b000SEvgeniy Ivanov movl 8(%esp), %edx 79*58a2b000SEvgeniy Ivanov movl 12(%esp), %edi 80*58a2b000SEvgeniy Ivanov movl 16(%esp), %ecx 81*58a2b000SEvgeniy Ivanov cld 82*58a2b000SEvgeniy Ivanov rep 83*58a2b000SEvgeniy Ivanov insw 84*58a2b000SEvgeniy Ivanov popl %edi 85*58a2b000SEvgeniy Ivanov ret 86*58a2b000SEvgeniy Ivanov 87*58a2b000SEvgeniy IvanovNENTRY(inl) 88*58a2b000SEvgeniy Ivanov movl 4(%esp), %edx 89*58a2b000SEvgeniy Ivanov inl %dx, %eax 90*58a2b000SEvgeniy Ivanov ret 91*58a2b000SEvgeniy Ivanov 92*58a2b000SEvgeniy IvanovNENTRY(insl) 93*58a2b000SEvgeniy Ivanov pushl %edi 94*58a2b000SEvgeniy Ivanov movl 8(%esp), %edx 95*58a2b000SEvgeniy Ivanov movl 12(%esp), %edi 96*58a2b000SEvgeniy Ivanov movl 16(%esp), %ecx 97*58a2b000SEvgeniy Ivanov cld 98*58a2b000SEvgeniy Ivanov rep 99*58a2b000SEvgeniy Ivanov insl 100*58a2b000SEvgeniy Ivanov popl %edi 101*58a2b000SEvgeniy Ivanov ret 102*58a2b000SEvgeniy Ivanov 103*58a2b000SEvgeniy IvanovNENTRY(outb) 104*58a2b000SEvgeniy Ivanov movl 4(%esp), %edx 105*58a2b000SEvgeniy Ivanov movl 8(%esp), %eax 106*58a2b000SEvgeniy Ivanov outb %al, %dx 107*58a2b000SEvgeniy Ivanov ret 108*58a2b000SEvgeniy Ivanov 109*58a2b000SEvgeniy IvanovNENTRY(outsb) 110*58a2b000SEvgeniy Ivanov pushl %esi 111*58a2b000SEvgeniy Ivanov movl 8(%esp), %edx 112*58a2b000SEvgeniy Ivanov movl 12(%esp), %esi 113*58a2b000SEvgeniy Ivanov movl 16(%esp), %ecx 114*58a2b000SEvgeniy Ivanov cld 115*58a2b000SEvgeniy Ivanov rep 116*58a2b000SEvgeniy Ivanov outsb 117*58a2b000SEvgeniy Ivanov popl %esi 118*58a2b000SEvgeniy Ivanov ret 119*58a2b000SEvgeniy Ivanov 120*58a2b000SEvgeniy IvanovNENTRY(outw) 121*58a2b000SEvgeniy Ivanov movl 4(%esp), %edx 122*58a2b000SEvgeniy Ivanov movl 8(%esp), %eax 123*58a2b000SEvgeniy Ivanov outw %ax, %dx 124*58a2b000SEvgeniy Ivanov ret 125*58a2b000SEvgeniy Ivanov 126*58a2b000SEvgeniy IvanovNENTRY(outsw) 127*58a2b000SEvgeniy Ivanov pushl %esi 128*58a2b000SEvgeniy Ivanov movl 8(%esp), %edx 129*58a2b000SEvgeniy Ivanov movl 12(%esp), %esi 130*58a2b000SEvgeniy Ivanov movl 16(%esp), %ecx 131*58a2b000SEvgeniy Ivanov cld 132*58a2b000SEvgeniy Ivanov rep 133*58a2b000SEvgeniy Ivanov outsw 134*58a2b000SEvgeniy Ivanov popl %esi 135*58a2b000SEvgeniy Ivanov ret 136*58a2b000SEvgeniy Ivanov 137*58a2b000SEvgeniy IvanovNENTRY(outl) 138*58a2b000SEvgeniy Ivanov movl 4(%esp), %edx 139*58a2b000SEvgeniy Ivanov movl 8(%esp), %eax 140*58a2b000SEvgeniy Ivanov outl %eax, %dx 141*58a2b000SEvgeniy Ivanov ret 142*58a2b000SEvgeniy Ivanov 143*58a2b000SEvgeniy IvanovNENTRY(outsl) 144*58a2b000SEvgeniy Ivanov pushl %esi 145*58a2b000SEvgeniy Ivanov movl 8(%esp), %edx 146*58a2b000SEvgeniy Ivanov movl 12(%esp), %esi 147*58a2b000SEvgeniy Ivanov movl 16(%esp), %ecx 148*58a2b000SEvgeniy Ivanov cld 149*58a2b000SEvgeniy Ivanov rep 150*58a2b000SEvgeniy Ivanov outsl 151*58a2b000SEvgeniy Ivanov popl %esi 152*58a2b000SEvgeniy Ivanov ret 153