annotate agent/src/os/bsd/BsdDebuggerLocal.c @ 2796:f08d439fab8c

7089790: integrate bsd-port changes Reviewed-by: kvn, twisti, jrose Contributed-by: Kurt Miller <kurt@intricatesoftware.com>, Greg Lewis <glewis@eyesbeyond.com>, Jung-uk Kim <jkim@freebsd.org>, Christos Zoulas <christos@zoulas.com>, Landon Fuller <landonf@plausible.coop>, The FreeBSD Foundation <board@freebsdfoundation.org>, Michael Franz <mvfranz@gmail.com>, Roger Hoover <rhoover@apple.com>, Alexander Strange <astrange@apple.com>
author never
date Sun, 25 Sep 2011 16:03:29 -0700
parents
children
rev   line source
never@2796 1 /*
never@2796 2 * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
never@2796 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@2796 4 *
never@2796 5 * This code is free software; you can redistribute it and/or modify it
never@2796 6 * under the terms of the GNU General Public License version 2 only, as
never@2796 7 * published by the Free Software Foundation.
never@2796 8 *
never@2796 9 * This code is distributed in the hope that it will be useful, but WITHOUT
never@2796 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@2796 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@2796 12 * version 2 for more details (a copy is included in the LICENSE file that
never@2796 13 * accompanied this code).
never@2796 14 *
never@2796 15 * You should have received a copy of the GNU General Public License version
never@2796 16 * 2 along with this work; if not, write to the Free Software Foundation,
never@2796 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@2796 18 *
never@2796 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
never@2796 20 * or visit www.oracle.com if you need additional information or have any
never@2796 21 * questions.
never@2796 22 *
never@2796 23 */
never@2796 24
never@2796 25 #include <stdlib.h>
never@2796 26 #include <jni.h>
never@2796 27 #include "libproc.h"
never@2796 28
never@2796 29 #if defined(x86_64) && !defined(amd64)
never@2796 30 #define amd64 1
never@2796 31 #endif
never@2796 32
never@2796 33 #ifdef i386
never@2796 34 #include "sun_jvm_hotspot_debugger_x86_X86ThreadContext.h"
never@2796 35 #endif
never@2796 36
never@2796 37 #ifdef amd64
never@2796 38 #include "sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext.h"
never@2796 39 #endif
never@2796 40
never@2796 41 #if defined(sparc) || defined(sparcv9)
never@2796 42 #include "sun_jvm_hotspot_debugger_sparc_SPARCThreadContext.h"
never@2796 43 #endif
never@2796 44
never@2796 45 static jfieldID p_ps_prochandle_ID = 0;
never@2796 46 static jfieldID threadList_ID = 0;
never@2796 47 static jfieldID loadObjectList_ID = 0;
never@2796 48
never@2796 49 static jmethodID createClosestSymbol_ID = 0;
never@2796 50 static jmethodID createLoadObject_ID = 0;
never@2796 51 static jmethodID getThreadForThreadId_ID = 0;
never@2796 52 static jmethodID listAdd_ID = 0;
never@2796 53
never@2796 54 #define CHECK_EXCEPTION_(value) if ((*env)->ExceptionOccurred(env)) { return value; }
never@2796 55 #define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;}
never@2796 56 #define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; }
never@2796 57 #define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;}
never@2796 58
never@2796 59 static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
never@2796 60 (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
never@2796 61 }
never@2796 62
never@2796 63 static struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj) {
never@2796 64 jlong ptr = (*env)->GetLongField(env, this_obj, p_ps_prochandle_ID);
never@2796 65 return (struct ps_prochandle*)(intptr_t)ptr;
never@2796 66 }
never@2796 67
never@2796 68 /*
never@2796 69 * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
never@2796 70 * Method: init0
never@2796 71 * Signature: ()V
never@2796 72 */
never@2796 73 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0
never@2796 74 (JNIEnv *env, jclass cls) {
never@2796 75 jclass listClass;
never@2796 76
never@2796 77 if (init_libproc(getenv("LIBSAPROC_DEBUG") != NULL) != true) {
never@2796 78 THROW_NEW_DEBUGGER_EXCEPTION("can't initialize libproc");
never@2796 79 }
never@2796 80
never@2796 81 // fields we use
never@2796 82 p_ps_prochandle_ID = (*env)->GetFieldID(env, cls, "p_ps_prochandle", "J");
never@2796 83 CHECK_EXCEPTION;
never@2796 84 threadList_ID = (*env)->GetFieldID(env, cls, "threadList", "Ljava/util/List;");
never@2796 85 CHECK_EXCEPTION;
never@2796 86 loadObjectList_ID = (*env)->GetFieldID(env, cls, "loadObjectList", "Ljava/util/List;");
never@2796 87 CHECK_EXCEPTION;
never@2796 88
never@2796 89 // methods we use
never@2796 90 createClosestSymbol_ID = (*env)->GetMethodID(env, cls, "createClosestSymbol",
never@2796 91 "(Ljava/lang/String;J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;");
never@2796 92 CHECK_EXCEPTION;
never@2796 93 createLoadObject_ID = (*env)->GetMethodID(env, cls, "createLoadObject",
never@2796 94 "(Ljava/lang/String;JJ)Lsun/jvm/hotspot/debugger/cdbg/LoadObject;");
never@2796 95 CHECK_EXCEPTION;
never@2796 96 getThreadForThreadId_ID = (*env)->GetMethodID(env, cls, "getThreadForThreadId",
never@2796 97 "(J)Lsun/jvm/hotspot/debugger/ThreadProxy;");
never@2796 98 CHECK_EXCEPTION;
never@2796 99 // java.util.List method we call
never@2796 100 listClass = (*env)->FindClass(env, "java/util/List");
never@2796 101 CHECK_EXCEPTION;
never@2796 102 listAdd_ID = (*env)->GetMethodID(env, listClass, "add", "(Ljava/lang/Object;)Z");
never@2796 103 CHECK_EXCEPTION;
never@2796 104 }
never@2796 105
never@2796 106 JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize
never@2796 107 (JNIEnv *env, jclass cls)
never@2796 108 {
never@2796 109 #ifdef _LP64
never@2796 110 return 8;
never@2796 111 #else
never@2796 112 return 4;
never@2796 113 #endif
never@2796 114
never@2796 115 }
never@2796 116
never@2796 117
never@2796 118 static void fillThreadsAndLoadObjects(JNIEnv* env, jobject this_obj, struct ps_prochandle* ph) {
never@2796 119 int n = 0, i = 0;
never@2796 120
never@2796 121 // add threads
never@2796 122 n = get_num_threads(ph);
never@2796 123 for (i = 0; i < n; i++) {
never@2796 124 jobject thread;
never@2796 125 jobject threadList;
never@2796 126 lwpid_t lwpid;
never@2796 127
never@2796 128 lwpid = get_lwp_id(ph, i);
never@2796 129 thread = (*env)->CallObjectMethod(env, this_obj, getThreadForThreadId_ID,
never@2796 130 (jlong)lwpid);
never@2796 131 CHECK_EXCEPTION;
never@2796 132 threadList = (*env)->GetObjectField(env, this_obj, threadList_ID);
never@2796 133 CHECK_EXCEPTION;
never@2796 134 (*env)->CallBooleanMethod(env, threadList, listAdd_ID, thread);
never@2796 135 CHECK_EXCEPTION;
never@2796 136 }
never@2796 137
never@2796 138 // add load objects
never@2796 139 n = get_num_libs(ph);
never@2796 140 for (i = 0; i < n; i++) {
never@2796 141 uintptr_t base;
never@2796 142 const char* name;
never@2796 143 jobject loadObject;
never@2796 144 jobject loadObjectList;
never@2796 145
never@2796 146 base = get_lib_base(ph, i);
never@2796 147 name = get_lib_name(ph, i);
never@2796 148 loadObject = (*env)->CallObjectMethod(env, this_obj, createLoadObject_ID,
never@2796 149 (*env)->NewStringUTF(env, name), (jlong)0, (jlong)base);
never@2796 150 CHECK_EXCEPTION;
never@2796 151 loadObjectList = (*env)->GetObjectField(env, this_obj, loadObjectList_ID);
never@2796 152 CHECK_EXCEPTION;
never@2796 153 (*env)->CallBooleanMethod(env, loadObjectList, listAdd_ID, loadObject);
never@2796 154 CHECK_EXCEPTION;
never@2796 155 }
never@2796 156 }
never@2796 157
never@2796 158 /*
never@2796 159 * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
never@2796 160 * Method: attach0
never@2796 161 * Signature: (I)V
never@2796 162 */
never@2796 163 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I
never@2796 164 (JNIEnv *env, jobject this_obj, jint jpid) {
never@2796 165
never@2796 166 struct ps_prochandle* ph;
never@2796 167 if ( (ph = Pgrab(jpid)) == NULL) {
never@2796 168 THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
never@2796 169 }
never@2796 170 (*env)->SetLongField(env, this_obj, p_ps_prochandle_ID, (jlong)(intptr_t)ph);
never@2796 171 fillThreadsAndLoadObjects(env, this_obj, ph);
never@2796 172 }
never@2796 173
never@2796 174 /*
never@2796 175 * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
never@2796 176 * Method: attach0
never@2796 177 * Signature: (Ljava/lang/String;Ljava/lang/String;)V
never@2796 178 */
never@2796 179 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2
never@2796 180 (JNIEnv *env, jobject this_obj, jstring execName, jstring coreName) {
never@2796 181 const char *execName_cstr;
never@2796 182 const char *coreName_cstr;
never@2796 183 jboolean isCopy;
never@2796 184 struct ps_prochandle* ph;
never@2796 185
never@2796 186 execName_cstr = (*env)->GetStringUTFChars(env, execName, &isCopy);
never@2796 187 CHECK_EXCEPTION;
never@2796 188 coreName_cstr = (*env)->GetStringUTFChars(env, coreName, &isCopy);
never@2796 189 CHECK_EXCEPTION;
never@2796 190
never@2796 191 if ( (ph = Pgrab_core(execName_cstr, coreName_cstr)) == NULL) {
never@2796 192 (*env)->ReleaseStringUTFChars(env, execName, execName_cstr);
never@2796 193 (*env)->ReleaseStringUTFChars(env, coreName, coreName_cstr);
never@2796 194 THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the core file");
never@2796 195 }
never@2796 196 (*env)->SetLongField(env, this_obj, p_ps_prochandle_ID, (jlong)(intptr_t)ph);
never@2796 197 (*env)->ReleaseStringUTFChars(env, execName, execName_cstr);
never@2796 198 (*env)->ReleaseStringUTFChars(env, coreName, coreName_cstr);
never@2796 199 fillThreadsAndLoadObjects(env, this_obj, ph);
never@2796 200 }
never@2796 201
never@2796 202 /*
never@2796 203 * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
never@2796 204 * Method: detach0
never@2796 205 * Signature: ()V
never@2796 206 */
never@2796 207 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0
never@2796 208 (JNIEnv *env, jobject this_obj) {
never@2796 209 struct ps_prochandle* ph = get_proc_handle(env, this_obj);
never@2796 210 if (ph != NULL) {
never@2796 211 Prelease(ph);
never@2796 212 }
never@2796 213 }
never@2796 214
never@2796 215 /*
never@2796 216 * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
never@2796 217 * Method: lookupByName0
never@2796 218 * Signature: (Ljava/lang/String;Ljava/lang/String;)J
never@2796 219 */
never@2796 220 JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0
never@2796 221 (JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) {
never@2796 222 const char *objectName_cstr, *symbolName_cstr;
never@2796 223 jlong addr;
never@2796 224 jboolean isCopy;
never@2796 225 struct ps_prochandle* ph = get_proc_handle(env, this_obj);
never@2796 226
never@2796 227 objectName_cstr = NULL;
never@2796 228 if (objectName != NULL) {
never@2796 229 objectName_cstr = (*env)->GetStringUTFChars(env, objectName, &isCopy);
never@2796 230 CHECK_EXCEPTION_(0);
never@2796 231 }
never@2796 232 symbolName_cstr = (*env)->GetStringUTFChars(env, symbolName, &isCopy);
never@2796 233 CHECK_EXCEPTION_(0);
never@2796 234
never@2796 235 addr = (jlong) lookup_symbol(ph, objectName_cstr, symbolName_cstr);
never@2796 236
never@2796 237 if (objectName_cstr != NULL) {
never@2796 238 (*env)->ReleaseStringUTFChars(env, objectName, objectName_cstr);
never@2796 239 }
never@2796 240 (*env)->ReleaseStringUTFChars(env, symbolName, symbolName_cstr);
never@2796 241 return addr;
never@2796 242 }
never@2796 243
never@2796 244 /*
never@2796 245 * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
never@2796 246 * Method: lookupByAddress0
never@2796 247 * Signature: (J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;
never@2796 248 */
never@2796 249 JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0
never@2796 250 (JNIEnv *env, jobject this_obj, jlong addr) {
never@2796 251 uintptr_t offset;
never@2796 252 const char* sym = NULL;
never@2796 253
never@2796 254 struct ps_prochandle* ph = get_proc_handle(env, this_obj);
never@2796 255 sym = symbol_for_pc(ph, (uintptr_t) addr, &offset);
never@2796 256 if (sym == NULL) return 0;
never@2796 257 return (*env)->CallObjectMethod(env, this_obj, createClosestSymbol_ID,
never@2796 258 (*env)->NewStringUTF(env, sym), (jlong)offset);
never@2796 259 }
never@2796 260
never@2796 261 /*
never@2796 262 * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
never@2796 263 * Method: readBytesFromProcess0
never@2796 264 * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
never@2796 265 */
never@2796 266 JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0
never@2796 267 (JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) {
never@2796 268
never@2796 269 jboolean isCopy;
never@2796 270 jbyteArray array;
never@2796 271 jbyte *bufPtr;
never@2796 272 ps_err_e err;
never@2796 273
never@2796 274 array = (*env)->NewByteArray(env, numBytes);
never@2796 275 CHECK_EXCEPTION_(0);
never@2796 276 bufPtr = (*env)->GetByteArrayElements(env, array, &isCopy);
never@2796 277 CHECK_EXCEPTION_(0);
never@2796 278
never@2796 279 err = ps_pread(get_proc_handle(env, this_obj), (psaddr_t) (uintptr_t)addr, bufPtr, numBytes);
never@2796 280 (*env)->ReleaseByteArrayElements(env, array, bufPtr, 0);
never@2796 281 return (err == PS_OK)? array : 0;
never@2796 282 }
never@2796 283
never@2796 284 JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
never@2796 285 (JNIEnv *env, jobject this_obj, jint lwp_id) {
never@2796 286
never@2796 287 struct reg gregs;
never@2796 288 jboolean isCopy;
never@2796 289 jlongArray array;
never@2796 290 jlong *regs;
never@2796 291
never@2796 292 struct ps_prochandle* ph = get_proc_handle(env, this_obj);
never@2796 293 if (get_lwp_regs(ph, lwp_id, &gregs) != true) {
never@2796 294 THROW_NEW_DEBUGGER_EXCEPTION_("get_thread_regs failed for a lwp", 0);
never@2796 295 }
never@2796 296
never@2796 297 #undef NPRGREG
never@2796 298 #ifdef i386
never@2796 299 #define NPRGREG sun_jvm_hotspot_debugger_x86_X86ThreadContext_NPRGREG
never@2796 300 #endif
never@2796 301 #ifdef ia64
never@2796 302 #define NPRGREG IA64_REG_COUNT
never@2796 303 #endif
never@2796 304 #ifdef amd64
never@2796 305 #define NPRGREG sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_NPRGREG
never@2796 306 #endif
never@2796 307 #if defined(sparc) || defined(sparcv9)
never@2796 308 #define NPRGREG sun_jvm_hotspot_debugger_sparc_SPARCThreadContext_NPRGREG
never@2796 309 #endif
never@2796 310
never@2796 311 array = (*env)->NewLongArray(env, NPRGREG);
never@2796 312 CHECK_EXCEPTION_(0);
never@2796 313 regs = (*env)->GetLongArrayElements(env, array, &isCopy);
never@2796 314
never@2796 315 #undef REG_INDEX
never@2796 316
never@2796 317 #ifdef i386
never@2796 318 #define REG_INDEX(reg) sun_jvm_hotspot_debugger_x86_X86ThreadContext_##reg
never@2796 319
never@2796 320 regs[REG_INDEX(GS)] = (uintptr_t) gregs.r_gs;
never@2796 321 regs[REG_INDEX(FS)] = (uintptr_t) gregs.r_fs;
never@2796 322 regs[REG_INDEX(ES)] = (uintptr_t) gregs.r_es;
never@2796 323 regs[REG_INDEX(DS)] = (uintptr_t) gregs.r_ds;
never@2796 324 regs[REG_INDEX(EDI)] = (uintptr_t) gregs.r_edi;
never@2796 325 regs[REG_INDEX(ESI)] = (uintptr_t) gregs.r_esi;
never@2796 326 regs[REG_INDEX(FP)] = (uintptr_t) gregs.r_ebp;
never@2796 327 regs[REG_INDEX(SP)] = (uintptr_t) gregs.r_isp;
never@2796 328 regs[REG_INDEX(EBX)] = (uintptr_t) gregs.r_ebx;
never@2796 329 regs[REG_INDEX(EDX)] = (uintptr_t) gregs.r_edx;
never@2796 330 regs[REG_INDEX(ECX)] = (uintptr_t) gregs.r_ecx;
never@2796 331 regs[REG_INDEX(EAX)] = (uintptr_t) gregs.r_eax;
never@2796 332 regs[REG_INDEX(PC)] = (uintptr_t) gregs.r_eip;
never@2796 333 regs[REG_INDEX(CS)] = (uintptr_t) gregs.r_cs;
never@2796 334 regs[REG_INDEX(SS)] = (uintptr_t) gregs.r_ss;
never@2796 335
never@2796 336 #endif /* i386 */
never@2796 337
never@2796 338 #if ia64
never@2796 339 regs = (*env)->GetLongArrayElements(env, array, &isCopy);
never@2796 340 int i;
never@2796 341 for (i = 0; i < NPRGREG; i++ ) {
never@2796 342 regs[i] = 0xDEADDEAD;
never@2796 343 }
never@2796 344 #endif /* ia64 */
never@2796 345
never@2796 346 #ifdef amd64
never@2796 347 #define REG_INDEX(reg) sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_##reg
never@2796 348
never@2796 349 regs[REG_INDEX(R15)] = gregs.r_r15;
never@2796 350 regs[REG_INDEX(R14)] = gregs.r_r14;
never@2796 351 regs[REG_INDEX(R13)] = gregs.r_r13;
never@2796 352 regs[REG_INDEX(R12)] = gregs.r_r12;
never@2796 353 regs[REG_INDEX(RBP)] = gregs.r_rbp;
never@2796 354 regs[REG_INDEX(RBX)] = gregs.r_rbx;
never@2796 355 regs[REG_INDEX(R11)] = gregs.r_r11;
never@2796 356 regs[REG_INDEX(R10)] = gregs.r_r10;
never@2796 357 regs[REG_INDEX(R9)] = gregs.r_r9;
never@2796 358 regs[REG_INDEX(R8)] = gregs.r_r8;
never@2796 359 regs[REG_INDEX(RAX)] = gregs.r_rax;
never@2796 360 regs[REG_INDEX(RCX)] = gregs.r_rcx;
never@2796 361 regs[REG_INDEX(RDX)] = gregs.r_rdx;
never@2796 362 regs[REG_INDEX(RSI)] = gregs.r_rsi;
never@2796 363 regs[REG_INDEX(RDI)] = gregs.r_rdi;
never@2796 364 regs[REG_INDEX(RIP)] = gregs.r_rip;
never@2796 365 regs[REG_INDEX(CS)] = gregs.r_cs;
never@2796 366 regs[REG_INDEX(RSP)] = gregs.r_rsp;
never@2796 367 regs[REG_INDEX(SS)] = gregs.r_ss;
never@2796 368 // regs[REG_INDEX(FSBASE)] = gregs.fs_base;
never@2796 369 // regs[REG_INDEX(GSBASE)] = gregs.gs_base;
never@2796 370 // regs[REG_INDEX(DS)] = gregs.ds;
never@2796 371 // regs[REG_INDEX(ES)] = gregs.es;
never@2796 372 // regs[REG_INDEX(FS)] = gregs.fs;
never@2796 373 // regs[REG_INDEX(GS)] = gregs.gs;
never@2796 374
never@2796 375 #endif /* amd64 */
never@2796 376
never@2796 377 #if defined(sparc) || defined(sparcv9)
never@2796 378
never@2796 379 #define REG_INDEX(reg) sun_jvm_hotspot_debugger_sparc_SPARCThreadContext_##reg
never@2796 380
never@2796 381 #ifdef _LP64
never@2796 382 regs[REG_INDEX(R_PSR)] = gregs.tstate;
never@2796 383 regs[REG_INDEX(R_PC)] = gregs.tpc;
never@2796 384 regs[REG_INDEX(R_nPC)] = gregs.tnpc;
never@2796 385 regs[REG_INDEX(R_Y)] = gregs.y;
never@2796 386 #else
never@2796 387 regs[REG_INDEX(R_PSR)] = gregs.psr;
never@2796 388 regs[REG_INDEX(R_PC)] = gregs.pc;
never@2796 389 regs[REG_INDEX(R_nPC)] = gregs.npc;
never@2796 390 regs[REG_INDEX(R_Y)] = gregs.y;
never@2796 391 #endif
never@2796 392 regs[REG_INDEX(R_G0)] = 0 ;
never@2796 393 regs[REG_INDEX(R_G1)] = gregs.u_regs[0];
never@2796 394 regs[REG_INDEX(R_G2)] = gregs.u_regs[1];
never@2796 395 regs[REG_INDEX(R_G3)] = gregs.u_regs[2];
never@2796 396 regs[REG_INDEX(R_G4)] = gregs.u_regs[3];
never@2796 397 regs[REG_INDEX(R_G5)] = gregs.u_regs[4];
never@2796 398 regs[REG_INDEX(R_G6)] = gregs.u_regs[5];
never@2796 399 regs[REG_INDEX(R_G7)] = gregs.u_regs[6];
never@2796 400 regs[REG_INDEX(R_O0)] = gregs.u_regs[7];
never@2796 401 regs[REG_INDEX(R_O1)] = gregs.u_regs[8];
never@2796 402 regs[REG_INDEX(R_O2)] = gregs.u_regs[ 9];
never@2796 403 regs[REG_INDEX(R_O3)] = gregs.u_regs[10];
never@2796 404 regs[REG_INDEX(R_O4)] = gregs.u_regs[11];
never@2796 405 regs[REG_INDEX(R_O5)] = gregs.u_regs[12];
never@2796 406 regs[REG_INDEX(R_O6)] = gregs.u_regs[13];
never@2796 407 regs[REG_INDEX(R_O7)] = gregs.u_regs[14];
never@2796 408 #endif /* sparc */
never@2796 409
never@2796 410
never@2796 411 (*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT);
never@2796 412 return array;
never@2796 413 }