m68k sunos4 port works (was: Re: (fwd) Help needed for linux m68k port)

Kiyo Inaba inaba at src.ricoh.co.jp
Tue Jul 14 01:44:18 PDT 1998


Following patch makes kaffe-snap to work on m68k/sunos4.
On m68k, structures are packed to 2 bytes boundary, and ALIGNMENT_OF_SIZE
macro shall be defined.
Same idea will work for m68k/linux, I hope.

Thanks Godmar, for his patient help.

Kiyo
------------------------------------------------------------------------
diff -cr kaffe-snap/config/config-std.h kaffe-snap-new/config/config-std.h
*** kaffe-snap/config/config-std.h	Wed Apr  1 04:10:52 1998
--- kaffe-snap-new/config/config-std.h	Sun Jul 12 13:39:33 1998
***************
*** 47,50 ****
--- 47,55 ----
  #define	__NORETURN__
  #endif
  
+ /* SunOS has on_exit only */
+ #if !defined(HAVE_ATEXIT) && defined(HAVE_ON_EXIT)
+ #define atexit(x)       on_exit(x, 0)
+ #endif
+ 
  #endif
diff -cr kaffe-snap/config/m68k/sunos4/config.frag kaffe-snap-new/config/m68k/sunos4/config.frag
*** kaffe-snap/config/m68k/sunos4/config.frag	Wed Apr  1 04:10:53 1998
--- kaffe-snap-new/config/m68k/sunos4/config.frag	Sun Jul 12 14:51:59 1998
***************
*** 3,6 ****
  #
  host_cpu=m68k
  host_os=sunos4
! dynamic_libraries=no
--- 3,25 ----
  #
  host_cpu=m68k
  host_os=sunos4
! PIC=-fPIC
! LIBSHARE=-Bdynamic
! LIBEXT=.so
! if [ "$cross_compiling" = yes ]; then
! # if we use cross environment, set tools properly
!   ac_cv_prog_AR=${ac_cv_prog_AR='m68k-sun-sunos4.1.1-ar -r'}
! # CC should be set before invoking configure, rather than here.
! # ac_cv_prog_CC=${ac_cv_prog_CC='m68k-sun-sunos4.1.1-gcc'}
!   ac_cv_prog_CPP=${ac_cv_prog_CPP='m68k-sun-sunos4.1.1-gcc -E'}
!   ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB='m68k-sun-sunos4.1.1-ranlib'}
! # if we use cross environment, following values may not be detected.
!   ac_cv_alignmentof_voidp=${ac_cv_alignmentof_voidp='2'}
!   ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
!   ac_cv_sizeof___int64=${ac_cv_sizeof___int64='0'}
!   ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
!   ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
!   ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}
!   ac_cv_sizeof_short=${ac_cv_sizeof_short='2'}
!   ac_cv_sizeof_voidp=${ac_cv_sizeof_voidp='4'}
! fi
diff -cr kaffe-snap/config/m68k/sunos4/md.h kaffe-snap-new/config/m68k/sunos4/md.h
*** kaffe-snap/config/m68k/sunos4/md.h	Wed Apr  1 04:10:53 1998
--- kaffe-snap-new/config/m68k/sunos4/md.h	Tue Jul 14 17:06:42 1998
***************
*** 7,12 ****
--- 7,19 ----
   *
   * See the file "license.terms" for information on usage and redistribution 
   * of this file. 
+  *
+  * Written by Kiyo Inaba <inaba at src.ricoh.co.jp>, 1998;
+  * Based on the ports
+  *	by Remi Perrot <r_perrot at mail.club-internet.fr> to m68k/linux
+  * and
+  *	by Alexandre Oliva <oliva at dcc.unicamp.br> to sparc
+  *
   */
  
  #ifndef __m68k_sunos4_md_h
***************
*** 14,21 ****
--- 21,76 ----
  
  #include "m68k/threads.h"
  
+ /*
+  * Redefine stack pointer offset.
+  */
+ #undef  SP_OFFSET
+ #define SP_OFFSET       2
+ 
+ /*
+  * Alignment in structure is 2 bytes packed.
+  */
+ #define ALIGNMENT_OF_SIZE(S)    (((S>1)?2:1))
+ 
+ #define	sysdepCallMethod(CALL) do {					\
+ 	int extraargs[(CALL)->nrargs];					\
+ 	register int d0 asm ("d0");					\
+ 	register int d1 asm ("d1");					\
+ 	int *res;							\
+ 	int *args = extraargs;						\
+ 	int argidx;							\
+ 	for(argidx = 0; argidx < (CALL)->nrargs; ++argidx) {		\
+ 	    if ((CALL)->callsize[argidx])				\
+ 		*args++ = (CALL)->args[argidx].i;			\
+ 	    else							\
+ 		*args++ = (CALL)->args[argidx-1].j;			\
+ 	}								\
+ 	asm volatile ("jsr     %2@\naddw    %3,sp\n"			\
+ 	 : "=r" (d0), "=r" (d1)						\
+ 	 : "a" ((CALL)->function),					\
+ 	   "r" ((CALL)->nrargs * sizeof(int))				\
+ 	 : "cc", "memory");						\
+ 	if ((CALL)->retsize != 0) {					\
+ 		res = (int *)(CALL)->ret;				\
+ 		res[1] = d1;						\
+ 		res[0] = d0;						\
+ 	}								\
+ } while (0)
+ 
  #if defined(TRANSLATOR)
  #include "jit-md.h"
  #endif
+ 
+ struct sockaddr;
+ extern int rename(const char*, const char*);
+ extern int remove(const char*);
+ extern int socket(int, int, int);
+ extern ssize_t sendto(int, const void*, size_t, int, const struct sockaddr*, int);
+ extern int setsockopt(int, int, int, const void*, int);
+ extern int getsockopt(int, int, int, void*, int*);
+ extern int getsockname(int, struct sockaddr*, int*);
+ extern int getpeername(int, struct sockaddr*, int*);
+ extern int select(int, fd_set*, fd_set*, fd_set*, struct timeval*);
+ extern int vfprintf(FILE *, char *, va_list);
  
  #endif


More information about the kaffe mailing list