Changeset 43 for trunk/INCLUDE/ASM.INC


Ignore:
Timestamp:
Apr 11, 2014, 11:48:01 PM (11 years ago)
Author:
Ben Rietbroek
Message:

BSS Corruption Problem located (auxdebug on) [2012-02-21]

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can DESTROY THE MBR on ALL ATTACHED DISKS!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE THESE COMMITS!!

Problem

o Function with Xrefs goes out-of-bounds because hideparttable is too small

Has only 30 entries and should be 45.
Lost partition checker initializes out-of-bounds.

Info

o About the hideparttable

For each partition it can be specified which other partitions need to
be hidden when that partition is booted. This is useful for legacy DOS
but also braindead Windows that presents HPFS/JFS partitions as
unformatted and tries to persuade the user to format them.
With v1.07 the numer of partitions that can be handled was expanded from
30 to 45, but the size of the hideparttable was overseen.

o The need to compress the hideparttable

The old size was 30x30=900 bytes while the required size is 45x45=2045 bytes.
This amount of space is not available in the image.
Since 6 bits are enough to identify the partition number to be hidden,
the solution is to devide the table into bitfields. This will result
in a table of (45*45*6)/8=1519 bytes, which can be fitted.

Changes

Revamped the sources quite a bit and moved the history to a separate
file. (AIR-BOOT.HIS)

New

o FIXCODE script for Linux

Just until the C version is ready...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/INCLUDE/ASM.INC

    r30 r43  
    3535EndM
    3636
     37
     38;
     39; An ORG directive resets the location counter where code and data is
     40; generated. If the location counter is reset back to a point where
     41; code or data already has been generated, this will be overwritten
     42; without warning.
     43; This macro can be used with every ORG directive to check for this condition,
     44; and when it occurs further assembly is terminated.
     45
     46; NOTE:  Overlapchecking in JWasm is not as reliable as in Tasm.
     47;        Because it's a single pass assembler, the current location can be
     48;        incorrect. Tasm with multiple passes works correct.
     49; FIXME: Get JWasm and Tasm use some common ECHO/%OUT method.
     50;        (Tasm only pases first word of non-quoted string to a macro)
     51check_overlap   MACRO   loc
     52
     53    ; Exit macro immediately if no overlap.
     54    ; We don't want to assign values to z_last_... if there is no
     55    ; overlap because they would then hold the values the last time this
     56    ; macro was called and not those of the last overlap.
     57    IF (loc - $) LE 0
     58    ;~ IF ($ - loc) GE 0
     59        EXITM
     60    ENDIF
     61
     62    ; Calculate the overlap.
     63    z_last_overlap_size = (loc - $)
     64    z_last_overlap_location = loc - z_last_overlap_size
     65
     66    IFDEF   JWASM
     67        ; Output message.
     68        ECHO
     69        ECHO ** ERROR: LOCATION OVERLAP DETECTED [JWASM] ! **
     70        ECHO .         THIS IS MOST LIKELY CAUSED BY CODE / DATA
     71        ECHO .         EXPANSION TOWARDS AN 'ORG' DIRECTIVE.
     72        ECHO .         LOOK AT 'z_last_overlap_location' TO SEE WHERE.
     73        ECHO .         LOOK AT 'z_last_overlap_size' TO SEE SIZE.
     74        ECHO .         FORCING ERROR...
     75        ECHO
     76    ENDIF
     77    IFDEF   TASM
     78        IF2
     79            ; Output message (only on pass2).
     80            %OUT
     81            %OUT ** ERROR: LOCATION OVERLAP DETECTED [TASM] ! **
     82            %OUT .         THIS IS MOST LIKELY CAUSED BY CODE / DATA
     83            %OUT .         EXPANSION TOWARDS AN 'ORG' DIRECTIVE.
     84            %OUT .         LOOK AT 'z_last_overlap_location' TO WHERE.
     85            %OUT .         LOOK AT 'z_last_overlap_size' TO SEE SIZE.
     86            %OUT .         FORCING ERROR...
     87            %OUT
     88        ENDIF
     89    ENDIF
     90
     91    ; Terminate assembly by forcing an error.
     92    .ERR
     93
     94ENDM
     95
     96
    3797; Shortcuts for pointer-types
    3898bptr                             equ   byte ptr
Note: See TracChangeset for help on using the changeset viewer.