Commit 38d3c5d0 authored by Charles Jacobsen's avatar Charles Jacobsen Committed by Vikram Narayanan

test-v2: LCD module create functioning.

Host can successfully load LCD, using new interval tree/memory
object logic. (Still get EPT fault while booting LCD.)

Some fixes/changes:

    1 - Need to use page-level granularity for memory objects.
        Unlike alloc_pages, vmalloc is page-granularity (rather
        than power-of-2 page granularity).
    2 - The kernel module region base virtual address needs to
        match the host's upper 2GB address, because of how address
        calculations are done internally and because we use the
        host module loader with no linkage changes (it's possible,
        but not worth it right now). Add assertion to make sure
        this is the case.
    3 - Needed to make LCD the owner of its cspace (set owner
        pointer).
parent ffc17a50
*Module.symvers
build
\ No newline at end of file
build
module_init_tools/compile
\ No newline at end of file
......@@ -222,10 +222,10 @@ static inline int lcd_syscall_alloc_pages(cptr_t slot,
}
static inline int lcd_syscall_vmalloc(cptr_t slot,
unsigned int order)
unsigned long nr_pages)
{
return lcd_syscall_two_args(LCD_SYSCALL_VMALLOC,
cptr_val(slot), order);
cptr_val(slot), nr_pages);
}
static inline int lcd_syscall_mmap(cptr_t mo_cptr, gpa_t base)
......
......@@ -65,6 +65,10 @@ static int do_kernel_module_grant_map(cptr_t lcd, struct lcd_create_ctx *ctx,
int ret;
/*
* Map module init and core at correct offsets
*
* XXX: Assumes init and core link addresses come from
* the host's module mem area.
* (LCD_KERNEL_MODULE_REGION_GV_ADDR =
*/
offset = gva_val(m_init_link_addr) -
gva_val(LCD_KERNEL_MODULE_REGION_GV_ADDR);
......@@ -76,7 +80,7 @@ static int do_kernel_module_grant_map(cptr_t lcd, struct lcd_create_ctx *ctx,
if (ret)
goto fail1;
offset = gva_val(m_core_link_addr) -
offset = gva_val(m_core_link_addr) -
gva_val(LCD_KERNEL_MODULE_REGION_GV_ADDR);
c = &(lcd_to_boot_info(ctx)->lcd_boot_cptrs.module_core);
ret = do_grant_and_map_for_mem(lcd, ctx, ctx->m_core_bits,
......
......@@ -37,6 +37,7 @@ static inline void __lcd_err(char *file, int lineno, char *fmt, ...)
va_start(args, fmt);
vprintk(fmt, args);
va_end(args);
printk("\n");
}
#define LCD_MSG(msg...) __lcd_msg(__FILE__, __LINE__, msg)
static inline void __lcd_msg(char *file, int lineno, char *fmt, ...)
......@@ -46,6 +47,7 @@ static inline void __lcd_msg(char *file, int lineno, char *fmt, ...)
va_start(args, fmt);
vprintk(fmt, args);
va_end(args);
printk("\n");
}
#define LCD_WARN(msg...) __lcd_warn(__FILE__, __LINE__, msg)
static inline void __lcd_warn(char *file, int lineno, char *fmt, ...)
......@@ -55,6 +57,7 @@ static inline void __lcd_warn(char *file, int lineno, char *fmt, ...)
va_start(args, fmt);
vprintk(fmt, args);
va_end(args);
printk("\n");
}
#define LCD_DEBUG_ERR 1
......@@ -449,7 +452,7 @@ struct lcd_mapping_metadata {
struct lcd_memory_object {
enum lcd_microkernel_type_id sub_type;
void *object;
unsigned int order;
unsigned long nr_pages;
};
/**
* __lcd_memory_object_start -- Starting address (memory-object dependent)
......@@ -502,7 +505,7 @@ hva_t __lcd_memory_object_hva(struct lcd_memory_object *mo);
* @caller: the LCD in whose cspace we should insert the capability
* @slot: where to insert new capability
* @mem_obj: the memory object (struct page*, unsigned long for dev mem, etc.)
* @order: mem_obj is 2^order pages
* @nr_pages: mem_obj nr_pages pages (nr_pages * PAGE_SIZE bytes)
* @sub_type: the microkernel type id for memory object
* @mo_out: out param, the created memory object (data structure)
*
......@@ -517,7 +520,7 @@ hva_t __lcd_memory_object_hva(struct lcd_memory_object *mo);
*/
int __lcd_insert_memory_object(struct lcd *caller,
cptr_t slot, void *mem_obj,
unsigned int order,
unsigned long nr_pages,
enum lcd_microkernel_type_id sub_type,
struct lcd_memory_object **mo_out);
/**
......@@ -544,10 +547,11 @@ int __lcd_alloc_pages(struct lcd *caller, cptr_t slot,
*
* Arguments similar to __lcd_alloc_pages.
*
* Unlike regular vmalloc, the allocation size must be a power of
* 2 pages.
* The allocation size must be a multiple of PAGE_SIZE (@nr_pages). This
* is what real vmalloc does, even though it accepts byte granularity
* sizes as argument.
*/
int __lcd_vmalloc(struct lcd *caller, cptr_t slot, unsigned int order);
int __lcd_vmalloc(struct lcd *caller, cptr_t slot, unsigned long nr_pages);
/**
* __lcd_get_memory_object -- Look up memory object in LCD's cspace
* @caller: LCD whose cspace we should look in
......
......@@ -115,7 +115,9 @@
*
* The layout is simple: the physical address space is mapped once in the
* high 512 GB range. This puts the kernel module mapping area in the high
* 2 GBs, the same as on the host (for x86_64 anyway).
* 2 GBs, the same as on the host (for x86_64 anyway - see
* Documentation/x86/x86_64/mm.txt, arch/x86/include/asm/page_64_types.h,
* and arch/x86/include/asm/pgtable_64_types.h).
*
* +---------------------------+ 0xFFFF FFFF FFFF FFFF
* | Kernel Module |
......@@ -155,7 +157,7 @@
#define LCD_MISC_REGION_SIZE (1UL << 30) /* .................... 1 GB */
#define LCD_STACK_REGION_SIZE (1UL << 30) /* ................... 1 GB */
#define LCD_HEAP_REGION_SIZE (1UL << 30) /* .................... 1 GB */
#define LCD_RAM_MAP_REGION_SIZE (1UL << 30) /* ................. 8 GBs */
#define LCD_RAM_MAP_REGION_SIZE (8UL << 30) /* ................. 8 GBs */
#define LCD_IOREMAP_REGION_SIZE (256UL << 30) /* ............... 256 GBs */
#define LCD_KERNEL_MODULE_REGION_SIZE (2UL << 30) /* ........... 2 GBs */
......@@ -166,28 +168,6 @@
#define LCD_BOOTSTRAP_PAGE_TABLES_SIZE (2 * PAGE_SIZE) /* .... 8 KBs */
#define LCD_STACK_SIZE (2 * PAGE_SIZE) /* .................... 8 KBs */
static inline void
__attribute__((used)) /* required so that this func is processed */
__lcd_build_checks__(void)
{
/*
* This function is for build checks only. (We can't put
* build bug on's in the top level.)
*/
/* LCD Bootstrap pages must be a power-of-two number of pages */
BUILD_BUG_ON_NOT_POWER_OF_2(LCD_BOOTSTRAP_PAGES_SIZE >> PAGE_SHIFT);
/* lcd_boot_info won't fit in bootstrap pages. Add more pages. */
BUILD_BUG_ON(sizeof(struct lcd_boot_info) > LCD_BOOTSTRAP_PAGES_SIZE);
/* We need exactly two page tables for the gv address space. */
BUILD_BUG_ON(LCD_BOOTSTRAP_PAGE_TABLES_SIZE >> PAGE_SHIFT != 2);
/* Number of LCD stack pages needs to be a power-of-two multiple. */
BUILD_BUG_ON_NOT_POWER_OF_2(LCD_STACK_SIZE >> PAGE_SHIFT);
}
/* Orders (for convenience) */
#define LCD_BOOTSTRAP_PAGES_ORDER \
......@@ -238,7 +218,7 @@ __lcd_build_checks__(void)
/* Addresses */
#define LCD_PHYS_BASE (0UL)
#define LCD_VIRT_BASE (0xFFFFFF7FFFFFFFFFUL)
#define LCD_VIRT_BASE (0xFFFFFF8000000000UL)
#define LCD_UTCB_GP_ADDR (__gpa(LCD_PHYS_BASE + LCD_UTCB_OFFSET))
#define LCD_UTCB_GV_ADDR (__gva(LCD_VIRT_BASE + LCD_UTCB_OFFSET))
......@@ -270,6 +250,40 @@ __lcd_build_checks__(void)
#define LCD_KERNEL_MODULE_REGION_GV_ADDR \
(__gva(LCD_VIRT_BASE + LCD_KERNEL_MODULE_REGION_OFFSET))
/* ASSERTIONS -------------------------------------------------- */
static inline void
__attribute__((used)) /* required so that this func is processed */
__lcd_build_checks__(void)
{
/*
* This function is for build checks only. (We can't put
* build bug on's in the top level.)
*/
/* LCD Bootstrap pages must be a power-of-two number of pages */
BUILD_BUG_ON_NOT_POWER_OF_2(LCD_BOOTSTRAP_PAGES_SIZE >> PAGE_SHIFT);
/* lcd_boot_info won't fit in bootstrap pages. Add more pages. */
BUILD_BUG_ON(sizeof(struct lcd_boot_info) > LCD_BOOTSTRAP_PAGES_SIZE);
/* We need exactly two page tables for the gv address space. */
BUILD_BUG_ON(LCD_BOOTSTRAP_PAGE_TABLES_SIZE >> PAGE_SHIFT != 2);
/* Number of LCD stack pages needs to be a power-of-two multiple. */
BUILD_BUG_ON_NOT_POWER_OF_2(LCD_STACK_SIZE >> PAGE_SHIFT);
/* We use the host module loader for loading .ko's and we
* don't relink (it's possible but not worth it right now).
* So the kernel module region gv address needs to match the
* starting gv address for the kernel map in the host. */
BUILD_BUG_ON(gva_val(LCD_KERNEL_MODULE_REGION_GV_ADDR) !=
__START_KERNEL_map);
}
/* HELPERS -------------------------------------------------- */
/**
* lcd_gva2gpa -- Convert a guest virtual to a guest physical address
* @gva: the guest virtual address to convert
......
......@@ -61,13 +61,13 @@ int _lcd_alloc_pages(unsigned int flags, unsigned int order,
cptr_t *slot_out);
/**
* _lcd_vmalloc -- Low-level vmalloc out into microkernel
* @order: allocate 2^order vmalloc pages
* @nr_pages: allocate nr_pages pages (nr_pages * PAGE_SIZE bytes)
* @slot_out: out param, cptr to vmalloc memory capability in caller's cspace
*
* Allocate pages that aren't necessarily contiguous in host
* physical. Pages are zero'd out.
*/
int _lcd_vmalloc(unsigned int order, cptr_t *slot_out);
int _lcd_vmalloc(unsigned long nr_pages, cptr_t *slot_out);
/*
* What about free pages? Use lcd_cap_revoke and/or lcd_cap_delete with
......@@ -207,8 +207,7 @@ void lcd_free_pages(struct page *base, unsigned int order);
*
* Allocate pages that aren't necessarily contiguous in guest
* physical or host physical. @sz is rounded up so that @sz is a
* page-multiple, and the page-multiple is a power of 2
* (@sz = 2^(order + page_size) for some order >= 0).
* page-multiple (just like regular vmalloc).
*/
void* lcd_vmalloc(unsigned long sz);
/**
......@@ -432,20 +431,14 @@ void lcd_unvolunteer_dev_mem(cptr_t devmem);
* control system
* @base: the virtual address at the start of the chunk of *virtually*
* contiguous vmalloc memory
* @order: there are 2^order pages of vmalloc memory being volunteered
* @nr_pages: there are nr_pages pages of vmalloc memory being volunteered
* @slot_out: out param, where the memory was stored in the caller's cspace
*
* Note: This only makes sense for non-isolated code. For isolated code,
* all memory objects it has access to are in its cspace, and so
* this function is equivalent to lcd_virt_to_cptr (see its documentation).
*
* Inserts vmalloc memory into the caller's cspace. Motivation: This is
* used when we load a module in the host for an LCD. The module
* loader uses vmalloc to set aside memory. Rather than create a capability
* for each individual page (as we did before), we create a capability that
* refers to the set of discontiguous pages. The object is the base *virtual*
* address of the vmalloc memory. Note that vmalloc memory allocations are
* page aligned.
* Inserts vmalloc memory into the caller's cspace.
*
* Of course, we risk the same memory being volunteered as regular RAM (via
* lcd_volunteer_page above). It's up to the non-isolated code not to do
......@@ -455,7 +448,7 @@ void lcd_unvolunteer_dev_mem(cptr_t devmem);
*
* Note: For non-isolated code, guest virtual == host virtual.
*/
int lcd_volunteer_vmalloc_mem(gva_t base, unsigned int order,
int lcd_volunteer_vmalloc_mem(gva_t base, unsigned long nr_pages,
cptr_t *slot_out);
/**
* lcd_unvolunteer_vmalloc_mem -- Remove vmalloc memory from the capability
......
......@@ -13,6 +13,7 @@ void lcd_printk(char *fmt, ...)
va_start(args, fmt);
vprintk(fmt, args);
va_end(args);
printk("\n"); /* flush */
}
/* EXPORTS -------------------------------------------------- */
......
......@@ -254,7 +254,7 @@ fail1:
return ret;
}
int _lcd_vmalloc(unsigned int order, cptr_t *slot_out)
int _lcd_vmalloc(unsigned long nr_pages, cptr_t *slot_out)
{
struct lcd *lcd = current->lcd;
cptr_t slot;
......@@ -270,7 +270,7 @@ int _lcd_vmalloc(unsigned int order, cptr_t *slot_out)
/*
* Allocate vmalloc memory
*/
ret = __lcd_vmalloc(lcd, slot, order);
ret = __lcd_vmalloc(lcd, slot, nr_pages);
if (ret) {
LIBLCD_ERR("alloc pages failed");
goto fail2;
......@@ -392,6 +392,7 @@ struct page *lcd_alloc_pages_exact_node(int nid, unsigned int flags,
struct lcd_memory_object *mo;
struct cnode *cnode;
struct page *p = NULL;
gpa_t unused;
/*
* Do lower-level alloc so that pages go into caller's cspace
*/
......@@ -405,7 +406,7 @@ struct page *lcd_alloc_pages_exact_node(int nid, unsigned int flags,
* (all this really does is put the allocated pages in the
* proper resource tree)
*/
ret = _lcd_mmap(slot, order, __gpa(0));
ret = lcd_map_phys(slot, order, &unused);
if (ret) {
LIBLCD_ERR("internal error: putting mem obj in tree");
goto fail2;
......@@ -440,6 +441,7 @@ struct page *lcd_alloc_pages(unsigned int flags, unsigned int order)
struct lcd_memory_object *mo;
struct cnode *cnode;
struct page *p = NULL;
gpa_t unused;
/*
* Do lower-level alloc so that pages go into caller's cspace
*/
......@@ -453,7 +455,7 @@ struct page *lcd_alloc_pages(unsigned int flags, unsigned int order)
* (all this really does is put the allocated pages in the
* proper resource tree)
*/
ret = _lcd_mmap(slot, order, __gpa(0));
ret = lcd_map_phys(slot, order, &unused);
if (ret) {
LIBLCD_ERR("internal error: putting mem obj in tree");
goto fail2;
......@@ -518,22 +520,21 @@ void lcd_free_pages(struct page *base, unsigned int order)
void* lcd_vmalloc(unsigned long sz)
{
struct lcd *lcd = current->lcd;
unsigned int order;
unsigned long nr_pages;
int ret;
cptr_t slot;
struct lcd_memory_object *mo;
struct cnode *cnode;
void *vptr = NULL;
gva_t unused;
/*
* Convert to order
* Convert to number of pages, rounding up
*/
order = ilog2(sz);
if (sz & ((1UL << order) - 1))
order++; /* round up */
nr_pages = ALIGN(sz, PAGE_SIZE) >> PAGE_SHIFT;
/*
* Do lower-level vmalloc so that mem goes into caller's cspace
*/
ret = _lcd_vmalloc(order, &slot);
ret = _lcd_vmalloc(nr_pages, &slot);
if (ret) {
LIBLCD_ERR("lower level vmalloc failed");
goto fail1;
......@@ -542,8 +543,10 @@ void* lcd_vmalloc(unsigned long sz)
* "Map" memory object in caller's physical address space
* (all this really does is put the allocated vmalloc mem in the
* proper resource tree)
*
* Order is ignored for now for non-isolated
*/
ret = _lcd_mmap(slot, order, __gpa(0));
ret = lcd_map_virt(slot, 0xbad, &unused);
if (ret) {
LIBLCD_ERR("internal error: putting mem obj in tree");
goto fail2;
......@@ -750,7 +753,7 @@ void lcd_unmap_virt(gva_t base, unsigned int order)
static int volunteer_mem_obj(struct task_struct *t,
void *mem_obj, unsigned long addr,
unsigned int order,
unsigned long nr_pages,
enum lcd_microkernel_type_id sub_type,
cptr_t *slot_out)
{
......@@ -782,7 +785,7 @@ static int volunteer_mem_obj(struct task_struct *t,
goto fail2;
}
ret = __lcd_insert_memory_object(t->lcd, slot, mem_obj,
order, sub_type, &mo);
nr_pages, sub_type, &mo);
if (ret) {
LIBLCD_ERR("error inserting new memory object");
goto fail3;
......@@ -819,7 +822,7 @@ int lcd_volunteer_pages(struct page *base, unsigned int order,
cptr_t *slot_out)
{
return volunteer_mem_obj(current, base,
page_to_pfn(base), order,
page_to_pfn(base), (1UL << order),
LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_PAGE,
slot_out);
}
......@@ -835,7 +838,7 @@ int lcd_volunteer_dev_mem(gpa_t base, unsigned int order,
cptr_t *slot_out)
{
return volunteer_mem_obj(current, (void *)gpa_val(base),
gpa_val(base), order,
gpa_val(base), (1UL << order),
LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_DEV_MEM,
slot_out);
}
......@@ -847,11 +850,11 @@ void lcd_unvolunteer_dev_mem(cptr_t devmem)
/* "VOLUNTEERING" VMALLOC MEMORY ---------------------------------------- */
int lcd_volunteer_vmalloc_mem(gva_t base, unsigned int order,
int lcd_volunteer_vmalloc_mem(gva_t base, unsigned long nr_pages,
cptr_t *slot_out)
{
return volunteer_mem_obj(current, (void *)gva_val(base),
gva_val(base), order,
gva_val(base), nr_pages,
LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM,
slot_out);
}
......
......@@ -85,7 +85,7 @@ fail1:
return ret;
}
int _lcd_vmalloc(unsigned int order, cptr_t *slot_out)
int _lcd_vmalloc(unsigned long nr_pages, cptr_t *slot_out)
{
cptr_t slot;
int ret;
......@@ -100,7 +100,7 @@ int _lcd_vmalloc(unsigned int order, cptr_t *slot_out)
/*
* Alloc pages
*/
ret = lcd_syscall_vmalloc(slot, order);
ret = lcd_syscall_vmalloc(slot, nr_pages);
if (ret) {
LIBLCD_ERR("vmalloc syscall failed");
goto fail2;
......
......@@ -7,6 +7,7 @@
#include <linux/list.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/log2.h>
#include <libcap.h>
#include <lcd_domains/microkernel.h>
......@@ -155,7 +156,7 @@ static int page_delete(struct cspace *cspace, struct cnode *cnode,
* Pages should be unmapped from all LCDs and not in use
* by any code. Free them.
*/
__free_pages(mo->object, mo->order);
__free_pages(mo->object, ilog2(mo->nr_pages));
/*
* Free mo, no one else should have a reference.
*/
......
......@@ -42,6 +42,11 @@ int __lcd_create_no_vm_no_thread(struct lcd **out)
LCD_ERR("cspace init failed");
goto fail3;
}
/*
* Store backref (this is used during delete and revoke callbacks,
* for example, to resolve cspace -> owning lcd)
*/
cap_cspace_setowner(lcd->cspace, lcd);
/*
* Set up synchronous ipc utcb
*/
......
......@@ -30,7 +30,7 @@ unsigned long __lcd_memory_object_start(struct lcd_memory_object *mo)
unsigned long __lcd_memory_object_size(struct lcd_memory_object *mo)
{
return (1UL << mo->order) << PAGE_SHIFT;
return mo->nr_pages << PAGE_SHIFT;
}
unsigned long __lcd_memory_object_last(struct lcd_memory_object *mo)
......@@ -78,7 +78,7 @@ hva_t __lcd_memory_object_hva(struct lcd_memory_object *mo)
int __lcd_insert_memory_object(struct lcd *caller, cptr_t slot,
void *mem_obj,
unsigned int order,
unsigned long nr_pages,
enum lcd_microkernel_type_id sub_type,
struct lcd_memory_object **mo_out)
{
......@@ -103,7 +103,7 @@ int __lcd_insert_memory_object(struct lcd *caller, cptr_t slot,
}
mo->sub_type = sub_type;
mo->object = mem_obj;
mo->order = order;
mo->nr_pages = nr_pages;
/*
* Insert memory object into global interval tree
*/
......@@ -182,7 +182,7 @@ int __lcd_alloc_pages_exact_node(struct lcd *caller, cptr_t slot, int nid,
/*
* Insert into caller's cspace
*/
ret = __lcd_insert_memory_object(caller, slot, p, order,
ret = __lcd_insert_memory_object(caller, slot, p, (1UL << order),
LCD_MICROKERNEL_TYPE_ID_PAGE,
&unused);
if (ret) {
......@@ -216,7 +216,7 @@ int __lcd_alloc_pages(struct lcd *caller, cptr_t slot,
/*
* Insert into caller's cspace
*/
ret = __lcd_insert_memory_object(caller, slot, p, order,
ret = __lcd_insert_memory_object(caller, slot, p, (1UL << order),
LCD_MICROKERNEL_TYPE_ID_PAGE,
&unused);
if (ret) {
......@@ -234,7 +234,7 @@ fail1:
/* VMALLOC -------------------------------------------------- */
int __lcd_vmalloc(struct lcd *caller, cptr_t slot, unsigned int order)
int __lcd_vmalloc(struct lcd *caller, cptr_t slot, unsigned long nr_pages)
{
int ret;
void *vptr;
......@@ -242,7 +242,7 @@ int __lcd_vmalloc(struct lcd *caller, cptr_t slot, unsigned int order)
/*
* Allocate zero'd out vmalloc pages
*/
vptr = vzalloc(1UL << (order + PAGE_SIZE));
vptr = vzalloc(nr_pages << PAGE_SHIFT);
if (!vptr) {
LCD_ERR("vzalloc failed");
ret = -ENOMEM;
......@@ -251,7 +251,7 @@ int __lcd_vmalloc(struct lcd *caller, cptr_t slot, unsigned int order)
/*
* Insert into caller's cspace
*/
ret = __lcd_insert_memory_object(caller, slot, vptr, order,
ret = __lcd_insert_memory_object(caller, slot, vptr, nr_pages,
LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM,
&unused);
if (ret) {
......@@ -374,7 +374,7 @@ static int isolated_map_vmalloc_mem(struct lcd *lcd,
/*
* Map each page, one at a time
*/
for (i = 0; i < (1UL << vmalloc_mo->order); i++) {
for (i = 0; i < vmalloc_mo->nr_pages; i++) {
hva = hva_add(vmalloc_base, i * PAGE_SIZE);
gpa = gpa_add(base, i * PAGE_SIZE);
/*
......@@ -440,7 +440,7 @@ static int isolated_map_contiguous_mem(struct lcd *lcd,
* caching, and we always map memory as WB in guest physical.
*/
ret = lcd_arch_ept_map_range(lcd->lcd_arch, base, hpa_base,
1 << mo->order);
mo->nr_pages);
if (ret) {
LCD_ERR("map");
goto fail2;
......@@ -566,7 +566,7 @@ static void isolated_unmap_vmalloc_mem(struct lcd *lcd,
*/
ret = lcd_arch_ept_unmap_range(lcd->lcd_arch,
meta->where_mapped,
vmalloc_mo->order);
vmalloc_mo->nr_pages);
if (ret)
LCD_DEBUG(LCD_DEBUG_ERR,
"some error unmapping");
......@@ -581,7 +581,7 @@ static void isolated_unmap_contiguous_mem(struct lcd *lcd,
* Unmap memory object
*/
ret = lcd_arch_ept_unmap_range(lcd->lcd_arch, meta->where_mapped,
1UL << mo->order);
mo->nr_pages);
if (ret)
LCD_DEBUG(LCD_DEBUG_ERR,
"some error unmapping");
......
......@@ -152,16 +152,16 @@ static int handle_syscall_mmap(struct lcd *lcd)
static int handle_syscall_vmalloc(struct lcd *lcd)
{
cptr_t slot;
unsigned int order;
unsigned long nr_pages;
/*
* Get slot where to store alloc'd pages and order
*/
slot = __cptr(lcd_arch_get_syscall_arg0(lcd->lcd_arch));
order = (unsigned int)lcd_arch_get_syscall_arg1(lcd->lcd_arch);
nr_pages = lcd_arch_get_syscall_arg1(lcd->lcd_arch);
/*
* Do vmalloc
*/
return __lcd_vmalloc(lcd, slot, order);
return __lcd_vmalloc(lcd, slot, nr_pages);
}
static int handle_syscall_pages_alloc(struct lcd *lcd)
......
......@@ -23,8 +23,8 @@ static int boot_main(void)
/*
* Create lcd
*/
ret = lcd_create_module_lcd(LCD_DIR("liblcd_tests/lcd"),
"lcd_test_mod_liblcd_tests_lcd",
ret = lcd_create_module_lcd(LCD_DIR("liblcd_test/lcd"),
"lcd_test_mod_liblcd_test_lcd",
&lcd,
&ctx);
if (ret) {
......
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