Improving FreeBSD User Emulation For Various Architectures

Project description

The project involves implementing necessary syscalls as well as to support more architectures such as RISCV and Aarch64.The tasks involves verifying the code that is present in the ‘blitz’ branch and debugging it if necessary. Main focus would be on supporting more architectures but I will try finding out any common syscalls and implementing them as well.

Approach to solving the problem

Currently in the QEMU main branch at qemu/bsd-user there is only support for arm, i386 and x86_64 but in the blitz fork code for Aarch64 and RISCV has been added. So my main goal would be to upstream these changes after testing and debugging them. Also as suggested by my mentor I will use poudriere to test for any broken call but not for comprehensive testing for evaluation.

The project workflow will include the following things:
1. Implement and verify the code from the Blitz branch.
2. Send the commits as patches to the mailing list and address any possible issues or improvements received from the feedback.
3. Commit the patch and check if it doesn’t break anything.

Deliverables

I have delivered patches for AArch64 and RISC-V FreeBSD support for QEMU after addressing the issues raised by the reviewer.

Milestones

Test Plan

By referencing BSD-USER.rst. First I set up a VM for FreeBSD 14.1R and installed the necessary packages for setting up a poudriere jail.
Then I cloned and built my repo with the commited patches https://github.com/Ajeets6/qemu/tree/riscv64v3

   1  mkdir git
   2  cd git
   3  git clone -b riscv64v3 https://github.com/Ajeets6/qemu.git bsd-user
   4  git clone git@gitlab.com:qemu-project/qemu.git qemu
   5  cd bsd-user
   6  mkdir 00-bsd-user% cd 00-bsd-user
   7  ../configure --disable-system --static
   8  gmake


Then I built and started the jail as following:

   1 poudriere jail -c -j 141riscv64 -a riscv.riscv64 -v 14.1-RELEASE -p default
   2 poudriere jail -s -j 141riscv64


At last I built and tested a RISCV binary using the created jail.

   1 cc -target freebsd-riscv --sysroot /usr/local/poudriere/jails/141riscv64 -o hello-riscv
   2 cd git/bsd-user/00-bsd-user/qemu-riscv -L /usr/local/poudriere/jails/141riscv64 ./hello-riscv


The same steps were used to test Aarch64 binaries as well

The Code

The Aarch64 patches have been applied:
https://patchew.org/QEMU/20240724220449.10398-1-imp@bsdimp.com/
The RISCV v3 patches have been submitted after addressing changes
https://patchew.org/QEMU/20240824045635.8978-1-itachis@FreeBSD.org/

Github
linkedin

SummerOfCode2024Projects/ImprovingFreeBSDUserEmulationForVariousArchitectures (last edited 2024-08-28T16:27:43+0000 by AjeetSingh)