Browse Source

--- Merging r20240 into '.':
U rtl/netbsd/sysnr.inc
--- Merging r20241 into '.':
U rtl/netbsd/i386/prt0.as
--- Merging r20242 into '.':
U rtl/netbsd/signal.inc

# revisions: 20240,20241,20242
------------------------------------------------------------------------
r20240 | pierre | 2012-02-03 23:51:12 +0100 (Fri, 03 Feb 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/sysnr.inc

+ Add missing syscall_nr_sigtimedwait
------------------------------------------------------------------------
------------------------------------------------------------------------
r20241 | pierre | 2012-02-03 23:51:57 +0100 (Fri, 03 Feb 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/i386/prt0.as

* Remove _strrchr call and add environ common
------------------------------------------------------------------------
------------------------------------------------------------------------
r20242 | pierre | 2012-02-03 23:52:21 +0100 (Fri, 03 Feb 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/signal.inc

+ Add tsiginfo type
------------------------------------------------------------------------

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

marco 13 years ago
parent
commit
59ba22a638
3 changed files with 83 additions and 10 deletions
  1. 23 9
      rtl/netbsd/i386/prt0.as
  2. 57 1
      rtl/netbsd/signal.inc
  3. 3 0
      rtl/netbsd/sysnr.inc

+ 23 - 9
rtl/netbsd/i386/prt0.as

@@ -50,7 +50,7 @@ ___fpc_brk_addr:
         .long   0
         .long   0
 
 
 #APP
 #APP
-	
+
 	.text
 	.text
 	.align	4
 	.align	4
 	.globl	__start
 	.globl	__start
@@ -87,14 +87,27 @@ ___start:
 	movl %edx,__progname
 	movl %edx,__progname
 	testl %edx,%edx
 	testl %edx,%edx
 	je .L2
 	je .L2
-	pushl $47
-	movl __progname,%eax
-	pushl %eax
-	call _strrchr
-	addl $8,%esp
-	movl %eax,%eax
-	movl %eax,__progname
-	cmpl $0,__progname
+        movl __progname,%edx
+        // Increase until 0 found
+        movl $0,%ebx
+.LL1:
+        movb (%edx,%ebx),%al
+        orb  %al,%al
+        je .LL2
+        incl %ebx
+.LL2:
+        decl %ebx
+        movb (%edx,%ebx),%al
+        cmpb $47,%al
+        je   .LL3
+        cmpl $0,%ebx
+        je   .LL4
+.LL3:    // slash found
+        incl %ebx
+        leal (%edx,%ebx),%eax
+        movl %eax,__progname
+.LL4:
+        cmpl $0,__progname
 	jne .L3
 	jne .L3
 	movl 12(%ebp),%eax
 	movl 12(%ebp),%eax
 	movl (%eax),%edx
 	movl (%eax),%edx
@@ -162,6 +175,7 @@ _actualsyscall:
 .ascii "NetBSD\0\0"
 .ascii "NetBSD\0\0"
 .long 199905
 .long 199905
 
 
+        .comm environ,4
         .comm operatingsystem_parameter_envp,4
         .comm operatingsystem_parameter_envp,4
         .comm operatingsystem_parameter_argc,4
         .comm operatingsystem_parameter_argc,4
         .comm operatingsystem_parameter_argv,4
         .comm operatingsystem_parameter_argv,4

+ 57 - 1
rtl/netbsd/signal.inc

@@ -68,8 +68,64 @@ Const   { For sending a signal }
 
 
 
 
 {$packrecords C}
 {$packrecords C}
+
+{ from NetBSD /usr/include/sys/siginfo.h }
 const
 const
-  SI_PAD_SIZE   = ((128/sizeof(longint)) - 3);
+  SI_PAD_SIZE   = 128;
+
+type
+
+  tsigval = record
+      sival_int : cint;
+      sival_ptr : pointer;
+    end;
+
+  tsig_rt = record
+      _uid : tuid; { defined in ptypes.inc }
+      _value : tsigval;
+    end;
+
+  tsig_child = record
+      _pid : tpid;
+      _status : cint;
+      _utime : tclock;
+      _stime : tclock;
+    end;
+
+  tsig_fault = record
+      _addr : pointer;
+      _trap : cint;
+    end;
+
+  tsig_poll = record
+     _band : clong;
+     _fd : cint;
+    end;
+
+  ksiginfo = record
+       si_signo : cint;
+       si_code  : cint;
+       si_errno : cint;
+{$ifdef cpu64}
+       si_pad   : cint;
+{$endif cpu64}
+       _reason : record
+         case longint of
+          0 : (_rt : tsig_rt);
+          1 : (_child : tsig_child);
+          2 : (_fault : tsig_fault);
+          3 : (_poll : tsig_poll);
+          { not yet filled }
+        end;
+   end;
+
+  psiginfo = ^tsiginfo;
+  tsiginfo = record
+          case longint of
+              0 : ( _pad : array[0..(SI_PAD_SIZE)-1] of char );
+              1 : ( _info : ksiginfo);
+          { end; }
+    end;
 
 
 {
 {
  * The sequence of the fields/registers in struct sigcontext should match
  * The sequence of the fields/registers in struct sigcontext should match

+ 3 - 0
rtl/netbsd/sysnr.inc

@@ -410,6 +410,9 @@ const
      syscall_nr_mlockall = 242;
      syscall_nr_mlockall = 242;
   { syscall: "munlockall" ret: "int" args:  }
   { syscall: "munlockall" ret: "int" args:  }
      syscall_nr_munlockall = 243;
      syscall_nr_munlockall = 243;
+  { syscall: "__sigtimedwait" ret:"int" args: "const sigset_t *" "siginfo_t *" 
+             "struct timespec *" }
+     syscall_nr_sigtimedwait = 244;
   { syscall: "__posix_rename" ret: "int" args: "const char  " "const char  "  }
   { syscall: "__posix_rename" ret: "int" args: "const char  " "const char  "  }
      syscall_nr___posix_rename = 270;
      syscall_nr___posix_rename = 270;
   { syscall: "swapctl" ret: "int" args: "int" "const void  " "int"  }
   { syscall: "swapctl" ret: "int" args: "int" "const void  " "int"  }