1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22/* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27#pragma ident "%Z%%M% %I% %E% SMI" 28 29#if defined(__lint) 30#include <kmdb/kmdb_asmutil.h> 31#endif 32 33#include <sys/asm_linkage.h> 34 35#if defined(__lint) 36/*ARGSUSED*/ 37uintptr_t 38cas(uintptr_t *rs1, uintptr_t rs2, uintptr_t rd) 39{ 40 return (0); 41} 42#else 43 44 ENTRY_NP(cas) 45 movl 4(%esp), %edx /* rs1 */ 46 movl 8(%esp), %eax /* rs2 */ 47 movl 12(%esp), %ecx /* rd */ 48 lock 49 cmpxchgl %ecx, (%edx) 50 ret 51 SET_SIZE(cas) 52 53#endif 54 55#if defined(__lint) 56void 57membar_producer(void) 58{ 59} 60#else 61 62 ENTRY(membar_producer) 63 lock 64 xorl $0, (%esp) / flush the write buffer 65 ret 66 SET_SIZE(membar_producer) 67 68#endif 69 70#if defined(__lint) 71/*ARGSUSED*/ 72void 73rdmsr(uint32_t addr, uint64_t *retp) 74{ 75} 76#else 77 78 ENTRY(rdmsr) 79 movl 4(%esp), %ecx 80 rdmsr 81 movl 8(%esp), %ecx 82 movl %eax, (%ecx) 83 movl %edx, 4(%ecx) 84 ret 85 SET_SIZE(rdmsr) 86 87#endif 88 89#if defined(__lint) 90/*ARGSUSED*/ 91void 92wrmsr(uint32_t addr, uint64_t *valp) 93{ 94} 95#else 96 97 ENTRY(wrmsr) 98 movl 8(%esp), %ecx 99 movl (%ecx), %eax 100 movl 4(%ecx), %edx 101 movl 4(%esp), %ecx 102 wrmsr 103 ret 104 SET_SIZE(wrmsr) 105 106#endif 107 108#if defined(__lint) 109uintptr_t 110get_fp(void) 111{ 112 return (0); 113} 114#else 115 116 ENTRY(get_fp) 117 movl %ebp, %eax 118 ret 119 SET_SIZE(get_fp) 120 121#endif 122 123#if defined(__lint) 124/*ARGSUSED*/ 125void 126kmt_in(void *buf, size_t nbytes, uintptr_t addr) 127{ 128} 129 130/*ARGSUSED*/ 131void 132kmt_out(void *buf, size_t nbytes, uintptr_t addr) 133{ 134} 135#else 136 137 ENTRY_NP(kmt_in) 138 movl 4(%esp), %ecx /* buf */ 139 movl 8(%esp), %eax /* nbytes */ 140 movl 12(%esp), %edx /* addr */ 141 142 cmp $4, %eax 143 je 4f 144 cmp $2, %eax 145 je 2f 146 1471: inb (%dx) 148 movb %al, 0(%ecx) 149 ret 150 1512: inw (%dx) 152 movw %ax, 0(%ecx) 153 ret 154 1554: inl (%dx) 156 movl %eax, 0(%ecx) 157 ret 158 SET_SIZE(kmt_in) 159 160 ENTRY_NP(kmt_out) 161 movl 4(%esp), %ecx /* buf */ 162 movl 8(%esp), %eax /* nbytes */ 163 movl 12(%esp), %edx /* addr */ 164 165 cmp $4, %eax 166 je 4f 167 cmp $2, %eax 168 je 2f 169 1701: movb 0(%ecx), %al 171 outb (%dx) 172 ret 173 1742: movw 0(%ecx), %ax 175 outw (%dx) 176 ret 177 1784: movl 0(%ecx), %eax 179 outl (%dx) 180 ret 181 SET_SIZE(kmt_out) 182 183#endif 184