Fix setup of usermode stack and added final system call to exit.

This commit is contained in:
2024-01-27 22:51:45 +01:00
parent 193e3a19dc
commit 3fff3bd8fc
6 changed files with 26 additions and 6 deletions

View File

@@ -12,7 +12,8 @@ namespace baos
enum class Syscall : std::uint64_t
{
FILE_READ = 0,
FILE_WRITE = 1
FILE_WRITE = 1,
EXIT = 0x3C
};
void setupSyscall() noexcept;

View File

@@ -108,7 +108,7 @@ void cmdDumpPageTable() noexcept
}
}
extern "C" void main()
extern "C" void usermode_main()
{
std::string cmd;
while(true)
@@ -132,6 +132,10 @@ extern "C" void main()
cmdDumpPageTable();
continue;
}
else if (cmd == "exit")
{
return;
}
std::printf("Unknown command: %s.\n", cmd.c_str());
}
}

View File

@@ -46,5 +46,7 @@ extern "C" void __baosSyscall(baos::Syscall cmd, std::uint64_t param0, std::uint
case Syscall::FILE_WRITE:
sysFileWrite(static_cast<unsigned>(param0), std::bit_cast<const char*>(param1), param2);
break;
case Syscall::EXIT:
break;
}
}