On Mon, 12 Apr 2004, Arkady V.Belousov wrote:
> [EMAIL PROTECTED]:
>
> > in kernel.asm. Use std for the memory move: helps if there's overlap
> > (PCs with a very low amount of RAM).
> > +++ inithma.c 10 Apr 2004 14:18:24 -0000 1.24
> > - else
> > - {
> > - /* might overlap */
> > - for (i = len, s = HMASource, d = HMADest; i != 0; i--)
> > - d[i] = s[i];
> > + fmemcpy(HMADest, HMASource, len);
> > + /* else it's the very first relocation: handled by kernel.asm */
>
> _Standard_ memcpy() _doesn't_ handles memory overlapping. This does
> _only_ memmove().
our fmemcpy uses cld. It's fine for our use here now. There's either no
overlap or it moves down.
> This is _not_ 8086 code (unless NASM begins to be smart enough, as
> TASM, to replace this by four SHR CX,1). I think, this code may look so:
>
> %ifdef WATCOM
> mov si,dx
> mov cl,4
> shr si,cl
> add ax,si
ok thanks.
> > - xor di,di
> > - mov cx,1 + init_end wrt INIT_TEXT
> > + mov cx,-2 + init_end wrt INIT_TEXT
> > + mov si,cx
> > + mov di,cx
> > + shr cx,1
> > + inc cx
>
> Unlike original code, new code doesn't "rounds up" CX value (for
> example, 3 bytes into 2 words).
This is deliberate. Guess I should add a comment -- the involved variables
are aligned.
> Same as above: SI, DI and CX are not aligned.
they are aligned via segs.inc.
Bart
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel