libpthread_md.c revision 169187
1178476Sjb/*
2178476Sjb * Copyright (c) 2006 Marcel Moolenaar
3178476Sjb * All rights reserved.
4178476Sjb *
5178476Sjb * Redistribution and use in source and binary forms, with or without
6178476Sjb * modification, are permitted provided that the following conditions
7178476Sjb * are met:
8178476Sjb * 1. Redistributions of source code must retain the above copyright
9178476Sjb *    notice, this list of conditions and the following disclaimer.
10178476Sjb * 2. Redistributions in binary form must reproduce the above copyright
11178476Sjb *    notice, this list of conditions and the following disclaimer in the
12178476Sjb *    documentation and/or other materials provided with the distribution.
13178476Sjb *
14178476Sjb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15178476Sjb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16178476Sjb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17178476Sjb * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18178476Sjb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19178476Sjb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20178476Sjb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21178476Sjb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22178476Sjb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23178476Sjb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24178476Sjb * SUCH DAMAGE.
25178476Sjb */
26178476Sjb
27178476Sjb#include <sys/cdefs.h>
28178476Sjb__FBSDID("$FreeBSD: head/lib/libthread_db/arch/powerpc/libpthread_md.c 169187 2007-05-01 18:28:08Z marcel $");
29178476Sjb
30178476Sjb#include <string.h>
31178476Sjb#include <sys/types.h>
32178476Sjb#include <proc_service.h>
33178476Sjb#include <thread_db.h>
34178476Sjb
35178476Sjb#include "libpthread_db.h"
36178476Sjb
37178476Sjbvoid
38178476Sjbpt_reg_to_ucontext(const struct reg *r, ucontext_t *uc)
39178476Sjb{
40178476Sjb	mcontext_t *mc = &uc->uc_mcontext;
41178476Sjb
42178476Sjb	memcpy(mc->mc_frame, r, MIN(sizeof(mc->mc_frame), sizeof(*r)));
43178476Sjb}
44178476Sjb
45178476Sjbvoid
46178476Sjbpt_ucontext_to_reg(const ucontext_t *uc, struct reg *r)
47178476Sjb{
48178476Sjb	const mcontext_t *mc = &uc->uc_mcontext;
49178476Sjb
50178476Sjb	memcpy(r, mc->mc_frame, MIN(sizeof(mc->mc_frame), sizeof(*r)));
51178476Sjb}
52178476Sjb
53178476Sjbvoid
54178476Sjbpt_fpreg_to_ucontext(const struct fpreg *r, ucontext_t *uc)
55178476Sjb{
56178476Sjb	mcontext_t *mc = &uc->uc_mcontext;
57178476Sjb
58178476Sjb	memcpy(mc->mc_fpreg, r, MIN(sizeof(mc->mc_fpreg), sizeof(*r)));
59178476Sjb	mc->mc_flags |= _MC_FP_VALID;
60178476Sjb}
61178476Sjb
62178476Sjbvoid
63178476Sjbpt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r)
64178476Sjb{
65178476Sjb	const mcontext_t *mc = &uc->uc_mcontext;
66178476Sjb
67178476Sjb	if (mc->mc_flags & _MC_FP_VALID)
68178476Sjb		memcpy(r, mc->mc_fpreg, MIN(sizeof(mc->mc_fpreg), sizeof(*r)));
69178476Sjb	else
70178476Sjb		memset(r, 0, sizeof(*r));
71178476Sjb}
72178476Sjb
73void
74pt_md_init(void)
75{
76}
77
78int
79pt_reg_sstep(struct reg *reg, int step)
80{
81
82	/* XXX */
83}
84