Subversion Repositories HelenOS

Rev

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

Rev 2441 Rev 2630
Line 73... Line 73...
73
       
73
       
74
        newmap = (uint8_t *) malloc(BITS2BYTES(bits), FRAME_ATOMIC);
74
        newmap = (uint8_t *) malloc(BITS2BYTES(bits), FRAME_ATOMIC);
75
        if (!newmap)
75
        if (!newmap)
76
            return ENOMEM;
76
            return ENOMEM;
77
       
77
       
78
        bitmap_initialize(&oldiomap, task->arch.iomap.map, task->arch.iomap.bits);
78
        bitmap_initialize(&oldiomap, task->arch.iomap.map,
-
 
79
            task->arch.iomap.bits);
79
        bitmap_initialize(&task->arch.iomap, newmap, bits);
80
        bitmap_initialize(&task->arch.iomap, newmap, bits);
80
 
81
 
81
        /*
82
        /*
82
         * Mark the new range inaccessible.
83
         * Mark the new range inaccessible.
83
         */
84
         */
84
        bitmap_set_range(&task->arch.iomap, oldiomap.bits, bits - oldiomap.bits);
85
        bitmap_set_range(&task->arch.iomap, oldiomap.bits,
-
 
86
            bits - oldiomap.bits);
85
 
87
 
86
        /*
88
        /*
87
         * In case there really existed smaller iomap,
89
         * In case there really existed smaller iomap,
88
         * copy its contents and deallocate it.
90
         * copy its contents and deallocate it.
89
         */    
91
         */    
90
        if (oldiomap.bits) {
92
        if (oldiomap.bits) {
91
            bitmap_copy(&task->arch.iomap, &oldiomap, oldiomap.bits);
93
            bitmap_copy(&task->arch.iomap, &oldiomap,
-
 
94
                oldiomap.bits);
92
            free(oldiomap.map);
95
            free(oldiomap.map);
93
        }
96
        }
94
    }
97
    }
95
 
98
 
96
    /*
99
    /*
Line 126... Line 129...
126
    if ((bits = TASK->arch.iomap.bits)) {
129
    if ((bits = TASK->arch.iomap.bits)) {
127
        bitmap_t iomap;
130
        bitmap_t iomap;
128
        task_t *task = TASK;
131
        task_t *task = TASK;
129
   
132
   
130
        ASSERT(TASK->arch.iomap.map);
133
        ASSERT(TASK->arch.iomap.map);
131
        bitmap_initialize(&iomap, CPU->arch.tss->iomap, TSS_IOMAP_SIZE * 8);
134
        bitmap_initialize(&iomap, CPU->arch.tss->iomap,
-
 
135
            TSS_IOMAP_SIZE * 8);
132
        bitmap_copy(&iomap, &task->arch.iomap, task->arch.iomap.bits);
136
        bitmap_copy(&iomap, &task->arch.iomap, task->arch.iomap.bits);
133
        /*
137
        /*
134
         * It is safe to set the trailing eight bits because of the extra
138
         * It is safe to set the trailing eight bits because of the
135
         * convenience byte in TSS_IOMAP_SIZE.
139
         * extra convenience byte in TSS_IOMAP_SIZE.
136
         */
140
         */
137
        bitmap_set_range(&iomap, ALIGN_UP(TASK->arch.iomap.bits, 8), 8);
141
        bitmap_set_range(&iomap, ALIGN_UP(TASK->arch.iomap.bits, 8), 8);
138
    }
142
    }
139
    spinlock_unlock(&TASK->lock);
143
    spinlock_unlock(&TASK->lock);
140
 
144