* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: hpv_console.s
* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For the avoidance of doubt, and except that if any non-GPL license
* choice is available it will apply instead, Sun elects to use only
* the General Public License version 2 (GPLv2) at this time for any
* software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later version
* may be used, or where a choice of which version of the GPL is applied is
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* ========== Copyright Header End ============================================
#ident "@(#) hpv_console.s 1.2 04/10/12 12:12:01"
#include <sys/asm_linkage.h>
#include <sys/asm_linkage.h>
.type hv_getch_mutex, #object
.type hv_putch_mutex, #object
#if defined(lint) || defined(__lint)
int hv_writechars( char * buf, int len )
* This will need a mutex to prevent the output from
* differing cpus coliding and interleaving.
* There is still a printf mutex that should protect
* nearly all of the time. So that means the penalty
* for acquiring a mutex here should be miniscule.
ENTRY2( hv_writechars, writechars )
save %sp, -SA(MINFRAME), %sp
GET_MUTEX( hv_putch_mutex, %l6, %l7 )
FREE_MUTEX( hv_putch_mutex, %l6, %l7 )
SET_SIZE( hv_writechars )
mov %l0, %i0 ! return count of how many read
#if defined(lint) || defined(__lint)
int hv_readchars( char * buf, int len )
* This will need a mutex to prevent the output from
* differing cpus coliding and interleaving.
* There is still a printf mutex that should protect
* nearly all of the time. So that means the penalty
* for acquiring a mutex here should be miniscule.
.type console_master, #object
.type hv_read_result, #object
ENTRY2( hv_readchars, readchars )
* returns count of characters read
save %sp, -SA(MINFRAME), %sp
* See if we are running on the console master - if not do not
setx console_master, %l5, %l6
bne %icc, 4f ! j.if not console master
GET_MUTEX( hv_getch_mutex, %l6, %l7 )
/* while less than buffer and result is 0 */
brnz %o0, 3f ! non zero return
FREE_MUTEX( hv_getch_mutex, %l6, %l7 )
mov %l0, %i0 ! return count of how many read
setx hv_read_result, %l3, %l2