TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Spotting Patterns in C Disassembly

54 pointsby donmccabout 11 years ago

5 comments

ndesaulniersabout 11 years ago
Very nice, this is the blog post that I wanted to follow up mine with: <a href="http://nickdesaulniers.github.io/blog/2014/04/18/lets-write-some-x86-64/" rel="nofollow">http:&#x2F;&#x2F;nickdesaulniers.github.io&#x2F;blog&#x2F;2014&#x2F;04&#x2F;18&#x2F;lets-write-...</a> I guess I still could, for x86_64. Any interest?<p>I believe the term for these patterns is called &quot;lowering.&quot;
评论 #7769954 未加载
eldavidoabout 11 years ago
Interested in this stuff? Get a computer engineering degree. This is precisely what we studied in my first-year programming classes. I have fond memories of lecture halls with blackboards on every wall, divided into right and left columns, showing simplified x86 assembly on the left, and C code on the right.<p>Another interesting topic in this area is calling conventions: the expectations of your compiler&#x2F;platform on how the stack is arranged, to facilitate &quot;linkage&quot; between callers and callees. The &quot;calling convention&quot; dictates where the return value goes, where the processor registers get saved (so they can be restored when control transfers back from the called function to the caller), and the location of the return address. Also, it varies based on whether you&#x27;re calling code in your own program or into the operating system -- OS calls always have to scrub all the registers, to avoid leaking protected state back to userspace.<p>Nice article.
评论 #7771080 未加载
pjmlpabout 11 years ago
In the late 80&#x27;s, when compilers for micro-computers still generated crappy code, it was quite easy to write tools that would map back to the source, if one knew which compiler was used.<p>Most patterns were as easy as tracking down bytecodes.
评论 #7770154 未加载
评论 #7770485 未加载
joncooperabout 11 years ago
I&#x27;m working on the Coursera compilers class right now, which is excellent: <a href="https://class.coursera.org/compilers-004" rel="nofollow">https:&#x2F;&#x2F;class.coursera.org&#x2F;compilers-004</a><p>The code generation portion of the class covers this material from the other end, i.e. at the point where the AST is transformed into assembly code, and it has been super interesting.<p>This is obvious in retrospect but wasn&#x27;t to me beforehand: if you&#x27;re interested in reverse engineering, it&#x27;s very helpful to study how the assembly was written in the first place.
评论 #7771141 未加载
jenandreabout 11 years ago
awesome, ok, then you try to go reconstruct a vtable and want to kill yourself
评论 #7769921 未加载
评论 #7769465 未加载