From nobody Fri Mar 25 11:41:18 2022 X-Original-To: freebsd-hackers@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 545531A306E6 for ; Fri, 25 Mar 2022 11:41:21 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KQ0Xx0Vn3z4fD0 for ; Fri, 25 Mar 2022 11:41:21 +0000 (UTC) (envelope-from theraven@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648208481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IeeUCHPgG59NKk6B5zxY/LvwebyC9I5iG/TNDxoPUb0=; b=VuPsYNFdqJF0KRBw2Eo5nFk3y4/OL4qu+fQMe69K7Tq7sc47euoKMPGQeL3+MSEbfI0Um+ ygTQVvoEaRCIm107BMMD3GOuIzfJrg+zuxzsZaQZuPPvwlLZWB62sNNUFl32inbZzItYR+ f5VbhtJn+rzd95QSmTYpt5NMJGLmh+E25DdPWvDq0jG3FBAc4TC7cDrgrpzy3ZbCuISfHt ds/5bLmmFcx/HShfWAZ9dcbYAQMWqBSfJyT1ikgSmJzjQUbsBXFJkJTvZBoGn0epwiYpL4 Tm2AubpKcM0Y5whzs9JG3hKZEEecMwY19YuyzIzcOFF8axanJNEh5a/KmGeB/Q== Received: from smtp.theravensnest.org (smtp.theravensnest.org [45.77.103.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: theraven) by smtp.freebsd.org (Postfix) with ESMTPSA id E3E4CCCD5 for ; Fri, 25 Mar 2022 11:41:20 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from [192.168.1.202] (host86-134-184-31.range86-134.btcentralplus.com [86.134.184.31]) by smtp.theravensnest.org (Postfix) with ESMTPSA id BB8582F6E4 for ; Fri, 25 Mar 2022 11:41:19 +0000 (GMT) Message-ID: Date: Fri, 25 Mar 2022 11:41:18 +0000 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-GB To: freebsd-hackers From: David Chisnall Subject: Getting the current thread's stack base / size on FreeBSD Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648208481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IeeUCHPgG59NKk6B5zxY/LvwebyC9I5iG/TNDxoPUb0=; b=WpuVSIXjKDIQj6XF7zkZoeLwNRXCey/wBGQY8NN8cj7wkETkKgROqzTDs5to5DKYhVJ8p5 KktUQI+PeRI8DTprzM8kJiWwaRSevxl9qf+6i6uEVFu/ZHE/siUBcre/nhpwdBZUhuihnS ElAKpNZGH3ZaBmjzCuw90hCLBV1byE0YsAIN1IKAzPh3AQ9IfCLzSnc98TLt4ndImcrItU l8TAsIwnJcovzl6yoT0IGbtHmnSQHN+NNQV0z3ErPjufSk6xzK4+AxmyBIGVoA/uT+Odx1 jsL6QWxp1FQqz3oqczD/pPD5z0sSO1O4jMkWDNcwUHvPFIjbmKI4z/YLf4UHwQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648208481; a=rsa-sha256; cv=none; b=YxV76RjL3oGyilXy1KqE4ZppRx1m03n4R0I/Kjhq1fnMwLVu3M4QZJIRNaWuG+GPaO88UC c9uRIYgKeSM3TfFWt6H+T4Bn4vl5sNEGsyXuqNaWrfRI3Rx6e4SkxkKIaw9gpzqhAF2+h/ XDGaZ4CV9rfgy/iBvuvzrt5ldmp0aPuZouz+mkV4UZ+5FAo34THW0G+HbW2lYfNnpLO1tn p/szQnbbPWPBCnMY5Gs8qUql7j5Ile3JDsakEYJ/4Iue7ECoqKiDaNCITxGREpTs9uzWDJ Aiz9Iu6iluUj2pycBnSjtQaWhNhnb2+84VH3BlNFz4gbbnJtxFqNVP5HgYX+ZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N Hi all, I'm trying to get the VAVM[1] WebAssembly runtime working on FreeBSD. In its platform-specific code, they need to find the base and size of the current stack. They have code for Linux and macOS, using different non-standard pthread extensions, but I couldn't see a mechanism for doing this on FreeBSD. Is there an API for this? Darwin provides a pair of _np APIs for getting these values. Glibc provides an API for getting the pthread attributes for the current thread, which is a bit more general and useful. Adding this to libthr would be a fairly simple change, if it doesn't exist already. Am I missing an existing mechanism? David [1] https://wavm.github.io/