qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hello world example with qemu-system-arm


From: James Gutbub
Subject: Re: Hello world example with qemu-system-arm
Date: Mon, 16 May 2022 15:25:54 -0700

Thank you for the help. I tried specifying ‘-R 0’ and receive the same error message - qemu-arm: Unable to reserve 0xffff0000 bytes of virtual address space at 0x1000 (Permission denied) for use as guest address space (check your virtual memory ulimit setting, min_mmap_addr or reserve less using -R option)

I have been using the default linker script provided by arm-none-eabi-ld but I will continue by using the linker script defined below, which gives the same error message as before.

test.ld file contents:

ENTRY(_Reset)
SECTIONS
{
. = 0x0000000;
.startup . : { startup.o(.text)}
.text : { *(.text) }
. = 0x8000000;
.data : { *(.data) }
.bss : { *(.bss COMMON) }
. = ALIGN(8);
. = . + 0x1000;
_stack = .;
}

And so my linking command now adds this using ‘-T test.ld’:

arm-none-eabi-ld startup.o -T test.ld -Map=test.map -o test.elf -e _Reset

I also tried ‘sudo sysctl -w vm.mmap_min_addr=”65536” ’ mentioned in https://gitlab.com/qemu-project/qemu/-/issues/447 and then run qemu-arm, I get a different error now (and it’s the same with ‘-R 0’):

qemu-arm: test.elf: Error mapping file: Cannot allocate memory

Would appreciate any additional advice you can share. If there is a better supported host environment to use than CentOS Stream 8 I could try it instead.

And here is the contents of test.map when using test.ld:

Memory Configuration

Name             Origin             Length             Attributes
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map
LOAD startup.o
                0x0000000000000000                . = 0x0
.startup        0x0000000000000000       0x1c
startup.o(.text)
.text          0x0000000000000000       0x1c startup.o
                0x0000000000000000                _Reset
.text
*(.text)
.glue_7         0x000000000000001c        0x0
.glue_7        0x000000000000001c        0x0 linker stubs
.glue_7t        0x000000000000001c        0x0
.glue_7t       0x000000000000001c        0x0 linker stubs
.vfp11_veneer   0x000000000000001c        0x0
.vfp11_veneer  0x000000000000001c        0x0 linker stubs
.v4_bx          0x000000000000001c        0x0
.v4_bx         0x000000000000001c        0x0 linker stubs
.iplt           0x000000000000001c        0x0
.iplt          0x000000000000001c        0x0 startup.o
.rel.dyn        0x000000000000001c        0x0
.rel.iplt      0x000000000000001c        0x0 startup.o
                0x0000000008000000                . = 0x8000000
.data           0x0000000008000000        0x0
*(.data)
.data          0x0000000008000000        0x0 startup.o
.igot.plt       0x0000000008000000        0x0
.igot.plt      0x0000000008000000        0x0 startup.o
.bss            0x0000000008000000        0x0
*(.bss COMMON)
.bss           0x0000000008000000        0x0 startup.o
                0x0000000008000000                . = ALIGN (0x8)
                0x0000000008001000                . = (. + 0x1000)
                0x0000000008001000                _stack = .
OUTPUT(test.elf elf32-littlearm)
LOAD linker stubs

.ARM.attributes
                0x0000000000000000       0x1d
.ARM.attributes
                0x0000000000000000       0x1d startup.o

Kind Regards,
James G.

On Sat, May 14, 2022 at 3:57 AM Peter Maydell <peter.maydell@linaro.org> wrote:
On Fri, 13 May 2022 at 23:59, James Gutbub <jgutbub@asu.edu> wrote:
>
> arm-none-eabi-as  -march=armv7-a startup.s -o startup.o
>
> arm-none-eabi-ld  startup.o -Map=test.map -o test.elf -e _Reset
>
>
>
> qemu-arm -cpu cortex-a7 -d in_asm,exec,cpu,int,unimp,guest_errors,nochain -D test.log test.elf
>
>
>
> qemu-arm: Unable to reserve 0xffff0000 bytes of virtual address space at 0x1000 (Permission denied) for use as guest address space (check your virtual memory ulimit setting, min_mmap_addr or reserve less using -R option)

You don't say what's in your test.map, but it is probably
trying to put bits of the ELF file in places that make
qemu-arm's attempt to reserve address space unhappy.

'-R 0' will probably be enough to work around this.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]