1946 return (TD_DBERR);
1947 }
1948
1949 if (ps_lsetfpregs(ph_p, thr_to_lwpid(th_p), fpregset) != PS_OK)
1950 return_val = TD_DBERR;
1951
1952 (void) ps_pcontinue(ph_p);
1953 ph_unlock(th_p->th_ta_p);
1954 return (return_val);
1955 }
1956
1957 /*
1958 * Get the size of the extra state register set for this architecture.
1959 * Currently unused by dbx.
1960 */
1961 #pragma weak td_thr_getxregsize = __td_thr_getxregsize
1962 /* ARGSUSED */
1963 td_err_e
1964 __td_thr_getxregsize(td_thrhandle_t *th_p, int *xregsize)
1965 {
1966 #if defined(__sparc)
1967 struct ps_prochandle *ph_p;
1968 td_err_e return_val;
1969
1970 if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
1971 return (return_val);
1972 if (ps_pstop(ph_p) != PS_OK) {
1973 ph_unlock(th_p->th_ta_p);
1974 return (TD_DBERR);
1975 }
1976
1977 if (ps_lgetxregsize(ph_p, thr_to_lwpid(th_p), xregsize) != PS_OK)
1978 return_val = TD_DBERR;
1979
1980 (void) ps_pcontinue(ph_p);
1981 ph_unlock(th_p->th_ta_p);
1982 return (return_val);
1983 #else /* __sparc */
1984 return (TD_NOXREGS);
1985 #endif /* __sparc */
1986 }
1987
1988 /*
1989 * Get a thread's extra state register set.
1990 */
1991 #pragma weak td_thr_getxregs = __td_thr_getxregs
1992 /* ARGSUSED */
1993 td_err_e
1994 __td_thr_getxregs(td_thrhandle_t *th_p, void *xregset)
1995 {
1996 #if defined(__sparc)
1997 struct ps_prochandle *ph_p;
1998 td_err_e return_val;
1999
2000 if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
2001 return (return_val);
2002 if (ps_pstop(ph_p) != PS_OK) {
2003 ph_unlock(th_p->th_ta_p);
2004 return (TD_DBERR);
2005 }
2006
2007 if (ps_lgetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK)
2008 return_val = TD_DBERR;
2009
2010 (void) ps_pcontinue(ph_p);
2011 ph_unlock(th_p->th_ta_p);
2012 return (return_val);
2013 #else /* __sparc */
2014 return (TD_NOXREGS);
2015 #endif /* __sparc */
2016 }
2017
2018 /*
2019 * Set a thread's extra state register set.
2020 */
2021 #pragma weak td_thr_setxregs = __td_thr_setxregs
2022 /* ARGSUSED */
2023 td_err_e
2024 __td_thr_setxregs(td_thrhandle_t *th_p, const void *xregset)
2025 {
2026 #if defined(__sparc)
2027 struct ps_prochandle *ph_p;
2028 td_err_e return_val;
2029
2030 if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
2031 return (return_val);
2032 if (ps_pstop(ph_p) != PS_OK) {
2033 ph_unlock(th_p->th_ta_p);
2034 return (TD_DBERR);
2035 }
2036
2037 if (ps_lsetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK)
2038 return_val = TD_DBERR;
2039
2040 (void) ps_pcontinue(ph_p);
2041 ph_unlock(th_p->th_ta_p);
2042 return (return_val);
2043 #else /* __sparc */
2044 return (TD_NOXREGS);
2045 #endif /* __sparc */
2046 }
2047
2048 struct searcher {
2049 psaddr_t addr;
2050 int status;
2051 };
2052
2053 /*
2054 * Check the struct thread address in *th_p again first
2055 * value in "data". If value in data is found, set second value
2056 * in "data" to 1 and return 1 to terminate iterations.
2057 * This function is used by td_thr_validate() to verify that
2058 * a thread handle is valid.
2059 */
2060 static int
2061 td_searcher(const td_thrhandle_t *th_p, void *data)
2062 {
2063 struct searcher *searcher_data = (struct searcher *)data;
2064
2065 if (searcher_data->addr == th_p->th_unique) {
|
1946 return (TD_DBERR);
1947 }
1948
1949 if (ps_lsetfpregs(ph_p, thr_to_lwpid(th_p), fpregset) != PS_OK)
1950 return_val = TD_DBERR;
1951
1952 (void) ps_pcontinue(ph_p);
1953 ph_unlock(th_p->th_ta_p);
1954 return (return_val);
1955 }
1956
1957 /*
1958 * Get the size of the extra state register set for this architecture.
1959 * Currently unused by dbx.
1960 */
1961 #pragma weak td_thr_getxregsize = __td_thr_getxregsize
1962 /* ARGSUSED */
1963 td_err_e
1964 __td_thr_getxregsize(td_thrhandle_t *th_p, int *xregsize)
1965 {
1966 struct ps_prochandle *ph_p;
1967 td_err_e return_val;
1968
1969 if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
1970 return (return_val);
1971 if (ps_pstop(ph_p) != PS_OK) {
1972 ph_unlock(th_p->th_ta_p);
1973 return (TD_DBERR);
1974 }
1975
1976 if (ps_lgetxregsize(ph_p, thr_to_lwpid(th_p), xregsize) != PS_OK)
1977 return_val = TD_DBERR;
1978
1979 (void) ps_pcontinue(ph_p);
1980 ph_unlock(th_p->th_ta_p);
1981 return (return_val);
1982 }
1983
1984 /*
1985 * Get a thread's extra state register set.
1986 */
1987 #pragma weak td_thr_getxregs = __td_thr_getxregs
1988 /* ARGSUSED */
1989 td_err_e
1990 __td_thr_getxregs(td_thrhandle_t *th_p, void *xregset)
1991 {
1992 struct ps_prochandle *ph_p;
1993 td_err_e return_val;
1994
1995 if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
1996 return (return_val);
1997 if (ps_pstop(ph_p) != PS_OK) {
1998 ph_unlock(th_p->th_ta_p);
1999 return (TD_DBERR);
2000 }
2001
2002 if (ps_lgetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK)
2003 return_val = TD_DBERR;
2004
2005 (void) ps_pcontinue(ph_p);
2006 ph_unlock(th_p->th_ta_p);
2007 return (return_val);
2008 }
2009
2010 /*
2011 * Set a thread's extra state register set.
2012 */
2013 #pragma weak td_thr_setxregs = __td_thr_setxregs
2014 /* ARGSUSED */
2015 td_err_e
2016 __td_thr_setxregs(td_thrhandle_t *th_p, const void *xregset)
2017 {
2018 struct ps_prochandle *ph_p;
2019 td_err_e return_val;
2020
2021 if ((ph_p = ph_lock_th(th_p, &return_val)) == NULL)
2022 return (return_val);
2023 if (ps_pstop(ph_p) != PS_OK) {
2024 ph_unlock(th_p->th_ta_p);
2025 return (TD_DBERR);
2026 }
2027
2028 if (ps_lsetxregs(ph_p, thr_to_lwpid(th_p), (caddr_t)xregset) != PS_OK)
2029 return_val = TD_DBERR;
2030
2031 (void) ps_pcontinue(ph_p);
2032 ph_unlock(th_p->th_ta_p);
2033 return (return_val);
2034 }
2035
2036 struct searcher {
2037 psaddr_t addr;
2038 int status;
2039 };
2040
2041 /*
2042 * Check the struct thread address in *th_p again first
2043 * value in "data". If value in data is found, set second value
2044 * in "data" to 1 and return 1 to terminate iterations.
2045 * This function is used by td_thr_validate() to verify that
2046 * a thread handle is valid.
2047 */
2048 static int
2049 td_searcher(const td_thrhandle_t *th_p, void *data)
2050 {
2051 struct searcher *searcher_data = (struct searcher *)data;
2052
2053 if (searcher_data->addr == th_p->th_unique) {
|