equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2015, Red Hat Inc. All rights reserved. |
3 * Copyright (c) 2015, 2019, Red Hat Inc. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
26 #include "precompiled.hpp" |
26 #include "precompiled.hpp" |
27 #include "asm/macroAssembler.hpp" |
27 #include "asm/macroAssembler.hpp" |
28 #include "asm/macroAssembler.inline.hpp" |
28 #include "asm/macroAssembler.inline.hpp" |
29 #include "memory/resourceArea.hpp" |
29 #include "memory/resourceArea.hpp" |
30 #include "runtime/java.hpp" |
30 #include "runtime/java.hpp" |
|
31 #include "runtime/os.hpp" |
31 #include "runtime/stubCodeGenerator.hpp" |
32 #include "runtime/stubCodeGenerator.hpp" |
32 #include "utilities/macros.hpp" |
33 #include "utilities/macros.hpp" |
33 #include "vm_version_aarch64.hpp" |
34 #include "vm_version_aarch64.hpp" |
34 |
35 |
35 #include OS_HEADER_INLINE(os) |
36 #include OS_HEADER_INLINE(os) |
36 |
37 |
37 #ifndef BUILTIN_SIM |
|
38 #include <sys/auxv.h> |
38 #include <sys/auxv.h> |
39 #include <asm/hwcap.h> |
39 #include <asm/hwcap.h> |
40 #else |
|
41 #define getauxval(hwcap) 0 |
|
42 #endif |
|
43 |
40 |
44 #ifndef HWCAP_AES |
41 #ifndef HWCAP_AES |
45 #define HWCAP_AES (1<<3) |
42 #define HWCAP_AES (1<<3) |
46 #endif |
43 #endif |
47 |
44 |
69 int VM_Version::_model; |
66 int VM_Version::_model; |
70 int VM_Version::_model2; |
67 int VM_Version::_model2; |
71 int VM_Version::_variant; |
68 int VM_Version::_variant; |
72 int VM_Version::_revision; |
69 int VM_Version::_revision; |
73 int VM_Version::_stepping; |
70 int VM_Version::_stepping; |
|
71 bool VM_Version::_dcpop; |
74 VM_Version::PsrInfo VM_Version::_psr_info = { 0, }; |
72 VM_Version::PsrInfo VM_Version::_psr_info = { 0, }; |
75 |
73 |
76 static BufferBlob* stub_blob; |
74 static BufferBlob* stub_blob; |
77 static const int stub_size = 550; |
75 static const int stub_size = 550; |
78 |
76 |
89 |
87 |
90 address generate_getPsrInfo() { |
88 address generate_getPsrInfo() { |
91 StubCodeMark mark(this, "VM_Version", "getPsrInfo_stub"); |
89 StubCodeMark mark(this, "VM_Version", "getPsrInfo_stub"); |
92 # define __ _masm-> |
90 # define __ _masm-> |
93 address start = __ pc(); |
91 address start = __ pc(); |
94 |
|
95 #ifdef BUILTIN_SIM |
|
96 __ c_stub_prolog(1, 0, MacroAssembler::ret_type_void); |
|
97 #endif |
|
98 |
92 |
99 // void getPsrInfo(VM_Version::PsrInfo* psr_info); |
93 // void getPsrInfo(VM_Version::PsrInfo* psr_info); |
100 |
94 |
101 address entry = __ pc(); |
95 address entry = __ pc(); |
102 |
96 |
173 |
167 |
174 _features = auxv; |
168 _features = auxv; |
175 |
169 |
176 int cpu_lines = 0; |
170 int cpu_lines = 0; |
177 if (FILE *f = fopen("/proc/cpuinfo", "r")) { |
171 if (FILE *f = fopen("/proc/cpuinfo", "r")) { |
178 char buf[128], *p; |
172 // need a large buffer as the flags line may include lots of text |
|
173 char buf[1024], *p; |
179 while (fgets(buf, sizeof (buf), f) != NULL) { |
174 while (fgets(buf, sizeof (buf), f) != NULL) { |
180 if (p = strchr(buf, ':')) { |
175 if ((p = strchr(buf, ':')) != NULL) { |
181 long v = strtol(p+1, NULL, 0); |
176 long v = strtol(p+1, NULL, 0); |
182 if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) { |
177 if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) { |
183 _cpu = v; |
178 _cpu = v; |
184 cpu_lines++; |
179 cpu_lines++; |
185 } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) { |
180 } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) { |
187 } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) { |
182 } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) { |
188 if (_model != v) _model2 = _model; |
183 if (_model != v) _model2 = _model; |
189 _model = v; |
184 _model = v; |
190 } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) { |
185 } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) { |
191 _revision = v; |
186 _revision = v; |
|
187 } else if (strncmp(buf, "flags", sizeof("flags") - 1) == 0) { |
|
188 if (strstr(p+1, "dcpop")) { |
|
189 _dcpop = true; |
|
190 } |
192 } |
191 } |
193 } |
192 } |
194 } |
193 } |
195 fclose(f); |
194 fclose(f); |
|
195 } |
|
196 |
|
197 if (os::supports_map_sync()) { |
|
198 // if dcpop is available publish data cache line flush size via |
|
199 // generic field, otherwise let if default to zero thereby |
|
200 // disabling writeback |
|
201 if (_dcpop) { |
|
202 _data_cache_line_flush_size = dcache_line; |
|
203 } |
196 } |
204 } |
197 |
205 |
198 // Enable vendor specific features |
206 // Enable vendor specific features |
199 |
207 |
200 // Ampere eMAG |
208 // Ampere eMAG |