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