machdep.c (283033) | machdep.c (283366) |
---|---|
1/* $NetBSD: arm32_machdep.c,v 1.44 2004/03/24 15:34:47 atatat Exp $ */ 2 3/*- 4 * Copyright (c) 2004 Olivier Houchard 5 * Copyright (c) 1994-1998 Mark Brinicombe. 6 * Copyright (c) 1994 Brini. 7 * All rights reserved. 8 * --- 35 unchanged lines hidden (view full) --- 44 45#include "opt_compat.h" 46#include "opt_ddb.h" 47#include "opt_platform.h" 48#include "opt_sched.h" 49#include "opt_timer.h" 50 51#include <sys/cdefs.h> | 1/* $NetBSD: arm32_machdep.c,v 1.44 2004/03/24 15:34:47 atatat Exp $ */ 2 3/*- 4 * Copyright (c) 2004 Olivier Houchard 5 * Copyright (c) 1994-1998 Mark Brinicombe. 6 * Copyright (c) 1994 Brini. 7 * All rights reserved. 8 * --- 35 unchanged lines hidden (view full) --- 44 45#include "opt_compat.h" 46#include "opt_ddb.h" 47#include "opt_platform.h" 48#include "opt_sched.h" 49#include "opt_timer.h" 50 51#include <sys/cdefs.h> |
52__FBSDID("$FreeBSD: head/sys/arm/arm/machdep.c 283033 2015-05-17 17:03:37Z ian $"); | 52__FBSDID("$FreeBSD: head/sys/arm/arm/machdep.c 283366 2015-05-24 12:20:11Z andrew $"); |
53 54#include <sys/param.h> 55#include <sys/proc.h> 56#include <sys/systm.h> 57#include <sys/bio.h> 58#include <sys/buf.h> 59#include <sys/bus.h> 60#include <sys/cons.h> --- 179 unchanged lines hidden (view full) --- 240int vfp_exists; 241SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, 242 &vfp_exists, 0, "Floating point support enabled"); 243 244void 245board_set_serial(uint64_t serial) 246{ 247 | 53 54#include <sys/param.h> 55#include <sys/proc.h> 56#include <sys/systm.h> 57#include <sys/bio.h> 58#include <sys/buf.h> 59#include <sys/bus.h> 60#include <sys/cons.h> --- 179 unchanged lines hidden (view full) --- 240int vfp_exists; 241SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, 242 &vfp_exists, 0, "Floating point support enabled"); 243 244void 245board_set_serial(uint64_t serial) 246{ 247 |
248 snprintf(board_serial, sizeof(board_serial)-1, | 248 snprintf(board_serial, sizeof(board_serial)-1, |
249 "%016jx", serial); 250} 251 252void 253board_set_revision(uint32_t revision) 254{ 255 256 board_revision = revision; --- 35 unchanged lines hidden (view full) --- 292#if defined(COMPAT_43) 293 td->td_sigstk.ss_flags |= SS_ONSTACK; 294#endif 295 } else 296 fp = (struct sigframe *)td->td_frame->tf_usr_sp; 297 298 /* make room on the stack */ 299 fp--; | 249 "%016jx", serial); 250} 251 252void 253board_set_revision(uint32_t revision) 254{ 255 256 board_revision = revision; --- 35 unchanged lines hidden (view full) --- 292#if defined(COMPAT_43) 293 td->td_sigstk.ss_flags |= SS_ONSTACK; 294#endif 295 } else 296 fp = (struct sigframe *)td->td_frame->tf_usr_sp; 297 298 /* make room on the stack */ 299 fp--; |
300 | 300 |
301 /* make the stack aligned */ 302 fp = (struct sigframe *)STACKALIGN(fp); 303 /* Populate the siginfo frame. */ 304 get_mcontext(td, &frame.sf_uc.uc_mcontext, 0); 305 frame.sf_si = ksi->ksi_info; 306 frame.sf_uc.uc_sigmask = *mask; 307 frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK ) 308 ? ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE; --- 14 unchanged lines hidden (view full) --- 323 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 324 325 /* 326 * Build context to run handler in. We invoke the handler 327 * directly, only returning via the trampoline. Note the 328 * trampoline version numbers are coordinated with machine- 329 * dependent code in libc. 330 */ | 301 /* make the stack aligned */ 302 fp = (struct sigframe *)STACKALIGN(fp); 303 /* Populate the siginfo frame. */ 304 get_mcontext(td, &frame.sf_uc.uc_mcontext, 0); 305 frame.sf_si = ksi->ksi_info; 306 frame.sf_uc.uc_sigmask = *mask; 307 frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK ) 308 ? ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE; --- 14 unchanged lines hidden (view full) --- 323 sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 324 325 /* 326 * Build context to run handler in. We invoke the handler 327 * directly, only returning via the trampoline. Note the 328 * trampoline version numbers are coordinated with machine- 329 * dependent code in libc. 330 */ |
331 | 331 |
332 tf->tf_r0 = sig; 333 tf->tf_r1 = (register_t)&fp->sf_si; 334 tf->tf_r2 = (register_t)&fp->sf_uc; 335 336 /* the trampoline uses r5 as the uc address */ 337 tf->tf_r5 = (register_t)&fp->sf_uc; 338 tf->tf_pc = (register_t)catcher; 339 tf->tf_usr_sp = (register_t)fp; --- 85 unchanged lines hidden (view full) --- 425 426 identify_arm_cpu(); 427 428 vm_ksubmap_init(&kmi); 429 430 /* 431 * Display the RAM layout. 432 */ | 332 tf->tf_r0 = sig; 333 tf->tf_r1 = (register_t)&fp->sf_si; 334 tf->tf_r2 = (register_t)&fp->sf_uc; 335 336 /* the trampoline uses r5 as the uc address */ 337 tf->tf_r5 = (register_t)&fp->sf_uc; 338 tf->tf_pc = (register_t)catcher; 339 tf->tf_usr_sp = (register_t)fp; --- 85 unchanged lines hidden (view full) --- 425 426 identify_arm_cpu(); 427 428 vm_ksubmap_init(&kmi); 429 430 /* 431 * Display the RAM layout. 432 */ |
433 printf("real memory = %ju (%ju MB)\n", | 433 printf("real memory = %ju (%ju MB)\n", |
434 (uintmax_t)arm32_ptob(realmem), 435 (uintmax_t)arm32_ptob(realmem) / mbyte); 436 printf("avail memory = %ju (%ju MB)\n", 437 (uintmax_t)arm32_ptob(vm_cnt.v_free_count), 438 (uintmax_t)arm32_ptob(vm_cnt.v_free_count) / mbyte); 439 if (bootverbose) { 440 arm_physmem_print_tables(); 441 arm_devmap_print_table(); --- 45 unchanged lines hidden (view full) --- 487{ 488 489 return (ENXIO); 490} 491 492void 493cpu_idle(int busy) 494{ | 434 (uintmax_t)arm32_ptob(realmem), 435 (uintmax_t)arm32_ptob(realmem) / mbyte); 436 printf("avail memory = %ju (%ju MB)\n", 437 (uintmax_t)arm32_ptob(vm_cnt.v_free_count), 438 (uintmax_t)arm32_ptob(vm_cnt.v_free_count) / mbyte); 439 if (bootverbose) { 440 arm_physmem_print_tables(); 441 arm_devmap_print_table(); --- 45 unchanged lines hidden (view full) --- 487{ 488 489 return (ENXIO); 490} 491 492void 493cpu_idle(int busy) 494{ |
495 | 495 |
496 CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); 497 spinlock_enter(); 498#ifndef NO_EVENTTIMERS 499 if (!busy) 500 cpu_idleclock(); 501#endif 502 if (!sched_runnable()) 503 cpu_sleep(0); --- 53 unchanged lines hidden (view full) --- 557 bzero(regs, sizeof(*regs)); 558 return (0); 559} 560 561int 562set_regs(struct thread *td, struct reg *regs) 563{ 564 struct trapframe *tf = td->td_frame; | 496 CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); 497 spinlock_enter(); 498#ifndef NO_EVENTTIMERS 499 if (!busy) 500 cpu_idleclock(); 501#endif 502 if (!sched_runnable()) 503 cpu_sleep(0); --- 53 unchanged lines hidden (view full) --- 557 bzero(regs, sizeof(*regs)); 558 return (0); 559} 560 561int 562set_regs(struct thread *td, struct reg *regs) 563{ 564 struct trapframe *tf = td->td_frame; |
565 | 565 |
566 bcopy(regs->r, &tf->tf_r0, sizeof(regs->r)); 567 tf->tf_usr_sp = regs->r_sp; 568 tf->tf_usr_lr = regs->r_lr; 569 tf->tf_pc = regs->r_pc; 570 tf->tf_spsr &= ~PSR_FLAGS; 571 tf->tf_spsr |= regs->r_cpsr & PSR_FLAGS; | 566 bcopy(regs->r, &tf->tf_r0, sizeof(regs->r)); 567 tf->tf_usr_sp = regs->r_sp; 568 tf->tf_usr_lr = regs->r_lr; 569 tf->tf_pc = regs->r_pc; 570 tf->tf_spsr &= ~PSR_FLAGS; 571 tf->tf_spsr |= regs->r_cpsr & PSR_FLAGS; |
572 return (0); | 572 return (0); |
573} 574 575int 576set_fpregs(struct thread *td, struct fpreg *regs) 577{ 578 return (0); 579} 580 --- 47 unchanged lines hidden (view full) --- 628 return proc_rwmem(td->td_proc, &uio); 629} 630 631int 632ptrace_single_step(struct thread *td) 633{ 634 struct proc *p; 635 int error; | 573} 574 575int 576set_fpregs(struct thread *td, struct fpreg *regs) 577{ 578 return (0); 579} 580 --- 47 unchanged lines hidden (view full) --- 628 return proc_rwmem(td->td_proc, &uio); 629} 630 631int 632ptrace_single_step(struct thread *td) 633{ 634 struct proc *p; 635 int error; |
636 | 636 |
637 /* TODO: This needs to be updated for Thumb-2 */ 638 if ((td->td_frame->tf_spsr & PSR_T) != 0) 639 return (EINVAL); 640 641 KASSERT(td->td_md.md_ptrace_instr == 0, 642 ("Didn't clear single step")); 643 p = td->td_proc; 644 PROC_UNLOCK(p); --- 162 unchanged lines hidden (view full) --- 807sys_sigreturn(td, uap) 808 struct thread *td; 809 struct sigreturn_args /* { 810 const struct __ucontext *sigcntxp; 811 } */ *uap; 812{ 813 ucontext_t uc; 814 int spsr; | 637 /* TODO: This needs to be updated for Thumb-2 */ 638 if ((td->td_frame->tf_spsr & PSR_T) != 0) 639 return (EINVAL); 640 641 KASSERT(td->td_md.md_ptrace_instr == 0, 642 ("Didn't clear single step")); 643 p = td->td_proc; 644 PROC_UNLOCK(p); --- 162 unchanged lines hidden (view full) --- 807sys_sigreturn(td, uap) 808 struct thread *td; 809 struct sigreturn_args /* { 810 const struct __ucontext *sigcntxp; 811 } */ *uap; 812{ 813 ucontext_t uc; 814 int spsr; |
815 | 815 |
816 if (uap == NULL) 817 return (EFAULT); 818 if (copyin(uap->sigcntxp, &uc, sizeof(uc))) 819 return (EFAULT); 820 /* 821 * Make sure the processor mode has not been tampered with and 822 * interrupts have not been disabled. 823 */ --- 357 unchanged lines hidden (view full) --- 1181 1182 /* Grab physical memory regions information from device tree. */ 1183 if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, &memsize) != 0) 1184 panic("Cannot get physical memory regions"); 1185 arm_physmem_hardware_regions(mem_regions, mem_regions_sz); 1186 1187 /* Grab reserved memory regions information from device tree. */ 1188 if (fdt_get_reserved_regions(mem_regions, &mem_regions_sz) == 0) | 816 if (uap == NULL) 817 return (EFAULT); 818 if (copyin(uap->sigcntxp, &uc, sizeof(uc))) 819 return (EFAULT); 820 /* 821 * Make sure the processor mode has not been tampered with and 822 * interrupts have not been disabled. 823 */ --- 357 unchanged lines hidden (view full) --- 1181 1182 /* Grab physical memory regions information from device tree. */ 1183 if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, &memsize) != 0) 1184 panic("Cannot get physical memory regions"); 1185 arm_physmem_hardware_regions(mem_regions, mem_regions_sz); 1186 1187 /* Grab reserved memory regions information from device tree. */ 1188 if (fdt_get_reserved_regions(mem_regions, &mem_regions_sz) == 0) |
1189 arm_physmem_exclude_regions(mem_regions, mem_regions_sz, | 1189 arm_physmem_exclude_regions(mem_regions, mem_regions_sz, |
1190 EXFLAG_NODUMP | EXFLAG_NOALLOC); 1191 1192 /* Platform-specific initialisation */ 1193 platform_probe_and_attach(); 1194 1195 pcpu0_init(); 1196 1197 /* Do basic tuning, hz etc */ --- 189 unchanged lines hidden (view full) --- 1387 /* 1388 * Exclude the kernel (and all the things we allocated which immediately 1389 * follow the kernel) from the VM allocation pool but not from crash 1390 * dumps. virtual_avail is a global variable which tracks the kva we've 1391 * "allocated" while setting up pmaps. 1392 * 1393 * Prepare the list of physical memory available to the vm subsystem. 1394 */ | 1190 EXFLAG_NODUMP | EXFLAG_NOALLOC); 1191 1192 /* Platform-specific initialisation */ 1193 platform_probe_and_attach(); 1194 1195 pcpu0_init(); 1196 1197 /* Do basic tuning, hz etc */ --- 189 unchanged lines hidden (view full) --- 1387 /* 1388 * Exclude the kernel (and all the things we allocated which immediately 1389 * follow the kernel) from the VM allocation pool but not from crash 1390 * dumps. virtual_avail is a global variable which tracks the kva we've 1391 * "allocated" while setting up pmaps. 1392 * 1393 * Prepare the list of physical memory available to the vm subsystem. 1394 */ |
1395 arm_physmem_exclude_region(abp->abp_physaddr, | 1395 arm_physmem_exclude_region(abp->abp_physaddr, |
1396 (virtual_avail - KERNVIRTADDR), EXFLAG_NOALLOC); 1397 arm_physmem_init_kernel_globals(); 1398 1399 init_param2(physmem); 1400 kdb_init(); 1401 1402 return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - 1403 sizeof(struct pcb))); --- 179 unchanged lines hidden --- | 1396 (virtual_avail - KERNVIRTADDR), EXFLAG_NOALLOC); 1397 arm_physmem_init_kernel_globals(); 1398 1399 init_param2(physmem); 1400 kdb_init(); 1401 1402 return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - 1403 sizeof(struct pcb))); --- 179 unchanged lines hidden --- |