220 38128 <CAFdMc-3V0VJ9nOs2fg4OuRr4N8TG-VXsrek1v=CJpr=Bqt98+Q@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "dgutson ." <danielgutson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: memcpy/memset/etc overloads for volatile memory
Date: Fri, 18 May 2018 17:53:14 -0300
Lines: 162
Approved: news@gmane.org
Message-ID: <CAFdMc-3V0VJ9nOs2fg4OuRr4N8TG-VXsrek1v=CJpr=Bqt98+Q@mail.gmail.com>
References: <CAFdMc-0NAvWrkwzpgEKq4DQj=0vL_0F2s17XyR9MSUNJk5R0sw@mail.gmail.com>
 <0e5ce74c-3e9e-4cf2-4afd-f7333ed82c5d@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="00000000000008e487056c8124da"
X-Trace: blaine.gmane.org 1526676669 31721 195.159.176.226 (18 May 2018 20:51:09 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 18 May 2018 20:51:09 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDE3NBMV6UFBBO727TLQKGQEJLUJZIQ@isocpp.org Fri May 18 22:51:05 2018
Return-path: <std-proposals+bncBDE3NBMV6UFBBO727TLQKGQEJLUJZIQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f200.google.com ([209.85.220.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDE3NBMV6UFBBO727TLQKGQEJLUJZIQ@isocpp.org>)
	id 1fJmLA-0008Aw-Tt
	for gclcip-std-proposals@m.gmane.org; Fri, 18 May 2018 22:51:05 +0200
Original-Received: by mail-qk0-f200.google.com with SMTP id c8-v6sf7960576qkb.21
        for <gclcip-std-proposals@m.gmane.org>; Fri, 18 May 2018 13:53:16 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1526676796; cv=pass;
        d=google.com; s=arc-20160816;
        b=QAtEGRyR5KIyH+Msj05ZwJn7CyGbuRPhVH8nxzfVnInJtG+o6d8IS6/pPxDg6nnL4i
         V50cEwytK4F/omV+Oppk8x5o9m+lz13EsIROvYIvQbA8fvYRonF+sxVSx7LfU3e1iDYQ
         +MXr350jk624PIigRugEj0OWqk5KuYiqmr2YpWTAz8g7K4tlaPodJM5/hzwX9ClkU/yy
         7n2Essa1xFI7y0uErDfB03CG7H+56/8rE1lQulbcAlbpGTlaemSlK1E3m4dIYtHnofZL
         Q4M0x04LARlEM1OEo8JQCjHflVE3xSFJ+3YGGLOWTRUa3YTbWRtFjW4Q4SMpaixfgwwD
         esiw==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=o5/lLqHi3tXDVfZ/Cr7dftajv7xTrds2E2Iwqr3+iU8=;
        b=IOIkjdSScVobGFFC8bn3Z45cuzBjPx5Lu4ZMGSUvVu08cT0dzes9kPLNCgUDKLvP+Z
         zAJT5oFD0iOfjyHoIzQvtiWyB4dj3VbnlitlR5DOwwhYwybBqS/pvIXbhzcmmGxD0ptD
         QhIJPxAQVq3Mp9LltAtzDc44/H885W6yCwCEx/j/hufMLNQf78mvpNmozfS4MVZsD5QS
         eMQq0goPwoK38knhRxDlqQY+pnp7PXwYtYrsJTSXEbFZnr9EpHTMTUHdhHohE5nc0eKy
         S5rd9bIzR2MRvbgYNrMkerLbblxkMFNksMSf2FDceKpcR0xP8xCoVpW4RQBEiHibMeUu
         YFxw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=LqAhcaHc;
       spf=pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=danielgutson@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=o5/lLqHi3tXDVfZ/Cr7dftajv7xTrds2E2Iwqr3+iU8=;
        b=KWAu7HpY2IuHGTgVWA0SzYtrAtH3+dEo6mw85jY6yhn4l/hehiAaQm+v1uNUIWjU4Z
         JS7PeWHe/pvrpihMqZbTl/RGV3U+h1oB4pwJQtmzEdkEErj//wUnl77sP6SyrZyckvl8
         XyyBgHRoWvR5EtrqutXzEhJZsKYGrr1KQ5YXHa6NuoS8aCTiK30ne6RNdIiSyeXVRJvF
         lDpMFIZnZuD1Nxf7xYmHgmoiUJEFXvE49RUSfVAI8QpIr6LupsFu16I9wTpgEWCoAC+J
         eLB2SuGm4gvWYUGUCXTk1Mob7DZeDYbO7NceA/FMLsV1GiSdq0kVoE8YAg0iMKGa86ma
         pPXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=o5/lLqHi3tXDVfZ/Cr7dftajv7xTrds2E2Iwqr3+iU8=;
        b=H3tw+1LqB16xKpDmbtlLNfNuNnmSH8Gci/SHWOo3s9WhfOHYI2ovNAN/tckP941zo2
         TNAKvuExhXvLGJb6Px+9iYvaE4gxs8PTJOEOG1Hxe4Ks51avF4xvf9PQ5eLoLdllp16n
         +zDMWbNuQbjMOAf5OZ+j0inAu4hkm/1ojwVdDIKGF9fgDEGDswJV5pYdgxDnGIseZNCX
         EbdGTNs+f7xKM0vM10NLZTlc0vTb0CRX++/Bj81PkPkyjj0Lk645vmGREslgWDQosV4H
         nKfriEeZ0Ho9sVoeVXJUEpsDaxFdG0vgwBEqq41bO4rg2FLjeRzYmmfqyFy9f3AOq2nQ
         FY4w==
X-Gm-Message-State: ALKqPweSQ+yoKI8kul2Qqz6EBsh2J42ZahzGvAArpLQhkSV19z0RulSf
	aNAizn0PCCX+gR3JmBQ4Dz9RDA==
X-Google-Smtp-Source: AB8JxZrpPvSKDV2G+ltusckncruhcOlJ95ukTS+1z1AAI5FprCBWi1SFoapZaFwfApuIJPDuQdE9AQ==
X-Received: by 2002:ac8:13c1:: with SMTP id i1-v6mr7276944qtj.15.1526676795942;
        Fri, 18 May 2018 13:53:15 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:ac8:72c3:: with SMTP id o3-v6ls4635982qtp.5.gmail; Fri, 18
 May 2018 13:53:15 -0700 (PDT)
X-Received: by 2002:aed:3cf0:: with SMTP id e45-v6mr11039915qtf.276.1526676795178;
        Fri, 18 May 2018 13:53:15 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1526676795; cv=none;
        d=google.com; s=arc-20160816;
        b=Y1c0gvT54Ap/o4s6zr52vjksnQJlgfXMQUp++KFyShvSdwyVTyIQFFh2ReK7BsnJtv
         OybqLyA2N9r07IyPea9kj/a2vfh6fjBuDHkFZVTUKYhXleje2gPHp/oi/5HPhLTHIEBN
         uQNo6lSdHgal4CKXNN1Fv/gWtHtaxc7khpR/wDyunqKlpeLIj90kUV3Sz7W3RZjveMyj
         Io5p0zs1dT7HmuPfR6Rasg3vVG3nHr4TmRh0GuCxw0l7WVqTLhz+jKlkcEOujmIzRj0E
         b//zQh89CTMMjR3whMmDC/nsKyVkSo45JU0Tb7gcm9jUaGJiNLW8LSlCApDq5l3/r9kq
         x6pQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=VPKm0kuIQ2VpZKtpjJAKYV70RiabqsZ/yQ1ebl1WPGo=;
        b=h4LLviBm+6HnwHmbJnQR90Y/ZxuknnTz+phNhmMb3522bLGTvjPcxEZ19Hnqs2p1zl
         inKUr9hPmDDEIBBCJq9Xx2XRY2qrE8VzwknSxZofDHWiI9fdTZog4NXMVnkiIyUOofnj
         Lulkk07W3lwHepmzPHyPLX4vh1IIvuwWRZhmQ3fawB6SIiRUOIDPXEna52aE6dqtwvqI
         zvBxAhDp8rq03rCjW6GRZaKHo4S6S+cjfljIbaEDZ7r/DbHZvoYd9IvbmGx1QcSwJl+q
         n3YFeKbOflyQz8puaJLqi9IhPCWGbAAVxXw0rftd3tcSZGRtT66acWT8pE1RIPn9Hn9B
         NksA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=LqAhcaHc;
       spf=pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=danielgutson@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id v124-v6sor6608529qka.1.2018.05.18.13.53.15
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 18 May 2018 13:53:15 -0700 (PDT)
Received-SPF: pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a37:a1cb:: with SMTP id k194-v6mr3997549qke.330.1526676794694;
 Fri, 18 May 2018 13:53:14 -0700 (PDT)
Original-Received: by 10.12.172.172 with HTTP; Fri, 18 May 2018 13:53:14 -0700 (PDT)
In-Reply-To: <0e5ce74c-3e9e-4cf2-4afd-f7333ed82c5d@gmail.com>
X-Original-Sender: danielgutson@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=LqAhcaHc;       spf=pass
 (google.com: domain of danielgutson@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=danielgutson@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:38128
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38128>

--00000000000008e487056c8124da
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, May 18, 2018 at 5:46 PM, Andrey Semashev <andrey.semashev@gmail.com=
>
wrote:

> On 05/18/18 23:41, dgutson . wrote:
>
>> This might be interesting.
>>
>> In some systems, the implementation of memcpy() & friends cannot be used
>> for memory-mapped devices.
>> Usually, mapped memory is marked as volatile.
>>
>> I'm proposing to add volatile pointers overloads for the memcpy()
>> function and friends, without specifying exactly what should be differen=
t
>> at the standard-level, but allowing implementations to provide a particu=
lar
>> behavior. I'm just proposing to add the declaration to the standard.
>>
>> Particularly, in some x86-based systems, reading things like the SPI
>> should be done on byte-per-byte basis (rather than streamed with any SIM=
D
>> instruction).
>>
>> I'm not sure what the wording should exactly say, but I'm just initiatin=
g
>> the discussion.
>>
>
> If it's not specified then the exact behavior wrt. memory accesses is not
> going to be portable, which means it's not going to be useful.


It is useful indeed: if I have a pointer to volatile memory, I cannot use
memcpy currently.
By adding the overload, I'm being guaranteed that I will be able to call
memcpy (and that the implementation shall DTRT, which is for example, the
byte per byte copying).
Besides the "DTRT" discussion, my point is: I want this overload to be
available. At least it should fall back to the non-volatile version.


>
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/is
> ocpp.org/d/msgid/std-proposals/0e5ce74c-3e9e-4cf2-4afd-
> f7333ed82c5d%40gmail.com.
>



--=20
Who=E2=80=99s got the sweetest disposition?
One guess, that=E2=80=99s who?
Who=E2=80=99d never, ever start an argument?
Who never shows a bit of temperament?
Who's never wrong but always right?
Who'd never dream of starting a fight?
Who get stuck with all the bad luck?

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAFdMc-3V0VJ9nOs2fg4OuRr4N8TG-VXsrek1v%3DCJpr%3D=
Bqt98%2BQ%40mail.gmail.com.

--00000000000008e487056c8124da
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Fri, May 18, 2018 at 5:46 PM, Andrey Semashev <span dir=3D"ltr">&lt;=
<a href=3D"mailto:andrey.semashev@gmail.com" target=3D"_blank">andrey.semas=
hev@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span=
 class=3D"">On 05/18/18 23:41, dgutson . wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
This might be interesting.<br>
<br>
In some systems, the implementation of memcpy() &amp; friends cannot be use=
d for memory-mapped devices.<br>
Usually, mapped memory is marked as volatile.<br>
<br>
I&#39;m proposing to add volatile pointers overloads for the memcpy() funct=
ion and friends, without specifying exactly what should be different at the=
 standard-level, but allowing implementations to provide a particular behav=
ior. I&#39;m just proposing to add the declaration to the standard.<br>
<br>
Particularly, in some x86-based systems, reading things like the SPI should=
 be done on byte-per-byte basis (rather than streamed with any SIMD instruc=
tion).<br>
<br>
I&#39;m not sure what the wording should exactly say, but I&#39;m just init=
iating the discussion.<br>
</blockquote>
<br></span>
If it&#39;s not specified then the exact behavior wrt. memory accesses is n=
ot going to be portable, which means it&#39;s not going to be useful.</bloc=
kquote><div><br></div><div>It is useful indeed: if I have a pointer to vola=
tile memory, I cannot use memcpy currently.</div><div>By adding the overloa=
d, I&#39;m being guaranteed that I will be able to call memcpy (and that th=
e implementation shall DTRT, which is for example, the byte per byte copyin=
g).</div><div>Besides the &quot;DTRT&quot; discussion, my point is: I want =
this overload to be available. At least it should fall back to the non-vola=
tile version.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span cl=
ass=3D"HOEnZb"><font color=3D"#888888"><br>
<br>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isoc<wbr>pp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0e5ce74c-3e9e-4cf2-4afd-f7333ed82c5d%=
40gmail.com" rel=3D"noreferrer" target=3D"_blank">https://groups.google.com=
/a/is<wbr>ocpp.org/d/msgid/std-proposals<wbr>/0e5ce74c-3e9e-4cf2-4afd-<wbr>=
f7333ed82c5d%40gmail.com</a>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b=
r><div class=3D"gmail_signature" data-smartmail=3D"gmail_signature">Who=E2=
=80=99s got the sweetest disposition?<br>One guess, that=E2=80=99s who?<br>=
Who=E2=80=99d never, ever start an argument?<br>Who never shows a bit of te=
mperament?<br>Who&#39;s never wrong but always right?<br>Who&#39;d never dr=
eam of starting a fight?<br>Who get stuck with all the bad luck? </div>
</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAFdMc-3V0VJ9nOs2fg4OuRr4N8TG-VXsrek1=
v%3DCJpr%3DBqt98%2BQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-3V0V=
J9nOs2fg4OuRr4N8TG-VXsrek1v%3DCJpr%3DBqt98%2BQ%40mail.gmail.com</a>.<br />

--00000000000008e487056c8124da--

.
