libpthread_md.c revision 256281
1/* 2 * Copyright (c) 2006-2007, Juniper Networks, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Neither the name of Juniper Networks nor the names of its contributors 15 * may be used to endorse or promote products derived from this software 16 * without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> 31__FBSDID("$FreeBSD: stable/10/lib/libthread_db/arch/mips/libpthread_md.c 182372 2008-08-28 15:41:12Z obrien $"); 32 33#include <sys/types.h> 34#include <sys/procfs.h> 35#include <ucontext.h> 36#include <string.h> 37#include <thread_db.h> 38#include "libpthread_db.h" 39 40void 41pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) 42{ 43 44 memcpy(uc->uc_mcontext.mc_regs, &r->r_regs[ZERO], 45 sizeof(uc->uc_mcontext.mc_regs)); 46 uc->uc_mcontext.mc_pc = r->r_regs[PC]; 47 uc->uc_mcontext.mullo = r->r_regs[MULLO]; 48 uc->uc_mcontext.mulhi = r->r_regs[MULHI]; 49} 50 51void 52pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) 53{ 54 memcpy(&r->r_regs[ZERO], uc->uc_mcontext.mc_regs, 55 sizeof(uc->uc_mcontext.mc_regs)); 56 r->r_regs[PC] = uc->uc_mcontext.mc_pc; 57 r->r_regs[MULLO] = uc->uc_mcontext.mullo; 58 r->r_regs[MULHI] = uc->uc_mcontext.mulhi; 59} 60 61void 62pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) 63{ 64 65 memcpy(uc->uc_mcontext.mc_fpregs, r->r_regs, 66 sizeof(uc->uc_mcontext.mc_fpregs)); 67} 68 69void 70pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) 71{ 72 73 memcpy(r->r_regs, uc->uc_mcontext.mc_fpregs, 74 sizeof(uc->uc_mcontext.mc_fpregs)); 75} 76 77void 78pt_md_init(void) 79{ 80 /* Nothing to do */ 81} 82 83int 84pt_reg_sstep(struct reg *reg __unused, int step __unused) 85{ 86 /* 87 * XXX: mips doesnt store single step info in any registers 88 */ 89 return (0); 90} 91