Alex Bennée <alex.ben...@linaro.org> writes:

> +    asprintf(&heap_info, "heap: %p -> %p\n", info.heap_base, 
> info.heap_limit);
> +    __semi_call(SYS_WRITE0, (uintptr_t) heap_info);
> +    if (info.heap_base != brk) {

That requires qemu to know a lot about the run-time environment, which
it rarely does in my experience of embedded systems...

All I've been able to check is whether the heap base is not below the
heap limit and the stack base is not above the stack limit. Not exactly
great validation, but at least it caught the case where I set the stack
limit to the top of the stack?

        if (block.heap_base != NULL && block.heap_limit != NULL) {
                /* Error if heap base is above limit */
                if ((uintptr_t) block.heap_base >= (uintptr_t) 
block.heap_limit) {
                        printf("heap base %p >= heap_limit %p\n",
                               block.heap_base, block.heap_limit);
                        exit(1);
                }
        }
        if (block.stack_base != NULL && block.stack_limit != NULL) {
                /* Error if stack base is below limit */
                if ((uintptr_t) block.stack_base < (uintptr_t) 
block.stack_limit) {
                        printf("stack base %p < stack_limit %p\n",
                               block.stack_base, block.stack_limit);
                        exit(2);
                }
        }
        exit(0);


-- 
-keith

Attachment: signature.asc
Description: PGP signature

Reply via email to