From a5d1d726704c6e3c4f8457e30cbd3d2840531ee5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 9 Oct 1998 11:04:04 +0000 Subject: Update. 1998-10-09 Ulrich Drepper * sysdeps/i386/i686/pt-machine.h: Remove unused inline definitions. --- linuxthreads/ChangeLog | 5 ++ linuxthreads/sysdeps/i386/i686/pt-machine.h | 16 ------- posix/ptestcases.h | 2 +- posix/regex.c | 30 ++++++++---- sysdeps/unix/sysv/linux/arm/bits/armsigctx.h | 59 ++++++++++++++++++++++++ sysdeps/unix/sysv/linux/arm/profil-counter.h | 42 +---------------- sysdeps/unix/sysv/linux/arm/register-dump.h | 69 +++++++++++++++++++--------- sysdeps/unix/sysv/linux/bits/socket.h | 2 +- 8 files changed, 136 insertions(+), 89 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/arm/bits/armsigctx.h diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 88f5eb7c8c..c93d485326 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,8 @@ +1998-10-09 Ulrich Drepper + + * sysdeps/i386/i686/pt-machine.h: Remove unused inline + definitions. + 1998-10-02 Andreas Jaeger * semaphore.h: Include so that _pthread_descr diff --git a/linuxthreads/sysdeps/i386/i686/pt-machine.h b/linuxthreads/sysdeps/i386/i686/pt-machine.h index d01e6cf368..8c2d794a8c 100644 --- a/linuxthreads/sysdeps/i386/i686/pt-machine.h +++ b/linuxthreads/sysdeps/i386/i686/pt-machine.h @@ -58,21 +58,5 @@ __compare_and_swap (long int *p, long int oldval, long int newval) } -extern inline int -get_eflags (void) -{ - int res; - __asm__ __volatile__ ("pushfl; popl %0" : "=r" (res) : ); - return res; -} - - -extern inline void -set_eflags (int newflags) -{ - __asm__ __volatile__ ("pushl %0; popfl" : : "r" (newflags) : "cc"); -} - - /* Use the LDT implementation only if the kernel is fixed. */ //#include "../useldt.h" diff --git a/posix/ptestcases.h b/posix/ptestcases.h index 0669380853..e025ab870f 100644 --- a/posix/ptestcases.h +++ b/posix/ptestcases.h @@ -66,7 +66,7 @@ { 1, 2, "\\$a", "$a", }, { 3, 3, "\\$$", "ab$", }, { 2, 6, "A\\([34]$[34]\\)B", "XA4$3BY", }, - { 0, 0, "2.8.3.1.3 Perios in BREs", NULL, }, + { 0, 0, "2.8.3.1.3 Periods in BREs", NULL, }, { 0, 0, "GA116", NULL, }, { 1, 1, ".", "abc", }, { -1, -1, ".ab", "abc", }, diff --git a/posix/regex.c b/posix/regex.c index 98ff8dfcbd..5f8e38c791 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -5570,7 +5570,8 @@ re_exec (s) REG_EXTENDED bit in CFLAGS is set; otherwise, to RE_SYNTAX_POSIX_BASIC; `newline_anchor' to REG_NEWLINE being set in CFLAGS; - `fastmap' and `fastmap_accurate' to zero; + `fastmap' to an allocated space for the fastmap; + `fastmap_accurate' to zero; `re_nsub' to the number of subexpressions in PATTERN. PATTERN is the address of the pattern string. @@ -5609,11 +5610,8 @@ regcomp (preg, pattern, cflags) preg->allocated = 0; preg->used = 0; - /* Don't bother to use a fastmap when searching. This simplifies the - REG_NEWLINE case: if we used a fastmap, we'd have to put all the - characters after newlines into the fastmap. This way, we just try - every character. */ - preg->fastmap = 0; + /* Try to allocate space for the fastmap. */ + preg->fastmap = (char *) malloc (1 << BYTEWIDTH); if (cflags & REG_ICASE) { @@ -5653,6 +5651,19 @@ regcomp (preg, pattern, cflags) unmatched close-group: both are REG_EPAREN. */ if (ret == REG_ERPAREN) ret = REG_EPAREN; + if (ret == REG_NOERROR && preg->fastmap) + { + /* Compute the fastmap now, since regexec cannot modify the pattern + buffer. */ + if (re_compile_fastmap (preg) == -2) + { + /* Some error occured while computing the fastmap, just forget + about it. */ + free (preg->fastmap); + preg->fastmap = NULL; + } + } + return (int) ret; } #ifdef _LIBC @@ -5701,10 +5712,10 @@ regexec (preg, string, nmatch, pmatch, eflags) if (want_reg_info) { regs.num_regs = nmatch; - regs.start = TALLOC (nmatch, regoff_t); - regs.end = TALLOC (nmatch, regoff_t); - if (regs.start == NULL || regs.end == NULL) + regs.start = TALLOC (nmatch * 2, regoff_t); + if (regs.start == NULL) return (int) REG_NOMATCH; + regs.end = regs.start + nmatch; } /* Perform the searching operation. */ @@ -5728,7 +5739,6 @@ regexec (preg, string, nmatch, pmatch, eflags) /* If we needed the temporary register info, free the space now. */ free (regs.start); - free (regs.end); } /* We want zero return to mean success, unlike `re_search'. */ diff --git a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h new file mode 100644 index 0000000000..395e194293 --- /dev/null +++ b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h @@ -0,0 +1,59 @@ +/* Definition of `struct sigcontext' for Linux/ARM + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* The format of struct sigcontext changed between 2.0 and 2.1 kernels. + Fortunately 2.0 puts a magic number in the first word and this is not + a legal value for `trap_no', so we can tell them apart. */ + +union k_sigcontext + { + struct + { + unsigned long int trap_no; + unsigned long int error_code; + unsigned long int oldmask; + unsigned long int arm_r0; + unsigned long int arm_r1; + unsigned long int arm_r2; + unsigned long int arm_r3; + unsigned long int arm_r4; + unsigned long int arm_r5; + unsigned long int arm_r6; + unsigned long int arm_r7; + unsigned long int arm_r8; + unsigned long int arm_r9; + unsigned long int arm_r10; + unsigned long int arm_fp; + unsigned long int arm_ip; + unsigned long int arm_sp; + unsigned long int arm_lr; + unsigned long int arm_pc; + unsigned long int arm_cpsr; + } v21; + struct + { + unsigned long int magic; + struct pt_regs reg; + unsigned long int trap_no; + unsigned long int error_code; + unsigned long int oldmask; + } v20; +}; + +#define SIGCONTEXT_2_0_MAGIC 0x4B534154 diff --git a/sysdeps/unix/sysv/linux/arm/profil-counter.h b/sysdeps/unix/sysv/linux/arm/profil-counter.h index 0d5024fa47..55a11bd76b 100644 --- a/sysdeps/unix/sysv/linux/arm/profil-counter.h +++ b/sysdeps/unix/sysv/linux/arm/profil-counter.h @@ -19,51 +19,13 @@ #include #include - -union k_sigcontext - { - struct - { - unsigned long int trap_no; - unsigned long int error_code; - unsigned long int oldmask; - unsigned long int arm_r0; - unsigned long int arm_r1; - unsigned long int arm_r2; - unsigned long int arm_r3; - unsigned long int arm_r4; - unsigned long int arm_r5; - unsigned long int arm_r6; - unsigned long int arm_r7; - unsigned long int arm_r8; - unsigned long int arm_r9; - unsigned long int arm_r10; - unsigned long int arm_fp; - unsigned long int arm_ip; - unsigned long int arm_sp; - unsigned long int arm_lr; - unsigned long int arm_pc; - unsigned long int arm_cpsr; - } v21; - struct - { - unsigned long int magic; - struct pt_regs reg; - unsigned long int trap_no; - unsigned long int error_code; - unsigned long int oldmask; - } v20; -}; +#include void profil_counter (int signo, int _a2, int _a3, int _a4, union k_sigcontext sc) { - /* The format of struct sigcontext changed between 2.0 and 2.1 kernels. - Fortunately 2.0 puts a magic number in the first word and this is not - a legal value for `trap_no', so we can tell them apart. */ - void *pc; - if (sc.v20.magic == 0x4B534154) + if (sc.v20.magic == SIGCONTEXT_2_0_MAGIC) pc = (void *) sc.v20.reg.ARM_pc; else pc = (void *) sc.v21.arm_pc; diff --git a/sysdeps/unix/sysv/linux/arm/register-dump.h b/sysdeps/unix/sysv/linux/arm/register-dump.h index 1b948ab5ff..015780c623 100644 --- a/sysdeps/unix/sysv/linux/arm/register-dump.h +++ b/sysdeps/unix/sysv/linux/arm/register-dump.h @@ -20,6 +20,7 @@ #include #include +#include /* We will print the register dump in this format: @@ -43,7 +44,7 @@ hexvalue (unsigned long int value, char *buf, size_t len) } static void -register_dump (int fd, struct sigcontext *ctx) +register_dump (int fd, union k_sigcontext *ctx) { char regs[20][8]; struct iovec iov[97]; @@ -59,26 +60,52 @@ register_dump (int fd, struct sigcontext *ctx) ++nr /* Generate strings of register contents. */ - hexvalue (ctx->arm_r0, regs[0], 8); - hexvalue (ctx->arm_r1, regs[1], 8); - hexvalue (ctx->arm_r2, regs[2], 8); - hexvalue (ctx->arm_r3, regs[3], 8); - hexvalue (ctx->arm_r4, regs[4], 8); - hexvalue (ctx->arm_r5, regs[5], 8); - hexvalue (ctx->arm_r6, regs[6], 8); - hexvalue (ctx->arm_r7, regs[7], 8); - hexvalue (ctx->arm_r8, regs[8], 8); - hexvalue (ctx->arm_r9, regs[9], 8); - hexvalue (ctx->arm_r10, regs[10], 4); - hexvalue (ctx->arm_fp, regs[11], 4); - hexvalue (ctx->arm_ip, regs[12], 4); - hexvalue (ctx->arm_sp, regs[13], 4); - hexvalue (ctx->arm_lr, regs[14], 4); - hexvalue (ctx->arm_pc, regs[15], 4); - hexvalue (ctx->arm_cpsr, regs[16], 8); - hexvalue (ctx->trap_no, regs[17], 8); - hexvalue (ctx->error_code, regs[18], 8); - hexvalue (ctx->old_mask, regs[19], 8); + if (ctx->v20.magic == SIGCONTEXT_2_0_MAGIC) + { + hexvalue (ctx->v20.reg.ARM_r0, regs[0], 8); + hexvalue (ctx->v20.reg.ARM_r1, regs[1], 8); + hexvalue (ctx->v20.reg.ARM_r2, regs[2], 8); + hexvalue (ctx->v20.reg.ARM_r3, regs[3], 8); + hexvalue (ctx->v20.reg.ARM_r4, regs[4], 8); + hexvalue (ctx->v20.reg.ARM_r5, regs[5], 8); + hexvalue (ctx->v20.reg.ARM_r6, regs[6], 8); + hexvalue (ctx->v20.reg.ARM_r7, regs[7], 8); + hexvalue (ctx->v20.reg.ARM_r8, regs[8], 8); + hexvalue (ctx->v20.reg.ARM_r9, regs[9], 8); + hexvalue (ctx->v20.reg.ARM_r10, regs[10], 4); + hexvalue (ctx->v20.reg.ARM_fp, regs[11], 4); + hexvalue (ctx->v20.reg.ARM_ip, regs[12], 4); + hexvalue (ctx->v20.reg.ARM_sp, regs[13], 4); + hexvalue (ctx->v20.reg.ARM_lr, regs[14], 4); + hexvalue (ctx->v20.reg.ARM_pc, regs[15], 4); + hexvalue (ctx->v20.reg.ARM_cpsr, regs[16], 8); + hexvalue (ctx->v20.trap_no, regs[17], 8); + hexvalue (ctx->v20.error_code, regs[18], 8); + hexvalue (ctx->v20.oldmask, regs[19], 8); + } + else + { + hexvalue (ctx->v21.arm_r0, regs[0], 8); + hexvalue (ctx->v21.arm_r1, regs[1], 8); + hexvalue (ctx->v21.arm_r2, regs[2], 8); + hexvalue (ctx->v21.arm_r3, regs[3], 8); + hexvalue (ctx->v21.arm_r4, regs[4], 8); + hexvalue (ctx->v21.arm_r5, regs[5], 8); + hexvalue (ctx->v21.arm_r6, regs[6], 8); + hexvalue (ctx->v21.arm_r7, regs[7], 8); + hexvalue (ctx->v21.arm_r8, regs[8], 8); + hexvalue (ctx->v21.arm_r9, regs[9], 8); + hexvalue (ctx->v21.arm_r10, regs[10], 4); + hexvalue (ctx->v21.arm_fp, regs[11], 4); + hexvalue (ctx->v21.arm_ip, regs[12], 4); + hexvalue (ctx->v21.arm_sp, regs[13], 4); + hexvalue (ctx->v21.arm_lr, regs[14], 4); + hexvalue (ctx->v21.arm_pc, regs[15], 4); + hexvalue (ctx->v21.arm_cpsr, regs[16], 8); + hexvalue (ctx->v21.trap_no, regs[17], 8); + hexvalue (ctx->v21.error_code, regs[18], 8); + hexvalue (ctx->v21.oldmask, regs[19], 8); + } /* Generate the output. */ ADD_STRING ("Register dump:\n\n R0: "); diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index eef389db44..47d70611f1 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -227,7 +227,7 @@ enum SCM_CREDENTIALS = 0x02, /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif - __SCM_CONNECT = 0x03, /* Data array is `struct scm_connect'. */ + __SCM_CONNECT = 0x03 /* Data array is `struct scm_connect'. */ }; /* User visible structure for SCM_CREDENTIALS message */ -- cgit 1.4.1