timesupref.cpp revision 2f0d866e126dd288169fed591c259c1c6b4016e5
1e40f57c72c881067b0314f898e1004211bb7650vboxsync/* $Id$ */
1e40f57c72c881067b0314f898e1004211bb7650vboxsync/** @file
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * IPRT - Time using SUPLib, the C Implementation.
1e40f57c72c881067b0314f898e1004211bb7650vboxsync */
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync/*
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2006-2007 Oracle Corporation
1e40f57c72c881067b0314f898e1004211bb7650vboxsync *
1e40f57c72c881067b0314f898e1004211bb7650vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
1e40f57c72c881067b0314f898e1004211bb7650vboxsync * available from http://www.virtualbox.org. This file is free software;
1e40f57c72c881067b0314f898e1004211bb7650vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1e40f57c72c881067b0314f898e1004211bb7650vboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * The contents of this file may alternatively be used under the terms
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * of the Common Development and Distribution License Version 1.0
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution, in which case the provisions of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * CDDL are applicable instead of those of the GPL.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * You may elect to license modified versions of this file under the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * terms and conditions of either the GPL or the CDDL or both.
1e40f57c72c881067b0314f898e1004211bb7650vboxsync */
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#ifndef IN_GUEST
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync/*******************************************************************************
1e40f57c72c881067b0314f898e1004211bb7650vboxsync* Header Files *
1e40f57c72c881067b0314f898e1004211bb7650vboxsync*******************************************************************************/
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#include <iprt/time.h>
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync#include "internal/iprt.h"
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#include <iprt/asm.h>
2f0d866e126dd288169fed591c259c1c6b4016e5vboxsync#include <iprt/asm-math.h>
2f0d866e126dd288169fed591c259c1c6b4016e5vboxsync#include <iprt/asm-amd64-x86.h>
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#include <VBox/sup.h>
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#include "internal/time.h"
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync/*
1e40f57c72c881067b0314f898e1004211bb7650vboxsync * Use the CPUID instruction for some kind of serialization.
1e40f57c72c881067b0314f898e1004211bb7650vboxsync */
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#undef ASYNC_GIP
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#undef USE_LFENCE
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define NEED_TRANSACTION_ID
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#include "timesupref.h"
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsyncRT_EXPORT_SYMBOL(RTTimeNanoTSLegacySync);
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define ASYNC_GIP
7e960d3a0a8a3a84d7aba2cca45d72b1c31cc97bvboxsync#ifdef IN_RC
1e40f57c72c881067b0314f898e1004211bb7650vboxsync# undef NEED_TRANSACTION_ID
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#endif
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#undef rtTimeNanoTSInternalRef
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#include "timesupref.h"
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsyncRT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsync);
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync/*
1e40f57c72c881067b0314f898e1004211bb7650vboxsync * Use LFENCE for load serialization.
1e40f57c72c881067b0314f898e1004211bb7650vboxsync */
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#undef ASYNC_GIP
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define USE_LFENCE
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#undef NEED_TRANSACTION_ID
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define NEED_TRANSACTION_ID
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#undef rtTimeNanoTSInternalRef
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#include "timesupref.h"
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsyncRT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSync);
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define ASYNC_GIP
7e960d3a0a8a3a84d7aba2cca45d72b1c31cc97bvboxsync#ifdef IN_RC
1e40f57c72c881067b0314f898e1004211bb7650vboxsync# undef NEED_TRANSACTION_ID
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#endif
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#undef rtTimeNanoTSInternalRef
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#include "timesupref.h"
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsyncRT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsync);
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync
1e40f57c72c881067b0314f898e1004211bb7650vboxsync#endif /* !IN_GUEST */
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync