Go isn’t linking my assembly: undefined external function
You are using the wrong dot. instead of TEXT .mul(SB),4,$0-48 write TEXT ·mul(SB),4,$0-48 and everything works just fine.
You are using the wrong dot. instead of TEXT .mul(SB),4,$0-48 write TEXT ·mul(SB),4,$0-48 and everything works just fine.
NOPs serve several purposes: They allow the debugger to place a breakpoint on a line even if it is combined with others in the generated code. It allows the loader to patch a jump with a different-sized target offset. It allows a block of code to be aligned at a particular boundary, which can be … Read more
It stands for “End Branch 64 bit” — or more precisely, Terminate Indirect Branch in 64 bit. Here is the operation: IF EndbranchEnabled(CPL) & EFER.LMA = 1 & CS.L = 1 IF CPL = 3 THEN IA32_U_CET.TRACKER = IDLE IA32_U_CET.SUPPRESS = 0 ELSE IA32_S_CET.TRACKER = IDLE IA32_S_CET.SUPPRESS = 0 FI FI; The instruction is otherwise … Read more
The processor model as documented in the Intel/AMD processor manual is a pretty imperfect model for the real execution engine of a modern core. In particular, the notion of the processor registers does not match reality, there is no such thing as a EAX or RAX register. One primary job of the instruction decoder is … Read more
LR is link register used to hold the return address for a function call. SP is stack pointer. The stack is generally used to hold “automatic” variables and context/parameters across function calls. Conceptually you can think of the “stack” as a place where you “pile” your data. You keep “stacking” one piece of data over … Read more
rep; nop is indeed the same as the pause instruction (opcode F390). It might be used for assemblers which don’t support the pause instruction yet. On previous processors, this simply did nothing, just like nop but in two bytes. On new processors which support hyperthreading, it is used as a hint to the processor that … Read more
You know how memory addressing works? There’s an address bus, a data bus, and some control lines. The CPU puts the address of a byte (or a beginning byte) of memory on the address bus, then raises the READ signal, and some RAM chip hopefully returns the contents of memory at that address by raising … Read more
I think primarily you’re getting confused between a program’s stack and any old stack. A Stack Is an abstract data structure which consists of information in a Last In First Out system. You put arbitrary objects onto the stack and then you take them off again, much like an in/out tray, the top item is … Read more
No, the x86 instruction set is certainly not deprecated. It is as popular as ever. The reason Intel uses a set of RISC-like micro-instructions internally is because they can be processed more efficiently. So a x86 CPU works by having a pretty heavy-duty decoder in the frontend, which accepts x86 instructions, and converts them to … Read more
I have done this many times and continue to do this. In this case where your primary goal is reading and not writing assembler I feel this applies. Write your own disassembler. Not for the purpose of making the next greatest disassembler, this one is strictly for you. The goal is to learn the instruction … Read more