libpthread_md.c revision 181044
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 181044 2008-07-31 05:25:52Z marcel $"); 29160971Smarcel 30160971Smarcel#include <string.h> 31160971Smarcel#include <sys/types.h> 32160971Smarcel#include <proc_service.h> 33160971Smarcel#include <thread_db.h> 34160971Smarcel 35160971Smarcel#include "libpthread_db.h" 36160971Smarcel 37160971Smarcelvoid 38160971Smarcelpt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) 39160971Smarcel{ 40169187Smarcel mcontext_t *mc = &uc->uc_mcontext; 41169187Smarcel 42169187Smarcel memcpy(mc->mc_frame, r, MIN(sizeof(mc->mc_frame), sizeof(*r))); 43160971Smarcel} 44160971Smarcel 45160971Smarcelvoid 46160971Smarcelpt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) 47160971Smarcel{ 48169187Smarcel const mcontext_t *mc = &uc->uc_mcontext; 49169187Smarcel 50169187Smarcel memcpy(r, mc->mc_frame, MIN(sizeof(mc->mc_frame), sizeof(*r))); 51160971Smarcel} 52160971Smarcel 53160971Smarcelvoid 54169187Smarcelpt_fpreg_to_ucontext(const struct fpreg *r, ucontext_t *uc) 55160971Smarcel{ 56169187Smarcel mcontext_t *mc = &uc->uc_mcontext; 57169187Smarcel 58169187Smarcel memcpy(mc->mc_fpreg, r, MIN(sizeof(mc->mc_fpreg), sizeof(*r))); 59169187Smarcel mc->mc_flags |= _MC_FP_VALID; 60160971Smarcel} 61160971Smarcel 62160971Smarcelvoid 63160971Smarcelpt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) 64160971Smarcel{ 65169187Smarcel const mcontext_t *mc = &uc->uc_mcontext; 66169187Smarcel 67169187Smarcel if (mc->mc_flags & _MC_FP_VALID) 68169187Smarcel memcpy(r, mc->mc_fpreg, MIN(sizeof(mc->mc_fpreg), sizeof(*r))); 69169187Smarcel else 70169187Smarcel memset(r, 0, sizeof(*r)); 71160971Smarcel} 72160971Smarcel 73160971Smarcelvoid 74160971Smarcelpt_md_init(void) 75160971Smarcel{ 76160971Smarcel} 77160971Smarcel 78160971Smarcelint 79160971Smarcelpt_reg_sstep(struct reg *reg, int step) 80160971Smarcel{ 81169187Smarcel 82169187Smarcel /* XXX */ 83181044Smarcel return (0); 84160971Smarcel} 85