mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
lib: sbi: Use current_hartindex() where possible
This avoids calls to the expensive sbi_hartid_to_hartindex() function and also makes the firmware smaller. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
9d7a983060
commit
15c4e285db
@@ -204,7 +204,7 @@ void sbi_update_hartindex_to_domain(u32 hartindex, struct sbi_domain *dom);
|
||||
|
||||
/** Get pointer to sbi_domain for current HART */
|
||||
#define sbi_domain_thishart_ptr() \
|
||||
sbi_hartindex_to_domain(sbi_hartid_to_hartindex(current_hartid()))
|
||||
sbi_hartindex_to_domain(current_hartindex())
|
||||
|
||||
/** Head of linked list of domains */
|
||||
extern struct sbi_dlist domain_list;
|
||||
|
@@ -52,10 +52,9 @@ struct sbi_context {
|
||||
(__d)->hartindex_to_context_table[__hartindex]
|
||||
|
||||
/** Macro to obtain the current hart's context pointer */
|
||||
#define sbi_domain_context_thishart_ptr() \
|
||||
sbi_hartindex_to_domain_context( \
|
||||
sbi_hartid_to_hartindex(current_hartid()), \
|
||||
sbi_domain_thishart_ptr())
|
||||
#define sbi_domain_context_thishart_ptr() \
|
||||
sbi_hartindex_to_domain_context(current_hartindex(), \
|
||||
sbi_domain_thishart_ptr())
|
||||
|
||||
/**
|
||||
* Enter a specific domain context synchronously
|
||||
|
Reference in New Issue
Block a user