X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Recipient: dj AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=uE53oEs6AvfpxjHBOMtBowbU8YQ1zm8Hse3TyAXap0E=; b=RLP8bBww8p4d EoYATEPEB3CSR57pBleLP31N/bmGT1gj0oyyLCr+lYhfRL1qOMqNMbjDg/EvyAF2s3TaQ0rxFy5tT 9NlB/v00ZoBJMnkLQBHgs7Jz5c1MoaHOZ4PFDfR0hh3qp3HVCOKwB7n9iXORcc82Sjr3A4qRoda85 KA8BWtYEXWnKH5zg4mdgeTXTk6zhG+Lmr8obIG3QaqG6balTOVjtWHZ6ar3X79CBMuaRutDK0T4+f aBrLfE2IlMjzjDZ13qoDdKBtXM7p6Av5uw92IH8vMrqBTGjBCXHKF+qeIMsjb4tr4WwE/CLeZsZsW JaeBpM9Ec/0oqhMILbzMjA==; Date: Sun, 14 Apr 2024 16:26:27 +0300 Message-Id: <86jzl0m5x8.fsf@gnu.org> From: "Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com]" To: Pali Cc: dj AT delorie DOT com, sezeroz AT gmail DOT com, djgpp AT delorie DOT com In-Reply-To: <20240414121034.h34pjed3s3udathh@pali> (message from Pali on Sun, 14 Apr 2024 14:10:34 +0200) Subject: Re: Error handling in __djgpp_set_page_attributes() References: <20240413122345 DOT sq2ua43ugmshrlhv AT pali> <86v84lntr7 DOT fsf AT gnu DOT org> <20240413225744 DOT sxdwqpaipq5acj3n AT pali> <86h6g4o638 DOT fsf AT gnu DOT org> <20240414082932 DOT pm4hht4c5agcysou AT pali> <861q78nuk3 DOT fsf AT gnu DOT org> <20240414100331 DOT yv4eqcr2ruhfbslk AT pali> <86sezome63 DOT fsf AT gnu DOT org> <20240414104251 DOT bjvvmf2qzvhus3ug AT pali> <86r0f8makl DOT fsf AT gnu DOT org> <20240414121034 DOT h34pjed3s3udathh AT pali> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Sun, 14 Apr 2024 14:10:34 +0200 > From: Pali > Cc: dj AT delorie DOT com, sezeroz AT gmail DOT com, djgpp AT delorie DOT com > > On Sunday 14 April 2024 14:46:02 Eli Zaretskii wrote: > > > Date: Sun, 14 Apr 2024 12:42:51 +0200 > > > From: Pali > > > Cc: dj AT delorie DOT com, sezeroz AT gmail DOT com, djgpp AT delorie DOT com > > > > > > What I think is important: include information that out_addr/num_bytes > > > address range must belong to sbrk allocator. This is something hard to > > > figure out without reading the source code of the function. > > > > What other allocator there can be in DJGPP? I thought all allocations > > go through sbrk, isn't that so? > > __djgpp_set_page_attributes function takes our_addr argument and it was > not clear for me what it is. Current documentation refers to the DPMI > 0507H function, which takes memory handle and offset in it, which > describes linear memory. __djgpp_set_page_attributes on the other hand > expects for that out_addr is the offset in the DS segment and is doing > translation to memory handle + offset by looking into sbrk allocator > (via _djgpp_memory_handle). So I think it's important to say that the OUT_ADDR is the offset from the DS segment base, and use 'sbrk' and 'malloc' as examples of functions that return such addresses, in contrast to __dpmi_allocate_linear_memory and similar APIs. IOW, say that offsets from DS are the requirement, and use 'sbrk' etc. as examples of satisfying the requirement. The fact that __djgpp_set_page_attributes translates to linear addresses is also worth mentioning. > Important is that it is from allocator (not from any other source). AFAIU, this is not a requirement. For example, if I know that offset 0x1000 from DS belongs to the program's address space (as it usually is), I can use that as OUT_ADDR. Right?