Fix setup of usermode stack and added final system call to exit.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user