2019-05-29 17:18:00 +03:00
/* SPDX-License-Identifier: GPL-2.0-only */
2017-07-11 04:04:30 +03:00
/*
* Copyright ( C ) 2012 Regents of the University of California
*/
# ifndef _ASM_RISCV_PROCESSOR_H
# define _ASM_RISCV_PROCESSOR_H
# include <linux/const.h>
2020-06-09 17:14:48 +03:00
# include <vdso/processor.h>
2017-07-11 04:04:30 +03:00
# include <asm/ptrace.h>
/*
* This decides where the kernel will search for a free chunk of vm
* space during mmap ' s .
*/
2018-12-10 09:21:46 +03:00
# define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
2017-07-11 04:04:30 +03:00
# define STACK_TOP TASK_SIZE
# define STACK_TOP_MAX STACK_TOP
# define STACK_ALIGN 16
# ifndef __ASSEMBLY__
struct task_struct ;
struct pt_regs ;
/* CPU-specific state of a task */
struct thread_struct {
/* Callee-saved registers */
unsigned long ra ;
unsigned long sp ; /* Kernel mode stack */
unsigned long s [ 12 ] ; /* s[0]: frame pointer */
struct __riscv_d_ext_state fstate ;
2020-12-17 19:01:44 +03:00
unsigned long bad_cause ;
2017-07-11 04:04:30 +03:00
} ;
# define INIT_THREAD { \
. sp = sizeof ( init_stack ) + ( long ) & init_stack , \
}
# define task_pt_regs(tsk) \
( ( struct pt_regs * ) ( task_stack_page ( tsk ) + THREAD_SIZE \
- ALIGN ( sizeof ( struct pt_regs ) , STACK_ALIGN ) ) )
2019-10-28 15:10:32 +03:00
# define KSTK_EIP(tsk) (task_pt_regs(tsk)->epc)
2017-07-11 04:04:30 +03:00
# define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp)
/* Do necessary setup to start up a newly executed thread. */
extern void start_thread ( struct pt_regs * regs ,
unsigned long pc , unsigned long sp ) ;
/* Free all resources held by a thread. */
static inline void release_thread ( struct task_struct * dead_task )
{
}
extern unsigned long get_wchan ( struct task_struct * p ) ;
static inline void wait_for_interrupt ( void )
{
__asm__ __volatile__ ( " wfi " ) ;
}
struct device_node ;
2018-10-02 22:15:00 +03:00
int riscv_of_processor_hartid ( struct device_node * node ) ;
2020-06-01 12:15:39 +03:00
int riscv_of_parent_hartid ( struct device_node * node ) ;
2017-07-11 04:04:30 +03:00
extern void riscv_fill_hwcap ( void ) ;
# endif /* __ASSEMBLY__ */
# endif /* _ASM_RISCV_PROCESSOR_H */