/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <string.h>
#include <errno.h>
#include <limits.h>
#include "Pcontrol.h"
#include "P32ton.h"
/*
* This file implements the routines to read and write per-lwp register
* information from either a live process or core file opened with libproc.
* We build up a few common routines for reading and writing register
* information, and then the public functions are all trivial calls to these.
*/
/*
* Utility function to return a pointer to the structure of cached information
* about an lwp in the core file, given its lwpid.
*/
static lwp_info_t *
{
uint_t i;
return (lwp);
}
return (NULL);
}
/*
* Utility function to open and read the contents of a per-lwp /proc file.
* This function is used to slurp in lwpstatus, xregs, and asrs.
*/
static int
{
int fd;
return (0);
}
}
return (-1);
}
/*
* Get the lwpstatus_t for an lwp from either the live process or our
* cached information from the core file. This is used to get the
* general-purpose registers or floating point registers.
*/
int
{
/*
* For both live processes and cores, our job is easy if the lwpid
* matches that of the representative lwp:
*/
return (0);
}
/*
* If this is a live process, then just read the information out
* of the per-lwp status file:
*/
lps, sizeof (lwpstatus_t)));
}
/*
* If this is a core file, we need to iterate through our list of
* cached lwp information and then copy out the status.
*/
return (0);
}
return (-1);
}
/*
* Utility function to modify lwp registers. This is done using either the
* process control file or per-lwp control file as necessary.
*/
static int
{
int fd;
return (-1);
}
/*
* Writing the process control file writes the representative lwp.
* Psync before we write to make sure we are consistent with the
* primary interfaces. Similarly, make sure to update P->status
* afterward if we are modifying one of its register sets.
*/
Psync(P);
return (-1);
return (0);
}
/*
* If the lwp we want is not the representative lwp, we need to
* open the ctl file for that specific lwp.
*/
return (0);
}
}
return (-1);
}
int
{
return (-1);
return (0);
}
int
{
}
int
{
return (-1);
return (0);
}
const prfpregset_t *fpregs)
{
}
int
{
return (-1);
}
return (-1);
}
xregs, sizeof (prxregset_t)));
}
return (0);
}
return (-1);
}
int
{
}
int
{
return (-1);
}
return (-1);
}
gwins, sizeof (gwindows_t)));
}
return (0);
}
return (-1);
}
#if defined(__sparcv9)
int
{
return (-1);
}
return (-1);
}
}
return (0);
}
return (-1);
}
int
{
}
#endif /* __sparcv9 */
#endif /* __sparc */
int
{
return (-1);
}
lps, sizeof (lwpsinfo_t)));
}
return (0);
}
return (-1);
}
int
{
return (-1);
}
return (-1);
return (-1);
}
}
return (0);
}
return (-1);
}
int
{
return (-1);
}
return (-1);
} else {
return (-1);
}
return (-1);
#ifdef _LP64
} else {
return (-1);
#endif
}
return (0);
}
int
{
return (-1);
}
return (-1);
} else {
return (-1);
}
/*
* Read out the current stack; if the SS_ONSTACK flag is set then
* this LWP is operating on the alternate signal stack. We can
* recover the original stack from pr_oldcontext.
*/
return (-1);
goto on_altstack;
#ifdef _LP64
} else {
return (-1);
goto on_altstack;
#endif
}
return (0);
return (-1);
#ifdef _LP64
} else {
return (-1);
#endif
}
return (0);
}
int
{
return (-1);
}
return (-1);
return (-1);
}
} else {
return (-1);
return (-1);
}
}
return (0);
}