Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / legion / src / host / i686native.c
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: i686native.c
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named 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 work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "@(#)i686native.c 1.1 07/01/16 SMI"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "basics.h"
#include "fatal.h"
#include "allocate.h"
#include "simcore.h"
#include "config.h"
#include "xicache.h"
#include "xdcache.h"
#include "tsparcv9.h"
#include "tsparcv9internal.h"
#include "sparcv9cc.h"
#include "magictraps.h"
#include "sparcv9decode.h"
#include "sunmedia_intrin.h"
#include "fpsim.h"
#include <atomic.h>
/* For now, map to Solaris 10 C-library implementations */
void
host_atomic_get128be(uint64_t *ptr, uint64_t *r1p, uint64_t *r2p)
{
union {
__m128i x;
uint64_t x1[2];
} ux;
ux.x = _mm_load_si128((__m128i *)ptr);
*r1p = ux.x1[0];
*r2p = ux.x1[1];
}
uint32_t
host_swap(uint32_t *ptr, uint32_t val)
{
return (atomic_swap_32(ptr, val));
}
uint8_t
host_ldstub(uint8_t *ptr, uint8_t v1, uint8_t v2)
{
return (atomic_swap_8(ptr, 0xff));
}
uint32_t
host_cas32(uint32_t *target, uint32_t cmp, uint32_t newval)
{
return (atomic_cas_32(target, cmp, newval));
}
uint64_t
host_cas64(uint64_t *target, uint64_t cmp, uint64_t newval)
{
return (atomic_cas_64(target, cmp, newval));
}
uint32_t
sim_atomic_add_32_nv(uint32_t *target, int32_t delta)
{
return (atomic_add_32_nv(target, delta));
}