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