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(
'kernel.elf',
arch_sources,
include_directories: includes,
link_args: [
'-Wl,-T,' + meson.current_source_dir() + '/platform.ld',
'-static'

View file

@ -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

View file

@ -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);