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