-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing callbacks in sail-riscv for state-changing events
1. Added implementation of callbacks for RVFI records in riscv_rvfi_callbacks.c.
- Loading branch information
1 parent
2f11108
commit 10ae49b
Showing
15 changed files
with
891 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
/* The model assumes that these functions do not change the state of the model. | ||
*/ | ||
int __attribute__((weak)) | ||
mem_update_callback(uint64_t addr, uint64_t width, lbits data) | ||
int mem_update_callback(uint64_t addr, uint64_t width, lbits value, | ||
bool is_exception) | ||
{ | ||
} | ||
int __attribute__((weak)) xreg_update_callback(unsigned reg, uint64_t value) { } | ||
int __attribute__((weak)) freg_update_callback(unsigned reg, uint64_t value) { } | ||
int __attribute__((weak)) | ||
csr_update_callback(const char *reg_name, uint64_t value) | ||
int mem_read_callback(uint64_t addr, uint64_t width, lbits value, | ||
bool is_exception) | ||
{ | ||
} | ||
int __attribute__((weak)) | ||
csr_read_callback(const char *reg_name, uint64_t value) | ||
{ | ||
} | ||
int __attribute__((weak)) vreg_update_callback(unsigned reg, lbits value) { } | ||
int __attribute__((weak)) pc_update_callback(uint64_t value) { } | ||
int xreg_update_callback(unsigned reg, uint64_t value) { } | ||
int freg_update_callback(unsigned reg, uint64_t value) { } | ||
int csr_update_callback(const char *reg_name, uint64_t value) { } | ||
int csr_read_callback(const char *reg_name, uint64_t value) { } | ||
int vreg_update_callback(unsigned reg, lbits value) { } | ||
int pc_update_callback(uint64_t value) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
int zrvfi_write(uint64_t addr, int64_t width, lbits value, bool is_exception); | ||
int zrvfi_read(uint64_t addr, sail_int width, lbits value, bool is_exception); | ||
int zrvfi_wX(int64_t reg, uint64_t value); | ||
|
||
int mem_update_callback(uint64_t addr, uint64_t width, lbits value, | ||
bool is_exception) | ||
{ | ||
zrvfi_write(addr, width, value, is_exception); | ||
} | ||
int mem_read_callback(uint64_t addr, uint64_t width, lbits value, | ||
bool is_exception) | ||
{ | ||
sail_int len; | ||
CREATE(sail_int)(&len); | ||
CONVERT_OF(sail_int, mach_int)(&len, width); | ||
zrvfi_read(addr, len, value, is_exception); | ||
KILL(sail_int)(&len); | ||
} | ||
int xreg_update_callback(unsigned reg, uint64_t value) | ||
{ | ||
zrvfi_wX(reg, value); | ||
} | ||
int freg_update_callback(unsigned reg, uint64_t value) { } | ||
int csr_update_callback(const char *reg_name, uint64_t value) { } | ||
int csr_read_callback(const char *reg_name, uint64_t value) { } | ||
int vreg_update_callback(unsigned reg, lbits value) { } | ||
int pc_update_callback(uint64_t value) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.