From df10908e9600db7fb901a06076ab34eaddbc281c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Str=C3=B6mbergson?= Date: Wed, 28 Aug 2024 14:17:31 +0200 Subject: [PATCH] (fpga) Add API register for syscall trampoline address. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Joachim Strömbergson --- hw/application_fpga/core/tk1/rtl/tk1.v | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/application_fpga/core/tk1/rtl/tk1.v b/hw/application_fpga/core/tk1/rtl/tk1.v index e17e1d6..1753afe 100644 --- a/hw/application_fpga/core/tk1/rtl/tk1.v +++ b/hw/application_fpga/core/tk1/rtl/tk1.v @@ -80,6 +80,7 @@ module tk1( localparam ADDR_APP_SIZE = 8'h0d; localparam ADDR_BLAKE2S = 8'h10; + localparam ADDR_SYSCALL = 8'h12; localparam ADDR_CDI_FIRST = 8'h20; localparam ADDR_CDI_LAST = 8'h27; @@ -143,6 +144,9 @@ module tk1( reg [31 : 0] blake2s_addr_reg; reg blake2s_addr_we; + reg [31 : 0] syscall_addr_reg; + reg syscall_addr_we; + reg [23 : 0] cpu_trap_ctr_reg; reg [23 : 0] cpu_trap_ctr_new; reg [2 : 0] cpu_trap_led_reg; @@ -283,6 +287,7 @@ module tk1( app_start_reg <= 32'h0; app_size_reg <= 32'h0; blake2s_addr_reg <= 32'h0; + syscall_addr_reg <= 32'h0; cdi_mem[0] <= 32'h0; cdi_mem[1] <= 32'h0; cdi_mem[2] <= 32'h0; @@ -354,6 +359,10 @@ module tk1( blake2s_addr_reg <= write_data; end + if (syscall_addr_we) begin + syscall_addr_reg <= write_data; + end + if (cdi_mem_we) begin cdi_mem[address[2 : 0]] <= write_data; end @@ -568,6 +577,12 @@ module tk1( end end + if (address == ADDR_SYSCALL) begin + if (!fw_app_mode_reg) begin + syscall_addr_we = 1'h1; + end + end + if ((address >= ADDR_CDI_FIRST) && (address <= ADDR_CDI_LAST)) begin if (!fw_app_mode_reg) begin cdi_mem_we = 1'h1; @@ -663,6 +678,10 @@ module tk1( tmp_read_data = blake2s_addr_reg; end + if (address == ADDR_SYSCALL) begin + tmp_read_data = syscall_addr_reg; + end + if ((address >= ADDR_CDI_FIRST) && (address <= ADDR_CDI_LAST)) begin tmp_read_data = cdi_mem[address[2 : 0]]; end