Commit 9252bb21 authored by Charles Jacobsen's avatar Charles Jacobsen Committed by Vikram Narayanan

test-v2: ipc1 example works.

Missing lcd_get_utcb function; added it.

Another cptr_cache ABI issue - need to compile isolated code with
padding flag; works now.

Couple small bugs in microkernel (return value not initialized for
certain error case).
parent d184c6d4
......@@ -12,6 +12,12 @@
#include <lcd_config/post_hook.h>
struct lcd_utcb *
lcd_get_utcb(void)
{
return (struct lcd_utcb *)gva_val(LCD_UTCB_GV_ADDR);
}
int _lcd_create_sync_endpoint(cptr_t slot)
{
return lcd_syscall_create_sync_ep(slot);
......
......@@ -220,6 +220,7 @@ static int lookup_lcd(struct cspace *cspace, cptr_t slot, struct cnode **cnode)
if (t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_LCD) &&
t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_KLCD)) {
LCD_ERR("not an lcd");
ret = -EINVAL;
goto fail2;
}
......@@ -463,8 +464,8 @@ int __lcd_cap_grant(struct lcd *caller, cptr_t lcd, cptr_t src, cptr_t dest)
* If lcd is not an embryo, fail - we only allow direct grants when
* the lcd is being set up
*/
if (!lcd_status_embryo(lcd_struct)) {
LCD_ERR("lcd is not an embryo");
if (lcd_status_dead(lcd_struct)) {
LCD_ERR("lcd is dead, cannot do grant");
ret = -EINVAL;
goto fail2;
}
......
......@@ -95,6 +95,7 @@ static int lookup_ep(struct cspace *cspace, cptr_t slot, struct cnode **cnode)
t = cap_cnode_type(*cnode);
if (t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_SYNC_EP)) {
LCD_ERR("not a sync ipc endpoint");
ret = -EINVAL;
goto fail2;
}
......
......@@ -290,6 +290,7 @@ static int lookup_memory_object(struct cspace *cspace, cptr_t slot,
t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_DEV_MEM) &&
t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM)) {
LCD_ERR("not a memory object");
ret = -EINVAL;
goto fail2;
}
......
......@@ -12,7 +12,8 @@ export ISOLATED_CC_FLAGS= \
$(COMMON_CC_FLAGS) \
-I$(LIBLCD_BUILD_DIR)/libcap.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/isolated \
-DLCD_ISOLATE
-DLCD_ISOLATE \
-DCPTR_CACHE_LOCK_PADDING_SIZE=8
export NON_ISOLATED_CC_FLAGS= \
$(COMMON_CC_FLAGS) \
......@@ -23,3 +24,4 @@ export NON_ISOLATED_CC_FLAGS= \
obj-m += liblcd_test/
obj-m += load/
obj-m += ipc1/
# Main targets
obj-m += lcd_test_mod_ipc1_boot.o
lcd_test_mod_ipc1_boot-y += boot.o
obj-m += lcd_test_mod_ipc1_lcd.o
lcd_test_mod_ipc1_lcd-y += lcd.o
lcd_test_mod_ipc1_lcd-y += $(LIBLCD)
obj-m += boot/
obj-m += lcd/
\ No newline at end of file
......@@ -33,8 +33,8 @@ static int boot_main(void)
/*
* Create lcd
*/
ret = lcd_create_module_lcd(LCD_DIR("liblcd_test/lcd"),
"lcd_test_mod_liblcd_test_lcd",
ret = lcd_create_module_lcd(LCD_DIR("ipc1/lcd"),
"lcd_test_mod_ipc1_lcd",
&lcd,
&ctx);
if (ret) {
......@@ -60,7 +60,7 @@ static int boot_main(void)
/*
* Store cptr in boot area
*/
lcd_to_boot_info(ctx)->ctprs[0] = dest;
lcd_to_boot_info(ctx)->cptrs[0] = dest;
/*
* Run lcd
*/
......@@ -72,13 +72,14 @@ static int boot_main(void)
/*
* Do a send, followed by a receive
*/
LIBLCD_MSG("sending 0x%lx to LCD", 1234);
lcd_set_r0(1234);
ret = lcd_send(endpoint);
ret = lcd_sync_send(endpoint);
if (ret) {
LIBLCD_ERR("failed to do first send");
goto fail7;
}
ret = lcd_recv(endpoint);
ret = lcd_sync_recv(endpoint);
if (ret) {
LIBLCD_ERR("recv failed");
goto fail8;
......@@ -86,6 +87,7 @@ static int boot_main(void)
/*
* Check value in message reg r0
*/
LIBLCD_MSG("got 0x%lx from LCD", lcd_r0());
if (lcd_r0() != 5678) {
LIBLCD_ERR("unexpected value 0x%lx in reg r0",
lcd_r0());
......
......@@ -15,16 +15,18 @@ cptr_t ep;
static int do_send(u64 val)
{
LIBLCD_MSG("sending 0x%llx to boot module", val);
lcd_set_r0(val);
return lcd_send(ep);
return lcd_sync_send(ep);
}
static int do_recv(void)
{
int ret;
ret = lcd_recv(ep);
ret = lcd_sync_recv(ep);
if (ret)
return ret;
LIBLCD_MSG("got 0x%lx from boot module", lcd_r0());
if (lcd_r0() != 1234)
return 1234;
return 0;
......@@ -42,9 +44,9 @@ static int __noreturn __init ipc1_lcd_init(void)
get_endpoint();
r = do_recv();
ret = do_recv();
r = do_send(5678);
ret = do_send(5678);
goto out;
......
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