From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.redhat.com (Postfix) with ESMTP id 0EEB13EAAC for ; Sun, 5 Jan 2003 13:10:06 -0500 (EST) Received: (from mail@localhost) by int-mx1.corp.redhat.com (8.11.6/8.11.6) id h05IA5S06437 for axp-list@listman.redhat.com; Sun, 5 Jan 2003 13:10:05 -0500 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id h05IA5a06430 for ; Sun, 5 Jan 2003 13:10:05 -0500 Received: from evrtwa1-ar5-4-65-005-235.evrtwa1.dsl-verizon.net (evrtwa1-ar5-4-65-005-235.evrtwa1.dsl-verizon.net [4.65.5.235]) by mx1.redhat.com (8.11.6/8.11.6) with SMTP id h05HgaB06988 for ; Sun, 5 Jan 2003 12:42:36 -0500 Received: (from rob@localhost) by evrtwa1-ar5-4-65-005-235.evrtwa1.dsl-verizon.net (8.11.6/8.11.6) id h05I9wo17039 for axp-list@redhat.com; Sun, 5 Jan 2003 10:09:58 -0800 Date: Sun, 5 Jan 2003 10:09:58 -0800 From: "Robert M. Riches Jr." Message-Id: <200301051809.h05I9wo17039@evrtwa1-ar5-4-65-005-235.evrtwa1.dsl-verizon.net> To: axp-list@redhat.com Subject: Re: Porting siocons to Alpha X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: > From: Richard Billingham > Date: Sun, 5 Jan 2003 17:53:58 +0000 (GMT) > > I've got a program called siocons > (http://www.identicalsoftware.com/yaroze/siocons.tgz) > that's used to transfer data via the serial port to a programmable playstation. > The program functions correctly under Linux/Intel, but hangs when I try to use it on my Alpha > box. I'm assuming this means that programming differences on the two > platforms are preventing it from working correctly. My programming skills > are limited, but I found a page stating that some programs assume a long > is 32 bits. With this in mind, I replaced all instances of long with > u_int32_t, but to no avail! > > Can you offer any pointers which could help me get this program working? Actually, much if not most of the problem with many of these programs is abuse of pointers. Some poor programmers seem to think a pointer can be stuffed into an 'int', not realizing the potential for size and other issues. With some of these problematic programs, the -taso compiler switch helps a great deal. This switch is not always documented in man pages. IIRC, usage messages are more reliable about this switch than the man pages. It is sometimes necessary to prefix the -taso switch to the linker by wrapping it in another switch. I don't remember off the top of my head the exact syntax. Another thing that helps is the personality() call. If you call it early the program, later calls to malloc() and friends will keep pointer values within the lower 2GB of address space, which works around the problem of the program stuffing a pointer into an int, at least if you're lucky. IIRC, the argument to pass is PER_LINUX_32BIT. There are other values if the program was written with other problematic assumptions. Be careful with signed vs. unsigned. Changing an unqualified 'long' to 'u_int32_t' could cause issues, because if I understand correctly the former is signed while the latter is unsigned. (Please disregard if this is not wrong.) There is hope, given a fair amount of luck. The -taso switch and the personality(PER_LINUX_32BIT) call were sufficient (along with fixing a buggy configuration script) to make Squeak work on Alpha. Squeak is a Smalltalk implementation that is extremely stuck on the notion that the whole world is 32 bits wide. Every object reference slash pointer in the whole system is crammed into 32 bits. Good luck. Robert Riches rm.riches@verizon.net