Commit d3811abf authored by Anton Burtsev's avatar Anton Burtsev Committed by Vikram Narayanan

ipc_call() requires in and out capabilities...

parent e7a70c32
......@@ -24,12 +24,13 @@ static inline int __lcd_api_create_sync_endpoint(capability_t cap, capability_t
msg->regs[0] = LCD_CREATE_SYNC_ENDPOINT;
msg->valid_regs = 1;
msg->cap_regs[0] = ep_cap;
msg->cap_regs[1] = reply_cap;
msg->valid_cap_regs = 2;
msg->cap_regs[0] = reply_cap;
msg->valid_cap_regs = 1;
return ipc_call(cap, msg);
msg->cap_regs[1] = ep_cap;
msg->valid_cap_reply_regs = 1;
return ipc_call(cap, msg);
};
static inline int lcd_api_create_sync_endpoint(capability_t ep_cap) {
......@@ -51,11 +52,15 @@ static inline int __lcd_api_create_lcd(capability_t cap,
str_regs = lcd_cap_marshal_string(&msg->regs[1], module_name, LCD_MAX_REGS - 1);
msg->valid_regs = 1 + str_regs;
cap_regs = lcd_cap_marshal_cap_array(&msg->cap_regs[0], boot_caps, boot_caps_size, LCD_MAX_CAP_REGS - 2);
msg->cap_regs[cap_regs] = lcd_cap;
msg->cap_regs[cap_regs + 1] = reply_cap;
msg->valid_cap_regs = cap_regs + 2;
cap_regs = lcd_cap_marshal_cap_array(&msg->cap_regs[0],
boot_caps, boot_caps_size,
LCD_MAX_CAP_REGS - 2);
msg->cap_regs[cap_regs] = reply_cap;
msg->valid_cap_regs = cap_regs + 1;
msg->cap_regs[cap_regs + 1] = lcd_cap;
msg->valid_cap_reply_regs = 1;
return ipc_call(cap, msg);
......
......@@ -18,6 +18,7 @@ struct message_info {
capability_t cap_regs[LCD_MAX_CAP_REGS];
u8 valid_regs;
u8 valid_cap_regs;
u8 valid_cap_reply_regs;
u8 err;
};
......
......@@ -10,11 +10,10 @@
#include <linux/sched.h>
#include <linux/kthread.h>
int lcd_api_create_sync_endpoint(struct lcd_api *api, capability_t reply_cap) {
int ret;
struct sync_ipc *rvp;
capability_t free_cap;
capability_t rvp_cap;
struct cnode *cnode;
struct message_info *msg = &current->utcb->msg_info;
......@@ -25,7 +24,7 @@ int lcd_api_create_sync_endpoint(struct lcd_api *api, capability_t reply_cap) {
goto err;
};
ret = lcd_alloc_cap(&current->cap_cache, &free_cap);
ret = lcd_alloc_cap(&current->cap_cache, &rvp_cap);
if(ret) {
printk(KERN_ERR "Failed to allocate free capability\n");
ret = -ENOSPC;
......@@ -33,7 +32,7 @@ int lcd_api_create_sync_endpoint(struct lcd_api *api, capability_t reply_cap) {
goto err;
};
ret = lcd_cap_insert_object(&current->cspace, free_cap, rvp, LCD_TYPE_SYNC_EP);
ret = lcd_cap_insert_object(&current->cspace, rvp_cap, rvp, LCD_TYPE_SYNC_EP);
if(cnode == 0) {
kfree(rvp);
goto err;
......@@ -74,8 +73,8 @@ int lcd_api_execution_loop(struct lcd_api *lcd_api) {
continue;
}
// We know we're serving a call invocation, reply cap must
// be there
// We know we're serving a call invocation, reply cap is
// verified by the ipc_call()
if(msg->valid_regs == 0) {
printk(KERN_ERR "lcd_api: invalid invocation\n");
......@@ -92,6 +91,10 @@ int lcd_api_execution_loop(struct lcd_api *lcd_api) {
case LCD_CREATE_SYNC_ENDPOINT:
ret = lcd_api_create_sync_endpoint(lcd_api, reply_cap);
break;
case LCD_CREATE_LCD:
ret = lcd_api_create_sync_endpoint(lcd_api, reply_cap);
break;
default:
printk(KERN_ERR "lcd_api: invalid call number:%d\n", call);
msg->valid_regs = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment