Index: trunk/i386/libsaio/fake_efi.c =================================================================== --- trunk/i386/libsaio/fake_efi.c (revision 2781) +++ trunk/i386/libsaio/fake_efi.c (revision 2782) @@ -665,6 +665,8 @@ { Node *chosenNode; chosenNode = DT__FindNode("/chosen", false); + unsigned long adler32 = 0; + if (chosenNode == NULL) { stop("setupChosenNode: Couldn't get '/chosen' node"); @@ -685,7 +687,7 @@ // DT__AddProperty(chosenNode, "boot-file-path", bootFPsize, gBootFP); -// DT__AddProperty(chosenNode, "boot-kernelcache-adler32", sizeof(adler32), adler32); + DT__AddProperty(chosenNode, "boot-kernelcache-adler32", sizeof(unsigned long), &adler32); DT__AddProperty(chosenNode, MACHINE_SIG_PROP, sizeof(Platform.HWSignature), (EFI_UINT32 *)&Platform.HWSignature); Index: trunk/i386/boot2/graphics.c =================================================================== --- trunk/i386/boot2/graphics.c (revision 2781) +++ trunk/i386/boot2/graphics.c (revision 2782) @@ -108,8 +108,7 @@ //========================================================================== // -void -printVBEModeInfo() +void printVBEModeInfo() { VBEInfoBlock vbeInfo; unsigned short * modePtr; @@ -233,8 +232,7 @@ // Return the VESA mode that matches the properties specified. // If a mode is not found, then return the "best" available mode. -static unsigned short -getVESAModeWithProperties( unsigned short width, +static unsigned short getVESAModeWithProperties( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short attributesSet, @@ -273,8 +271,7 @@ // Loop through the mode list, and find the matching mode. - for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); - *modePtr != modeEndOfList; modePtr++ ) + for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); *modePtr != modeEndOfList; modePtr++ ) { // Get mode information. @@ -288,15 +285,14 @@ #if DEBUG printf("Mode %x: %dx%dx%d mm:%d attr:%x\n", - *modePtr, modeInfo.XResolution, modeInfo.YResolution, - modeInfo.BitsPerPixel, modeInfo.MemoryModel, - modeInfo.ModeAttributes); + *modePtr, modeInfo.XResolution, modeInfo.YResolution, + modeInfo.BitsPerPixel, modeInfo.MemoryModel, + modeInfo.ModeAttributes); #endif // Filter out unwanted modes based on mode attributes. - if ( ( ( modeInfo.ModeAttributes & attributesSet ) != attributesSet ) - || ( ( modeInfo.ModeAttributes & attributesClear ) != 0 ) ) + if (((modeInfo.ModeAttributes & attributesSet) != attributesSet) || ((modeInfo.ModeAttributes & attributesClear) != 0)) { continue; } @@ -305,73 +301,62 @@ modeBitsPerPixel = modeInfo.BitsPerPixel; - if ( ( modeBitsPerPixel == 4 ) && ( modeInfo.MemoryModel == 0 ) ) + if ((modeBitsPerPixel == 4) && (modeInfo.MemoryModel == 0)) { // Text mode, 16 colors. } - else if ( ( modeBitsPerPixel == 8 ) && ( modeInfo.MemoryModel == 4 ) ) + else if ((modeBitsPerPixel == 8) && (modeInfo.MemoryModel == 4)) { // Packed pixel, 256 colors. } - else if ( ( ( modeBitsPerPixel == 16 ) || ( modeBitsPerPixel == 15 ) ) - && ( modeInfo.MemoryModel == 6 ) - && ( modeInfo.RedMaskSize == 5 ) - && ( modeInfo.GreenMaskSize == 5 ) - && ( modeInfo.BlueMaskSize == 5 ) ) + else if (((modeBitsPerPixel == 16) || (modeBitsPerPixel == 15)) && (modeInfo.MemoryModel == 6) && (modeInfo.RedMaskSize == 5) && + (modeInfo.GreenMaskSize == 5) && (modeInfo.BlueMaskSize == 5)) { // Direct color, 16 bpp (1:5:5:5). modeInfo.BitsPerPixel = modeBitsPerPixel = 16; } - else if ( ( modeBitsPerPixel == 32 ) - && ( modeInfo.MemoryModel == 6 ) - && ( modeInfo.RedMaskSize == 8 ) - && ( modeInfo.GreenMaskSize == 8 ) - && ( modeInfo.BlueMaskSize == 8 ) ) + else if ((modeBitsPerPixel == 32) && (modeInfo.MemoryModel == 6) && (modeInfo.RedMaskSize == 8) && + (modeInfo.GreenMaskSize == 8) && (modeInfo.BlueMaskSize == 8)) { // Direct color, 32 bpp (8:8:8:8). } else { - continue; // Not a supported mode. + continue; // Not a supported mode. } // Modes larger than the specified dimensions are skipped. - if ( ( modeInfo.XResolution > width ) || - ( modeInfo.YResolution > height ) ) + if ((modeInfo.XResolution > width) || (modeInfo.YResolution > height)) { continue; } // Perfect match, we're done looking. - if ( ( modeInfo.XResolution == width ) && - ( modeInfo.YResolution == height ) && - ( modeBitsPerPixel == bitsPerPixel ) ) + if (modeInfo.XResolution == width && modeInfo.YResolution == height && modeBitsPerPixel == bitsPerPixel) { matchedMode = *modePtr; - bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) ); + bcopy(&modeInfo, outModeInfo, sizeof(modeInfo)); break; } // Save the next "best" mode in case a perfect match is not found. - if ( modeInfo.XResolution == outModeInfo->XResolution && - modeInfo.YResolution == outModeInfo->YResolution && - modeBitsPerPixel <= outModeInfo->BitsPerPixel ) + if (modeInfo.XResolution == outModeInfo->XResolution && modeInfo.YResolution == outModeInfo->YResolution && + modeBitsPerPixel <= outModeInfo->BitsPerPixel) { - continue; // Saved mode has more depth. + continue; // Saved mode has more depth. } - if ( modeInfo.XResolution < outModeInfo->XResolution || - modeInfo.YResolution < outModeInfo->YResolution || - modeBitsPerPixel < outModeInfo->BitsPerPixel ) + if (modeInfo.XResolution < outModeInfo->XResolution || modeInfo.YResolution < outModeInfo->YResolution || + modeBitsPerPixel < outModeInfo->BitsPerPixel) { - continue; // Saved mode has more resolution. + continue; // Saved mode has more resolution. } matchedMode = *modePtr; - bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) ); + bcopy(&modeInfo, outModeInfo, sizeof(modeInfo)); } return matchedMode; @@ -380,7 +365,7 @@ //========================================================================== // setupPalette -static void setupPalette( VBEPalette * p, const unsigned char * g ) +static void setupPalette( VBEPalette *p, const unsigned char *g ) { int i; unsigned char * source = (unsigned char *) g; @@ -422,11 +407,7 @@ //========================================================================== // setVESAGraphicsMode -static int -setVESAGraphicsMode( unsigned short width, - unsigned short height, - unsigned char bitsPerPixel, - unsigned short refreshRate ) +static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate ) { VBEModeInfoBlock minfo; unsigned short mode; @@ -485,12 +466,12 @@ // Set the mode with default refresh rate. - err = setVBEMode(mode | kLinearFrameBufferBit, NULL); + err = setVBEMode(mode | kLinearFrameBufferBit, NULL); - if (err != errSuccess) - { - break; - } + if (err != errSuccess) + { + break; + } // Set 8-bit color palette. @@ -504,26 +485,27 @@ } } - // Is this required for buggy Video BIOS implementations? - // On which adapter? + // Is this required for buggy Video BIOS implementations? + // On which adapter? - if ( minfo.BytesPerScanline == 0 ) - minfo.BytesPerScanline = ( minfo.XResolution * - minfo.BitsPerPixel ) >> 3; + if ( minfo.BytesPerScanline == 0 ) + { + minfo.BytesPerScanline = ( minfo.XResolution * minfo.BitsPerPixel ) >> 3; + } - // Update KernBootStruct using info provided by the selected - // VESA mode. + // Update KernBootStruct using info provided by the selected + // VESA mode. - bootArgs->Video.v_display = GRAPHICS_MODE; - bootArgs->Video.v_width = minfo.XResolution; - bootArgs->Video.v_height = minfo.YResolution; - bootArgs->Video.v_depth = minfo.BitsPerPixel; - bootArgs->Video.v_rowBytes = minfo.BytesPerScanline; - bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr); + bootArgs->Video.v_display = GRAPHICS_MODE; + bootArgs->Video.v_width = minfo.XResolution; /* 1920 or 1600 */ + bootArgs->Video.v_height = minfo.YResolution; /* 1200 or 900 */ + bootArgs->Video.v_depth = minfo.BitsPerPixel; /* 32 */ + bootArgs->Video.v_rowBytes = minfo.BytesPerScanline; /* 7680 or 6400 */ + bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr); } while ( 0 ); - return err; + return err; } //============================================================================== @@ -563,8 +545,7 @@ //============================================================================== -int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, - uint8_t **imageData) +int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, uint8_t **imageData) { uint8_t *pngData = NULL; int pngFile = 0, pngSize; @@ -617,7 +598,8 @@ //============================================================================== -int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData) { +int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData) +{ PNG_info_t *info; int error = 0; @@ -647,8 +629,7 @@ //============================================================================== -void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, - uint8_t *data) +void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data) { uint16_t drawWidth; uint8_t *vram = (uint8_t *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + 4 * x; @@ -856,11 +837,7 @@ //========================================================================== // drawDataRectangle -void drawDataRectangle( unsigned short x, - unsigned short y, - unsigned short width, - unsigned short height, - unsigned char *data ) +void drawDataRectangle( unsigned short x, unsigned short y, unsigned short width, unsigned short height, unsigned char *data ) { unsigned short drawWidth; @@ -929,7 +906,7 @@ DECLARE_IOHIBERNATEPROGRESSALPHA -void drawPreview(void *src, uint8_t * saveunder) +void drawPreview(void *src, uint8_t *saveunder) { uint8_t *screen; uint32_t rowBytes, pixelShift; @@ -1024,7 +1001,7 @@ //============================================================================== -void updateProgressBar(uint8_t * saveunder, int32_t firstBlob, int32_t select) +void updateProgressBar(uint8_t *saveunder, int32_t firstBlob, int32_t select) { uint8_t *screen; uint32_t rowBytes, pixelShift; @@ -1122,7 +1099,7 @@ //========================================================================== // getNumberArrayFromProperty -static int getNumberArrayFromProperty( const char * propKey, +static int getNumberArrayFromProperty( const char *propKey, unsigned long numbers[], unsigned long maxArrayCount ) { Index: trunk/i386/boot2/boot.c =================================================================== --- trunk/i386/boot2/boot.c (revision 2781) +++ trunk/i386/boot2/boot.c (revision 2782) @@ -922,6 +922,9 @@ return MacOSVerCurrent; } +// ========================================================================= +unsigned long Adler32(unsigned char *buf, long len) +{ #define BASE 65521L /* largest prime smaller than 65536 */ #define NMAX 5000 // NMAX (was 5521) the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 @@ -932,25 +935,31 @@ #define DO8(buf, i) DO4(buf, i); DO4(buf, i + 4); #define DO16(buf) DO8(buf, 0); DO8(buf, 8); -unsigned long Adler32(unsigned char *buf, long len) -{ + int k; + unsigned long s1 = 1; // adler & 0xffff; unsigned long s2 = 0; // (adler >> 16) & 0xffff; unsigned long result; - int k; while (len > 0) { k = len < NMAX ? len : NMAX; len -= k; - while (k >= 16) { + while (k >= 16) + { DO16(buf); buf += 16; k -= 16; } - if (k != 0) do { - s1 += *buf++; - s2 += s1; - } while (--k); + + if (k != 0) + { + do + { + s1 += *buf++; + s2 += s1; + } while (--k); + } + s1 %= BASE; s2 %= BASE; } Index: trunk/i386/boot2/gui.c =================================================================== --- trunk/i386/boot2/gui.c (revision 2781) +++ trunk/i386/boot2/gui.c (revision 2782) @@ -54,6 +54,7 @@ iDeviceGeneric_o, iDeviceHFS, iDeviceHFS_o, + iDeviceHFS_cap, iDeviceHFS_cap_o, iDeviceHFS_yos, @@ -148,6 +149,7 @@ {.name = "device_generic_o", .image = NULL}, {.name = "device_hfsplus", .image = NULL}, {.name = "device_hfsplus_o", .image = NULL}, + {.name = "device_hfsplus_cap", .image = NULL}, {.name = "device_hfsplus_cap_o", .image = NULL}, {.name = "device_hfsplus_yos", .image = NULL}, @@ -394,6 +396,7 @@ LOADPNG(device_generic_o, iDeviceGeneric); LOADPNG(device_hfsplus, iDeviceGeneric); LOADPNG(device_hfsplus_o, iDeviceHFS); + LOADPNG(device_hfsplus_cap, iDeviceHFS); LOADPNG(device_hfsplus_cap_o, iDeviceHFS_cap); LOADPNG(device_hfsplus_yos, iDeviceHFS);