Hi Neelesh,

You need to give some untyped memory objects to allocman before it can create kernel objects. I would encourage you to try and use the 'bootstrap_use_current_simple' if possible (this is what we do in sel4test for example https://github.com/seL4/sel4test/blob/master/apps/sel4test-driver/src/main.c#L82).

Otherwise if you look at bootstrap_use_current_simple you will that it first does bootstrap_use_current_1level and then allocman_add_simple_untypeds, which in the end boils down to calls to allocman_utspace_add_uts

Adrian

On Wed 26-Oct-2016 8:58 AM, Neelesh Vemula wrote:
Hi

I have created a new process from the root/init task. In the new process I have the following code for initializing the allocman as below:


vka_t vka;
allocman_t *allocman;
vspace_t vspace;

#define ALLOCATOR_STATIC_POOL_SIZE ((1 << seL4_PageBits) * 10)
UNUSED static char allocator_mem_pool[ALLOCATOR_STATIC_POOL_SIZE];

#define ALLOCATOR_VIRTUAL_POOL_SIZE ((1 << seL4_PageBits) * 100)



int main(int argc, char **argv) {
        
    allocman = bootstrap_use_current_1level(SEL4UTILS_CNODE_SLOT,
                                             CONFIG_SEL4UTILS_CSPACE_SIZE_BITS,
                                             0,
                                             (1u << CONFIG_SEL4UTILS_CSPACE_SIZE_BITS),
                                             ALLOCATOR_STATIC_POOL_SIZE,
                                             allocator_mem_pool);


    allocman_make_vka(&vka, allocman);

    vka_object_t ep_object = {0};
    error = vka_alloc_endpoint(&vka, &ep_object);
    ZF_LOGF_IFERR(error, "Failed to allocate new endpoint object.\n");



I have the following definition structure shared as 

enum sel4utils_cspace_layout {
    /*
     * The root cnode (with appropriate guard)
     */
    SEL4UTILS_CNODE_SLOT = 1,
    /* The slot on the cspace that fault_endpoint is put if
     * sel4utils_configure_process is used.
     */
    SEL4UTILS_ENDPOINT_SLOT = 2,

    SEL4UTILS_PD_SLOT = 3,

    FREE_SLOT = 4,
};

This particular program has compiled for zynq-7000 platform and when running it I get the following output in the stdout :

Just entered the user function
vka_alloc_object@object.h:51 Failed to allocate object of size 16, error 1

Assertion failed: error == 0 (/apps/zynq-comm-user/src/main.c: main: 71)

I have been not able to figure out why this error is occurring. I can only guess that the allocman was not initialized properly. Can someone help me with what I may have done wrong?

Regards
Neelesh Vemula


_______________________________________________
Devel mailing list
Devel@sel4.systems
https://sel4.systems/lists/listinfo/devel