agra-uni-bremen / riscv-vp

RISC-V Virtual Prototype
MIT License
139 stars 49 forks source link

macOS port #13

Open U2654 opened 3 years ago

U2654 commented 3 years ago

only macOS porting code... hopefully

nmeum commented 3 years ago

I managed to get remote access to a Mac OS X machine at our faculty and started looking into this in greater detail. Apart from the small compatibility issue with the current code base (e.g. unnamed semaphores, lack of st_atime in struct stat, …) there are also larger issues which don't seem to be addressed in this PR currently. For instance, Mac OS X provides a different API for the creation of tun devices (as used by the Ethernet and SLIP peripheral). In order to make these peripherals actually work—and not just compile—on OS X it seems to be me that we would be required to support utun network interfaces. Unfortunately, I wasn't able to find any official documentation for utun devices on Mac OS. OpenVPN does support them but unfortunately the OpenVPN code is licensed under AGPL. The CAN peripheral is subject to a similar problem, since it also relies on behavior not specified by POSIX. I am honestly unsure if the effort required to make these peripherals work properly is worth it. Alternatively, we could disable these peripherals on OS X, but then we would only support it partially and I am unsure if that is desirable.

U2654 commented 3 years ago

Thank you for your effort.

IMHO, it would be a benefit to have a macOS port with limited functions as none at all. If tun and can devices will be required, we (or whoever) can follow up.

I guess that the tun issue might be solvable. I don't use it. If you have a test/example using this, I could further investigate it. However, it might take a while before I'll find the time.

CAN could be some more work to do. AFAIK there is no OS support for BSD or macOS. I don't have a use or test case, too.