AC_ARG_WITH(xammac, [ --with-xammac=yes,no If you want to build the Xamarin.Mac assemblies (defaults to no)], [], [with_xammac=no])
AC_ARG_WITH(mobile_static, [ --with-mobile_static=yes,no If you want to build the mobile_static assemblies (defaults to no)], [], [with_mobile_static=no])
-OPROFILE=no
-AC_ARG_WITH(oprofile,[ --with-oprofile=no,<oprofile install dir> Enable oprofile support (defaults to no)],[
- if test x$with_oprofile != xno; then
- oprofile_include=$with_oprofile/include
- if test ! -f $oprofile_include/opagent.h; then
- AC_MSG_ERROR([oprofile include file not found at $oprofile_include/opagent.h])
- fi
- OPROFILE=yes
- OPROFILE_CFLAGS="-I$oprofile_include"
- OPROFILE_LIBS="-L$with_oprofile/lib/oprofile -lopagent"
- AC_DEFINE(HAVE_OPROFILE,1,[Have oprofile support])
- fi
-])
-
MALLOC_MEMPOOLS=no
AC_ARG_WITH(malloc_mempools,[ --with-malloc-mempools=yes,no Use malloc for each single mempool allocation (only for runtime debugging, defaults to no)],[
if test x$with_malloc_mempools = xyes; then
## Maybe should also disable if mcsdir is invalid. Let's punt the issue for now.
AM_CONDITIONAL(BUILD_MCS, [test x$cross_compiling = xno && test x$enable_mcs_build != xno])
-AM_CONDITIONAL(HAVE_OPROFILE, test x$OPROFILE = xyes)
-AC_SUBST(OPROFILE_CFLAGS)
-AC_SUBST(OPROFILE_LIBS)
-
libmono_ldflags="$libmono_ldflags $LIBS"
AM_CONDITIONAL(INSTALL_4_x, [test "x$with_profile4_x" = xyes])
TLS: $with_tls
SIGALTSTACK: $with_sigaltstack
Engine: $jit_status
- oprofile: $OPROFILE
BigArrays: $enable_big_arrays
DTrace: $enable_dtrace
LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm)
--- /dev/null
+namespace System.Security.Cryptography {
+
+ static class CAPI {
+ // OID key type.
+ internal const uint CRYPT_OID_INFO_OID_KEY = 1;
+ internal const uint CRYPT_OID_INFO_NAME_KEY = 2;
+ internal const uint CRYPT_OID_INFO_ALGID_KEY = 3;
+ internal const uint CRYPT_OID_INFO_SIGN_KEY = 4;
+
+ public static string CryptFindOIDInfoNameFromKey (string key, OidGroup oidGroup)
+ {
+ // TODO: incomplete
+ // TODO: oidGroup is ignored
+ switch (key) {
+ case "1.2.840.113549.1.1.5":
+ case "1.3.14.3.2.29":
+ case "1.3.14.3.2.15":
+ return "sha1RSA";
+ case "1.2.840.113549.1.1.4":
+ case "1.3.14.3.2.3":
+ return "md5RSA";
+ case "1.2.840.10040.4.3":
+ case "1.3.14.3.2.13":
+ return "sha1DSA";
+ case "1.2.840.113549.1.1.2":
+ case "1.3.14.7.2.3.1":
+ return "md2RSA";
+ case "1.2.840.113549.1.1.3":
+ return "md4RSA";
+ return "md4RSA";
+ return "md4RSA";
+ case "1.3.14.3.2.27":
+ return "dsaSHA1";
+ case "2.16.840.1.101.2.1.1.19":
+ return "mosaicUpdatedSig";
+ case "1.3.14.3.2.26":
+ return "sha1";
+ case "1.2.840.113549.2.5":
+ return "md5";
+ case "2.16.840.1.101.3.4.2.1":
+ return "sha256";
+ case "2.16.840.1.101.3.4.2.2":
+ return "sha384";
+ case "2.16.840.1.101.3.4.2.3":
+ return "sha512";
+ case "1.2.840.113549.1.1.11":
+ return "sha256RSA";
+ case "1.2.840.113549.1.1.12":
+ return "sha384RSA";
+ case "1.2.840.113549.1.1.13":
+ return "sha512RSA";
+ case "1.2.840.113549.1.1.10":
+ return "RSASSA-PSS";
+ case "1.2.840.10045.4.1":
+ return "sha1ECDSA";
+ case "1.2.840.10045.4.3.2":
+ return "sha256ECDSA";
+ case "1.2.840.10045.4.3.3":
+ return "sha384ECDSA";
+ case "1.2.840.10045.4.3.4":
+ return "sha512ECDSA";
+ case "1.2.840.10045.4.3":
+ return "specifiedECDSA";
+ case "1.2.840.113549.1.1.1":
+ return "RSA";
+ case "1.2.840.113549.1.7.1":
+ return "PKCS 7 Data";
+ case "1.2.840.113549.1.9.3":
+ return "Content Type";
+ case "1.2.840.113549.1.9.4":
+ return "Message Digest";
+ case "1.2.840.113549.1.9.5":
+ return "Signing Time";
+ case "1.2.840.113549.3.7":
+ return "3des";
+ case "2.5.29.17":
+ return "Subject Alternative Name";
+ case "2.16.840.1.101.3.4.1.2":
+ return "aes128";
+ case "2.16.840.1.101.3.4.1.42":
+ return "aes256";
+ case "2.16.840.1.113730.1.1":
+ return "Netscape Cert Type";
+ }
+
+ return null;
+ }
+
+ public static string CryptFindOIDInfoKeyFromName (string name, OidGroup oidGroup)
+ {
+ // TODO: incomplete
+ // TODO: oidGroup is ignored
+ switch(name) {
+ case "sha1RSA":
+ return "1.2.840.113549.1.1.5";
+ case "md5RSA":
+ return "1.2.840.113549.1.1.4";
+ case "sha1DSA":
+ return "1.2.840.10040.4.3";
+ case "shaRSA":
+ return "1.3.14.3.2.29";
+ case "md2RSA":
+ return "1.2.840.113549.1.1.2";
+ case "md4RSA":
+ return "1.2.840.113549.1.1.3";
+ case "dsaSHA1":
+ return "1.3.14.3.2.27";
+ case "mosaicUpdatedSig":
+ return "2.16.840.1.101.2.1.1.19";
+ case "sha1":
+ return "1.3.14.3.2.26";
+ case "md5":
+ return "1.2.840.113549.2.5";
+ case "sha256":
+ return "2.16.840.1.101.3.4.2.1";
+ case "sha384":
+ return "2.16.840.1.101.3.4.2.2";
+ case "sha512":
+ return "2.16.840.1.101.3.4.2.3";
+ case "sha256RSA":
+ return "1.2.840.113549.1.1.11";
+ case "sha384RSA":
+ return "1.2.840.113549.1.1.12";
+ case "sha512RSA":
+ return "1.2.840.113549.1.1.13";
+ case "RSASSA-PSS":
+ return "1.2.840.113549.1.1.10";
+ case "sha1ECDSA":
+ return "1.2.840.10045.4.1";
+ case "sha256ECDSA":
+ return "1.2.840.10045.4.3.2";
+ case "sha384ECDSA":
+ return "1.2.840.10045.4.3.3";
+ case "sha512ECDSA":
+ return "1.2.840.10045.4.3.4";
+ case "specifiedECDSA":
+ return "1.2.840.10045.4.3";
+ case "RSA":
+ return "1.2.840.113549.1.1.1";
+ case "PKCS 7 Data":
+ return "1.2.840.113549.1.7.1";
+ case "Content Type":
+ return "1.2.840.113549.1.9.3";
+ case "Message Digest":
+ return "1.2.840.113549.1.9.4";
+ case "Signing Time":
+ return "1.2.840.113549.1.9.5";
+ case "3des":
+ return "1.2.840.113549.3.7";
+ case "Subject Alternative Name":
+ return "2.5.29.17";
+ case "aes128":
+ return "2.16.840.1.101.3.4.1.2";
+ case "aes256":
+ return "2.16.840.1.101.3.4.1.42";
+ case "Netscape Cert Type":
+ return "2.16.840.1.113730.1.1";
+ }
+ return null;
+ }
+ }
+}
\ No newline at end of file
_oid = new Oid (oid, friendlyName);
base.Critical = critical;
- _enhKeyUsage = enhancedKeyUsages.ReadOnlyCopy ();
+ _enhKeyUsage = new OidCollection();
+ foreach (Oid oid in enhancedKeyUsages) {
+ _enhKeyUsage.Add(oid);
+ }
RawData = Encode ();
}
switch (_status) {
case AsnDecodeStatus.Ok:
case AsnDecodeStatus.InformationNotAvailable:
- if (_enhKeyUsage == null)
- _enhKeyUsage = new OidCollection ();
- _enhKeyUsage.ReadOnly = true;
- return _enhKeyUsage;
+
+ OidCollection oids = new OidCollection();
+ if (_enhKeyUsage != null) {
+ foreach(Oid oid in _enhKeyUsage) {
+ oids.Add(oid);
+ }
+ }
+ return oids;
default:
throw new CryptographicException ("Badly encoded extension.");
}
return SubjectKeyIdentifierExtension (multiLine);
// other known objects (i.e. supported structure) -
// but without any corresponding framework class
- case Oid.oidSubjectAltName:
+ case "2.5.29.17": // oidSubjectAltName:
return SubjectAltName (multiLine);
- case Oid.oidNetscapeCertType:
+ case "2.16.840.1.113730.1.1": // oidNetscapeCertType
return NetscapeCertType (multiLine);
default:
return Default (multiLine);
+++ /dev/null
-//
-// Oid.cs - System.Security.Cryptography.Oid
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if SECURITY_DEP
-
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Security.Cryptography {
-
- public sealed class Oid {
-
- private string _value;
- private string _name;
-
- // constructors
-
- public Oid ()
- {
- }
-
- public Oid (string oid)
- {
- if (oid == null)
- throw new ArgumentNullException ("oid");
-
- _value = oid;
- _name = GetName (oid);
- }
-
- public Oid (string value, string friendlyName)
- {
- _value = value;
- _name = friendlyName;
- }
-
- public Oid (Oid oid)
- {
- if (oid == null)
- throw new ArgumentNullException ("oid");
-
- _value = oid.Value;
- _name = oid.FriendlyName;
- }
-
- // properties
-
- public string FriendlyName {
- get { return _name; }
- set {
- _name = value;
- _value = GetValue (_name);
- }
- }
-
- public string Value {
- get { return _value; }
- set {
- _value = value;
- _name = GetName (_value);
- }
- }
-
- // internal stuff
-
- // Known OID/Names not defined anywhere else (by OID order)
- internal const string oidRSA = "1.2.840.113549.1.1.1";
- internal const string nameRSA = "RSA";
- internal const string oidPkcs7Data = "1.2.840.113549.1.7.1";
- internal const string namePkcs7Data = "PKCS 7 Data";
- internal const string oidPkcs9ContentType = "1.2.840.113549.1.9.3";
- internal const string namePkcs9ContentType = "Content Type";
- internal const string oidPkcs9MessageDigest = "1.2.840.113549.1.9.4";
- internal const string namePkcs9MessageDigest = "Message Digest";
- internal const string oidPkcs9SigningTime = "1.2.840.113549.1.9.5";
- internal const string namePkcs9SigningTime = "Signing Time";
- internal const string oidMd5 = "1.2.840.113549.2.5";
- internal const string nameMd5 = "md5";
- internal const string oid3Des = "1.2.840.113549.3.7";
- internal const string name3Des = "3des";
- internal const string oidSha1 = "1.3.14.3.2.26";
- internal const string nameSha1 = "sha1";
- internal const string oidSubjectAltName = "2.5.29.17";
- internal const string nameSubjectAltName = "Subject Alternative Name";
- internal const string oidAes128 = "2.16.840.1.101.3.4.1.2";
- internal const string nameAes128 = "aes128";
- internal const string oidAes256 = "2.16.840.1.101.3.4.1.42";
- internal const string nameAes256 = "aes256";
- internal const string oidSha256 = "2.16.840.1.101.3.4.2.1";
- internal const string nameSha256 = "sha256";
- internal const string oidSha512 = "2.16.840.1.101.3.4.2.3";
- internal const string nameSha512 = "sha512";
- internal const string oidNetscapeCertType = "2.16.840.1.113730.1.1";
- internal const string nameNetscapeCertType = "Netscape Cert Type";
-
- // TODO - find the complete list
- private string GetName (string oid)
- {
- switch (oid) {
- case oidRSA:
- return nameRSA;
- case oidPkcs7Data:
- return namePkcs7Data;
- case oidPkcs9ContentType:
- return namePkcs9ContentType;
- case oidPkcs9MessageDigest:
- return namePkcs9MessageDigest;
- case oidPkcs9SigningTime:
- return namePkcs9SigningTime;
- case oid3Des:
- return name3Des;
- case X509BasicConstraintsExtension.oid:
- return X509BasicConstraintsExtension.friendlyName;
- case X509KeyUsageExtension.oid:
- return X509KeyUsageExtension.friendlyName;
- case X509EnhancedKeyUsageExtension.oid:
- return X509EnhancedKeyUsageExtension.friendlyName;
- case X509SubjectKeyIdentifierExtension.oid:
- return X509SubjectKeyIdentifierExtension.friendlyName;
- case oidSubjectAltName:
- return nameSubjectAltName;
- case oidNetscapeCertType:
- return nameNetscapeCertType;
- case oidMd5:
- return nameMd5;
- case oidAes128:
- return nameAes128;
- case oidAes256:
- return nameAes256;
- case oidSha1:
- return nameSha1;
- case oidSha256:
- return nameSha256;
- case oidSha512:
- return nameSha512;
- default:
- return _name;
- }
- }
-
- // TODO - find the complete list
- private string GetValue (string name)
- {
- switch (name) {
- case nameRSA:
- return oidRSA;
- case namePkcs7Data:
- return oidPkcs7Data;
- case namePkcs9ContentType:
- return oidPkcs9ContentType;
- case namePkcs9MessageDigest:
- return oidPkcs9MessageDigest;
- case namePkcs9SigningTime:
- return oidPkcs9SigningTime;
- case name3Des:
- return oid3Des;
- case X509BasicConstraintsExtension.friendlyName:
- return X509BasicConstraintsExtension.oid;
- case X509KeyUsageExtension.friendlyName:
- return X509KeyUsageExtension.oid;
- case X509EnhancedKeyUsageExtension.friendlyName:
- return X509EnhancedKeyUsageExtension.oid;
- case X509SubjectKeyIdentifierExtension.friendlyName:
- return X509SubjectKeyIdentifierExtension.oid;
- case nameSubjectAltName:
- return oidSubjectAltName;
- case nameNetscapeCertType:
- return oidNetscapeCertType;
- case nameMd5:
- return oidMd5;
- case nameAes128:
- return oidAes128;
- case nameAes256:
- return oidAes256;
- case nameSha1:
- return oidSha1;
- case nameSha256:
- return oidSha256;
- case nameSha512:
- return oidSha512;
- default:
- return _value;
- }
- }
- }
-}
-
-#endif
+++ /dev/null
-//
-// OidCollection.cs - System.Security.Cryptography.OidCollection
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if SECURITY_DEP
-
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
- public sealed class OidCollection : ICollection, IEnumerable {
-
- private ArrayList _list;
- private bool _readOnly;
-
- // constructors
-
- public OidCollection ()
- {
- _list = new ArrayList ();
- }
-
- // properties
-
- public int Count {
- get { return _list.Count; }
- }
-
- public bool IsSynchronized {
- get { return _list.IsSynchronized; }
- }
-
- public Oid this [int index] {
- get { return (Oid) _list [index]; }
- }
-
- public Oid this [string oid] {
- get {
- foreach (Oid o in _list) {
- if (o.Value == oid)
- return o;
- }
- return null;
- }
- }
-
- public object SyncRoot {
- get { return _list.SyncRoot; }
- }
-
- // methods
-
- public int Add (Oid oid)
- {
- return (_readOnly ? 0 : _list.Add (oid));
- }
-
- public void CopyTo (Oid[] array, int index)
- {
- _list.CopyTo ((Array)array, index);
- }
-
- // to satisfy ICollection - private
- void ICollection.CopyTo (Array array, int index)
- {
- _list.CopyTo (array, index);
- }
-
- public OidEnumerator GetEnumerator ()
- {
- return new OidEnumerator (this);
- }
-
- // to satisfy IEnumerator - private
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return new OidEnumerator (this);
- }
-
- // internal stuff
-
- internal bool ReadOnly {
- get { return _readOnly; }
- set { _readOnly = value; }
- }
-
- internal OidCollection ReadOnlyCopy ()
- {
- OidCollection copy = new OidCollection ();
- foreach (Oid oid in _list) {
- copy.Add (oid);
- }
- copy._readOnly = true;
- return copy;
- }
- }
-}
-
-#endif
+++ /dev/null
-//
-// OidEnumerator.cs - System.Security.Cryptography.OidEnumerator
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if SECURITY_DEP
-
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
- // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
-
- public sealed class OidEnumerator : IEnumerator {
-
- private OidCollection _collection;
- private int _position;
-
- // note: couldn't reuse the IEnumerator from ArrayList because
- // it doesn't throw the same exceptions
- internal OidEnumerator (OidCollection collection)
- {
- _collection = collection;
- _position = -1;
- }
-
- // properties
-
- public Oid Current {
- get {
- if (_position < 0)
- throw new ArgumentOutOfRangeException ();
- return (Oid) _collection [_position];
- }
- }
-
- object IEnumerator.Current {
- get {
- if (_position < 0)
- throw new ArgumentOutOfRangeException ();
- return _collection [_position];
- }
- }
-
- // methods
-
- public bool MoveNext ()
- {
- if (++_position < _collection.Count)
- return true;
- else {
- // strangely we must always be able to return the last entry
- _position = _collection.Count - 1;
- return false;
- }
- }
-
- public void Reset ()
- {
- _position = -1;
- }
- }
-}
-
-#endif
+++ /dev/null
-//
-// OidGroup.cs:
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2015 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Security.Cryptography
-{
- public enum OidGroup {
- All = 0,
- HashAlgorithm = 1,
- EncryptionAlgorithm = 2,
- PublicKeyAlgorithm = 3,
- SignatureAlgorithm = 4,
- Attribute = 5,
- ExtensionOrAttribute = 6,
- EnhancedKeyUsage = 7,
- Policy = 8,
- Template = 9,
- KeyDerivationFunction = 10
- }
-}
System.Security.Cryptography/AsnEncodedDataCollection.cs
System.Security.Cryptography/AsnEncodedData.cs
System.Security.Cryptography/AsnEncodedDataEnumerator.cs
-System.Security.Cryptography/OidCollection.cs
-System.Security.Cryptography/Oid.cs
-System.Security.Cryptography/OidEnumerator.cs
-System.Security.Cryptography/OidGroup.cs
System.Security.Cryptography.X509Certificates/OpenFlags.cs
System.Security.Cryptography.X509Certificates/OSX509Certificates.cs
System.Security.Cryptography.X509Certificates/PublicKey.cs
ReferenceSources/AssertWrapper.cs
ReferenceSources/BinaryCompatibility.cs
ReferenceSources/ConfigurationManagerInternalFactory.cs
+ReferenceSources/CAPI.cs
ReferenceSources/EnvironmentHelpers.cs
ReferenceSources/Internal.cs
ReferenceSources/HttpSysSettings.cs
../referencesource/System/sys/system/threading/Barrier.cs
../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs
+../referencesource/System/security/system/security/cryptography/oid.cs
+
+../referencesource/System/security/system/security/cryptography/x509/x509utils.cs
+
../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs
../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs
namespace MonoTests.System.Security.Cryptography {
[TestFixture]
-
public class OidTest {
static string invalidOid = "1.0";
public void ConstructorStringStringNull ()
{
Oid o = new Oid (validOid, null);
- Assert.IsNull (o.FriendlyName, "FriendlyName");
+ Assert.AreEqual ("RSA", o.FriendlyName, "FriendlyName");
Assert.AreEqual (validOid, o.Value, "Value");
}
Oid o = new Oid (validOid, invalidName);
Assert.AreEqual (invalidName, o.FriendlyName, "FriendlyName");
o.FriendlyName = null;
- Assert.IsNull (o.FriendlyName, "FriendlyName-Null");
+ Assert.AreEqual ("RSA", o.FriendlyName, "FriendlyName-Null");
}
[Test]
o.FriendlyName = "sha512";
Assert.AreEqual (o.Value, "2.16.840.1.101.3.4.2.3", "sha512 Value from FriendlyName");
+ o = new Oid ("2.16.840.1.101.3.4.2.2");
+ Assert.AreEqual ("2.16.840.1.101.3.4.2.2", o.Value, "sha384 Value");
+ Assert.AreEqual ("sha384", o.FriendlyName, "sha384 FriendlyName");
+
+ o = new Oid ("1.2.840.113549.1.1.12");
+ Assert.AreEqual ("1.2.840.113549.1.1.12", o.Value, "sha384RSA Value");
+ Assert.AreEqual ("sha384RSA", o.FriendlyName, "sha384RSA FriendlyName");
+
// TODO: add other well known oid as we find them
}
}
}
-
System.Security.Cryptography/AsnEncodedData.cs
System.Security.Cryptography/AsnEncodedDataCollection.cs
System.Security.Cryptography/AsnEncodedDataEnumerator.cs
-System.Security.Cryptography/Oid.cs
-System.Security.Cryptography/OidCollection.cs
-System.Security.Cryptography/OidEnumerator.cs
-System.Security.Cryptography/OidGroup.cs
System.Threading/Semaphore.cs
System.Threading/ThreadExceptionEventArgs.cs
System.Threading/ThreadExceptionEventHandler.cs
Mono.Net.Security/SystemCertificateValidator.cs
ReferenceSources/AssertWrapper.cs
+ReferenceSources/CAPI.cs
ReferenceSources/EnvironmentHelpers.cs
ReferenceSources/Internal.cs
ReferenceSources/HttpSysSettings.cs
../referencesource/System/sys/system/threading/Barrier.cs
+../referencesource/System/security/system/security/cryptography/oid.cs
+
+../referencesource/System/security/system/security/cryptography/x509/x509utils.cs
+
../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs
../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs
}
}
+ static byte[] PEM (string type, byte[] data)
+ {
+ string pem = Encoding.ASCII.GetString (data);
+ string header = String.Format ("-----BEGIN {0}-----", type);
+ string footer = String.Format ("-----END {0}-----", type);
+ int start = pem.IndexOf (header) + header.Length;
+ int end = pem.IndexOf (footer, start);
+ string base64 = pem.Substring (start, (end - start));
+ return Convert.FromBase64String (base64);
+ }
+
+ static byte[] ConvertData (byte[] data)
+ {
+ if (data == null || data.Length == 0)
+ return data;
+
+ // does it looks like PEM ?
+ if (data [0] != 0x30) {
+ try {
+ return PEM ("CERTIFICATE", data);
+ } catch {
+ // let the implementation take care of it.
+ }
+ }
+ return data;
+ }
+
#if !MONOTOUCH && !XAMMAC
public static X509CertificateImpl Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
{
+ rawData = ConvertData (rawData);
if (nativeHelper != null)
return nativeHelper.Import (rawData, password, keyStorageFlags);
internal class X509Utils {
private X509Utils () {}
-
+#if !MONO
internal static bool IsCertRdnCharString (uint dwValueType) {
return ((dwValueType & CAPI.CERT_RDN_TYPE_MASK) >= CAPI.CERT_RDN_NUMERIC_STRING);
}
CAPI.CRYPT_OID_INFO pOIDInfo = CAPI.CryptFindOIDInfo(CAPI.CRYPT_OID_INFO_OID_KEY, pszOid, 0);
return pOIDInfo.Algid;
}
-
+#endif
#if FEATURE_CORESYSTEM
[SecuritySafeCritical]
#endif
- internal static string FindOidInfo(uint keyType, string keyValue, OidGroup oidGroup) {
+ internal static string FindOidInfo(uint keyType, string keyValue, System.Security.Cryptography.OidGroup oidGroup) {
if (keyValue == null)
throw new ArgumentNullException("keyValue");
if (keyValue.Length == 0)
return null;
+#if MONO
+ switch(keyType) {
+ case CAPI.CRYPT_OID_INFO_OID_KEY:
+ return CAPI.CryptFindOIDInfoNameFromKey(keyValue, oidGroup);
+ case CAPI.CRYPT_OID_INFO_NAME_KEY:
+ return CAPI.CryptFindOIDInfoKeyFromName(keyValue, oidGroup);
+ default:
+ throw new NotImplementedException(keyType.ToString());
+ }
+#else
SafeLocalAllocHandle pvKey = SafeLocalAllocHandle.InvalidHandle;
try {
finally {
pvKey.Dispose();
}
+#endif
}
// Try to find OID info within a specific group, and if that doesn't work fall back to all
// groups for compatibility with previous frameworks
- internal static string FindOidInfoWithFallback(uint key, string value, OidGroup group) {
+ internal static string FindOidInfoWithFallback(uint key, string value, System.Security.Cryptography.OidGroup group) {
string info = FindOidInfo(key, value, group);
// If we couldn't find it in the requested group, then try again in all groups
- if (info == null && group != OidGroup.All) {
- info = FindOidInfo(key, value, OidGroup.All);
+ if (info == null && group != System.Security.Cryptography.OidGroup.All) {
+ info = FindOidInfo(key, value, System.Security.Cryptography.OidGroup.All);
}
return info;
}
-
+#if !MONO
//
// verify the passed keyValue is valid as per X.208
//
else
return SR.GetString(SR.Unknown_Error);
}
+#endif
}
}
WapiHandle_process *process_handle;
pid_t pid G_GNUC_UNUSED, ret;
int status;
- guint32 start;
- guint32 now;
+ gint64 start, now;
struct MonoProcess *mp;
/* FIXME: We can now easily wait on processes that aren't our own children,
finished = TRUE;
if (mono_thread_internal_current () != gc_thread) {
gboolean timed_out = FALSE;
- guint32 start_ticks = mono_msec_ticks ();
- guint32 end_ticks = start_ticks + 2000;
+ gint64 start_ticks = mono_msec_ticks ();
+ gint64 end_ticks = start_ticks + 2000;
mono_gc_finalize_notify ();
/* Finishing the finalizer thread, so wait a little bit... */
/* MS seems to wait for about 2 seconds */
while (!finalizer_thread_exited) {
- guint32 current_ticks = mono_msec_ticks ();
+ gint64 current_ticks = mono_msec_ticks ();
guint32 timeout;
if (current_ticks >= end_ticks)
ICALL(ENV_11, "get_MachineName", ves_icall_System_Environment_get_MachineName)
ICALL(ENV_13, "get_Platform", ves_icall_System_Environment_get_Platform)
ICALL(ENV_14, "get_ProcessorCount", mono_cpu_count)
-ICALL(ENV_15, "get_TickCount", mono_msec_ticks)
+ICALL(ENV_15, "get_TickCount", ves_icall_System_Environment_get_TickCount)
ICALL(ENV_16, "get_UserName", ves_icall_System_Environment_get_UserName)
ICALL(ENV_16m, "internalBroadcastSettingChange", ves_icall_System_Environment_BroadcastSettingChange)
ICALL(ENV_17, "internalGetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable)
#endif
}
+ICALL_EXPORT
+gint32
+ves_icall_System_Environment_get_TickCount (void)
+{
+ /* this will overflow after ~24 days */
+ return (gint32) (mono_msec_boottime () & 0xffffffff);
+}
+
ICALL_EXPORT gint32
ves_icall_System_Runtime_Versioning_VersioningHelper_GetRuntimeId (void)
{
LockWord lw;
MonoThreadsSync *mon;
HANDLE sem;
- guint32 then = 0, now, delta;
+ gint64 then = 0, now, delta;
guint32 waitms;
guint32 ret;
guint32 new_status, old_status, tmp_status;
if (!mono_thread_test_state (mono_thread_internal_current (), (MonoThreadState)(ThreadState_StopRequested | ThreadState_SuspendRequested | ThreadState_AbortRequested))) {
if (ms != INFINITE) {
now = mono_msec_ticks ();
- if (now < then) {
- LOCK_DEBUG (g_message ("%s: wrapped around! now=0x%x then=0x%x", __func__, now, then));
- now += (0xffffffff - then);
- then = 0;
-
- LOCK_DEBUG (g_message ("%s: wrap rejig: now=0x%x then=0x%x delta=0x%x", __func__, now, then, now-then));
- }
+ /* it should not overflow before ~30k years */
+ g_assert (now >= then);
delta = now - then;
if (delta >= ms) {
void *stack_start;
void *stack_start_limit;
- /*FIXME pretty please finish killing ARCH_NUM_REGS */
-#ifdef USE_MONO_CTX
MonoContext ctx; /* ditto */
-#else
- gpointer regs[ARCH_NUM_REGS]; /* ditto */
-#endif
};
#else
info->client_info.stack_end = (char*)stack_bottom;
}
-#ifdef USE_MONO_CTX
memset (&info->client_info.ctx, 0, sizeof (MonoContext));
-#else
- memset (&info->client_info.regs, 0, sizeof (info->client_info.regs));
-#endif
if (mono_gc_get_gc_callbacks ()->thread_attach_func)
info->client_info.runtime_data = mono_gc_get_gc_callbacks ()->thread_attach_func ();
}
if (!precise) {
-#ifdef USE_MONO_CTX
sgen_conservatively_pin_objects_from ((void**)&info->client_info.ctx, (void**)(&info->client_info.ctx + 1),
start_nursery, end_nursery, PIN_TYPE_STACK);
-#else
- sgen_conservatively_pin_objects_from ((void**)&info->client_info.regs, (void**)&info->client_info.regs + ARCH_NUM_REGS,
- start_nursery, end_nursery, PIN_TYPE_STACK);
-#endif
+
{
// This is used on Coop GC for platforms where we cannot get the data for individual registers.
// We force a spill of all registers into the stack and pass a chunk of data into sgen.
if (stack_start >= info->client_info.stack_start_limit && stack_start <= info->client_info.stack_end) {
info->client_info.stack_start = stack_start;
-#ifdef USE_MONO_CTX
mono_sigctx_to_monoctx (&ctx, &info->client_info.ctx);
-#else
- ARCH_COPY_SIGCTX_REGS (&info->client_info.regs, &ctx);
-#endif
} else {
g_assert (!info->client_info.stack_start);
}
suspend_thread (SgenThreadInfo *info, void *context)
{
int stop_count;
-#ifndef USE_MONO_CTX
- gpointer regs [ARCH_NUM_REGS];
-#endif
MonoContext ctx;
gpointer stack_start;
if (0 && info->client_info.stop_count == stop_count)
return;
-#ifdef USE_MONO_CTX
if (context) {
mono_sigctx_to_monoctx (context, &ctx);
info->client_info.stopped_ip = MONO_CONTEXT_GET_IP (&ctx);
info->client_info.stopped_ip = NULL;
stack_start = NULL;
}
-#else
- info->client_info.stopped_ip = context ? (gpointer) ARCH_SIGCTX_IP (context) : NULL;
- stack_start = context ? (char*) ARCH_SIGCTX_SP (context) - REDZONE_SIZE : NULL;
-#endif
/* If stack_start is not within the limits, then don't set it
in info and we will be restarted. */
if (stack_start >= info->client_info.stack_start_limit && stack_start <= info->client_info.stack_end) {
info->client_info.stack_start = stack_start;
-#ifdef USE_MONO_CTX
if (context) {
memcpy (&info->client_info.ctx, &ctx, sizeof (MonoContext));
} else {
memset (&info->client_info.ctx, 0, sizeof (MonoContext));
}
-#else
- if (context) {
- ARCH_COPY_SIGCTX_REGS (regs, context);
- memcpy (&info->client_info.regs, regs, sizeof (info->client_info.regs));
- } else {
- memset (&info->client_info.regs, 0, sizeof (info->client_info.regs));
- }
-#endif
} else {
g_assert (!info->client_info.stack_start);
}
CloseHandle (handle);
#if !defined(MONO_CROSS_COMPILE)
-#ifdef USE_MONO_CTX
memset (&info->client_info.ctx, 0, sizeof (MonoContext));
#ifdef TARGET_AMD64
info->client_info.ctx.gregs[AMD64_RIP] = context.Rip;
info->client_info.stopped_ip = (gpointer)context.Eip;
info->client_info.stack_start = (char*)context.Esp - REDZONE_SIZE;
#endif
-
-#else
- info->client_info.regs [0] = context.Edi;
- info->client_info.regs [1] = context.Esi;
- info->client_info.regs [2] = context.Ebx;
- info->client_info.regs [3] = context.Edx;
- info->client_info.regs [4] = context.Ecx;
- info->client_info.regs [5] = context.Eax;
- info->client_info.regs [6] = context.Ebp;
- info->client_info.regs [7] = context.Esp;
- info->client_info.stopped_ip = (gpointer)context.Eip;
- info->client_info.stack_start = (char*)context.Esp - REDZONE_SIZE;
-#endif
#endif
/* Notify the JIT */
return (void*)p;
}
-#ifdef USE_MONO_CTX
static MonoContext cur_thread_ctx;
-#else
-static mword cur_thread_regs [ARCH_NUM_REGS];
-#endif
static void
update_current_thread_stack (void *start)
{
int stack_guard = 0;
-#if !defined(USE_MONO_CTX)
- void *reg_ptr = cur_thread_regs;
-#endif
SgenThreadInfo *info = mono_thread_info_current ();
info->client_info.stack_start = align_pointer (&stack_guard);
g_assert (info->client_info.stack_start >= info->client_info.stack_start_limit && info->client_info.stack_start < info->client_info.stack_end);
-#ifdef USE_MONO_CTX
MONO_CONTEXT_GET_CURRENT (cur_thread_ctx);
memcpy (&info->client_info.ctx, &cur_thread_ctx, sizeof (MonoContext));
if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, NULL, &info->client_info.ctx);
-#else
- ARCH_STORE_REGS (reg_ptr);
- memcpy (&info->client_info.regs, reg_ptr, sizeof (info->client_info.regs));
- if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
- mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, NULL, NULL);
-#endif
}
static gboolean
FOREACH_THREAD (info) {
info->client_info.stack_start = NULL;
-#ifdef USE_MONO_CTX
memset (&info->client_info.ctx, 0, sizeof (MonoContext));
-#else
- memset (&info->client_info.regs, 0, sizeof (info->client_info.regs));
-#endif
} FOREACH_THREAD_END
TV_GETTIME (start_handshake);
g_error ("BAD STACK");
info->client_info.stack_start = stack_start;
-#ifdef USE_MONO_CTX
info->client_info.ctx = mono_thread_info_get_suspend_state (info)->ctx;
-#else
- g_assert_not_reached ();
-#endif
}
static void
MonoCoopMutex worker_creation_lock;
gint32 heuristic_completions;
- guint32 heuristic_sample_start;
- guint32 heuristic_last_dequeue; // ms
- guint32 heuristic_last_adjustment; // ms
- guint32 heuristic_adjustment_interval; // ms
+ gint64 heuristic_sample_start;
+ gint64 heuristic_last_dequeue; // ms
+ gint64 heuristic_last_adjustment; // ms
+ gint64 heuristic_adjustment_interval; // ms
ThreadPoolHillClimbing heuristic_hill_climbing;
MonoCoopMutex heuristic_lock;
static gboolean
monitor_sufficient_delay_since_last_dequeue (void)
{
- guint32 threshold;
+ gint64 threshold;
g_assert (threadpool);
mono_gc_set_skip_thread (TRUE);
do {
- guint32 ts;
+ gint64 ts;
gboolean alerted = FALSE;
if (mono_runtime_is_shutting_down ())
}
static gint16
-hill_climbing_update (gint16 current_thread_count, guint32 sample_duration, gint32 completions, guint32 *adjustment_interval)
+hill_climbing_update (gint16 current_thread_count, guint32 sample_duration, gint32 completions, gint64 *adjustment_interval)
{
ThreadPoolHillClimbing *hc;
ThreadPoolHeuristicStateTransition transition;
if (mono_coop_mutex_trylock (&threadpool->heuristic_lock) == 0) {
gint32 completions = InterlockedExchange (&threadpool->heuristic_completions, 0);
- guint32 sample_end = mono_msec_ticks ();
- guint32 sample_duration = sample_end - threadpool->heuristic_sample_start;
+ gint64 sample_end = mono_msec_ticks ();
+ gint64 sample_duration = sample_end - threadpool->heuristic_sample_start;
if (sample_duration >= threadpool->heuristic_adjustment_interval / 2) {
ThreadPoolCounter counter;
mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout)
{
gboolean res = TRUE;
- guint32 start;
+ gint64 end;
gpointer sem;
g_assert (domain);
g_assert (mono_domain_is_unloading (domain));
if (timeout != -1)
- start = mono_msec_ticks ();
+ end = mono_msec_ticks () + timeout;
#ifndef DISABLE_SOCKETS
mono_threadpool_ms_io_remove_domain_jobs (domain);
if (timeout != -1) {
- timeout -= mono_msec_ticks () - start;
- if (timeout < 0)
+ if (mono_msec_ticks () > end)
return FALSE;
}
#endif
mono_memory_write_barrier ();
while (domain->threadpool_jobs) {
- MONO_PREPARE_BLOCKING;
- WaitForSingleObject (sem, timeout);
- MONO_FINISH_BLOCKING;
+ gint64 now;
+
if (timeout != -1) {
- timeout -= mono_msec_ticks () - start;
- if (timeout <= 0) {
+ now = mono_msec_ticks ();
+ if (now > end) {
res = FALSE;
break;
}
}
+
+ MONO_PREPARE_BLOCKING;
+ WaitForSingleObject (sem, timeout != -1 ? end - now : timeout);
+ MONO_FINISH_BLOCKING;
}
domain->cleanup_semaphore = NULL;
#endif
abort_appdomain_data user_data;
- guint32 start_time;
+ gint64 start_time;
int orig_timeout = timeout;
int i;
int total = 0;
int fd = conn_fd;
int flags = 0;
- static gint32 last_keepalive;
- gint32 msecs;
+ static gint64 last_keepalive;
+ gint64 msecs;
MONO_PREPARE_BLOCKING;
if (is_user_frame)
setup_stack_trace (mono_ex, dynamic_methods, initial_trace_ips, &trace_ips);
+#ifndef MONO_CROSS_COMPILE
#ifdef MONO_CONTEXT_SET_LLVM_EXC_REG
if (ji->from_llvm)
MONO_CONTEXT_SET_LLVM_EXC_REG (ctx, ex_obj);
/* store the exception object in bp + ei->exvar_offset */
*((gpointer *)(gpointer)((char *)MONO_CONTEXT_GET_BP (ctx) + ei->exvar_offset)) = ex_obj;
#endif
+#endif
#ifdef MONO_CONTEXT_SET_LLVM_EH_SELECTOR_REG
/*
ex_obj = obj;
if (((ei->flags == MONO_EXCEPTION_CLAUSE_NONE) || (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER))) {
+#ifndef MONO_CROSS_COMPILE
#ifdef MONO_CONTEXT_SET_LLVM_EXC_REG
MONO_CONTEXT_SET_LLVM_EXC_REG (ctx, ex_obj);
#else
g_assert (!ji->from_llvm);
/* store the exception object in bp + ei->exvar_offset */
*((gpointer *)(gpointer)((char *)MONO_CONTEXT_GET_BP (ctx) + ei->exvar_offset)) = ex_obj;
+#endif
#endif
}
endif
AM_CPPFLAGS = \
- -fexceptions -DMONO_USE_EXC_TABLES \
-DSUPPRESSION_DIR=\""$(datadir)/mono-$(API_VER)/mono/profiler"\" \
-I$(top_srcdir) \
$(GLIB_CFLAGS)
if !DISABLE_PROFILER
bin_PROGRAMS = mprof-report
+if !BITCODE
+prof_shlibs = \
+ libmono-profiler-aot.la \
+ libmono-profiler-iomap.la \
+ libmono-profiler-log.la
+endif
+
if HAVE_VTUNE
-vtune_lib = libmono-profiler-vtune.la
+vtune_stlibs = libmono-profiler-vtune-static.la
+if !BITCODE
+vtune_shlibs = libmono-profiler-vtune.la
+endif
endif
-lib_LTLIBRARIES = libmono-profiler-aot.la libmono-profiler-iomap.la libmono-profiler-log.la libmono-profiler-log-static.la $(vtune_lib)
+lib_LTLIBRARIES = \
+ $(prof_shlibs) \
+ libmono-profiler-aot-static.la \
+ libmono-profiler-iomap-static.la \
+ libmono-profiler-log-static.la \
+ $(vtune_shlibs) \
+ $(vtune_stlibs)
if PLATFORM_DARWIN
-if BITCODE
-libmono_profiler_log_la_LDFLAGS = -no-undefined
-else
-libmono_profiler_log_la_LDFLAGS = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
-endif
-endif
-if PLATFORM_ANDROID
-libmono_profiler_log_la_LDFLAGS = -avoid-version
-endif
-endif
-endif
+prof_ldflags = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
endif
-if HAVE_OPROFILE
-# Do something that uses OPROFILE_CFLAGS and OPROFILE_LIBS
+if PLATFORM_ANDROID
+prof_ldflags = -avoid-version
endif
-if SUPPORT_BOEHM
-if DISABLE_EXECUTABLES
-LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA)
-else
-if !SHARED_MONO
-static_libs= \
- $(top_builddir)/mono/metadata/libmonoruntime-static.la \
- $(top_builddir)/mono/io-layer/libwapi.la \
- $(top_builddir)/mono/utils/libmonoutils.la \
- $(GLIB_LIBS) $(LIBICONV) \
- $(LIBGC_STATIC_LIBS)
-
-LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA) $(static_libs)
-else
-LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA)
endif
endif
-else
-LIBMONO=$(top_builddir)/mono/mini/libmonosgen-$(API_VER).la
endif
+# The log profiler uses eglib functions, so it needs to be linked against
+# libeglib in shared mode, but not in static mode, since that would
+# leads to duplicate symbols when it is linked into an app which
+# also uses eglib (e.g. the runtime). Automake doesn't support this
+# functionality, so create a separate static version of the library.
+
libmono_profiler_aot_la_SOURCES = mono-profiler-aot.c
libmono_profiler_aot_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
-if BITCODE
-libmono_profiler_aot_la_LDFLAGS = -no-undefined
-endif
+libmono_profiler_aot_la_LDFLAGS = $(prof_ldflags)
+libmono_profiler_aot_static_la_SOURCES = mono-profiler-aot.c
+libmono_profiler_aot_static_la_LDFLAGS = -static
+
libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
libmono_profiler_iomap_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
-if BITCODE
-libmono_profiler_iomap_la_LDFLAGS = -no-undefined
-endif
+libmono_profiler_iomap_la_LDFLAGS = $(prof_ldflags)
+libmono_profiler_iomap_static_la_SOURCES = mono-profiler-iomap.c
+libmono_profiler_iomap_static_la_LDFLAGS = -static
+
libmono_profiler_log_la_SOURCES = proflog.c
libmono_profiler_log_la_LIBADD = $(GLIB_LIBS) $(Z_LIBS)
+libmono_profiler_log_la_LDFLAGS = $(prof_ldflags)
+libmono_profiler_log_static_la_SOURCES = proflog.c
+libmono_profiler_log_static_la_LDFLAGS = -static
+
if HAVE_VTUNE
libmono_profiler_vtune_la_SOURCES = mono-profiler-vtune.c
libmono_profiler_vtune_la_CFLAGS = $(VTUNE_CFLAGS)
libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(GLIB_LIBS) $(LIBICONV)
+libmono_profiler_vtune_la_LDFLAGS = $(prof_ldflags)
+libmono_profiler_vtune_static_la_SOURCES = mono-profiler-vtune.c
+libmono_profiler_vtune_static_la_LDFLAGS = -static
endif
-# The log profile uses eglib functions, so it needs to be linked against
-# libeglib in shared mode, but not in static mode, since that would
-# leads to duplicate symbols when it is linked into an app which
-# also uses eglib (e.g. the runtime). Automake doesn't support this
-# functionality, so create a separate static version of the library.
-libmono_profiler_log_static_la_SOURCES = proflog.c
-libmono_profiler_log_static_la_LDFLAGS = -static
-
mprof_report_SOURCES = decode.c
mprof_report_LDADD = $(Z_LIBS) $(GLIB_LIBS) $(LIBICONV)
#include <mono/utils/mono-context.h>
-/*
- * Define either USE_MONO_CTX, or
- * ARCH_SIGCTX_SP/ARCH_SIGCTX_IP/ARCH_STORE_REGS/ARCH_COPY_SIGCTX_REGS.
- * Define ARCH_NUM_REGS to be the number of general registers in MonoContext, or the
- * number of registers stored by ARCH_STORE_REGS.
- */
-
#if defined(MONO_CROSS_COMPILE)
#define REDZONE_SIZE 0
-#define ARCH_NUM_REGS 0
-#define ARCH_STORE_REGS(ptr)
-#define ARCH_SIGCTX_SP(ctx) NULL
-#define ARCH_SIGCTX_IP(ctx) NULL
-#define ARCH_COPY_SIGCTX_REGS(a,ctx)
-
#elif defined(TARGET_X86)
#define REDZONE_SIZE 0
-#define ARCH_NUM_REGS 8
-
#ifndef MONO_ARCH_HAS_MONO_CONTEXT
#error 0
#endif
-#define USE_MONO_CTX
-
#elif defined(TARGET_AMD64)
#define REDZONE_SIZE 128
-#define ARCH_NUM_REGS 16
-#define USE_MONO_CTX
-
#elif defined(TARGET_POWERPC)
#define REDZONE_SIZE 224
-#define ARCH_NUM_REGS 32
-#ifdef __APPLE__
-#define ARCH_STORE_REGS(ptr) \
- __asm__ __volatile__( \
- "stmw r0, 0(%0)\n" \
- : \
- : "b" (ptr) \
- )
-#else
-#define ARCH_STORE_REGS(ptr) \
- __asm__ __volatile__( \
- "stmw 0, 0(%0)\n" \
- : \
- : "b" (ptr) \
- )
-#endif
-#define ARCH_SIGCTX_SP(ctx) (UCONTEXT_REG_Rn((ctx), 1))
-#define ARCH_SIGCTX_IP(ctx) (UCONTEXT_REG_NIP((ctx)))
-#define ARCH_COPY_SIGCTX_REGS(a,ctx) do { \
- int __i; \
- for (__i = 0; __i < 32; ++__i) \
- ((a)[__i]) = (gpointer) UCONTEXT_REG_Rn((ctx), __i); \
- } while (0)
-
/* MS_BLOCK_SIZE must be a multiple of the system pagesize, which for some
architectures is 64k. */
#if defined(TARGET_POWERPC) || defined(TARGET_POWERPC64)
#elif defined(TARGET_ARM)
#define REDZONE_SIZE 0
-#define USE_MONO_CTX
-
-/* We dont store ip, sp */
-#define ARCH_NUM_REGS 14
#elif defined(TARGET_ARM64)
#else
#error "Not implemented."
#endif
-#define USE_MONO_CTX
-#define ARCH_NUM_REGS 31
#elif defined(__mips__)
#define REDZONE_SIZE 0
-#define USE_MONO_CTX
-#define ARCH_NUM_REGS 32
-
#elif defined(__s390x__)
#define REDZONE_SIZE 0
-#define USE_MONO_CTX
-#define ARCH_NUM_REGS 16
-
#elif defined(__sparc__)
#define REDZONE_SIZE 0
-/* Don't bother with %g0 (%r0), it's always hard-coded to zero */
-#define ARCH_NUM_REGS 15
-#ifdef __sparcv9
-#define ARCH_STORE_REGS(ptr) \
- __asm__ __volatile__( \
- "st %%g1,[%0]\n\t" \
- "st %%g2,[%0+0x08]\n\t" \
- "st %%g3,[%0+0x10]\n\t" \
- "st %%g4,[%0+0x18]\n\t" \
- "st %%g5,[%0+0x20]\n\t" \
- "st %%g6,[%0+0x28]\n\t" \
- "st %%g7,[%0+0x30]\n\t" \
- "st %%o0,[%0+0x38]\n\t" \
- "st %%o1,[%0+0x40]\n\t" \
- "st %%o2,[%0+0x48]\n\t" \
- "st %%o3,[%0+0x50]\n\t" \
- "st %%o4,[%0+0x58]\n\t" \
- "st %%o5,[%0+0x60]\n\t" \
- "st %%o6,[%0+0x68]\n\t" \
- "st %%o7,[%0+0x70]\n\t" \
- : \
- : "r" (ptr) \
- : "memory" \
- )
-#else
-#define ARCH_STORE_REGS(ptr) \
- __asm__ __volatile__( \
- "st %%g1,[%0]\n\t" \
- "st %%g2,[%0+0x04]\n\t" \
- "st %%g3,[%0+0x08]\n\t" \
- "st %%g4,[%0+0x0c]\n\t" \
- "st %%g5,[%0+0x10]\n\t" \
- "st %%g6,[%0+0x14]\n\t" \
- "st %%g7,[%0+0x18]\n\t" \
- "st %%o0,[%0+0x1c]\n\t" \
- "st %%o1,[%0+0x20]\n\t" \
- "st %%o2,[%0+0x24]\n\t" \
- "st %%o3,[%0+0x28]\n\t" \
- "st %%o4,[%0+0x2c]\n\t" \
- "st %%o5,[%0+0x30]\n\t" \
- "st %%o6,[%0+0x34]\n\t" \
- "st %%o7,[%0+0x38]\n\t" \
- : \
- : "r" (ptr) \
- : "memory" \
- )
-#endif
-
-#ifndef REG_SP
-#define REG_SP REG_O6
-#endif
-
-#define ARCH_SIGCTX_SP(ctx) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_SP])
-#define ARCH_SIGCTX_IP(ctx) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_PC])
-#define ARCH_COPY_SIGCTX_REGS(a,ctx) do { \
- (a)[0] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_G1]); \
- (a)[1] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_G2]); \
- (a)[2] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_G3]); \
- (a)[3] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_G4]); \
- (a)[4] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_G5]); \
- (a)[5] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_G6]); \
- (a)[6] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_G7]); \
- (a)[7] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_O0]); \
- (a)[8] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_O1]); \
- (a)[9] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_O2]); \
- (a)[10] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_O3]); \
- (a)[11] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_O4]); \
- (a)[12] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_O5]); \
- (a)[13] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_O6]); \
- (a)[14] = (gpointer) (((ucontext_t *)(ctx))->uc_mcontext.gregs [REG_O7]); \
- } while (0)
-
#endif
#endif /* __MONO_SGENARCHDEP_H__ */
find_pinning_ref_from_thread (char *obj, size_t size)
{
#ifndef SGEN_WITHOUT_MONO
- int j;
char *endobj = obj + size;
FOREACH_THREAD (info) {
+ mword *ctxstart, *ctxcurrent, *ctxend;
char **start = (char**)info->client_info.stack_start;
if (info->client_info.skip || info->client_info.gc_disabled)
continue;
start++;
}
- for (j = 0; j < ARCH_NUM_REGS; ++j) {
-#ifdef USE_MONO_CTX
- mword w = ((mword*)&info->client_info.ctx) [j];
-#else
- mword w = (mword)&info->client_info.regs [j];
-#endif
+ for (ctxstart = ctxcurrent = (mword*) &info->client_info.ctx, ctxend = (mword*) (&info->client_info.ctx + 1); ctxcurrent < ctxend; ctxcurrent ++) {
+ mword w = *ctxcurrent;
if (w >= (mword)obj && w < (mword)obj + size)
- SGEN_LOG (0, "Object %p referenced in saved reg %d of thread %p (id %p)", obj, j, info, (gpointer)mono_thread_info_get_tid (info));
+ SGEN_LOG (0, "Object %p referenced in saved reg %d of thread %p (id %p)", obj, (int) (ctxcurrent - ctxstart), info, (gpointer)mono_thread_info_get_tid (info));
}
} FOREACH_THREAD_END
#endif
#ifndef __MONO_MONO_CONTEXT_H__
#define __MONO_MONO_CONTEXT_H__
+#include <glib.h>
+
#include "mono-compiler.h"
#include "mono-sigcontext.h"
#include "mono-machine.h"
* MONO_CONTEXT_GET_CURRENT captures the current context as close as possible. One reg might be clobbered
* to hold the address of the target MonoContext. It will be a caller save one, so should not be a problem.
*/
-#if (defined(__i386__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_X86))
+#if defined(MONO_CROSS_COMPILE)
+
+typedef struct {} MonoContext;
+
+#define MONO_CONTEXT_SET_IP(ctx,ip) g_assert_not_reached ()
+#define MONO_CONTEXT_SET_BP(ctx,bp) g_assert_not_reached ()
+#define MONO_CONTEXT_SET_SP(ctx,sp) g_assert_not_reached ()
+
+#define MONO_CONTEXT_GET_IP(ctx) NULL
+#define MONO_CONTEXT_GET_BP(ctx) NULL
+#define MONO_CONTEXT_GET_SP(ctx) NULL
+
+#define MONO_CONTEXT_GET_CURRENT(ctx) do {} while (0)
+
+#elif defined(__i386__) || defined(TARGET_X86)
/*HACK, move this to an eventual mono-signal.c*/
#if defined( __linux__) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || \
#define MONO_ARCH_HAS_MONO_CONTEXT 1
-#elif (defined(__x86_64__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_AMD64)) /* defined(__i386__) */
+#elif defined(__x86_64__) || defined(TARGET_AMD64) /* defined(__i386__) */
#include <mono/arch/amd64/amd64-codegen.h>
#define MONO_ARCH_HAS_MONO_CONTEXT 1
-#elif (defined(__arm__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_ARM)) /* defined(__x86_64__) */
+#elif defined(__arm__) || defined(TARGET_ARM) /* defined(__x86_64__) */
#include <mono/arch/arm/arm-codegen.h>
#define MONO_ARCH_HAS_MONO_CONTEXT 1
-#elif (defined(__aarch64__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_ARM64))
+#elif defined(__aarch64__) || defined(TARGET_ARM64)
#include <mono/arch/arm64/arm64-codegen.h>
: "memory" \
)
-#define MONO_ARCH_HAS_MONO_CONTEXT 1
-
-#else
+#else /* !defined(__mono_ppc64__) */
typedef struct {
- gulong sc_ir; // pc
- gulong sc_sp; // r1
- mgreg_t regs [19]; /*FIXME, this must be changed to 32 for sgen*/
- double fregs [18];
+ mgreg_t sc_ir; // pc
+ mgreg_t sc_sp; // r1
+ mgreg_t regs [32];
+ double fregs [32];
} MonoContext;
/* we have the stack pointer, not the base pointer in sigcontext */
-#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (gulong)ip; } while (0);
+#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (mgreg_t)ip; } while (0);
/* FIXME: should be called SET_SP */
-#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (gulong)bp; } while (0);
-#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_sp = (gulong)sp; } while (0);
+#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (mgreg_t)bp; } while (0);
+#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_sp = (mgreg_t)sp; } while (0);
#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_ir))
#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ppc_r31-13]))
#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_sp))
+
+#define MONO_CONTEXT_GET_CURRENT(ctx) \
+ __asm__ __volatile__( \
+ "std 0, 0(%0)\n" \
+ "std 1, 4(%0)\n" \
+ "std 0, 4*0+8(%0)\n" \
+ "std 1, 4*1+8(%0)\n" \
+ "std 2, 4*2+8(%0)\n" \
+ "std 3, 4*3+8(%0)\n" \
+ "std 4, 4*4+8(%0)\n" \
+ "std 5, 4*5+8(%0)\n" \
+ "std 6, 4*6+8(%0)\n" \
+ "std 7, 4*7+8(%0)\n" \
+ "std 8, 4*8+8(%0)\n" \
+ "std 9, 4*9+8(%0)\n" \
+ "std 10, 4*10+8(%0)\n" \
+ "std 11, 4*11+8(%0)\n" \
+ "std 12, 4*12+8(%0)\n" \
+ "std 13, 4*13+8(%0)\n" \
+ "std 14, 4*14+8(%0)\n" \
+ "std 15, 4*15+8(%0)\n" \
+ "std 16, 4*16+8(%0)\n" \
+ "std 17, 4*17+8(%0)\n" \
+ "std 18, 4*18+8(%0)\n" \
+ "std 19, 4*19+8(%0)\n" \
+ "std 20, 4*20+8(%0)\n" \
+ "std 21, 4*21+8(%0)\n" \
+ "std 22, 4*22+8(%0)\n" \
+ "std 23, 4*23+8(%0)\n" \
+ "std 24, 4*24+8(%0)\n" \
+ "std 25, 4*25+8(%0)\n" \
+ "std 26, 4*26+8(%0)\n" \
+ "std 27, 4*27+8(%0)\n" \
+ "std 28, 4*28+8(%0)\n" \
+ "std 29, 4*29+8(%0)\n" \
+ "std 30, 4*30+8(%0)\n" \
+ "std 31, 4*31+8(%0)\n" \
+ "stfd 0, 8*0+4*32+8(%0)\n" \
+ "stfd 1, 8*1+4*32+8(%0)\n" \
+ "stfd 2, 8*2+4*32+8(%0)\n" \
+ "stfd 3, 8*3+4*32+8(%0)\n" \
+ "stfd 4, 8*4+4*32+8(%0)\n" \
+ "stfd 5, 8*5+4*32+8(%0)\n" \
+ "stfd 6, 8*6+4*32+8(%0)\n" \
+ "stfd 7, 8*7+4*32+8(%0)\n" \
+ "stfd 8, 8*8+4*32+8(%0)\n" \
+ "stfd 9, 8*9+4*32+8(%0)\n" \
+ "stfd 10, 8*10+4*32+8(%0)\n" \
+ "stfd 11, 8*11+4*32+8(%0)\n" \
+ "stfd 12, 8*12+4*32+8(%0)\n" \
+ "stfd 13, 8*13+4*32+8(%0)\n" \
+ "stfd 14, 8*14+4*32+8(%0)\n" \
+ "stfd 15, 8*15+4*32+8(%0)\n" \
+ "stfd 16, 8*16+4*32+8(%0)\n" \
+ "stfd 17, 8*17+4*32+8(%0)\n" \
+ "stfd 18, 8*18+4*32+8(%0)\n" \
+ "stfd 19, 8*19+4*32+8(%0)\n" \
+ "stfd 20, 8*20+4*32+8(%0)\n" \
+ "stfd 21, 8*21+4*32+8(%0)\n" \
+ "stfd 22, 8*22+4*32+8(%0)\n" \
+ "stfd 23, 8*23+4*32+8(%0)\n" \
+ "stfd 24, 8*24+4*32+8(%0)\n" \
+ "stfd 25, 8*25+4*32+8(%0)\n" \
+ "stfd 26, 8*26+4*32+8(%0)\n" \
+ "stfd 27, 8*27+4*32+8(%0)\n" \
+ "stfd 28, 8*28+4*32+8(%0)\n" \
+ "stfd 29, 8*29+4*32+8(%0)\n" \
+ "stfd 30, 8*30+4*32+8(%0)\n" \
+ "stfd 31, 8*31+4*32+8(%0)\n" \
+ : : "r" (&(ctx)) \
+ : "memory" \
+ )
+
#endif
+#define MONO_ARCH_HAS_MONO_CONTEXT 1
+
#elif defined(__sparc__) || defined(sparc) /* defined(__mono_ppc__) */
typedef struct MonoContext {
+ mgreg_t regs [15];
guint8 *ip;
gpointer *sp;
gpointer *fp;
#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->fp))
#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sp))
+#ifdef __sparcv9
+#define MONO_CONTEXT_GET_CURRENT(ctx) \
+ __asm__ __volatile__( \
+ "st %%g1,[%0]\n" \
+ "st %%g2,[%0+0x08]\n" \
+ "st %%g3,[%0+0x10]\n" \
+ "st %%g4,[%0+0x18]\n" \
+ "st %%g5,[%0+0x20]\n" \
+ "st %%g6,[%0+0x28]\n" \
+ "st %%g7,[%0+0x30]\n" \
+ "st %%o0,[%0+0x38]\n" \
+ "st %%o1,[%0+0x40]\n" \
+ "st %%o2,[%0+0x48]\n" \
+ "st %%o3,[%0+0x50]\n" \
+ "st %%o4,[%0+0x58]\n" \
+ "st %%o5,[%0+0x60]\n" \
+ "st %%o6,[%0+0x68]\n" \
+ "st %%o7,[%0+0x70]\n" \
+ : \
+ : "r" (&(ctx)) \
+ : "memory" \
+ )
+#else
+#define MONO_CONTEXT_GET_CURRENT(ctx) \
+ __asm__ __volatile__( \
+ "st %%g1,[%0]\n" \
+ "st %%g2,[%0+0x04]\n" \
+ "st %%g3,[%0+0x08]\n" \
+ "st %%g4,[%0+0x0c]\n" \
+ "st %%g5,[%0+0x10]\n" \
+ "st %%g6,[%0+0x14]\n" \
+ "st %%g7,[%0+0x18]\n" \
+ "st %%o0,[%0+0x1c]\n" \
+ "st %%o1,[%0+0x20]\n" \
+ "st %%o2,[%0+0x24]\n" \
+ "st %%o3,[%0+0x28]\n" \
+ "st %%o4,[%0+0x2c]\n" \
+ "st %%o5,[%0+0x30]\n" \
+ "st %%o6,[%0+0x34]\n" \
+ "st %%o7,[%0+0x38]\n" \
+ : \
+ : "r" (&(ctx)) \
+ : "memory" \
+ )
+#endif
+
+#define MONO_ARCH_HAS_MONO_CONTEXT 1
+
#elif defined(__ia64__) /*defined(__sparc__) || defined(sparc) */
#ifndef UNW_LOCAL_ONLY
return fp;
}
-#elif ((defined(__mips__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_MIPS))) && SIZEOF_REGISTER == 4 /* defined(__ia64__) */
+#elif (defined(__mips__) || defined(TARGET_MIPS)) && SIZEOF_REGISTER == 4 /* defined(__ia64__) */
#include <mono/arch/mips/mips-codegen.h>
if (*start_time == 0) {
static guint64 boot_time = 0;
if (!boot_time)
- boot_time = mono_100ns_datetime () - ((guint64)mono_msec_ticks ()) * 10000;
+ boot_time = mono_100ns_datetime () - mono_msec_boottime () * 10000;
*start_time = boot_time + mono_process_get_data (pid, MONO_PROCESS_ELAPSED);
}
#include <utils/mono-time.h>
-#define MTICKS_PER_SEC 10000000
+#define MTICKS_PER_SEC (10 * 1000 * 1000)
+
+gint64
+mono_msec_ticks (void)
+{
+ return mono_100ns_ticks () / 10 / 1000;
+}
#ifdef HOST_WIN32
#include <windows.h>
-guint32
-mono_msec_ticks (void)
+#ifndef _MSC_VER
+/* we get "error: implicit declaration of function 'GetTickCount64'" */
+WINBASEAPI ULONGLONG WINAPI GetTickCount64(void);
+#endif
+
+gint64
+mono_msec_boottime (void)
{
/* GetTickCount () is reportedly monotonic */
- return GetTickCount ();
+ return GetTickCount64 ();
}
/* Returns the number of 100ns ticks from unspecified time: this should be monotonic */
if (uptime) {
double upt;
if (fscanf (uptime, "%lf", &upt) == 1) {
- gint64 now = mono_100ns_ticks ();
+ gint64 now = mono_100ns_datetime ();
fclose (uptime);
return now - (gint64)(upt * MTICKS_PER_SEC);
}
}
/* Returns the number of milliseconds from boot time: this should be monotonic */
-guint32
-mono_msec_ticks (void)
+gint64
+mono_msec_boottime (void)
{
static gint64 boot_time = 0;
gint64 now;
if (!boot_time)
boot_time = get_boot_time ();
- now = mono_100ns_ticks ();
+ now = mono_100ns_datetime ();
/*printf ("now: %llu (boot: %llu) ticks: %llu\n", (gint64)now, (gint64)boot_time, (gint64)(now - boot_time));*/
return (now - boot_time)/10000;
}
#include <sys/time.h>
#endif
-/* Returns the number of milliseconds from boot time: this should be monotonic */
-guint32 mono_msec_ticks (void);
+/* Returns the number of milliseconds from boot time: this should be monotonic
+ *
+ * Prefer to use mono_msec_ticks for elapsed time calculation. */
+gint64 mono_msec_boottime (void);
+
+/* Returns the number of milliseconds ticks from unspecified time: this should be monotonic */
+gint64 mono_msec_ticks (void);
/* Returns the number of 100ns ticks from unspecified time: this should be monotonic */
-gint64 mono_100ns_ticks (void);
+gint64 mono_100ns_ticks (void);
/* Returns the number of 100ns ticks since 1/1/1601, UTC timezone */
-gint64 mono_100ns_datetime (void);
+gint64 mono_100ns_datetime (void);
#ifndef HOST_WIN32
gint64 mono_100ns_datetime_from_timeval (struct timeval tv);
/* No GC support. */
/* #undef HAVE_NULL_GC */
-/* Have oprofile support */
-/* #undef HAVE_OPROFILE */
-
/* Define to 1 if you have the `poll' function. */
/* #undef HAVE_POLL */