Why do Windows functions all begin with a pointless MOV EDI, EDI instruction?
https://devblogs.microsoft.com/oldnewthing/20110921-00/?p=95...
Why do Windows functions all begin with a pointless MOV EDI, EDI instruction?
https://devblogs.microsoft.com/oldnewthing/20110921-00/?p=95...
For this specific blog post there's an HN discussion¹ and archive.today² (beware!?³) did grab comments while the Internet Archive does not load them:
¹ https://news.ycombinator.com/item?id=3022224
² http://archive.today/2015.07.08-134638/http://blogs.msdn.com...
Side note: Michael Kaplan’s blog, which Microsoft took down in a remarkably shameful manner, has also been archived[3], while Eric Lippert reposted (most of?) his old articles on his personal WordPress instance[4].
[1] http://bytepointer.com/resources/old_new_thing/index.htm
[2] http://bytepointer.com/resources/old_new_thing/20110921_226_...
At the time that seemed like a good way of getting low-level code-related posts.
[1] https://docs.microsoft.com/en-us/archive/blogs/larryosterman...
Or is it that when you get to assembly-level instructions, you can have total confidence that everything you’re reading will be executed as-is ?
Wouldn't it be the same to have a single 5-byte effectless operation to patch a single long jump instead of needing space for two jumps?
I thought that multibyte NOPs were executed in a single instruction?
Besides, it sounds like premature optimization. This isn’t the 1980s; An extra clock cycle per function call is not going to make or break your program.
There is a very good chance this dates back to 16-bit Windows. Even Windows 98 supported the 486 which was not capable of independent execution (that’s P5) or separate decode from execution (P5Pro there).
Those processors weren’t dead until Windows XP.