Comparing struct pt_regs : asm-i386 vs asm-x86_64

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


Hi,

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 :

http://sourceforge.net/tracker/?group_id=13130&atid=313130

regards,

Robert
--
Robert M. Stockmann - RHCE
Network Engineer - UNIX/Linux Specialist
crashrecovery.org 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 http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/