From owner-freebsd-amd64@FreeBSD.ORG Wed Jun 2 02:50:35 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 30E9D16A540; Wed, 2 Jun 2004 02:50:35 -0700 (PDT) Received: from transport.cksoft.de (transport.cksoft.de [62.111.66.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C95643D1D; Wed, 2 Jun 2004 02:50:10 -0700 (PDT) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from transport.cksoft.de (localhost [127.0.0.1]) by transport.cksoft.de (Postfix) with ESMTP id D89211FFDD5; Wed, 2 Jun 2004 11:50:08 +0200 (CEST) Received: by transport.cksoft.de (Postfix, from userid 66) id 097C21FFDD4; Wed, 2 Jun 2004 11:50:07 +0200 (CEST) Received: by mail.int.zabbadoz.net (Postfix, from userid 1060) id 24D6915600; Wed, 2 Jun 2004 09:41:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.int.zabbadoz.net (Postfix) with ESMTP id 212EE154E5; Wed, 2 Jun 2004 09:41:15 +0000 (UTC) Date: Wed, 2 Jun 2004 09:41:15 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@e0-0.zab2.int.zabbadoz.net To: Peter Wemm In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS cksoft-s20020300-20031204bz on transport.cksoft.de cc: FreeBSD amd64 mailing list Subject: Re: patch: amd64 native cvsup with compress working X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2004 09:50:35 -0000 On Tue, 1 Jun 2004, Bjoern A. Zeeb wrote: Sorry for replying to myself but attached is an updated patch for amd64 cvsup to work with compression. The problem seems that zlib deflate returns an (c native) int that gets somehow mapped to an INTEGER directly or indirectly through the RETURN statements with the PROCEDURE returning an INTEGER. INTEGER on amd64 seems to be a long and not an int thus some conversion from the zlib return into m3 seems to lose signedness. The workaround is to use a Ctypes.int variable to temporary safe the return code from zlib and do the type convertion entirely in m3 which seems to work fine here. cvsupping release=cvs, src-all at the moment. --- cut --- --- suplib/src/GzipWr.m3.orig Tue Jun 1 21:09:44 2004 +++ suplib/src/GzipWr.m3 Wed Jun 2 08:59:02 2004 @@ -32,7 +32,7 @@ UNSAFE MODULE GzipWr; IMPORT GzipError, OSError, StreamWrClass, Thread, Ugzip, Wr, WrClass; -FROM Ctypes IMPORT unsigned_char_star; +FROM Ctypes IMPORT unsigned_char_star, int; REVEAL T = Public BRANDED OBJECT @@ -102,12 +102,15 @@ PROCEDURE Deflate(strmp: Ugzip.z_stream_ (* Call "Ugzip.deflate", making sure that pointers into the (traced) input and output buffers are on the stack or in registers. This ensures that the collector will not move the buffers. *) + VAR + rc: int; BEGIN strmp.next_in := next_in; strmp.avail_in := avail_in; strmp.next_out := next_out; strmp.avail_out := avail_out; - RETURN Ugzip.deflate(strmp, flush); + rc := Ugzip.deflate(strmp, flush); + RETURN rc; END Deflate; PROCEDURE Flush(self: T) --- suplib/src/GzipRd.m3.orig Tue Mar 4 19:26:22 2003 +++ suplib/src/GzipRd.m3 Wed Jun 2 08:59:22 2004 @@ -32,7 +32,7 @@ UNSAFE MODULE GzipRd; IMPORT GzipError, OSError, Rd, RdClass, StreamRdClass, Thread, Ugzip; -FROM Ctypes IMPORT unsigned_char_star; +FROM Ctypes IMPORT unsigned_char_star, int; REVEAL T = Public BRANDED OBJECT @@ -83,12 +83,15 @@ PROCEDURE Inflate(strmp: Ugzip.z_stream_ (* Call "Ugzip.inflate", making sure that pointers into the (traced) input and output buffers are on the stack or in registers. This ensures that the collector will not move the buffers. *) + VAR + rc: int; BEGIN strmp.next_in := next_in; strmp.avail_in := avail_in; strmp.next_out := next_out; strmp.avail_out := avail_out; - RETURN Ugzip.inflate(strmp, flush); + rc := Ugzip.inflate(strmp, flush); + RETURN rc; END Inflate; PROCEDURE Init(self: T; --- cut --- -- Bjoern A. Zeeb bzeeb at Zabbadoz dot NeT