Subversion Repositories HelenOS

Rev

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

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