Hi!

     I have the trouble. After some minor change I get error from MSVC
linker about fixup overflow. After some investigaion I found issue. Excerpt
from new dsk.cod:

______________O\_/_________________________________\_/O______________
_DATA   SEGMENT  WORD PUBLIC 'DATA'
_DATA   ENDS
CONST   SEGMENT  WORD PUBLIC 'CONST'
CONST   ENDS
DGROUP  GROUP   CONST, _BSS, _DATA
[...]
CONST      SEGMENT
$T1873  DW SEG _blk_dev
CONST      ENDS
[...]
;|***     if (rp->r_unit >= blk_dev.dh_name[0])
; ╫▓▌ 171
                                        $I1548:
        *** 000032      8e 06 00 00             mov     es,WORD PTR $T1873
        *** 000036      26 a0 0a 00             mov     al,BYTE PTR es:_blk_dev+10
[...]
        *** 000017      b8 00 00                mov     ax,SEG _blk_dev
        *** 00001a      8e c0                   mov     es,ax
_____________________________________________________________________
              O/~\                                 /~\O

In compare with previos .cod, here we see, that MSVC (by some internal
reason) instead using "mov ax,seg _blk_dev/mov es,ax" (as in last code)
generates word in CONST segment and tries _in some cases_ to access this
word (instead direct "mov ax,seg _blk_drv"), and this cause fixup overflow.
Now let review the map file:

______________O\_/_________________________________\_/O______________
 015A2H 01B39H 00598H _DATA                  DATA
 01B3AH 01BF9H 000C0H _DATAEND               DATA
 01BFAH 01CF9H 00100H CONST                  DATA
>--------------^^^^^--^^^^^------------------^^^^
[...]
 01EF0H 0CF0EH 0B01FH HMA_TEXT               CODE
 0CF0FH 0CF0FH 00000H HMA_TEXT_END           CODE
 0CF10H 0CF10H 00000H INIT_TEXT_START        CODE
 0CF10H 10B1CH 03C0DH INIT_TEXT              CODE
[...]
 126F0H 126F0H 00000H _STACK                 STACK
-126F0H 126F0H 00000H CONST                  CONST
+125E0H 125E1H 00002H CONST                  CONST
>--------------^^^^^--^^^^^------------------^^^^^
_____________________________________________________________________
              O/~\                                 /~\O

(Note: with "-" above shown line with previous map, with "+" above shown
line for map, when linker makes error about fixup error).

     As you may see, there is two different CONST segments: one is as
defined in segs.inc (CONST with class DATA) and one, which generated by
compiler (CONST with class CONST). Review of other compiler shows, that
their CONST segment have the class DATA, class CONST is specific for MSVC.

     Thus, me have latent bug in kernel, related to segmentation, which not
gets into account that under MSVC segments CONST have class CONST, not DATA.
I _suggest_, that this bug may be overcomed in segs.inc: "if COMPILER is
MSCL8, declare CONST with class CONST, else with class DATA". But I not know
the NASM very well to add into segs.inc such check by myself. Also, I fear,
that different class for segments may move out CONST from DGROUP group. Tom?
Bart? Anyone?




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to