VirtualBox

Ignore:
Timestamp:
Nov 23, 2023 12:40:38 AM (12 months ago)
Author:
vboxsync
Message:

bs3kit: Fixed some issues with loading of a fake 63.5 MB floppy. Added optional checksumming of the images we load (disabled by default, as it's slow in IEM). bugref:10371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-linker.h

    r102181 r102270  
    5353    uint8_t     cFATs;                  /**< 010h */
    5454    uint16_t    cRootDirEntries;        /**< 011h */
    55     uint16_t    cTotalSectors;          /**< 013h */
     55    uint16_t    cTotalSectors;          /**< 013h - We (ab)use this for the checksum length in sectors. */
    5656    uint8_t     bMediaDescriptor;       /**< 015h */
    5757    uint16_t    cSectorsPerFAT;         /**< 016h */
     
    6363    uint8_t     bFlagsEtc;              /**< 025h */
    6464    uint8_t     bExtendedSignature;     /**< 026h */
    65     uint32_t    dwSerialNumber;         /**< 027h */
     65    uint32_t    dwSerialNumber;         /**< 027h - We (ab)use this for the base image checksum. */
    6666    char        abLabel[11];            /**< 02bh */
    6767    char        abFSType[8];            /**< 036h */
     
    104104    int32_t     offStrings;         /**< Relative address (to entry start) of the string table. */
    105105    uint32_t    offFilename;        /**< String table offset of the DLL name (sans path, with extension). */
     106    uint32_t    uChecksum;          /**< Simple checksum of all the on-disk image bits. */
    106107} BS3HIGHDLLENTRY;
    107108/** Magic value for BS3HIGHDLLENTRY. */
     
    125126
    126127
     128/** Initial value for Bs3CalcChecksum. */
     129#define BS3_CALC_CHECKSUM_INITIAL_VALUE 1
     130
     131/**
     132 * Calculates an Adler-32 checksum.
     133 */
     134DECLINLINE(uint32_t) Bs3CalcChecksum(uint32_t uChecksum, uint8_t const RT_FAR *pbSrc, size_t cbSrc)
     135{
     136    uint32_t uA = RT_LO_U16(uChecksum);
     137    uint32_t uB = RT_HI_U16(uChecksum);
     138
     139    while (cbSrc-- > 0)
     140    {
     141        uA = (uA + *pbSrc++) % 0xfff1;
     142        uB = (uA + uB)       % 0xfff1;
     143    }
     144
     145    return RT_MAKE_U32(uA, uB);
     146}
     147
    127148#endif /* !BS3KIT_INCLUDED_bs3kit_linker_h */
    128149
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette