From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 24 07:41:49 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C979716A4CE for ; Sun, 24 Apr 2005 07:41:49 +0000 (GMT) Received: from smtp01.aptg.net (smtp01.aptg.net [210.200.211.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7FF9E43D45 for ; Sun, 24 Apr 2005 07:41:48 +0000 (GMT) (envelope-from b8701143@tmu.edu.tw) Received: from localhost (localhost [127.0.0.1])C98035336DB for ; Sun, 24 Apr 2005 15:41:46 +0800 (CST) Received: from smtp01.aptg.net ([127.0.0.1]) by localhost (smtp01 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22124-06 for ; Sun, 24 Apr 2005 15:41:46 +0800 (CST) Received: from IBM6C6CDABCD41 (210-58-40-189.cm.dynamic.apol.com.tw [210.58.40.189])3A46B532C96 for ; Sun, 24 Apr 2005 15:41:46 +0800 (CST) Message-ID: <000f01c548a1$0eb33fd0$6702a8c0@IBM6C6CDABCD41> From: "HHCHANG" To: Date: Sun, 24 Apr 2005 15:41:41 +0800 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at aptg.net X-Mailman-Approved-At: Sun, 24 Apr 2005 12:04:34 +0000 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: about execute assembly exapmles under freebsd X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 07:41:49 -0000 Hi, I couldn't execute assembly example under freebsd . The environment and tools I used were (in IBM X31 box): 1. bash-2.05b# uname -a FreeBSD sexbear.localhost 5.3-STABLE FreeBSD 5.3-STABLE #3: Sun Feb 20 = 21:55:06 UTC 2005 = ?root@sexbear.localhost:/usr/obj/usr/src/sys/SEXBEAR??i386 2. bash-2.05b# as -v GNU assembler version 2.15 [FreeBSD] 2004-05-23 (i386-obrien-freebsd) = using BFD version 2.15 [FreeBSD] 2004-05-23 bash-2.05b# ld -v GNU ld version 2.15 [FreeBSD] 2004-05-23 3.(compile and execute the example) bash-2.05b# as -gstabs -o cpuid.o cpuid.s ld -o cpuid cpuid.o cpuid (no output after executing the program) gdb cpuid (gdb) run Starting program: /usr/local/src/code/chap04/cpuid Program exited with code 0340. (gdb) break *_start (gdb) run Program exited with code 0340. ###################example in book################################### #cpuid.s Sample program to extract the processor Vendor ID .section .data output: .ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n" .section .text .globl _start _start: movl $0, %eax cpuid movl $output, %edi movl %ebx, 28(%edi) movl %edx, 32(%edi) movl %ecx, 36(%edi) movl $4, %eax movl $1, %ebx movl $output, %ecx movl $42, %edx int $0x80 movl $1, %eax movl $0, %ebx int $0x80 ###################example in book################################### I viewed the tutorial: http://www.int80h.org/bsdasm/. but I couldn't find any syntax error in the program. Could someone give me a hint where I could find the more information? Thanks~ Regards,