sigsafe-commits Mailing List for sigsafe
Status: Pre-Alpha
Brought to you by:
slamb
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
(28) |
Mar
(1) |
Apr
|
May
(62) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Author: slamb Date: Thu Feb 10 13:19:21 2005 New Revision: 1035 Modified: projects/atoms/doc/manual/manual.xml projects/axamol/message-board/src/WEB-INF/libraries/main.xml projects/axamol/sql-library/doc/examples/library.xml projects/sigsafe/docsrc/background.h projects/www.slamb.org/projects/axamol/message-board/index.xml projects/www.slamb.org/projects/cancellation_tests/index.xml Log: Fixed some dead links Modified: projects/atoms/doc/manual/manual.xml ============================================================================== --- projects/atoms/doc/manual/manual.xml (original) +++ projects/atoms/doc/manual/manual.xml Thu Feb 10 13:19:21 2005 @@ -4,8 +4,8 @@ <!ENTITY intro SYSTEM "intro.xml"> <!ENTITY io_system SYSTEM "io_system.xml"> <!ENTITY performance SYSTEM "performance.xml"> -<!ENTITY mdash CDATA "–"> -<!ENTITY hellip CDATA "…"> +<!ENTITY mdash "–"> +<!ENTITY hellip "…"> ]> <book id="atoms"> Modified: projects/axamol/message-board/src/WEB-INF/libraries/main.xml ============================================================================== --- projects/axamol/message-board/src/WEB-INF/libraries/main.xml (original) +++ projects/axamol/message-board/src/WEB-INF/libraries/main.xml Thu Feb 10 13:19:21 2005 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- $Rev$ $Date$ --> -<?xml-stylesheet href="../../../sql-library/src/xsl/querylib.xsl" type="text/xml"?> +<?xml-stylesheet href="../../../../sql-library/src/xsl/library.xsl" type="text/xml+xsl"?> <l:library xmlns:l="http://www.slamb.org/axamol/sql-library/library" xmlns:s="http://www.slamb.org/axamol/sql-library/statement" Modified: projects/axamol/sql-library/doc/examples/library.xml ============================================================================== --- projects/axamol/sql-library/doc/examples/library.xml (original) +++ projects/axamol/sql-library/doc/examples/library.xml Thu Feb 10 13:19:21 2005 @@ -7,7 +7,7 @@ - we do this so that we can share include these example files in the - DocBook output. --> -<?xml-stylesheet href="../../src/xsl/querylib.xsl" type="text/xml+xsl"?> +<?xml-stylesheet href="../../src/xsl/library.xsl" type="text/xml+xsl"?> <!DOCTYPE library [ <!ENTITY queryEmployees SYSTEM "queryEmployees.xml"> <!ENTITY activeEmploymentsOracle SYSTEM "activeEmploymentsOracle.xml"> Modified: projects/sigsafe/docsrc/background.h ============================================================================== --- projects/sigsafe/docsrc/background.h (original) +++ projects/sigsafe/docsrc/background.h Thu Feb 10 13:19:21 2005 @@ -1,7 +1,7 @@ // $Id$ /** - * @page background Background + * @page backgnd Background information * * (This section is intended to describe what signals are, how they are * useful, and the evolution of mechanisms to handle them safely. If you're Modified: projects/www.slamb.org/projects/axamol/message-board/index.xml ============================================================================== --- projects/www.slamb.org/projects/axamol/message-board/index.xml (original) +++ projects/www.slamb.org/projects/axamol/message-board/index.xml Thu Feb 10 13:19:21 2005 @@ -17,7 +17,7 @@ <p>Axamol Message Board is a web-based message board with a solid relational schema, a well-defined rich-text format for messages, and excellent code organization. Since it uses <a - href="../sax-pipeline">Axamol SAX Pipeline</a>, I'm confident that it has + href="../sax-pipeline/">Axamol SAX Pipeline</a>, I'm confident that it has no cross-site scripting vulnerabilities.</p> <p>It is <b>not</b> a complete message board system—it may become @@ -42,19 +42,18 @@ <ul> <li>Java actions, which handle authentication, actually update the database, and redirect to the appropriate presentation page. (They - live in <a href="/svn/repos/projects/mb/src/WEB-INF/org/slamb/mb">this - directory</a> in the repository.)</li> - <li><tt>XFP</tt> (JSP-like) presentation pages, which gather and - format data. (They live in <a href="/svn/repos/projects/mb/src/">this + live in <a href="/svn/repos/projects/mb/src/WEB-INF/classes/org/slamb/mb">this directory</a> in the repository.)</li> + <li><tt>AFP</tt> (JSP-like) presentation pages, which gather and + format data. (They live in <a href="/svn/repos/projects/axamol/message-board/src/">this + directory</a> in the repository and the <tt>WEB-INF</tt> subdirectory.)</li> <li>XSL templates, which fill in the finer details. (They live in - <a href="/svn/repos/projects/mb/src/WEB-INF/xsl/">this directory</a> + <a href="/svn/repos/projects/axamol/message-board/src/WEB-INF/xsl/">this directory</a> in the repository.</li> <li>A <a - href="/svn/repos/projects/mb/src/WEB-INF/library.xml">library</a> + href="/svn/repos/projects/axamol/message-board/src/WEB-INF/library/main.xml">library</a> of SQL queries and DML statements. (<a - href="/wc/projects/mb/src/WEB-INF/library.html">Autogenerated - documentation</a>).</li> + href="library.html">Autogenerated documentation</a>).</li> </ul> These different layers improve readability by letting you focus on one thing at a time. They also allow me to make the code considerably less @@ -77,12 +76,11 @@ </li> </ul> - <h2>Can I use the SQL libraries and XFP pages in my own projects?</h2> + <h2>Can I use the SQL libraries and AXP pages in my own projects?</h2> <p>Yeah, those are separate chunks of software called <a - href="/projects/framework/">framework</a> and <a - href="/projects/xmldb/">xmldb</a>. (They also need names. Can you - tell?)</p> + href="../sql-library/">Axamol SQL Library</a> and <a + href="../sax-pipeline/">Axamol SAX Pipeline</a>.</p> <h2>What needs to be done?</h2> Modified: projects/www.slamb.org/projects/cancellation_tests/index.xml ============================================================================== --- projects/www.slamb.org/projects/cancellation_tests/index.xml (original) +++ projects/www.slamb.org/projects/cancellation_tests/index.xml Thu Feb 10 13:19:21 2005 @@ -173,7 +173,7 @@ <tr> <td /> <td><a - href="/svn/repos/projects/cancellation_tests/test_siglongjmp_cleanup.c">siglongjmp_cleanup</a></td> + href="/svn/repos/projects/cancellation_tests/test_siglongjmp_cleanup.cc">siglongjmp_cleanup</a></td> <td class="failed">fail</td> <td class="failed">fail</td> <td class="failed">fail</td> @@ -321,5 +321,10 @@ href="http://www.slamb.org/projects/sigsafe/">sigsafe</a> rather than using the (poorly) standardized mechanism.</p> + <h2>Download</h2> + + <p>You can download the entire suite of tests here: + <a href="cancellation-tests-0.1.0.tar.gz">cancellation-tests-0.1.0.tar.gz</a>.</p> + </main> </page> |
|
From: <sl...@ca...> - 2005-02-02 20:41:04
|
Author: slamb Date: Wed Feb 2 14:40:59 2005 New Revision: 912 Modified: projects/sigsafe/docsrc/main.h Log: Better language. Modified: projects/sigsafe/docsrc/main.h ============================================================================== --- projects/sigsafe/docsrc/main.h (original) +++ projects/sigsafe/docsrc/main.h Wed Feb 2 14:40:59 2005 @@ -8,9 +8,8 @@ * exhaustively searches for race conditions with the <tt>ptrace(2)</tt> * facility. * - * The meat of the library is a set of alternate system call wrappers. Check - * out the following table, which shows when signals cause system calls to - * return immediately: + * The meat of the library is a set of alternate system call wrappers. The + * shows when signals cause system calls to return immediately: * * <table> * <tr> |
|
From: <sl...@ca...> - 2004-05-19 16:32:13
|
Author: slamb Date: Wed May 19 11:32:06 2004 New Revision: 776 Modified: projects/sigsafe/src/ppc-darwin/README projects/sigsafe/src/ppc-darwin/emulated_syscalls.c projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S projects/sigsafe/src/ppc-darwin/syscalls.h projects/sigsafe/src/sigsafe.h Log: - sigsafe_pause() and sigsafe_sigsuspend() on Darwin. - More fiddling with the assembly. Modified: projects/sigsafe/src/ppc-darwin/README ============================================================================== --- projects/sigsafe/src/ppc-darwin/README (original) +++ projects/sigsafe/src/ppc-darwin/README Wed May 19 11:32:06 2004 @@ -2,6 +2,9 @@ These resources are helpful for writing ppc-darwin assembly: +- <http://home-1.tiscali.nl/~solognt/codingstuff/ppc_cursus.html> + A good introduction to PPC assembly + - <http://cvs.opendarwin.org/index.cgi/src/Libc/ppc/sys/> Apple's implementation of these functions. @@ -17,3 +20,9 @@ - /usr/incldue/architecture/ppc/asm_help.h Describes stack layout and has lots of helpful macros + +- <http://www-106.ibm.com/developerworks/linux/library/l-ppc/> + The "Resources" section has a good list of sites with PPC information + +- <http://e-www.motorola.com/files/32bit/doc/ref_manual/MPC7450UM.pdf> + Motorola MPC7450 RISC Microprocessor Family User's Manual Modified: projects/sigsafe/src/ppc-darwin/emulated_syscalls.c ============================================================================== --- projects/sigsafe/src/ppc-darwin/emulated_syscalls.c (original) +++ projects/sigsafe/src/ppc-darwin/emulated_syscalls.c Wed May 19 11:32:06 2004 @@ -63,6 +63,25 @@ return (ret == KERN_SUCCESS) ? 0 : -EINVAL; } +PRIVATE_DEF(int sigsafe_sigsuspend_(const sigset_t mask)); + +int sigsafe_sigsuspend(const sigset_t *mask_p) { + sigset_t mask; + + if (mask_p) + mask = *mask_p; + else + sigemptyset(&mask); + + return sigsafe_sigsuspend_(mask); +} + +int sigsafe_pause(void) { + sigset_t mask; + sigemptyset(&mask); + return sigsafe_sigsuspend_(mask); +} + pid_t sigsafe_wait(int *status) { return sigsafe_wait4(WAIT_ANY, status, 0, NULL); } Modified: projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S ============================================================================== --- projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S (original) +++ projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S Wed May 19 11:32:06 2004 @@ -28,12 +28,12 @@ LABEL(_sigsafe_##name) @\ LOAD_TSD(args) @\ cmpwi r10,0 /* check TSD pointer */ @\ - beq _sigsafe_##name##_maxjmp_ @\ li r0,SYS_##name @\ + beq- _sigsafe_##name##_maxjmp_ @\ HIDDEN(_sigsafe_##name##_minjmp_) @\ lwz r10,0(r10) /* check TSD value */ @\ cmpwi r10,0 @\ - bne _sigsafe_##name##_jmpto_ @\ + bne- _sigsafe_##name##_jmpto_ @\ HIDDEN(_sigsafe_##name##_maxjmp_) @\ sc @\ POST_SC_##type @\ Modified: projects/sigsafe/src/ppc-darwin/syscalls.h ============================================================================== --- projects/sigsafe/src/ppc-darwin/syscalls.h (original) +++ projects/sigsafe/src/ppc-darwin/syscalls.h Wed May 19 11:32:06 2004 @@ -19,6 +19,9 @@ SYSCALL(accept, 3) SYSCALL(connect, 3) +#define SYS_sigsuspend_ SYS_sigsuspend +SYSCALL(sigsuspend_, 1) + #define SYS_clock_sleep_trap -62 /* from xnu/osfmk/mach/syscall_sw.h */ MACH_SYSCALL(clock_sleep_trap, 5) Modified: projects/sigsafe/src/sigsafe.h ============================================================================== --- projects/sigsafe/src/sigsafe.h (original) +++ projects/sigsafe/src/sigsafe.h Wed May 19 11:32:06 2004 @@ -288,6 +288,9 @@ */ int sigsafe_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); +int sigsafe_sigsuspend(const sigset_t*); +int sigsafe_pause(void); + /*@}*/ #ifdef __cplusplus |
|
From: <sl...@ca...> - 2004-05-19 14:23:28
|
Author: slamb Date: Wed May 19 09:23:25 2004 New Revision: 775 Modified: projects/sigsafe/src/ppc-darwin/README projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S Log: Fixed sigsafe_clock_sleep_trap; the problem actually could have occurred on unix system calls, too. Modified: projects/sigsafe/src/ppc-darwin/README ============================================================================== --- projects/sigsafe/src/ppc-darwin/README (original) +++ projects/sigsafe/src/ppc-darwin/README Wed May 19 09:23:25 2004 @@ -5,6 +5,10 @@ - <http://cvs.opendarwin.org/index.cgi/src/Libc/ppc/sys/> Apple's implementation of these functions. +- <http://cvs.opendarwin.org/index.cgi/src/xnu/osfmk/ppc/hw_exception.s> + The kernel's system call entry code - see "shandler". + It's a little...dense...but it might be helpful. + - <http://www.securiteam.com/securityreviews/PPC_OSX_Shellcode_Assembly.pdf> A paper about ppc/darwin shellcode, but it has some useful small examples. Modified: projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S ============================================================================== --- projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S (original) +++ projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S Wed May 19 09:23:25 2004 @@ -83,21 +83,23 @@ */ /*@{*/ #define SAVERESTORE_ARGS_0(func) -#define SAVERESTORE_ARGS_1(func) @\ - func a0, ARG_IN(1)(r1) -#define SAVERESTORE_ARGS_2(func) @\ +#define SAVERESTORE_ARGS_1(func) \ + func a0, ARG_IN(1)(sp) +#define SAVERESTORE_ARGS_2(func) \ SAVERESTORE_ARGS_1(func) @\ - func a1, ARG_IN(2)(r1) -#define SAVERESTORE_ARGS_3(func) @\ + func a1, ARG_IN(2)(sp) +#define SAVERESTORE_ARGS_3(func) \ SAVERESTORE_ARGS_2(func) @\ - func a2, ARG_IN(3)(r1) -#define SAVERESTORE_ARGS_4(func) @\ + func a2, ARG_IN(3)(sp) +#define SAVERESTORE_ARGS_4(func) \ SAVERESTORE_ARGS_3(func) @\ - func a3, ARG_IN(4)(r1) -#define SAVERESTORE_ARGS_5(func) @\ - func a4, ARG_IN(5)(r1) -#define SAVERESTORE_ARGS_6(func) @\ - func a5, ARG_IN(6)(r1) + func a3, ARG_IN(4)(sp) +#define SAVERESTORE_ARGS_5(func) \ + SAVERESTORE_ARGS_4(func) @\ + func a4, ARG_IN(5)(sp) +#define SAVERESTORE_ARGS_6(func) \ + SAVERESTORE_ARGS_5(func) @\ + func a5, ARG_IN(6)(sp) /*@}*/ #define SYSCALL(name,args) GENERIC_SYSCALL(name,posix,args) |
|
From: <sl...@ca...> - 2004-05-19 13:57:25
|
Author: slamb
Date: Wed May 19 08:57:23 2004
New Revision: 774
Modified:
projects/sigsafe/src/ppc-darwin/emulated_syscalls.c
Log:
Oops, add attribution.
Need to look into APSL a bit more before next release, make sure this mix is
kosher.
Modified: projects/sigsafe/src/ppc-darwin/emulated_syscalls.c
==============================================================================
--- projects/sigsafe/src/ppc-darwin/emulated_syscalls.c (original)
+++ projects/sigsafe/src/ppc-darwin/emulated_syscalls.c Wed May 19 08:57:23 2004
@@ -3,7 +3,9 @@
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
- * @version $Id$
+ * sigsafe_nanosleep is derived from Apple libc and thus is under the APSL
+ * 1.1.
+ * @version $Id: emulated_syscalls.c 773 2004-05-19 13:51:56Z slamb$
* @author Scott Lamb <sl...@sl...>
*/
@@ -25,6 +27,7 @@
int sleep_nsec,
mach_timespec_t *abs_time_after));
+/* Derived from Libc/gen/nanosleep.c */
int sigsafe_nanosleep(const struct timespec *req, struct timespec *rem) {
kern_return_t ret;
mach_timespec_t abs_time_after;
|
|
From: <sl...@ca...> - 2004-05-19 13:52:04
|
Author: slamb
Date: Wed May 19 08:51:56 2004
New Revision: 773
Added:
projects/sigsafe/src/ia64-hpux/
- copied from rev 765, projects/sigsafe/src/ia64-linux/
Modified:
projects/sigsafe/src/ppc-darwin/emulated_syscalls.c
projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S
projects/sigsafe/src/ppc-darwin/syscalls.h
projects/sigsafe/src/sigsafe.c
Log:
OS X changes:
- Preliminary support for Mach system calls.
This doesn't work with the multithreaded variant. Not sure why yet.
- Now only use a nested frame if multithreaded, restore stack frame _before_
doing the system call. This saves doing it in two places, so there are not
as many bytes. I also had helped it would help with the Mach stuff, since
then the arguments are in the same place in the stack as in the Mach calls
that the standard system does. No luck, though.
- Use said support to implement sigsafe_nanosleep().
Modified: projects/sigsafe/src/ppc-darwin/emulated_syscalls.c
==============================================================================
--- projects/sigsafe/src/ppc-darwin/emulated_syscalls.c (original)
+++ projects/sigsafe/src/ppc-darwin/emulated_syscalls.c Wed May 19 08:51:56 2004
@@ -8,11 +8,57 @@
*/
#include "sigsafe_internal.h"
+#include <mach/mach.h>
+#include <mach/clock.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/resource.h>
+#include <errno.h>
+#include <assert.h>
-/* TODO implement sigsafe_nanosleep */
+extern mach_port_t clock_port; /* see Libc/mach/mach_init_ports.c */
+
+PRIVATE_DEF(kern_return_t sigsafe_clock_sleep_trap(
+ mach_port_name_t clock_name,
+ sleep_type_t sleep_type,
+ int sleep_sec,
+ int sleep_nsec,
+ mach_timespec_t *abs_time_after));
+
+int sigsafe_nanosleep(const struct timespec *req, struct timespec *rem) {
+ kern_return_t ret;
+ mach_timespec_t abs_time_after;
+ mach_timespec_t abs_time_before;
+
+ /* Validate arguments */
+ if ((req == NULL) || (req->tv_sec < 0) || (req->tv_nsec > NSEC_PER_SEC)) {
+ return -EINVAL;
+ }
+
+ if (rem != NULL) { /* we might have to calculate rem; get current time */
+ ret = clock_get_time(clock_port, &abs_time_before);
+ assert(ret == KERN_SUCCESS); /* should never fail */
+ }
+
+ ret = sigsafe_clock_sleep_trap(clock_port, TIME_RELATIVE,
+ req->tv_sec, req->tv_nsec, NULL);
+
+ if (ret == KERN_ABORTED) { /* this is Mach's equivalent of EINTR */
+ if (rem != NULL) { /* update remaining time */
+ ret = clock_get_time(clock_port, &abs_time_after);
+ assert(ret == KERN_SUCCESS);
+
+ /* rem = abs_time_before + req - abs_time_after */
+ ADD_MACH_TIMESPEC(&abs_time_before, req);
+ SUB_MACH_TIMESPEC(&abs_time_before, &abs_time_after);
+ rem->tv_sec = abs_time_before.tv_sec;
+ rem->tv_nsec = abs_time_before.tv_nsec;
+ }
+ return -EINTR;
+ }
+
+ return (ret == KERN_SUCCESS) ? 0 : -EINVAL;
+}
pid_t sigsafe_wait(int *status) {
return sigsafe_wait4(WAIT_ANY, status, 0, NULL);
Modified: projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S Wed May 19 08:51:56 2004
@@ -10,6 +10,7 @@
#import <sigsafe_config.h>
#define EINTR 4 /* from /usr/include/sys/errno.h */
+#define KERN_ABORTED 14 /* from /usr/include/sys/mach/kern_return.h */
#ifdef _THREAD_SAFE
.reference _sigsafe_key_
@@ -20,36 +21,58 @@
NON_LAZY_STUB(_sigsafe_data_)
#endif
-#define SYSCALL(name,args) \
-NESTED(_sigsafe_##name, 0, 1, 0, 0) @\
+#define ERROR_posix -EINTR
+#define ERROR_mach KERN_ABORTED
+
+#define GENERIC_SYSCALL(name,type,args) \
+LABEL(_sigsafe_##name) @\
LOAD_TSD(args) @\
- li r0,SYS_##name @\
cmpwi r10,0 /* check TSD pointer */ @\
beq _sigsafe_##name##_maxjmp_ @\
+ li r0,SYS_##name @\
HIDDEN(_sigsafe_##name##_minjmp_) @\
lwz r10,0(r10) /* check TSD value */ @\
cmpwi r10,0 @\
bne _sigsafe_##name##_jmpto_ @\
HIDDEN(_sigsafe_##name##_maxjmp_) @\
sc @\
- neg r3,r3 /* executed only on error */ @\
- RETURN @\
+ POST_SC_##type @\
+ blr @\
HIDDEN(_sigsafe_##name##_jmpto_) @\
- li r3,-EINTR @\
- RETURN
+ li r3,ERROR_##type @\
+ blr
+
+/* For Mach system calls, we don't need to do anything post-system call. */
+#define POST_SC_mach
+
+/*
+ * For POSIX system calls, it's a little different:
+ * On error, we return to the next instruction. (This one.)
+ * It should negate the return value so we know it was an error.
+ * On success, the system call skips over this one.
+ */
+#define POST_SC_posix neg r3,r3
#define HIDDEN(label) .private_extern label @ label:
#ifdef _THREAD_SAFE
-#define LOAD_TSD(args) \
+#define LOAD_TSD(args) \
+BUILD_FRAME(0, 1, 0, 0) @\
SAVERESTORE_ARGS_##args(stw) @\
PICIFY(_sigsafe_key_) /* retrieve TSD */ @\
lwz r3,0(PICIFY_REG) @\
CALL_EXTERN_AGAIN(_pthread_getspecific) @\
mr r10,r3 @\
- SAVERESTORE_ARGS_##args(lwz)
+ SAVERESTORE_ARGS_##args(lwz) @\
+ /* Stuff copied from RETURN { */ \
+ lwz32 r0,r1,SAVED_LR @\
+ lwz32 r12,r1,SAVED_CR @\
+ addic sp,r1,__framesize @\
+ mtlr r0 @\
+ mtcrf 0xff,r12 \
+ /* } */
#else
-#define LOAD_TSD(args) \
+#define LOAD_TSD(args) \
PICIFY(_sigsafe_data_) @\
lwz r10,0(PICIFY_REG)
#endif
@@ -61,20 +84,24 @@
/*@{*/
#define SAVERESTORE_ARGS_0(func)
#define SAVERESTORE_ARGS_1(func) @\
- func r3, ARG_IN(1)(r1)
+ func a0, ARG_IN(1)(r1)
#define SAVERESTORE_ARGS_2(func) @\
SAVERESTORE_ARGS_1(func) @\
- func r4, ARG_IN(2)(r1)
+ func a1, ARG_IN(2)(r1)
#define SAVERESTORE_ARGS_3(func) @\
SAVERESTORE_ARGS_2(func) @\
- func r5, ARG_IN(3)(r1)
+ func a2, ARG_IN(3)(r1)
#define SAVERESTORE_ARGS_4(func) @\
SAVERESTORE_ARGS_3(func) @\
- func r6, ARG_IN(4)(r1)
+ func a3, ARG_IN(4)(r1)
#define SAVERESTORE_ARGS_5(func) @\
- func r7, ARG_IN(5)(r1)
+ func a4, ARG_IN(5)(r1)
#define SAVERESTORE_ARGS_6(func) @\
- func r8, ARG_IN(6)(r1)
+ func a5, ARG_IN(6)(r1)
/*@}*/
+#define SYSCALL(name,args) GENERIC_SYSCALL(name,posix,args)
+#define MACH_SYSCALL(name,args) GENERIC_SYSCALL(name,mach,args)
+
+.private_extern _sigsafe_clock_sleep_trap
#include "syscalls.h"
Modified: projects/sigsafe/src/ppc-darwin/syscalls.h
==============================================================================
--- projects/sigsafe/src/ppc-darwin/syscalls.h (original)
+++ projects/sigsafe/src/ppc-darwin/syscalls.h Wed May 19 08:51:56 2004
@@ -18,3 +18,7 @@
SYSCALL(wait4, 4)
SYSCALL(accept, 3)
SYSCALL(connect, 3)
+
+#define SYS_clock_sleep_trap -62 /* from xnu/osfmk/mach/syscall_sw.h */
+
+MACH_SYSCALL(clock_sleep_trap, 5)
Modified: projects/sigsafe/src/sigsafe.c
==============================================================================
--- projects/sigsafe/src/sigsafe.c (original)
+++ projects/sigsafe/src/sigsafe.c Wed May 19 08:51:56 2004
@@ -29,6 +29,7 @@
PRIVATE_DEF(void sigsafe_##name##_minjmp_(void)); \
PRIVATE_DEF(void sigsafe_##name##_maxjmp_(void)); \
PRIVATE_DEF(void sigsafe_##name##_jmpto_ (void));
+#define MACH_SYSCALL(name, args) SYSCALL(name, args)
#include "syscalls.h"
#undef SYSCALL
@@ -41,6 +42,7 @@
{ NULL, NULL, NULL }
};
#undef SYSCALL
+#undef MACH_SYSCALL
#ifdef SIGSAFE_NO_SIGINFO
static void sighandler(int signum, int code, struct sigcontext *ctx) {
|
|
From: <sl...@ca...> - 2004-05-15 15:19:40
|
Author: slamb
Date: Sat May 15 10:19:38 2004
New Revision: 769
Added:
projects/sigsafe/src/i386-sunos/
- copied from rev 768, projects/sigsafe/src/i386-solaris/
Removed:
projects/sigsafe/src/i386-solaris/
Log:
Moved i386-solaris to i386-sunos, so it will hopefully recognize itself when
compiling.
|
|
From: <sl...@ca...> - 2004-05-15 15:19:13
|
Author: slamb
Date: Sat May 15 10:19:07 2004
New Revision: 768
Added:
projects/sigsafe/src/i386-solaris/
- copied from rev 765, projects/sigsafe/src/i386-freebsd/
projects/sigsafe/tests/create_graph.py (contents, props changed)
Modified:
projects/sigsafe/SConstruct
projects/sigsafe/src/SConscript
projects/sigsafe/src/i386-solaris/README
projects/sigsafe/src/i386-solaris/emulated_syscalls.c
projects/sigsafe/src/i386-solaris/sighandler_platform.c
projects/sigsafe/src/i386-solaris/sigsafe_syscalls.S
projects/sigsafe/src/i386-solaris/syscalls.h
projects/sigsafe/tests/race_checker/race_checker.h
Log:
Solaris/x86, round 1.
Ignore the create_graph.py stuff; it doesn't do much yet.
I'll have to move i386-solaris to i386-sunos, but Subversion doesn't want me
to do that until I've committed.
Modified: projects/sigsafe/SConstruct
==============================================================================
--- projects/sigsafe/SConstruct (original)
+++ projects/sigsafe/SConstruct Sat May 15 10:19:07 2004
@@ -22,7 +22,7 @@
arch = os.uname()[4]
if arch == 'Power Macintosh': arch = 'ppc'
-if re.compile('i[3456]86').match(arch): arch = 'i386'
+if re.compile('i[3456]?86(pc)?').match(arch): arch = 'i386'
if re.compile('sun.*').match(arch): arch = 'sparc'
os_name = string.replace(string.lower(os.uname()[0]),'-','')
Export('arch os_name')
Modified: projects/sigsafe/src/SConscript
==============================================================================
--- projects/sigsafe/src/SConscript (original)
+++ projects/sigsafe/src/SConscript Sat May 15 10:19:07 2004
@@ -27,5 +27,5 @@
env.Program(target = 'print_sizes', source = 'print_sizes.c')
static_lib = env.StaticLibrary(target = 'sigsafe', source = source)
shared_lib = None
-shared_lib = env.SharedLibrary(target = 'sigsafe', source = source)
+#shared_lib = env.SharedLibrary(target = 'sigsafe', source = source)
Export('static_lib shared_lib')
Modified: projects/sigsafe/src/i386-solaris/README
==============================================================================
--- projects/sigsafe/src/i386-freebsd/README (original)
+++ projects/sigsafe/src/i386-solaris/README Sat May 15 10:19:07 2004
@@ -1,3 +1,6 @@
$Id$
-http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/x86-system-calls.html
+Copied from FreeBSD, then modified according to output from disassembling
+_read in dbx. Used "dis _read" after starting program.
+
+Like Solaris/sparc, this seems to have ERESTART; loop until it goes away.
Modified: projects/sigsafe/src/i386-solaris/emulated_syscalls.c
==============================================================================
--- projects/sigsafe/src/i386-freebsd/emulated_syscalls.c (original)
+++ projects/sigsafe/src/i386-solaris/emulated_syscalls.c Sat May 15 10:19:07 2004
@@ -1,5 +1,5 @@
/** @file
- * Emulated system calls under i386-freebsd.
+ * Emulated system calls under i386-sunos.
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
@@ -12,10 +12,10 @@
#include <sys/wait.h>
#include <sys/resource.h>
-pid_t sigsafe_wait(int *status) {
+/*pid_t sigsafe_wait(int *status) {
return sigsafe_wait4(WAIT_ANY, status, 0, NULL);
}
pid_t sigsafe_wait3(int *status, int options, struct rusage *rusage) {
return sigsafe_wait4(WAIT_ANY, status, options, rusage);
-}
+}*/
Modified: projects/sigsafe/src/i386-solaris/sighandler_platform.c
==============================================================================
--- projects/sigsafe/src/i386-freebsd/sighandler_platform.c (original)
+++ projects/sigsafe/src/i386-solaris/sighandler_platform.c Sat May 15 10:19:07 2004
@@ -1,5 +1,5 @@
/** @file
- * Adjusts instruction pointer as necessary on i386-freebsd.
+ * Adjusts instruction pointer as necessary on i386-sunos.
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
@@ -14,13 +14,13 @@
void sigsafe_handler_for_platform_(ucontext_t *ctx) {
struct sigsafe_syscall_ *s;
void *eip;
- eip = (void*) ctx->uc_mcontext.mc_eip;
+ eip = (void*) ctx->uc_mcontext.gregs[EIP];
for (s = sigsafe_syscalls_; s->minjmp != NULL; s++) {
if (s->minjmp <= eip && eip <= s->maxjmp) {
#ifdef SIGSAFE_DEBUG_JUMP
write(2, "[J]", 3);
#endif
- ctx->uc_mcontext.mc_eip = (int) s->jmpto;
+ ctx->uc_mcontext.gregs[EIP] = (int) s->jmpto;
return;
}
}
Modified: projects/sigsafe/src/i386-solaris/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/i386-solaris/sigsafe_syscalls.S Sat May 15 10:19:07 2004
@@ -4,11 +4,11 @@
* This file is part of sigsafe, which is released under the MIT license.
*/
+#define _ASM
#include <sys/syscall.h>
+#include <sys/errno.h>
#include <sigsafe_config.h>
-#define EINTR 4 /* from sys/errno.h> */
-
#define SYSCALL(name,args) \
.text ;\
.type sigsafe_##name,@function ;\
@@ -22,18 +22,20 @@
L_sigsafe_##name##_nocompare: ;\
movl $SYS_##name,%eax ;\
LABEL(sigsafe_##name##_maxjmp_) ;\
- int $0x80 ;\
- jc L_sigsafe_##name##_error /* if carry flag set, error */;\
+ lcall $0x27,$0x0 ;\
+ jb L_sigsafe_##name##_error ;\
ret ;\
LABEL(sigsafe_##name##_jmpto_) ;\
movl $EINTR,%eax ;\
L_sigsafe_##name##_error: ;\
+ cmp $ERESTART,%eax ;\
+ je sigsafe_##name ;\
neg %eax /* return -errno */ ;\
ret ;\
.size sigsafe_##name, . - sigsafe_##name
#define LABEL(label) \
-.global label ;\
+.globl label ;\
label:
#ifdef _THREAD_SAFE
Modified: projects/sigsafe/src/i386-solaris/syscalls.h
==============================================================================
--- projects/sigsafe/src/i386-freebsd/syscalls.h (original)
+++ projects/sigsafe/src/i386-solaris/syscalls.h Sat May 15 10:19:07 2004
@@ -1,5 +1,5 @@
/** @file
- * Lists implemented raw system calls on i386-freebsd.
+ * Lists implemented raw system calls on i386-sunos.
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
@@ -12,11 +12,6 @@
SYSCALL(readv, 3)
SYSCALL(write, 3)
SYSCALL(writev, 3)
-SYSCALL(select, 5)
SYSCALL(poll, 3)
-SYSCALL(wait4, 4)
SYSCALL(accept, 3)
SYSCALL(connect, 3)
-#ifdef SIGSAFE_HAVE_KEVENT
-SYSCALL(kevent, 6)
-#endif
Added: projects/sigsafe/tests/create_graph.py
==============================================================================
--- (empty file)
+++ projects/sigsafe/tests/create_graph.py Sat May 15 10:19:07 2004
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+"""create_graph - creates a bar graph comparing the read() microbenchmarks.
+
+This will run the raw read(), sigsafe_read(), and select()+read()
+microbenchmarks five times each. It will generate a gnuplot file to plot a
+95% confidence interval for the mean user CPU time of each."""
+
+import os
+import resource
+
+"""Computes the user CPU time required by a single run of the given test.
+Returns the time, in seconds."""
+def computeUserTime(test_name):
+ user_time_before = resource.getrusage(resource.RUSAGE_CHILDREN).ru_utime
+ retval = os.spawnl(os.P_WAIT, './' + test_name, test_name)
+ if retval != 0:
+ raise 'Test %s failed with return value %d' % (test_name, retval)
+ user_time_after = resource.getrusage(resource.RUSAGE_CHILDREN).ru_utime
+ return user_time_after - user_time_before
+
+tests = [('bench_read_raw', 'Raw read()'),
+ ('bench_read_safe', 'sigsafe_read()'),
+ ('bench_read_select','select()+read()')]
+
+raw_time = computeUserTime('bench_read_safe')
+print "Raw time: %f" % (raw_time)
Modified: projects/sigsafe/tests/race_checker/race_checker.h
==============================================================================
--- projects/sigsafe/tests/race_checker/race_checker.h (original)
+++ projects/sigsafe/tests/race_checker/race_checker.h Sat May 15 10:19:07 2004
@@ -14,13 +14,15 @@
#include <signal.h> /* for sig_atomic_t */
#include <setjmp.h> /* for sigsetjmp */
+/** Type of error return; used by error_wrap */
enum error_return_type {
- DIRECT, /**< pthread functions */
- NEGATIVE, /**< sigsafe functions */
- ERRNO /**< old-school functions */
+ DIRECT, /**< pthread functions; return 0 or Exxx */
+ NEGATIVE, /**< sigsafe functions; return >= 0 or -Exxx */
+ ERRNO /**< old-school functions; return >= 0 or -1, Exxx in errno */
};
-int error_wrap(int, const char*, enum error_return_type);
+/** Aborts if retval/type/errno indicate error. */
+int error_wrap(int retval, const char *fname, enum error_return_type type);
enum run_result {
/* skip 0 */
|
|
From: <sl...@ca...> - 2004-05-14 03:03:38
|
Author: slamb
Date: Thu May 13 22:03:35 2004
New Revision: 767
Added:
projects/sigsafe/src/alpha-freebsd/
- copied from rev 765, projects/sigsafe/src/alpha-linux/
Modified:
projects/sigsafe/src/alpha-freebsd/emulated_syscalls.c
projects/sigsafe/src/alpha-freebsd/sighandler_platform.c
projects/sigsafe/src/alpha-freebsd/sigsafe_syscalls.S
projects/sigsafe/src/alpha-freebsd/syscalls.h
projects/sigsafe/src/sigsafe.h
Log:
Support for FreeBSD/alpha.
Modified: projects/sigsafe/src/alpha-freebsd/emulated_syscalls.c
==============================================================================
--- projects/sigsafe/src/alpha-linux/emulated_syscalls.c (original)
+++ projects/sigsafe/src/alpha-freebsd/emulated_syscalls.c Thu May 13 22:03:35 2004
@@ -8,6 +8,5 @@
*/
#include "sigsafe_internal.h"
-#include <linux/net.h>
/* None so far */
Modified: projects/sigsafe/src/alpha-freebsd/sighandler_platform.c
==============================================================================
--- projects/sigsafe/src/alpha-linux/sighandler_platform.c (original)
+++ projects/sigsafe/src/alpha-freebsd/sighandler_platform.c Thu May 13 22:03:35 2004
@@ -1,5 +1,5 @@
/** @file
- * Adjusts instruction pointer as necessary on alpha-linux.
+ * Adjusts instruction pointer as necessary on alpha-freebsd.
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
@@ -8,19 +8,20 @@
*/
#include "sigsafe_internal.h"
+#include <machine/reg.h>
#include <ucontext.h>
#include <unistd.h>
void sigsafe_handler_for_platform_(ucontext_t *ctx) {
struct sigsafe_syscall_ *s;
void *pc;
- pc = (void*) ctx->uc_mcontext.sc_pc;
+ pc = (void*) ctx->uc_mcontext.mc_regs[R_PC];
for (s = sigsafe_syscalls_; s->minjmp != NULL; s++) {
if (s->minjmp <= pc && pc <= s->maxjmp) {
#ifdef SIGSAFE_DEBUG_JUMP
write(2, "[J]", 3);
#endif
- ctx->uc_mcontext.sc_pc = (long) s->jmpto;
+ ctx->uc_mcontext.mc_regs[R_PC] = (long) s->jmpto;
return;
}
}
Modified: projects/sigsafe/src/alpha-freebsd/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/alpha-freebsd/sigsafe_syscalls.S Thu May 13 22:03:35 2004
@@ -4,11 +4,12 @@
* This file is part of sigsafe, which is released under the MIT license.
*/
-#include <asm/unistd.h>
-#include <asm/errno.h>
-#include <alpha/regdef.h>
+#include <sys/syscall.h>
+#include <machine/asm.h>
#include <sigsafe_config.h>
+#define EINTR 4 /* from <sys/errno.h> */
+
/*
* Function call convention:
*
@@ -48,7 +49,7 @@
ldl t0, 0(v0) ;\
bne t0, sigsafe_##name##_jmpto_ ;\
$sigsafe_##name##_nocompare: ;\
- lda v0, __NR_##name(zero) ;\
+ lda v0, SYS_##name(zero) ;\
LABEL(sigsafe_##name##_maxjmp_) ;\
callsys ;\
bne a3, $sigsafe_##name##_error ;\
Modified: projects/sigsafe/src/alpha-freebsd/syscalls.h
==============================================================================
--- projects/sigsafe/src/alpha-linux/syscalls.h (original)
+++ projects/sigsafe/src/alpha-freebsd/syscalls.h Thu May 13 22:03:35 2004
@@ -1,5 +1,5 @@
/** @file
- * Lists implemented raw system calls on alpha-linux.
+ * Lists implemented raw system calls on alpha-freebsd.
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
@@ -14,9 +14,9 @@
SYSCALL(writev, 3)
SYSCALL(select, 5)
SYSCALL(poll, 3)
-#ifdef SIGSAFE_HAVE_EPOLL
-SYSCALL(epoll_wait, 4)
-#endif
SYSCALL(wait4, 4)
SYSCALL(accept, 2)
SYSCALL(connect, 3)
+#ifdef SIGSAFE_HAVE_KEVENT
+SYSCALL(kevent, 6)
+#endif
Modified: projects/sigsafe/src/sigsafe.h
==============================================================================
--- projects/sigsafe/src/sigsafe.h (original)
+++ projects/sigsafe/src/sigsafe.h Thu May 13 22:03:35 2004
@@ -29,6 +29,10 @@
#include <stdint.h> /* for intptr_t */
#endif
+#ifdef SIGSAVE_HAVE_KEVENT
+#include <sys/event.h>
+#endif
+
#ifdef SIGSAFE_HAVE_EPOLL
#include <sys/epoll.h>
#endif
|
|
From: <sl...@ca...> - 2004-05-14 01:52:49
|
Author: slamb
Date: Thu May 13 20:52:46 2004
New Revision: 766
Modified:
projects/sigsafe/ (props changed)
projects/sigsafe/SConstruct
projects/sigsafe/src/ppc-darwin/sighandler_platform.c
Log:
Get install dir and debug flag from the commandline.
Modified: projects/sigsafe/SConstruct
==============================================================================
--- projects/sigsafe/SConstruct (original)
+++ projects/sigsafe/SConstruct Thu May 13 20:52:46 2004
@@ -7,10 +7,12 @@
import re
import string
-install_dir = '/usr/local'
-install_include_dir = install_dir + '/include'
-install_lib_dir = install_dir + '/lib'
-debug = 1
+
+opts = Options('options.cache')
+opts.AddOptions(
+ BoolOption('debug', 'Compile a debug version', 0),
+ PathOption('install_dir', 'Installation destination', '/usr/local'),
+)
#
# Determine our platform
@@ -35,9 +37,12 @@
global_env = None
if os_name == 'osf1':
# gcc doesn't work with pthreads, so force use of the native tools
- global_env = Environment(tools = ['cc','link','ar','as'])
+ global_env = Environment(tools = ['cc','link','ar','as'], options=opts)
else:
- global_env = Environment()
+ global_env = Environment(options = opts)
+
+Help(opts.GenerateHelpText(global_env))
+opts.Save('options.cache', global_env)
global_env.Append(
CPPPATH = [
@@ -69,7 +74,7 @@
if global_env['CC'] == 'gcc':
global_env.Append(CCFLAGS = ['-Wall', '-fno-common'])
-if debug:
+if global_env['debug']:
global_env.Append(
CPPDEFINES=[
'SIGSAFE_DEBUG_SIGNAL', # write [S] to stderr whenever
@@ -123,6 +128,8 @@
source = Value(defines)
)
+install_include_dir = global_env['install_dir'] + '/include'
+install_lib_dir = global_env['install_dir'] + '/lib'
install_targets = [
Install(dir = install_include_dir, source = 'src/sigsafe.h'),
Install(dir = install_include_dir, source = config_header),
Modified: projects/sigsafe/src/ppc-darwin/sighandler_platform.c
==============================================================================
--- projects/sigsafe/src/ppc-darwin/sighandler_platform.c (original)
+++ projects/sigsafe/src/ppc-darwin/sighandler_platform.c Thu May 13 20:52:46 2004
@@ -11,7 +11,7 @@
#include <ucontext.h>
#include <unistd.h>
-PRIVATE(void sigsafe_handler_for_platform_(ucontext_t *ctx)) {
+PRIVATE_DEF(void sigsafe_handler_for_platform_(ucontext_t *ctx)) {
struct sigsafe_syscall_ *s;
void *srr0;
srr0 = (void*) ctx->uc_mcontext->ss.srr0;
|
Author: slamb
Date: Thu May 13 19:54:49 2004
New Revision: 765
Modified:
projects/sigsafe/SConstruct
projects/sigsafe/src/SConscript
projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S
projects/sigsafe/src/alpha-osf1/sigsafe_syscalls.S
projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S
projects/sigsafe/src/i386-linux/sigsafe_syscalls.S
projects/sigsafe/src/i386-netbsd/sigsafe_syscalls.S
projects/sigsafe/src/ia64-linux/sigsafe_syscalls.S
projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S
projects/sigsafe/src/sigsafe.h
projects/sigsafe/src/sparc-sunos/sigsafe_syscalls.S
projects/sigsafe/src/x86_64-linux/sigsafe_syscalls.S
Log:
Install files to /usr/local:
- generate a sigsafe_config.h header to manage SIGSAFE_HAVE_xxx.
- targets to install headers, libraries
- alias to do so with a simple "sudo scons install"
Modified: projects/sigsafe/SConstruct
==============================================================================
--- projects/sigsafe/SConstruct (original)
+++ projects/sigsafe/SConstruct Thu May 13 19:54:49 2004
@@ -7,6 +7,9 @@
import re
import string
+install_dir = '/usr/local'
+install_include_dir = install_dir + '/include'
+install_lib_dir = install_dir + '/lib'
debug = 1
#
@@ -79,25 +82,55 @@
)
conf = global_env.Configure(conf_dir = '.sconf_temp_%s-%s' % (arch, os_name))
+defines = []
+
+#
+# Check what system calls are available.
+#
+# The defines below are added to a sigsafe_config.h header file which will be
+# installed, so that calling code does not need to pass the SIGSAFE_xxx
+# defines itself.
+#
if os_name != 'darwin':
# Darwin poll is emulated through select
- conf.env.Append(CPPDEFINES = ['SIGSAFE_HAVE_POLL'])
+ defines.append('SIGSAFE_HAVE_POLL')
if os_name != 'sunos':
# Solaris select is emulated through poll
- conf.env.Append(CPPDEFINES = ['SIGSAFE_HAVE_SELECT'])
+ defines.append('SIGSAFE_HAVE_SELECT')
if conf.CheckFunc('kevent'):
- conf.env.Append(CPPDEFINES = ['SIGSAFE_HAVE_KEVENT'])
+ defines.append('SIGSAFE_HAVE_KEVENT')
if conf.CheckFunc('epoll_wait'):
- conf.env.Append(CPPDEFINES = ['SIGSAFE_HAVE_EPOLL'])
+ defines.append('SIGSAFE_HAVE_EPOLL')
if conf.CheckHeader('stdint.h'):
- conf.env.Append(CPPDEFINES = ['SIGSAFE_HAVE_STDINT_H'])
+ defines.append('SIGSAFE_HAVE_STDINT_H')
+
+def createConfigHeader(target, source, env):
+ f = open(str(target[0]), 'wb')
+ f.write('/* AUTOMATICALLY GENERATED BY SConstruct; DO NOT EDIT */\n')
+ f.write('/* $Id$ */\n')
+ for define in defines:
+ f.write('#define ' + define + '\n')
+global_env['BUILDERS']['ConfigHeader'] = Builder(action = createConfigHeader)
+buildDir = 'build-%s-%s-common' % (arch, os_name)
+global_env.Append(CPPPATH = ['#/' + buildDir])
+config_header = global_env.ConfigHeader(
+ target = buildDir + '/sigsafe_config.h',
+ source = Value(defines)
+)
+install_targets = [
+ Install(dir = install_include_dir, source = 'src/sigsafe.h'),
+ Install(dir = install_include_dir, source = config_header),
+]
+
+#
# Check for stuff needed only for testing.
+#
extra_test_libs = []
@@ -133,7 +166,7 @@
def addTargets(type, base_env):
buildDir = 'build-%s-%s-%s' % (arch, os_name, type)
env = base_env.Copy()
- env.Append(LIBPATH = '#/' + buildDir)
+ env.Append(LIBPATH = ['#/' + buildDir])
Export('env')
SConscript('src/SConscript',
@@ -143,6 +176,17 @@
build_dir = buildDir + '/tests/',
duplicate = 0)
+ Import('static_lib shared_lib')
+ install_targets.append(InstallAs(
+ target = '%s/libsigsafe-%s%s' % (install_lib_dir, type,
+ global_env['LIBSUFFIX']),
+ source = static_lib))
+ if shared_lib is not None:
+ install_targets.append(InstallAs(
+ target = '%s/libsigsafe-%s%s' % (install_lib_dir, type,
+ global_env['SHLIBSUFFIX']),
+ source = shared_lib))
+
# Always build a single-threaded version.
addTargets('st', global_env)
@@ -179,3 +223,5 @@
else:
env.Append(LIBS = ['pthread'])
addTargets('mt', env)
+
+Alias('install', install_targets)
Modified: projects/sigsafe/src/SConscript
==============================================================================
--- projects/sigsafe/src/SConscript (original)
+++ projects/sigsafe/src/SConscript Thu May 13 19:54:49 2004
@@ -25,5 +25,7 @@
source.append(platform_subdir + '/sigsafe_syscalls.S')
env.Program(target = 'print_sizes', source = 'print_sizes.c')
-env.StaticLibrary(target = 'sigsafe', source = source)
-#env.SharedLibrary(target = 'sigsafe', source = source)
+static_lib = env.StaticLibrary(target = 'sigsafe', source = source)
+shared_lib = None
+shared_lib = env.SharedLibrary(target = 'sigsafe', source = source)
+Export('static_lib shared_lib')
Modified: projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -7,6 +7,7 @@
#include <asm/unistd.h>
#include <asm/errno.h>
#include <alpha/regdef.h>
+#include <sigsafe_config.h>
/*
* Function call convention:
Modified: projects/sigsafe/src/alpha-osf1/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/alpha-osf1/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/alpha-osf1/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -7,6 +7,7 @@
#include <sys/syscall.h>
#include <alpha/regdef.h>
#include <alpha/pal.h>
+#include <sigsafe_config.h>
#define EINTR 4 /* from sys/errno.h */
Modified: projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -5,6 +5,7 @@
*/
#include <sys/syscall.h>
+#include <sigsafe_config.h>
#define EINTR 4 /* from sys/errno.h> */
Modified: projects/sigsafe/src/i386-linux/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/i386-linux/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/i386-linux/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -6,6 +6,7 @@
#include <asm/unistd.h>
#include <asm/errno.h>
+#include <sigsafe_config.h>
#ifdef __DYNAMIC__
#error "This code is position-dependent."
Modified: projects/sigsafe/src/i386-netbsd/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/i386-netbsd/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/i386-netbsd/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -5,6 +5,7 @@
*/
#include <sys/syscall.h>
+#include <sigsafe_config.h>
#define EINTR 4 /* from sys/errno.h> */
Modified: projects/sigsafe/src/ia64-linux/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/ia64-linux/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/ia64-linux/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -7,6 +7,7 @@
#define __ASSEMBLY__
#include <asm/unistd.h>
#include <asm/errno.h>
+#include <sigsafe_config.h>
#define save_pfs loc0
#define save_rp loc1
Modified: projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -7,6 +7,7 @@
#import <architecture/ppc/asm_help.h>
#import <architecture/ppc/pseudo_inst.h>
#import <sys/syscall.h>
+#import <sigsafe_config.h>
#define EINTR 4 /* from /usr/include/sys/errno.h */
Modified: projects/sigsafe/src/sigsafe.h
==============================================================================
--- projects/sigsafe/src/sigsafe.h (original)
+++ projects/sigsafe/src/sigsafe.h Thu May 13 19:54:49 2004
@@ -14,6 +14,7 @@
#define SIGSAFE_NO_SIGINFO
#endif
+#include <sigsafe_config.h>
#include <signal.h>
#ifndef SIGSAFE_NO_SIGINFO
#include <ucontext.h>
Modified: projects/sigsafe/src/sparc-sunos/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/sparc-sunos/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/sparc-sunos/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -8,6 +8,7 @@
#include <sys/trap.h>
#include <sys/syscall.h>
#include <sys/errno.h>
+#include <sigsafe_config.h>
/*
* The tricky things to remember below are:
Modified: projects/sigsafe/src/x86_64-linux/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/x86_64-linux/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/x86_64-linux/sigsafe_syscalls.S Thu May 13 19:54:49 2004
@@ -6,6 +6,7 @@
#include <asm/unistd.h>
#include <asm/errno.h>
+#include <sigsafe_config.h>
#define SYSCALL(name, args) ;\
.text ;\
|
|
From: <sl...@ca...> - 2004-05-14 00:01:29
|
Author: slamb
Date: Thu May 13 19:01:25 2004
New Revision: 764
Added:
projects/sigsafe/scons-shared-asm.patch (contents, props changed)
Log:
Patch to scons necessary to compile shared library.
Added: projects/sigsafe/scons-shared-asm.patch
==============================================================================
--- (empty file)
+++ projects/sigsafe/scons-shared-asm.patch Thu May 13 19:01:25 2004
@@ -0,0 +1,35 @@
+Index: Defaults.py
+===================================================================
+RCS file: /cvsroot/scons/scons/src/engine/SCons/Defaults.py,v
+retrieving revision 1.87
+diff -u -r1.87 Defaults.py
+--- Defaults.py 19 Apr 2004 03:43:12 -0000 1.87
++++ Defaults.py 13 May 2004 22:18:00 -0000
+@@ -127,6 +127,8 @@
+
+ ASAction = SCons.Action.Action("$ASCOM")
+ ASPPAction = SCons.Action.Action("$ASPPCOM")
++ShASAction = SCons.Action.Action("$ASCOM")
++ShASPPAction = SCons.Action.Action("$ASPPCOM -D__DYNAMIC__")
+
+ ProgScan = SCons.Scanner.Prog.ProgScan()
+
+Index: Tool/as.py
+===================================================================
+RCS file: /cvsroot/scons/scons/src/engine/SCons/Tool/as.py,v
+retrieving revision 1.4
+diff -u -r1.4 as.py
+--- Tool/as.py 26 Feb 2004 05:53:37 -0000 1.4
++++ Tool/as.py 13 May 2004 22:18:00 -0000
+@@ -54,9 +54,11 @@
+
+ for suffix in ASSuffixes:
+ static_obj.add_action(suffix, SCons.Defaults.ASAction)
++ shared_obj.add_action(suffix, SCons.Defaults.ShASAction)
+
+ for suffix in ASPPSuffixes:
+ static_obj.add_action(suffix, SCons.Defaults.ASPPAction)
++ shared_obj.add_action(suffix, SCons.Defaults.ShASPPAction)
+
+ env['AS'] = env.Detect(assemblers) or 'as'
+ env['ASFLAGS'] = SCons.Util.CLVar('')
|
|
From: <sl...@ca...> - 2004-05-13 23:36:27
|
Author: slamb Date: Thu May 13 18:36:25 2004 New Revision: 763 Added: projects/sigsafe/src/template.c (contents, props changed) Modified: projects/sigsafe/src/SConscript projects/sigsafe/src/i386-linux/README projects/sigsafe/src/i386-linux/sigsafe_syscalls.S Log: Working on shared library support, but not ready yet in i386-linux. Modified: projects/sigsafe/src/SConscript ============================================================================== --- projects/sigsafe/src/SConscript (original) +++ projects/sigsafe/src/SConscript Thu May 13 18:36:25 2004 @@ -26,4 +26,4 @@ env.Program(target = 'print_sizes', source = 'print_sizes.c') env.StaticLibrary(target = 'sigsafe', source = source) -env.SharedLibrary(target = 'sigsafe', source = source) +#env.SharedLibrary(target = 'sigsafe', source = source) Modified: projects/sigsafe/src/i386-linux/README ============================================================================== --- projects/sigsafe/src/i386-linux/README (original) +++ projects/sigsafe/src/i386-linux/README Thu May 13 18:36:25 2004 @@ -25,3 +25,6 @@ - <http://www.cs.utexas.edu/users/dahlin/Classes/UGOS/labs/lab2/gcc-calling-notes.pdf> Describes gcc calling conventions + +- <http://www.netwinder.org/~patb/elf_relocs.html> + Describes ELF relocations, particularly with respect to i386. Modified: projects/sigsafe/src/i386-linux/sigsafe_syscalls.S ============================================================================== --- projects/sigsafe/src/i386-linux/sigsafe_syscalls.S (original) +++ projects/sigsafe/src/i386-linux/sigsafe_syscalls.S Thu May 13 18:36:25 2004 @@ -7,6 +7,10 @@ #include <asm/unistd.h> #include <asm/errno.h> +#ifdef __DYNAMIC__ +#error "This code is position-dependent." +#endif + /* * __NR_select actually refers to an older version that takes a structure. * We want the not-obsolete one. Added: projects/sigsafe/src/template.c ============================================================================== --- (empty file) +++ projects/sigsafe/src/template.c Thu May 13 18:36:25 2004 @@ -0,0 +1,31 @@ +/** @file + * A template for making assembly. + * This file should never be used. Instead, it's helpful as a template + * for writing assembly for new platforms. Compile it with -S and look at the + * resultant assembly code. Try with and without -D_THREAD_SAFE and -fpic. + * @legal + * Copyright © 2004 Scott Lamb <sl...@sl...>. + * This file is part of sigsafe, which is released under the MIT license. + * @version $Id$ + * @author Scott Lamb <sl...@sl...> + */ + +#include <errno.h> +#include <pthread.h> +#include "sigsafe_internal.h" + +#ifdef _THREAD_SAFE +PRIVATE_DEF(pthread_key_t sigsafe_key_); +#else +PRIVATE_DEF(struct sigsafe_tsd_ *sigsafe_data_); +#endif + +ssize_t sigsafe_read_template(int fd, char *buf, size_t len) { +#ifdef _THREAD_SAFE + struct sigsafe_tsd_ *sigsafe_data_ = pthread_getspecific(sigsafe_key_); +#endif + if (sigsafe_data_ == NULL || sigsafe_data_->signal_received == 0) { + return read(fd, buf, len); + } + return -EINTR; +} |
|
From: <sl...@ca...> - 2004-05-13 22:42:03
|
Author: slamb
Date: Thu May 13 17:41:58 2004
New Revision: 762
Modified:
projects/sigsafe/src/i386-linux/emulated_syscalls.c
projects/sigsafe/src/i386-linux/sighandler_platform.c
projects/sigsafe/src/i386-linux/sigsafe_syscalls.S
projects/sigsafe/src/sigsafe.c
projects/sigsafe/src/sigsafe_internal.h
Log:
Work on Linux, at least with scons patch.
Modified: projects/sigsafe/src/i386-linux/emulated_syscalls.c
==============================================================================
--- projects/sigsafe/src/i386-linux/emulated_syscalls.c (original)
+++ projects/sigsafe/src/i386-linux/emulated_syscalls.c Thu May 13 17:41:58 2004
@@ -11,7 +11,7 @@
#include "sigsafe_internal.h"
#include <linux/net.h>
-int sigsafe_socketcall(int call, unsigned long *args) PRIVATE;
+PRIVATE_DEF(int sigsafe_socketcall(int call, unsigned long *args));
int sigsafe_accept(int s, struct sockaddr *addr, socklen_t *addrlen) {
unsigned long args[] = { s, (long) addr, (long) addrlen };
Modified: projects/sigsafe/src/i386-linux/sighandler_platform.c
==============================================================================
--- projects/sigsafe/src/i386-linux/sighandler_platform.c (original)
+++ projects/sigsafe/src/i386-linux/sighandler_platform.c Thu May 13 17:41:58 2004
@@ -12,7 +12,7 @@
#include <ucontext.h>
#include <unistd.h>
-PRIVATE(void sigsafe_handler_for_platform_(ucontext_t *ctx)) {
+PRIVATE_DEC(void sigsafe_handler_for_platform_(ucontext_t *ctx)) {
struct sigsafe_syscall_ *s;
void *eip;
eip = (void*) ctx->uc_mcontext.gregs[REG_EIP];
Modified: projects/sigsafe/src/i386-linux/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/i386-linux/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/i386-linux/sigsafe_syscalls.S Thu May 13 17:41:58 2004
@@ -59,13 +59,7 @@
ret ;\
.size sigsafe_##name, . - sigsafe_##name
-#ifdef __DYNAMIC__
-#define HIDE(label) .hidden label
-#else
-#define HIDE(label) .global label
-#endif
-
-#define HIDDEN(label) HIDE(label); label:
+#define HIDDEN(label) .internal label; .globl label; label:
/*
* Since we're using the registers above for system call arguments, we
@@ -162,5 +156,5 @@
movl sigsafe_data_,%eax
#endif
-.hidden sigsafe_socketcall
+.internal sigsafe_socketcall
#include "syscalls.h"
Modified: projects/sigsafe/src/sigsafe.c
==============================================================================
--- projects/sigsafe/src/sigsafe.c (original)
+++ projects/sigsafe/src/sigsafe.c Thu May 13 17:41:58 2004
@@ -16,19 +16,19 @@
#include <errno.h>
#ifdef _THREAD_SAFE
-PRIVATE(pthread_key_t sigsafe_key_) = 0;
+PRIVATE_DEC(pthread_key_t sigsafe_key_) = 0;
static pthread_once_t sigsafe_once = PTHREAD_ONCE_INIT;
#else
-PRIVATE(struct sigsafe_tsd_* sigsafe_data_) = 0;
+PRIVATE_DEC(struct sigsafe_tsd_* sigsafe_data_) = 0;
static int sigsafe_inited;
#endif
static sigsafe_user_handler_t user_handlers[SIGSAFE_SIGMAX];
#define SYSCALL(name, args) \
- PRIVATE(void sigsafe_##name##_minjmp_(void)); \
- PRIVATE(void sigsafe_##name##_maxjmp_(void)); \
- PRIVATE(void sigsafe_##name##_jmpto_ (void));
+ PRIVATE_DEF(void sigsafe_##name##_minjmp_(void)); \
+ PRIVATE_DEF(void sigsafe_##name##_maxjmp_(void)); \
+ PRIVATE_DEF(void sigsafe_##name##_jmpto_ (void));
#include "syscalls.h"
#undef SYSCALL
@@ -36,7 +36,7 @@
{ sigsafe_##name##_minjmp_, \
sigsafe_##name##_maxjmp_, \
sigsafe_##name##_jmpto_ },
-PRIVATE(struct sigsafe_syscall_ sigsafe_syscalls_[]) = {
+PRIVATE_DEC(struct sigsafe_syscall_ sigsafe_syscalls_[]) = {
#include "syscalls.h"
{ NULL, NULL, NULL }
};
Modified: projects/sigsafe/src/sigsafe_internal.h
==============================================================================
--- projects/sigsafe/src/sigsafe_internal.h (original)
+++ projects/sigsafe/src/sigsafe_internal.h Thu May 13 17:41:58 2004
@@ -20,11 +20,13 @@
*/
#if defined(__APPLE_CC__)
-#define PRIVATE(sym) __private_extern__ sym
-#elif defined(__GNUC__) && defined(__DYNAMIC__)
-#define PRIVATE(sym) extern sym __attribute__ ((visibility ("hidden")))
+#define PRIVATE_DEF(sym) __private_extern__ sym
+#define PRIVATE_DEC(sym) __private_extern__ sym
+#elif defined(__GNUC__)
+#define PRIVATE_DEF(sym) extern __attribute__ ((visibility ("internal"))) sym
+#define PRIVATE_DEC(sym) __attribute__ ((visibility ("internal"))) sym
#else
-#define PRIVATE(sym) extern sym
+#error "Don't know how to make symbols private on your platform."
#endif
/**
@@ -57,12 +59,12 @@
const void *jmpto;
};
-PRIVATE(struct sigsafe_syscall_ sigsafe_syscalls_[]);
+PRIVATE_DEF(struct sigsafe_syscall_ sigsafe_syscalls_[]);
#ifdef SIGSAFE_NO_SIGINFO
-PRIVATE(void sigsafe_handler_for_platform_(struct sigcontext *ctx));
+PRIVATE_DEF(void sigsafe_handler_for_platform_(struct sigcontext *ctx));
#else
-PRIVATE(void sigsafe_handler_for_platform_(ucontext_t *ctx));
+PRIVATE_DEF(void sigsafe_handler_for_platform_(ucontext_t *ctx));
#endif
#endif /* !SIGSAFE_INTERNAL_H */
|
|
From: <sl...@ca...> - 2004-05-13 21:45:46
|
Author: slamb
Date: Thu May 13 16:45:42 2004
New Revision: 761
Modified:
projects/sigsafe/SConstruct
projects/sigsafe/docsrc/porting.h
projects/sigsafe/src/SConscript
projects/sigsafe/src/i386-linux/sighandler_platform.c
projects/sigsafe/src/i386-linux/sigsafe_syscalls.S
projects/sigsafe/src/ppc-darwin/sighandler_platform.c
projects/sigsafe/src/sigsafe.c
projects/sigsafe/src/sigsafe_internal.h
Log:
- Build shared library.
(In progress; need to test with pure scons 0.95 and on other platforms)
- Removed extraneous text from porting doc.
Modified: projects/sigsafe/SConstruct
==============================================================================
--- projects/sigsafe/SConstruct (original)
+++ projects/sigsafe/SConstruct Thu May 13 16:45:42 2004
@@ -53,6 +53,10 @@
# each system anyway - to write the assembly code.
#
+if os_name == 'darwin':
+ global_env['SHLINKFLAGS'] = '$LINKFLAGS -dynamiclib -Wl,-x'
+ global_env['SHLIBSUFFIX'] = '.dylib'
+
if os_name == 'osf1':
global_env.Append(CPPDEFINES = [
'_XOPEN_SOURCE=600', # use socklen_t
@@ -60,7 +64,7 @@
])
if global_env['CC'] == 'gcc':
- global_env.Append(CCFLAGS = ['-Wall'])
+ global_env.Append(CCFLAGS = ['-Wall', '-fno-common'])
if debug:
global_env.Append(
Modified: projects/sigsafe/docsrc/porting.h
==============================================================================
--- projects/sigsafe/docsrc/porting.h (original)
+++ projects/sigsafe/docsrc/porting.h Thu May 13 16:45:42 2004
@@ -2,9 +2,6 @@
/**
* @page porting Porting to a new system
- * This section is not finished. For now, I have a few quick notes in the
- * following sections in the README:
- *
* <h2>Writing the system-dependent code</h2>
*
* <h3>What needs to be written</h3>
Modified: projects/sigsafe/src/SConscript
==============================================================================
--- projects/sigsafe/src/SConscript (original)
+++ projects/sigsafe/src/SConscript Thu May 13 16:45:42 2004
@@ -26,4 +26,4 @@
env.Program(target = 'print_sizes', source = 'print_sizes.c')
env.StaticLibrary(target = 'sigsafe', source = source)
-#env.SharedLibrary(target = 'sigsafe', source = source)
+env.SharedLibrary(target = 'sigsafe', source = source)
Modified: projects/sigsafe/src/i386-linux/sighandler_platform.c
==============================================================================
--- projects/sigsafe/src/i386-linux/sighandler_platform.c (original)
+++ projects/sigsafe/src/i386-linux/sighandler_platform.c Thu May 13 16:45:42 2004
@@ -12,7 +12,7 @@
#include <ucontext.h>
#include <unistd.h>
-void sigsafe_handler_for_platform_(ucontext_t *ctx) {
+PRIVATE(void sigsafe_handler_for_platform_(ucontext_t *ctx)) {
struct sigsafe_syscall_ *s;
void *eip;
eip = (void*) ctx->uc_mcontext.gregs[REG_EIP];
Modified: projects/sigsafe/src/i386-linux/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/i386-linux/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/i386-linux/sigsafe_syscalls.S Thu May 13 16:45:42 2004
@@ -59,7 +59,7 @@
ret ;\
.size sigsafe_##name, . - sigsafe_##name
-#ifdef PIC
+#ifdef __DYNAMIC__
#define HIDE(label) .hidden label
#else
#define HIDE(label) .global label
Modified: projects/sigsafe/src/ppc-darwin/sighandler_platform.c
==============================================================================
--- projects/sigsafe/src/ppc-darwin/sighandler_platform.c (original)
+++ projects/sigsafe/src/ppc-darwin/sighandler_platform.c Thu May 13 16:45:42 2004
@@ -11,7 +11,7 @@
#include <ucontext.h>
#include <unistd.h>
-void sigsafe_handler_for_platform_(ucontext_t *ctx) {
+PRIVATE(void sigsafe_handler_for_platform_(ucontext_t *ctx)) {
struct sigsafe_syscall_ *s;
void *srr0;
srr0 = (void*) ctx->uc_mcontext->ss.srr0;
Modified: projects/sigsafe/src/sigsafe.c
==============================================================================
--- projects/sigsafe/src/sigsafe.c (original)
+++ projects/sigsafe/src/sigsafe.c Thu May 13 16:45:42 2004
@@ -16,19 +16,19 @@
#include <errno.h>
#ifdef _THREAD_SAFE
-pthread_key_t sigsafe_key_ PRIVATE;
+PRIVATE(pthread_key_t sigsafe_key_) = 0;
static pthread_once_t sigsafe_once = PTHREAD_ONCE_INIT;
#else
-struct sigsafe_tsd_ *sigsafe_data_ PRIVATE;
+PRIVATE(struct sigsafe_tsd_* sigsafe_data_) = 0;
static int sigsafe_inited;
#endif
static sigsafe_user_handler_t user_handlers[SIGSAFE_SIGMAX];
#define SYSCALL(name, args) \
- extern void sigsafe_##name##_minjmp_(void) PRIVATE; \
- extern void sigsafe_##name##_maxjmp_(void) PRIVATE; \
- extern void sigsafe_##name##_jmpto_ (void) PRIVATE;
+ PRIVATE(void sigsafe_##name##_minjmp_(void)); \
+ PRIVATE(void sigsafe_##name##_maxjmp_(void)); \
+ PRIVATE(void sigsafe_##name##_jmpto_ (void));
#include "syscalls.h"
#undef SYSCALL
@@ -36,7 +36,7 @@
{ sigsafe_##name##_minjmp_, \
sigsafe_##name##_maxjmp_, \
sigsafe_##name##_jmpto_ },
-struct sigsafe_syscall_ sigsafe_syscalls_[] = {
+PRIVATE(struct sigsafe_syscall_ sigsafe_syscalls_[]) = {
#include "syscalls.h"
{ NULL, NULL, NULL }
};
Modified: projects/sigsafe/src/sigsafe_internal.h
==============================================================================
--- projects/sigsafe/src/sigsafe_internal.h (original)
+++ projects/sigsafe/src/sigsafe_internal.h Thu May 13 16:45:42 2004
@@ -19,10 +19,12 @@
* and other good things to know about ELF relocation, symbol versioning, etc.
*/
-#if defined(__GNUC__) && defined(PIC)
-#define PRIVATE __attribute__ ((visibility ("hidden")))
+#if defined(__APPLE_CC__)
+#define PRIVATE(sym) __private_extern__ sym
+#elif defined(__GNUC__) && defined(__DYNAMIC__)
+#define PRIVATE(sym) extern sym __attribute__ ((visibility ("hidden")))
#else
-#define PRIVATE
+#define PRIVATE(sym) extern sym
#endif
/**
@@ -55,12 +57,12 @@
const void *jmpto;
};
-extern struct sigsafe_syscall_ sigsafe_syscalls_[] PRIVATE;
+PRIVATE(struct sigsafe_syscall_ sigsafe_syscalls_[]);
#ifdef SIGSAFE_NO_SIGINFO
-void sigsafe_handler_for_platform_(struct sigcontext *ctx) PRIVATE;
+PRIVATE(void sigsafe_handler_for_platform_(struct sigcontext *ctx));
#else
-void sigsafe_handler_for_platform_(ucontext_t *ctx) PRIVATE;
+PRIVATE(void sigsafe_handler_for_platform_(ucontext_t *ctx));
#endif
#endif /* !SIGSAFE_INTERNAL_H */
|
|
From: <sl...@ca...> - 2004-05-13 21:02:01
|
Author: slamb
Date: Thu May 13 16:01:58 2004
New Revision: 760
Modified:
projects/sigsafe/tests/bench_read.c
Log:
Move a single byte at a time to focus better on our userspace code.
Modified: projects/sigsafe/tests/bench_read.c
==============================================================================
--- projects/sigsafe/tests/bench_read.c (original)
+++ projects/sigsafe/tests/bench_read.c Thu May 13 16:01:58 2004
@@ -25,13 +25,14 @@
#include <sigsafe.h>
#endif
-#ifndef PIPE_BUF
-/* OSF/1 doesn't */
-#define PIPE_BUF _POSIX_PIPE_BUF
-#endif
+/*
+ * We want very few bytes per transfer to emphasize the time spent in the
+ * system call wrapper (userspace), not the time shuffling bytes around in the
+ * kernel.
+ */
+#define TRANSFER_SIZE 1
-#define BYTES_TO_TRANSFER 4294967295uL
- /* max: 4294967295uL */
+#define BYTES_TO_TRANSFER (TRANSFER_SIZE<<23)
#define min(a,b) ((a)<(b)?(a):(b))
@@ -77,7 +78,7 @@
sigsetjmp(env, 0);
#endif
retval = MYREAD(devzero, buffer,
- min(PIPE_BUF, BYTES_TO_TRANSFER - total_transferred));
+ min(TRANSFER_SIZE, BYTES_TO_TRANSFER - total_transferred));
assert(retval > 0);
total_transferred += retval;
}
|
|
From: <sl...@ca...> - 2004-05-13 21:01:27
|
Author: slamb
Date: Thu May 13 16:01:22 2004
New Revision: 759
Modified:
projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S
Log:
Hide minjmp_, maxjmp_, and jmpto_ on Darwin.
Modified: projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/ppc-darwin/sigsafe_syscalls.S Thu May 13 16:01:22 2004
@@ -25,18 +25,20 @@
li r0,SYS_##name @\
cmpwi r10,0 /* check TSD pointer */ @\
beq _sigsafe_##name##_maxjmp_ @\
-LABEL(_sigsafe_##name##_minjmp_) @\
+HIDDEN(_sigsafe_##name##_minjmp_) @\
lwz r10,0(r10) /* check TSD value */ @\
cmpwi r10,0 @\
bne _sigsafe_##name##_jmpto_ @\
-LABEL(_sigsafe_##name##_maxjmp_) @\
+HIDDEN(_sigsafe_##name##_maxjmp_) @\
sc @\
neg r3,r3 /* executed only on error */ @\
RETURN @\
-LABEL(_sigsafe_##name##_jmpto_) @\
+HIDDEN(_sigsafe_##name##_jmpto_) @\
li r3,-EINTR @\
RETURN
+#define HIDDEN(label) .private_extern label @ label:
+
#ifdef _THREAD_SAFE
#define LOAD_TSD(args) \
SAVERESTORE_ARGS_##args(stw) @\
|
|
From: <sl...@ca...> - 2004-05-11 09:31:54
|
Author: slamb Date: Tue May 11 04:31:49 2004 New Revision: 758 Modified: projects/sigsafe/CHANGES projects/sigsafe/Doxyfile projects/sigsafe/RELEASE_NOTES Log: Rolling 0.1.3 Modified: projects/sigsafe/CHANGES ============================================================================== --- projects/sigsafe/CHANGES (original) +++ projects/sigsafe/CHANGES Tue May 11 04:31:49 2004 @@ -1,6 +1,6 @@ $Id$ -sigsafe-0.1.3 (in progress) +sigsafe-0.1.3 (released 11 May 2004) ------------- * Added support for several platforms: Modified: projects/sigsafe/Doxyfile ============================================================================== --- projects/sigsafe/Doxyfile (original) +++ projects/sigsafe/Doxyfile Tue May 11 04:31:49 2004 @@ -27,7 +27,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.1.3-dev +PROJECT_NUMBER = 0.1.3 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. Modified: projects/sigsafe/RELEASE_NOTES ============================================================================== --- projects/sigsafe/RELEASE_NOTES (original) +++ projects/sigsafe/RELEASE_NOTES Tue May 11 04:31:49 2004 @@ -1,6 +1,6 @@ $Id$ -sigsafe version 0.1.3-dev release notes: +sigsafe version 0.1.3 release notes: * Most existing platforms work without problems. |
|
From: <sl...@ca...> - 2004-05-11 09:27:04
|
Author: slamb
Date: Tue May 11 04:27:02 2004
New Revision: 757
Modified:
projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S
Log:
The usual underscore fix.
Modified: projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/i386-freebsd/sigsafe_syscalls.S Tue May 11 04:27:02 2004
@@ -15,7 +15,7 @@
LOAD_TSD ;\
testl %eax,%eax ;\
je L_sigsafe_##name##_nocompare ;\
-LABEL(_sigsafe_##name##_minjmp) ;\
+LABEL(sigsafe_##name##_minjmp_) ;\
cmp $0,(%eax) ;\
jne sigsafe_##name##_jmpto_ ;\
L_sigsafe_##name##_nocompare: ;\
|
|
From: <sl...@ca...> - 2004-05-11 09:06:54
|
Author: slamb
Date: Tue May 11 04:06:51 2004
New Revision: 756
Modified:
projects/sigsafe/src/sigsafe.h
Log:
More API documentation, more goodness.
Modified: projects/sigsafe/src/sigsafe.h
==============================================================================
--- projects/sigsafe/src/sigsafe.h (original)
+++ projects/sigsafe/src/sigsafe.h Tue May 11 04:06:51 2004
@@ -52,6 +52,42 @@
/**
* User-specified handler type.
+ * Arguments:
+ * - <tt>int signo</tt>: The signal number received.
+ * - <tt>siginfo_t *si</tt>: The signal information as passed to a
+ * sigaction-style signal handler.
+ * - <tt>ucontext_t *ctx</tt>: The machine context of the program when
+ * the signal was received. After the user-defined handler exits, the
+ * platform-specific handler will kick in. It will decide if it is currently
+ * executing in a "jump region" of a sigsafe system call and adjust the
+ * instruction pointer if so. While <tt>ctx</tt> is not marked
+ * <tt>const</tt>, you should be very cautious modifying it. Your code will
+ * be non-portable, and you may interfere with sigsafe's operation. In fact,
+ * normally you will not need to even read this parameter.
+ * - intptr_t user_data. The data you passed to sigsafe_install_tsd() in this
+ * thread.
+ *
+ * @warning
+ * This handler is executed asynchronously. You must take care to only call
+ * async signal-safe functions. In fact, the entire point of sigsafe is to
+ * allow you to do very little here and handle the rest in the main program.
+ * It's recommended that you only note details about the signal here, not take
+ * any action.
+ *
+ * @par Portability:
+ * Unfortunately, NetBSD does not support sigaction, as of the latest released
+ * version (1.6.2). Thus, it has a different signature:
+ * - <tt>int signo</tt>
+ * - <tt>int code</tt> - similar to si->si_code with the standard handler
+ * - <tt>struct sigcontext *ctx</tt> - similar to the standard handler's ctx.
+ * - <tt>intptr_t user_data</tt>
+ * Currently, you will need to use <tt>#ifdef SIGSAFE_NO_SIGINFO</tt> if you
+ * wish to support NetBSD.
+ *
+ * @par Future releases:
+ * I may change the API to have "simple" and "extended" versions of user
+ * handlers, so that simple ones do not need to worry about these platform
+ * differences.
* @see sigsafe_install_handler
*/
#ifdef SIGSAFE_NO_SIGINFO
@@ -74,7 +110,8 @@
* more than copy whatever data from the <tt>siginfo_t*</tt>
* structure to the user-supplied location. This is allowed
* since <tt>sigsafe</tt> itself only notes that a signal has
- * arrived, not even the signal number.
+ * arrived, not even the signal number. May be NULL, in which
+ * case sigsafe simply notes that a signal was received.
* @return 0 on success; <tt>-EINVAL</tt> where <tt>sigaction(2)</tt> would
* return -1 and set errno to <tt>EINVAL</tt>.
* @note
@@ -218,7 +255,7 @@
* Signal-safe <tt>poll(2)</tt>.
* @par Availability:
* All supported systems except Darwin/OS X.
- * (The <tt>poll(2)</tt> system call on Drawin is emulated with
+ * (The <tt>poll(2)</tt> system call on Darwin is emulated with
* <tt>select(2)</tt>.)
*/
#if defined(SIGSAFE_HAVE_POLL) || defined(DOXYGEN)
@@ -238,7 +275,12 @@
int sigsafe_connect(int sockfd, const struct sockaddr *serv_addr,
socklen_t addrlen);
-/** Signal-safe <tt>nanosleep(2)</tt>. */
+/**
+ * Signal-safe <tt>nanosleep(2)</tt>.
+ * @par Availability:
+ * Currently not implemented on Tru64/alpha or Darwin/ppc. I expect it will be
+ * in a future release.
+ */
int sigsafe_nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
/*@}*/
|
|
From: <sl...@ca...> - 2004-05-11 08:48:57
|
Author: slamb
Date: Tue May 11 03:48:54 2004
New Revision: 755
Modified:
projects/sigsafe/src/sigsafe.c
projects/sigsafe/tests/platform_behavior/test_socket_timeout.c
Log:
More NetBSD changes.
Modified: projects/sigsafe/src/sigsafe.c
==============================================================================
--- projects/sigsafe/src/sigsafe.c (original)
+++ projects/sigsafe/src/sigsafe.c Tue May 11 03:48:54 2004
@@ -43,7 +43,7 @@
#undef SYSCALL
#ifdef SIGSAFE_NO_SIGINFO
-static void sighandler(int signum, int code, struct siginfo *ctx) {
+static void sighandler(int signum, int code, struct sigcontext *ctx) {
#else
static void sighandler(int signum, siginfo_t *siginfo, ucontext_t *ctx) {
#endif
Modified: projects/sigsafe/tests/platform_behavior/test_socket_timeout.c
==============================================================================
--- projects/sigsafe/tests/platform_behavior/test_socket_timeout.c (original)
+++ projects/sigsafe/tests/platform_behavior/test_socket_timeout.c Tue May 11 03:48:54 2004
@@ -43,7 +43,7 @@
int main(void) {
struct sockaddr_in server_addr;
- unsigned long server_addr_len = sizeof(struct sockaddr_in);
+ socklen_t server_addr_len = sizeof(struct sockaddr_in);
int listen_fd, connected_fd;
int retval;
struct timeval timeout, old_time, new_time;
@@ -60,7 +60,7 @@
error_wrap(listen(listen_fd, 5), "listen");
if (error_wrap(fork(), "fork") == 0) {
struct sockaddr_in originating_addr;
- unsigned long originating_addr_len = sizeof(struct sockaddr_in);
+ socklen_t originating_addr_len = sizeof(struct sockaddr_in);
int accepted_fd;
/* Accept the connection, wait for it to be closed, then die. */
|
|
From: <sl...@ca...> - 2004-05-11 08:39:57
|
Author: slamb
Date: Tue May 11 03:39:53 2004
New Revision: 754
Modified:
projects/sigsafe/CHANGES
projects/sigsafe/Doxyfile
projects/sigsafe/RELEASE_NOTES
projects/sigsafe/SConstruct
Log:
Work on release notes. Releasing soon, I hope.
Modified: projects/sigsafe/CHANGES
==============================================================================
--- projects/sigsafe/CHANGES (original)
+++ projects/sigsafe/CHANGES Tue May 11 03:39:53 2004
@@ -1,6 +1,43 @@
$Id$
-sigsafe-0.1.2
+sigsafe-0.1.3 (in progress)
+-------------
+
+* Added support for several platforms:
+
+ - Linux/alpha
+ - Linux/ia64
+ - Linux/x86_64
+ - NetBSD/i386
+ - Solaris/sparc
+ - Tru64/alpha
+
+* A split into single-threaded and multi-threaded versions, to support
+ platforms with poor thread support. (*BSD systems.)
+
+* Build system improvements.
+
+ - The .sconf_temp and test directories are built in per-platform
+ directories, along with the main system, so it's easier to share a build
+ directory between many different platforms. (This makes testing on
+ SourceForge's compile farm and HP's test drive systems easier.)
+
+ - The single "scons" command will also build single-threaded and
+ multi-threaded versions, where available.
+
+ - The SConstruct file is more readable, with numerous comments. It should be
+ easy to change, even for people who have never seen scons before.
+
+* Better hiding of implementation details:
+
+ - a separate header for internal functions
+ - more static variables
+ - private functions are marked with __attribute((visibility("private")))
+ where available, always suffixed with _ to mark them as such.
+
+* Documentation improvements, mostly notes about porting to new systems.
+
+sigsafe-0.1.2 (released 1 May 2004)
-------------
* Added preliminary support for FreeBSD. (See RELEASE_NOTES.)
@@ -16,7 +53,7 @@
* Workarounds for RedHat 9's half-completed epoll.
-sigsafe-0.1.1
+sigsafe-0.1.1 (released 23 Feb 2004)
-------------
* Documentation improvements: a better quick overview, the start of some
@@ -38,7 +75,7 @@
* Small build system changes - mostly fixing a bunch of typos/thinkos around
the benchmark.
-sigsafe-0.1.0
+sigsafe-0.1.0 (released 15 Feb 2004)
-------------
* (Initial version)
Modified: projects/sigsafe/Doxyfile
==============================================================================
--- projects/sigsafe/Doxyfile (original)
+++ projects/sigsafe/Doxyfile Tue May 11 03:39:53 2004
@@ -27,7 +27,7 @@
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.1.2
+PROJECT_NUMBER = 0.1.3-dev
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
Modified: projects/sigsafe/RELEASE_NOTES
==============================================================================
--- projects/sigsafe/RELEASE_NOTES (original)
+++ projects/sigsafe/RELEASE_NOTES Tue May 11 03:39:53 2004
@@ -2,11 +2,20 @@
sigsafe version 0.1.3-dev release notes:
-* Linux/i386 appears to be working perfectly.
+* Most existing platforms work without problems.
-* Linux/alpha has mixed results:
+* The FreeBSD and NetBSD builds, by default, are single-threaded only.
+ I'd be interested to hear from people who have tried multi-threaded versions
+ on the -CURRENT versions of these systems. Older versions do not have a
+ suitable threading library.
- - On a single-processor system, it appears to work perfectly. Details:
+* The race condition checker is only working on Linux. I'd appreciate any help
+ porting it to other systems; it has proved unexpectedly difficult.
+
+* There appears to be, ironically, a race condition in the checker on
+ Linux/alpha. I suspect a kernel bug. Details:
+
+ - On a single-processor system, it appears to work perfectly. Machine specs:
spe141.testdrive.compaq.com:
- Alpha XP1000a
@@ -19,7 +28,7 @@
- On three different SMP systems, the race condition checker often fails -
the child dies with SIGTRAP. I think this is not a real problem with the
- code being checked, but rather a race in ptrace() itself. Machine details:
+ code being checked, but rather a race in ptrace() itself. Machine specs:
spe144.testdrive.compaq.com:
- Alpha ES40
@@ -39,22 +48,6 @@
- kernel 2.4.9-32.5smp
- glibc 2.2.4-29
-* The FreeBSD/x86 support is preliminary:
-
- - With LinuxThreads, sigaction returns -1/EINVAL in sigsafe_install_handler.
- No handler is installed. Not sure why.
-
- - I don't have access to a machine with FreeBSD 5.X and a KSE-based pthread
- library. I'd like to hear reports of success or failure from people who
- do.
-
- - Don't use it with user thread libraries (-pthread under FreeBSD 4.X).
- sigsafe does not support them and never will. (Symptoms: simple_test will
- return EAGAIN if no input is available when it does the read.)
-
- - The race condition checker doesn't compile. No si_code constants; probably
- not too hard to fix, but I haven't yet.
-
* The documentation is improved, but it still has a ways to go:
- The "Background" section stops abruptly. There are a lot more topics to
@@ -62,6 +55,11 @@
- The "Pattern reference" could use more explanation and should be adapted
to use the same terminology.
- The "Goal reference" doesn't really exist yet.
+ - The "Porting" section is missing the step-by-step tour.
+ - The "Performance" section is missing the shiny microbenchmark graphs. More
+ importantly, it's missing real-world performance tests to determine if
+ sigsafe's possible speed advantage is significant in a real system.
+ - The section about behavior of existing system calls could use bulking out.
If you spot anything wrong with what's already there, please let me know. If
it's unclear to you, odds are it is to someone else, too. And if it seems
@@ -69,29 +67,3 @@
Patches to add new documentation are also welcome. But saying "it's just not
there" doesn't help - I already know that.
-
-* The race checker is in pretty good shape now on Linux/x86.
- Try it out with "tests/race_checker/race_checker -qm" for a quick test.
-
-* The race checker still doesn't work under Darwin. It will give
- results like this:
-
- $ ./race_checker -qm
- Running sigsafe_read test
- attached
- stepped once
-
- ERROR: Child was killed/dump from signal 5.
-
- ...
-
- Test Result Expected
- ----------------------------------------------------------------
- * sigsafe_read misc. failure success
- * racebefore_read misc. failure ignored signal
- * raceafter_read misc. failure forgotten result
-
- * - These 3 tests did not return the expected result.
-
- signal 5 is SIGTRAP. I need to find out how to intercept this so the child
- does not die.
Modified: projects/sigsafe/SConstruct
==============================================================================
--- projects/sigsafe/SConstruct (original)
+++ projects/sigsafe/SConstruct Tue May 11 03:39:53 2004
@@ -29,7 +29,6 @@
# the name "global_env".
#
-
global_env = None
if os_name == 'osf1':
# gcc doesn't work with pthreads, so force use of the native tools
@@ -45,13 +44,13 @@
)
#
-# Modify it according to our platform
+# Modify the basic environment according to our platform.
#
# There's a mix here of behavior hardcoded for each platform and behavior that
# is tested for. Stuff generally gets tested for if it is very simple or may
# change across revisions of the operating system. Otherwise, we can get away
-# with tests by platform name because we have to write assembly for each one
-# anyway.
+# with tests by platform name because we need a specific effort to port to
+# each system anyway - to write the assembly code.
#
if os_name == 'osf1':
@@ -94,7 +93,7 @@
if conf.CheckHeader('stdint.h'):
conf.env.Append(CPPDEFINES = ['SIGSAFE_HAVE_STDINT_H'])
-# Check for stuff needed only for testing
+# Check for stuff needed only for testing.
extra_test_libs = []
@@ -143,7 +142,7 @@
# Always build a single-threaded version.
addTargets('st', global_env)
-# Build a multi-threaded version if our platform has a thread good library.
+# Build a multi-threaded version if our platform has a good thread library.
if os_name != 'freebsd' and os_name != 'netbsd':
env = global_env.Copy()
env.Append(
|
|
From: <sl...@ca...> - 2004-05-11 08:12:33
|
Author: slamb
Date: Tue May 11 03:12:25 2004
New Revision: 753
Added:
projects/sigsafe/docsrc/performance.h (contents, props changed)
projects/sigsafe/docsrc/porting.h (contents, props changed)
Modified:
projects/sigsafe/README
projects/sigsafe/docsrc/main.h
projects/sigsafe/src/i386-netbsd/emulated_syscalls.c
projects/sigsafe/src/i386-netbsd/sighandler_platform.c
projects/sigsafe/src/i386-netbsd/sigsafe_syscalls.S
projects/sigsafe/src/ia64-linux/emulated_syscalls.c
Log:
- NetBSD fix; missed a '_', as usual.
- Documentation improvements:
- Bulked out the porting stuff and moved it from README to the doxygen docs.
- Skeleton of a performance section.
- Admitted in the main page where the documentation is lacking.
Modified: projects/sigsafe/README
==============================================================================
--- projects/sigsafe/README (original)
+++ projects/sigsafe/README Tue May 11 03:12:25 2004
@@ -77,121 +77,6 @@
the library and include file to a suitable location, like /usr/local/bin.
-HOW DO I TEST IT?
-=================
-
-* If the race checker is working on your platform, you might run it first. A
- quick run looks like this:
-
- $ cd tests/race_checker
- $ ./race_checker -qm
- ...
-
- Test Result Expected
- ----------------------------------------------------------------
- sigsafe_read success success
- racebefore_read ignored signal ignored signal
- raceafter_read forgotten result forgotten result
-
- If the the results are different from expected, it will mark the guilty tests
- with a '*' and note it at the bottom.
-
- If that passes, you can run a full test with:
-
- $ ./race_checker -a
-
- but this will take a long time - you might start it before going to bed.
-
-* If the race condition checker doesn't work, you can play with "simple_test"
- instead.
-
- $ ./simple_test
- <TYPE SOMETHING>
- read returned: 5
- buf: asdf
-
- simple_test just does a read from the terminal and tells you the result.
- Try entering data or sending it a SIGUSR1. Try editing the source code and
- uncommenting the "raise" before the system call; it should report EINTR
- then, too. You can even do something similar to what the race checker does
- for the instructions right around the system call in the debugger:
-
- $ gdb ./simple_test
- ...
-
- (gdb) break sigsafe_read
- Breakpoint 1 at 0x8048a24
-
- (gdb) run
- ...
-
- (gdb) disassemble
- Dump of assembler code for function sigsafe_read:
- ...
-
- (gdb) step N (however many times you like)
- ...
-
- (gdb) signal SIGUSR1
- Continuing with signal SIGUSR1.
- ...
-
- (gdb) continue
- ...
-
-* You can check the performance with the system call microbenchmark. It reads
- a lot of data from the zero device. The important thing is the time relative
- to the normal system call:
-
- $ cd tests
- $ time ./bench_read_raw
- ...
- $ time ./bench_read_safe
- ...
-
- They will both take about the same amount of kernel time, since they both
- execute the same syscalls. The safe one will in theory use more user and
- real time, but hopefully it is not a noticeable difference. Run the tests a
- few times to make sure you get consistent results.
-
-
-HOW DO I PORT SIGSAFE TO A NEW SYSTEM?
-======================================
-
-To port sigsafe to a new platform, you need to implement:
-
-- The system call wrappers themselves. They're mostly normal wrappers except
- that they get a TSD (thread-specific data) key and look at received_signals
- within it. They should have a symbol _sigsafe_XXX_minjmp where they read
- the received_signals value from memory and _sigsafe_XXX_maxjmp where they
- execute the system call. Between those two values (inclusive), the signal
- handler will work by jumping to _sigsafe_XXX_jmpto. (It should not be in
- that region.) Look at the other platforms for examples.
-
-- the signal handler. It should adjust the instruction pointer inside the
- context argument as mentioned above. Then return to userspace. On all the
- previous platforms, just modifying the context and returning normally is
- sufficient. You might find instead:
-
- - you need to use setcontext()
- - you need to use sigreturn()
- - you need to save a jump buffer in your system call wrappers with
- sigsetjmp() and restore it with siglongjmp() (ugh)
-
-- the race condition tester. It uses process tracing, which is OS-specific.
- Most systems seem to have ptrace() or ttrace() or similar; it's just a
- matter of finding the right names for constants and such.
-
-Once you have an implementation, you should test it. This means both:
-
-- running the race condition tester to make sure your code is correct
-
-- running the microbenchmark to see that you have reasonable performance
-
-And then, send me a patch! The number of supported platforms will grow much
-faster this way.
-
-
HOW DO I ADD A SYSTEM CALL?
===========================
Modified: projects/sigsafe/docsrc/main.h
==============================================================================
--- projects/sigsafe/docsrc/main.h (original)
+++ projects/sigsafe/docsrc/main.h Tue May 11 03:12:25 2004
@@ -93,22 +93,45 @@
*
* <h3>Additional information</h3>
*
- * - @link background Background information. @endlink
+ * - @link background Background information. @endlink (In progress.)
* If everything above was confusing to you, this should help you understand
* what signals are, why most code does not handle them safely, and how your
* code can.
- * - @link goalref Goal-based reference. @endlink
+ * - @link goalref Goal-based reference. @endlink (Still to write.)
* For writing new code. (I want to wait for blocking IO
* or a timeout, how should I do that?)
- * - @link patternref Pattern-based reference. @endlink
+ * - @link patternref Pattern-based reference. @endlink (In progress.)
* For auditing existing code. (Is this code safe? Does it
* perform as well as it could? Is it portable?)
+ * - @link porting Porting to new systems. @endlink (In progress.)
+ * Tips for writing the platform-dependent portions for new platforms and
+ * testing the results.
+ * - @link performance Performance test results. @endlink (In progress.)
+ * - The API reference itself. The "Modules" page is a good place to start.
*
* <h3>Availability</h3>
*
- * sigsafe is available for Linux/i386 and Darwin/ppc (OS X). More platforms
- * should be ready soon.
+ * sigsafe is available for the following platforms:
*
- * Please look at the <tt>README</tt> file for installation notes and porting
- * hints.
+ * - Darwin/ppc (a.k.a OS X)
+ * - FreeBSD/i386
+ * - Linux/alpha
+ * - Linux/i386
+ * - Linux/ia64
+ * - Linux/x86_64
+ * - NetBSD/i386
+ * - Solaris/sparc
+ * - Tru64/alpha
+ *
+ * I still intend to port it to:
+ *
+ * - FreeBSD/alpha
+ * - HP-UX/ia64
+ * - HP-UX/parisc
+ * - Linux/parisc
+ * - Solaris/i386
+ *
+ * At which point I will be out of machines to port it to. If you want a
+ * platform not listed, you'll have to give me access to such a machine or
+ * port it yourself.
*/
Added: projects/sigsafe/docsrc/performance.h
==============================================================================
--- (empty file)
+++ projects/sigsafe/docsrc/performance.h Tue May 11 03:12:25 2004
@@ -0,0 +1,37 @@
+// $Id$
+
+/**
+ * @page performance Performance
+ * In general, performance should not be your main reason for using sigsafe.
+ * However, here I will show that performance is at least comparable to libc's
+ * system call wrappers, unsafe signals and all. It may be significantly
+ * faster than some ways of handling signals safely, notably the self-pipe
+ * trick. It certainly is faster, but the jury is still out on whether this is
+ * a significant difference.
+ *
+ * This <i>will</i> contain pretty graphs of benchmarks of sigsafe benchmarks
+ * (a microbenchmark and a use in a real application). But I haven't made them
+ * yet. Until then, you're welcome to run the microbenchmark yourself. Try
+ * comparing the output from:
+ *
+ * - <tt>time build-myplatform/tests/bench_read_raw</tt> - this tests the
+ * libc's system call wrappers in a plain way without safe signal handling.
+ * - <tt>time build-myplatform/tests/bench_read_safe</tt> - this is sigsafe's
+ * handling. In theory, it should be very slightly slower than the libc's.
+ * In practice, it is actually slightly faster in some cases! (This implies
+ * a suboptimal libc.) Let me know if it is significantly slower. (It may
+ * be so on the Pentium IV, because I have yet to implement
+ * <tt>SYSENTER</tt> support.)
+ * - <tt>time build-platform/tests/bench_read_select</tt> - this is a test
+ * with every read preceded by a <tt>select</tt>, as is necessary in some
+ * cases with the self-pipe trick commonly used as an alternative to
+ * sigsafe. It should be about half the speed.
+ *
+ * The real-world benchmark will likely be Apache. I've made a patch that
+ * eliminates a need to use <tt>select</tt> before <tt>read</tt> and
+ * <tt>write</tt> for socket timeouts. There are actually no signals involved,
+ * but it's a very analogous situation. I expect to find that under platforms
+ * with high system call overhead (notably Darwin), it is noticeably faster.
+ * Unfortunately, I've run into hardware problems while benchmarking. Stay
+ * tuned...
+ */
Added: projects/sigsafe/docsrc/porting.h
==============================================================================
--- (empty file)
+++ projects/sigsafe/docsrc/porting.h Tue May 11 03:12:25 2004
@@ -0,0 +1,219 @@
+// $Id$
+
+/**
+ * @page porting Porting to a new system
+ * This section is not finished. For now, I have a few quick notes in the
+ * following sections in the README:
+ *
+ * <h2>Writing the system-dependent code</h2>
+ *
+ * <h3>What needs to be written</h3>
+ *
+ * To port sigsafe to a new system, you need to implement:
+ *
+ * - The system call wrappers themselves. They're mostly normal wrappers
+ * except that they get a TSD (thread-specific data) key and look at
+ * received_signals within it. They should have a symbol _sigsafe_XXX_minjmp
+ * where they read the received_signals value from memory and
+ * _sigsafe_XXX_maxjmp where they execute the system call. Between those two
+ * values (inclusive), the signal handler will work by jumping to
+ * _sigsafe_XXX_jmpto. (It should not be in that region.) Look at the other
+ * platforms for examples.
+ *
+ * - the signal handler. It should adjust the instruction pointer inside the
+ * context argument as mentioned above. Then return to userspace. On all the
+ * previous platforms, just modifying the context and returning normally is
+ * sufficient. You might find instead:
+ *
+ * - you need to use setcontext()
+ * - you need to use sigreturn()
+ * - you need to save a jump buffer in your system call wrappers with
+ * sigsetjmp() and restore it with siglongjmp() (ugh)
+ *
+ * And you can optionally implement:
+ *
+ * - the race condition tester. It uses process tracing, which is OS-specific.
+ * I had originally hoped this would simply be a matter of finding the right
+ * names for <tt>ptrace()</tt> constants. Unfortunately, it seems to be much
+ * more involved. In fact, this code is only working under Linux now.
+ * Luckily, it's not strictly necessary - you can test sigsafe without it,
+ * as outlined below.
+ *
+ * <h3>Finding resources</h3>
+ *
+ * I've had good luck so far finding information about how to implement raw
+ * system calls under various platforms. You might find the following
+ * resources helpful:
+ *
+ * - Google. Just search for your platform name and syscall. Include bits
+ * you find in system headers.
+ * - The <tt>arch</tt>, <tt>machine</tt>, <tt>sys</tt>, etc. directories of
+ * off <tt>/usr/include</tt>. Searching for "syscall", "system call", "asm",
+ * and "assembler" will be helpful.
+ * - Compiler-generated assembly. "Try cc -S file.c" after making a skeleton
+ * file that does most of what you want. You might try with or without
+ * optimization ("-O"); sometimes it's clearer with or without. You might
+ * also use "-fpic" under gcc to look at position-independent code.
+ * - The system libc. If you're lucky, it's open source. But failing that,
+ * you can at least disassemble a system call with <tt>dbx</tt> or
+ * <tt>gdb</tt>.
+ * - Existing sigsafe platforms. It will be especially helpful to look at
+ * implementations for the same architecture, if they exist. Function call
+ * conventions tend to be the same across operating systems, and system call
+ * conventions tend to be similar. Each platform also has a <tt>README</tt>
+ * file outlining the resources I used to make the port.
+ * - Me. I'm happy to share whatever I know.
+ *
+ * <h3>Step-by-step tutorial</h3>
+ *
+ * ...doesn't exist yet. Sorry! Come back in a while.
+ *
+ * <h2>Testing your implementation</h2>
+ *
+ * <h3>Using the race condition checker</h3>
+ *
+ * Ideally, the race condition checker works on your platform. Then testing is
+ * fairly simple:
+ *
+@verbatim
+$ tests/build-myplatform/race_checker -qm
+...
+ Test Result Expected
+----------------------------------------------------------------
+ sigsafe_read success success
+ racebefore_read ignored signal ignored signal
+ raceafter_read forgotten result forgotten result
+@endverbatim
+ *
+ * If the the results are different from expected, it will mark the guilty
+ * tests with a '*' and note it at the bottom.
+ *
+ * If the quick tests pass, you can run a full test with:
+ *
+@verbatim
+$ ./race_checker -a
+@endverbatim
+ *
+ * but you might go out for coffee or perhaps dinner while this happens. It
+ * traces through a lot of instructions one-by-one, so it is slow.
+ *
+ * <h3>Testing for races with gdb</h3>
+ *
+ * <ul>
+ *
+ * <li> Test a run with no signals received:
+ *
+@verbatim
+$ gdb build-myplatform/tests/simple_test
+...
+(gdb) run
+Starting program: ...
+asdf
+read 5 bytes: asdf
+@endverbatim
+ *
+ * This is the most basic confirmation that your program is working, with no
+ * unusual paths taken.</li>
+ *
+ * <li> Test a run with a non-signal-related error. I typically use
+ * <tt>EBADF</tt> by modifying <tt>simple_test</tt>'s call line to read a
+ * nonsensical file descriptor.</li>
+ *
+ * <li>Test runs without a call to sigsafe_install_tsd. I typically comment
+ * this line out of <tt>simple_test</tt>. It shouldn't crash. The portable
+ * code won't call <tt>sigsafe_handler_for_platform_</tt> in this case, so
+ * you can be confident that it won't skip out on a signal handler. You
+ * just have to check that you don't try to dereference NULL; you should
+ * jump directly to the system call if you find the TSD pointer is null.
+ * </li>
+ *
+ * <li>Test a run with a signal received well before minjmp (but after the
+ * signal handler and TSD are installed).
+ *
+@verbatim
+$ gdb build-myplatform/tests/simple_test
+...
+(gdb) break sigsafe_read
+Breakpoint 1 at 0x22d0
+(gdb) run
+Starting program: ...
+
+Breakpoint 1, 0x000022d0 in sigsafe_read ()
+(gdb) signal SIGUSR1
+Continuing with signal SIGUSR1.
+[S]
+Breakpoint 1, 0x000022d0 in sigsafe_read ()
+(gdb) continue
+sigsafe_read returned -4 (Interrupted system call)
+@endverbatim
+ *
+ * Note the "[S]" that says the signal handler was invoked. If you don't
+ * see this, your gdb might be broken! I've found under Darwin/ppc that I
+ * have to manually deliver a signal from a shell in another terminal
+ * window.
+ *
+ * What you're looking for here is confirmation that it correctly follows
+ * the signal received path if a signal is received before entering the
+ * jump region.</li>
+ *
+ * <li>Test runs one instruction before minjmp. They should be the same as
+ * above. Use "stepinstruction" (or "si" for short) to step one-by-one
+ * until you almost see the minjmp, then try the signal. You're looking
+ * for confirmation that you didn't place the <tt>minjmp</tt> too late. If
+ * you've already fetched the <tt>signal_received</tt> count when
+ * <tt>minjmp</tt> comes around, this will proceed to the system call.
+ * That's bad.</li>
+ *
+ * <li>Test runs at minjmp, maxjmp, and possibly between. They should look the
+ * same as above, except you'll also see a <tt>[J]</tt> if debugging is
+ * enabled.</li>
+ *
+ * <li>Test runs immediately after the system call. sigsafe_read should return
+ * the normal result, not -EINTR.</li>
+ * </ul>
+ *
+ * This is not as thorough as the automated race checker, but these are all
+ * the critical values. You can be reasonable confident in your implementation
+ * if all these tests pass.
+ *
+ * Some handy gdb commands:
+ *
+ * - disassemble (or "disas"): shows machine instructions at the current
+ * instruction pointer address or the specified function/symbol. Handy for
+ * seeing where you are in the code, and also for reverse-engineering
+ * <tt>libc</tt> where necessary.
+ * - stepinstruction (or "si"): steps a single machine instruction.
+ * - "show registers" - shows all registers. "show registers X Y Z" will only
+ * show the given ones.
+ * - "set $x = 1", where x is a register, will set the value appropriately.
+ * - "print expr" will print the value of the specified expression. It can
+ * include registers ($reg as above), C-style casts and operators (the '&'
+ * address-of or '*' derefence), etc.
+ * - "signal SIGxxx" will deliver the specified signal and continue. Be
+ * careful - it doesn't work on all platforms. On Darwin/ppc, I have to
+ * manually deliver signals to the stopped program in another terminal, then
+ * continue.
+ * - "break func" - set a breakpoint at a function
+ * - "break *func+X" - sets a breakpoint at X bytes past the start of func.
+ * Handy when looking at disassembler output.
+ *
+ * <h3>Testing for races with dbx</h3>
+ *
+ * The process is as above, with gdb. The only real difference is in the
+ * syntax. Some handy commands here:
+ *
+ * - "func/20i" - disassemble 20 instructions starting at func.
+ * - "stop in func" - set a breakpoint at func.
+ * - "continue SIGxxx" - continue with a signal.
+ * - "printregs" - print register contents.
+ *
+ * <h3>Testing performance</h3>
+ *
+ * You should also run <tt>time build-myplatform/tests/bench_read_raw</tt>
+ * and <tt>time build-myplatform/tests/bench_read_safe</tt>. They should not
+ * differ in time significantly. (User time is where you'll find the
+ * difference, if any.) In theory the safe version should be slightly more
+ * processor-intensive since it makes a call to <tt>pthread_getspecific</tt>
+ * with every system call. In practice, I often find no statistically
+ * significant difference or even that the safe version is faster.
+ */
Modified: projects/sigsafe/src/i386-netbsd/emulated_syscalls.c
==============================================================================
--- projects/sigsafe/src/i386-netbsd/emulated_syscalls.c (original)
+++ projects/sigsafe/src/i386-netbsd/emulated_syscalls.c Tue May 11 03:12:25 2004
@@ -1,5 +1,5 @@
/** @file
- * Emulated system calls under i386-freebsd.
+ * Emulated system calls on i386-netbsd.
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
Modified: projects/sigsafe/src/i386-netbsd/sighandler_platform.c
==============================================================================
--- projects/sigsafe/src/i386-netbsd/sighandler_platform.c (original)
+++ projects/sigsafe/src/i386-netbsd/sighandler_platform.c Tue May 11 03:12:25 2004
@@ -1,5 +1,5 @@
/** @file
- * Adjusts instruction pointer as necessary on i386-linux.
+ * Adjusts instruction pointer as necessary on i386-netbsd.
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
Modified: projects/sigsafe/src/i386-netbsd/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/i386-netbsd/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/i386-netbsd/sigsafe_syscalls.S Tue May 11 03:12:25 2004
@@ -17,7 +17,7 @@
je L_sigsafe_##name##_nocompare ;\
LABEL(sigsafe_##name##_minjmp_) ;\
cmp $0,(%eax) ;\
- jne _sigsafe_##name##_jmpto ;\
+ jne sigsafe_##name##_jmpto_ ;\
L_sigsafe_##name##_nocompare: ;\
movl $SYS_##name,%eax ;\
LABEL(sigsafe_##name##_maxjmp_) ;\
Modified: projects/sigsafe/src/ia64-linux/emulated_syscalls.c
==============================================================================
--- projects/sigsafe/src/ia64-linux/emulated_syscalls.c (original)
+++ projects/sigsafe/src/ia64-linux/emulated_syscalls.c Tue May 11 03:12:25 2004
@@ -1,5 +1,5 @@
/** @file
- * Emulated system calls on x86_64-linux.
+ * Emulated system calls on ia64-linux.
* @legal
* Copyright © 2004 Scott Lamb <sl...@sl...>.
* This file is part of sigsafe, which is released under the MIT license.
|
|
From: <sl...@ca...> - 2004-05-11 06:48:58
|
Author: slamb
Date: Tue May 11 01:48:53 2004
New Revision: 752
Modified:
projects/sigsafe/SConstruct
projects/sigsafe/src/sparc-sunos/sighandler_platform.c
projects/sigsafe/src/sparc-sunos/sigsafe_syscalls.S
projects/sigsafe/tests/SConscript
projects/sigsafe/tests/platform_behavior/SConscript
projects/sigsafe/tests/race_checker/SConscript
Log:
Changes to make Solaris/sparc happier:
- Updated for newer naming scheme (grr)
- Configure checking for the rt, socket, and nsl libraries needed for tests.
Modified: projects/sigsafe/SConstruct
==============================================================================
--- projects/sigsafe/SConstruct (original)
+++ projects/sigsafe/SConstruct Tue May 11 01:48:53 2004
@@ -94,6 +94,30 @@
if conf.CheckHeader('stdint.h'):
conf.env.Append(CPPDEFINES = ['SIGSAFE_HAVE_STDINT_H'])
+# Check for stuff needed only for testing
+
+extra_test_libs = []
+
+if not conf.CheckFunc('nanosleep'):
+ if conf.CheckLibWithHeader('rt', 'time.h', 'C', 'nanosleep(NULL,NULL);',
+ autoadd = 0):
+ extra_test_libs.append('rt')
+ else:
+ print 'Unable to find library for nanosleep.'
+ Exit(1)
+
+if not conf.CheckFunc('connect'):
+ if conf.CheckLib('nsl', autoadd = 0):
+ extra_test_libs.append('nsl')
+ if conf.CheckLibWithHeader('socket', ['sys/types.h','sys/socket.h'],
+ 'C', 'connect(0, NULL, 0);', autoadd = 0):
+ extra_test_libs.append('socket')
+ else:
+ print 'Unable to find library for connect.'
+ Exit(1)
+
+Export('extra_test_libs')
+
global_env = conf.Finish()
#
Modified: projects/sigsafe/src/sparc-sunos/sighandler_platform.c
==============================================================================
--- projects/sigsafe/src/sparc-sunos/sighandler_platform.c (original)
+++ projects/sigsafe/src/sparc-sunos/sighandler_platform.c Tue May 11 01:48:53 2004
@@ -12,10 +12,10 @@
#include <unistd.h>
void sigsafe_handler_for_platform_(ucontext_t *ctx) {
- struct sigsafe_syscall *s;
+ struct sigsafe_syscall_ *s;
void *pc;
pc = (void*) ctx->uc_mcontext.gregs[REG_PC];
- for (s = sigsafe_syscalls; s->address != NULL; s++) {
+ for (s = sigsafe_syscalls_; s->minjmp != NULL; s++) {
if (s->minjmp <= pc && pc <= s->maxjmp) {
#ifdef SIGSAFE_DEBUG_JUMP
write(2, "[J]", 3);
Modified: projects/sigsafe/src/sparc-sunos/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/sparc-sunos/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/sparc-sunos/sigsafe_syscalls.S Tue May 11 01:48:53 2004
@@ -40,14 +40,14 @@
LOAD_TSD ;\
cmp %g2, 0 ;\
$sigsafe_##name##_check: ;\
- be _sigsafe_##name##_maxjmp ;\
+ be sigsafe_##name##_maxjmp_ ;\
mov SYS_##name, %g1 ;\
-LABEL(_sigsafe_##name##_minjmp) ;\
+LABEL(sigsafe_##name##_minjmp_) ;\
ld [%g2], %g3 ;\
cmp %g3, 0 ;\
- bne _sigsafe_##name##_jmpto ;\
+ bne sigsafe_##name##_jmpto_ ;\
.empty /* suppress "label in delay slot" warning */ ;\
-LABEL(_sigsafe_##name##_maxjmp) ;\
+LABEL(sigsafe_##name##_maxjmp_) ;\
te ST_SYSCALL ;\
bcc $sigsafe_##name##_out ;\
cmp %o0, ERESTART ;\
@@ -55,7 +55,7 @@
cmp %g2, 0 ;\
retl ;\
neg %o0 ;\
-LABEL(_sigsafe_##name##_jmpto) ;\
+LABEL(sigsafe_##name##_jmpto_) ;\
mov -EINTR, %o0 ;\
$sigsafe_##name##_out: ;\
retl ;\
Modified: projects/sigsafe/tests/SConscript
==============================================================================
--- projects/sigsafe/tests/SConscript (original)
+++ projects/sigsafe/tests/SConscript Tue May 11 01:48:53 2004
@@ -3,7 +3,7 @@
# Copyright (C) 2004 Scott Lamb <sl...@sl...>.
# This file is part of sigsafe, which is released under the MIT license.
-Import('env os_name')
+Import('env os_name extra_test_libs')
SConscript('platform_behavior/SConscript')
if os_name != 'freebsd' and os_name != 'netbsd':
@@ -11,6 +11,7 @@
env = env.Copy()
env.Prepend(LIBS = ['sigsafe', 'm'])
+env.Append(LIBS = extra_test_libs)
for i in ['simple_test',
'test_pipe_bytecount',
Modified: projects/sigsafe/tests/platform_behavior/SConscript
==============================================================================
--- projects/sigsafe/tests/platform_behavior/SConscript (original)
+++ projects/sigsafe/tests/platform_behavior/SConscript Tue May 11 01:48:53 2004
@@ -3,12 +3,9 @@
# Copyright (C) 2004 Scott Lamb <sl...@sl...>.
# This file is part of sigsafe, which is released under the MIT license.
-Import('env os_name')
+Import('env os_name extra_test_libs')
env = env.Copy()
-
-# TODO: make a configure-style test for nanosleep/librt
-if os_name == 'osf1':
- env.Append(LIBS = ['rt'])
+env.Append(LIBS = extra_test_libs)
for i in ['blocked_alarm',
'setitimer_rounding',
Modified: projects/sigsafe/tests/race_checker/SConscript
==============================================================================
--- projects/sigsafe/tests/race_checker/SConscript (original)
+++ projects/sigsafe/tests/race_checker/SConscript Tue May 11 01:48:53 2004
@@ -3,9 +3,10 @@
# Copyright (C) 2004 Scott Lamb <sl...@sl...>.
# This file is part of sigsafe, which is released under the MIT license.
-Import('env os_name')
+Import('env os_name extra_test_libs')
env = env.Copy()
env.Prepend(LIBS = ['sigsafe'])
+env.Append(LIBS = extra_test_libs)
env.Program(target = 'race_checker', source = [
'race_checker.c',
'races_generic.c',
|
|
From: <sl...@ca...> - 2004-05-09 12:42:19
|
Author: slamb
Date: Sun May 9 07:42:14 2004
New Revision: 751
Modified:
projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S
projects/sigsafe/src/alpha-osf1/sigsafe_syscalls.S
Log:
Alpha systems:
- restore stack properly on exit of single-threaded version
- look at sigsafe_data_, not &sigsafe_data_.
Modified: projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/alpha-linux/sigsafe_syscalls.S Sun May 9 07:42:14 2004
@@ -51,13 +51,13 @@
LABEL(sigsafe_##name##_maxjmp_) ;\
callsys ;\
bne a3, $sigsafe_##name##_error ;\
- lda sp, 8+8*args(sp) ;\
+ lda sp, FRAME_SIZE(args)(sp) ;\
ret zero, (ra), 1 ;\
LABEL(sigsafe_##name##_jmpto_) ;\
lda v0, EINTR(zero) ;\
$sigsafe_##name##_error: ;\
negl v0 ;\
- lda sp, 8+8*args(sp) ;\
+ lda sp, FRAME_SIZE(args)(sp) ;\
ret zero, (ra), 1 ;\
.end sigsafe_##name
@@ -105,6 +105,16 @@
/*@}*/
#ifdef _THREAD_SAFE
+#define FRAME_SIZE(args) 8+8*args
+#else
+#define FRAME_SIZE(args) 8
+#endif
+
+/**
+ * @define START
+ * Initialize the frame, get the TSD pointer in v0
+ */
+#ifdef _THREAD_SAFE
#define START(args) \
.frame sp,8+8*args,ra ;\
.mask SAVEDMASK_##args,-8-8*args ;\
@@ -112,8 +122,7 @@
lda sp,-8-8*args(sp) ;\
SAVERESTORE_REGS_##args(stq) ;\
.prologue 1 ;\
- lda t0, sigsafe_key_ ;\
- ldl a0, 0(t0) ;\
+ ldl a0, sigsafe_key_ /* sigsafe_key_ */ ;\
jsr ra,pthread_getspecific ;\
ldgp gp,0(ra) ;\
SAVERESTORE_REGS_##args(ldq)
@@ -124,7 +133,7 @@
ldgp gp,0(pv) ;\
lda sp,-8(sp) ;\
.prologue 1 ;\
- lda v0, sigsafe_data_
+ ldq v0, sigsafe_data_ /* sigsafe_data_ */
#endif
#include "syscalls.h"
Modified: projects/sigsafe/src/alpha-osf1/sigsafe_syscalls.S
==============================================================================
--- projects/sigsafe/src/alpha-osf1/sigsafe_syscalls.S (original)
+++ projects/sigsafe/src/alpha-osf1/sigsafe_syscalls.S Sun May 9 07:42:14 2004
@@ -57,13 +57,13 @@
LABEL(sigsafe_##name##_maxjmp_) ;\
call_pal PAL_callsys ;\
bne a3, $sigsafe_##name##_error ;\
- lda sp, 8+8*args(sp) ;\
+ lda sp, FRAME_SIZE(args)(sp) ;\
ret zero, (ra), 1 ;\
LABEL(sigsafe_##name##_jmpto_) ;\
lda v0, EINTR(zero) ;\
$sigsafe_##name##_error: ;\
negl v0 ;\
- lda sp, 8+8*args(sp) ;\
+ lda sp, FRAME_SIZE(args)(sp) ;\
ret zero, (ra), 1 ;\
.end sigsafe_##name
@@ -111,6 +111,12 @@
/*@}*/
#ifdef _THREAD_SAFE
+#define FRAME_SIZE(args) 8+8*args
+#else
+#define FRAME_SIZE(args) 8
+#endif
+
+#ifdef _THREAD_SAFE
#define START(args) \
.frame sp,8+8*args,ra ;\
.mask SAVEDMASK_##args,-8-8*args ;\
@@ -118,8 +124,7 @@
lda sp,-8-8*args(sp) ;\
SAVERESTORE_REGS_##args(stq) ;\
.prologue 1 ;\
- lda t0, sigsafe_key_ ;\
- ldl a0, 0(t0) ;\
+ ldl a0, sigsafe_key_ ;\
jsr ra,__pthread_getspecific ;\
ldgp gp,0(ra) ;\
SAVERESTORE_REGS_##args(ldq)
@@ -130,7 +135,7 @@
ldgp gp,0(pv) ;\
lda sp,-8(sp) ;\
.prologue 1 ;\
- lda v0, sigsafe_data_
+ ldq v0, sigsafe_data_
#endif
#include "syscalls.h"
|