From nobody Thu Jan 19 15:11:23 2023 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NyR1733Xnz2t8hg for ; Thu, 19 Jan 2023 15:11:39 +0000 (UTC) (envelope-from pprocacci@gmail.com) Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NyR170w3Wz3hnk for ; Thu, 19 Jan 2023 15:11:39 +0000 (UTC) (envelope-from pprocacci@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ot1-x335.google.com with SMTP id a1-20020a056830008100b006864df3b1f8so1372261oto.3 for ; Thu, 19 Jan 2023 07:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=U9xnlwcVowiYPoLWFGS8sv/9ISVQA/vxP/zILdpt2lQ=; b=efbRK4Q2B5bo5QM5KB2Um3pmjKDjlrL5OI2IIFIX5ATDPyOxoIaC9R1/yX2zNNBpZJ yOGuxmdWLbN0CF2wQ9CRcR2oRvAGJZy4boa5KUhg1UZJuI8woTiSoPAszuJoshJ5W2n4 yeomi0irpaPLweRciU3gNURhqCpDIfGSU2oH17no44hFFZ/+kNqERHN+kdQ7fNpaT5FO V8IWYgBlvgCkYhkFU3iACCYArJvGCwmEX9tw313bGf+L2+pdkTtlCtX5sU0FPD/dq994 WKHYmPNPoiUaIZ4auNyuXy3nnIrELaRM2uYvfhj0wKD3wcR+YCi+jLA0amQIeDk1gdth pOew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=U9xnlwcVowiYPoLWFGS8sv/9ISVQA/vxP/zILdpt2lQ=; b=b7/7EAU6E768Plm5cj9canyZ8AM6gNoZCfDX/dSrW6qHPDWV7ZU3+DsKuoqGNz7gXH TcrhWplcYZLXZewN23cX/pdIxV0Ast6/Rh//4Lom03+8dXJLahxFQE9xKOtP26LsTvaX GF9LSDuQTksVsK4Rz81PeRZf+WGUGNJXcV2JZhlr58RHvw1AF6MdwmC2OpkkZk7XA7oH 96Q7QVl2Jo7V508MQ8L2CG/K1niSk98CmrCKCdicVi0nFozX2bgOaZr0OlpeKsEODWVe w2yad+4eIgRuYrRgondaNcv04IxVUAPyRx6y5lWblMF5WgMu2jSvuNV4xUoz3JRu+7QU T9ew== X-Gm-Message-State: AFqh2kpryXYXqc5l6W6mmyHEFv9mSPhXgbEwTP1axYlzIczHExLJe30P 6nmUoSnTWAfwMF5dCn5y5vYt6MhHQKIrAj+ekw== X-Google-Smtp-Source: AMrXdXu+becqcGFTqTy4TpTkFaHABDWGHur15kd1TgJrNWyJkHt82PYhtPickuYEkrMCtgkGTrUWDrz+fCDMhl4jMNc= X-Received: by 2002:a05:6830:1211:b0:684:9eae:c451 with SMTP id r17-20020a056830121100b006849eaec451mr654093otp.267.1674141096662; Thu, 19 Jan 2023 07:11:36 -0800 (PST) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Paul Procacci Date: Thu, 19 Jan 2023 10:11:23 -0500 Message-ID: Subject: Re: FreeBSD AMD64 kernel calling convention To: Daniel Cervus Cc: "freebsd-questions@freebsd.org" Content-Type: multipart/alternative; boundary="0000000000005ee3c305f29f5943" X-Rspamd-Queue-Id: 4NyR170w3Wz3hnk X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --0000000000005ee3c305f29f5943 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It's the same as Linux. rdi, rsi, rdx, r10, r8, r9 in that order. rcx and r11 destroy'd immediately upon syscall invocation. Thanks, Paul Procacci On Wed, Jan 18, 2023 at 11:08 PM Daniel Cervus wrote: > Hi, everyone. I=E2=80=99m learning AMD64 assembly language. But seems I= cannot > find much information about FreeBSD kernel interface, does it follows the > same calling convention as described in System V AMD64 ABI? Or it is like > Linux kernel calling convention, uses R10 instead of RCX to pass paramete= rs? > > > > Daniel > --=20 __________________ :(){ :|:& };: --0000000000005ee3c305f29f5943 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It's the same as Linux.

rdi, rs= i, rdx, r10, r8, r9=C2=A0 in that order.=C2=A0 rcx and r11 destroy'd im= mediately upon syscall invocation.

Thanks,
Paul Procacci

On Wed, Jan 18, 2023 at 11:08 PM Daniel Cervu= s <DanieltheDeer@outlook.co= m> wrote:

=C2=A0 Hi, everyone. I=E2=80=99m learning AMD64 assem= bly language. But seems I cannot find much information about FreeBSD kernel= interface, does it follows the same calling convention as described in System V AMD64 ABI? Or it is like Linux kernel calling con= vention, uses R10 instead of RCX to pass parameters?

=C2=A0

Daniel=



--
__________________

:(){ :|:& };:
--0000000000005ee3c305f29f5943--