[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

www/w3m on sparc64



I have tried to get w3m working on sparc64 by copying existing
pieces of boehm-gc configuration and code from other platforms.
With the attached patch it builds and basically runs, however I
tend to get an abort pretty quickly.

This will probably not go in for 3.0, but it's a starting point.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de
Index: Makefile
===================================================================
RCS file: /cvs/ports/www/w3m/Makefile,v
retrieving revision 1.44
diff -u -r1.44 Makefile
--- Makefile	7 Apr 2002 00:54:46 -0000	1.44
+++ Makefile	7 Apr 2002 21:27:03 -0000
@@ -1,6 +1,6 @@
 # $OpenBSD: Makefile,v 1.44 2002/04/07 00:54:46 naddy Exp $
 
-ONLY_FOR_ARCHS=	alpha i386 m68k powerpc sparc
+ONLY_FOR_ARCHS=	alpha i386 m68k powerpc sparc sparc64
 
 COMMENT=	"pager/text-based web browser"
 
@@ -44,8 +44,10 @@
 	README README.dict README.func STORY.html \
 	keymap.default keymap.lynx menu.default menu.submenu
 
-PATCH_LIST=	patch-gc_dyn_load_c \
-		patch-gc_include_private_gcconfig_h
+PATCH_LIST=	patch-gc_Makefile \
+		patch-gc_dyn_load_c \
+		patch-gc_include_private_gcconfig_h \
+		patch-gc_sparc_openbsd_mach_dep_S
 
 .if ${FLAVOR:L:Mimage}
 LIB_DEPENDS=	Imlib.19::graphics/imlib
@@ -78,6 +80,10 @@
 		patch-image_c \
 		patch-search_c
 .endif
+
+post-extract:
+	@cd ${WRKSRC}/gc; \
+		cp sparc_netbsd_mach_dep.s sparc_openbsd_mach_dep.S
 
 post-install:
 	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/w3m
Index: patches/patch-gc_Makefile
===================================================================
RCS file: patches/patch-gc_Makefile
diff -N patches/patch-gc_Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-gc_Makefile	7 Apr 2002 21:27:03 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- gc/Makefile.orig	Sun Apr  7 21:47:54 2002
++++ gc/Makefile	Sun Apr  7 21:48:20 2002
+@@ -452,7 +452,7 @@ mach_dep.o: $(srcdir)/mach_dep.c $(srcdi
+ #	Gcc on a 21264 can spill pointers to fp registers.  Oops.
+ 	./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
+ 	./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
+-	./if_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
++	./if_mach SPARC OPENBSD $(CC) -c -o mach_dep.o $(srcdir)/sparc_openbsd_mach_dep.S
+ 	./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
+ 	./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
+ 	./if_mach IA64 "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
Index: patches/patch-gc_include_private_gcconfig_h
===================================================================
RCS file: /cvs/ports/www/w3m/patches/patch-gc_include_private_gcconfig_h,v
retrieving revision 1.1
diff -u -r1.1 patch-gc_include_private_gcconfig_h
--- patches/patch-gc_include_private_gcconfig_h	10 Mar 2002 07:44:44 -0000	1.1
+++ patches/patch-gc_include_private_gcconfig_h	7 Apr 2002 21:27:03 -0000
@@ -1,6 +1,6 @@
 $OpenBSD: patch-gc_include_private_gcconfig_h,v 1.1 2002/03/10 07:44:44 brad Exp $
---- gc/include/private/gcconfig.h.orig	Sun Mar 10 01:52:20 2002
-+++ gc/include/private/gcconfig.h	Sun Mar 10 01:58:59 2002
+--- gc/include/private/gcconfig.h.orig	Thu Dec 20 01:37:30 2001
++++ gc/include/private/gcconfig.h	Sun Apr  7 20:09:05 2002
 @@ -49,10 +49,14 @@
  #    define HP
  #    define mach_type_known
@@ -17,18 +17,37 @@
  # if defined(OPENBSD) && defined(__sparc__)
  #    define SPARC
  #    define mach_type_known
-@@ -673,6 +677,14 @@
- #   ifdef NETBSD
- #     define ALIGNMENT 4
- #     define OS_TYPE "NETBSD"
+@@ -678,6 +682,14 @@
+ #     define DATASTART GC_data_start
+ #     define DYNAMIC_LOADING
+ #   endif
++#   ifdef OPENBSD
++#     define ALIGNMENT 4
++#     define OS_TYPE "OPENBSD"
 +#     define HEURISTIC2
 +      extern char etext;
 +#     define DATASTART GC_data_start
 +#     define DYNAMIC_LOADING
 +#   endif
-+#   ifdef OPENBSD
-+#     define ALIGNMENT 4
-+#     define OS_TYPE "OPENBSD"
- #     define HEURISTIC2
-       extern char etext;
- #     define DATASTART GC_data_start
+ #   ifdef NOSYS
+ #     define ALIGNMENT 4
+ #     define OS_TYPE "NOSYS"
+@@ -811,9 +823,15 @@
+ #   endif
+ #   ifdef OPENBSD
+ #     define OS_TYPE "OPENBSD"
+-#     define STACKBOTTOM ((ptr_t) 0xf8000000)
+-      extern int etext;
+-#     define DATASTART ((ptr_t)(&etext))
++#     ifdef __ELF__
++#	define HEURISTIC2
++#	define DATASTART GC_data_start
++#	define CPP_WORDSZ 64
++#     else
++#	define STACKBOTTOM ((ptr_t) 0xf8000000)
++	extern int etext;
++#	define DATASTART ((ptr_t)(&etext))
++#     endif
+ #   endif
+ #   ifdef NETBSD
+ #     define OS_TYPE "NETBSD"
Index: patches/patch-gc_sparc_openbsd_mach_dep_S
===================================================================
RCS file: patches/patch-gc_sparc_openbsd_mach_dep_S
diff -N patches/patch-gc_sparc_openbsd_mach_dep_S
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-gc_sparc_openbsd_mach_dep_S	7 Apr 2002 21:27:03 -0000
@@ -0,0 +1,50 @@
+$OpenBSD$
+--- gc/sparc_openbsd_mach_dep.S.orig	Sun Apr  7 22:05:05 2002
++++ gc/sparc_openbsd_mach_dep.S	Sun Apr  7 22:05:12 2002
+@@ -1,3 +1,5 @@
++!	$OpenBSD$
++
+ !	SPARCompiler 3.0 and later apparently no longer handles
+ !	asm outside functions.  So we need a separate .s file
+ !	This is only set up for SunOS 4.
+@@ -11,13 +13,35 @@
+ 	.globl 	_C_LABEL(GC_push_regs)
+ _C_LABEL(GC_save_regs_in_stack):
+ _C_LABEL(GC_push_regs):
++#if defined(__arch64__)
++	save	%sp,-128,%sp
++	flushw
++	ret
++	restore	%sp,2047+128,%o0
++#else
+ 	ta	0x3   ! ST_FLUSH_WINDOWS
+ 	mov	%sp,%o0
+ 	retl
+ 	nop
++#endif
+ 	
+ 	.globl	_C_LABEL(GC_clear_stack_inner)
+ _C_LABEL(GC_clear_stack_inner):
++#if defined(__arch64__)
++	mov	%sp,%o2		! Save sp
++	add	%sp,2047-8,%o3	! p = sp+bias-8
++	add	%o1,-2047-192,%sp	! Move sp out of the way,
++				! so that traps still work.
++				! Includes some extra words
++				! so we can be sloppy below.
++loop:
++	stx	%g0,[%o3]	! *(long *)p = 0
++	cmp	%o3,%o1
++	bgu,pt	%xcc, loop	! if (p > limit) goto loop
++	add	%o3,-8,%o3	! p -= 8 (delay slot)
++	retl
++	mov	%o2,%sp		! Restore sp., delay slot
++#else
+ 	mov	%sp,%o2		! Save sp
+ 	add	%sp,-8,%o3	! p = sp-8
+ 	clr	%g1		! [g0,g1] = 0
+@@ -32,3 +56,4 @@ loop:
+ 	add	%o3,-8,%o3	! p -= 8 (delay slot)
+ 	retl
+ 	mov	%o2,%sp		! Restore sp., delay slot
++#endif