obhq / obliteration

Experimental free and open-source PlayStation 4 kernel
https://obliteration.net
Apache License 2.0
624 stars 18 forks source link

Implement /dev/dmem{0,1,2} #500

Closed ultimaweapon closed 10 months ago

ultimaweapon commented 10 months ago

Implement only open. Or implement more if you want to go further. But better to implement only open so it is easier to get merged.

SuchAFuriousDeath commented 10 months ago

Could you add a bit more context to this (that is, if you're not working on it yourself already). Does it just open them, or try to do ioctl on them or...?

ultimaweapon commented 10 months ago

Updated.

SuchAFuriousDeath commented 10 months ago

Nice. Do we just add an 'open' function to VFileOps, which will be a no-op where there's a null pointer on the PS4, or do we align more closely with how the PS4 works internally and create a struct with optional function pointers instead of VFileOps?

ultimaweapon commented 10 months ago

Sorry I don't understand what you mean.

SuchAFuriousDeath commented 10 months ago

Well in FreeBSD, the devices are represented with structs, that have function pointers, we have structs, that implement the VFileOps trait. In FreeBSD, some of those function pointers can be null (and for a lot of devices, some are). How do we represent that with out VFileOps trait? It can't have an optional function.

SuchAFuriousDeath commented 10 months ago
image
SuchAFuriousDeath commented 10 months ago
image
SuchAFuriousDeath commented 10 months ago

You can see that deci_tty6 has null for d_read. How do cover that option with a trait? I don't think we can.

ultimaweapon commented 10 months ago

Actually those ones are not VFileOps. It is much lower level. I'm trying to make our FS implementation work in the similar way as the PS4. For now just mimic how the PS4 return when those fields are null in each implementation of VFileOps.

red-prig commented 10 months ago

@SuchAFuriousDeath You obviously did something wrong, because firstly d_version should be equal to 17122009, secondly deci_tty6 is the name of the device, but the structure itself is, if I’m not mistaken, deci_tty

SuchAFuriousDeath commented 10 months ago

oh, oops. Thank you both.

ultimaweapon commented 10 months ago

Actually those ones are not VFileOps. It is much lower level. I'm trying to make our FS implementation work in the similar way as the PS4. For now just mimic how the PS4 return when those fields are null in each implementation of VFileOps.

This may take some time because the filesystem in the FreeBSD is quite complicated. They have a lot of layers and they also use some scripts to generate some of the functions and structs.

SuchAFuriousDeath commented 10 months ago

Sounds fun :D

red-prig commented 10 months ago

He talks about this https://github.com/freebsd/freebsd-src/blob/releng/9.0/sys/tools/vnode_if.awk