Subversion Repositories HelenOS

Rev

Rev 2089 | Rev 3056 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2089 Rev 2115
Line 54... Line 54...
54
 *
54
 *
55
 * Initialize kernel CPUs support.
55
 * Initialize kernel CPUs support.
56
 *
56
 *
57
 */
57
 */
58
void cpu_init(void) {
58
void cpu_init(void) {
59
    int i, j;
59
    unsigned int i, j;
60
   
60
   
61
#ifdef CONFIG_SMP
61
#ifdef CONFIG_SMP
62
    if (config.cpu_active == 1) {
62
    if (config.cpu_active == 1) {
63
#endif /* CONFIG_SMP */
63
#endif /* CONFIG_SMP */
64
        cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count,
64
        cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count,
Line 67... Line 67...
67
            panic("malloc/cpus");
67
            panic("malloc/cpus");
68
 
68
 
69
        /* initialize everything */
69
        /* initialize everything */
70
        memsetb((uintptr_t) cpus, sizeof(cpu_t) * config.cpu_count, 0);
70
        memsetb((uintptr_t) cpus, sizeof(cpu_t) * config.cpu_count, 0);
71
 
71
 
72
        for (i=0; i < config.cpu_count; i++) {
72
        for (i = 0; i < config.cpu_count; i++) {
73
            cpus[i].stack = (uint8_t *) frame_alloc(STACK_FRAMES, FRAME_KA | FRAME_ATOMIC);
73
            cpus[i].stack = (uint8_t *) frame_alloc(STACK_FRAMES, FRAME_KA | FRAME_ATOMIC);
74
           
74
           
75
            cpus[i].id = i;
75
            cpus[i].id = i;
76
           
76
           
77
            spinlock_initialize(&cpus[i].lock, "cpu_t.lock");
77
            spinlock_initialize(&cpus[i].lock, "cpu_t.lock");
Line 96... Line 96...
96
}
96
}
97
 
97
 
98
/** List all processors. */
98
/** List all processors. */
99
void cpu_list(void)
99
void cpu_list(void)
100
{
100
{
101
    int i;
101
    unsigned int i;
102
 
102
 
103
    for (i = 0; i < config.cpu_count; i++) {
103
    for (i = 0; i < config.cpu_count; i++) {
104
        if (cpus[i].active)
104
        if (cpus[i].active)
105
            cpu_print_report(&cpus[i]);
105
            cpu_print_report(&cpus[i]);
106
        else
106
        else