A new version of the Qemu emulator for the Elbrus processor has been released

A new version of the Qemu emulator for the Elbrus processor has been released

$ git clone --depth=1 -b e2k https://git.mentality.rip/OpenE2K/qemu-e2k.git
$ cd qemu-e2k
$ mkdir build
$ cd build
$ ../configure --target-list=e2k-linux-user --static --disable-capstone --disable-werror
$ nice ninja
$ sudo cp qemu-e2k /usr/local/bin

$ cat hello.c
#include <stdio.h>
int main(int argc, char *argv[]) {
        const char *name = argc > 1 ? argv[1] : "world";
        printf("Hello, %s!\n", name);
        return 0;
}
$ lcc -O2 hello.c -o hello-e2k
$ qemu-e2k hello-e2k $USER
Hello, denis!

# setup binfmt
$ cat /etc/binfmt.d/qemu-e2k.conf 
:qemu-e2k:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xaf\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-e2k:OC
:qemu-e2k-old:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x31\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-e2k:OC
:qemu-e2k32:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xaf\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-e2k32:OC
:qemu-e2k32-old:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x31\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-e2k32:OC
$ ./hello-e2k $USER
Hello, denis!

Related posts