diff options
author | dfr <dfr@FreeBSD.org> | 2005-05-31 09:43:04 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2005-05-31 09:43:04 +0000 |
commit | 874478d7fd90e4178b95bc5a6f3b15c0c057c491 (patch) | |
tree | 6e75a2cdc72929f6a8fcd18615399aea3228d568 /sys/i386 | |
parent | 0d07e4ee86c5f875d30d214612b6aea86b793a5a (diff) | |
download | FreeBSD-src-874478d7fd90e4178b95bc5a6f3b15c0c057c491.zip FreeBSD-src-874478d7fd90e4178b95bc5a6f3b15c0c057c491.tar.gz |
Add support for XMM registers in GDB for x86 processors that support
SSE (or its successors).
Reviewed by: marcel, davidxu
MFC After: 2 weeks
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/ptrace_machdep.c | 62 | ||||
-rw-r--r-- | sys/i386/include/ptrace.h | 5 | ||||
-rw-r--r-- | sys/i386/include/reg.h | 12 |
3 files changed, 79 insertions, 0 deletions
diff --git a/sys/i386/i386/ptrace_machdep.c b/sys/i386/i386/ptrace_machdep.c new file mode 100644 index 0000000..545bb20 --- /dev/null +++ b/sys/i386/i386/ptrace_machdep.c @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2005 Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/proc.h> +#include <sys/ptrace.h> +#include <machine/md_var.h> +#include <machine/pcb.h> + +int +cpu_ptrace(struct thread *td, int req, void *addr, int data) +{ + int error; + + if (!cpu_fxsr) + return (EINVAL); + + switch (req) { + case PT_GETXMMREGS: + error = copyout(&td->td_pcb->pcb_save.sv_xmm, addr, + sizeof(td->td_pcb->pcb_save.sv_xmm)); + break; + + case PT_SETXMMREGS: + error = copyin(addr, &td->td_pcb->pcb_save.sv_xmm, + sizeof(td->td_pcb->pcb_save.sv_xmm)); + break; + + default: + return (EINVAL); + } + + return (error); +} diff --git a/sys/i386/include/ptrace.h b/sys/i386/include/ptrace.h index eef24f8..24eb411 100644 --- a/sys/i386/include/ptrace.h +++ b/sys/i386/include/ptrace.h @@ -33,4 +33,9 @@ #ifndef _MACHINE_PTRACE_H_ #define _MACHINE_PTRACE_H_ +#define __HAVE_PTRACE_MACHDEP + +#define PT_GETXMMREGS (PT_FIRSTMACH + 0) +#define PT_SETXMMREGS (PT_FIRSTMACH + 1) + #endif diff --git a/sys/i386/include/reg.h b/sys/i386/include/reg.h index 5060bb6..dbafd4b 100644 --- a/sys/i386/include/reg.h +++ b/sys/i386/include/reg.h @@ -114,6 +114,18 @@ struct fpreg { unsigned char fpr_pad[64]; }; +struct xmmreg { + /* + * XXX should get struct from npx.h. Here we give a slightly + * simplified struct. This may be too much detail. Perhaps + * an array of unsigned longs is best. + */ + unsigned long xmm_env[8]; + unsigned char xmm_acc[8][16]; + unsigned char xmm_reg[8][16]; + unsigned char xmm_pad[224]; +}; + /* * Register set accessible via /proc/$pid/dbregs. */ |