forked from Mirrors/opensbi
		
	include: Make sbi_current_hartid() as macro in riscv_asm.h
The sbi_current_hartid() being a regular function is quite expensive because for callers it is a function call instead of a direct CSR read. This patch converts sbi_current_hartid() into a macro in riscv_asm.h. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
		@@ -157,6 +157,8 @@ void csr_write_num(int csr_num, unsigned long val);
 | 
			
		||||
		__asm__ __volatile__("wfi" ::: "memory"); \
 | 
			
		||||
	} while (0)
 | 
			
		||||
 | 
			
		||||
/* Get current HART id */
 | 
			
		||||
#define current_hartid()	((unsigned int)csr_read(CSR_MHARTID))
 | 
			
		||||
 | 
			
		||||
/* determine CPU extension, return non-zero support */
 | 
			
		||||
int misa_extension_imp(char ext);
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,4 @@ sbi_hart_switch_mode(unsigned long arg0, unsigned long arg1,
 | 
			
		||||
		     unsigned long next_addr, unsigned long next_mode,
 | 
			
		||||
		     bool next_virt);
 | 
			
		||||
 | 
			
		||||
u32 sbi_current_hartid(void);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user