Commit 508b682d authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan
Browse files

libcap-integration: Re-factor some easy misc kliblcd code.

Boot info, caps and cptrs, printk, and sync ipc.
parent fc7f2e63
/*
* boot_info.c
*
* Copyright: University of Utah
*/
#include <lcd-domains/liblcd.h>
struct lcd_boot_info * lcd_get_boot_info(void)
{
return NULL;
}
/*
* cap.c
*
* Copyright: University of Utah
*/
#include <libcap.h>
#include <lcd-domains/liblcd.h>
void lcd_cap_delete(cptr_t slot)
{
cap_delete(current->lcd->cspace, slot);
}
int lcd_cap_revoke(cptr_t slot)
{
return cap_revoke(current->lcd->cspace, slot);
}
int lcd_cptr_alloc(cptr_t *slot_out)
{
return cptr_alloc(current->cptr_cache, slot_out);
}
void lcd_cptr_free(cptr_t slot)
{
cptr_free(current->cptr_cache, slot);
}
/*
* console.c
*
* Copyright: University of Utah
*/
#include <linux/printk.h>
#include <lcd-domains/liblcd.h>
void lcd_printk(char *fmt, ...)
{
va_list args;
va_start(args, fmt);
vprintk(fmt, args);
va_end(args);
}
/*
* sync_ipc.c
*
* Copyright: University of Utah
*/
#include <libcap.h>
#include <lcd-domains/liblcd.h>
struct lcd_utcb *lcd_get_utcb(void)
{
return current->lcd->utcb;
}
int _lcd_create_sync_endpoint(cptr_t slot)
{
return __lcd_create_sync_endpoint(current->lcd, slot);
}
int lcd_create_sync_endpoint(cptr_t *slot_out)
{
int ret;
/*
* Alloc cptr
*/
ret = lcd_cptr_alloc(slot_out);
if (ret) {
LIBLCD_ERR("cptr alloc failed");
goto fail1;
}
/*
* Get endpoint
*/
ret = _lcd_create_sync_endpoint(*slot_out);
if (ret) {
LIBLCD_ERR("sync endpoint create failed");
goto fail2;
}
return 0;
fail2:
lcd_cptr_free(*slot_out);
fail1:
return ret;
}
int lcd_sync_send(cptr_t endpoint)
{
return __lcd_send(current->lcd, endpoint);
}
int lcd_sync_recv(cptr_t endpoint)
{
return __lcd_recv(current->lcd, endpoint);
}
int lcd_sync_call(cptr_t endpoint)
{
return __lcd_call(current->lcd, endpoint);
}
int lcd_sync_reply(void)
{
return __lcd_reply(current->lcd, endpoint);
}
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