vm_machdep.c revision 81337
1/*-
2 * Copyright (c) 2001 Jake Burkholder.
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 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/sparc64/sparc64/vm_machdep.c 81337 2001-08-09 02:32:05Z obrien $
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/proc.h>
32#include <sys/bio.h>
33#include <sys/buf.h>
34#include <sys/unistd.h>
35#include <sys/user.h>
36
37#include <dev/ofw/openfirm.h>
38
39#include <vm/vm.h>
40#include <vm/vm_extern.h>
41
42#include <machine/cpu.h>
43#include <machine/frame.h>
44#include <machine/md_var.h>
45
46void
47cpu_exit(struct proc *p)
48{
49	TODO;
50}
51
52void
53cpu_fork(struct proc *p1, struct proc *p2, int flags)
54{
55	struct trapframe *tf;
56	struct frame *fp;
57	struct pcb *pcb;
58
59	if ((flags & RFPROC) == 0)
60		return;
61
62	pcb = &p2->p_addr->u_pcb;
63	if ((p1->p_frame->tf_tstate & TSTATE_PEF) != 0) {
64		mtx_lock_spin(&sched_lock);
65		savefpctx(&p1->p_addr->u_pcb.pcb_fpstate);
66		mtx_unlock_spin(&sched_lock);
67	}
68	bcopy(&p1->p_addr->u_pcb, pcb, sizeof(*pcb));
69
70	tf = (struct trapframe *)((caddr_t)pcb + UPAGES * PAGE_SIZE) - 1;
71	bcopy(p1->p_frame, tf, sizeof(*tf));
72	p2->p_frame = tf;
73
74	fp = (struct frame *)tf - 1;
75	fp->f_local[0] = (u_long)fork_return;
76	fp->f_local[1] = (u_long)p2;
77	fp->f_local[2] = (u_long)tf;
78	pcb->pcb_fp = (u_long)fp - SPOFF;
79	pcb->pcb_pc = (u_long)fork_trampoline - 8;
80}
81
82void
83cpu_reset(void)
84{
85	OF_exit();
86}
87
88void
89cpu_set_fork_handler(struct proc *p, void (*func)(void *), void *arg)
90{
91	struct frame *fp;
92	struct pcb *pcb;
93
94	pcb = &p->p_addr->u_pcb;
95	fp = (struct frame *)(pcb->pcb_fp + SPOFF);
96	fp->f_local[0] = (u_long)func;
97	fp->f_local[1] = (u_long)arg;
98}
99
100void
101cpu_wait(struct proc *p)
102{
103	TODO;
104}
105
106void
107swi_vm(void *v)
108{
109	TODO;
110}
111
112int
113vm_fault_quick(caddr_t v, int prot)
114{
115	TODO;
116	return (0);
117}
118
119void
120vmapbuf(struct buf *bp)
121{
122	TODO;
123}
124
125void
126vunmapbuf(struct buf *bp)
127{
128	TODO;
129}
130