Subversion Repositories HelenOS-historic

Rev

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

Rev 1409 Rev 1424
Line 63... Line 63...
63
{
63
{
64
    ipl_t ipl;
64
    ipl_t ipl;
65
    cap_t caps;
65
    cap_t caps;
66
    task_t *t;
66
    task_t *t;
67
    int flags;
67
    int flags;
68
    count_t i;
68
    mem_backend_data_t backend_data = { .d1 = (__native) pf, .d2 = (__native) pages };
69
   
69
   
70
    /*
70
    /*
71
     * Make sure the caller is authorised to make this syscall.
71
     * Make sure the caller is authorised to make this syscall.
72
     */
72
     */
73
    caps = cap_get(TASK);
73
    caps = cap_get(TASK);
Line 96... Line 96...
96
   
96
   
97
    /* Lock the task and release the lock protecting tasks_btree. */
97
    /* Lock the task and release the lock protecting tasks_btree. */
98
    spinlock_lock(&t->lock);
98
    spinlock_lock(&t->lock);
99
    spinlock_unlock(&tasks_lock);
99
    spinlock_unlock(&tasks_lock);
100
   
100
   
101
    flags = AS_AREA_DEVICE | AS_AREA_READ;
101
    flags = AS_AREA_READ;
102
    if (writable)
102
    if (writable)
103
        flags |= AS_AREA_WRITE;
103
        flags |= AS_AREA_WRITE;
104
    if (!as_area_create(t->as, flags, pages * PAGE_SIZE, vp, AS_AREA_ATTR_NONE, NULL, NULL)) {
104
    if (!as_area_create(t->as, flags, pages * PAGE_SIZE, vp, AS_AREA_ATTR_NONE,
-
 
105
        &phys_backend, &backend_data)) {
105
        /*
106
        /*
106
         * The address space area could not have been created.
107
         * The address space area could not have been created.
107
         * We report it using ENOMEM.
108
         * We report it using ENOMEM.
108
         */
109
         */
109
        spinlock_unlock(&t->lock);
110
        spinlock_unlock(&t->lock);
110
        interrupts_restore(ipl);
111
        interrupts_restore(ipl);
111
        return ENOMEM;
112
        return ENOMEM;
112
    }
113
    }
113
   
114
   
114
    /* Initialize page tables. */
115
    /*
115
    for (i = 0; i < pages; i++)
-
 
116
        as_set_mapping(t->as, vp + i * PAGE_SIZE, pf + i * FRAME_SIZE);
116
     * Mapping is created on-demand during page fault.
-
 
117
     */
117
 
118
   
118
    spinlock_unlock(&t->lock);
119
    spinlock_unlock(&t->lock);
119
    interrupts_restore(ipl);
120
    interrupts_restore(ipl);
120
    return 0;
121
    return 0;
121
}
122
}
122
 
123