Commit 08bb2d4f authored by Anton Burtsev's avatar Anton Burtsev Committed by Vikram Narayanan

Getting close to local cspaces

parent feba5441
......@@ -2,15 +2,62 @@
#include "server-idl.h"
/* Caller stubs */
int register_server(struct server_interface *server) {
/* Generate a global capability variable */
client_t client;
int __register_server_caller(capability_t client, struct server_interface *server) {
int ret;
msg->regs[0] = client_interface_register_server;
msg->valid_regs = 1;
msg->cap_regs[0] = server;
msg->valid_cap_regs = 1;
ret = ipc_call(server, msg);
if (ret) {
printk(KERN_ERR "client failed to ivoke server:%d\n", ret);
/* XXX: BU: make up some result, which? */
return ret;
};
return (int) msg->regs[0];
}
int register_server_caller(struct server_interface *server) {
return __register_server_caller(client, server);
}
/* Callee stubs */
int register_server_callee(struct server_interface *server) {
int register_server_callee(struct message_info *msg, capability_t reply_cap) {
int ret;
struct server_interface *server;
server = (struct server_interface *) malloc(sizeof(struct server_interface));
if (!server) {
printk(KERN_ERR "memory allocation failed\n");
msg->valid_regs = 0;
msg->valid_cap_regs = 0;
msg->err = -ENOMEM;
ipc_reply(reply_cap, msg);
return 0;
};
ret = register_server(server);
msg->regs[0] = ret;
msg->valid_regs = 1;
msg->valid_cap_regs = 0;
ret = ipc_reply(reply_cap, msg);
if(ret) {
printk(KERN_ERR "IPC reply failed: %d\n", ret);
return ret;
};
return ret;
}
......@@ -61,8 +108,8 @@ int execution_loop(void) {
struct sync_ipc *client_server_rvp;
int accept_client_introduction(void) {
return lcd_accept_introduction(&client_server_rvp,
&current->utcb->boot_info.boot_caps[LCD_BOOT_FREE_CAP0]);
return lcd_accept_introduction(&client_server_rvp,
&client);
};
EXPORT_SYMBOL(accept_client_introduction);
......
......@@ -5,7 +5,10 @@ enum client_interface {
client_interface_register_server,
};
int register_server(capability_t client, struct server_interface *server);
int register_server_callee(capability_t server, );
int register_server_caller(struct server_interface *server);
int __register_server_caller(capability_t client, struct server_interface *server);
int register_server_callee(struct message_info *msg, capability_t reply_cap);
#endif
......@@ -4,9 +4,14 @@
*
*/
#ifndef _LCD_TEST_
#ifndef _LCD_TEST_CLIENT_SERVER_CLIENT_H_
#define _LCD_TEST_CLIENT_SERVER_CLIENT_H_
struct server_interface {
int (*test_func1) (unsigned long a, long b, char c);
int (*test_func2) (unsigned long a);
};
int register_server(struct server_interface *s);
#endif
/**
* sender.c - sender for the IPC ping-pong test
* server.c - server for the LCD client server example
*
*
* Authors: Anton Burtsev <aburtsev@flux.utah.edu>
......@@ -23,6 +23,9 @@
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LCD client-server test server");
int test_func1(unsigned long a, long b, char c) {
printk(KERN_INFO "test_func1: a:%llu, b:%li, c:%c\n", a, b, c);
return a + b;
......@@ -33,11 +36,15 @@ int test_func2(unsigned long a) {
return a * 10;
};
struct server_interface server = {
.test_func1 = test_func1,
.test_func2 = test_func2,
};
static int __init server_init(void)
{
execution_loop_thread_init();
register_server();
register_server(&server);
}
static void __exit server_exit(void)
......
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