bao-project / bao-demos

A guide on how to build and use a set of Bao guest configurations for various platforms
Other
33 stars 37 forks source link

feat(guests/linux): add mmap interface for bao ipc in Linux #32

Closed clachan closed 1 year ago

clachan commented 1 year ago

The follow code snippet shows how to use it:

int fd = open("/dev/baoipc0", O_RDWR); char ipcshmem_read = (char )mmap(NULL, 0x2000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); char ipcshmem_write = (char )mmap(NULL, 0x2000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x2000);

// direct pointer access

munmap(ipcshmem_read, 0x2000); munmap(ipcshmem_write, 0x2000);

clachan commented 1 year ago

Hi,

I implemented the mmap interface for my own purpose, and think it may benefit others. Please review. Any comments are welcome.

Thanks, Clay

josecm commented 1 year ago

Thanks for the PR @clachan. Although this is not used in the demo, it is very useful as a reference. However, in the near future, we want to clearly design and specify support for using Bao IPC shared memory (maybe using some already existing protocol) and provide the kernel module on its own repo. If you have any interest in contributing in this sense, please let us know!

clachan commented 1 year ago

Thanks for the PR @clachan. Although this is not used in the demo, it is very useful as a reference. However, in the near future, we want to clearly design and specify support for using Bao IPC shared memory (maybe using some already existing protocol) and provide the kernel module on its own repo. If you have any interest in contributing in this sense, please let us know!

Yes, I am interested. Please let me know the plan when appropriate. Looking forward to contributing more.