Skip to content

Commit 0b70591

Browse files
committed
Factor out signaling of a UEFI event.
1 parent b5e88ab commit 0b70591

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

qiling/os/uefi/bs.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,7 @@ def hook_SignalEvent(ql, address, params):
132132
event_id = params["Event"]
133133

134134
if event_id in ql.loader.events:
135-
event = ql.loader.events[event_id]
136-
137-
if not event["Set"]:
138-
event["Set"] = True
139-
notify_func = event["NotifyFunction"]
140-
notify_context = event["NotifyContext"]
141-
ql.loader.notify_list.append((event_id, notify_func, notify_context))
142-
135+
signal_event(ql, event_id)
143136
return EFI_SUCCESS
144137
else:
145138
return EFI_INVALID_PARAMETER

qiling/os/uefi/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
from qiling.os.uefi.UefiSpec import EFI_CONFIGURATION_TABLE, EFI_SYSTEM_TABLE
1313
from qiling.os.uefi.UefiBaseType import EFI_GUID
1414

15+
def signal_event(ql, event_id: int) -> None:
16+
event = ql.loader.events[event_id]
17+
18+
if not event["Set"]:
19+
event["Set"] = True
20+
notify_func = event["NotifyFunction"]
21+
notify_context = event["NotifyContext"]
22+
ql.loader.notify_list.append((event_id, notify_func, notify_context))
23+
1524
def check_and_notify_protocols(ql) -> bool:
1625
if ql.loader.notify_list:
1726
event_id, notify_func, notify_context = ql.loader.notify_list.pop(0)

0 commit comments

Comments
 (0)