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=i9xc/LhcGRJXpdK4ftXE+f4IWa8ymdtHu0slczRKb/Y=; b=Kfa6xlY9mwhn OvRPz8t/7YLnH4OH5y0edNbNQQc9kqvMSba634U3wyg7Nsw0jFiPd7mBpaEgptRQmcGrXs7v227GZ Beq8FTH4oBM2adKghd6rJ7ZHQoN6Xo60eWTvd+ll5rph2pLM6jKnYMBJPzkDCvtFmUFVVJrrzGERn e5HKqh/CC1lI0z9jqKfhNZW7YOe8saVpYs9IeK1B9Cu/ihiM09S/Psd/dsoFbOyVZyzfbbw3YvW/u CBno8JOTkeZyuFFi31IO55nCbwHGl3H/tOar7i5+PnO807CR0r+XTtcBN2Zb/az4TNZiSNaPJey84 rF5zeoX5KtKQl8eh806pXQ==; Date: Thu, 21 Mar 2024 09:22:17 +0200 Message-Id: <86o7b82gnq.fsf@gnu.org> From: "Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com]" To: Pali , Charles Sandmann Cc: dj AT delorie DOT com, sezeroz AT gmail DOT com, djgpp AT delorie DOT com In-Reply-To: <20240320231522.fowijjlk2h6ilw6x@pali> (message from Pali on Thu, 21 Mar 2024 00:15:22 +0100) Subject: Re: Error handling of ECX in __dpmi_set_page_attributes() References: <20240320231522 DOT fowijjlk2h6ilw6x 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: Thu, 21 Mar 2024 00:15:22 +0100 > From: Pali > Cc: djgpp AT delorie DOT com > > In function __dpmi_set_page_attributes implemented in d0507.S assembly > file is missing propagation of ECX register on error. > > DPMI 1.0 spec says that if function 0507H is unsuccessful then it sets > ECX to number of pages that have been set. It is not clear from the spec whether ECX is _always_ set, regardless of the error code returned in AX. Some error codes don't sound like they could happen after successfully setting attributes of several pages. Do we have any information about what the various DPMI 1.0 hosts actually do in this case? Should we at least check in the function's code that the value in ECX is non-negative and smaller than the value of ECX set by the caller? I also question the wisdom of writing into the input structure provided by the caller -- the caller might not expect that. What other DPMI functions do something like that? > But DJGPP's wrapper for DPMI 0507H in __dpmi_set_page_attributes > propagates ECX register value to caller only if DPMI function success. > Value stay unmodified if function fails. Maybe I'm missing something, but I don't see where the DPMI macro propagates ECX back to the caller when the DPMI call succeeds. What I see is that the value of info->count stays unmodified regardless of whether the call succeeds or fails. What did I miss? > Could you look at this problem? > > I have there a simple fix for it. The following change propagates ECX > register back to the caller not only on success, but also on failure. Any real-life situation where you need this enhancement? (I added Charles to the addressees in the hope that he could find a moment to look at this and comment.)