Linux Kernel Architecture

(Jacob Rumans) #1
Mauerer runapp01.tex V1 - 09/04/2008 6:08pm Page 1134

Appendix A: Architecture Specifics


A.7.8 AMD64


Even though the AMD64 architecture is very similar to its IA32 predecessor, a number of registers have
been added so that there are some differences as concerns the registers that must be saved during system
calls:

include/asm-x86/ptrace.h
struct pt_regs {
unsigned long r15;
unsigned long r14;
unsigned long r13;
unsigned long r12;
unsigned long rbp;
unsigned long rbx;
/* arguments: non interrupts/non tracing syscalls only save upto here*/
unsigned long r11;
unsigned long r10;
unsigned long r9;
unsigned long r8;
unsigned long rax;
unsigned long rcx;
unsigned long rdx;
unsigned long rsi;
unsigned long rdi;
unsigned long orig_rax;
/* end of arguments */
/* cpu exception frame or undefined */
unsigned long rip;
unsigned long cs;
unsigned long eflags;
unsigned long rsp;
unsigned long ss;
/* top of stack page */
};

The close ties between the two architectures are very apparent in the followingthread_structstructure
which has almost exactly the same layout as in IA32:

include/asm-x86_64/processor.h
struct thread_struct {
unsigned long rsp0;
unsigned long rsp;
unsigned long userrsp; /* Copy from PDA */
unsigned long fs;
unsigned long gs;
unsigned short es, ds, fsindex, gsindex;
/* Hardware debugging registers */
unsigned long debugreg0;
unsigned long debugreg1;
unsigned long debugreg2;
unsigned long debugreg3;
unsigned long debugreg6;
unsigned long debugreg7;
/* fault info */
Free download pdf