Live data from Hacker News

Ask HN: What's the best resource for learning modern x64 assembly?

news.ycombinator.com

101–110 of 112 posts

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#102

Earlier quoted context omitted.

>Learn whatever assembly language first On this front, I can highly recommend these two resources, preferably in this order for someone totally new to assembly: NAND to Tetris, a course that will have you build an emulated general-purpose CPU from first principles even with no prior knowledge. You'll learn exactly about registers and memory by making them. I even recommend this to non-hardware people because the way…

Little warning, Microcorruption may be no longer monitored at this time. Account registration is not automated. A hacker I closely follow tried to play Microcorruption during a Twitch broadcast, and, to my great disappointment, he was unable to due to lack of response.

Luckily their "Hall of Fame" is open for anyone to see. And some of the accounts in there are pretty obvious junk accounts with the usual junk passwords. Would probably take like 5 tries to "brute force" your way in, which given the context of the site would even seem fair game.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#103
post #102

Earlier quoted context omitted.

Little warning, Microcorruption may be no longer monitored at this time. Account registration is not automated. A hacker I closely follow tried to play Microcorruption during a Twitch broadcast, and, to my great disappointment, he was unable to due to lack of response.

Luckily their "Hall of Fame" is open for anyone to see. And some of the accounts in there are pretty obvious junk accounts with the usual junk passwords. Would probably take like 5 tries to "brute force" your way in, which given the context of the site would even seem fair game.

I agree that just about nobody would care in spirit.

It should probably at least be explicitly noted by anyone considering doing so: I'm sure that's still super illegal.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#104
post #45

Earlier quoted context omitted.

It's way better than IDA Pro. I have used the Pro version with the Hex-Rays decompiler. Ghidra is legitimately better. I wouldn't recommend IDA to anyone at this point because I don't see it having much of a future (sorry not sorry). It's worth learning the Ghidra Scripting API because you can write ad-hoc scripts with Jython syntax to automate tasks/do custom analysis.

I was using ghidra for one of my uhh research projects earlier and I actually found the decompiler from hex rays still does better in some cases. In ghidra sometimes it times out and fails to decompile. Maybe I'm not using it correctly? I haven't begun exploring what kind of plug-ins and stuff it has, maybe that helps?

It depends massively on platform, architecture, and programming language. Hex-Rays is probably still ideal for embedded and obscure platforms. Ghidra's decompiler seems optimized for ARM and amd64 userland consumer-level stuff that the NSA was most interested in hacking.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#105

It really depends on your starting point. If you know how to write low-level C (i.e. with direct Win32/POSIX API calls), that's a good start. If you don't know what that means, you need to master this first. So much of assembly is built to support higher-level programming, things like segments, indirect references, system calls, etc., so it pays to know the WHY of all of it (e.g. do you know what a frame pointer is?…

How can I get started on learning the low level c stuff with direct system calls and such. I learned about assembly, pipelining, cache, and memory allocation during a systems architecture course, so I'm really interested in the low level of the machine. The problem is I don't really have an idea of a project that I could do to learn the level right above. Of course I learned a bit during the course, but I really want…

I'd recommend writing something you might have used or be familiar with, in bare-metal C. Maybe try writing a simple web server, which is something most people will be familiar with. Try doing it a couple different ways: single-threaded, prefork (processes), event-based with select/kqueue/epoll. Write your own data structures: hash tables, linked lists, etc.

This sounds simple but will give you a good tour of a lot of different areas: BSD sockets, named pipes/unix domain sockets for cross-thread communication, signals, memory management, threading, basic scheduling, and parallel programming (locks/concurrency), to name a few.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#106
post #49
post #26

For practice and user-mode stuffs https://godbolt.org/ is a valueless tool to help you view the output of any C program. Simply write any C program on the left, and add "-O1" in flag inputs. Assembly with color representing line-mappings would appear on the right.

> valueless You mean "invaluable" here (cannot be given a value, as it's too important). "valueless" is the opposite (worthless)! https://en.wiktionary.org/wiki/valueless

Thanks. I had to read the original sentence multiple times; for a moment I thought I was having a stroke.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#107
post #33

Earlier quoted context omitted.

Thanks for the recommendation. I hadn't come across this one before. But wow, I forgot how expensive text books can be.

I picked up the international edition on Amazon a while back for $20 or so, significantly less than what they’re asking for now. I don’t see that one on amazon today, but I’ve seen that edition on other sites. I’d look for it. I haven’t finished the 3rd edition, but I made it about 3/4 of the way through the 2nd edition and loved it. I picked up the 3rd specifically for the x64 material.

If by the international edition you mean global edition, then you need to know that it has problems. See [1] and [2].

[1] https://news.ycombinator.com/item?id=22287045

[2] http://csapp.cs.cmu.edu/3e/errata.html

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#108

It really depends on your starting point. If you know how to write low-level C (i.e. with direct Win32/POSIX API calls), that's a good start. If you don't know what that means, you need to master this first. So much of assembly is built to support higher-level programming, things like segments, indirect references, system calls, etc., so it pays to know the WHY of all of it (e.g. do you know what a frame pointer is?…

Your comment about compilers is most likely true. The exception being if he needs to vectorize or if he had the opportunity use these special-purpose instructions that are seemingly built to accelerate particular algorithms.

On x86 pretty much all of the special purpose and vector instructions are accessible from C or C++ through intrinsics. No need to drop down to assembly for that except perhaps for a very, very specialized use case.
Post reply on HN