From patchwork Fri Jul 2 14:55:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 57668 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 52C3EB6F16 for ; Sat, 3 Jul 2010 00:55:30 +1000 (EST) Received: (qmail 19581 invoked by alias); 2 Jul 2010 14:55:28 -0000 Received: (qmail 19556 invoked by uid 22791); 2 Jul 2010 14:55:26 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_CC, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Jul 2010 14:55:21 +0000 Received: from kpbe16.cbf.corp.google.com (kpbe16.cbf.corp.google.com [172.25.105.80]) by smtp-out.google.com with ESMTP id o62EtJri029859 for ; Fri, 2 Jul 2010 07:55:19 -0700 Received: from pwj5 (pwj5.prod.google.com [10.241.219.69]) by kpbe16.cbf.corp.google.com with ESMTP id o62EtIB9016660 for ; Fri, 2 Jul 2010 07:55:18 -0700 Received: by pwj5 with SMTP id 5so1306933pwj.8 for ; Fri, 02 Jul 2010 07:55:18 -0700 (PDT) Received: by 10.142.179.19 with SMTP id b19mr1224911wff.161.1278082517741; Fri, 02 Jul 2010 07:55:17 -0700 (PDT) Received: from coign.google.com ([67.218.107.123]) by mx.google.com with ESMTPS id r27sm830671rvq.9.2010.07.02.07.55.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 02 Jul 2010 07:55:16 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org Subject: [gccgo] Fix Syscall types Date: Fri, 02 Jul 2010 07:55:07 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch from Christopher Wedgwood fixes the types used by the Syscall function. I messed it up such that it always used 32-bit types on 64-bit systems. Committed to gccgo branch. Ian diff -r 4421ae82aa69 libgo/syscalls/syscall.go --- a/libgo/syscalls/syscall.go Fri Jul 02 07:42:23 2010 -0700 +++ b/libgo/syscalls/syscall.go Fri Jul 02 07:52:08 2010 -0700 @@ -18,13 +18,12 @@ func libc_syscall32(trap int32, a1, a2, a3, a4, a5, a6 int32) int32 __asm__ ("syscall"); func libc_syscall64(trap int64, a1, a2, a3, a4, a5, a6 int64) int64 __asm__ ("syscall"); -// Do a system call. We look at the size of int to see how to pass +// Do a system call. We look at the size of uintptr to see how to pass // the arguments, so that we don't pass a 64-bit value when the function // expects a 32-bit one. func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) { var r uintptr; - var i int; - if unsafe.Sizeof(i) == 4 { + if unsafe.Sizeof(r) == 4 { r1 := libc_syscall32(int32(trap), int32(a1), int32(a2), int32(a3), 0, 0, 0); r = uintptr(r1); } else { @@ -36,8 +35,7 @@ func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) { var r uintptr; - var i int; - if unsafe.Sizeof(i) == 4 { + if unsafe.Sizeof(r) == 4 { r1 := libc_syscall32(int32(trap), int32(a1), int32(a2), int32(a3), int32(a4), int32(a5), int32(a6)); r = uintptr(r1);