Home | History | Annotate | Line # | Download | only in arm
cpu_arm.c revision 1.2
      1  1.2  jmcneill /* $NetBSD: cpu_arm.c,v 1.2 2013/11/11 13:52:04 jmcneill Exp $ */
      2  1.1  jmcneill 
      3  1.1  jmcneill /*-
      4  1.1  jmcneill  * Copyright (c) 2011 Reinoud Zandijk <reinoud (at) netbsd.org>
      5  1.1  jmcneill  * Copyright (c) 2007, 2013 Jared D. McNeill <jmcneill (at) invisible.ca>
      6  1.1  jmcneill  * All rights reserved.
      7  1.1  jmcneill  *
      8  1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
      9  1.1  jmcneill  * modification, are permitted provided that the following conditions
     10  1.1  jmcneill  * are met:
     11  1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     12  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     13  1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     15  1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     16  1.1  jmcneill  *
     17  1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18  1.1  jmcneill  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19  1.1  jmcneill  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  1.1  jmcneill  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21  1.1  jmcneill  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  1.1  jmcneill  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  1.1  jmcneill  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  1.1  jmcneill  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  1.1  jmcneill  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  1.1  jmcneill  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27  1.1  jmcneill  * POSSIBILITY OF SUCH DAMAGE.
     28  1.1  jmcneill  */
     29  1.1  jmcneill 
     30  1.1  jmcneill /*
     31  1.1  jmcneill  * Note that this machdep.c uses the `dummy' mcontext_t defined for usermode.
     32  1.1  jmcneill  * This is basicly a blob of PAGE_SIZE big. We might want to switch over to
     33  1.1  jmcneill  * non-generic mcontext_t's one day, but will this break non-NetBSD hosts?
     34  1.1  jmcneill  */
     35  1.1  jmcneill 
     36  1.1  jmcneill #include <sys/cdefs.h>
     37  1.2  jmcneill __KERNEL_RCSID(0, "$NetBSD: cpu_arm.c,v 1.2 2013/11/11 13:52:04 jmcneill Exp $");
     38  1.1  jmcneill 
     39  1.1  jmcneill #include <sys/types.h>
     40  1.1  jmcneill #include <sys/systm.h>
     41  1.1  jmcneill #include <sys/param.h>
     42  1.1  jmcneill #include <sys/time.h>
     43  1.1  jmcneill #include <sys/exec.h>
     44  1.1  jmcneill #include <sys/buf.h>
     45  1.1  jmcneill #include <sys/boot_flag.h>
     46  1.1  jmcneill #include <sys/ucontext.h>
     47  1.1  jmcneill #include <sys/utsname.h>
     48  1.1  jmcneill #include <machine/pcb.h>
     49  1.1  jmcneill #include <machine/psl.h>
     50  1.1  jmcneill 
     51  1.1  jmcneill #include <uvm/uvm_extern.h>
     52  1.1  jmcneill #include <uvm/uvm_page.h>
     53  1.1  jmcneill 
     54  1.1  jmcneill #include <dev/mm.h>
     55  1.1  jmcneill #include <machine/machdep.h>
     56  1.1  jmcneill #include <machine/thunk.h>
     57  1.1  jmcneill 
     58  1.1  jmcneill #include "opt_exec.h"
     59  1.1  jmcneill 
     60  1.1  jmcneill /* from sys/arch/arm/include/frame.h : KEEP IN SYNC */
     61  1.1  jmcneill struct sigframe_siginfo {
     62  1.1  jmcneill 	siginfo_t	sf_si;		/* actual saved siginfo */
     63  1.1  jmcneill 	ucontext_t	sf_uc;		/* actual saved ucontext */
     64  1.1  jmcneill };
     65  1.1  jmcneill 
     66  1.1  jmcneill void
     67  1.1  jmcneill sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
     68  1.1  jmcneill {
     69  1.1  jmcneill 	panic("sendsig_siginfo not implemented");
     70  1.1  jmcneill }
     71  1.1  jmcneill 
     72  1.1  jmcneill void
     73  1.1  jmcneill setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
     74  1.1  jmcneill {
     75  1.1  jmcneill 	panic("sendsig_siginfo not implemented");
     76  1.1  jmcneill }
     77  1.1  jmcneill 
     78  1.1  jmcneill void
     79  1.1  jmcneill md_syscall_get_syscallnumber(ucontext_t *ucp, uint32_t *code)
     80  1.1  jmcneill {
     81  1.1  jmcneill 	panic("md_syscall_get_syscallnumber not implemented");
     82  1.1  jmcneill }
     83  1.1  jmcneill 
     84  1.1  jmcneill int
     85  1.1  jmcneill md_syscall_getargs(lwp_t *l, ucontext_t *ucp, int nargs, int argsize,
     86  1.1  jmcneill 	register_t *args)
     87  1.1  jmcneill {
     88  1.1  jmcneill 	panic("md_syscall_getargs not implemented");
     89  1.1  jmcneill 	return 0;
     90  1.1  jmcneill }
     91  1.1  jmcneill 
     92  1.1  jmcneill void
     93  1.1  jmcneill md_syscall_set_returnargs(lwp_t *l, ucontext_t *ucp,
     94  1.1  jmcneill 	int error, register_t *rval)
     95  1.1  jmcneill {
     96  1.1  jmcneill 	panic("md_syscall_set_returnargs not implemented");
     97  1.1  jmcneill }
     98  1.1  jmcneill 
     99  1.1  jmcneill register_t
    100  1.1  jmcneill md_get_pc(ucontext_t *ucp)
    101  1.1  jmcneill {
    102  1.2  jmcneill 	unsigned int *reg = (unsigned int *)&ucp->uc_mcontext;
    103  1.2  jmcneill 	return reg[15];
    104  1.1  jmcneill }
    105  1.1  jmcneill 
    106  1.1  jmcneill register_t
    107  1.1  jmcneill md_get_sp(ucontext_t *ucp)
    108  1.1  jmcneill {
    109  1.2  jmcneill 	unsigned int *reg = (unsigned int *)&ucp->uc_mcontext;
    110  1.2  jmcneill 	return reg[13];
    111  1.1  jmcneill }
    112  1.1  jmcneill 
    113  1.1  jmcneill int
    114  1.1  jmcneill md_syscall_check_opcode(ucontext_t *ucp)
    115  1.1  jmcneill {
    116  1.1  jmcneill 	panic("md_syscall_check_opcode not implemented");
    117  1.1  jmcneill 	return 0;
    118  1.1  jmcneill }
    119  1.1  jmcneill 
    120  1.1  jmcneill void
    121  1.1  jmcneill md_syscall_get_opcode(ucontext_t *ucp, uint32_t *opcode)
    122  1.1  jmcneill {
    123  1.1  jmcneill 	panic("md_syscall_get_opcode not implemented");
    124  1.1  jmcneill }
    125  1.1  jmcneill 
    126  1.1  jmcneill void
    127  1.1  jmcneill md_syscall_inc_pc(ucontext_t *ucp, uint32_t opcode)
    128  1.1  jmcneill {
    129  1.1  jmcneill 	panic("md_syscall_inc_pc not implemented");
    130  1.1  jmcneill }
    131  1.1  jmcneill 
    132  1.1  jmcneill void
    133  1.1  jmcneill md_syscall_dec_pc(ucontext_t *ucp, uint32_t opcode)
    134  1.1  jmcneill {
    135  1.1  jmcneill 	panic("md_syscall_dec_pc not implemented");
    136  1.1  jmcneill }
    137  1.1  jmcneill 
    138