+Wed Mar 1 00:49:06 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ From 2000-02-28 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>:
+ Make NEW_PROC_ABI interface functional on Solaris x86.
+ * sol-thread.c (ps_lgetLDT): Rewrite to use new
+ procfs_find_LDT_entry function from procfs.c, mostly copied from
+ lin-thread.c.
+ * inferior.h, procfs.c (procfs_get_pid_fd): Removed, no longer
+ needed.
+
Wed Mar 1 00:34:55 2000 Andrew Cagney <cagney@b1.cygnus.com>
From 2000-02-26 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>:
#ifdef TM_I386SOL2_H
-/* Get local descriptor table. */
-
-#include <sys/procfs.h>
-#include <sys/reg.h>
-#include <sys/sysi86.h>
-
-static int nldt_allocated = 0;
-static struct ssd *ldt_bufp = NULL;
-
/* Reads the local descriptor table of a LWP. */
ps_err_e
ps_lgetLDT (gdb_ps_prochandle_t ph, lwpid_t lwpid,
struct ssd *pldt)
{
- gregset_t gregset;
- int lwp_fd;
- ps_err_e val;
- int nldt;
- int i;
-
- /* Get procfs file descriptor for the LWP. */
- lwp_fd = procfs_get_pid_fd (BUILD_LWP (lwpid, PIDGET (inferior_pid)));
- if (lwp_fd < 0)
- return PS_BADLID;
-
- /* Fetch registers und LDT descriptors. */
- if (ioctl (lwp_fd, PIOCGREG, &gregset) == -1)
- return PS_ERR;
+ /* NOTE: only used on Solaris, therefore OK to refer to procfs.c */
+ extern struct ssd *procfs_find_LDT_entry (int);
+ struct ssd *ret;
- if (ioctl (lwp_fd, PIOCNLDT, &nldt) == -1)
- return PS_ERR;
-
- if (nldt_allocated < nldt)
+ ret = procfs_find_LDT_entry (BUILD_LWP (lwpid, PIDGET (inferior_pid)));
+ if (ret)
{
- ldt_bufp
- = (struct ssd *) xrealloc (ldt_bufp, (nldt + 1) * sizeof (struct ssd));
- nldt_allocated = nldt;
+ memcpy (pldt, ret, sizeof (struct ssd));
+ return PS_OK;
}
-
- if (ioctl (lwp_fd, PIOCLDT, ldt_bufp) == -1)
+ else /* LDT not found. */
return PS_ERR;
-
- /* Search LDT for the LWP via register GS. */
- for (i = 0; i < nldt; i++)
- {
- if (ldt_bufp[i].sel == (gregset[GS] & 0xffff))
- {
- *pldt = ldt_bufp[i];
- return PS_OK;
- }
- }
-
- /* LDT not found. */
- return PS_ERR;
}
#endif /* TM_I386SOL2_H */
\f