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#if defined(__lint) 28#include <kmdb/kmdb_asmutil.h> 29#endif 30 31#include <sys/asm_linkage.h> 32 33#if defined(__lint) 34/*ARGSUSED*/ 35uintptr_t 36cas(uintptr_t *rs1, uintptr_t rs2, uintptr_t rd) 37{ 38 return (0); 39} 40#else 41 42 ENTRY_NP(cas) 43 movq %rsi, %rax 44 lock 45 cmpxchgq %rdx, (%rdi) 46 ret 47 SET_SIZE(cas) 48#endif 49 50#if defined(__lint) 51void 52membar_producer(void) 53{ 54} 55#else 56 57 ENTRY(membar_producer) 58 sfence 59 ret 60 SET_SIZE(membar_producer) 61 62#endif 63 64#if defined(__lint) 65/*ARGSUSED*/ 66void 67rdmsr(uint32_t addr, uint64_t *retp) 68{ 69} 70#else 71 72 ENTRY(rdmsr) 73 movl %edi, %ecx 74 rdmsr 75 movl %eax, (%rsi) 76 movl %edx, 4(%rsi) 77 ret 78 SET_SIZE(rdmsr) 79 80#endif 81 82#if defined(__lint) 83/*ARGSUSED*/ 84void 85wrmsr(uint32_t addr, uint64_t *valp) 86{ 87} 88#else 89 90 ENTRY(wrmsr) 91 movl (%rsi), %eax 92 movl 4(%rsi), %edx 93 movl %edi, %ecx 94 wrmsr 95 ret 96 SET_SIZE(wrmsr) 97 98#endif 99 100#if defined(__lint) 101uintptr_t 102get_fp(void) 103{ 104 return (0); 105} 106#else 107 108 ENTRY(get_fp) 109 movq %rbp, %rax 110 ret 111 SET_SIZE(get_fp) 112 113#endif 114 115#if defined(__lint) 116/*ARGSUSED*/ 117void 118kmt_in(void *buf, size_t nbytes, uintptr_t addr) 119{ 120} 121 122/*ARGSUSED*/ 123void 124kmt_out(void *buf, size_t nbytes, uintptr_t addr) 125{ 126} 127#else 128 129 ENTRY_NP(kmt_in) 130 cmpq $4, %rsi 131 je 4f 132 cmpq $2, %rsi 133 je 2f 134 1351: inb (%dx) 136 movb %al, 0(%rdi) 137 ret 138 1392: inw (%dx) 140 movw %ax, 0(%rdi) 141 ret 142 1434: inl (%dx) 144 movl %eax, 0(%rdi) 145 ret 146 SET_SIZE(kmt_in) 147 148 ENTRY_NP(kmt_out) 149 cmpq $4, %rsi 150 je 4f 151 cmpq $2, %rsi 152 je 2f 153 1541: movb 0(%rdi), %al 155 outb (%dx) 156 ret 157 1582: movw 0(%rdi), %ax 159 outw (%dx) 160 ret 161 1624: movl 0(%rdi), %eax 163 outl (%dx) 164 ret 165 SET_SIZE(kmt_out) 166 167#endif 168