minor changes in using the per_core macro, add additional output messages by an exception & cosmetic changes

This commit is contained in:
Stefan Lankes 2011-07-20 09:47:46 +02:00
parent 20c944b099
commit e57a447fda
4 changed files with 10 additions and 8 deletions

View file

@ -512,6 +512,7 @@ hack1:
no_task_switch1:
pop ebx
xor eax, eax
sti
ret

View file

@ -229,7 +229,8 @@ static void fault_handler(struct state *s)
{
if (s->int_no < 32) {
kputs(exception_messages[s->int_no]);
kprintf(" Exception (%d) at 0x%x:0x%x, error code 0x%x\n", s->int_no, s->cs, s->eip, s->error);
kprintf(" Exception (%d) at 0x%x:0x%x, error code 0x%x, eflags 0x%x\n",
s->int_no, s->cs, s->eip, s->error, s->eflags);
/* Now, we signalize that we have handled the interrupt */
if (apic_is_enabled())

View file

@ -38,14 +38,14 @@ typedef unsigned int tid_t;
#define DEFINE_PER_CORE(type, name, def_value) type name = def_value;
#define CORE_ID 0
#else
#define per_core(name) __get_percore_##name()
#define per_core(name) (*__get_percore_##name())
#define DECLARE_PER_CORE(type, name) \
typedef struct { type var __attribute__ ((aligned (CACHE_LINE))); } aligned_##name;\
extern aligned_##name name[MAX_CORES];\
inline static type __get_percore_##name(void) {\
type ret; \
inline static type* __get_percore_##name(void) {\
type* ret; \
uint32_t flags = irq_nested_disable(); \
ret = name[smp_id()].var; \
ret = &(name[smp_id()].var); \
irq_nested_enable(flags);\
return ret; \
}

View file

@ -68,7 +68,7 @@ int multitasking_init(void) {
memset(task_table[0].outbox, 0x00, sizeof(mailbox_wait_msg_t*)*MAX_TASKS);
task_table[0].pgd = get_boot_pgd();
task_table[0].flags = TASK_DEFAULT_FLAGS;
current_task[0].var = task_table+0;
per_core(current_task) = task_table+0;
return 0;
}
@ -763,7 +763,7 @@ void scheduler(void)
if (curr_task->status == TASK_RUNNING)
curr_task->status = TASK_READY;
task_table[new_id].status = TASK_RUNNING;
current_task[CORE_ID].var = task_table+new_id;
per_core(current_task) = task_table+new_id;
goto get_task_out;
}
@ -776,7 +776,7 @@ void scheduler(void)
* we switch to the idle task, if the current task terminates
* and no other is ready
*/
current_task[CORE_ID].var = task_table+CORE_ID;
per_core(current_task) = task_table+CORE_ID;
get_task_out:
//kprintf("schedule %d on core %d\n", per_core(current_task)->id, smp_id());