From ea60891ef5f4ca20ab64a9bc82dd4a22e4fd21ac Mon Sep 17 00:00:00 2001 From: Quantum Date: Sun, 23 Jan 2022 15:35:18 -0500 Subject: [PATCH] Renamed call -> ecall Removed old sbi call funcions in kernel.cpp --- kernel/drivers/opensbi/opensbi.cpp | 104 ++++++++++++++--------------- kernel/kernel.cpp | 22 ------ 2 files changed, 52 insertions(+), 74 deletions(-) diff --git a/kernel/drivers/opensbi/opensbi.cpp b/kernel/drivers/opensbi/opensbi.cpp index 1456be3..b92d98e 100644 --- a/kernel/drivers/opensbi/opensbi.cpp +++ b/kernel/drivers/opensbi/opensbi.cpp @@ -4,23 +4,23 @@ namespace drivers { namespace opensbi { - sbiret_t call( - uintmax_t extension, - uintmax_t function, - uintmax_t a0, - uintmax_t a1, - uintmax_t a2, - uintmax_t a3, - uintmax_t a4, - uintmax_t a5) { - register uintmax_t r_a7 asm("a7") = extension; - register uintmax_t r_a6 asm("a6") = function; - register uintmax_t r_a0 asm("a0") = a0; - register uintmax_t r_a1 asm("a1") = a1; - register uintmax_t r_a2 asm("a2") = a2; - register uintmax_t r_a3 asm("a3") = a3; - register uintmax_t r_a4 asm("a4") = a4; - register uintmax_t r_a5 asm("a5") = a5; + sbiret_t ecall( + uintptr_t extension, + uintptr_t function, + uintptr_t a0, + uintptr_t a1, + uintptr_t a2, + uintptr_t a3, + uintptr_t a4, + uintptr_t a5) { + register uintptr_t r_a7 asm("a7") = extension; + register uintptr_t r_a6 asm("a6") = function; + register uintptr_t r_a0 asm("a0") = a0; + register uintptr_t r_a1 asm("a1") = a1; + register uintptr_t r_a2 asm("a2") = a2; + register uintptr_t r_a3 asm("a3") = a3; + register uintptr_t r_a4 asm("a4") = a4; + register uintptr_t r_a5 asm("a5") = a5; asm volatile("ecall" : // Instruction "=r"(r_a0), "=r"(r_a1) : // Inputs "r"(r_a7), "r"(r_a6), // Outputs @@ -29,49 +29,49 @@ namespace opensbi { return {.error = a0, .value = a1}; } - sbiret_t call( - uintmax_t extension, - uintmax_t function, - uintmax_t a0, - uintmax_t a1, - uintmax_t a2, - uintmax_t a3, - uintmax_t a4) { - return call(extension, function, a0, a1, a2, a3, a4, 0); + sbiret_t ecall( + uintptr_t extension, + uintptr_t function, + uintptr_t a0, + uintptr_t a1, + uintptr_t a2, + uintptr_t a3, + uintptr_t a4) { + return ecall(extension, function, a0, a1, a2, a3, a4, 0); } - sbiret_t call( - uintmax_t extension, - uintmax_t function, - uintmax_t a0, - uintmax_t a1, - uintmax_t a2, - uintmax_t a3) { - return call(extension, function, a0, a1, a2, a3, 0, 0); + sbiret_t ecall( + uintptr_t extension, + uintptr_t function, + uintptr_t a0, + uintptr_t a1, + uintptr_t a2, + uintptr_t a3) { + return ecall(extension, function, a0, a1, a2, a3, 0, 0); } - sbiret_t call( - uintmax_t extension, - uintmax_t function, - uintmax_t a0, - uintmax_t a1, - uintmax_t a2) { - return call(extension, function, a0, a1, a2, 0, 0, 0); + sbiret_t ecall( + uintptr_t extension, + uintptr_t function, + uintptr_t a0, + uintptr_t a1, + uintptr_t a2) { + return ecall(extension, function, a0, a1, a2, 0, 0, 0); } - sbiret_t call( - uintmax_t extension, - uintmax_t function, - uintmax_t a0, - uintmax_t a1) { - return call(extension, function, a0, a1, 0, 0, 0, 0); + sbiret_t ecall( + uintptr_t extension, + uintptr_t function, + uintptr_t a0, + uintptr_t a1) { + return ecall(extension, function, a0, a1, 0, 0, 0, 0); } - sbiret_t call( - uintmax_t extension, - uintmax_t function, - uintmax_t a0) { - return call(extension, function, a0, 0, 0, 0, 0, 0); + sbiret_t ecall( + uintptr_t extension, + uintptr_t function, + uintptr_t a0) { + return ecall(extension, function, a0, 0, 0, 0, 0, 0); } } // End namespace opensbi diff --git a/kernel/kernel.cpp b/kernel/kernel.cpp index a9acc34..e2e9346 100644 --- a/kernel/kernel.cpp +++ b/kernel/kernel.cpp @@ -30,28 +30,6 @@ typedef unsigned long sbi_word; -/* -void sbi_call1(int ext, int func, sbi_word arg0) { - register sbi_word rExt asm("a7") = ext; - register sbi_word rFunc asm("a6") = func; - register sbi_word rArg0 asm("a0") = arg0; - register sbi_word rArg1 asm("a1"); - asm volatile("ecall" : "+r"(rArg0), "=r"(rArg1) : "r"(rExt), "r"(rFunc)); - if(rArg0) - __builtin_trap(); -} - -void sbi_call2(int ext, int func, sbi_word arg0, sbi_word arg1) { - register sbi_word rExt asm("a7") = ext; - register sbi_word rFunc asm("a6") = func; - register sbi_word rArg0 asm("a0") = arg0; - register sbi_word rArg1 asm("a1") = arg1; - asm volatile("ecall" : "+r"(rArg0), "+r"(rArg1) : "r"(rExt), "r"(rFunc)); - if(rArg0) - __builtin_trap(); -} -*/ - void fmt(const char *f, ...) { va_list va; va_start(va, f);