# HG changeset patch # User Paul Boddie # Date 1461454179 -7200 # Node ID 126b2dfe3b5d1995cf76a7f9bb991463998bb482 # Parent f9de3cdf235948b9146eec51192c0ed946c83f69 Consolidated task initialisation code. diff -r f9de3cdf2359 -r 126b2dfe3b5d stage2/tasks.c --- a/stage2/tasks.c Sat Apr 23 23:25:58 2016 +0200 +++ b/stage2/tasks.c Sun Apr 24 01:29:39 2016 +0200 @@ -45,6 +45,11 @@ void init_tasks() { current_task = 0; + init_task(); +} + +void init_task() +{ current_stack_pointer = &stack_pointers[current_task]; current_registers = registers[current_task]; } @@ -84,9 +89,5 @@ current_task++; if (current_task == max_tasks) current_task = 0; - - /* Indicate the current stack pointer and task registers. */ - - current_stack_pointer = &stack_pointers[current_task]; - current_registers = registers[current_task]; + init_task(); } diff -r f9de3cdf2359 -r 126b2dfe3b5d stage2/tasks.h --- a/stage2/tasks.h Sat Apr 23 23:25:58 2016 +0200 +++ b/stage2/tasks.h Sun Apr 24 01:29:39 2016 +0200 @@ -8,6 +8,7 @@ /* Task management functions. */ void init_tasks(void); +void init_task(void); void start_task(unsigned short, void (*)(), u32[], u8); void switch_task(void);