libpthread_md.c revision 181341
1160971Smarcel/* 2160971Smarcel * Copyright (c) 2006 Marcel Moolenaar 3160971Smarcel * All rights reserved. 4160971Smarcel * 5160971Smarcel * Redistribution and use in source and binary forms, with or without 6160971Smarcel * modification, are permitted provided that the following conditions 7160971Smarcel * are met: 8160971Smarcel * 1. Redistributions of source code must retain the above copyright 9160971Smarcel * notice, this list of conditions and the following disclaimer. 10160971Smarcel * 2. Redistributions in binary form must reproduce the above copyright 11160971Smarcel * notice, this list of conditions and the following disclaimer in the 12160971Smarcel * documentation and/or other materials provided with the distribution. 13160971Smarcel * 14160971Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15160971Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16160971Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17160971Smarcel * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18160971Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19160971Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20160971Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21160971Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22160971Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23160971Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24160971Smarcel * SUCH DAMAGE. 25160971Smarcel */ 26160971Smarcel 27160971Smarcel#include <sys/cdefs.h> 28160971Smarcel__FBSDID("$FreeBSD: head/lib/libthread_db/arch/powerpc/libpthread_md.c 181341 2008-08-06 03:14:18Z marcel $"); 29160971Smarcel 30181059Smarcel#include <sys/types.h> 31160971Smarcel#include <string.h> 32160971Smarcel#include <thread_db.h> 33160971Smarcel 34160971Smarcel#include "libpthread_db.h" 35160971Smarcel 36160971Smarcelvoid 37160971Smarcelpt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) 38160971Smarcel{ 39169187Smarcel mcontext_t *mc = &uc->uc_mcontext; 40169187Smarcel 41169187Smarcel memcpy(mc->mc_frame, r, MIN(sizeof(mc->mc_frame), sizeof(*r))); 42160971Smarcel} 43160971Smarcel 44160971Smarcelvoid 45160971Smarcelpt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) 46160971Smarcel{ 47169187Smarcel const mcontext_t *mc = &uc->uc_mcontext; 48169187Smarcel 49169187Smarcel memcpy(r, mc->mc_frame, MIN(sizeof(mc->mc_frame), sizeof(*r))); 50160971Smarcel} 51160971Smarcel 52160971Smarcelvoid 53169187Smarcelpt_fpreg_to_ucontext(const struct fpreg *r, ucontext_t *uc) 54160971Smarcel{ 55169187Smarcel mcontext_t *mc = &uc->uc_mcontext; 56169187Smarcel 57169187Smarcel memcpy(mc->mc_fpreg, r, MIN(sizeof(mc->mc_fpreg), sizeof(*r))); 58169187Smarcel mc->mc_flags |= _MC_FP_VALID; 59160971Smarcel} 60160971Smarcel 61160971Smarcelvoid 62160971Smarcelpt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) 63160971Smarcel{ 64169187Smarcel const mcontext_t *mc = &uc->uc_mcontext; 65169187Smarcel 66169187Smarcel if (mc->mc_flags & _MC_FP_VALID) 67169187Smarcel memcpy(r, mc->mc_fpreg, MIN(sizeof(mc->mc_fpreg), sizeof(*r))); 68169187Smarcel else 69169187Smarcel memset(r, 0, sizeof(*r)); 70160971Smarcel} 71160971Smarcel 72160971Smarcelvoid 73160971Smarcelpt_md_init(void) 74160971Smarcel{ 75160971Smarcel} 76160971Smarcel 77160971Smarcelint 78181341Smarcelpt_reg_sstep(struct reg *reg __unused, int step __unused) 79160971Smarcel{ 80169187Smarcel 81169187Smarcel /* XXX */ 82181044Smarcel return (0); 83160971Smarcel} 84