Readit News logoReadit News
btdmaster commented on Show HN: X86CSS – An x86 CPU emulator written in CSS   lyra.horse/x86css/... · Posted by u/rebane2001
btdmaster · 20 days ago
Very cool. The horsle demo made me think, how hard would it be to add a virtual memory address (or a non-8086 RAND instruction) that returns a random byte (that would allow it to pick a random value and get a standard wordle working in principle)

I see CSS random() is only supported by Safari, I wonder if there's some side channel that would work in Chrome specifically? (I guess timing the user input would work)

btdmaster commented on Both GCC and Clang generate strange/inefficient code   codingmarginalia.blogspot... · Posted by u/rsf
delta_p_delta_x · a month ago
Even at a higher level of abstraction, the compiler seems to pull through: https://godbolt.org/z/1nvE34YTe
btdmaster · a month ago
It emits a cmp/jmp still when arithmetic would be fine though which is the difference highlighted in the article and examples in this thread. It's nice that it simplifies down to assembly, but the assembly is somewhat questionable (especially that xor eax eax branch target on the other side).
btdmaster commented on Both GCC and Clang generate strange/inefficient code   codingmarginalia.blogspot... · Posted by u/rsf
maccard · a month ago
To back up the other commenter - it's not the same. https://godbolt.org/z/r6e443x1c shows that if you write imperfect C++ clang is perfectly capable of optimizing it.
btdmaster · a month ago
I see yeah that makes sense. I wanted to highlight that "magic" will, on average, give the optimizer a harder time. Explicit offset loops like that are generally avoided in many C++ styles in favor of iterators.
btdmaster commented on Both GCC and Clang generate strange/inefficient code   codingmarginalia.blogspot... · Posted by u/rsf
btdmaster · a month ago
In my experience C++ abstractions give the optimizer a harder job and thus it generates worse code. In this case, different code is emitted by clang if you write a C version[0] versus C++ original[1].

Usually abstraction like this means that the compiler has to emit generic code which is then harder to flow through constraints and emit the same final assembly since it's less similar to the "canonical" version of the code that wouldn't use a magic `==` (in this case) or std::vector methods or something else like that.

[0] https://godbolt.org/z/vso7xbh61

[1] https://godbolt.org/z/MjcEKd9Tr

btdmaster commented on Linear Address Spaces: Unsafe at any speed (2022)   queue.acm.org/detail.cfm?... · Posted by u/nithssh
btdmaster · 2 months ago
I think you could argue there is already some effort to do type safety at the ISA register level, with e.g. shadow stack or control flow integrity. Isn't that very similar to this, except targeting program state rather than external memory?
btdmaster commented on Unix v4 (1973) – Live Terminal   unixv4.dev/... · Posted by u/pjmlp
btdmaster · 2 months ago
Everything really is a file: if you do `cat /` you'll get back the internal representation of the directory entries in / (analogous to ls)

And they still had coredumps at the time if you press ctrl-\

btdmaster commented on Assorted less(1) tips   blog.thechases.com/posts/... · Posted by u/todsacerdoti
btdmaster · 2 months ago
You can also press `s` to save data from a pipe to a file rather than manually copy pasting.

u/btdmaster

KarmaCake day1708March 29, 2021View Original