Skip to content

Commit f4da14d

Browse files
committed
Remove where-is-mcontext.c
That's pretty old. Using the same code for ppc32/ppc64 appears to work.
1 parent 8f5bf09 commit f4da14d

File tree

6 files changed

+7
-117
lines changed

6 files changed

+7
-117
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ src/runtime/target-arch-os.h
3232
src/runtime/target-arch.h
3333
src/runtime/target-lispregs.h
3434
src/runtime/target-os.h
35-
src/runtime/ppc-linux-mcontext.h
3635
tests/test-status.lisp-expr
3736
tests/test.log
3837
tests/*.so

clean.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ find . \( \
110110
-name 'test.log' -o \
111111
-name 'a.out' -o \
112112
-name 'sbcl' -o \
113-
-name 'ppc-linux-mcontext.h' -o \
114113
-name 'depend' -o \
115114
-name 'TAGS' -o \
116115
-name 'tags' -o \

make-config.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -724,15 +724,7 @@ case "$sbcl_arch" in
724724
esac
725725
;;
726726
ppc)
727-
if [ "$sbcl_os" = "linux" ]; then
728-
# Use a C program to detect which kind of glibc we're building on,
729-
# to bandage across the break in source compatibility between
730-
# versions 2.3.1 and 2.3.2
731-
#
732-
# FIXME: integrate to grovel-features, mayhaps
733-
$GNUMAKE -C tools-for-build where-is-mcontext -I ../src/runtime
734-
tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h || (echo "error running where-is-mcontext"; exit 1)
735-
elif [ "$sbcl_os" = "darwin" ]; then
727+
if [ "$sbcl_os" = "darwin" ]; then
736728
# We provide a dlopen shim, so a little lie won't hurt
737729
printf ' :os-provides-dlopen' >> $ltf
738730
# The default stack ulimit under darwin is too small to run PURIFY.
@@ -745,10 +737,6 @@ case "$sbcl_arch" in
745737
fi
746738
;;
747739
ppc64)
748-
# there is no glibc bug that requires the 'where-is-mcontext' hack.
749-
# (Sufficiently new glibc uses the correct definition, which is the same as
750-
# 2.3.1, so define our constant for that)
751-
echo '#define GLIBC231_STYLE_UCONTEXT 1' > src/runtime/ppc-linux-mcontext.h
752740
;;
753741
riscv)
754742
if [ "$xlen" = "64" ]; then

src/runtime/ppc-linux-os.c

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <sys/prctl.h>
3535

3636
#include "validate.h"
37-
#include "ppc-linux-mcontext.h"
3837

3938
int arch_os_thread_init(struct thread *thread) {
4039
/* For some reason, PPC Linux appears to default to not generating
@@ -62,74 +61,37 @@ int arch_os_thread_cleanup(struct thread *thread) {
6261
os_context_register_t *
6362
os_context_register_addr(os_context_t *context, int offset)
6463
{
65-
#if defined(GLIBC231_STYLE_UCONTEXT)
66-
return &((context->uc_mcontext.regs)->gpr[offset]);
67-
#elif defined(GLIBC232_STYLE_UCONTEXT)
68-
return &((context->uc_mcontext.uc_regs->gregs)[offset]);
69-
#endif
64+
return &context->uc_mcontext.regs->gpr[offset];
7065
}
7166

7267
os_context_register_t *
7368
os_context_lr_addr(os_context_t *context)
7469
{
75-
#if defined(GLIBC231_STYLE_UCONTEXT)
76-
return &((context->uc_mcontext.regs)->link);
77-
#elif defined(GLIBC232_STYLE_UCONTEXT)
78-
return &((context->uc_mcontext.uc_regs->gregs)[PT_LNK]);
79-
#endif
70+
return &context->uc_mcontext.regs->link;
8071
}
8172

8273
os_context_register_t *
8374
os_context_ctr_addr(os_context_t *context)
8475
{
85-
/* Like os_context_fp_control() and os_context_lr_addr(), this
86-
* uses an index beyond the declared end of the array in order to
87-
* find the correct register value in the context. */
88-
#if defined(GLIBC231_STYLE_UCONTEXT)
89-
/* FIXME: This probably should be ->ctr instead of ->gpr[PT_CTR]. */
90-
return &((context->uc_mcontext.regs)->gpr[PT_CTR]);
91-
#elif defined(GLIBC232_STYLE_UCONTEXT)
92-
return &((context->uc_mcontext.uc_regs)->gregs[PT_CTR]);
93-
#endif
76+
return &context->uc_mcontext.regs->ctr;
9477
}
9578

9679
os_context_register_t *
9780
os_context_cr_addr(os_context_t *context)
9881
{
99-
/* Like os_context_fp_control() and os_context_lr_addr(), this
100-
* uses an index beyond the declared end of the array in order to
101-
* find the correct register value in the context. */
102-
#if defined(GLIBC231_STYLE_UCONTEXT)
103-
/* FIXME: This probably should be ->ccr instead of ->gpr[PT_CCR]. */
104-
return &((context->uc_mcontext.regs)->gpr[PT_CCR]);
105-
#elif defined(GLIBC232_STYLE_UCONTEXT)
106-
return &((context->uc_mcontext.uc_regs)->gregs[PT_CCR]);
107-
#endif
82+
return &context->uc_mcontext.regs->ccr;
10883
}
10984

11085
sigset_t *
11186
os_context_sigmask_addr(os_context_t *context)
11287
{
113-
#if defined(GLIBC231_STYLE_UCONTEXT)
11488
return &context->uc_sigmask;
115-
#elif defined(GLIBC232_STYLE_UCONTEXT)
116-
return &context->uc_sigmask;
117-
#endif
11889
}
11990

12091
unsigned long
12192
os_context_fp_control(os_context_t *context)
12293
{
123-
/* So this may look like nice, well behaved code. However, closer
124-
inspection reveals that gpr is simply the general purpose
125-
registers, and PT_FPSCR is an offset that is larger than 32
126-
(the number of ppc registers), but that happens to get the
127-
right answer. -- CSR, 2002-07-11 */
128-
#if defined(GLIBC231_STYLE_UCONTEXT)
129-
return context->uc_mcontext.regs->gpr[PT_FPSCR];
130-
#elif defined(GLIBC232_STYLE_UCONTEXT)
131-
return context->uc_mcontext.uc_regs->gregs[PT_FPSCR];
132-
#endif
94+
return ((unsigned long*)context->uc_mcontext.regs)[PT_FPSCR];
13395
}
13496

13597
void

src/runtime/ppc-linux-os.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ unsigned long os_context_fp_control(os_context_t *context);
88
#define RESTORE_FP_CONTROL_FROM_CONTEXT
99
void os_restore_fp_control(os_context_t *context);
1010

11-
#include "ppc-linux-mcontext.h" // Selects one of these two definitions
12-
#ifdef GLIBC231_STYLE_UCONTEXT
13-
# define OS_CONTEXT_PC(context) (context->uc_mcontext.regs)->nip
14-
#elif defined GLIBC232_STYLE_UCONTEXT
15-
# define OS_CONTEXT_PC(context) (context->uc_mcontext.uc_regs->gregs)[PT_NIP]
16-
#else
17-
# error "Need a definition of OS_CONTEXT_PC"
18-
#endif
11+
#define OS_CONTEXT_PC(context) (context->uc_mcontext.regs)->nip
1912

2013
#endif /* _PPC_LINUX_OS_H */

tools-for-build/where-is-mcontext.c

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)