浏览代码

--- Merging r20649 into '.':
U packages/gdbint/src/gdbint.pp
--- Merging r20737 into '.':
U rtl/bsd/ostypes.inc
--- Merging r20741 into '.':
G rtl/bsd/ostypes.inc
U rtl/netbsd/sysnr.inc
U rtl/netbsd/ptypes.inc
--- Merging r20742 into '.':
G rtl/netbsd/ptypes.inc
--- Merging r20773 into '.':
U rtl/unix/x86.pp
--- Merging r20782 into '.':
U rtl/bsd/system.pp
--- Merging r20783 into '.':
U rtl/openbsd/signal.inc
--- Merging r20784 into '.':
U rtl/openbsd/i386/sighnd.inc
--- Merging r20923 into '.':
U rtl/netbsd/errno.inc
--- Merging r20928 into '.':
U rtl/openbsd/sysnr.inc
--- Merging r20929 into '.':
U rtl/netbsd/signal.inc
--- Merging r20930 into '.':
U rtl/netbsd/pthread.inc
--- Merging r20931 into '.':
U rtl/netbsd/errnostr.inc
--- Merging r20937 into '.':
U compiler/systems/i_bsd.pas

# revisions: 20649,20737,20741,20742,20773,20782,20783,20784,20923,20928,20929,20930,20931,20937
------------------------------------------------------------------------
r20649 | pierre | 2012-03-29 14:54:09 +0200 (Thu, 29 Mar 2012) | 1 line
Changed paths:
M /trunk/packages/gdbint/src/gdbint.pp

* Add relocate_gdb_directory to avoid loading of main.o from libgdb.a
------------------------------------------------------------------------
------------------------------------------------------------------------
r20737 | pierre | 2012-04-07 01:55:57 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/bsd/ostypes.inc

st_mode is before st_ino for NetBSD in stat record
------------------------------------------------------------------------
------------------------------------------------------------------------
r20741 | pierre | 2012-04-07 17:37:03 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/bsd/ostypes.inc
M /trunk/rtl/netbsd/ptypes.inc
M /trunk/rtl/netbsd/sysnr.inc

Add NETBSD_USE_STAT30 conditional for recent NetBSD changes, not yet used
------------------------------------------------------------------------
------------------------------------------------------------------------
r20742 | pierre | 2012-04-07 17:51:26 +0200 (Sat, 07 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/ptypes.inc

Fix ino_t for stat13 x86_64 CPU
------------------------------------------------------------------------
------------------------------------------------------------------------
r20773 | pierre | 2012-04-09 23:55:18 +0200 (Mon, 09 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/unix/x86.pp

Return -1 for fpIOPL and set errno to ESysENoSys for non-linux systems
------------------------------------------------------------------------
------------------------------------------------------------------------
r20782 | pierre | 2012-04-11 14:56:11 +0200 (Wed, 11 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/bsd/system.pp

+ Add forward declaration of InstallDefaultSignalHandler for use inside sighnd.inc
------------------------------------------------------------------------
------------------------------------------------------------------------
r20783 | pierre | 2012-04-11 15:21:38 +0200 (Wed, 11 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/openbsd/signal.inc

Correct several record fields
------------------------------------------------------------------------
------------------------------------------------------------------------
r20784 | pierre | 2012-04-11 15:22:58 +0200 (Wed, 11 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/openbsd/i386/sighnd.inc

Use mmx_support to decide to use xmState or x87state part of sigcontext
------------------------------------------------------------------------
------------------------------------------------------------------------
r20923 | pierre | 2012-04-18 18:04:01 +0200 (Wed, 18 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/errno.inc

Corrected NetBSD system errors
------------------------------------------------------------------------
------------------------------------------------------------------------
r20928 | pierre | 2012-04-19 10:33:18 +0200 (Thu, 19 Apr 2012) | 4 lines
Changed paths:
M /trunk/rtl/openbsd/sysnr.inc

* corrected to be closer to /usr/include/sys/syscall.h header
* Note: sigaltstack syscall number is modified by this patch
no other interface change should be moticable.

------------------------------------------------------------------------
------------------------------------------------------------------------
r20929 | pierre | 2012-04-19 14:37:23 +0200 (Thu, 19 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/signal.inc

Change SIGIOT to alias of SIGABRT (value does not change)
------------------------------------------------------------------------
------------------------------------------------------------------------
r20930 | pierre | 2012-04-19 14:52:28 +0200 (Thu, 19 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/pthread.inc

Changed sem_t to pointer to a anonymous struct as in system header and fixed wrong constant values
------------------------------------------------------------------------
------------------------------------------------------------------------
r20931 | pierre | 2012-04-19 16:51:43 +0200 (Thu, 19 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/errnostr.inc

messages checked
------------------------------------------------------------------------
------------------------------------------------------------------------
r20937 | pierre | 2012-04-20 14:09:41 +0200 (Fri, 20 Apr 2012) | 1 line
Changed paths:
M /trunk/compiler/systems/i_bsd.pas

Use linux/i386 aligmnents for NetBSD/OpenBSD i386
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@20998 -

marco 13 年之前
父节点
当前提交
78ffa09e32

+ 12 - 12
compiler/systems/i_bsd.pas

@@ -229,17 +229,17 @@ unit i_bsd;
             endian       : endian_little;
             alignment    :
               (
-                procalign       : 4;
+                procalign       : 16;
                 loopalign       : 4;
                 jumpalign       : 0;
                 constalignmin   : 0;
-                constalignmax   : 1;
+                constalignmax   : 8;
                 varalignmin     : 0;
-                varalignmax     : 1;
-                localalignmin   : 0;
-                localalignmax   : 1;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 8;
                 recordalignmin  : 0;
-                recordalignmax  : 2;
+                recordalignmax  : 16;
                 maxCrecordalign : 4
               );
             first_parm_offset : 8;
@@ -290,17 +290,17 @@ unit i_bsd;
             endian       : endian_little;
             alignment    :
               (
-                procalign       : 4;
+                procalign       : 16;
                 loopalign       : 4;
                 jumpalign       : 0;
                 constalignmin   : 0;
-                constalignmax   : 1;
+                constalignmax   : 8;
                 varalignmin     : 0;
-                varalignmax     : 1;
-                localalignmin   : 0;
-                localalignmax   : 1;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 8;
                 recordalignmin  : 0;
-                recordalignmax  : 2;
+                recordalignmax  : 16;
                 maxCrecordalign : 4
               );
             first_parm_offset : 8;

+ 7 - 0
packages/gdbint/src/gdbint.pp

@@ -2510,6 +2510,13 @@ begin
 end;
 {$endif def GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
 
+{ Avoid loading of main.o object by providing a
+  stripped down version of relocate_gdb_directory function }
+function relocate_gdb_directory(path : pchar) : pchar; cdecl; public;
+begin
+  relocate_gdb_directory:=path;
+end;
+
 {*****************************************************************************
                                  tgdbinterface
 *****************************************************************************}

+ 6 - 0
rtl/bsd/ostypes.inc

@@ -69,8 +69,14 @@ TYPE
         st_nlink      : nlink_t;           // number of hard links
         st_ino        : ino_t;             // inode's number
 {$else}
+{$ifdef netbsd_use_stat30}
+     { order is inverted for better alignment probably }
+        st_mode       : mode_t;            // inode protection mode
+        st_ino        : ino_t;             // inode's number
+{$else not netbsd}
         st_ino        : ino_t;             // inode's number
         st_mode       : mode_t;            // inode protection mode
+{$endif not netbsd}
         st_nlink      : nlink_t;           // number of hard links
 {$endif}
         st_uid        : uid_t;             // user ID of the file's owner

+ 7 - 0
rtl/bsd/system.pp

@@ -169,6 +169,13 @@ begin
   seterrno(olderrno);
 end;
 
+{$ifdef DEBUG}
+  { Declare InstallDefaultSignalHandler as forward to be able
+    to test aclling fpsigaction again within SignalToRunError
+    function implemented within sighnd.inc inlcude file }
+procedure InstallDefaultSignalHandler(signum: longint; out oldact: SigActionRec); forward;
+{$endif}
+
 {$i sighnd.inc}
 
 procedure InstallDefaultSignalHandler(signum: longint; out oldact: SigActionRec); public name '_FPC_INSTALLDEFAULTSIGHANDLER';

+ 26 - 4
rtl/netbsd/errno.inc

@@ -78,7 +78,6 @@ Const
         ESysEPROTONOSUPPORT     = 43;           { Protocol not supported }
         ESysESOCKTNOSUPPORT     = 44;           { Socket type not supported }
         ESysEOPNOTSUPP          = 45;           { Operation not supported }
-        ESysENOTSUP             = ESysEOPNOTSUPP;       { Operation not supported }
         ESysEPFNOSUPPORT        = 46;           { Protocol family not supported }
         ESysEAFNOSUPPORT        = 47;           { Address family not supported by protocol family }
         ESysEADDRINUSE          = 48;           { Address already in use }
@@ -129,9 +128,32 @@ Const
         ESysEIDRM               = 82;           { Identifier removed }
         ESysENOMSG              = 83;           { No message of desired type }
         ESysEOVERFLOW           = 84;           { Value too large to be stored in data type }
-        ESysECANCELED           = 85;           { Operation canceled }
-        ESysEILSEQ              = 86;           { Illegal byte sequence }
-        ESysELAST               = 86;           { Must be equal largest errno }
+        ESysEILSEQ              = 85;           { Illegal byte sequence }
+{ From IEEE Std 1003.1-2001 }
+{ Base, Realtime, Threads or Thread Priority Scheduling option errors }
+        ESysENOTSUP             = 86;           { Not supported }
+
+{ Realtime option errors }
+        ESysECANCELED           = 87;           { Operation canceled }
+
+{ Realtime, XSI STREAMS option errors }
+        ESysEBADMSG             = 88;           { Bad or Corrupt message }
+
+{ XSI STREAMS option errors  }
+        ESysENODATA             = 89;           { No message available }
+        ESysENOSR               = 90;           { No STREAM resources }
+        ESysENOSTR              = 91;           { Not a STREAM }
+        ESysETIME               = 92;           { STREAM ioctl timeout }
+
+{ File system extended attribute errors }
+        ESysENOATTR             = 93;           { Attribute not found }
+
+{ Realtime, XSI STREAMS option errors }
+        ESysEMULTIHOP           = 94;           { Multihop attempted } 
+        ESysENOLINK             = 95;           { Link has been severed }
+        ESysEPROTO              = 96;           { Protocol error }
+
+        ESysELAST               = 96;           { Must be equal largest errno }
 
 
 

+ 71 - 67
rtl/netbsd/errnostr.inc

@@ -13,37 +13,37 @@
 
  **********************************************************************}
 
-{$warning FIX ME, I'am from FreeBSD }
+{ Checked using ../unix/scipts/check_errnostr.sh  }
 const
-  sys_errn=93;
+  sys_errn=97;
   sys_errlist:array[0..sys_errn-1] of pchar = (
         'Success',                              { 0 }
         'Operation not permitted',              { EPERM }
         'No such file or directory',            { ENOENT }
         'No such process',                      { ESRCH }
         'Interrupted system call',              { EINTR }
-        'I/O error',                            { EIO }
-        'No such device or address',            { ENXIO }
-        'Arg list too long',                    { E2BIG }
+        'Input/output error',                   { EIO }
+        'Device not configured',                { ENXIO }
+        'Argument list too long',               { E2BIG }
         'Exec format error',                    { ENOEXEC }
-        'Bad file number',                      { EBADF }
+        'Bad file descriptor',                  { EBADF }
         'No child processes',                   { ECHILD }
-        'Resource deadlock avoided',   { EDEADLK was EAGAIN }
-        'Out of memory',                        { ENOMEM }
+        'Resource deadlock avoided',            { EDEADLK was EAGAIN }
+        'Cannot allocate memory',               { ENOMEM }
         'Permission denied',                    { EACCES }
         'Bad address',                          { EFAULT }
         'Block device required',                { ENOTBLK }
-        'Device or resource busy',              { EBUSY }
+        'Device busy',                          { EBUSY }
         'File exists',                          { EEXIST }
         'Cross-device link',                    { EXDEV }
-        'No such device',                       { ENODEV }
+        'Operation not supported by device',    { ENODEV }
         'Not a directory',                      { ENOTDIR }
         'Is a directory',                       { EISDIR }
         'Invalid argument',                     { EINVAL }
-        'File table overflow',                  { ENFILE }
+        'Too many open files in system',        { ENFILE }
         'Too many open files',                  { EMFILE }
-        'Not a typewriter',                     { ENOTTY }
-        'Text (code segment) file busy',        { ETXTBSY  Text file busy.  The new process was
+        'Inappropriate ioctl for device',       { ENOTTY }
+        'Text file busy',                       { ETXTBSY  Text file busy.  The new process was
                                                     a pure procedure (shared text) file which was
                                                     open for writing by another process, or file
                                                     which was open for writing by another process,
@@ -56,68 +56,72 @@ const
         'Read-only file system',                { EROFS }
         'Too many links',                       { EMLINK }
         'Broken pipe',                          { EPIPE }
-        'Math argument out of domain of func',  { EDOM }
-        'Math result not representable',        { ERANGE }
-        'Resource temporarily unavailable',        { EAGAIN }
-        'Operation now in progress',      { EINPROGRESS }
-        'Operation already in progress', { EALREADY	}
+        'Numerical argument out of domain',     { EDOM }
+        'Result too large',                     { ERANGE }
+        'Resource temporarily unavailable',     { EAGAIN }
+        'Operation now in progress',            { EINPROGRESS }
+        'Operation already in progress',        { EALREADY	}
 // ipc/network software -- argument errors
-        'Socket operation on non-socket',    { ENOTSOCK }
-        'Destination address required',     { EDESTADDRREQ }
+        'Socket operation on non-socket',       { ENOTSOCK }
+        'Destination address required',         { EDESTADDRREQ }
         'Message too long',                     { EMSGSIZE }
-        'Protocol wrong type for socket', { EPROTOTYPE }
+        'Protocol wrong type for socket',       { EPROTOTYPE }
         'Protocol not available',               { ENOPROTOOPT }
-        'Protocol not supported',              { EPROTONOSUPPORT }
-        'Socket type not supported',         { ESOCKTNOSUPPORT }
-        'Operation not supported',             { EOPNOTSUPP }
-        'Protocol family not supported',      { EPFNOSUPPORT }
+        'Protocol not supported',               { EPROTONOSUPPORT }
+        'Socket type not supported',            { ESOCKTNOSUPPORT }
+        'Operation not supported',              { EOPNOTSUPP }
+        'Protocol family not supported',        { EPFNOSUPPORT }
         'Address family not supported by protocol family',  { EAFNOSUPPORT }
-        'Address already in use',                { EADDRINUSE }
-        'Can''t assign requested address',  { EADDRNOTAVAIL }
+        'Address already in use',               { EADDRINUSE }
+        'Can''t assign requested address',      { EADDRNOTAVAIL }
 // ipc/network software -- operational errors
-        'Network is down',                            { ENETDOWN }
-        'Network is unreachable',                 { ENETUNREACH }
-        'Network dropped connection on reset', { ENETRESET }
-        'Software caused connection abort',   { ECONNABORTED }
-        'Connection reset by peer',                 { ECONNRESET }
-        'No buffer space available',                { ENOBUFS }
-        'Socket is already connected',            { EISCONN }
-        'Socket is not connected',                    { ENOTCONN }
+        'Network is down',                      { ENETDOWN }
+        'Network is unreachable',               { ENETUNREACH }
+        'Network dropped connection on reset',  { ENETRESET }
+        'Software caused connection abort',     { ECONNABORTED }
+        'Connection reset by peer',             { ECONNRESET }
+        'No buffer space available',            { ENOBUFS }
+        'Socket is already connected',          { EISCONN }
+        'Socket is not connected',              { ENOTCONN }
         'Can''t send after socket shutdown',    { ESHUTDOWN }
         'Too many references: can''t splice',   { ETOOMANYREFS }
-        'Operation timed out',                           { ETIMEDOUT }
-        'Connection refused',                           { ECONNREFUSED }
-        'Too many levels of symbolic links',     { ELOOP }
-        'File name too long',                              { ENAMETOOLONG }
-        'Host is down',                                       { EHOSTDOWN }
-        'No route to host',                                  { EHOSTUNREACH }
-        'Directory not empty',                            { ENOTEMPTY }
-        'Too many processes',                           { EPROCLIM }
-        'Too many users',                                   { EUSERS }
-        'Disc quota exceeded',                           { EDQUOT }
+        'Operation timed out',                  { ETIMEDOUT }
+        'Connection refused',                   { ECONNREFUSED }
+        'Too many levels of symbolic links',    { ELOOP }
+        'File name too long',                   { ENAMETOOLONG }
+        'Host is down',                         { EHOSTDOWN }
+        'No route to host',                     { EHOSTUNREACH }
+        'Directory not empty',                  { ENOTEMPTY }
+        'Too many processes',                   { EPROCLIM }
+        'Too many users',                       { EUSERS }
+        'Disc quota exceeded',                  { EDQUOT }
 // Network File System
-        'Stale NFS file handle',                              { ESTALE }
-        'Too many levels of remote in path',        { EREMOTE }
-        'RPC struct is bad',                                    { EBADRPC }
-        'RPC version wrong',                                { ERPCMISMATCH }
-        'RPC prog. not avail',                                { EPROGUNAVAIL }
-        'Program version wrong',                          { EPROGMISMATCH }
-        'Bad procedure for program',                    { EPROCUNAVAIL }
-        'No locks available',                                   { ENOLCK }
-        'Function not implemented',                       { ENOSYS }
-        'Inappropriate file type or format',              { EFTYPE }
-        'Authentication error',                                 { EAUTH }
-        'Need authenticator',                                   { ENEEDAUTH }
-        'Identifier removed',                                   { EIDRM }
-        'No message of desired type',                   { ENOMSG }
+        'Stale NFS file handle',                { ESTALE }
+        'Too many levels of remote in path',    { EREMOTE }
+        'RPC struct is bad',                    { EBADRPC }
+        'RPC version wrong',                    { ERPCMISMATCH }
+        'RPC prog. not avail',                  { EPROGUNAVAIL }
+        'Program version wrong',                { EPROGMISMATCH }
+        'Bad procedure for program',            { EPROCUNAVAIL }
+        'No locks available',                   { ENOLCK }
+        'Function not implemented',             { ENOSYS }
+        'Inappropriate file type or format',    { EFTYPE }
+        'Authentication error',                 { EAUTH }
+        'Need authenticator',                   { ENEEDAUTH }
+        'Identifier removed',                   { EIDRM }
+        'No message of desired type',           { ENOMSG }
         'Value too large to be stored in data type', { EOVERFLOW }
-        'Operation canceled',                                  { ECANCELED }
-        'Illegal byte sequence',                                { EILSEQ }
-        'Attribute not found',                                    { ENOATTR }
-        'Programming error',                                    { EDOOFUS }
-        'Bad message',                                            { EBADMSG }
-        'Multihop attempted',                                   { EMULTIHOP }
-        'Link has been severed',                              { ENOLINK }
-        'Protocol error'                                             { EPROTO }
+        'Illegal byte sequence',                { EILSEQ }
+        'Not supported',                        { ENOTSUP }
+        'Operation canceled',                   { ECANCELED }
+        'Bad or Corrupt message',               { EBADMSG }
+        'No message available',                 { ENODATA }
+        'No STREAM resources',                  { ENOSR }
+        'Not a STREAM',                         { ENOSTR }
+        'STREAM ioctl timeout',                 { ETIME }
+        'Attribute not found',                  { ENOATTR }
+        'Multihop attempted',                   { EMULTIHOP }
+        'Link has been severed',                { ENOLINK }
+        'Protocol error'                        { EPROTO }
 );
 

+ 4 - 4
rtl/netbsd/pthread.inc

@@ -19,10 +19,10 @@
 
  **********************************************************************}
 
-CONST PTHREAD_EXPLICIT_SCHED       = 0;
+CONST PTHREAD_EXPLICIT_SCHED       = 1;
       PTHREAD_CREATE_DETACHED      = 1;
       PTHREAD_SCOPE_PROCESS        = 0;
-      SEM_FAILED                   = -1;
+      SEM_FAILED                   = 0;
 
  TYPE
     ppthread_t           = ^pthread_t;
@@ -35,8 +35,8 @@ CONST PTHREAD_EXPLICIT_SCHED       = 0;
     ppthread_cond_t      = ^pthread_cond_t;
     ppthread_condattr_t  = ^pthread_condattr_t;
 
-    sem_t       = cint;
-    psem_t          = ^sem_t;
+    sem_t       = ptrint;
+    psem_t      = ^sem_t;
     TSemaphore  = sem_t;
     PSemaphore  = ^TSemaphore;
 

+ 4 - 1
rtl/netbsd/ptypes.inc

@@ -32,8 +32,11 @@ type
     TGid     = gid_t;
     pGid     = ^gid_t;
     TIOCtlRequest = cuLong;
-
+{$ifdef NETBSD_USE_STAT30}
     ino_t    = cint64;          { used for file serial numbers }
+{$else}
+    ino_t = cuint32;
+{$endif}
     TIno     = ino_t;
     pIno     = ^ino_t;
 

+ 2 - 2
rtl/netbsd/signal.inc

@@ -39,7 +39,7 @@ Const   { For sending a signal }
   SIGILL     = 4;
   SIGTRAP    = 5;
   SIGABRT    = 6;
-  SIGIOT     = 6;
+  SIGIOT     = SIGABRT;
   SIGEMT     = 7;
   SIGFPE     = 8;
   SIGKILL    = 9;
@@ -53,7 +53,7 @@ Const   { For sending a signal }
   SIGSTOP    = 17;
   SIGTSTP    = 18;
   SIGCONT    = 19;
-  SIGCHLD   = 20;
+  SIGCHLD    = 20;
   SIGTTIN    = 21;
   SIGTTOU    = 22;
   SIGIO      = 23;

+ 20 - 5
rtl/netbsd/sysnr.inc

@@ -495,8 +495,17 @@ const
      syscall_nr_kqueue = 344;
   { syscall: "kevent" ret: "int" args: "int" "const struct kevent *" "size_t" "struct kevent *" "size_t" "const struct timespec *" }
     syscall_nr_kevent = 345;
+  { syscall: "__stat30" ret: "int" args: "const char *" "struct stat *" }
+    syscall_nr___stat30 = 387;
 
-     syscall_nr_MAXSYSCALL = 340;
+  { syscall: "__fstat30" ret: "int" args: "int" "struct stat *" }
+    syscall_nr___fstat30 = 388;
+
+  { syscall: "__lstat30" ret: "int" args: "const char *" "struct stat *" }
+    syscall_nr___lstat30 = 389;
+
+
+     syscall_nr_MAXSYSCALL = 390;
      syscall_nr_NSYSENT = 512;
 
 
@@ -505,12 +514,21 @@ const
   and removed those who are equal
   and added some equivalents, unchecked PM }
 
+{$ifdef NETBSD_USE_STAT30}
 { syscall_nr_compat_12_fstat12 = 189 }
 { syscall_nr___fstat13 = 279 }
- syscall_nr_fstat                       = syscall_nr___fstat13;
+ syscall_nr_fstat                       = syscall_nr___fstat30;
 { syscall_nr_compat_12_lstat12 = 190 }
 {  syscall_nr___lstat13 = 280 }
+ syscall_nr_lstat                       = syscall_nr___lstat30;
+{ syscall_nr_compat_12_stat12 = 188; }
+{ syscall_nr___stat13 = 278 }
+ syscall_nr_stat                        = syscall_nr___stat30;
+{$else}
+ syscall_nr_fstat                       = syscall_nr___fstat13;
  syscall_nr_lstat                       = syscall_nr___lstat13;
+ syscall_nr_stat                        = syscall_nr___stat13;
+{$endif}
 { syscall_nr_sigaction                   = 342; MISSING }
 { syscall: "__sigaction14" ret: "int" args: "int" "const struct sigaction  " "struct sigaction  "  }
  syscall_nr_sigaction = syscall_nr___sigaction14;
@@ -527,9 +545,6 @@ const
  syscall_nr_sigreturn = syscall_nr___sigreturn14;
 { Note: syscall_nr_sigreturn was not on the checked list for FreeBSD }
 
-{ syscall_nr_compat_12_stat12 = 188; }
-{ syscall_nr___stat13 = 278 }
- syscall_nr_stat                        = syscall_nr___stat13;
 { syscall_nr_wait4 = 7 }
  syscall_nr_waitpid                     =   syscall_nr_wait4;
 { This one seems to be missing !!!!

+ 11 - 1
rtl/openbsd/i386/sighnd.inc

@@ -27,7 +27,12 @@ end;
 function getaltfpustate(sigcontext:psigcontextrec):longint; {inline;}
 begin
   if assigned(sigcontext) then
-    getaltfpustate:=sigcontext^.sc_fpustate^.en_sw 
+    begin
+      if mmx_support then
+        getaltfpustate:=sigcontext^.sc_fpustate^.xmmState.fx_fsw 
+      else
+        getaltfpustate:=sigcontext^.sc_fpustate^.x87state.en_sw 
+    end
   else
     getaltfpustate:=0;
 end;
@@ -37,6 +42,7 @@ procedure SignalToRunerror(Sig: longint;sininfo:psiginfo; SigContext: PSigContex
 
 var
   res,fpustate : word;
+  oldact: SigActionRec;
 begin
   res:=0;
 {$ifdef BSD}
@@ -87,6 +93,10 @@ begin
     SIGQUIT:
         res:=233;
   end;
+{$ifdef DEBUG_SIGNAL_HANDLER}
+  InstallDefaultSignalHandler(sig,oldact);
+  InstallDefaultSignalHandler(sig,oldact);
+{$endif}
   reenable_signal(sig);
 { give runtime error at the position where the signal was raised }
   if res<>0 then

+ 31 - 6
rtl/openbsd/signal.inc

@@ -69,14 +69,15 @@ Const   { For sending a signal }
 
 {$packrecords C}
 const
-  SI_PAD_SIZE   = ((128/sizeof(longint)) - 3);
+  SI_MAXSZ = 128;
+  SI_PAD_SIZE = ((SI_MAXSZ div sizeof(longint)) - 3);
 
 {
  * The sequence of the fields/registers in struct sigcontext should match
  * those in mcontext_t.
  }
 
-type sigset_t = array[0..3] of cardinal;
+type sigset_t = array [0..0] of cuint32 {array[0..3] of cardinal};
 
     PSigContextRec = ^SigContextRec;
     psigcontext = ^sigcontextrec;
@@ -147,7 +148,7 @@ type sigset_t = array[0..3] of cardinal;
 {$endif def cpux86_64}
      end;
 {$ifdef cpui386}
-     TFpuState = record
+     TFpuX87State = 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
@@ -166,6 +167,25 @@ type sigset_t = array[0..3] of cardinal;
        fpr_ex_tw    : cardinal;     { tag word of last exception }
        fpr_pad      : array[0..63] of char;
        end;
+    TFpuXMMState = 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;
+    TFpuState = record
+      case integer of
+       0 : (X87State : TFpuX87State);
+       1 : (XMMState : TFpuXMMState);
+    end; 
 {$endif def cpui386}
 
 (*  From /usr/include/amd64/fpu.h header 
@@ -260,7 +280,6 @@ struct savefpu {
   PSigInfo_t = ^SigInfo_t;
   SigInfo_t = record
                 si_signo,                       { signal number }
-                si_errno,                       { errno association }
         {
          * Cause of signal, one of the SI_ macros or signal-specific
          * values, i.e. one of the FPE_... values for SIGFPE. This
@@ -268,13 +287,19 @@ struct savefpu {
          * FreeBSD signal handler.
          }
                 si_code,                        { signal code }
+                si_errno : cint32;              { errno association }
+                case integer of
+                0 : (
                 si_pid          : Longint;      { sending process }
                 si_uid          : Cardinal;     { sender's ruid }
                 si_status       : Longint;      { exit value }
                 si_addr         : Pointer;      { faulting instruction }
                 si_value        : SigVal;       { signal value }
                 si_band         : Cardinal;     { band event for SIGPOLL }
-                __spare         : array[0..6] of Longint; { gimme some slack }
+                __spare         : array[0..6] of Longint;); { gimme some slack }
+                1 : ( fault_addr : pointer;
+                      fault_trapno : cint; );
+                2 : (pad : array [0..SI_PAD_SIZE] of cuint32;);
                 end;
   TSigInfo = SigInfo_t;
   TSigInfo_t = TSigInfo;
@@ -312,8 +337,8 @@ struct savefpu {
 //        0: (Sh: SignalHandler);
 //        1: (Sa: TSigAction);
 //      end;
-    Sa_Flags    : Longint;
     Sa_Mask     : SigSet;
+    Sa_Flags    : Longint;
   end;
 
 {

+ 10 - 4
rtl/openbsd/sysnr.inc

@@ -71,7 +71,7 @@ Const
         syscall_nr_setlogin     = 50 ;
         syscall_nr_acct         = 51 ;
         syscall_nr_sigpending   = 52 ;
-        syscall_nr_sigaltstack  = 53 ;
+        syscall_nr_osigaltstack = 53 ;
         syscall_nr_ioctl        = 54 ;
         syscall_nr_reboot       = 55 ;
         syscall_nr_revoke       = 56 ;
@@ -159,7 +159,10 @@ Const
         syscall_nr_swapctl      = 193;
         syscall_nr_getrlimit    = 194;
         syscall_nr_setrlimit    = 195;
-        syscall_nr_getdirentries35 = 196;
+        syscall_nr_ogetdirentries = 196;
+        { The entry below is to avoid unnecessary incompatibility with
+          older version }
+        syscall_nr_getdirentries35 = syscall_nr_ogetdirentries;
         syscall_nr_mmap         = 197;
         syscall_nr___syscall    = 198;
         syscall_nr_lseek        = 199;
@@ -172,6 +175,7 @@ Const
         syscall_nr_futimes      = 206;
         syscall_nr_getpgid      = 207;
         syscall_nr_xfspioctl    = 208;
+        syscall_nr_nnpfspioctl  = 208;
         syscall_nr_semget       = 221;
         syscall_nr_semop35      = 222;
         syscall_nr_msgget       = 225;
@@ -222,7 +226,9 @@ Const
         syscall_nr_setresgid    = 284;
         syscall_nr_mquery       = 286;
         syscall_nr_closefrom    = 287;
-        syscall_nr_signalstack  = 288;
+        syscall_nr_sigaltstack  = 288;
+        { left for compatibility }
+        syscall_nr_signalstack  = syscall_nr_sigaltstack;
         syscall_nr_shmget       = 289;
         syscall_nr_semop        = 290;
         syscall_nr_stat         = 291;
@@ -250,7 +256,7 @@ Const
         syscall_nr_MAXSYSCALL   = 313;
 
 { Aliases }
-        syscall_nr_getdirentries = syscall_nr_getdirentries35;
+        syscall_nr_getdirentries = syscall_nr_ogetdirentries;
         syscall_nr_waitpid      = syscall_nr_wait4;  // 7, added: ease of notation purposes
 {        syscall_nr_getdents = syscall_nr_getdirentries; }
 {$define USE_GETDIRENTRIES_SYSCALL}

+ 3 - 0
rtl/unix/x86.pp

@@ -519,6 +519,9 @@ Function fpIoPL(Level : cint) : cint;
 begin
  {$ifdef Linux}
   fpIOPL:=do_Syscall(Syscall_nr_iopl,TSysParam(Level));
+ {$else}
+  fpIOPL:=-1;
+  FpSetErrNo(ESysENoSys);
  {$endif}
 end;