Commit 342151de authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

Finished a great big chunk of the microkernel.

IPC in place. Most api calls in place, finishing implementation of
api kill / tear down of lcds.
parent f69072d9
......@@ -15,3 +15,14 @@ int lcd_cnode_lookup(struct cspace *cspace, cptr_t c, struct cnode **out);
int lcd_cnode_grant(struct cspace *src, struct cspace *dest,
cptr_t src_cptr, cptr_t dest_cptr, unsigned int rights);
/*
* Looks up cnode slot at cptr, and inserts object, type, and rights
* info.
*/
int lcd_cap_insert(struct cspace *cspace, cptr_t cptr,
void *object, enum lcd_cap_type type, unsigned int rights);
/*
* Revokes specified rights on all derived capabilities.
*/
int lcd_cap_revoke(struct cspace *cspace, cptr_t cptr, unsigned int rights);
......@@ -97,10 +97,16 @@ struct lcd_thread {
int is_calling; /* non-zero if thread is sending and send */
/* was part of a call */
int should_stop; /* set to 1 when lcd_thread should stop */
struct completion exited; /* signal when I'm done exiting */
};
struct lcd {
struct module *m; /* module code running in lcd */
struct cspace *cspace; /* lcd's cspace, shared by all threads */
struct mutex lock; /* protects threads list */
struct list_head threads; /* list of all contained threads */
struct list_head all_list; /* list of all lcds */
};
......@@ -307,15 +313,25 @@ LCD_MK_IN_CAP_REG_ACCESS(7);
/* SYSTEM CALLS ---------------------------------------- */
#define LCD_SYSCALL_SEND 0
#define LCD_SYSCALL_RECV 1
#define LCD_SYSCALL_CALL 2
#define LCD_SYSCALL_REPLY 3
enum {
LCD_SYSCALL_SEND = 0,
LCD_SYSCALL_RECV = 1,
LCD_SYSCALL_CALL = 2,
LCD_SYSCALL_REPLY = 3
};
/* API CPTR ---------------------------------------- */
/* API STUFF ---------------------------------------- */
#define LCD_API_CPTR 1
enum {
LCD_API_CAP_ALLOC = 0,
LCD_API_CREATE_LCD1 = 1,
LCD_API_CREATE_LCD2 = 2,
LCD_API_EXIT = 3,
LCD_API_KILL = 4
};
/* ERROR CODES ---------------------------------------- */
#define LCD_EINVAL ((u64)-EINVAL)
......@@ -328,4 +344,10 @@ LCD_MK_IN_CAP_REG_ACCESS(7);
static int __##fn##(int argc, cptr_t *cptrs[]) \
__attribute__((__section__(".gmain"))) = fn
/* IOCTL INFO -------------------------------------------------- */
/* see include/uapi/linux/lcd-prototype.h */
#include <uapi/linux/lcd-prototype.h>
#endif /* LCD_LCD_H */
#ifndef LCD_PROTOTYPE_H
#define LCD_PROTOTYPE_H
/*
* lcd-prototype.h - public header for LCD Prototype support
*/
#include <linux/types.h>
/* Fixme: Needs to jive with numbers in include/linux/miscdevice.h */
#define LCD_PROTOTYPE_MINOR 254
struct lcd_prototype_module_args {
/* syscall arguments to init_module */
void *module_image;
unsigned long len;
const char *param_values;
} __attribute__((packed));
#define LCD_PROTOTYPE_INIT_MODULE _IOR(LCD_PROTOTYPE_MINOR, 0x01, struct lcd_prototype_module_args)
#endif /* LCD_PROTOTYPE_H */
......@@ -43,7 +43,7 @@
#include <syslog.h>
/* for lcd init module */
#include <temp/include/linux/lcd-domains.h>
#include <temp/include/linux/lcd-prototype.h>
#include <sys/ioctl.h>
#include "util.h"
......@@ -1696,12 +1696,12 @@ static void do_softdep(const struct module_softdep *softdep,
}
}
#define DEVICE_NAME "/dev/lcd"
#define DEVICE_NAME "/dev/lcd-prototype"
static int lcd_init_module(void *module_image, unsigned long len,
char *param_values)
{
int ret;
struct lcd_init_module_args ma;
struct lcd_prototype_module_args ma;
int fd;
ma.module_image = module_image;
......@@ -1714,7 +1714,7 @@ static int lcd_init_module(void *module_image, unsigned long len,
perror("lcd-modprobe");
goto fail;
}
ret = ioctl(fd, LCD_INIT_MODULE, &ma);
ret = ioctl(fd, LCD_PROTOTYPE_INIT_MODULE, &ma);
if (ret) {
perror("lcd-modprobe");
goto fail_fd;
......
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