some code cleanups

This commit is contained in:
Stefan Lankes 2012-07-17 14:06:48 -07:00
parent f83f29abb7
commit 47fae3de67
3 changed files with 15 additions and 7 deletions

View file

@ -39,8 +39,8 @@
//#define START_JOIN_TEST
//#define START_PI
//#define START_MEASURE_CTX_SWITCH
//#define START_HELLO
#define START_TESTS
#define START_HELLO
//#define START_TESTS
//#define START_JACOBI
// does our demos require GFX support?

View file

@ -29,7 +29,7 @@
gdt_ptr_t gp;
tss_t task_state_segments[MAX_CORES] __attribute__ ((aligned (PAGE_SIZE)));
static unsigned char kstacks[MAX_TASKS][KERNEL_STACK_SIZE] __attribute__ ((aligned (PAGE_SIZE))) = {[0][0 ... KERNEL_STACK_SIZE-1] = 0xCD};
static unsigned char kstacks[MAX_TASKS][KERNEL_STACK_SIZE] __attribute__ ((aligned (PAGE_SIZE))) = {[0 ... MAX_TASKS-1][0 ... KERNEL_STACK_SIZE-1] = 0xCD};
size_t default_stack_pointer = (size_t) kstacks[0] + KERNEL_STACK_SIZE - 16; // => stack is 16byte aligned
// currently, our kernel has full access to the ioports
static gdt_entry_t gdt[GDT_ENTRIES] = {[0 ... GDT_ENTRIES-1] = {0, 0, 0, 0, 0, 0}};

View file

@ -82,11 +82,15 @@ int create_kernel_task_on_core(tid_t* id, entry_point_t ep, void* arg, uint8_t p
*/
static inline int create_kernel_task(tid_t* id, entry_point_t ep, void* arg, uint8_t prio)
{
uint32_t core_id, flags;
uint32_t core_id;
flags = irq_nested_disable();
#if MAX_CORES > 1
uint32_t flags = irq_nested_disable();
core_id = CORE_ID;
irq_nested_enable(flags);
#else
core_id = 0;
#endif
return create_kernel_task_on_core(id, ep, arg, prio, core_id);
}
@ -116,11 +120,15 @@ int create_user_task_on_core(tid_t* id, const char* fame, char** argv, uint32_t
*/
static inline int create_user_task(tid_t* id, const char* fame, char** argv)
{
uint32_t core_id, flags;
uint32_t core_id;
flags = irq_nested_disable();
#if MAX_CORES > 1
uint32_t flags = irq_nested_disable();
core_id = CORE_ID;
irq_nested_enable(flags);
#else
core_id = 0;
#endif
return create_user_task_on_core(id, fame, argv, core_id);
}