upvote
Afaik I think I saw the author say on reddit he used AI to prototype and then rewrote it.

https://www.reddit.com/r/openbsd/s/k0dz2WrkCo

In that thread I suggested he submit it to the ports tree, I'm not sure if he took my advice or came up with the idea on his own. At any rate this is cool.

reply
I never hid the fact that I iterated with AI. It's pretty hard to commit to an approach if you don't even know if it will succeed. And boy oh boy this was a shot in the dark.

I also respect Wine and OpenBSD and their rules to not have any LLM code in the repo/ports. So my approach was to iterate over solutions, find approach that works, ask AI to "just see if my idea even works", learn what/how/why of that approach, generate some supporting manuals for myself (for example how to decode %gs instructions and how to reencode them) and then write my own code based just on decoding tables (and not LLM code).

I did not know how to work with REX/SIB/ModRM, how to detect prefixes, how to parse every single instruction that contains %gs, how offsets work, how to encode jmp rels, why I want to use JMP *0(%RIP) instead of JMP 32rel on return, why I want to leave stub on SIGUSR (or any other signal). But I do know now.

I was incredibly lucky that patching just these %gs instructions were enough to launch Factorio and play, with broken sound, but anyways! Holy molly this was and is so much FUN!

The approach still feels like cheating, and if it feels the same for you, I perfectly understand.

reply
I'm way more ai skeptical than most HN users and I don't think you did anything wrong. Like I said in the reddit thread, the patches are cool. Kudos.
reply
this strikes me as the responsible way to use AI period - test it out, see what works then clean it up until its something you understand & can feel good about.
reply
Yes, treating it as an occasionally flawed/wrong personal tutor (instead of a code genie) seems like a good use of it. Nothing wrong with learning by whatever means necessary IMO.
reply
Yes, he said the same on the mailing list[0] when he asking about a related thing 3 weeks ago:

> I had some success in porting Wine to amd64.OpenBSD. Was able to run a few = games. But that required in memory patching of %gs commands (LLM's suggesti= on and 1st implementation, then I re-did it from scratch - I'm not that sma= rt with amd64 assembly code)

Also, it's not a single author. Other people contributed significantly and their contributions don't seem written by AI: https://github.com/NethIafin/wine/commits/openbsd-master/

[0]: https://marc.info/?l=openbsd-tech&m=179070255546118&w=2

reply
At that time, that LLM built solution was like 3+ weeks old if not more. It's just me and Fabien for now though. Rest are working on helping us turn it into a nice Port Wine
reply