Compare commits

...

2 commits

Author SHA1 Message Date
ea60891ef5
Renamed call -> ecall
Removed old sbi call funcions in kernel.cpp
2022-01-23 15:35:18 -05:00
c4e91606de
Fixed qemu build
Forgot to add the include directories
2022-01-09 17:15:15 -05:00
3 changed files with 53 additions and 74 deletions

View file

@ -1,6 +1,7 @@
elf = executable( elf = executable(
'kernel.elf', 'kernel.elf',
arch_sources, arch_sources,
include_directories: includes,
link_args: [ link_args: [
'-Wl,-T,' + meson.current_source_dir() + '/platform.ld', '-Wl,-T,' + meson.current_source_dir() + '/platform.ld',
'-static' '-static'

View file

@ -4,23 +4,23 @@
namespace drivers { namespace drivers {
namespace opensbi { namespace opensbi {
sbiret_t call( sbiret_t ecall(
uintmax_t extension, uintptr_t extension,
uintmax_t function, uintptr_t function,
uintmax_t a0, uintptr_t a0,
uintmax_t a1, uintptr_t a1,
uintmax_t a2, uintptr_t a2,
uintmax_t a3, uintptr_t a3,
uintmax_t a4, uintptr_t a4,
uintmax_t a5) { uintptr_t a5) {
register uintmax_t r_a7 asm("a7") = extension; register uintptr_t r_a7 asm("a7") = extension;
register uintmax_t r_a6 asm("a6") = function; register uintptr_t r_a6 asm("a6") = function;
register uintmax_t r_a0 asm("a0") = a0; register uintptr_t r_a0 asm("a0") = a0;
register uintmax_t r_a1 asm("a1") = a1; register uintptr_t r_a1 asm("a1") = a1;
register uintmax_t r_a2 asm("a2") = a2; register uintptr_t r_a2 asm("a2") = a2;
register uintmax_t r_a3 asm("a3") = a3; register uintptr_t r_a3 asm("a3") = a3;
register uintmax_t r_a4 asm("a4") = a4; register uintptr_t r_a4 asm("a4") = a4;
register uintmax_t r_a5 asm("a5") = a5; register uintptr_t r_a5 asm("a5") = a5;
asm volatile("ecall" : // Instruction asm volatile("ecall" : // Instruction
"=r"(r_a0), "=r"(r_a1) : // Inputs "=r"(r_a0), "=r"(r_a1) : // Inputs
"r"(r_a7), "r"(r_a6), // Outputs "r"(r_a7), "r"(r_a6), // Outputs
@ -29,49 +29,49 @@ namespace opensbi {
return {.error = a0, .value = a1}; return {.error = a0, .value = a1};
} }
sbiret_t call( sbiret_t ecall(
uintmax_t extension, uintptr_t extension,
uintmax_t function, uintptr_t function,
uintmax_t a0, uintptr_t a0,
uintmax_t a1, uintptr_t a1,
uintmax_t a2, uintptr_t a2,
uintmax_t a3, uintptr_t a3,
uintmax_t a4) { uintptr_t a4) {
return call(extension, function, a0, a1, a2, a3, a4, 0); return ecall(extension, function, a0, a1, a2, a3, a4, 0);
} }
sbiret_t call( sbiret_t ecall(
uintmax_t extension, uintptr_t extension,
uintmax_t function, uintptr_t function,
uintmax_t a0, uintptr_t a0,
uintmax_t a1, uintptr_t a1,
uintmax_t a2, uintptr_t a2,
uintmax_t a3) { uintptr_t a3) {
return call(extension, function, a0, a1, a2, a3, 0, 0); return ecall(extension, function, a0, a1, a2, a3, 0, 0);
} }
sbiret_t call( sbiret_t ecall(
uintmax_t extension, uintptr_t extension,
uintmax_t function, uintptr_t function,
uintmax_t a0, uintptr_t a0,
uintmax_t a1, uintptr_t a1,
uintmax_t a2) { uintptr_t a2) {
return call(extension, function, a0, a1, a2, 0, 0, 0); return ecall(extension, function, a0, a1, a2, 0, 0, 0);
} }
sbiret_t call( sbiret_t ecall(
uintmax_t extension, uintptr_t extension,
uintmax_t function, uintptr_t function,
uintmax_t a0, uintptr_t a0,
uintmax_t a1) { uintptr_t a1) {
return call(extension, function, a0, a1, 0, 0, 0, 0); return ecall(extension, function, a0, a1, 0, 0, 0, 0);
} }
sbiret_t call( sbiret_t ecall(
uintmax_t extension, uintptr_t extension,
uintmax_t function, uintptr_t function,
uintmax_t a0) { uintptr_t a0) {
return call(extension, function, a0, 0, 0, 0, 0, 0); return ecall(extension, function, a0, 0, 0, 0, 0, 0);
} }
} // End namespace opensbi } // End namespace opensbi

View file

@ -30,28 +30,6 @@
typedef unsigned long sbi_word; 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, ...) { void fmt(const char *f, ...) {
va_list va; va_list va;
va_start(va, f); va_start(va, f);