Re: [hatari-devel] SCSI Driver improvements patch |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] SCSI Driver improvements patch
- From: Uwe Seimet <Uwe.Seimet@xxxxxxxxx>
- Date: Mon, 10 Feb 2025 21:54:00 +0100
- Arc-authentication-results: i=1; strato.com; arc=none; dkim=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1739220845; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:References:Message-ID:Subject:To:From:Date:Cc:Date:From: Subject:Sender; bh=SGgjg2LKbupgQb3tcuiscFylCNukiZxBPbYHCm+eltI=; b=gSe4l19WxleYV0+tDhmYpk3Ugm9krrecJV/pEz4kwvts3x6NcIdwkGf2ONWskmuXbO c1DkulI/IeMb0jO8t0xgFh4htpjQpos1vWfOGC/ggzebTIUapZl+P/C9zlQU7QuZInnI VCwPlDdsmcH4dBICzfedkx9DvSudGaQbRUCtwK2Q+gNFsovLJyIh98VVSIudOyfNussV sVee1xSfXcKP7KsxhI2K7u+jzXH1mbEp+/uDC2b3egQ2dhP5fsYdM4FNL6/81ReCIKGQ MFxDKX0dERR4aNZlbPBhOTP7ZmTTK742fowSPNsRDF++ib7ctYIgHTLB1AyJfd0wlZ5h Gg4A==
- Arc-seal: i=1; a=rsa-sha256; t=1739220845; cv=none; d=strato.com; s=strato-dkim-0002; b=nz9L5+TUlsjSgAYYY1mKYAxkOhCjoClf67eXOMWCadYtNPPWja+rFc8NB7CjkYRQYD XNikRvd2tCnDtizYjHv7TWoXCo/BQunIyds9djAopJBlruhaVzSSCa9crawAHkG6432U NE5bToVRZ4fq187jsw3UvJCP0GWzFp1LcceELqN2yJwRd+jhJ6xJEEg6nU8Q8BC0awsf 3VQT2YKB8gU8zu3jUcHS8uRkSwGg1Jjq1S0GCjaIg5MReB2p7zTQeRFTNQi6pO+nsF5+ vOt/S4adGwuPYv2IlwiNsYveynXagcoqdPmERoLPTfDjABHdRnfR3lc7V1yWQO/p44AY MmLA==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1739220845; s=strato-dkim-0002; d=seimet.de; h=In-Reply-To:References:Message-ID:Subject:To:From:Date:Cc:Date:From: Subject:Sender; bh=SGgjg2LKbupgQb3tcuiscFylCNukiZxBPbYHCm+eltI=; b=smpS3nGLDMeTXvYX/NrhK+BoIfHzPeYwNpxI32IeFKbvmzb3wuRMSOXoPeiP24vrIp ff5iVSMSDAob2AI4Kjfn2PIte+MUgu1Tvlcn6fgZilwTcKRbWN5atWTpDo6sr7xiV2zw g3oa1q3MAtGYtoPc8hsCY1jkxcP8tqtSxlPF8IlbRQitRKGcDITWwU2yHW8jGZM+DDLd dcP+IBOrpQduE+LDHWN99/2qMSydt62S15PjBIqLSv0rmMBDWlwPFAQZNmDUG5XSrXYo kIVpiTSK0YlObTOvYtywYH/IFR5fm95HAZ3n/i5dnTWJHO9MfjjEzpD7zG/BoN5k9Wfy CHGw==
- Dkim-signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1739220845; s=strato-dkim-0003; d=seimet.de; h=In-Reply-To:References:Message-ID:Subject:To:From:Date:Cc:Date:From: Subject:Sender; bh=SGgjg2LKbupgQb3tcuiscFylCNukiZxBPbYHCm+eltI=; b=UMkU8Q1G/DldPY1TwXv5uVn8zj+Om8DqoblZivHBW1DKD1HZVlTOLEB6WsoYJzxX0g QqNE7CkCzfJ2YzBLtqAw==
I will definitely provide feedback, but this will take some time.
> Hi,
>
> On 7.2.2025 21.16, Thomas Huth wrote:
> > Am Mon, 3 Feb 2025 19:21:38 +0100
> > schrieb Uwe Seimet <Uwe.Seimet@xxxxxxxxx>:
> >> any chance to get feedback on my question? Maybe what I am asking for is not
> >> possible or does not make sense. But my guess is that what I am supposed to
> >> change in the SCSI Driver code will result in code sequences that also exist
> >> elsewhere, or that other NatFeats code might also need.
> >> When I say "optionally" I do not mean something you configure with cmake,
> >> but something like a boolean parameter in the methods to be called.
> >
> > For proper checking, you also need to know the size of the area that might
> > get accessed after getting the pointer. I guess there is no "one size fits
> > all" function that can be used everywhere, but we could at least add an
> > additional wrapper function that looks like this:
> >
> > /**
> > * Check if an area is valid and return a direct pointer to it in the
> > * host memory (or NULL if it was invalid).
> > */
> > void *STMemory_CheckedAreaPtr(uint32_t addr, int size, int mem_type)
> > {
> > if (!STMemory_CheckAreaType(addr, size, mem_type ))
> > return NULL;
> >
> > return STMemory_STAddrToPointer(addr);
> > }
> >
> > WDYT?
>
> Sounds fine to me!
>
>
> - Eero
>
> >>>> * read_stack_pointer(): calls STMemory_STAddrToPointer(), but does not
> >>>> check that the addresses are valid, as it should:
> >>>
> >>> Wouldn't it be better if Hatari was checking this in
> >>> STMemory_STAddrToPointer(), at least optionally? The existing conversions
> >>> between native and Atari address space already make the code in nf_scsidrv.c
> >>> (and likely elsewhere) hard to read. I don't doubt that these checks are
> >>> useful, but I wonder whether there are better solutions than explicit checks
> >>> everywhere.
> >>>
> >>> Best regards
> >>>
> >>> Uwe
>
>