Subversion Repositories HelenOS-historic

Rev

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

Rev 1505 Rev 1547
Line 37... Line 37...
37
#include "fb.h"
37
#include "fb.h"
38
#include "sysio.h"
38
#include "sysio.h"
39
#include "ega.h"
39
#include "ega.h"
40
#include "main.h"
40
#include "main.h"
41
 
41
 
42
void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area,
42
void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area)
43
               size_t maxsize)
-
 
44
{
43
{
45
    void *dest;
44
    void *dest;
46
 
45
 
47
    if (*area) {
-
 
48
        ipc_answer_fast(callid, ELIMIT, 0, 0);
46
    dest = as_get_mappable_page(IPC_GET_ARG2(*call));
49
        return;
-
 
50
    }
-
 
51
    if (IPC_GET_ARG2(*call) > ALIGN_UP(maxsize, PAGE_SIZE)) {
-
 
52
        ipc_answer_fast(callid, EINVAL, 0, 0);
47
    if (ipc_answer_fast(callid, 0, (sysarg_t)dest, 0) == 0) {
53
        return;
48
        if (*area)
54
    }
-
 
55
   
-
 
56
    dest = as_get_mappable_page(maxsize);
49
            as_area_destroy(*area);
57
    if (ipc_answer_fast(callid, 0, (sysarg_t)dest, 0) == 0)
-
 
58
        *area = dest;
50
        *area = dest;
-
 
51
    }
59
}
52
}
60
 
53
 
61
int main(int argc, char *argv[])
54
int main(int argc, char *argv[])
62
{
55
{
63
    ipcarg_t phonead;
56
    ipcarg_t phonead;