Changeset View
Changeset View
Standalone View
Standalone View
head/sys/riscv/include/cpu.h
/*- | /*- | ||||
* Copyright (c) 2015-2016 Ruslan Bukin <br@bsdpad.com> | * Copyright (c) 2015-2018 Ruslan Bukin <br@bsdpad.com> | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Portions of this software were developed by SRI International and the | * Portions of this software were developed by SRI International and the | ||||
* University of Cambridge Computer Laboratory under DARPA/AFRL contract | * University of Cambridge Computer Laboratory under DARPA/AFRL contract | ||||
* FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme. | * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme. | ||||
* | * | ||||
* Portions of this software were developed by the University of Cambridge | * Portions of this software were developed by the University of Cambridge | ||||
* Computer Laboratory as part of the CTSRD Project, with support from the | * Computer Laboratory as part of the CTSRD Project, with support from the | ||||
Show All 25 Lines | |||||
#ifndef _MACHINE_CPU_H_ | #ifndef _MACHINE_CPU_H_ | ||||
#define _MACHINE_CPU_H_ | #define _MACHINE_CPU_H_ | ||||
#include <machine/atomic.h> | #include <machine/atomic.h> | ||||
#include <machine/frame.h> | #include <machine/frame.h> | ||||
#define TRAPF_PC(tfp) ((tfp)->tf_ra) | #define TRAPF_PC(tfp) ((tfp)->tf_ra) | ||||
#define TRAPF_USERMODE(tfp) (((tfp)->tf_sepc & (1ul << 63)) == 0) | #define TRAPF_USERMODE(tfp) (((tfp)->tf_sstatus & SSTATUS_SPP) == 0) | ||||
#define cpu_getstack(td) ((td)->td_frame->tf_sp) | #define cpu_getstack(td) ((td)->td_frame->tf_sp) | ||||
#define cpu_setstack(td, sp) ((td)->td_frame->tf_sp = (sp)) | #define cpu_setstack(td, sp) ((td)->td_frame->tf_sp = (sp)) | ||||
#define cpu_spinwait() /* nothing */ | #define cpu_spinwait() /* nothing */ | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |