From owner-freebsd-alpha Tue Jun 6 19:11:36 2000 Delivered-To: freebsd-alpha@freebsd.org Received: from po4.wam.umd.edu (po4.wam.umd.edu [128.8.10.166]) by hub.freebsd.org (Postfix) with ESMTP id 600BD37B9EE for ; Tue, 6 Jun 2000 19:11:33 -0700 (PDT) (envelope-from howardjp@wam.umd.edu) Received: from rac5.wam.umd.edu (root@rac5.wam.umd.edu [128.8.10.145]) by po4.wam.umd.edu (8.9.3/8.9.3) with ESMTP id WAA08390 for ; Tue, 6 Jun 2000 22:11:32 -0400 (EDT) Received: from rac5.wam.umd.edu (sendmail@localhost [127.0.0.1]) by rac5.wam.umd.edu (8.9.3/8.9.3) with SMTP id WAA27869 for ; Tue, 6 Jun 2000 22:11:31 -0400 (EDT) Received: from rac5.wam.umd.edu (howardjp@localhost) by rac5.wam.umd.edu (8.9.3/8.9.3) with ESMTP id WAA27864 for ; Tue, 6 Jun 2000 22:11:30 -0400 (EDT) Message-Id: <200006070211.WAA27864@rac5.wam.umd.edu> X-Authentication-Warning: rac5.wam.umd.edu: howardjp owned process doing -bs To: freebsd-alpha@freebsd.org Subject: Alpha Assembly Date: Tue, 06 Jun 2000 22:11:24 -0400 From: James Howard Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org After reading Konstantin Boldyshev introduction to assembly programming with NASM, I became curious and started playing. Eventually (and with the help of his document on Linux assembly), I got it assemblable under GCC. Needless to say, I felt that was cool. But now I am really curious, how would I write a simple "Hello, world!\n" under Alpha? This is partly academic since I do not have an Alpha (let alone a FreeBSD/Alpha) to test on. Donated processor cycles appreciated :) Reading through the Alpha libc code offered me some insight but not enough to make it understandable. As near as I can tell, the only code that actually does the system call is this from sys/alpha/SYS.h: #define CALLSYS_ERROR(name) \ CALLSYS_NOERROR(name); \ br gp, LLABEL(name,0); \ LLABEL(name,0): \ LDGP(gp); \ beq a3, LLABEL(name,1); \ jmp zero, .cerror; \ LLABEL(name,1): How does this relate to the similar(?) code of sys/i386/SYS.h: #define KERNCALL int $0x80 /* Faster */ Having done real-mode C and Assembly programming under DOS, it is obvious to me how the x86 code works. You simply push the arguments onto the stack and call interrupt 0x80. But the Alpha code here is killing me. Please forgive me if I am totally out to lunch here. Jamie To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message