1#include <string.h>
2
3#include "internal.h"
4#include "sch/internal.h"
5
6enum rt_scheduler_error rt_ext_fn_exec(struct rt_scheduler_static *rts,
7 char *name, uint32_t id, uintptr_t a,
8 uintptr_t b) {
9 struct rt_ext_fn *fns = rts->ext_fns;
10 struct rt_ext_fn *found = NULL;
11 for (size_t i = 0; i < rts->num_ext_fns; i++) {
12 if ((name && strcmp(str1: fns[i].name, str2: name) == 0) || (fns[i].id == id)) {
13 found = &fns[i];
14 break;
15 }
16 }
17
18 if (!found)
19 return RT_SCHEDULER_ERR_NOT_FOUND;
20
21 /* Got it */
22 enum irql irql = irql_raise(new_level: IRQL_DISPATCH_LEVEL);
23
24 found->fn(a, b);
25
26 irql_lower(old_level: irql);
27 return RT_SCHEDULER_ERR_OK;
28}
29