Program Counter and Instruction Register

You will need both always. The program counter (PC) holds the address of the next instruction to be executed, while the instruction register (IR) holds the encoded instruction. Upon fetching the instruction, the program counter is incremented by one “address value” (to the location of the next instruction). The instruction is then decoded and executed … Read more

Intel 64, rsi and rdi registers

These registers were originally implicitly used in repetitive instructions, for instance MOVSB, which copy a byte from DS:SI (DataSegment:SourceIndex) to ES:DI(ExtraSegment:DestinationIndex), at the time of the 16-bits computers with segmented memory in real mode. And also as index registers in 16-bit addressing modes like [bx + si]. Right now, these registers are for example used … Read more

What are the names of the new X86_64 processors registers?

The MSDN documentation includes information about the x64 registers. x64 extends x64’s 8 general-purpose registers to be 64-bit, and adds 8 new 64-bit registers. The 64-bit registers have names beginning with “r”, so for example the 64-bit extension of eax is called rax. The new registers are named r8 through r15. The lower 32 bits, … Read more

Why is there not a register that contains the higher bytes of EAX?

Just for some clarification. In the early microprocessor days of the 1970’s, CPUs had only a small number of registers and a very limited instruction set. Typically, the arithmetic unit could only operate on a single CPU register, often referred to as the “accumulator”. The accumulator on the 8 bit 8080 & Z80 processors was … Read more

What are callee and caller saved registers?

Caller-saved registers (AKA volatile registers, or call-clobbered) are used to hold temporary quantities that need not be preserved across calls. For that reason, it is the caller’s responsibility to push these registers onto the stack or copy them somewhere else if it wants to restore this value after a procedure call. It’s normal to let … Read more

x86_64 registers rax/eax/ax/al overwriting full register contents [duplicate]

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

If registers are so blazingly fast, why don’t we have more of them?

There’s many reasons you don’t just have a huge number of registers: They’re highly linked to most pipeline stages. For starters, you need to track their lifetime, and forward results back to previous stages. The complexity gets intractable very quickly, and the number of wires (literally) involved grows at the same rate. It’s expensive on … Read more

Trying to understand gcc option -fomit-frame-pointer

Most smaller functions don’t need a frame pointer – larger functions MAY need one. It’s really about how well the compiler manages to track how the stack is used, and where things are on the stack (local variables, arguments passed to the current function and arguments being prepared for a function about to be called). … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)