Comparing struct pt_regs : asm-i386 vs asm-x86_64

From: Robert M. Stockmann
Date: Sat Jul 17 2004 - 12:57:06 EST


The (X86_64/AMD64/Opteron) platform is pretty compatible with 32 bits
software written for the ia32 architecture, so to seems.

However when going down to assembly language it breaks down to pieces :

include/asm-i386/ptrace.h :

/* this struct defines the way the registers are stored on the
stack during a system call. */

struct pt_regs {
long ebx;
long ecx;
long edx;
long esi;
long edi;
long ebp;
long eax;
int xds;
int xes;
long orig_eax;
long eip;
int xcs;
long eflags;
long esp;
int xss;

include/asm-x86_64/ptrace.h :

#ifndef __ASSEMBLY__

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 */

So when porting i386 C-code (which uses the struct pt_regs from
include/asm-i386/ptrace.h) how does the pt_regs structure translate into
the struct pt_regs from include/asm-x86_64/ptrace.h ?

Actually the software i'm referring to is the linux-abi project. Latest
patch contributions, also for kernel 2.6.7 can be found at :


Robert M. Stockmann - RHCE
Network Engineer - UNIX/Linux Specialist stock@xxxxxxxxxxx

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at