Deutsch   English   Français   Italiano  
<veeefe$91cc$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!news.in-chemnitz.de!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Brett <ggtgp@yahoo.com>
Newsgroups: comp.arch
Subject: Re: 80286 protected mode
Date: Sat, 12 Oct 2024 18:17:18 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <veeefe$91cc$1@dont-email.me>
References: <2024Oct6.150415@mips.complang.tuwien.ac.at>
 <memo.20241006163428.19028W@jgd.cix.co.uk>
 <2024Oct7.093314@mips.complang.tuwien.ac.at>
 <7c8e5c75ce0f1e7c95ec3ae4bdbc9249@www.novabbs.org>
 <2024Oct8.092821@mips.complang.tuwien.ac.at>
 <ve5ek3$2jamt$1@dont-email.me>
 <ve6gv4$2o2cj$1@dont-email.me>
 <ve6olo$2pag3$2@dont-email.me>
 <73e776d6becb377b484c5dcc72b526dc@www.novabbs.org>
 <ve7sco$31tgt$1@dont-email.me>
 <2b31e1343b1f3fadd55ad6b87d879b78@www.novabbs.org>
 <ve99fg$38kta$1@dont-email.me>
 <35cb536e6310a38f0269788881cffdaf@www.novabbs.org>
 <veb4j5$3kjt3$2@dont-email.me>
 <ab65eba51e4d4adc988e54df4a5fc7eb@www.novabbs.org>
 <ved03t$1uut$1@dont-email.me>
 <veec3b$8kmg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 12 Oct 2024 20:17:18 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="265aa6bfdb09b7ae1d89905248f436e5";
	logging-data="296332"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/sVJuZYq+8j2BA8pUo9gd+"
User-Agent: NewsTap/5.5 (iPad)
Cancel-Lock: sha1:cbQ7TvXuhKM1qdPrnVodzKgF/Xc=
	sha1:zPBcbeG3dn/Tmg4bzWFuEhlZGeg=
Bytes: 3243

Brian G. Lucas <bagel99@gmail.com> wrote:
> On 10/12/24 12:06 AM, Brett wrote:
>> MitchAlsup1 <mitchalsup@aol.com> wrote:
>>> On Fri, 11 Oct 2024 12:10:13 +0000, David Brown wrote:
>>> 
>>>> 
>>>> Do you think you can just write this :
>>>> 
>>>> void * memmove(void * s1, const void  * s2, size_t n)
>>>> {
>>>> return memmove(s1, s2, n);
>>>> }
>>>> 
>>>> in your library's source?
>>> 
>>> .global memmove
>>> memmove:
>>> MM     R2,R1,R3
>>> RET
>>> 
>>> sure !
>>> 
>> 
>> Can R3 be a const, that causes issues for restartability, but branch
>> prediction is easier and the code is shorter.
>> 
> Yes.
> #include <string.h>
> 
> void memmoverr(char to[], char fm[], size_t cnt)
> {
>     memmove(to, fm, cnt);
> }
> 
> void memmoverd(char to[], char fm[])
> {
>     memmove(to, fm, 0x100000000);
> }
> Yields:
> memmoverr:                              ; @memmoverr
> 	mm	r1,r2,r3
> 	ret
> memmoverd:                              ; @memmoverd
> 	mm	r1,r2,#4294967296
> 	ret

Excellent!

>> Though I guess forwarding a const is probably a thing today to improve
>> branch prediction, which is normally HORRIBLE for short branch counts.

What is the default virtual loop count if the register count is not
available?

Worst case the source and dest are in cache, and the count is 150 cycles
away in memory. So hundreds of chars could be copied until the value is
loaded and that count value could be say 5. Lots of work and time
discarded, so you play the odds, perhaps to the low side and over prefetch
to cover being wrong.