obhq / obliteration

Experimental PS4 emulator written in Rust for Windows, macOS and Linux
https://obliteration.net
MIT License
581 stars 17 forks source link

Figure out what to do about negative offsets when reading/writing #839

Open SuchAFuriousDeath opened 2 months ago

SuchAFuriousDeath commented 2 months ago

I remember from somewhere that FreeBSD allows negative offsets for devices, but our offset field is currently an u64.

ultimaweapon commented 2 months ago

Strange. I though FreeBSD is going to ignore the offset instead of using its negative value.

SuchAFuriousDeath commented 2 months ago

Ignore it where?

ultimaweapon commented 2 months ago

I don't know. It just my guess because a read/write to a device should not requires an offset.

SuchAFuriousDeath commented 2 months ago

I'm not saying it requires an offset. But the uio struct contains an offset field and in pwritev FreeBSD allows negative offsets (and we do too) image

ultimaweapon commented 2 months ago

I'm not saying it requires an offset. But the uio struct contains an offset field and in pwritev FreeBSD allows negative offsets (and we do too) image

The real purpose of this code should be not allowed a negative offset for non-device. What I suspect it FreeBSD will ignore the offset when reading or writing a device.

SuchAFuriousDeath commented 2 months ago

Sure, but how does that relate to this issue? :D You left a todo!() in the code and we have to deal with it somehow.

ultimaweapon commented 2 months ago

What we need to do is find a device that use this offset when reading or writing. If none of the devices used it we can remove it from the parameters.