Subversion Repositories HelenOS-historic

Rev

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

Rev 686 Rev 689
Line 81... Line 81...
81
 * @param flags Flags for host zone selection and address processing.
81
 * @param flags Flags for host zone selection and address processing.
82
 * @param order Allocate exactly 2^order frames.
82
 * @param order Allocate exactly 2^order frames.
83
 *
83
 *
84
 * @return Allocated frame.
84
 * @return Allocated frame.
85
 */
85
 */
86
__address frame_alloc(int flags, __u8 order)
86
__address frame_alloc(int flags, __u8 order, int * status)
87
{
87
{
88
    ipl_t ipl;
88
    ipl_t ipl;
89
    link_t *cur, *tmp;
89
    link_t *cur, *tmp;
90
    zone_t *z;
90
    zone_t *z;
91
    zone_t *zone = NULL;
91
    zone_t *zone = NULL;
Line 115... Line 115...
115
   
115
   
116
    if (!zone) {
116
    if (!zone) {
117
        if (flags & FRAME_PANIC)
117
        if (flags & FRAME_PANIC)
118
            panic("Can't allocate frame.\n");
118
            panic("Can't allocate frame.\n");
119
       
119
       
-
 
120
       
-
 
121
       
120
        /*
122
        /*
121
         * TODO: Sleep until frames are available again.
123
         * TODO: Sleep until frames are available again.
122
         */
124
         */
123
        spinlock_unlock(&zone_head_lock);
125
        spinlock_unlock(&zone_head_lock);
124
        interrupts_restore(ipl);
126
        interrupts_restore(ipl);
125
 
127
 
-
 
128
        if (flags & FRAME_NON_BLOCKING) {
-
 
129
            ASSERT(status != NULL);
-
 
130
            *status = FRAME_NO_MEMORY;
-
 
131
            return NULL;
-
 
132
        }
-
 
133
       
126
        panic("Sleep not implemented.\n");
134
        panic("Sleep not implemented.\n");
127
        goto loop;
135
        goto loop;
128
    }
136
    }
129
       
137
       
130
 
138
 
Line 149... Line 157...
149
 
157
 
150
 
158
 
151
    if (flags & FRAME_KA)
159
    if (flags & FRAME_KA)
152
        v = PA2KA(v);
160
        v = PA2KA(v);
153
   
161
   
-
 
162
    if (flags & FRAME_NON_BLOCKING) {
-
 
163
        ASSERT(status != NULL);
-
 
164
        *status = FRAME_OK;
-
 
165
    }
-
 
166
   
154
    return v;
167
    return v;
155
}
168
}
156
 
169
 
157
/** Free a frame.
170
/** Free a frame.
158
 *
171
 *