From owner-freebsd-questions Fri Nov 8 1:10:24 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E1A237B404 for ; Fri, 8 Nov 2002 01:10:22 -0800 (PST) Received: from segfault.kiev.ua (segfault.kiev.ua [193.193.193.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 353E543E75 for ; Fri, 8 Nov 2002 01:10:20 -0800 (PST) (envelope-from netch@segfault.kiev.ua) Received: (from netch@localhost) by segfault.kiev.ua (8) id LDX04538; Fri, 8 Nov 2002 11:10:09 +0200 (EET) (envelope-from netch) Date: Fri, 8 Nov 2002 11:10:09 +0200 From: Valentin Nechayev To: Anton Shcherbinin Cc: freebsd-questions@freebsd.org Subject: Re: [freebsd] System calls: int $0x80 vs. lcall $7, $0 Message-ID: <20021108091009.GI54767@netch.kiev.ua> Reply-To: netch@netch.kiev.ua References: <12523076531.20021028155722@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <12523076531.20021028155722@fastmail.fm> X-42: On Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mon, Oct 28, 2002 at 15:57:22, useperl wrote about "[freebsd] System calls: int $0x80 vs. lcall $7, $0": Извините, здесь лучше по-русски. > Gentlemen, I am new to FreeBSD programming and going to write a simple > program which will not use libc. I tried to find out how to make a > system call of FreeBSD kernel. But 2 different sources of information, a > book on assembly programming and FreeBSD Developers' Handbook, say > contrary things, and I got completely confused. Работают оба метода - и int $0x80, и lcall $7, $0. > My assembly book says (trying to translate from Russian into English): Лучше не переводить.;) > ``Numbers of system calls (which are in /usr/include/sys/syscall.h file) > and way of getting to entry point (long call to 0007:00000000) are > standardized in SysV/386 ABI, but for example Linux uses another > convention -- interrupt 80H. [...] Как ни странно, lcall $7, $0 работает и в линуксе. > So what's the truth? int $0x80 or lcall $7,$0 ? Or are both possible? int $0x80 стал доступен на FreeBSD начиная с 3.0. В 2.* и 1.*, был только lcall. Часть источников может отставать. > If both, which is better? What is "SysV/386 ABI standard" and does > FreeBSD follow it? Он оговаривает метод вызова (тот же lcall), метод передачи параметров, метод передачи номера вызова. Есть разные уровни соответствия. Полное - требуется только для iBCS, иначе можно делать как угодно. Для собственных сред Linux и FreeBSD не требуется никакого соответствия;) > If it follows this standard, where could I get > this standard from? (I did try Google search, but found nothing > resembling a standard or official documents). Это не нужно. Достаточно посмотреть существующую реализацию. > Thanks a lot for any clues. If this maillist is not the most appropriate > place to ask questions like this, please direct me to the right place. /netch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message