News for hackers. Stuff that matters.
Re:Wozmon for x86-64 by gabrielsroka on Wednesday November 29, 2023 @11:47AM (#38461747)
What a coincidence. I recently converted the 6502 version to Python and then worked with ChatGPT to convert the Python to C. (I'm not a C programmer.)

https://github.com/gabrielsroka/gabrielsroka.github.io/tree/...

Re:Wozmon for x86-64 by asveikau on Wednesday November 29, 2023 @11:53AM (#38461833)
To support running code you'll need to call mprotect(2) on the buffer to make it executable.

If you hit Ctrl-d on this code it will burn through that loop constantly with no input. You need to check fgets()'s return code, it will be NULL on error or eof.

Re:Wozmon for x86-64 by gabrielsroka on Wednesday November 29, 2023 @12:39PM (#38462416)
Thank you. I saw a warning about that from the compiler. But like I said I'm not a C programmer. Feel free to submit a PR if you like.

I assume you're talking about Linux/Unix. I'm mostly a Windows guy.

Re:Wozmon for x86-64 by asveikau on Wednesday November 29, 2023 @12:59PM (#38462725)
I am knowledgeable about both. Unix guy at heart but used to work for MSFT on windows.

The Windows version of mprotect(2) is VirtualProtect. It would probably make more sense to allocate the buffer with VirtualAlloc with the correct flags, rather than modify a stack buffer. The Unix version of that would be to allocate with mmap(2).

Edit: https://github.com/gabrielsroka/gabrielsroka.github.io/pull/...

Re:Wozmon for x86-64 by ianseyler on Wednesday November 29, 2023 @12:23PM (#38462183)
Interesting to see it written in higher-level languages!