Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static void run_task(task_t *task) {
printk("CPU[%u]: Running task %s[%u]\n", task->cpu, task->name, task->id);

set_task_state(task, TASK_STATE_RUNNING);
task->func(task->arg);
task->result = task->func(task->arg);
set_task_state(task, TASK_STATE_DONE);
}

Expand Down
18 changes: 17 additions & 1 deletion drivers/acpi/acpica/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,32 @@ ACPI_THREAD_ID AcpiOsGetThreadId(void) {
return smp_processor_id() + 1;
}

struct osd_exec_cb_wrapper {
ACPI_OSD_EXEC_CALLBACK Function;
void *Context;
};
typedef struct osd_exec_cb_wrapper osd_exec_cb_wrapper_t;

unsigned long _osd_exec_cb_wrapper(void *arg) {
osd_exec_cb_wrapper_t *cb = arg;

cb->Function(cb->Context);
return 0;
}

ACPI_STATUS AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function,
void *Context) {
static unsigned counter = 0;
unsigned cpu = smp_processor_id();
osd_exec_cb_wrapper_t cb;
char name[40];
task_t *task;

snprintf(name, sizeof(name), "acpi_%u_%u_%u", Type, counter++, cpu);

task = new_task(name, (task_func_t) Function, Context);
cb.Function = Function;
cb.Context = Context;
task = new_task(name, _osd_exec_cb_wrapper, &cb);
if (!task)
return AE_NO_MEMORY;

Expand Down
2 changes: 1 addition & 1 deletion include/ktf.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern bool opt_debug;
extern int usermode_call(user_func_t fn, void *fn_arg);

extern void kernel_main(void) __noreturn;
extern void test_main(void *unused);
extern unsigned long test_main(void *unused);

#endif /* __ASSEMBLY__ */

Expand Down
2 changes: 1 addition & 1 deletion include/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <list.h>
#include <page.h>

typedef void (*task_func_t)(void *arg);
typedef unsigned long (*task_func_t)(void *arg);

enum task_state {
TASK_STATE_NEW,
Expand Down
3 changes: 2 additions & 1 deletion tests/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static get_next_test_result_t get_next_test(test_fn **out_test_fn, char **out_na
return TESTS_DONE;
}

void test_main(void *unused) {
unsigned long test_main(void *unused) {
char *name;
test_fn *fn = NULL;
unsigned n = 0;
Expand All @@ -76,4 +76,5 @@ void test_main(void *unused) {
}

printk("Tests completed: %u\n", n);
return 0;
}