machdep.c (82016) | machdep.c (82902) |
---|---|
1/*- 2 * Copyright (c) 2001 Jake Burkholder. | 1/*- 2 * Copyright (c) 2001 Jake Burkholder. |
3 * Copyright (c) 1992 Terrence R. Lambert. 4 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. |
|
3 * All rights reserved. 4 * | 5 * All rights reserved. 6 * |
7 * This code is derived from software contributed to Berkeley by 8 * William Jolitz. 9 * |
|
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. | 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. |
18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the University of 21 * California, Berkeley and its contributors. 22 * 4. Neither the name of the University nor the names of its contributors 23 * may be used to endorse or promote products derived from this software 24 * without specific prior written permission. |
|
13 * | 25 * |
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 | 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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 * | 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * |
26 * $FreeBSD: head/sys/sparc64/sparc64/machdep.c 82016 2001-08-21 00:07:37Z jake $ | 38 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 39 * from: FreeBSD: src/sys/i386/i386/machdep.c,v 1.477 2001/08/27 40 * $FreeBSD: head/sys/sparc64/sparc64/machdep.c 82902 2001-09-03 22:41:40Z jake $ |
27 */ 28 29#include "opt_ddb.h" 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/cons.h> 34#include <sys/kernel.h> 35#include <sys/linker.h> 36#include <sys/lock.h> 37#include <sys/mutex.h> 38#include <sys/pcpu.h> 39#include <sys/proc.h> 40#include <sys/bio.h> 41#include <sys/buf.h> 42#include <sys/ptrace.h> 43#include <sys/signalvar.h> | 41 */ 42 43#include "opt_ddb.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/cons.h> 48#include <sys/kernel.h> 49#include <sys/linker.h> 50#include <sys/lock.h> 51#include <sys/mutex.h> 52#include <sys/pcpu.h> 53#include <sys/proc.h> 54#include <sys/bio.h> 55#include <sys/buf.h> 56#include <sys/ptrace.h> 57#include <sys/signalvar.h> |
58#include <sys/sysent.h> |
|
44#include <sys/sysproto.h> 45#include <sys/timetc.h> 46#include <sys/user.h> | 59#include <sys/sysproto.h> 60#include <sys/timetc.h> 61#include <sys/user.h> |
62#include <sys/exec.h> |
|
47 48#include <dev/ofw/openfirm.h> 49 50#include <vm/vm.h> 51#include <vm/vm_param.h> 52#include <vm/vm_kern.h> 53#include <vm/vm_object.h> 54#include <vm/vm_page.h> 55#include <vm/vm_map.h> 56#include <vm/vm_pager.h> 57#include <vm/vm_extern.h> 58 59#include <ddb/ddb.h> 60 61#include <machine/bootinfo.h> 62#include <machine/clock.h> | 63 64#include <dev/ofw/openfirm.h> 65 66#include <vm/vm.h> 67#include <vm/vm_param.h> 68#include <vm/vm_kern.h> 69#include <vm/vm_object.h> 70#include <vm/vm_page.h> 71#include <vm/vm_map.h> 72#include <vm/vm_pager.h> 73#include <vm/vm_extern.h> 74 75#include <ddb/ddb.h> 76 77#include <machine/bootinfo.h> 78#include <machine/clock.h> |
63#include <machine/frame.h> | 79#include <machine/cpu.h> |
64#include <machine/intr_machdep.h> 65#include <machine/md_var.h> 66#include <machine/pmap.h> 67#include <machine/pstate.h> 68#include <machine/reg.h> | 80#include <machine/intr_machdep.h> 81#include <machine/md_var.h> 82#include <machine/pmap.h> 83#include <machine/pstate.h> 84#include <machine/reg.h> |
85#include <machine/sigframe.h> |
|
69#include <machine/tick.h> 70#include <machine/tstate.h> | 86#include <machine/tick.h> 87#include <machine/tstate.h> |
88#include <machine/ver.h> |
|
71 72typedef int ofw_vec_t(void *); 73 74extern char tl0_base[]; 75 76extern char _end[]; 77 78int physmem = 0; 79int cold = 1; 80long dumplo; 81int Maxmem = 0; 82 | 89 90typedef int ofw_vec_t(void *); 91 92extern char tl0_base[]; 93 94extern char _end[]; 95 96int physmem = 0; 97int cold = 1; 98long dumplo; 99int Maxmem = 0; 100 |
101u_long debug_mask; 102 |
|
83struct mtx Giant; 84struct mtx sched_lock; 85 86struct globaldata __globaldata; | 103struct mtx Giant; 104struct mtx sched_lock; 105 106struct globaldata __globaldata; |
87#define GLOBALSTACK_SZ 128 88u_long __globalstack[GLOBALSTACK_SZ]; | |
89/* 90 * This needs not be aligned as the other user areas, provided that process 0 91 * does not have an fp state (which it doesn't normally). 92 * This constraint is only here for debugging. 93 */ 94char user0[UPAGES * PAGE_SIZE] __attribute__ ((aligned (64))); 95struct user *proc0paddr; 96 | 107/* 108 * This needs not be aligned as the other user areas, provided that process 0 109 * does not have an fp state (which it doesn't normally). 110 * This constraint is only here for debugging. 111 */ 112char user0[UPAGES * PAGE_SIZE] __attribute__ ((aligned (64))); 113struct user *proc0paddr; 114 |
97vm_offset_t clean_sva; 98vm_offset_t clean_eva; | 115struct kva_md_info kmi; |
99 100u_long ofw_vec; 101u_long ofw_tba; 102 | 116 117u_long ofw_vec; 118u_long ofw_tba; 119 |
103static vm_offset_t buffer_sva; 104static vm_offset_t buffer_eva; 105static vm_offset_t pager_sva; 106static vm_offset_t pager_eva; 107 | |
108static struct timecounter tick_tc; 109 110static timecounter_get_t tick_get_timecount; 111void sparc64_init(struct bootinfo *bi, ofw_vec_t *vec); 112 113static void cpu_startup(void *); 114SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); 115 116static void 117cpu_startup(void *arg) 118{ | 120static struct timecounter tick_tc; 121 122static timecounter_get_t tick_get_timecount; 123void sparc64_init(struct bootinfo *bi, ofw_vec_t *vec); 124 125static void cpu_startup(void *); 126SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); 127 128static void 129cpu_startup(void *arg) 130{ |
119 vm_offset_t physmem_est; 120 vm_offset_t minaddr; 121 vm_offset_t maxaddr; | |
122 phandle_t child; 123 phandle_t root; | 131 phandle_t child; 132 phandle_t root; |
124 vm_offset_t va; 125 vm_size_t size; 126 char name[32]; | |
127 char type[8]; 128 u_int clock; | 133 char type[8]; 134 u_int clock; |
129 int factor; 130 caddr_t p; 131 int i; | |
132 133 root = OF_peer(0); 134 for (child = OF_child(root); child != 0; child = OF_peer(child)) { 135 OF_getprop(child, "device_type", type, sizeof(type)); 136 if (strcmp(type, "cpu") == 0) 137 break; 138 } 139 if (child == 0) 140 panic("cpu_startup: no cpu\n"); | 135 136 root = OF_peer(0); 137 for (child = OF_child(root); child != 0; child = OF_peer(child)) { 138 OF_getprop(child, "device_type", type, sizeof(type)); 139 if (strcmp(type, "cpu") == 0) 140 break; 141 } 142 if (child == 0) 143 panic("cpu_startup: no cpu\n"); |
141 OF_getprop(child, "name", name, sizeof(name)); | |
142 OF_getprop(child, "clock-frequency", &clock, sizeof(clock)); 143 144 tick_tc.tc_get_timecount = tick_get_timecount; 145 tick_tc.tc_poll_pps = NULL; 146 tick_tc.tc_counter_mask = ~0u; 147 tick_tc.tc_frequency = clock; 148 tick_tc.tc_name = "tick"; 149 tc_init(&tick_tc); --- 5 unchanged lines hidden (view full) --- 155 (clock + 4999) / 1000000, ((clock + 4999) / 10000) % 100); 156#if 0 157 ver = rdpr(ver); 158 printf("manuf: %#lx impl: %#lx mask: %#lx maxtl: %#lx maxwin: %#lx\n", 159 VER_MANUF(ver), VER_IMPL(ver), VER_MASK(ver), VER_MAXTL(ver), 160 VER_MAXWIN(ver)); 161#endif 162 | 144 OF_getprop(child, "clock-frequency", &clock, sizeof(clock)); 145 146 tick_tc.tc_get_timecount = tick_get_timecount; 147 tick_tc.tc_poll_pps = NULL; 148 tick_tc.tc_counter_mask = ~0u; 149 tick_tc.tc_frequency = clock; 150 tick_tc.tc_name = "tick"; 151 tc_init(&tick_tc); --- 5 unchanged lines hidden (view full) --- 157 (clock + 4999) / 1000000, ((clock + 4999) / 10000) % 100); 158#if 0 159 ver = rdpr(ver); 160 printf("manuf: %#lx impl: %#lx mask: %#lx maxtl: %#lx maxwin: %#lx\n", 161 VER_MANUF(ver), VER_IMPL(ver), VER_MASK(ver), VER_MAXTL(ver), 162 VER_MAXWIN(ver)); 163#endif 164 |
165 vm_ksubmap_init(&kmi); 166#if 0 |
|
163 /* 164 * XXX make most of this MI and move to sys/kern. 165 */ 166 167 /* 168 * Calculate callout wheel size. 169 */ 170 for (callwheelsize = 1, callwheelbits = 0; callwheelsize < ncallout; --- 69 unchanged lines hidden (view full) --- 240 callout[i].c_flags = CALLOUT_LOCAL_ALLOC; 241 SLIST_INSERT_HEAD(&callfree, &callout[i], c_links.sle); 242 } 243 244 for (i = 0; i < callwheelsize; i++) 245 TAILQ_INIT(&callwheel[i]); 246 247 mtx_init(&callout_lock, "callout", MTX_SPIN | MTX_RECURSE); | 167 /* 168 * XXX make most of this MI and move to sys/kern. 169 */ 170 171 /* 172 * Calculate callout wheel size. 173 */ 174 for (callwheelsize = 1, callwheelbits = 0; callwheelsize < ncallout; --- 69 unchanged lines hidden (view full) --- 244 callout[i].c_flags = CALLOUT_LOCAL_ALLOC; 245 SLIST_INSERT_HEAD(&callfree, &callout[i], c_links.sle); 246 } 247 248 for (i = 0; i < callwheelsize; i++) 249 TAILQ_INIT(&callwheel[i]); 250 251 mtx_init(&callout_lock, "callout", MTX_SPIN | MTX_RECURSE); |
252#endif |
|
248 249 bufinit(); 250 vm_pager_bufferinit(); 251 252 globaldata_register(globalp); | 253 254 bufinit(); 255 vm_pager_bufferinit(); 256 257 globaldata_register(globalp); |
253 | 258#if 0 |
254 tick_start(clock, tick_hardclock); | 259 tick_start(clock, tick_hardclock); |
260#endif |
|
255} 256 257unsigned 258tick_get_timecount(struct timecounter *tc) 259{ 260 return ((unsigned)rd(tick)); 261} 262 --- 75 unchanged lines hidden (view full) --- 338 * globaldata is tied to %g7. We could therefore also use assignments to 339 * globaldata here. 340 * The alternate %g6 additionally points to a small per-cpu stack that 341 * is used to temporarily store global registers in special spill 342 * handlers. 343 */ 344 ps = rdpr(pstate); 345 wrpr(pstate, ps, PSTATE_AG); | 261} 262 263unsigned 264tick_get_timecount(struct timecounter *tc) 265{ 266 return ((unsigned)rd(tick)); 267} 268 --- 75 unchanged lines hidden (view full) --- 344 * globaldata is tied to %g7. We could therefore also use assignments to 345 * globaldata here. 346 * The alternate %g6 additionally points to a small per-cpu stack that 347 * is used to temporarily store global registers in special spill 348 * handlers. 349 */ 350 ps = rdpr(pstate); 351 wrpr(pstate, ps, PSTATE_AG); |
352 __asm __volatile("mov %0, %%g6" : : "r" 353 (&__globaldata.gd_alt_stack[ALT_STACK_SIZE - 1])); |
|
346 __asm __volatile("mov %0, %%g7" : : "r" (&__globaldata)); | 354 __asm __volatile("mov %0, %%g7" : : "r" (&__globaldata)); |
347 __asm __volatile("mov %0, %%g6" : : 348 "r" (&__globalstack[GLOBALSTACK_SZ - 1])); | |
349 wrpr(pstate, ps, PSTATE_IG); 350 __asm __volatile("mov %0, %%g7" : : "r" (&__globaldata)); 351 wrpr(pstate, ps, 0); 352 353 /* 354 * Initialize curproc so that mutexes work. 355 */ 356 PCPU_SET(curproc, &proc0); --- 15 unchanged lines hidden (view full) --- 372{ 373 ofw_tba = rdpr(tba); 374 ofw_vec = (u_long)vec; 375} 376 377void 378sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) 379{ | 355 wrpr(pstate, ps, PSTATE_IG); 356 __asm __volatile("mov %0, %%g7" : : "r" (&__globaldata)); 357 wrpr(pstate, ps, 0); 358 359 /* 360 * Initialize curproc so that mutexes work. 361 */ 362 PCPU_SET(curproc, &proc0); --- 15 unchanged lines hidden (view full) --- 378{ 379 ofw_tba = rdpr(tba); 380 ofw_vec = (u_long)vec; 381} 382 383void 384sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) 385{ |
380 TODO; | 386 struct trapframe *tf; 387 struct sigframe *sfp; 388 struct sigacts *psp; 389 struct sigframe sf; 390 struct proc *p; 391 u_long sp; 392 int oonstack; 393 394 oonstack = 0; 395 p = curproc; 396 PROC_LOCK(p); 397 psp = p->p_sigacts; 398 tf = p->p_frame; 399 sp = tf->tf_sp + SPOFF; 400 oonstack = sigonstack(sp); 401 402 CTR4(KTR_SIG, "sendsig: p=%p (%s) catcher=%p sig=%d", p, p->p_comm, 403 catcher, sig); 404 405 /* Save user context. */ 406 bzero(&sf, sizeof(sf)); 407 sf.sf_uc.uc_sigmask = *mask; 408 sf.sf_uc.uc_stack = p->p_sigstk; 409 sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK) 410 ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; 411 sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; 412 bcopy(tf->tf_global, sf.sf_uc.uc_mcontext.mc_global, 413 sizeof (tf->tf_global)); 414 bcopy(tf->tf_out, sf.sf_uc.uc_mcontext.mc_out, sizeof (tf->tf_out)); 415 sf.sf_uc.uc_mcontext.mc_sp = tf->tf_sp; 416 sf.sf_uc.uc_mcontext.mc_tpc = tf->tf_tpc; 417 sf.sf_uc.uc_mcontext.mc_tnpc = tf->tf_tnpc; 418 sf.sf_uc.uc_mcontext.mc_tstate = tf->tf_tstate; 419 420 /* Allocate and validate space for the signal handler context. */ 421 if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack && 422 SIGISMEMBER(psp->ps_sigonstack, sig)) { 423 sfp = (struct sigframe *)(p->p_sigstk.ss_sp + 424 p->p_sigstk.ss_size - sizeof(struct sigframe)); 425#if defined(COMPAT_43) || defined(COMPAT_SUNOS) 426 p->p_sigstk.ss_flags |= SS_ONSTACK; 427#endif 428 } else 429 sfp = (struct sigframe *)sp - 1; 430 PROC_UNLOCK(p); 431 432 /* 433 * grow_stack() will return 0 if *sfp does not fit inside the stack 434 * and the stack can not be grown. 435 * useracc() will return FALSE if access is denied. 436 */ 437 if (vm_map_growstack(p, (u_long)sfp) != KERN_SUCCESS || 438 !useracc((caddr_t)sfp, sizeof(*sfp), VM_PROT_WRITE)) { 439 /* 440 * Process has trashed its stack; give it an illegal 441 * instruction to halt it in its tracks. 442 */ 443 CTR2(KTR_SIG, "sendsig: trashed stack p=%p sfp=%p", p, sfp); 444 PROC_LOCK(p); 445 SIGACTION(p, SIGILL) = SIG_DFL; 446 SIGDELSET(p->p_sigignore, SIGILL); 447 SIGDELSET(p->p_sigcatch, SIGILL); 448 SIGDELSET(p->p_sigmask, SIGILL); 449 psignal(p, SIGILL); 450 PROC_UNLOCK(p); 451 return; 452 } 453 454 /* Translate the signal if appropriate. */ 455 if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) 456 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 457 458 /* Build the argument list for the signal handler. */ 459 tf->tf_out[0] = sig; 460 tf->tf_out[2] = (register_t)&sfp->sf_uc; 461 tf->tf_out[3] = tf->tf_type; 462 tf->tf_out[4] = (register_t)catcher; 463 PROC_LOCK(p); 464 if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { 465 /* Signal handler installed with SA_SIGINFO. */ 466 tf->tf_out[1] = (register_t)&sfp->sf_si; 467 468 /* Fill siginfo structure. */ 469 sf.sf_si.si_signo = sig; 470 sf.sf_si.si_code = code; 471 sf.sf_si.si_addr = (void *)tf->tf_type; 472 } else { 473 /* Old FreeBSD-style arguments. */ 474 tf->tf_out[1] = code; 475 } 476 PROC_UNLOCK(p); 477 478 /* Copy the sigframe out to the user's stack. */ 479 if (rwindow_save(p) != 0 || copyout(&sf, sfp, sizeof(*sfp)) != 0) { 480 /* 481 * Something is wrong with the stack pointer. 482 * ...Kill the process. 483 */ 484 CTR2(KTR_SIG, "sendsig: sigexit p=%p sfp=%p", p, sfp); 485 PROC_LOCK(p); 486 sigexit(p, SIGILL); 487 /* NOTREACHED */ 488 } 489 490 tf->tf_tpc = PS_STRINGS - *(p->p_sysent->sv_szsigcode); 491 tf->tf_tnpc = tf->tf_tpc + 4; 492 tf->tf_sp = (u_long)sfp - SPOFF; 493 494 CTR3(KTR_SIG, "sendsig: return p=%p pc=%#lx sp=%#lx", p, tf->tf_tpc, 495 tf->tf_sp); |
381} 382 383#ifndef _SYS_SYSPROTO_H_ 384struct sigreturn_args { 385 ucontext_t *ucp; 386}; 387#endif 388 389int 390sigreturn(struct proc *p, struct sigreturn_args *uap) 391{ | 496} 497 498#ifndef _SYS_SYSPROTO_H_ 499struct sigreturn_args { 500 ucontext_t *ucp; 501}; 502#endif 503 504int 505sigreturn(struct proc *p, struct sigreturn_args *uap) 506{ |
392 TODO; 393 return (0); | 507 struct trapframe *tf; 508 ucontext_t uc; 509 510 if (rwindow_save(p)) { 511 PROC_LOCK(p); 512 sigexit(p, SIGILL); 513 } 514 515 CTR2(KTR_SIG, "sigreturn: p=%p ucp=%p", p, uap->sigcntxp); 516 if (copyin(uap->sigcntxp, &uc, sizeof(uc)) != 0) { 517 CTR1(KTR_SIG, "sigreturn: efault p=%p", p); 518 return (EFAULT); 519 } 520 521 if (((uc.uc_mcontext.mc_tpc | uc.uc_mcontext.mc_tnpc) & 3) != 0) 522 return (EINVAL); 523 524 tf = p->p_frame; 525 bcopy(uc.uc_mcontext.mc_global, tf->tf_global, 526 sizeof(tf->tf_global)); 527 bcopy(uc.uc_mcontext.mc_out, tf->tf_out, sizeof(tf->tf_out)); 528 tf->tf_sp = uc.uc_mcontext.mc_sp; 529 tf->tf_tpc = uc.uc_mcontext.mc_tpc; 530 tf->tf_tnpc = uc.uc_mcontext.mc_tnpc; 531 tf->tf_tstate = uc.uc_mcontext.mc_tstate; 532 PROC_LOCK(p); 533#if defined(COMPAT_43) || defined(COMPAT_SUNOS) 534 if (uc.uc_mcontext.mc_onstack & 1) 535 p->p_sigstk.ss_flags |= SS_ONSTACK; 536 else 537 p->p_sigstk.ss_flags &= ~SS_ONSTACK; 538#endif 539 540 p->p_sigmask = uc.uc_sigmask; 541 SIG_CANTMASK(p->p_sigmask); 542 PROC_UNLOCK(p); 543 CTR4(KTR_SIG, "sigreturn: return p=%p pc=%#lx sp=%#lx tstate=%#lx", 544 p, tf->tf_tpc, tf->tf_sp, tf->tf_tstate); 545 return (EJUSTRETURN); |
394} 395 396void 397cpu_halt(void) 398{ 399 TODO; 400} 401 --- 12 unchanged lines hidden (view full) --- 414 TODO; 415 return (0); 416} 417 418void 419setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings) 420{ 421 struct pcb *pcb; | 546} 547 548void 549cpu_halt(void) 550{ 551 TODO; 552} 553 --- 12 unchanged lines hidden (view full) --- 566 TODO; 567 return (0); 568} 569 570void 571setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings) 572{ 573 struct pcb *pcb; |
422 struct wsframe *fp; | 574 struct frame *fp; |
423 424 /* Round the stack down to a multiple of 16 bytes. */ 425 stack = ((stack) / 16) * 16; 426 pcb = &p->p_addr->u_pcb; 427 /* XXX: honor the real number of windows... */ | 575 576 /* Round the stack down to a multiple of 16 bytes. */ 577 stack = ((stack) / 16) * 16; 578 pcb = &p->p_addr->u_pcb; 579 /* XXX: honor the real number of windows... */ |
428 bzero(pcb->pcb_wscratch, sizeof(pcb->pcb_wscratch)); | 580 bzero(pcb->pcb_rw, sizeof(pcb->pcb_rw)); |
429 /* The inital window for the process (%cw = 0). */ | 581 /* The inital window for the process (%cw = 0). */ |
430 fp = &pcb->pcb_wscratch[0]; 431 pcb->pcb_cwp = 1; 432 pcb->pcb_ws_inuse = 1; 433 pcb->pcb_inwinop = 0; | 582 fp = (struct frame *)((caddr_t)p->p_addr + UPAGES * PAGE_SIZE) - 1; |
434 /* Make sure the frames that are frobbed are actually flushed. */ 435 __asm __volatile("flushw"); 436 mtx_lock_spin(&sched_lock); 437 fp_init_proc(pcb); 438 /* Setup state in the trap frame. */ 439 p->p_frame->tf_tstate = TSTATE_IE; 440 p->p_frame->tf_tpc = entry; 441 p->p_frame->tf_tnpc = entry + 4; --- 4 unchanged lines hidden (view full) --- 446 * - the initial %fp should be 0 447 * - the initial %sp should point to the top frame, which should be 448 * 16-byte-aligned 449 * - %g1, if != 0, passes a function pointer which should be registered 450 * with atexit(). 451 */ 452 bzero(p->p_frame->tf_out, sizeof(p->p_frame->tf_out)); 453 bzero(p->p_frame->tf_global, sizeof(p->p_frame->tf_global)); | 583 /* Make sure the frames that are frobbed are actually flushed. */ 584 __asm __volatile("flushw"); 585 mtx_lock_spin(&sched_lock); 586 fp_init_proc(pcb); 587 /* Setup state in the trap frame. */ 588 p->p_frame->tf_tstate = TSTATE_IE; 589 p->p_frame->tf_tpc = entry; 590 p->p_frame->tf_tnpc = entry + 4; --- 4 unchanged lines hidden (view full) --- 595 * - the initial %fp should be 0 596 * - the initial %sp should point to the top frame, which should be 597 * 16-byte-aligned 598 * - %g1, if != 0, passes a function pointer which should be registered 599 * with atexit(). 600 */ 601 bzero(p->p_frame->tf_out, sizeof(p->p_frame->tf_out)); 602 bzero(p->p_frame->tf_global, sizeof(p->p_frame->tf_global)); |
603 /* Set up user stack. */ 604 fp->f_fp = stack - SPOFF; |
|
454 p->p_frame->tf_out[6] = stack - SPOFF - sizeof(struct frame); 455 wr(y, 0, 0); | 605 p->p_frame->tf_out[6] = stack - SPOFF - sizeof(struct frame); 606 wr(y, 0, 0); |
456 /* shouldn't be needed */ 457 fp->wsf_sp = stack - SPOFF - sizeof(struct frame); 458 fp->wsf_inuse = 1; | |
459 mtx_unlock_spin(&sched_lock); 460} 461 462void 463Debugger(const char *msg) 464{ 465 466 printf("Debugger(\"%s\")\n", msg); --- 44 unchanged lines hidden --- | 607 mtx_unlock_spin(&sched_lock); 608} 609 610void 611Debugger(const char *msg) 612{ 613 614 printf("Debugger(\"%s\")\n", msg); --- 44 unchanged lines hidden --- |