[BACK]Return to cpufunc.S CVS log [TXT][DIR] Up to [local] / prex / dev / i386 / i386

Annotation of prex/dev/i386/i386/cpufunc.S, Revision 1.1

1.1     ! nbrk        1: /*-
        !             2:  * Copyright (c) 2008, Kohsuke Ohtani
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms, with or without
        !             6:  * modification, are permitted provided that the following conditions
        !             7:  * are met:
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer.
        !            10:  * 2. Redistributions in binary form must reproduce the above copyright
        !            11:  *    notice, this list of conditions and the following disclaimer in the
        !            12:  *    documentation and/or other materials provided with the distribution.
        !            13:  * 3. Neither the name of the author nor the names of any co-contributors
        !            14:  *    may be used to endorse or promote products derived from this software
        !            15:  *    without specific prior written permission.
        !            16:  *
        !            17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
        !            18:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            19:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            20:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
        !            21:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            22:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            23:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            25:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            26:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            27:  * SUCH DAMAGE.
        !            28:  */
        !            29:
        !            30: #include <machine/asm.h>
        !            31:
        !            32:
        !            33: ENTRY(breakpoint)
        !            34:        int     $3
        !            35:        ret
        !            36:
        !            37: ENTRY(outb)
        !            38:        movl    4(%esp), %eax
        !            39:        movl    8(%esp), %edx
        !            40:        outb    %al, %dx
        !            41:        ret
        !            42:
        !            43: ENTRY(outw)
        !            44:        movl    4(%esp), %eax
        !            45:        movl    8(%esp), %edx
        !            46:        outw    %ax, %dx
        !            47:        ret
        !            48:
        !            49: ENTRY(outl)
        !            50:        movl    4(%esp), %eax
        !            51:        movl    8(%esp), %edx
        !            52:        outl    %eax, %dx
        !            53:        ret
        !            54:
        !            55: ENTRY(inb)
        !            56:        movl    4(%esp), %edx
        !            57:        xorl    %eax, %eax
        !            58:        inb     %dx, %al
        !            59:        ret
        !            60:
        !            61: ENTRY(inw)
        !            62:        movl    4(%esp), %edx
        !            63:        xorl    %eax, %eax
        !            64:        inw     %dx, %ax
        !            65:        ret
        !            66:
        !            67: ENTRY(inl)
        !            68:        movl    4(%esp), %edx
        !            69:        inl     %dx, %eax
        !            70:        ret
        !            71:
        !            72: ENTRY(outb_p)
        !            73:        movl    4(%esp), %eax
        !            74:        movl    8(%esp), %edx
        !            75:        outb    %al, %dx
        !            76:        outb    %al, $0x80
        !            77:        ret
        !            78:
        !            79: ENTRY(inb_p)
        !            80:        movl    4(%esp), %edx
        !            81:        xorl    %eax, %eax
        !            82:        inb     %dx, %al
        !            83:        outb    %al, $0x80
        !            84:        ret
        !            85:
        !            86: ENTRY(rdmsr)
        !            87:        movl    4(%esp), %ecx
        !            88:        rdmsr
        !            89:        movl    8(%esp), %ecx
        !            90:        movl    %eax, (%ecx)
        !            91:        movl    12(%esp), %ecx
        !            92:        movl    %edx, (%ecx)
        !            93:        ret
        !            94:
        !            95: ENTRY(wrmsr)
        !            96:        movl    4(%esp), %ecx
        !            97:        movl    8(%esp), %eax
        !            98:        movl    12(%esp), %edx
        !            99:        wrmsr
        !           100:        ret
        !           101:
        !           102: ENTRY(cpuid)
        !           103:        pushl   %ebx
        !           104:        pushl   %edi
        !           105:        movl    12(%esp), %eax
        !           106:        movl    16(%esp), %edi
        !           107:        cpuid
        !           108:        movl    %eax, 0(%edi)
        !           109:        movl    %ebx, 4(%edi)
        !           110:        movl    %ecx, 8(%edi)
        !           111:        movl    %edx, 12(%edi)
        !           112:        popl    %edi
        !           113:        popl    %ebx
        !           114:        ret

CVSweb