Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d852d31

Browse files
committed
This patch should enable 6.5 to build on Motorola 68000 architecture. It comes from Roman Hodek <[email protected]>.
1 parent 70dfc8c commit d852d31

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/include/postgres.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1995, Regents of the University of California
88
*
9-
* $Id: postgres.h,v 1.22 1999/05/03 19:10:14 momjian Exp $
9+
* $Id: postgres.h,v 1.23 1999/06/10 22:59:22 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -63,7 +63,21 @@ typedef Oid regproc;
6363
typedef Oid RegProcedure;
6464

6565
/* ptr to func returning (char *) */
66+
#if defined(__mc68000__) && defined(__ELF__)
67+
/* The m68k SVR4 ABI defines that pointers are returned in %a0 instead of
68+
* %d0. So if a function pointer is declared to return a pointer, the
69+
* compiler may look only into %a0, but if the called function was declared
70+
* to return return an integer type, it puts its value only into %d0. So the
71+
* caller doesn't pink up the correct return value. The solution is to
72+
* declare the function pointer to return int, so the compiler picks up the
73+
* return value from %d0. (Functions returning pointers put their value
74+
* *additionally* into %d0 for compability.) The price is that there are
75+
* some warnings about int->pointer conversions...
76+
*/
77+
typedef int32 ((*func_ptr) ());
78+
#else
6679
typedef char *((*func_ptr) ());
80+
#endif
6781

6882

6983
#define RegProcedureIsValid(p) OidIsValid(p)

src/include/storage/s_lock.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.59 1999/04/13 17:42:26 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.60 1999/06/10 22:59:22 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -157,6 +157,24 @@ tas(volatile slock_t *lock)
157157
#endif /* sparc */
158158

159159

160+
#if defined(__mc68000__)
161+
#define TAS(lock) tas(lock)
162+
163+
static __inline__ int
164+
tas(volatile slock_t *lock)
165+
{
166+
register int rv;
167+
168+
__asm__ __volatile__ (
169+
"tas %1; sne %0"
170+
: "=d" (rv), "=m"(*lock)
171+
: "1" (*lock)
172+
: "cc" );
173+
return rv;
174+
}
175+
176+
#endif /* defined(__mc68000__) */
177+
160178

161179
#if defined(NEED_VAX_TAS_ASM)
162180
/*
@@ -372,3 +390,4 @@ int tas(volatile slock_t *lock); /* port/.../tas.s, or
372390

373391
#endif /* HAS_TEST_AND_SET */
374392
#endif /* S_LOCK_H */
393+

0 commit comments

Comments
 (0)