src/cpu/mips/vm/vm_version_mips.cpp

changeset 1
2d8a650513c2
child 203
333debbd9de9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/cpu/mips/vm/vm_version_mips.cpp	Fri Apr 29 00:06:10 2016 +0800
     1.3 @@ -0,0 +1,120 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2015, 2016, Loongson Technology. All rights reserved.
     1.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 + *
     1.9 + * This code is free software; you can redistribute it and/or modify it
    1.10 + * under the terms of the GNU General Public License version 2 only, as
    1.11 + * published by the Free Software Foundation.
    1.12 + *
    1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + * version 2 for more details (a copy is included in the LICENSE file that
    1.17 + * accompanied this code).
    1.18 + *
    1.19 + * You should have received a copy of the GNU General Public License version
    1.20 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + *
    1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + * or visit www.oracle.com if you need additional information or have any
    1.25 + * questions.
    1.26 + *
    1.27 + */
    1.28 +
    1.29 +#include "precompiled.hpp"
    1.30 +#include "asm/macroAssembler.hpp"
    1.31 +#include "asm/macroAssembler.inline.hpp"
    1.32 +#include "memory/resourceArea.hpp"
    1.33 +#include "runtime/java.hpp"
    1.34 +#include "runtime/stubCodeGenerator.hpp"
    1.35 +#include "vm_version_mips.hpp"
    1.36 +#ifdef TARGET_OS_FAMILY_linux
    1.37 +# include "os_linux.inline.hpp"
    1.38 +#endif
    1.39 +#ifdef TARGET_OS_FAMILY_solaris
    1.40 +# include "os_solaris.inline.hpp"
    1.41 +#endif
    1.42 +#ifdef TARGET_OS_FAMILY_windows
    1.43 +# include "os_windows.inline.hpp"
    1.44 +#endif
    1.45 +#ifdef TARGET_OS_FAMILY_bsd
    1.46 +# include "os_bsd.inline.hpp"
    1.47 +#endif
    1.48 +/*
    1.49 +int VM_Version::_cpu;
    1.50 +int VM_Version::_model;
    1.51 +int VM_Version::_stepping;
    1.52 +int VM_Version::_cpuFeatures;
    1.53 +const char*           VM_Version::_features_str = "";
    1.54 +VM_Version::CpuidInfo VM_Version::_cpuid_info   = { 0, };
    1.55 +
    1.56 +static BufferBlob* stub_blob;
    1.57 +static const int stub_size = 300;
    1.58 +
    1.59 +extern "C" {
    1.60 +  typedef void (*getPsrInfo_stub_t)(void*);
    1.61 +}
    1.62 +static getPsrInfo_stub_t getPsrInfo_stub = NULL;
    1.63 +*/
    1.64 +int VM_Version::_features = VM_Version::unknown_m;
    1.65 +const char* VM_Version::_features_str = "";
    1.66 +/*
    1.67 +class VM_Version_StubGenerator: public StubCodeGenerator {
    1.68 + public:
    1.69 +
    1.70 +  VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {}
    1.71 +
    1.72 +  address generate_getPsrInfo() {
    1.73 +  };
    1.74 +};
    1.75 +
    1.76 +
    1.77 +void VM_Version::get_processor_features() {
    1.78 +}
    1.79 +*/
    1.80 +void VM_Version::initialize() {
    1.81 +	_features = determine_features();
    1.82 +	//no need, Abstract_VM_Version already define it as false
    1.83 +	_supports_cx8 = true;
    1.84 +
    1.85 +	char buf[256];
    1.86 +	jio_snprintf(buf, sizeof(buf), "%s, %s"
    1.87 +#ifdef OPT_RANGECHECK
    1.88 +			", optimized range check"
    1.89 +#endif
    1.90 +#ifdef OPT_PHI_1
    1.91 +			", optimized phi"
    1.92 +#endif
    1.93 +#ifdef OPT_MERGE
    1.94 +			", optimized merge"
    1.95 +#endif
    1.96 +			,	(has_l2_cache() ? "has_l2_cache" : ""), (has_16k_page() ? "has_16k_page" : "")
    1.97 +	);
    1.98 +	//////////////////////add some other feature here//////////////////
    1.99 +	
   1.100 +	// buf is started with ", " or is empty
   1.101 +	_features_str = strdup(buf);
   1.102 +	NOT_PRODUCT( if (PrintMiscellaneous && Verbose) print_features(); );
   1.103 +}
   1.104 +
   1.105 +void VM_Version::print_features() {
   1.106 +	tty->print_cr("Version:%s", cpu_features());
   1.107 +}
   1.108 +
   1.109 +int VM_Version::determine_features() {
   1.110 +	//////////////////////add some other feature here//////////////////
   1.111 +	return spt_16k_page_m; 
   1.112 +}
   1.113 +
   1.114 +static int saved_features = 0;
   1.115 +
   1.116 +void VM_Version::allow_all() {
   1.117 +	saved_features = _features;
   1.118 +	_features     = all_features_m;
   1.119 +}
   1.120 +
   1.121 +void VM_Version::revert() {
   1.122 +	_features = saved_features;
   1.123 +}

mercurial