diff options
author | Andrew Waterman <andrew@sifive.com> | 2024-05-20 18:38:12 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2024-05-20 18:38:12 -0700 |
commit | 54e2005dc8658bf7bbec52ac54fe4712f7b4362a (patch) | |
tree | 94d5acaf1b339f46e93386a40424307034450edf /pk/pk.c | |
parent | da80ada596eae650761bf9da9a0283b8b8058584 (diff) | |
parent | 5ae7523adc17d6014d6bd7db02ee26607c00470d (diff) | |
download | pk-54e2005dc8658bf7bbec52ac54fe4712f7b4362a.zip pk-54e2005dc8658bf7bbec52ac54fe4712f7b4362a.tar.gz pk-54e2005dc8658bf7bbec52ac54fe4712f7b4362a.tar.bz2 |
Merge branch 'mylai-mtk-zicfilp-upstream'
Diffstat (limited to 'pk/pk.c')
-rw-r--r-- | pk/pk.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -13,6 +13,7 @@ elf_info current; long disabled_hart_mask; +bool zicfilp_enabled; static void help() { @@ -22,6 +23,7 @@ static void help() printk(" -h, --help Print this help message\n"); printk(" -p Disable on-demand program paging\n"); printk(" -s Print cycles upon termination\n"); + printk(" --zicfilp Enable Zicfilp CFI mechanism for user program\n"); shutdown(0); } @@ -54,6 +56,11 @@ static void handle_option(const char* arg) return; } + if (strcmp(arg, "--zicfilp") == 0) { + zicfilp_enabled = true; + return; + } + panic("unrecognized option: `%s'", arg); suggest_help(); } @@ -177,6 +184,8 @@ static void run_loaded_program(size_t argc, char** argv, uintptr_t kstack_top) init_tf(&tf, current.entry, stack_top); __riscv_flush_icache(); write_csr(sscratch, kstack_top); + if (zicfilp_enabled) + set_csr(senvcfg, SENVCFG_LPE); start_user(&tf); } |