Commit 543e30a4 authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan
Browse files

liblcd-v2: Re-factor simple functions - cap ops, sync ipc.

parent 3b8910b9
/*
* boot_info.c
*
* Isolated LCD bootstrap information
*
* Copyright: University of Utah
*/
#include <lcd_config/pre_hook.h>
#include <liblcd/address_spaces.h>
#include <liblcd/boot_info.h>
#include <lcd_config/post_hook.h>
struct lcd_boot_info * lcd_get_boot_info(void)
{
return (struct lcd_boot_info *)gva_val(LCD_BOOTSTRAP_PAGES_GV_ADDR);
}
/*
* cap.c
*
* Copyright: University of Utah
*/
#include <lcd_config/pre_hook.h>
#include <asm/lcd_domains/liblcd.h>
#include <liblcd/cap.h>
#include <lcd_config/post_hook.h>
void lcd_cap_delete(cptr_t slot)
{
lcd_syscall_cap_delete(slot);
}
int lcd_cap_revoke(cptr_t slot)
{
return lcd_syscall_cap_revoke(slot);
}
int lcd_cptr_alloc(cptr_t *slot_out)
{
return cptr_alloc(&lcd_get_boot_info()->cptr_cache, slot_out);
}
void lcd_cptr_free(cptr_t slot)
{
cptr_free(&lcd_get_boot_info()->cptr_cache, slot);
}
......@@ -9,16 +9,10 @@
#include <lcd_config/pre_hook.h>
#include <linux/kernel.h> /* for vsnprintf */
#include <asm/lcd_domains/liblcd.h>
#include <lcd_config/post_hook.h>
static lcd_sys_put_char(char c)
{
lcd_set_debug_reg(c);
return LCD_DO_SYSCALL(LCD_SYSCALL_PUTCHAR);
}
void lcd_printk(char *fmt, ...)
{
va_list args;
......@@ -34,9 +28,9 @@ void lcd_printk(char *fmt, ...)
* Write char by char
*/
for (p = buf; *p; p++)
lcd_put_char(*p);
lcd_syscall_putchar(*p);
/*
* Write null char
*/
lcd_put_char(0);
lcd_syscall_putchar(0);
}
/*
* sync_ipc.c
*
* Copyright: University of Utah
*/
#include <lcd_config/pre_hook.h>
#include <liblcd/sync_ipc.h>
#include <lcd_config/post_hook.h>
int __lcd_create_sync_endpoint(cptr_t slot)
{
return lcd_syscall_create_sync_ep(slot);
}
int lcd_create_sync_endpoint(cptr_t *slot_out)
{
int ret;
/*
* Alloc cptr
*/
ret = lcd_alloc_cptr(slot_out);
if (ret) {
LIBLCD_ERR("cptr alloc");
goto fail1;
}
/*
* Get new endpoint
*/
ret = __lcd_create_sync_endpoint(*slot_out);
if (ret) {
LIBLCD_ERR("create sync endpoint");
goto fail2;
}
return 0;
fail2:
lcd_free_cptr(*slot_out);
fail1:
return ret;
}
int lcd_sync_send(cptr_t endpoint)
{
return lcd_syscall_sync_send(endpoint);
}
int lcd_sync_recv(cptr_t endpoint)
{
return lcd_syscall_sync_recv(endpoint);
}
int lcd_sync_call(cptr_t endpoint)
{
return lcd_syscall_sync_call(endpoint);
}
int lcd_sync_reply(void)
{
return lcd_syscall_sync_reply();
}
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