comparison src/os/solaris/vm/os_solaris.cpp @ 17707:7d28f4e15b61

8029775: Solaris code cleanup Summary: cleaned up warnings in solaris specific os code. Reviewed-by: coleenp, fparain, dcubed Contributed-by: gerald.thornbrugh@oracle.com
author dcubed
date Wed, 05 Mar 2014 11:28:33 -0800
parents 0e6af9b390af
children 62c54fcc0a35
comparison
equal deleted inserted replaced
17706:0e6af9b390af 17707:7d28f4e15b61
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
2230 st->print("%s",(p.pr_mflags & MA_WRITE) ? "w" : "-"); 2230 st->print("%s",(p.pr_mflags & MA_WRITE) ? "w" : "-");
2231 st->print("%s",(p.pr_mflags & MA_EXEC) ? "x" : "-"); 2231 st->print("%s",(p.pr_mflags & MA_EXEC) ? "x" : "-");
2232 st->cr(); 2232 st->cr();
2233 status = true; 2233 status = true;
2234 } 2234 }
2235 ::close(fd); 2235 }
2236 } 2236 ::close(fd);
2237 } 2237 }
2238 return status; 2238 return status;
2239 } 2239 }
2240 2240
2241 void os::pd_print_cpu_info(outputStream* st) { 2241 void os::pd_print_cpu_info(outputStream* st) {
2255 // but they're the same for all the solaris architectures that we support. 2255 // but they're the same for all the solaris architectures that we support.
2256 const char *ill_names[] = { "ILL0", "ILL_ILLOPC", "ILL_ILLOPN", "ILL_ILLADR", 2256 const char *ill_names[] = { "ILL0", "ILL_ILLOPC", "ILL_ILLOPN", "ILL_ILLADR",
2257 "ILL_ILLTRP", "ILL_PRVOPC", "ILL_PRVREG", 2257 "ILL_ILLTRP", "ILL_PRVOPC", "ILL_PRVREG",
2258 "ILL_COPROC", "ILL_BADSTK" }; 2258 "ILL_COPROC", "ILL_BADSTK" };
2259 2259
2260 const size_t ill_names_length = (sizeof(ill_names)/sizeof(char *));
2261
2260 const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV", 2262 const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV",
2261 "FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES", 2263 "FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES",
2262 "FPE_FLTINV", "FPE_FLTSUB" }; 2264 "FPE_FLTINV", "FPE_FLTSUB" };
2265 const size_t fpe_names_length = (sizeof(fpe_names)/sizeof(char *));
2263 2266
2264 const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" }; 2267 const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" };
2268 const size_t segv_names_length = (sizeof(segv_names)/sizeof(char *));
2265 2269
2266 const char *bus_names[] = { "BUS0", "BUS_ADRALN", "BUS_ADRERR", "BUS_OBJERR" }; 2270 const char *bus_names[] = { "BUS0", "BUS_ADRALN", "BUS_ADRERR", "BUS_OBJERR" };
2271 const size_t bus_names_length = (sizeof(bus_names)/sizeof(char *));
2267 2272
2268 void os::print_siginfo(outputStream* st, void* siginfo) { 2273 void os::print_siginfo(outputStream* st, void* siginfo) {
2269 st->print("siginfo:"); 2274 st->print("siginfo:");
2270 2275
2271 const int buflen = 100; 2276 const int buflen = 100;
2280 } 2285 }
2281 const int c = si->si_code; 2286 const int c = si->si_code;
2282 assert(c > 0, "unexpected si_code"); 2287 assert(c > 0, "unexpected si_code");
2283 switch (si->si_signo) { 2288 switch (si->si_signo) {
2284 case SIGILL: 2289 case SIGILL:
2285 st->print(", si_code=%d (%s)", c, c > 8 ? "" : ill_names[c]); 2290 st->print(", si_code=%d (%s)", c,
2291 c >= ill_names_length ? "" : ill_names[c]);
2286 st->print(", si_addr=" PTR_FORMAT, si->si_addr); 2292 st->print(", si_addr=" PTR_FORMAT, si->si_addr);
2287 break; 2293 break;
2288 case SIGFPE: 2294 case SIGFPE:
2289 st->print(", si_code=%d (%s)", c, c > 9 ? "" : fpe_names[c]); 2295 st->print(", si_code=%d (%s)", c,
2296 c >= fpe_names_length ? "" : fpe_names[c]);
2290 st->print(", si_addr=" PTR_FORMAT, si->si_addr); 2297 st->print(", si_addr=" PTR_FORMAT, si->si_addr);
2291 break; 2298 break;
2292 case SIGSEGV: 2299 case SIGSEGV:
2293 st->print(", si_code=%d (%s)", c, c > 2 ? "" : segv_names[c]); 2300 st->print(", si_code=%d (%s)", c,
2301 c >= segv_names_length ? "" : segv_names[c]);
2294 st->print(", si_addr=" PTR_FORMAT, si->si_addr); 2302 st->print(", si_addr=" PTR_FORMAT, si->si_addr);
2295 break; 2303 break;
2296 case SIGBUS: 2304 case SIGBUS:
2297 st->print(", si_code=%d (%s)", c, c > 3 ? "" : bus_names[c]); 2305 st->print(", si_code=%d (%s)", c,
2306 c >= bus_names_length ? "" : bus_names[c]);
2298 st->print(", si_addr=" PTR_FORMAT, si->si_addr); 2307 st->print(", si_addr=" PTR_FORMAT, si->si_addr);
2299 break; 2308 break;
2300 default: 2309 default:
2301 st->print(", si_code=%d", si->si_code); 2310 st->print(", si_code=%d", si->si_code);
2302 // no si_addr 2311 // no si_addr
3009 // Scan the pages from start to end until a page different than 3018 // Scan the pages from start to end until a page different than
3010 // the one described in the info parameter is encountered. 3019 // the one described in the info parameter is encountered.
3011 char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) { 3020 char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) {
3012 const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE }; 3021 const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE };
3013 const size_t types = sizeof(info_types) / sizeof(info_types[0]); 3022 const size_t types = sizeof(info_types) / sizeof(info_types[0]);
3014 uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT]; 3023 uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT + 1];
3015 uint_t validity[MAX_MEMINFO_CNT]; 3024 uint_t validity[MAX_MEMINFO_CNT];
3016 3025
3017 size_t page_size = MAX2((size_t)os::vm_page_size(), page_expected->size); 3026 size_t page_size = MAX2((size_t)os::vm_page_size(), page_expected->size);
3018 uint64_t p = (uint64_t)start; 3027 uint64_t p = (uint64_t)start;
3019 while (p < (uint64_t)end) { 3028 while (p < (uint64_t)end) {
3048 } else { 3057 } else {
3049 return NULL; 3058 return NULL;
3050 } 3059 }
3051 } 3060 }
3052 3061
3053 if (i != addrs_count) { 3062 if (i < addrs_count) {
3054 if ((validity[i] & 2) != 0) { 3063 if ((validity[i] & 2) != 0) {
3055 page_found->lgrp_id = outdata[types * i]; 3064 page_found->lgrp_id = outdata[types * i];
3056 } else { 3065 } else {
3057 page_found->lgrp_id = -1; 3066 page_found->lgrp_id = -1;
3058 } 3067 }