mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 13:39:39 +01:00 
			
		
		
		
	+ Add x86_64 cpu sigcontext record
git-svn-id: trunk@20711 -
This commit is contained in:
		
							parent
							
								
									ea216f8d0f
								
							
						
					
					
						commit
						c12f09316e
					
				@ -80,10 +80,18 @@ type sigset_t = array[0..3] of cardinal;
 | 
			
		||||
 | 
			
		||||
    PSigContextRec = ^SigContextRec;
 | 
			
		||||
    psigcontext = ^sigcontextrec;
 | 
			
		||||
{$ifdef cpui386}
 | 
			
		||||
    PFpuState = ^TFpuState;
 | 
			
		||||
{$endif def cpui386}
 | 
			
		||||
{$ifdef cpux86_64}
 | 
			
		||||
    PFpu64State = ^TFpu64State;
 | 
			
		||||
{$endif def cpux86_64}
 | 
			
		||||
    SigContextRec = record
 | 
			
		||||
       sc_mask      : sigset_t;          { signal mask to restore }
 | 
			
		||||
{$ifdef cpui386}
 | 
			
		||||
(*     sc_mask      : sigset_t;          { signal mask to restore }
 | 
			
		||||
       sc_onstack   : longint;              { sigstack state to restore }
 | 
			
		||||
 | 
			
		||||
       I did not find those fields in OpenBSD
 | 
			
		||||
       /usr/iclude/i386/signal.h header *)
 | 
			
		||||
       sc_gs        : longint;              { machine state (struct trapframe): }
 | 
			
		||||
       sc_fs        : longint;
 | 
			
		||||
       sc_es        : longint;
 | 
			
		||||
@ -91,18 +99,55 @@ type sigset_t = array[0..3] of cardinal;
 | 
			
		||||
       sc_edi       : longint;
 | 
			
		||||
       sc_esi       : longint;
 | 
			
		||||
       sc_ebp       : longint;
 | 
			
		||||
       sc_isp       : longint;
 | 
			
		||||
       sc_ebx       : longint;
 | 
			
		||||
       sc_edx       : longint;
 | 
			
		||||
       sc_ecx       : longint;
 | 
			
		||||
       sc_eax       : longint;
 | 
			
		||||
       sc_trapno    : longint;
 | 
			
		||||
       sc_err       : longint;
 | 
			
		||||
       sc_eip       : longint;
 | 
			
		||||
       sc_cs        : longint;
 | 
			
		||||
       sc_efl       : longint;
 | 
			
		||||
       sc_esp       : longint;
 | 
			
		||||
       sc_ss        : longint;
 | 
			
		||||
       sc_onstack   : longint;
 | 
			
		||||
       sc_mask      : longint;
 | 
			
		||||
       sc_trapno    : longint;
 | 
			
		||||
       sc_err       : longint;
 | 
			
		||||
       sc_fpustate  : pfpustate;
 | 
			
		||||
{$endif def cpui386}
 | 
			
		||||
{$ifdef cpux86_64}
 | 
			
		||||
	sc_rdi : clong;
 | 
			
		||||
	sc_rsi : clong;
 | 
			
		||||
        sc_rdx : clong;
 | 
			
		||||
	sc_rcx : clong;
 | 
			
		||||
	sc_r8  : clong;
 | 
			
		||||
	sc_r9  : clong;
 | 
			
		||||
	sc_r10 : clong;
 | 
			
		||||
	sc_r11 : clong;
 | 
			
		||||
	sc_r12 : clong;
 | 
			
		||||
	sc_r13 : clong;
 | 
			
		||||
	sc_r14 : clong;
 | 
			
		||||
	sc_r15 : clong;
 | 
			
		||||
	sc_rbp : clong;
 | 
			
		||||
	sc_rbx : clong;
 | 
			
		||||
	sc_rax : clong;
 | 
			
		||||
	sc_gs  : clong;
 | 
			
		||||
	sc_fs  : clong;
 | 
			
		||||
	sc_es  : clong;
 | 
			
		||||
	sc_ds  : clong;
 | 
			
		||||
	sc_trapno : clong;
 | 
			
		||||
	sc_err : clong;
 | 
			
		||||
	sc_rip : clong;
 | 
			
		||||
	sc_cs  : clong;
 | 
			
		||||
	sc_rflags : clong;
 | 
			
		||||
	sc_rsp : clong;
 | 
			
		||||
	sc_ss  : clong;
 | 
			
		||||
	sc_fpstate : PFpu64State;
 | 
			
		||||
	sc_onstack : cint;
 | 
			
		||||
	sc_mask : cint;
 | 
			
		||||
{$endif def cpux86_64}
 | 
			
		||||
     end;
 | 
			
		||||
{$ifdef cpui386}
 | 
			
		||||
     TFpuState = record
 | 
			
		||||
        {
 | 
			
		||||
         * XXX FPU state is 27 * 4 bytes h/w, 1 * 4 bytes s/w (probably not
 | 
			
		||||
         * needed here), or that + 16 * 4 bytes for emulators (probably all
 | 
			
		||||
@ -117,11 +162,92 @@ type sigset_t = array[0..3] of cardinal;
 | 
			
		||||
       en_foo       : cardinal;     { floating operand offset }
 | 
			
		||||
       en_fos       : cardinal;     { floating operand segment selector }
 | 
			
		||||
       fpr_acc      : array[0..79] of char;
 | 
			
		||||
       fpr_ex_sw    : cardinal;
 | 
			
		||||
       fpr_ex_sw    : cardinal;     { status word of last exception }
 | 
			
		||||
       fpr_ex_tw    : cardinal;     { tag word of last exception }
 | 
			
		||||
       fpr_pad      : array[0..63] of char;
 | 
			
		||||
       end;
 | 
			
		||||
{$endif def cpui386}
 | 
			
		||||
 | 
			
		||||
(*  From /usr/include/amd64/fpu.h header 
 | 
			
		||||
/*
 | 
			
		||||
 * amd64 only uses the extended save/restore format used
 | 
			
		||||
 * by fxsave/fsrestore, to always deal with the SSE registers,
 | 
			
		||||
 * which are part of the ABI to pass floating point values.
 | 
			
		||||
 * Must be stored in memory on a 16-byte boundary.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
struct fxsave64 {
 | 
			
		||||
	u_int16_t  fx_fcw;
 | 
			
		||||
	u_int16_t  fx_fsw;
 | 
			
		||||
	u_int8_t   fx_ftw;
 | 
			
		||||
	u_int8_t   fx_unused1;
 | 
			
		||||
	u_int16_t  fx_fop;
 | 
			
		||||
	u_int64_t  fx_rip;
 | 
			
		||||
	u_int64_t  fx_rdp;
 | 
			
		||||
	u_int32_t  fx_mxcsr;
 | 
			
		||||
	u_int32_t  fx_mxcsr_mask;
 | 
			
		||||
	u_int64_t  fx_st[8][2];   /* 8 normal FP regs */
 | 
			
		||||
	u_int64_t  fx_xmm[16][2]; /* 16 SSE2 registers */
 | 
			
		||||
	u_int8_t   fx_unused3[96];
 | 
			
		||||
} __packed;
 | 
			
		||||
 | 
			
		||||
struct savefpu {
 | 
			
		||||
	struct fxsave64 fp_fxsave;	/* see above */
 | 
			
		||||
	u_int16_t fp_ex_sw;		/* saved status from last exception */
 | 
			
		||||
	u_int16_t fp_ex_tw;		/* saved tag from last exception */
 | 
			
		||||
}; *)
 | 
			
		||||
{$ifdef cpux86_64}
 | 
			
		||||
    TFpu64State = packed record
 | 
			
		||||
	fx_fcw : cuint16;
 | 
			
		||||
        fx_fsw : cuint16;
 | 
			
		||||
        fx_ftw : cuint8;
 | 
			
		||||
        fx_unused1 : cuint8;
 | 
			
		||||
        fx_fop : cuint16;
 | 
			
		||||
        fx_rip : cuint64;
 | 
			
		||||
        fx_rdp : cuint64;
 | 
			
		||||
        fx_mxcsr : cuint32;
 | 
			
		||||
        fx_mxcsr_mask : cuint32;
 | 
			
		||||
        fx_st : array[0..7] of array [0..1] of cuint64;
 | 
			
		||||
        fx_xmm : array [0..15] of array [0..1] of cuint64;
 | 
			
		||||
        fx_unusued3 : array [0..95] of cuint8;
 | 
			
		||||
    end;
 | 
			
		||||
{$endif def cpux86_64}
 | 
			
		||||
 | 
			
		||||
(* From /usr/include/amd64/signal.h 
 | 
			
		||||
  struct sigcontext {
 | 
			
		||||
	/* plain match trapframe */
 | 
			
		||||
   Sig64Context  = Record
 | 
			
		||||
	long	sc_rdi;
 | 
			
		||||
	long	sc_rsi;
 | 
			
		||||
	long	sc_rdx;
 | 
			
		||||
	long	sc_rcx;
 | 
			
		||||
	long	sc_r8;
 | 
			
		||||
	long	sc_r9;
 | 
			
		||||
	long	sc_r10;
 | 
			
		||||
	long	sc_r11;
 | 
			
		||||
	long	sc_r12;
 | 
			
		||||
	long	sc_r13;
 | 
			
		||||
	long	sc_r14;
 | 
			
		||||
	long	sc_r15;
 | 
			
		||||
	long	sc_rbp;
 | 
			
		||||
	long	sc_rbx;
 | 
			
		||||
	long	sc_rax;
 | 
			
		||||
	long	sc_gs;
 | 
			
		||||
	long	sc_fs;
 | 
			
		||||
	long	sc_es;
 | 
			
		||||
	long	sc_ds;
 | 
			
		||||
	long	sc_trapno;
 | 
			
		||||
	long	sc_err;
 | 
			
		||||
	long	sc_rip;
 | 
			
		||||
	long	sc_cs;
 | 
			
		||||
	long	sc_rflags;
 | 
			
		||||
	long	sc_rsp;
 | 
			
		||||
	long	sc_ss;
 | 
			
		||||
 | 
			
		||||
	struct fxsave64 *sc_fpstate;
 | 
			
		||||
	int	sc_onstack;
 | 
			
		||||
	int	sc_mask;
 | 
			
		||||
}; *)
 | 
			
		||||
  Sigval = Record
 | 
			
		||||
            Case Boolean OF
 | 
			
		||||
        { Members as suggested by Annex C of POSIX 1003.1b. }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user