feat: expanded ACPI support, initial support for S3 sleep
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Power.hpp
|
||||
* SYS_RESET, SYS_SHUTDOWN syscalls
|
||||
* SYS_RESET, SYS_SHUTDOWN, SYS_SUSPEND syscalls
|
||||
* Copyright (c) 2026 Daniel Hammer
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <Efi/UEFI.hpp>
|
||||
#include <Memory/Paging.hpp>
|
||||
#include <ACPI/AcpiShutdown.hpp>
|
||||
#include <ACPI/AcpiSleep.hpp>
|
||||
|
||||
namespace Montauk {
|
||||
|
||||
@@ -41,4 +42,11 @@ namespace Montauk {
|
||||
asm volatile("cli; hlt");
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
static int64_t Sys_Suspend() {
|
||||
if (!Hal::AcpiSleep::IsS3Available()) {
|
||||
return -1; // S3 not supported
|
||||
}
|
||||
return (int64_t)Hal::AcpiSleep::Suspend();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "Info.hpp" // SYS_GETINFO
|
||||
#include "Graphics.hpp" // SYS_FBINFO, SYS_FBMAP, SYS_TERMSIZE, SYS_TERMSCALE
|
||||
#include "Net.hpp" // SYS_PING, SYS_SOCKET, SYS_CONNECT, SYS_BIND, SYS_LISTEN, SYS_ACCEPT, SYS_SEND, SYS_RECV, SYS_CLOSESOCK, SYS_SENDTO, SYS_RECVFROM, SYS_GETNETCFG, SYS_SETNETCFG, SYS_RESOLVE
|
||||
#include "Power.hpp" // SYS_RESET, SYS_SHUTDOWN
|
||||
#include "Power.hpp" // SYS_RESET, SYS_SHUTDOWN, SYS_SUSPEND
|
||||
#include "Mouse.hpp" // SYS_MOUSESTATE, SYS_SETMOUSEBOUNDS
|
||||
#include "IoRedir.hpp" // SYS_SPAWN_REDIR, SYS_CHILDIO_READ, SYS_CHILDIO_WRITE, SYS_CHILDIO_WRITEKEY, SYS_CHILDIO_SETTERMSZ
|
||||
#include "Random.hpp" // SYS_GETRANDOM
|
||||
@@ -331,6 +331,8 @@ namespace Montauk {
|
||||
case SYS_BTINFO:
|
||||
if (!ValidUserPtr(frame->arg1)) return -1;
|
||||
return Sys_BtInfo((BtAdapterInfo*)frame->arg1);
|
||||
case SYS_SUSPEND:
|
||||
return Sys_Suspend();
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,9 @@ namespace Montauk {
|
||||
static constexpr uint64_t SYS_BTLIST = 87;
|
||||
static constexpr uint64_t SYS_BTINFO = 88;
|
||||
|
||||
/* Power.hpp */
|
||||
static constexpr uint64_t SYS_SUSPEND = 89;
|
||||
|
||||
static constexpr int SOCK_TCP = 1;
|
||||
static constexpr int SOCK_UDP = 2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user