diff options
| author | Nick Erdmann <n@nirf.de> | 2019-08-10 00:32:43 +0200 |
|---|---|---|
| committer | Nick Erdmann <n@nirf.de> | 2019-08-10 19:14:47 +0200 |
| commit | 47ce736abec2d97c70eed619b5a6a58edeb4816a (patch) | |
| tree | 4cc918bfe2412ca8cea57bc32b026a2ba5ce5bed | |
| parent | 9445b3f057bdeb57cdb02c86b94145ae9a345531 (diff) | |
| download | zig-47ce736abec2d97c70eed619b5a6a58edeb4816a.tar.gz zig-47ce736abec2d97c70eed619b5a6a58edeb4816a.zip | |
std/os/uefi: add basic Event support
| -rw-r--r-- | std/os/uefi.zig | 2 | ||||
| -rw-r--r-- | std/os/uefi/protocols/absolute_pointer_protocol.zig | 2 | ||||
| -rw-r--r-- | std/os/uefi/protocols/simple_pointer_protocol.zig | 2 | ||||
| -rw-r--r-- | std/os/uefi/protocols/simple_text_input_ex_protocol.zig | 2 | ||||
| -rw-r--r-- | std/os/uefi/tables.zig | 1 | ||||
| -rw-r--r-- | std/os/uefi/tables/boot_services.zig | 25 |
6 files changed, 27 insertions, 7 deletions
diff --git a/std/os/uefi.zig b/std/os/uefi.zig index 9ddaad5aa6..db46d50c1f 100644 --- a/std/os/uefi.zig +++ b/std/os/uefi.zig @@ -8,7 +8,7 @@ pub const is_the_target = builtin.os == .uefi; pub var handle: Handle = undefined; pub var system_table: *tables.SystemTable = undefined; -pub const Event = @OpaqueType(); +pub const Event = *@OpaqueType(); // GUIDs must be align(8) pub const Guid = extern struct { time_low: u32, diff --git a/std/os/uefi/protocols/absolute_pointer_protocol.zig b/std/os/uefi/protocols/absolute_pointer_protocol.zig index b1fcc4902e..8be52ad7e4 100644 --- a/std/os/uefi/protocols/absolute_pointer_protocol.zig +++ b/std/os/uefi/protocols/absolute_pointer_protocol.zig @@ -6,7 +6,7 @@ const Guid = uefi.Guid; pub const AbsolutePointerProtocol = extern struct { _reset: extern fn (*const AbsolutePointerProtocol, bool) usize, _get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) usize, - wait_for_input: *Event, + wait_for_input: Event, mode: *AbsolutePointerMode, pub fn reset(self: *const AbsolutePointerProtocol, verify: bool) usize { diff --git a/std/os/uefi/protocols/simple_pointer_protocol.zig b/std/os/uefi/protocols/simple_pointer_protocol.zig index 26d11ca7f5..369bc76aaa 100644 --- a/std/os/uefi/protocols/simple_pointer_protocol.zig +++ b/std/os/uefi/protocols/simple_pointer_protocol.zig @@ -6,7 +6,7 @@ const Guid = uefi.Guid; pub const SimplePointerProtocol = struct { _reset: extern fn (*const SimplePointerProtocol, bool) usize, _get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) usize, - wait_for_input: *Event, + wait_for_input: Event, mode: *SimplePointerMode, pub fn reset(self: *const SimplePointerProtocol, verify: bool) usize { diff --git a/std/os/uefi/protocols/simple_text_input_ex_protocol.zig b/std/os/uefi/protocols/simple_text_input_ex_protocol.zig index 16f676fd2d..e23a68bacf 100644 --- a/std/os/uefi/protocols/simple_text_input_ex_protocol.zig +++ b/std/os/uefi/protocols/simple_text_input_ex_protocol.zig @@ -6,7 +6,7 @@ const Guid = uefi.Guid; pub const SimpleTextInputExProtocol = extern struct { _reset: extern fn (*const SimpleTextInputExProtocol, bool) usize, _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) usize, - wait_for_key_ex: *Event, + wait_for_key_ex: Event, _set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) usize, _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) usize, _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) usize, diff --git a/std/os/uefi/tables.zig b/std/os/uefi/tables.zig index e5867ae657..51caed19d1 100644 --- a/std/os/uefi/tables.zig +++ b/std/os/uefi/tables.zig @@ -4,3 +4,4 @@ pub const ResetType = @import("tables/runtime_services.zig").ResetType; pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices; pub const SystemTable = @import("tables/system_table.zig").SystemTable; pub const TableHeader = @import("tables/table_header.zig").TableHeader; +pub const TimerDelay = @import("tables/boot_services.zig").TimerDelay; diff --git a/std/os/uefi/tables/boot_services.zig b/std/os/uefi/tables/boot_services.zig index 813677910b..6007552bdd 100644 --- a/std/os/uefi/tables/boot_services.zig +++ b/std/os/uefi/tables/boot_services.zig @@ -1,4 +1,5 @@ const uefi = @import("std").os.uefi; +const Event = uefi.Event; const Guid = uefi.Guid; const Handle = uefi.Handle; const TableHeader = uefi.tables.TableHeader; @@ -22,10 +23,10 @@ pub const BootServices = extern struct { getMemoryMap: usize, // TODO allocatePool: usize, // TODO freePool: usize, // TODO - createEvent: usize, // TODO - setTimer: usize, // TODO + createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize, + setTimer: extern fn (Event, TimerDelay, u64) usize, waitForEvent: usize, // TODO - signalEvent: usize, // TODO + signalEvent: extern fn (Event) usize, closeEvent: usize, // TODO checkEvent: usize, // TODO installProtocolInterface: usize, // TODO @@ -61,4 +62,22 @@ pub const BootServices = extern struct { createEventEx: usize, // TODO pub const signature: u64 = 0x56524553544f4f42; + + pub const event_timer: u32 = 0x80000000; + pub const event_runtime: u32 = 0x40000000; + pub const event_notify_wait: u32 = 0x00000100; + pub const event_notify_signal: u32 = 0x00000200; + pub const event_signal_exit_boot_services: u32 = 0x00000201; + pub const event_signal_virtual_address_change: u32 = 0x00000202; + + pub const tpl_application: usize = 4; + pub const tpl_callback: usize = 8; + pub const tpl_notify: usize = 16; + pub const tpl_high_level: usize = 31; +}; + +pub const TimerDelay = extern enum(u32) { + TimerCancel, + TimerPeriodic, + TimerRelative, }; |
