Subversion Repositories HelenOS-historic

Rev

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

Rev 1264 Rev 1414
Line 117... Line 117...
117
    if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) {
117
    if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) {
118
        page_table_unlock(AS, true);
118
        page_table_unlock(AS, true);
119
        interrupts_restore(ipl);
119
        interrupts_restore(ipl);
120
        return (__native) ENOENT;
120
        return (__native) ENOENT;
121
    }
121
    }
122
    paddr = PFN2ADDR(PTE_GET_FRAME(t)) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
122
    paddr = PTE_GET_FRAME(t) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
123
    page_table_unlock(AS, true);
123
    page_table_unlock(AS, true);
124
   
124
   
125
    interrupts_restore(ipl);   
125
    interrupts_restore(ipl);   
126
 
126
 
127
    futex = futex_find(paddr);
127
    futex = futex_find(paddr);
Line 131... Line 131...
131
 
131
 
132
/** Wakeup one thread waiting in futex wait queue.
132
/** Wakeup one thread waiting in futex wait queue.
133
 *
133
 *
134
 * @param uaddr Userspace address of the futex counter.
134
 * @param uaddr Userspace address of the futex counter.
135
 *
135
 *
136
 * @return ENOENT if there is no futex associated with the address
-
 
137
 *     or if there is no physical mapping for uaddr.
136
 * @return ENOENT if there is no physical mapping for uaddr.
138
 */
137
 */
139
__native sys_futex_wakeup(__address uaddr)
138
__native sys_futex_wakeup(__address uaddr)
140
{
139
{
141
    futex_t *futex;
140
    futex_t *futex;
142
    __address paddr;
141
    __address paddr;
Line 153... Line 152...
153
    if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) {
152
    if (!t || !PTE_VALID(t) || !PTE_PRESENT(t)) {
154
        page_table_unlock(AS, true);
153
        page_table_unlock(AS, true);
155
        interrupts_restore(ipl);
154
        interrupts_restore(ipl);
156
        return (__native) ENOENT;
155
        return (__native) ENOENT;
157
    }
156
    }
158
    paddr = PFN2ADDR(PTE_GET_FRAME(t)) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
157
    paddr = PTE_GET_FRAME(t) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
159
    page_table_unlock(AS, true);
158
    page_table_unlock(AS, true);
160
   
159
   
161
    interrupts_restore(ipl);
160
    interrupts_restore(ipl);
162
 
161
 
163
    futex = futex_find(paddr);
162
    futex = futex_find(paddr);
Line 190... Line 189...
190
        futex = hash_table_get_instance(item, futex_t, ht_link);
189
        futex = hash_table_get_instance(item, futex_t, ht_link);
191
        rwlock_read_unlock(&futex_ht_lock);
190
        rwlock_read_unlock(&futex_ht_lock);
192
    } else {
191
    } else {
193
        /*
192
        /*
194
         * Upgrade to writer is not currently supported,
193
         * Upgrade to writer is not currently supported,
195
         * Therefore, it is necessary to release the read lock
194
         * therefore, it is necessary to release the read lock
196
         * and reacquire it as a writer.
195
         * and reacquire it as a writer.
197
         */
196
         */
198
        rwlock_read_unlock(&futex_ht_lock);
197
        rwlock_read_unlock(&futex_ht_lock);
199
 
198
 
200
        rwlock_write_lock(&futex_ht_lock);
199
        rwlock_write_lock(&futex_ht_lock);