Discussion:
questions about relocator16.S
(too old to reply)
Cao jin
2018-08-14 07:09:43 UTC
Permalink
Hi,

I am learning these code, and now have 2 questions:

1. at the bottom of relocator_common.S, there is:

LOCAL(jump_vector):
/* Jump location. Is filled by the code */
.long 0
.long CODE_SEGMENT

Since it is offset & segment selector value, why is not ".word
CODE_SEGMENT", is there any subtle difference?

2. in relocator16.S, after "RELOAD_GDT", the other segment registers are
updated two times with DATA_SEGMENT & PSEUDO_REAL_DSEG, they are pretty
close, there is no memory read/write between them, so why we need the
updates with DATA_SEGMENT?
--
Sincerely,
Cao jin
Vladimir 'phcoder' Serbinenko
2018-08-14 08:36:55 UTC
Permalink
Post by Cao jin
Hi,
/* Jump location. Is filled by the code */
.long 0
.long CODE_SEGMENT
Since it is offset & segment selector value, why is not ".word
CODE_SEGMENT", is there any subtle difference?
i386 is little endian, so effectively it just reserves 2 bytes more and
fills them with zeros.
Post by Cao jin
2. in relocator16.S, after "RELOAD_GDT", the other segment registers are
updated two times with DATA_SEGMENT & PSEUDO_REAL_DSEG, they are pretty
close, there is no memory read/write between them, so why we need the
updates with DATA_SEGMENT?
It's derived from older code that may have had accesses there. But it was
tested on many CPUs and changing it risks triggering obscure bug in an
obscure CPU
Post by Cao jin
--
Sincerely,
Cao jin
_______________________________________________
Grub-devel mailing list
https://lists.gnu.org/mailman/listinfo/grub-devel
Cao jin
2018-08-16 02:59:42 UTC
Permalink
Sorry I don't see reply in time because I am not on the TO or CC list.
Hi,
        /* Jump location. Is filled by the code */
        .long   0
        .long   CODE_SEGMENT
Since it is offset & segment selector value, why is not ".word
CODE_SEGMENT", is there any subtle difference?
i386 is little endian, so effectively it just reserves 2 bytes more and
fills them with zeros.
Yes, I think so.
2. in relocator16.S, after "RELOAD_GDT", the other segment registers are
updated two times with DATA_SEGMENT & PSEUDO_REAL_DSEG, they are pretty
close, there is no memory read/write between them, so why we need the
updates with DATA_SEGMENT?
It's derived from older code that may have had accesses there. But it
was tested on many CPUs and changing it risks triggering obscure bug in
an obscure CPU
I see.

Thanks very much for your explanation, Vladimir:)
--
Sincerely,
Cao jin
Continue reading on narkive:
Loading...