1843e1988Sjohnlev/* 2843e1988Sjohnlev * CDDL HEADER START 3843e1988Sjohnlev * 4843e1988Sjohnlev * The contents of this file are subject to the terms of the 5843e1988Sjohnlev * Common Development and Distribution License (the "License"). 6843e1988Sjohnlev * You may not use this file except in compliance with the License. 7843e1988Sjohnlev * 8843e1988Sjohnlev * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9843e1988Sjohnlev * or http://www.opensolaris.org/os/licensing. 10843e1988Sjohnlev * See the License for the specific language governing permissions 11843e1988Sjohnlev * and limitations under the License. 12843e1988Sjohnlev * 13843e1988Sjohnlev * When distributing Covered Code, include this CDDL HEADER in each 14843e1988Sjohnlev * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15843e1988Sjohnlev * If applicable, add the following below this CDDL HEADER, with the 16843e1988Sjohnlev * fields enclosed by brackets "[]" replaced with your own identifying 17843e1988Sjohnlev * information: Portions Copyright [yyyy] [name of copyright owner] 18843e1988Sjohnlev * 19843e1988Sjohnlev * CDDL HEADER END 20843e1988Sjohnlev */ 21843e1988Sjohnlev 22843e1988Sjohnlev/* 23843e1988Sjohnlev * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24843e1988Sjohnlev * Use is subject to license terms. 25843e1988Sjohnlev */ 26843e1988Sjohnlev 27843e1988Sjohnlev#include <sys/asm_linkage.h> 28843e1988Sjohnlev#include <sys/asm_misc.h> 29843e1988Sjohnlev 30843e1988Sjohnlev#if defined(__lint) 31843e1988Sjohnlev 32843e1988Sjohnlev#include "dboot_asm.h" 33843e1988Sjohnlev 34843e1988Sjohnlev/* ARGSUSED */ 35843e1988Sjohnlevuint32_t 36843e1988Sjohnlevget_cpuid_edx(uint32_t *eax) 37843e1988Sjohnlev{ return (0); } 38843e1988Sjohnlev 39843e1988Sjohnlev/* ARGSUSED */ 40843e1988Sjohnlevvoid 41843e1988Sjohnlevoutb(int port, uint8_t value) 42843e1988Sjohnlev{} 43843e1988Sjohnlev 44843e1988Sjohnlev/* ARGSUSED */ 45843e1988Sjohnlevuint8_t 46843e1988Sjohnlevinb(int port) 47843e1988Sjohnlev{ return (0); } 48843e1988Sjohnlev 49843e1988Sjohnlev#else /* __lint */ 50843e1988Sjohnlev 51843e1988Sjohnlev#if defined(__amd64) 52843e1988Sjohnlev 53843e1988Sjohnlev /* 54843e1988Sjohnlev * do a cpuid instruction, returning the eax/edx values 55843e1988Sjohnlev * 56843e1988Sjohnlev * uint32_t get_cpuid_edx(uint32_t *eax) 57843e1988Sjohnlev */ 58843e1988Sjohnlev ENTRY_NP(get_cpuid_edx) 59843e1988Sjohnlev pushq %rbx 60843e1988Sjohnlev movl (%rdi), %eax 61843e1988Sjohnlev cpuid 62843e1988Sjohnlev movl %eax, (%rdi) 63843e1988Sjohnlev movl %edx, %eax 64843e1988Sjohnlev popq %rbx 65843e1988Sjohnlev ret 66843e1988Sjohnlev SET_SIZE(get_cpuid_edx) 67843e1988Sjohnlev 68843e1988Sjohnlev /* 69843e1988Sjohnlev * void outb(int port, uint8_t value) 70843e1988Sjohnlev */ 71843e1988Sjohnlev ENTRY(outb) 72843e1988Sjohnlev movw %di, %dx 73843e1988Sjohnlev movb %sil, %al 74843e1988Sjohnlev outb (%dx) 75843e1988Sjohnlev ret 76843e1988Sjohnlev SET_SIZE(outb) 77843e1988Sjohnlev 78843e1988Sjohnlev /* 79843e1988Sjohnlev * uint8_t inb(int port) 80843e1988Sjohnlev */ 81843e1988Sjohnlev ENTRY(inb) 82843e1988Sjohnlev xorl %eax, %eax 83843e1988Sjohnlev movw %di, %dx 84843e1988Sjohnlev inb (%dx) 85843e1988Sjohnlev ret 86843e1988Sjohnlev SET_SIZE(inb) 87843e1988Sjohnlev 88*e65d07eeSKeith Wesolowski ENTRY(htonl) 89*e65d07eeSKeith Wesolowski movl %edi, %eax 90*e65d07eeSKeith Wesolowski bswap %eax 91*e65d07eeSKeith Wesolowski ret 92*e65d07eeSKeith Wesolowski SET_SIZE(htonl) 93*e65d07eeSKeith Wesolowski 94843e1988Sjohnlev#elif defined(__i386) 95843e1988Sjohnlev 96843e1988Sjohnlev .code32 97843e1988Sjohnlev 98843e1988Sjohnlev /* 99843e1988Sjohnlev * do a cpuid instruction, returning the eax/edx values 100843e1988Sjohnlev * 101843e1988Sjohnlev * uint32_t get_cpuid_edx(uint32_t *eax) 102843e1988Sjohnlev */ 103843e1988Sjohnlev ENTRY_NP(get_cpuid_edx) 104843e1988Sjohnlev movl 4(%esp), %ecx 105843e1988Sjohnlev movl (%ecx), %eax 106843e1988Sjohnlev pushl %ebx 107843e1988Sjohnlev cpuid 108843e1988Sjohnlev popl %ebx 109843e1988Sjohnlev movl 4(%esp), %ecx 110843e1988Sjohnlev movl %eax, (%ecx) 111843e1988Sjohnlev movl %edx, %eax 112843e1988Sjohnlev ret 113843e1988Sjohnlev SET_SIZE(get_cpuid_edx) 114843e1988Sjohnlev 115843e1988Sjohnlev /* 116843e1988Sjohnlev * void outb(int port, uint8_t value) 117843e1988Sjohnlev */ 118843e1988Sjohnlev ENTRY_NP(outb) 119843e1988Sjohnlev movl 4(%esp), %edx 120843e1988Sjohnlev movl 8(%esp), %eax 121843e1988Sjohnlev outb (%dx) 122843e1988Sjohnlev ret 123843e1988Sjohnlev SET_SIZE(outb) 124843e1988Sjohnlev 125843e1988Sjohnlev /* 126843e1988Sjohnlev * uint8_t inb(int port) 127843e1988Sjohnlev */ 128843e1988Sjohnlev ENTRY_NP(inb) 129843e1988Sjohnlev movl 4(%esp), %edx 130843e1988Sjohnlev inb (%dx) 131843e1988Sjohnlev andl $0xff, %eax 132843e1988Sjohnlev ret 133843e1988Sjohnlev SET_SIZE(inb) 134843e1988Sjohnlev 135*e65d07eeSKeith Wesolowski ENTRY(htonl) 136*e65d07eeSKeith Wesolowski movl 4(%esp), %eax 137*e65d07eeSKeith Wesolowski bswap %eax 138*e65d07eeSKeith Wesolowski ret 139*e65d07eeSKeith Wesolowski SET_SIZE(htonl) 140*e65d07eeSKeith Wesolowski 141843e1988Sjohnlev#endif /* __i386 */ 142843e1988Sjohnlev 143843e1988Sjohnlev#endif /* __lint */ 144