nsprpub/pr/src/md/os2/os2gc.c

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 * GC related routines
michael@0 8 *
michael@0 9 */
michael@0 10 #include "primpl.h"
michael@0 11
michael@0 12 PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
michael@0 13 {
michael@0 14 CONTEXTRECORD context;
michael@0 15 context.ContextFlags = CONTEXT_INTEGER;
michael@0 16
michael@0 17 if (_PR_IS_NATIVE_THREAD(t)) {
michael@0 18 context.ContextFlags |= CONTEXT_CONTROL;
michael@0 19 if (QueryThreadContext(t->md.handle, CONTEXT_CONTROL, &context)) {
michael@0 20 t->md.gcContext[0] = context.ctx_RegEax;
michael@0 21 t->md.gcContext[1] = context.ctx_RegEbx;
michael@0 22 t->md.gcContext[2] = context.ctx_RegEcx;
michael@0 23 t->md.gcContext[3] = context.ctx_RegEdx;
michael@0 24 t->md.gcContext[4] = context.ctx_RegEsi;
michael@0 25 t->md.gcContext[5] = context.ctx_RegEdi;
michael@0 26 t->md.gcContext[6] = context.ctx_RegEsp;
michael@0 27 t->md.gcContext[7] = context.ctx_RegEbp;
michael@0 28 *np = PR_NUM_GCREGS;
michael@0 29 } else {
michael@0 30 PR_ASSERT(0);/* XXX */
michael@0 31 }
michael@0 32 }
michael@0 33 return (PRWord *)&t->md.gcContext;
michael@0 34 }
michael@0 35
michael@0 36 /* This function is not used right now, but is left as a reference.
michael@0 37 * If you ever need to get the fiberID from the currently running fiber,
michael@0 38 * this is it.
michael@0 39 */
michael@0 40 void *
michael@0 41 GetMyFiberID()
michael@0 42 {
michael@0 43 void *fiberData = 0;
michael@0 44
michael@0 45 /* A pointer to our tib entry is found at FS:[18]
michael@0 46 * At offset 10h is the fiberData pointer. The context of the
michael@0 47 * fiber is stored in there.
michael@0 48 */
michael@0 49 #ifdef HAVE_ASM
michael@0 50 __asm {
michael@0 51 mov EDX, FS:[18h]
michael@0 52 mov EAX, DWORD PTR [EDX+10h]
michael@0 53 mov [fiberData], EAX
michael@0 54 }
michael@0 55 #endif
michael@0 56
michael@0 57 return fiberData;
michael@0 58 }

mercurial