Index: branches/cparm/Chameleon.xcodeproj/project.pbxproj =================================================================== --- branches/cparm/Chameleon.xcodeproj/project.pbxproj (revision 1803) +++ branches/cparm/Chameleon.xcodeproj/project.pbxproj (revision 1804) @@ -7,12 +7,292 @@ objects = { /* Begin PBXFileReference section */ - 0172D0DC11FB66820030222E /* dram_controllers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dram_controllers.h; sourceTree = ""; }; - 0172D0DD11FB66820030222E /* dram_controllers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dram_controllers.c; sourceTree = ""; }; - 019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = ""; }; - 1D145307137073F40050C0CD /* bootargs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootargs.h; sourceTree = ""; }; - 1D2A1AF513743A2600787720 /* bootargs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootargs.h; sourceTree = ""; }; - 65ED53931204B83200B22507 /* disk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = ""; }; + AB0E930C14C6223500F798D7 /* cpu_intel_amd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu_intel_amd.c; sourceTree = ""; }; + AB43B2B714C37E520018D529 /* boot0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0.s; sourceTree = ""; }; + AB43B2B814C37E520018D529 /* boot0md.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0md.s; sourceTree = ""; }; + AB43B2B914C37E520018D529 /* chain0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = chain0.s; sourceTree = ""; }; + AB43B2BA14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B2BC14C37E520018D529 /* boot1f32-install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "boot1f32-install.sh"; sourceTree = ""; }; + AB43B2BD14C37E520018D529 /* boot1f32.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1f32.s; sourceTree = ""; }; + AB43B2BE14C37E520018D529 /* boot1h.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1h.s; sourceTree = ""; }; + AB43B2BF14C37E520018D529 /* boot1he.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1he.s; sourceTree = ""; }; + AB43B2C014C37E520018D529 /* boot1hp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1hp.s; sourceTree = ""; }; + AB43B2C114C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B2C314C37E520018D529 /* appleboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleboot.h; sourceTree = ""; }; + AB43B2C414C37E520018D529 /* appleClut8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleClut8.h; sourceTree = ""; }; + AB43B2C514C37E520018D529 /* boot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = boot.c; sourceTree = ""; }; + AB43B2C614C37E520018D529 /* boot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boot.h; sourceTree = ""; }; + AB43B2C714C37E520018D529 /* boot2.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot2.s; sourceTree = ""; }; + AB43B2C814C37E520018D529 /* drivers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = drivers.c; sourceTree = ""; }; + AB43B2C914C37E520018D529 /* drivers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = drivers.h; sourceTree = ""; }; + AB43B2CA14C37E520018D529 /* failedboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = failedboot.h; sourceTree = ""; }; + AB43B2CB14C37E520018D529 /* graphics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphics.c; sourceTree = ""; }; + AB43B2CC14C37E520018D529 /* graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphics.h; sourceTree = ""; }; + AB43B2CD14C37E520018D529 /* lzss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzss.c; sourceTree = ""; }; + AB43B2CE14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B2CF14C37E520018D529 /* mboot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mboot.c; sourceTree = ""; }; + AB43B2D014C37E520018D529 /* mboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mboot.h; sourceTree = ""; }; + AB43B2D114C37E520018D529 /* modules.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = modules.c; sourceTree = ""; }; + AB43B2D214C37E520018D529 /* modules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = modules.h; sourceTree = ""; }; + AB43B2D314C37E520018D529 /* multiboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multiboot.h; sourceTree = ""; }; + AB43B2D414C37E520018D529 /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = ""; }; + AB43B2D514C37E520018D529 /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options.h; sourceTree = ""; }; + AB43B2D614C37E520018D529 /* prompt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prompt.c; sourceTree = ""; }; + AB43B2D814C37E520018D529 /* cdboot.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboot.s; sourceTree = ""; }; + AB43B2D914C37E520018D529 /* cdboothdd.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboothdd.s; sourceTree = ""; }; + AB43B2DA14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B2DC14C37E520018D529 /* Limits */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Limits; sourceTree = ""; }; + AB43B2DD14C37E520018D529 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + AB43B2DF14C37E520018D529 /* efi_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = efi_tables.c; sourceTree = ""; }; + AB43B2E014C37E520018D529 /* efi_tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi_tables.h; sourceTree = ""; }; + AB43B2E114C37E520018D529 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = ""; }; + AB43B2E214C37E520018D529 /* libsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsa.h; sourceTree = ""; }; + AB43B2E314C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B2E414C37E520018D529 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; + AB43B2E514C37E520018D529 /* prf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prf.c; sourceTree = ""; }; + AB43B2E614C37E520018D529 /* printf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printf.c; sourceTree = ""; }; + AB43B2E714C37E520018D529 /* qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qsort.c; sourceTree = ""; }; + AB43B2E814C37E520018D529 /* rand.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rand.c; sourceTree = ""; }; + AB43B2E914C37E520018D529 /* setjmp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; + AB43B2EA14C37E520018D529 /* string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = string.c; sourceTree = ""; }; + AB43B2EB14C37E520018D529 /* strtol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strtol.c; sourceTree = ""; }; + AB43B2EC14C37E520018D529 /* zalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zalloc.c; sourceTree = ""; }; + AB43B2EE14C37E520018D529 /* acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = ""; }; + AB43B2EF14C37E520018D529 /* acpi_tools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_tools.c; sourceTree = ""; }; + AB43B2F014C37E520018D529 /* acpi_tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_tools.h; sourceTree = ""; }; + AB43B2F114C37E520018D529 /* allocate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = allocate.c; sourceTree = ""; }; + AB43B2F214C37E520018D529 /* apic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apic.h; sourceTree = ""; }; + AB43B2F314C37E520018D529 /* asm.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = asm.s; sourceTree = ""; }; + AB43B2F414C37E520018D529 /* befs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = befs.c; sourceTree = ""; }; + AB43B2F514C37E520018D529 /* befs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = befs.h; sourceTree = ""; }; + AB43B2F614C37E520018D529 /* bios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bios.h; sourceTree = ""; }; + AB43B2F714C37E520018D529 /* bios.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bios.s; sourceTree = ""; }; + AB43B2F814C37E520018D529 /* biosfn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = biosfn.c; sourceTree = ""; }; + AB43B2F914C37E520018D529 /* bootLion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootLion.h; sourceTree = ""; }; + AB43B2FA14C37E520018D529 /* bootstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bootstruct.c; sourceTree = ""; }; + AB43B2FB14C37E520018D529 /* bootstruct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootstruct.h; sourceTree = ""; }; + AB43B2FC14C37E520018D529 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = ""; }; + AB43B2FD14C37E520018D529 /* console.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = console.c; sourceTree = ""; }; + AB43B2FE14C37E520018D529 /* convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = convert.c; sourceTree = ""; }; + AB43B2FF14C37E520018D529 /* convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert.h; sourceTree = ""; }; + AB43B30014C37E520018D529 /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu.c; sourceTree = ""; }; + AB43B30114C37E520018D529 /* cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = ""; }; + AB43B30214C37E520018D529 /* cpu_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_data.h; sourceTree = ""; }; + AB43B30314C37E520018D529 /* cpuid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpuid.h; sourceTree = ""; }; + AB43B30414C37E520018D529 /* datatype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = datatype.h; sourceTree = ""; }; + AB43B30514C37E520018D529 /* device_inject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_inject.c; sourceTree = ""; }; + AB43B30614C37E520018D529 /* device_inject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_inject.h; sourceTree = ""; }; + AB43B30714C37E520018D529 /* device_tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_tree.c; sourceTree = ""; }; + AB43B30814C37E520018D529 /* device_tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_tree.h; sourceTree = ""; }; + AB43B30914C37E520018D529 /* disk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = disk.c; sourceTree = ""; }; + AB43B30A14C37E520018D529 /* disk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = ""; }; + AB43B30B14C37E520018D529 /* efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi.h; sourceTree = ""; }; + AB43B30C14C37E520018D529 /* exfat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = exfat.c; sourceTree = ""; }; + AB43B30D14C37E520018D529 /* exfat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = exfat.h; sourceTree = ""; }; + AB43B30E14C37E520018D529 /* ext2fs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ext2fs.c; sourceTree = ""; }; + AB43B30F14C37E520018D529 /* ext2fs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ext2fs.h; sourceTree = ""; }; + AB43B31014C37E520018D529 /* fake_efi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fake_efi.c; sourceTree = ""; }; + AB43B31114C37E520018D529 /* fake_efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fake_efi.h; sourceTree = ""; }; + AB43B31214C37E520018D529 /* fdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fdisk.h; sourceTree = ""; }; + AB43B31314C37E520018D529 /* freebsd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = freebsd.c; sourceTree = ""; }; + AB43B31414C37E520018D529 /* freebsd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = freebsd.h; sourceTree = ""; }; + AB43B31514C37E520018D529 /* hfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hfs.c; sourceTree = ""; }; + AB43B31614C37E520018D529 /* hfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hfs.h; sourceTree = ""; }; + AB43B31714C37E520018D529 /* hfs_CaseTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hfs_CaseTables.h; sourceTree = ""; }; + AB43B31814C37E520018D529 /* hfs_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hfs_compare.c; sourceTree = ""; }; + AB43B31914C37E520018D529 /* intel_acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intel_acpi.h; sourceTree = ""; }; + AB43B31A14C37E520018D529 /* internal_modules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internal_modules.h; sourceTree = ""; }; + AB43B31B14C37E520018D529 /* io_inline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io_inline.h; sourceTree = ""; }; + AB43B31C14C37E520018D529 /* libsaio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsaio.h; sourceTree = ""; }; + AB43B31D14C37E520018D529 /* load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load.c; sourceTree = ""; }; + AB43B31E14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B31F14C37E520018D529 /* md5c.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5c.c; sourceTree = ""; }; + AB43B32014C37E520018D529 /* misc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = misc.c; sourceTree = ""; }; + AB43B32114C37E520018D529 /* msdos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msdos.c; sourceTree = ""; }; + AB43B32214C37E520018D529 /* msdos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msdos.h; sourceTree = ""; }; + AB43B32314C37E520018D529 /* msdos_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msdos_private.h; sourceTree = ""; }; + AB43B32414C37E520018D529 /* nbp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nbp.c; sourceTree = ""; }; + AB43B32514C37E520018D529 /* nbp_cmd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nbp_cmd.h; sourceTree = ""; }; + AB43B32614C37E520018D529 /* ntfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ntfs.c; sourceTree = ""; }; + AB43B32714C37E520018D529 /* ntfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntfs.h; sourceTree = ""; }; + AB43B32814C37E520018D529 /* ntfs_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntfs_private.h; sourceTree = ""; }; + AB43B32914C37E520018D529 /* openbsd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = openbsd.c; sourceTree = ""; }; + AB43B32A14C37E520018D529 /* openbsd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = openbsd.h; sourceTree = ""; }; + AB43B32B14C37E520018D529 /* pci.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci.c; sourceTree = ""; }; + AB43B32C14C37E520018D529 /* pci.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pci.h; sourceTree = ""; }; + AB43B32D14C37E520018D529 /* pci_root.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci_root.c; sourceTree = ""; }; + AB43B32E14C37E520018D529 /* pci_root.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pci_root.h; sourceTree = ""; }; + AB43B32F14C37E520018D529 /* platform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = platform.c; sourceTree = ""; }; + AB43B33014C37E520018D529 /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = ""; }; + AB43B33114C37E520018D529 /* ppm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppm.h; sourceTree = ""; }; + AB43B33214C37E520018D529 /* ppmsetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppmsetup.h; sourceTree = ""; }; + AB43B33314C37E520018D529 /* saio_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saio_internal.h; sourceTree = ""; }; + AB43B33414C37E520018D529 /* saio_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saio_types.h; sourceTree = ""; }; + AB43B33514C37E520018D529 /* sl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sl.h; sourceTree = ""; }; + AB43B33614C37E520018D529 /* smbios.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios.c; sourceTree = ""; }; + AB43B33714C37E520018D529 /* SMBIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SMBIOS.h; sourceTree = ""; }; + AB43B33814C37E520018D529 /* smp-imps.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "smp-imps.c"; sourceTree = ""; }; + AB43B33914C37E520018D529 /* smp-imps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "smp-imps.h"; sourceTree = ""; }; + AB43B33A14C37E520018D529 /* stringTable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stringTable.c; sourceTree = ""; }; + AB43B33B14C37E520018D529 /* sys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sys.c; sourceTree = ""; }; + AB43B33C14C37E520018D529 /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = ""; }; + AB43B33D14C37E520018D529 /* ufs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ufs.c; sourceTree = ""; }; + AB43B33E14C37E520018D529 /* ufs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ufs.h; sourceTree = ""; }; + AB43B33F14C37E520018D529 /* ufs_byteorder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ufs_byteorder.c; sourceTree = ""; }; + AB43B34014C37E520018D529 /* ufs_byteorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ufs_byteorder.h; sourceTree = ""; }; + AB43B34114C37E520018D529 /* vbe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vbe.c; sourceTree = ""; }; + AB43B34214C37E520018D529 /* vbe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vbe.h; sourceTree = ""; }; + AB43B34314C37E520018D529 /* xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = ""; }; + AB43B34414C37E520018D529 /* xml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = ""; }; + AB43B34514C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B34614C37E520018D529 /* MakeInc.dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MakeInc.dir; sourceTree = ""; }; + AB43B34714C37E520018D529 /* MakePaths.dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MakePaths.dir; sourceTree = ""; }; + AB43B34A14C37E520018D529 /* acpi_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_codec.c; sourceTree = ""; }; + AB43B34B14C37E520018D529 /* acpi_codec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_codec.h; sourceTree = ""; }; + AB43B34C14C37E520018D529 /* acpicode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpicode.c; sourceTree = ""; }; + AB43B34D14C37E520018D529 /* acpicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpicode.h; sourceTree = ""; }; + AB43B34E14C37E520018D529 /* ACPICodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ACPICodec.c; sourceTree = ""; }; + AB43B34F14C37E520018D529 /* acpidecode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpidecode.c; sourceTree = ""; }; + AB43B35014C37E520018D529 /* acpidecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpidecode.h; sourceTree = ""; }; + AB43B35114C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B35314C37E520018D529 /* acpi_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_patcher.c; sourceTree = ""; }; + AB43B35414C37E520018D529 /* acpi_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_patcher.h; sourceTree = ""; }; + AB43B35514C37E520018D529 /* AcpiPatcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = AcpiPatcher.c; sourceTree = ""; }; + AB43B35614C37E520018D529 /* aml_generator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aml_generator.c; sourceTree = ""; }; + AB43B35714C37E520018D529 /* aml_generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aml_generator.h; sourceTree = ""; }; + AB43B35814C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B35A14C37E520018D529 /* CPUfreq.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CPUfreq.c; sourceTree = ""; }; + AB43B35B14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B35D14C37E520018D529 /* ati.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ati.c; sourceTree = ""; }; + AB43B35E14C37E520018D529 /* ati.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ati.h; sourceTree = ""; }; + AB43B35F14C37E520018D529 /* ati_reg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ati_reg.h; sourceTree = ""; }; + AB43B36014C37E520018D529 /* gma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gma.c; sourceTree = ""; }; + AB43B36114C37E520018D529 /* gma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gma.h; sourceTree = ""; }; + AB43B36214C37E520018D529 /* GraphicsEnabler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = GraphicsEnabler.c; sourceTree = ""; }; + AB43B36314C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B36414C37E520018D529 /* nvidia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nvidia.c; sourceTree = ""; }; + AB43B36514C37E520018D529 /* nvidia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nvidia.h; sourceTree = ""; }; + AB43B36714C37E520018D529 /* graphic_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphic_utils.c; sourceTree = ""; }; + AB43B36814C37E520018D529 /* graphic_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphic_utils.h; sourceTree = ""; }; + AB43B36914C37E520018D529 /* gui.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gui.c; sourceTree = ""; }; + AB43B36A14C37E520018D529 /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = ""; }; + AB43B36B14C37E520018D529 /* GUI_appleboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUI_appleboot.h; sourceTree = ""; }; + AB43B36C14C37E520018D529 /* GUI_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = GUI_module.c; sourceTree = ""; }; + AB43B36D14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B36E14C37E520018D529 /* picopng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = picopng.c; sourceTree = ""; }; + AB43B36F14C37E520018D529 /* picopng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picopng.h; sourceTree = ""; }; + AB43B37114C37E520018D529 /* HelloWorld.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = HelloWorld.c; sourceTree = ""; }; + AB43B37214C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B37414C37E520018D529 /* bmdecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bmdecompress.c; sourceTree = ""; }; + AB43B37514C37E520018D529 /* bmdecompress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bmdecompress.h; sourceTree = ""; }; + AB43B37614C37E520018D529 /* graphic_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphic_utils.c; sourceTree = ""; }; + AB43B37714C37E520018D529 /* graphic_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphic_utils.h; sourceTree = ""; }; + AB43B37814C37E520018D529 /* HibernateEnabler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = HibernateEnabler.c; sourceTree = ""; }; + AB43B37914C37E520018D529 /* IOHibernatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOHibernatePrivate.h; sourceTree = ""; }; + AB43B37A14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B37B14C37E520018D529 /* resume.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resume.c; sourceTree = ""; }; + AB43B37C14C37E520018D529 /* resume.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resume.h; sourceTree = ""; }; + AB43B37E14C37E520018D529 /* HPET.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = HPET.c; sourceTree = ""; }; + AB43B37F14C37E520018D529 /* hpet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hpet.h; sourceTree = ""; }; + AB43B38014C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B38214C37E520018D529 /* kernel_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kernel_patcher.c; sourceTree = ""; }; + AB43B38314C37E520018D529 /* kernel_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_patcher.h; sourceTree = ""; }; + AB43B38414C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B38614C37E520018D529 /* adler32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = adler32.c; sourceTree = ""; }; + AB43B38714C37E520018D529 /* deflate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = deflate.c; sourceTree = ""; }; + AB43B38814C37E520018D529 /* deflate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deflate.h; sourceTree = ""; }; + AB43B38914C37E520018D529 /* hex_editor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hex_editor.c; sourceTree = ""; }; + AB43B38A14C37E520018D529 /* hex_editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hex_editor.h; sourceTree = ""; }; + AB43B38B14C37E520018D529 /* inffast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inffast.c; sourceTree = ""; }; + AB43B38C14C37E520018D529 /* inffast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inffast.h; sourceTree = ""; }; + AB43B38D14C37E520018D529 /* inffixed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inffixed.h; sourceTree = ""; }; + AB43B38E14C37E520018D529 /* inflate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inflate.c; sourceTree = ""; }; + AB43B38F14C37E520018D529 /* inflate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inflate.h; sourceTree = ""; }; + AB43B39014C37E520018D529 /* inftrees.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inftrees.c; sourceTree = ""; }; + AB43B39114C37E520018D529 /* inftrees.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inftrees.h; sourceTree = ""; }; + AB43B39214C37E520018D529 /* kext_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kext_patcher.c; sourceTree = ""; }; + AB43B39314C37E520018D529 /* kext_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kext_patcher.h; sourceTree = ""; }; + AB43B39414C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B39514C37E520018D529 /* mkext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mkext.h; sourceTree = ""; }; + AB43B39614C37E520018D529 /* trees.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = trees.c; sourceTree = ""; }; + AB43B39714C37E520018D529 /* trees.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = trees.h; sourceTree = ""; }; + AB43B39814C37E520018D529 /* zconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zconf.h; sourceTree = ""; }; + AB43B39914C37E520018D529 /* zlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zlib.h; sourceTree = ""; }; + AB43B39A14C37E520018D529 /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zutil.c; sourceTree = ""; }; + AB43B39B14C37E520018D529 /* zutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zutil.h; sourceTree = ""; }; + AB43B39D14C37E520018D529 /* Keylayout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Keylayout.c; sourceTree = ""; }; + AB43B39E14C37E520018D529 /* Keylayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Keylayout.h; sourceTree = ""; }; + AB43B39F14C37E520018D529 /* Keymapper.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Keymapper.c; sourceTree = ""; }; + AB43B3A014C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3A114C37E520018D529 /* term.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = term.h; sourceTree = ""; }; + AB43B3A214C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3A414C37E520018D529 /* dram_controllers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dram_controllers.c; sourceTree = ""; }; + AB43B3A514C37E520018D529 /* dram_controllers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dram_controllers.h; sourceTree = ""; }; + AB43B3A614C37E520018D529 /* GPL_V2_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL_V2_LICENSE; sourceTree = ""; }; + AB43B3A714C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3A814C37E520018D529 /* mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mem.c; sourceTree = ""; }; + AB43B3A914C37E520018D529 /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = ""; }; + AB43B3AA14C37E520018D529 /* Memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Memory.c; sourceTree = ""; }; + AB43B3AB14C37E520018D529 /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = ""; }; + AB43B3AC14C37E520018D529 /* memvendors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memvendors.h; sourceTree = ""; }; + AB43B3AD14C37E520018D529 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + AB43B3AE14C37E520018D529 /* spd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spd.c; sourceTree = ""; }; + AB43B3AF14C37E520018D529 /* spd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spd.h; sourceTree = ""; }; + AB43B3B114C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3B214C37E520018D529 /* NBI.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = NBI.c; sourceTree = ""; }; + AB43B3B414C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3B514C37E520018D529 /* Networking.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Networking.c; sourceTree = ""; }; + AB43B3B714C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3B814C37E520018D529 /* ramdisk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ramdisk.c; sourceTree = ""; }; + AB43B3B914C37E520018D529 /* ramdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ramdisk.h; sourceTree = ""; }; + AB43B3BA14C37E520018D529 /* RamDiskLoader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = RamDiskLoader.c; sourceTree = ""; }; + AB43B3BC14C37E520018D529 /* 915resolution.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = 915resolution.c; sourceTree = ""; }; + AB43B3BD14C37E520018D529 /* 915resolution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 915resolution.h; sourceTree = ""; }; + AB43B3BE14C37E520018D529 /* edid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = edid.c; sourceTree = ""; }; + AB43B3BF14C37E520018D529 /* edid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = edid.h; sourceTree = ""; }; + AB43B3C014C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3C114C37E520018D529 /* Resolution.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Resolution.c; sourceTree = ""; }; + AB43B3C214C37E520018D529 /* shortatombios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shortatombios.h; sourceTree = ""; }; + AB43B3C414C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3C514C37E520018D529 /* mysmbios.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mysmbios.c; sourceTree = ""; }; + AB43B3C614C37E520018D529 /* mysmbios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mysmbios.h; sourceTree = ""; }; + AB43B3C714C37E520018D529 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + AB43B3C814C37E520018D529 /* smbios_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios_decode.c; sourceTree = ""; }; + AB43B3C914C37E520018D529 /* smbios_getters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios_getters.c; sourceTree = ""; }; + AB43B3CA14C37E520018D529 /* smbios_getters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smbios_getters.h; sourceTree = ""; }; + AB43B3CB14C37E520018D529 /* SMBiosGetters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SMBiosGetters.c; sourceTree = ""; }; + AB43B3CD14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3CE14C37E520018D529 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + AB43B3CF14C37E520018D529 /* smbios_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios_patcher.c; sourceTree = ""; }; + AB43B3D014C37E520018D529 /* smbios_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smbios_patcher.h; sourceTree = ""; }; + AB43B3D114C37E520018D529 /* SMBiosPatcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SMBiosPatcher.c; sourceTree = ""; }; + AB43B3D314C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3D414C37E520018D529 /* usb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = usb.c; sourceTree = ""; }; + AB43B3D514C37E520018D529 /* USBFix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = USBFix.c; sourceTree = ""; }; + AB43B3D714C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3D814C37E520018D529 /* YellowIconFixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = YellowIconFixer.c; sourceTree = ""; }; + AB43B3DA14C37E520018D529 /* amlsgn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = amlsgn.m; sourceTree = ""; }; + AB43B3DB14C37E520018D529 /* bdmesg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bdmesg.c; sourceTree = ""; }; + AB43B3DD14C37E530018D529 /* acpidecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpidecode.h; sourceTree = ""; }; + AB43B3DE14C37E530018D529 /* datatype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = datatype.h; sourceTree = ""; }; + AB43B3DF14C37E530018D529 /* intel_acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intel_acpi.h; sourceTree = ""; }; + AB43B3E014C37E530018D529 /* ppm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppm.h; sourceTree = ""; }; + AB43B3E114C37E530018D529 /* ppmsetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppmsetup.h; sourceTree = ""; }; + AB43B3E214C37E530018D529 /* machOconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = machOconv.c; sourceTree = ""; }; + AB43B3E314C37E530018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + AB43B3E414C37E530018D529 /* Symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Symbols.c; sourceTree = ""; }; + AB43B3E514C37E530018D529 /* WKdm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKdm.h; sourceTree = ""; }; + AB43B3E614C37E530018D529 /* WKdmDecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = WKdmDecompress.c; sourceTree = ""; }; + AB43B3EC14C383120018D529 /* bcopy.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bcopy.s; sourceTree = ""; }; + AB43B3ED14C383120018D529 /* bzero.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bzero.s; sourceTree = ""; }; + AB43B3EE14C383120018D529 /* divdi3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = divdi3.c; sourceTree = ""; }; + AB43B3EF14C383120018D529 /* moddi3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = moddi3.c; sourceTree = ""; }; + AB43B3F014C383120018D529 /* qdivrem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qdivrem.c; sourceTree = ""; }; + AB43B3F114C383120018D529 /* quad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quad.h; sourceTree = ""; }; + AB43B3F214C383120018D529 /* udivdi3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = udivdi3.c; sourceTree = ""; }; + AB43B3F314C383120018D529 /* umoddi3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = umoddi3.c; sourceTree = ""; }; + AB43B3F814C384040018D529 /* stack_protector.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stack_protector.c; sourceTree = ""; }; + AB43B42A14C3A8080018D529 /* arc4random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arc4random.c; sourceTree = ""; }; B0056CD611F3868000754B65 /* boot */ = {isa = PBXFileReference; lastKnownFileType = text; path = boot; sourceTree = ""; }; B0056CD711F3868000754B65 /* boot.sys */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.preload"; path = boot.sys; sourceTree = ""; }; B0056CD811F3868000754B65 /* boot0 */ = {isa = PBXFileReference; lastKnownFileType = text; path = boot0; sourceTree = ""; }; @@ -28,148 +308,6 @@ B0056CE211F3868000754B65 /* libsaio.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libsaio.a; sourceTree = ""; }; B0056CE311F3868000754B65 /* machOconv */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = machOconv; sourceTree = ""; }; B0056CE411F3868000754B65 /* vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vers.h; sourceTree = ""; }; - B0056CE711F3868000754B65 /* boot0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0.s; sourceTree = ""; }; - B0056CE811F3868000754B65 /* chain0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = chain0.s; sourceTree = ""; }; - B0056CE911F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056CEB11F3868000754B65 /* boot1.asm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm.asm; path = boot1.asm; sourceTree = ""; }; - B0056CEC11F3868000754B65 /* boot1.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1.s; sourceTree = ""; }; - B0056CED11F3868000754B65 /* boot1f32-install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "boot1f32-install.sh"; sourceTree = ""; }; - B0056CEE11F3868000754B65 /* boot1f32.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1f32.s; sourceTree = ""; }; - B0056CEF11F3868000754B65 /* boot1he.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1he.s; sourceTree = ""; }; - B0056CF011F3868000754B65 /* boot1hp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1hp.s; sourceTree = ""; }; - B0056CF111F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056CF311F3868000754B65 /* appleboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleboot.h; sourceTree = ""; }; - B0056CF411F3868000754B65 /* appleClut8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleClut8.h; sourceTree = ""; }; - B0056CF511F3868000754B65 /* bmdecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bmdecompress.c; sourceTree = ""; }; - B0056CF611F3868000754B65 /* boot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = boot.c; sourceTree = ""; }; - B0056CF711F3868000754B65 /* boot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boot.h; sourceTree = ""; }; - B0056CF811F3868000754B65 /* boot2.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot2.s; sourceTree = ""; }; - B0056CF911F3868000754B65 /* drivers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = drivers.c; sourceTree = ""; }; - B0056CFA11F3868000754B65 /* graphic_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphic_utils.c; sourceTree = ""; }; - B0056CFB11F3868000754B65 /* graphic_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphic_utils.h; sourceTree = ""; }; - B0056CFC11F3868000754B65 /* graphics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphics.c; sourceTree = ""; }; - B0056CFD11F3868000754B65 /* graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphics.h; sourceTree = ""; }; - B0056CFE11F3868000754B65 /* gui.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gui.c; sourceTree = ""; }; - B0056CFF11F3868000754B65 /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = ""; }; - B0056D0011F3868000754B65 /* IOHibernatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOHibernatePrivate.h; sourceTree = ""; }; - B0056D0111F3868000754B65 /* lzss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzss.c; sourceTree = ""; }; - B0056D0211F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056D0311F3868000754B65 /* mboot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mboot.c; sourceTree = ""; }; - B0056D0411F3868000754B65 /* mboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mboot.h; sourceTree = ""; }; - B0056D0511F3868000754B65 /* multiboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multiboot.h; sourceTree = ""; }; - B0056D0611F3868000754B65 /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = ""; }; - B0056D0711F3868000754B65 /* picopng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = picopng.c; sourceTree = ""; }; - B0056D0811F3868000754B65 /* picopng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picopng.h; sourceTree = ""; }; - B0056D0911F3868000754B65 /* prompt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prompt.c; sourceTree = ""; }; - B0056D0A11F3868000754B65 /* ramdisk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ramdisk.c; sourceTree = ""; }; - B0056D0B11F3868000754B65 /* ramdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ramdisk.h; sourceTree = ""; }; - B0056D0C11F3868000754B65 /* resume.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resume.c; sourceTree = ""; }; - B0056D0D11F3868000754B65 /* WKdm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKdm.h; sourceTree = ""; }; - B0056D0E11F3868000754B65 /* WKdmDecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = WKdmDecompress.c; sourceTree = ""; }; - B0056D1011F3868000754B65 /* cdboot.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboot.s; sourceTree = ""; }; - B0056D1111F3868000754B65 /* cdboothdd.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboothdd.s; sourceTree = ""; }; - B0056D1211F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056D1411F3868000754B65 /* Limits */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Limits; sourceTree = ""; }; - B0056D1511F3868000754B65 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; - B0056D1711F3868000754B65 /* efi_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = efi_tables.c; sourceTree = ""; }; - B0056D1811F3868000754B65 /* efi_tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi_tables.h; sourceTree = ""; }; - B0056D1911F3868000754B65 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = ""; }; - B0056D1A11F3868000754B65 /* libsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsa.h; sourceTree = ""; }; - B0056D1B11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056D1C11F3868000754B65 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; - B0056D1D11F3868000754B65 /* prf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prf.c; sourceTree = ""; }; - B0056D1E11F3868000754B65 /* printf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printf.c; sourceTree = ""; }; - B0056D1F11F3868000754B65 /* qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qsort.c; sourceTree = ""; }; - B0056D2011F3868000754B65 /* setjmp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; - B0056D2111F3868000754B65 /* string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = string.c; sourceTree = ""; }; - B0056D2211F3868000754B65 /* strtol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strtol.c; sourceTree = ""; }; - B0056D2311F3868000754B65 /* zalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zalloc.c; sourceTree = ""; }; - B0056D2511F3868000754B65 /* acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = ""; }; - B0056D2611F3868000754B65 /* acpi_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_patcher.c; sourceTree = ""; }; - B0056D2711F3868000754B65 /* acpi_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_patcher.h; sourceTree = ""; }; - B0056D2811F3868000754B65 /* allocate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = allocate.c; sourceTree = ""; }; - B0056D2911F3868000754B65 /* asm.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = asm.s; sourceTree = ""; }; - B0056D2A11F3868000754B65 /* ati.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ati.c; sourceTree = ""; }; - B0056D2B11F3868000754B65 /* ati.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ati.h; sourceTree = ""; }; - B0056D2C11F3868000754B65 /* bios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bios.h; sourceTree = ""; }; - B0056D2D11F3868000754B65 /* bios.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bios.s; sourceTree = ""; }; - B0056D2E11F3868000754B65 /* biosfn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = biosfn.c; sourceTree = ""; }; - B0056D2F11F3868000754B65 /* bootstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bootstruct.c; sourceTree = ""; }; - B0056D3011F3868000754B65 /* bootstruct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootstruct.h; sourceTree = ""; }; - B0056D3111F3868000754B65 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = ""; }; - B0056D3211F3868000754B65 /* console.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = console.c; sourceTree = ""; }; - B0056D3311F3868000754B65 /* convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = convert.c; sourceTree = ""; }; - B0056D3411F3868000754B65 /* convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert.h; sourceTree = ""; }; - B0056D3511F3868000754B65 /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu.c; sourceTree = ""; }; - B0056D3611F3868000754B65 /* cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = ""; }; - B0056D3711F3868000754B65 /* device_inject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_inject.c; sourceTree = ""; }; - B0056D3811F3868000754B65 /* device_inject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_inject.h; sourceTree = ""; }; - B0056D3911F3868000754B65 /* device_tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_tree.c; sourceTree = ""; }; - B0056D3A11F3868000754B65 /* device_tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_tree.h; sourceTree = ""; }; - B0056D3B11F3868000754B65 /* disk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = disk.c; sourceTree = ""; }; - B0056D3C11F3868000754B65 /* efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi.h; sourceTree = ""; }; - B0056D3D11F3868000754B65 /* ext2fs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ext2fs.c; sourceTree = ""; }; - B0056D3E11F3868000754B65 /* ext2fs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ext2fs.h; sourceTree = ""; }; - B0056D3F11F3868000754B65 /* fake_efi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fake_efi.c; sourceTree = ""; }; - B0056D4011F3868000754B65 /* fake_efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fake_efi.h; sourceTree = ""; }; - B0056D4111F3868000754B65 /* fdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fdisk.h; sourceTree = ""; }; - B0056D4211F3868000754B65 /* hfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hfs.c; sourceTree = ""; }; - B0056D4311F3868000754B65 /* hfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hfs.h; sourceTree = ""; }; - B0056D4411F3868000754B65 /* hfs_CaseTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hfs_CaseTables.h; sourceTree = ""; }; - B0056D4511F3868000754B65 /* hfs_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hfs_compare.c; sourceTree = ""; }; - B0056D4611F3868000754B65 /* hpet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hpet.c; sourceTree = ""; }; - B0056D4711F3868000754B65 /* hpet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hpet.h; sourceTree = ""; }; - B0056D4811F3868000754B65 /* io_inline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io_inline.h; sourceTree = ""; }; - B0056D4911F3868000754B65 /* libsaio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsaio.h; sourceTree = ""; }; - B0056D4A11F3868000754B65 /* load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load.c; sourceTree = ""; }; - B0056D4B11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056D4C11F3868000754B65 /* md5c.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5c.c; sourceTree = ""; }; - B0056D4D11F3868000754B65 /* mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mem.c; sourceTree = ""; }; - B0056D4E11F3868000754B65 /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = ""; }; - B0056D4F11F3868000754B65 /* memvendors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memvendors.h; sourceTree = ""; }; - B0056D5011F3868000754B65 /* misc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = misc.c; sourceTree = ""; }; - B0056D5111F3868000754B65 /* msdos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msdos.c; sourceTree = ""; }; - B0056D5211F3868000754B65 /* msdos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msdos.h; sourceTree = ""; }; - B0056D5311F3868000754B65 /* msdos_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msdos_private.h; sourceTree = ""; }; - B0056D5411F3868000754B65 /* nbp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nbp.c; sourceTree = ""; }; - B0056D5511F3868000754B65 /* nbp_cmd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nbp_cmd.h; sourceTree = ""; }; - B0056D5611F3868000754B65 /* ntfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ntfs.c; sourceTree = ""; }; - B0056D5711F3868000754B65 /* ntfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntfs.h; sourceTree = ""; }; - B0056D5811F3868000754B65 /* ntfs_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntfs_private.h; sourceTree = ""; }; - B0056D5911F3868000754B65 /* nvidia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nvidia.c; sourceTree = ""; }; - B0056D5A11F3868000754B65 /* nvidia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nvidia.h; sourceTree = ""; }; - B0056D5B11F3868000754B65 /* pci.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci.c; sourceTree = ""; }; - B0056D5C11F3868000754B65 /* pci.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pci.h; sourceTree = ""; }; - B0056D5D11F3868000754B65 /* pci_root.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci_root.c; sourceTree = ""; }; - B0056D5E11F3868000754B65 /* pci_root.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pci_root.h; sourceTree = ""; }; - B0056D5F11F3868000754B65 /* pci_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci_setup.c; sourceTree = ""; }; - B0056D6011F3868000754B65 /* platform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = platform.c; sourceTree = ""; }; - B0056D6111F3868000754B65 /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = ""; }; - B0056D6211F3868000754B65 /* saio_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saio_internal.h; sourceTree = ""; }; - B0056D6311F3868000754B65 /* saio_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saio_types.h; sourceTree = ""; }; - B0056D6411F3868000754B65 /* sl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sl.h; sourceTree = ""; }; - B0056D6511F3868000754B65 /* SMBIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SMBIOS.h; sourceTree = ""; }; - B0056D6611F3868000754B65 /* smbios_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios_patcher.c; sourceTree = ""; }; - B0056D6711F3868000754B65 /* smbios_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smbios_patcher.h; sourceTree = ""; }; - B0056D6811F3868000754B65 /* spd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spd.c; sourceTree = ""; }; - B0056D6911F3868000754B65 /* spd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spd.h; sourceTree = ""; }; - B0056D6A11F3868000754B65 /* stringTable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stringTable.c; sourceTree = ""; }; - B0056D6B11F3868000754B65 /* sys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sys.c; sourceTree = ""; }; - B0056D6C11F3868000754B65 /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = ""; }; - B0056D6D11F3868000754B65 /* ufs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ufs.c; sourceTree = ""; }; - B0056D6E11F3868000754B65 /* ufs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ufs.h; sourceTree = ""; }; - B0056D6F11F3868000754B65 /* ufs_byteorder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ufs_byteorder.c; sourceTree = ""; }; - B0056D7011F3868000754B65 /* ufs_byteorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ufs_byteorder.h; sourceTree = ""; }; - B0056D7111F3868000754B65 /* usb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = usb.c; sourceTree = ""; }; - B0056D7211F3868000754B65 /* vbe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vbe.c; sourceTree = ""; }; - B0056D7311F3868000754B65 /* vbe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vbe.h; sourceTree = ""; }; - B0056D7411F3868000754B65 /* xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = ""; }; - B0056D7511F3868000754B65 /* xml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = ""; }; - B0056D7611F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056D7711F3868000754B65 /* MakeInc.dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MakeInc.dir; sourceTree = ""; }; - B0056D7811F3868000754B65 /* MakePaths.dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MakePaths.dir; sourceTree = ""; }; - B0056D7A11F3868000754B65 /* machOconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = machOconv.c; sourceTree = ""; }; - B0056D7B11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; B0056D7C11F3868000754B65 /* TODO */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TODO; sourceTree = ""; }; B0056D7D11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; B0056D7F11F3868000754B65 /* CREDITS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CREDITS; sourceTree = ""; }; @@ -298,10 +436,7 @@ B0056E1811F3868000754B65 /* screen_format.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screen_format.png; sourceTree = ""; }; B0056E1911F3868000754B65 /* xnulogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = xnulogo.png; sourceTree = ""; }; B0056E1A11F3868000754B65 /* Users_Guide0.5.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Users_Guide0.5.pdf; sourceTree = ""; }; - B00F494911F6089500B1D7C5 /* aml_generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aml_generator.h; sourceTree = ""; }; - B00F494A11F6089500B1D7C5 /* aml_generator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aml_generator.c; sourceTree = ""; }; B0146EFF11FDEF550010765C /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; - B0146F0011FDEFB90010765C /* GPL_V2_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL_V2_LICENSE; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ @@ -310,15 +445,13 @@ children = ( B0056DBA11F3868000754B65 /* artwork */, B0056E0611F3868000754B65 /* doc */, - B0056CE511F3868000754B65 /* i386 */, + AB43B2B514C37E520018D529 /* i386 */, B0056D8311F3868000754B65 /* package */, B0056CD411F3868000754B65 /* sym */, B0056D8211F3868000754B65 /* APPLE_LICENSE */, B0056D7F11F3868000754B65 /* CREDITS */, B0056D8111F3868000754B65 /* CHANGES */, - B0146F0011FDEFB90010765C /* GPL_V2_LICENSE */, B0146EFF11FDEF550010765C /* README */, - 019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */, B0056D7C11F3868000754B65 /* TODO */, B0056D7D11F3868000754B65 /* Makefile */, B0056D8011F3868000754B65 /* coding_standards.txt */, @@ -326,256 +459,569 @@ name = Chameleon; sourceTree = ""; }; - B0056CD411F3868000754B65 /* sym */ = { + AB43B2B514C37E520018D529 /* i386 */ = { isa = PBXGroup; children = ( - B0056CD511F3868000754B65 /* i386 */, + AB43B2B614C37E520018D529 /* boot0 */, + AB43B2BB14C37E520018D529 /* boot1 */, + AB43B2C214C37E520018D529 /* boot2 */, + AB43B2D714C37E520018D529 /* cdboot */, + AB43B2DB14C37E520018D529 /* doc */, + AB43B2DE14C37E520018D529 /* libsa */, + AB43B2ED14C37E520018D529 /* libsaio */, + AB43B34514C37E520018D529 /* Makefile */, + AB43B34614C37E520018D529 /* MakeInc.dir */, + AB43B34714C37E520018D529 /* MakePaths.dir */, + AB43B34814C37E520018D529 /* modules */, + AB43B3D914C37E520018D529 /* util */, ); - path = sym; + path = i386; sourceTree = ""; }; - B0056CD511F3868000754B65 /* i386 */ = { + AB43B2B614C37E520018D529 /* boot0 */ = { isa = PBXGroup; children = ( - B0056CD611F3868000754B65 /* boot */, - B0056CD711F3868000754B65 /* boot.sys */, - B0056CD811F3868000754B65 /* boot0 */, - B0056CD911F3868000754B65 /* boot0hfs */, - B0056CDA11F3868000754B65 /* boot1f32 */, - B0056CDB11F3868000754B65 /* boot1h */, - B0056CDC11F3868000754B65 /* boot1he */, - B0056CDD11F3868000754B65 /* boot1hp */, - B0056CDE11F3868000754B65 /* cdboot */, - B0056CDF11F3868000754B65 /* chain0 */, - B0056CE011F3868000754B65 /* embedded.h */, - B0056CE111F3868000754B65 /* libsa.a */, - B0056CE211F3868000754B65 /* libsaio.a */, - B0056CE311F3868000754B65 /* machOconv */, - B0056CE411F3868000754B65 /* vers.h */, + AB43B2B714C37E520018D529 /* boot0.s */, + AB43B2B814C37E520018D529 /* boot0md.s */, + AB43B2B914C37E520018D529 /* chain0.s */, + AB43B2BA14C37E520018D529 /* Makefile */, ); - path = i386; + path = boot0; sourceTree = ""; }; - B0056CE511F3868000754B65 /* i386 */ = { + AB43B2BB14C37E520018D529 /* boot1 */ = { isa = PBXGroup; children = ( - B0056CE611F3868000754B65 /* boot0 */, - B0056CEA11F3868000754B65 /* boot1 */, - B0056CF211F3868000754B65 /* boot2 */, - B0056D0F11F3868000754B65 /* cdboot */, - B0056D1311F3868000754B65 /* doc */, - B0056D1611F3868000754B65 /* libsa */, - B0056D2411F3868000754B65 /* libsaio */, - B0056D7911F3868000754B65 /* util */, - B0056D7611F3868000754B65 /* Makefile */, - B0056D7711F3868000754B65 /* MakeInc.dir */, - B0056D7811F3868000754B65 /* MakePaths.dir */, + AB43B2BC14C37E520018D529 /* boot1f32-install.sh */, + AB43B2BD14C37E520018D529 /* boot1f32.s */, + AB43B2BE14C37E520018D529 /* boot1h.s */, + AB43B2BF14C37E520018D529 /* boot1he.s */, + AB43B2C014C37E520018D529 /* boot1hp.s */, + AB43B2C114C37E520018D529 /* Makefile */, ); - path = i386; + path = boot1; sourceTree = ""; }; - B0056CE611F3868000754B65 /* boot0 */ = { + AB43B2C214C37E520018D529 /* boot2 */ = { isa = PBXGroup; children = ( - B0056CE711F3868000754B65 /* boot0.s */, - B0056CE811F3868000754B65 /* chain0.s */, - B0056CE911F3868000754B65 /* Makefile */, + AB43B2C314C37E520018D529 /* appleboot.h */, + AB43B2C414C37E520018D529 /* appleClut8.h */, + AB43B2C514C37E520018D529 /* boot.c */, + AB43B2C614C37E520018D529 /* boot.h */, + AB43B2C714C37E520018D529 /* boot2.s */, + AB43B2C814C37E520018D529 /* drivers.c */, + AB43B2C914C37E520018D529 /* drivers.h */, + AB43B2CA14C37E520018D529 /* failedboot.h */, + AB43B2CB14C37E520018D529 /* graphics.c */, + AB43B2CC14C37E520018D529 /* graphics.h */, + AB43B2CD14C37E520018D529 /* lzss.c */, + AB43B2CE14C37E520018D529 /* Makefile */, + AB43B2CF14C37E520018D529 /* mboot.c */, + AB43B2D014C37E520018D529 /* mboot.h */, + AB43B2D114C37E520018D529 /* modules.c */, + AB43B2D214C37E520018D529 /* modules.h */, + AB43B2D314C37E520018D529 /* multiboot.h */, + AB43B2D414C37E520018D529 /* options.c */, + AB43B2D514C37E520018D529 /* options.h */, + AB43B2D614C37E520018D529 /* prompt.c */, ); - path = boot0; + path = boot2; sourceTree = ""; }; - B0056CEA11F3868000754B65 /* boot1 */ = { + AB43B2D714C37E520018D529 /* cdboot */ = { isa = PBXGroup; children = ( - B0056CEB11F3868000754B65 /* boot1.asm */, - B0056CEC11F3868000754B65 /* boot1.s */, - B0056CED11F3868000754B65 /* boot1f32-install.sh */, - B0056CEE11F3868000754B65 /* boot1f32.s */, - B0056CEF11F3868000754B65 /* boot1he.s */, - B0056CF011F3868000754B65 /* boot1hp.s */, - B0056CF111F3868000754B65 /* Makefile */, + AB43B2D814C37E520018D529 /* cdboot.s */, + AB43B2D914C37E520018D529 /* cdboothdd.s */, + AB43B2DA14C37E520018D529 /* Makefile */, ); - path = boot1; + path = cdboot; sourceTree = ""; }; - B0056CF211F3868000754B65 /* boot2 */ = { + AB43B2DB14C37E520018D529 /* doc */ = { isa = PBXGroup; children = ( - B0056CF311F3868000754B65 /* appleboot.h */, - B0056CF411F3868000754B65 /* appleClut8.h */, - B0056CF511F3868000754B65 /* bmdecompress.c */, - B0056CF611F3868000754B65 /* boot.c */, - B0056CF711F3868000754B65 /* boot.h */, - B0056CF811F3868000754B65 /* boot2.s */, - B0056CF911F3868000754B65 /* drivers.c */, - B0056CFA11F3868000754B65 /* graphic_utils.c */, - B0056CFB11F3868000754B65 /* graphic_utils.h */, - B0056CFC11F3868000754B65 /* graphics.c */, - B0056CFD11F3868000754B65 /* graphics.h */, - B0056CFE11F3868000754B65 /* gui.c */, - B0056CFF11F3868000754B65 /* gui.h */, - B0056D0011F3868000754B65 /* IOHibernatePrivate.h */, - B0056D0111F3868000754B65 /* lzss.c */, - B0056D0211F3868000754B65 /* Makefile */, - B0056D0311F3868000754B65 /* mboot.c */, - B0056D0411F3868000754B65 /* mboot.h */, - B0056D0511F3868000754B65 /* multiboot.h */, - B0056D0611F3868000754B65 /* options.c */, - B0056D0711F3868000754B65 /* picopng.c */, - B0056D0811F3868000754B65 /* picopng.h */, - B0056D0911F3868000754B65 /* prompt.c */, - B0056D0A11F3868000754B65 /* ramdisk.c */, - B0056D0B11F3868000754B65 /* ramdisk.h */, - B0056D0C11F3868000754B65 /* resume.c */, - B0056D0D11F3868000754B65 /* WKdm.h */, - B0056D0E11F3868000754B65 /* WKdmDecompress.c */, + AB43B2DC14C37E520018D529 /* Limits */, + AB43B2DD14C37E520018D529 /* README */, ); - path = boot2; + path = doc; sourceTree = ""; }; - B0056D0F11F3868000754B65 /* cdboot */ = { + AB43B2DE14C37E520018D529 /* libsa */ = { isa = PBXGroup; children = ( - B0056D1011F3868000754B65 /* cdboot.s */, - B0056D1111F3868000754B65 /* cdboothdd.s */, - B0056D1211F3868000754B65 /* Makefile */, + AB43B3EC14C383120018D529 /* bcopy.s */, + AB43B3ED14C383120018D529 /* bzero.s */, + AB43B3EE14C383120018D529 /* divdi3.c */, + AB43B3EF14C383120018D529 /* moddi3.c */, + AB43B3F014C383120018D529 /* qdivrem.c */, + AB43B3F114C383120018D529 /* quad.h */, + AB43B3F214C383120018D529 /* udivdi3.c */, + AB43B3F314C383120018D529 /* umoddi3.c */, + AB43B2DF14C37E520018D529 /* efi_tables.c */, + AB43B2E014C37E520018D529 /* efi_tables.h */, + AB43B2E114C37E520018D529 /* error.c */, + AB43B2E214C37E520018D529 /* libsa.h */, + AB43B2E314C37E520018D529 /* Makefile */, + AB43B2E414C37E520018D529 /* memory.h */, + AB43B2E514C37E520018D529 /* prf.c */, + AB43B2E614C37E520018D529 /* printf.c */, + AB43B2E714C37E520018D529 /* qsort.c */, + AB43B2E814C37E520018D529 /* rand.c */, + AB43B2E914C37E520018D529 /* setjmp.s */, + AB43B2EA14C37E520018D529 /* string.c */, + AB43B2EB14C37E520018D529 /* strtol.c */, + AB43B2EC14C37E520018D529 /* zalloc.c */, ); - path = cdboot; + path = libsa; sourceTree = ""; }; - B0056D1311F3868000754B65 /* doc */ = { + AB43B2ED14C37E520018D529 /* libsaio */ = { isa = PBXGroup; children = ( - B0056D1411F3868000754B65 /* Limits */, - B0056D1511F3868000754B65 /* README */, + AB43B2EE14C37E520018D529 /* acpi.h */, + AB43B2EF14C37E520018D529 /* acpi_tools.c */, + AB43B2F014C37E520018D529 /* acpi_tools.h */, + AB43B2F114C37E520018D529 /* allocate.c */, + AB43B2F214C37E520018D529 /* apic.h */, + AB43B42A14C3A8080018D529 /* arc4random.c */, + AB43B2F314C37E520018D529 /* asm.s */, + AB43B2F414C37E520018D529 /* befs.c */, + AB43B2F514C37E520018D529 /* befs.h */, + AB43B2F614C37E520018D529 /* bios.h */, + AB43B2F714C37E520018D529 /* bios.s */, + AB43B2F814C37E520018D529 /* biosfn.c */, + AB43B2F914C37E520018D529 /* bootLion.h */, + AB43B2FA14C37E520018D529 /* bootstruct.c */, + AB43B2FB14C37E520018D529 /* bootstruct.h */, + AB43B2FC14C37E520018D529 /* cache.c */, + AB43B2FD14C37E520018D529 /* console.c */, + AB43B2FE14C37E520018D529 /* convert.c */, + AB43B2FF14C37E520018D529 /* convert.h */, + AB43B30014C37E520018D529 /* cpu.c */, + AB43B30114C37E520018D529 /* cpu.h */, + AB0E930C14C6223500F798D7 /* cpu_intel_amd.c */, + AB43B30214C37E520018D529 /* cpu_data.h */, + AB43B30314C37E520018D529 /* cpuid.h */, + AB43B30414C37E520018D529 /* datatype.h */, + AB43B30514C37E520018D529 /* device_inject.c */, + AB43B30614C37E520018D529 /* device_inject.h */, + AB43B30714C37E520018D529 /* device_tree.c */, + AB43B30814C37E520018D529 /* device_tree.h */, + AB43B30914C37E520018D529 /* disk.c */, + AB43B30A14C37E520018D529 /* disk.h */, + AB43B30B14C37E520018D529 /* efi.h */, + AB43B30C14C37E520018D529 /* exfat.c */, + AB43B30D14C37E520018D529 /* exfat.h */, + AB43B30E14C37E520018D529 /* ext2fs.c */, + AB43B30F14C37E520018D529 /* ext2fs.h */, + AB43B31014C37E520018D529 /* fake_efi.c */, + AB43B31114C37E520018D529 /* fake_efi.h */, + AB43B31214C37E520018D529 /* fdisk.h */, + AB43B31314C37E520018D529 /* freebsd.c */, + AB43B31414C37E520018D529 /* freebsd.h */, + AB43B31514C37E520018D529 /* hfs.c */, + AB43B31614C37E520018D529 /* hfs.h */, + AB43B31714C37E520018D529 /* hfs_CaseTables.h */, + AB43B31814C37E520018D529 /* hfs_compare.c */, + AB43B31914C37E520018D529 /* intel_acpi.h */, + AB43B31A14C37E520018D529 /* internal_modules.h */, + AB43B31B14C37E520018D529 /* io_inline.h */, + AB43B31C14C37E520018D529 /* libsaio.h */, + AB43B31D14C37E520018D529 /* load.c */, + AB43B31E14C37E520018D529 /* Makefile */, + AB43B31F14C37E520018D529 /* md5c.c */, + AB43B32014C37E520018D529 /* misc.c */, + AB43B32114C37E520018D529 /* msdos.c */, + AB43B32214C37E520018D529 /* msdos.h */, + AB43B32314C37E520018D529 /* msdos_private.h */, + AB43B32414C37E520018D529 /* nbp.c */, + AB43B32514C37E520018D529 /* nbp_cmd.h */, + AB43B32614C37E520018D529 /* ntfs.c */, + AB43B32714C37E520018D529 /* ntfs.h */, + AB43B32814C37E520018D529 /* ntfs_private.h */, + AB43B32914C37E520018D529 /* openbsd.c */, + AB43B32A14C37E520018D529 /* openbsd.h */, + AB43B32B14C37E520018D529 /* pci.c */, + AB43B32C14C37E520018D529 /* pci.h */, + AB43B32D14C37E520018D529 /* pci_root.c */, + AB43B32E14C37E520018D529 /* pci_root.h */, + AB43B32F14C37E520018D529 /* platform.c */, + AB43B33014C37E520018D529 /* platform.h */, + AB43B33114C37E520018D529 /* ppm.h */, + AB43B33214C37E520018D529 /* ppmsetup.h */, + AB43B33314C37E520018D529 /* saio_internal.h */, + AB43B33414C37E520018D529 /* saio_types.h */, + AB43B33514C37E520018D529 /* sl.h */, + AB43B33614C37E520018D529 /* smbios.c */, + AB43B33714C37E520018D529 /* SMBIOS.h */, + AB43B3F814C384040018D529 /* stack_protector.c */, + AB43B33814C37E520018D529 /* smp-imps.c */, + AB43B33914C37E520018D529 /* smp-imps.h */, + AB43B33A14C37E520018D529 /* stringTable.c */, + AB43B33B14C37E520018D529 /* sys.c */, + AB43B33C14C37E520018D529 /* table.c */, + AB43B33D14C37E520018D529 /* ufs.c */, + AB43B33E14C37E520018D529 /* ufs.h */, + AB43B33F14C37E520018D529 /* ufs_byteorder.c */, + AB43B34014C37E520018D529 /* ufs_byteorder.h */, + AB43B34114C37E520018D529 /* vbe.c */, + AB43B34214C37E520018D529 /* vbe.h */, + AB43B34314C37E520018D529 /* xml.c */, + AB43B34414C37E520018D529 /* xml.h */, ); - path = doc; + path = libsaio; sourceTree = ""; }; - B0056D1611F3868000754B65 /* libsa */ = { + AB43B34814C37E520018D529 /* modules */ = { isa = PBXGroup; children = ( - B0056D1711F3868000754B65 /* efi_tables.c */, - B0056D1811F3868000754B65 /* efi_tables.h */, - B0056D1911F3868000754B65 /* error.c */, - B0056D1A11F3868000754B65 /* libsa.h */, - B0056D1B11F3868000754B65 /* Makefile */, - B0056D1C11F3868000754B65 /* memory.h */, - B0056D1D11F3868000754B65 /* prf.c */, - B0056D1E11F3868000754B65 /* printf.c */, - B0056D1F11F3868000754B65 /* qsort.c */, - B0056D2011F3868000754B65 /* setjmp.s */, - B0056D2111F3868000754B65 /* string.c */, - B0056D2211F3868000754B65 /* strtol.c */, - B0056D2311F3868000754B65 /* zalloc.c */, + AB43B34914C37E520018D529 /* ACPICodec */, + AB43B35214C37E520018D529 /* ACPIPatcher */, + AB43B35914C37E520018D529 /* CPUfreq */, + AB43B35C14C37E520018D529 /* GraphicsEnabler */, + AB43B36614C37E520018D529 /* GUI */, + AB43B37014C37E520018D529 /* HelloWorld */, + AB43B37314C37E520018D529 /* HibernateEnabler */, + AB43B37D14C37E520018D529 /* HPET */, + AB43B38114C37E520018D529 /* KernelPatcher */, + AB43B38514C37E520018D529 /* KextPatcher */, + AB43B39C14C37E520018D529 /* Keymapper */, + AB43B3A214C37E520018D529 /* Makefile */, + AB43B3A314C37E520018D529 /* Memory */, + AB43B3B014C37E520018D529 /* NetbookInstaller */, + AB43B3B314C37E520018D529 /* Networking */, + AB43B3B614C37E520018D529 /* RamDiskLoader */, + AB43B3BB14C37E520018D529 /* Resolution */, + AB43B3C314C37E520018D529 /* SMBiosGetters */, + AB43B3CC14C37E520018D529 /* SMBiosPatcher */, + AB43B3D214C37E520018D529 /* USBFix */, + AB43B3D614C37E520018D529 /* YellowIconFixer */, ); - path = libsa; + path = modules; sourceTree = ""; }; - B0056D2411F3868000754B65 /* libsaio */ = { + AB43B34914C37E520018D529 /* ACPICodec */ = { isa = PBXGroup; children = ( - B0056D2511F3868000754B65 /* acpi.h */, - B0056D2611F3868000754B65 /* acpi_patcher.c */, - B0056D2711F3868000754B65 /* acpi_patcher.h */, - B0056D2811F3868000754B65 /* allocate.c */, - B00F494A11F6089500B1D7C5 /* aml_generator.c */, - B00F494911F6089500B1D7C5 /* aml_generator.h */, - B0056D2911F3868000754B65 /* asm.s */, - B0056D2A11F3868000754B65 /* ati.c */, - B0056D2B11F3868000754B65 /* ati.h */, - B0056D2C11F3868000754B65 /* bios.h */, - B0056D2D11F3868000754B65 /* bios.s */, - B0056D2E11F3868000754B65 /* biosfn.c */, - 1D145307137073F40050C0CD /* bootargs.h */, - B0056D2F11F3868000754B65 /* bootstruct.c */, - B0056D3011F3868000754B65 /* bootstruct.h */, - B0056D3111F3868000754B65 /* cache.c */, - B0056D3211F3868000754B65 /* console.c */, - B0056D3311F3868000754B65 /* convert.c */, - B0056D3411F3868000754B65 /* convert.h */, - B0056D3511F3868000754B65 /* cpu.c */, - B0056D3611F3868000754B65 /* cpu.h */, - B0056D3711F3868000754B65 /* device_inject.c */, - B0056D3811F3868000754B65 /* device_inject.h */, - B0056D3911F3868000754B65 /* device_tree.c */, - B0056D3A11F3868000754B65 /* device_tree.h */, - B0056D3B11F3868000754B65 /* disk.c */, - 65ED53931204B83200B22507 /* disk.h */, - 0172D0DC11FB66820030222E /* dram_controllers.h */, - 0172D0DD11FB66820030222E /* dram_controllers.c */, - B0056D3C11F3868000754B65 /* efi.h */, - B0056D3D11F3868000754B65 /* ext2fs.c */, - B0056D3E11F3868000754B65 /* ext2fs.h */, - B0056D3F11F3868000754B65 /* fake_efi.c */, - B0056D4011F3868000754B65 /* fake_efi.h */, - B0056D4111F3868000754B65 /* fdisk.h */, - B0056D4211F3868000754B65 /* hfs.c */, - B0056D4311F3868000754B65 /* hfs.h */, - B0056D4411F3868000754B65 /* hfs_CaseTables.h */, - B0056D4511F3868000754B65 /* hfs_compare.c */, - B0056D4611F3868000754B65 /* hpet.c */, - B0056D4711F3868000754B65 /* hpet.h */, - B0056D4811F3868000754B65 /* io_inline.h */, - B0056D4911F3868000754B65 /* libsaio.h */, - B0056D4A11F3868000754B65 /* load.c */, - B0056D4B11F3868000754B65 /* Makefile */, - B0056D4C11F3868000754B65 /* md5c.c */, - B0056D4D11F3868000754B65 /* mem.c */, - B0056D4E11F3868000754B65 /* mem.h */, - B0056D4F11F3868000754B65 /* memvendors.h */, - B0056D5011F3868000754B65 /* misc.c */, - B0056D5111F3868000754B65 /* msdos.c */, - B0056D5211F3868000754B65 /* msdos.h */, - B0056D5311F3868000754B65 /* msdos_private.h */, - B0056D5411F3868000754B65 /* nbp.c */, - B0056D5511F3868000754B65 /* nbp_cmd.h */, - B0056D5611F3868000754B65 /* ntfs.c */, - B0056D5711F3868000754B65 /* ntfs.h */, - B0056D5811F3868000754B65 /* ntfs_private.h */, - B0056D5911F3868000754B65 /* nvidia.c */, - B0056D5A11F3868000754B65 /* nvidia.h */, - B0056D5B11F3868000754B65 /* pci.c */, - B0056D5C11F3868000754B65 /* pci.h */, - B0056D5D11F3868000754B65 /* pci_root.c */, - B0056D5E11F3868000754B65 /* pci_root.h */, - B0056D5F11F3868000754B65 /* pci_setup.c */, - B0056D6011F3868000754B65 /* platform.c */, - B0056D6111F3868000754B65 /* platform.h */, - B0056D6211F3868000754B65 /* saio_internal.h */, - B0056D6311F3868000754B65 /* saio_types.h */, - B0056D6411F3868000754B65 /* sl.h */, - B0056D6511F3868000754B65 /* SMBIOS.h */, - B0056D6611F3868000754B65 /* smbios_patcher.c */, - B0056D6711F3868000754B65 /* smbios_patcher.h */, - B0056D6811F3868000754B65 /* spd.c */, - B0056D6911F3868000754B65 /* spd.h */, - B0056D6A11F3868000754B65 /* stringTable.c */, - B0056D6B11F3868000754B65 /* sys.c */, - B0056D6C11F3868000754B65 /* table.c */, - B0056D6D11F3868000754B65 /* ufs.c */, - B0056D6E11F3868000754B65 /* ufs.h */, - B0056D6F11F3868000754B65 /* ufs_byteorder.c */, - B0056D7011F3868000754B65 /* ufs_byteorder.h */, - B0056D7111F3868000754B65 /* usb.c */, - B0056D7211F3868000754B65 /* vbe.c */, - B0056D7311F3868000754B65 /* vbe.h */, - B0056D7411F3868000754B65 /* xml.c */, - B0056D7511F3868000754B65 /* xml.h */, - 1D2A1AF513743A2600787720 /* bootargs.h */, + AB43B34A14C37E520018D529 /* acpi_codec.c */, + AB43B34B14C37E520018D529 /* acpi_codec.h */, + AB43B34C14C37E520018D529 /* acpicode.c */, + AB43B34D14C37E520018D529 /* acpicode.h */, + AB43B34E14C37E520018D529 /* ACPICodec.c */, + AB43B34F14C37E520018D529 /* acpidecode.c */, + AB43B35014C37E520018D529 /* acpidecode.h */, + AB43B35114C37E520018D529 /* Makefile */, ); - path = libsaio; + path = ACPICodec; sourceTree = ""; }; - B0056D7911F3868000754B65 /* util */ = { + AB43B35214C37E520018D529 /* ACPIPatcher */ = { isa = PBXGroup; children = ( - B0056D7A11F3868000754B65 /* machOconv.c */, - B0056D7B11F3868000754B65 /* Makefile */, + AB43B35314C37E520018D529 /* acpi_patcher.c */, + AB43B35414C37E520018D529 /* acpi_patcher.h */, + AB43B35514C37E520018D529 /* AcpiPatcher.c */, + AB43B35614C37E520018D529 /* aml_generator.c */, + AB43B35714C37E520018D529 /* aml_generator.h */, + AB43B35814C37E520018D529 /* Makefile */, ); + path = ACPIPatcher; + sourceTree = ""; + }; + AB43B35914C37E520018D529 /* CPUfreq */ = { + isa = PBXGroup; + children = ( + AB43B35A14C37E520018D529 /* CPUfreq.c */, + AB43B35B14C37E520018D529 /* Makefile */, + ); + path = CPUfreq; + sourceTree = ""; + }; + AB43B35C14C37E520018D529 /* GraphicsEnabler */ = { + isa = PBXGroup; + children = ( + AB43B35D14C37E520018D529 /* ati.c */, + AB43B35E14C37E520018D529 /* ati.h */, + AB43B35F14C37E520018D529 /* ati_reg.h */, + AB43B36014C37E520018D529 /* gma.c */, + AB43B36114C37E520018D529 /* gma.h */, + AB43B36214C37E520018D529 /* GraphicsEnabler.c */, + AB43B36314C37E520018D529 /* Makefile */, + AB43B36414C37E520018D529 /* nvidia.c */, + AB43B36514C37E520018D529 /* nvidia.h */, + ); + path = GraphicsEnabler; + sourceTree = ""; + }; + AB43B36614C37E520018D529 /* GUI */ = { + isa = PBXGroup; + children = ( + AB43B36714C37E520018D529 /* graphic_utils.c */, + AB43B36814C37E520018D529 /* graphic_utils.h */, + AB43B36914C37E520018D529 /* gui.c */, + AB43B36A14C37E520018D529 /* gui.h */, + AB43B36B14C37E520018D529 /* GUI_appleboot.h */, + AB43B36C14C37E520018D529 /* GUI_module.c */, + AB43B36D14C37E520018D529 /* Makefile */, + AB43B36E14C37E520018D529 /* picopng.c */, + AB43B36F14C37E520018D529 /* picopng.h */, + ); + path = GUI; + sourceTree = ""; + }; + AB43B37014C37E520018D529 /* HelloWorld */ = { + isa = PBXGroup; + children = ( + AB43B37114C37E520018D529 /* HelloWorld.c */, + AB43B37214C37E520018D529 /* Makefile */, + ); + path = HelloWorld; + sourceTree = ""; + }; + AB43B37314C37E520018D529 /* HibernateEnabler */ = { + isa = PBXGroup; + children = ( + AB43B37414C37E520018D529 /* bmdecompress.c */, + AB43B37514C37E520018D529 /* bmdecompress.h */, + AB43B37614C37E520018D529 /* graphic_utils.c */, + AB43B37714C37E520018D529 /* graphic_utils.h */, + AB43B37814C37E520018D529 /* HibernateEnabler.c */, + AB43B37914C37E520018D529 /* IOHibernatePrivate.h */, + AB43B37A14C37E520018D529 /* Makefile */, + AB43B37B14C37E520018D529 /* resume.c */, + AB43B37C14C37E520018D529 /* resume.h */, + ); + path = HibernateEnabler; + sourceTree = ""; + }; + AB43B37D14C37E520018D529 /* HPET */ = { + isa = PBXGroup; + children = ( + AB43B37E14C37E520018D529 /* HPET.c */, + AB43B37F14C37E520018D529 /* hpet.h */, + AB43B38014C37E520018D529 /* Makefile */, + ); + path = HPET; + sourceTree = ""; + }; + AB43B38114C37E520018D529 /* KernelPatcher */ = { + isa = PBXGroup; + children = ( + AB43B38214C37E520018D529 /* kernel_patcher.c */, + AB43B38314C37E520018D529 /* kernel_patcher.h */, + AB43B38414C37E520018D529 /* Makefile */, + ); + path = KernelPatcher; + sourceTree = ""; + }; + AB43B38514C37E520018D529 /* KextPatcher */ = { + isa = PBXGroup; + children = ( + AB43B38614C37E520018D529 /* adler32.c */, + AB43B38714C37E520018D529 /* deflate.c */, + AB43B38814C37E520018D529 /* deflate.h */, + AB43B38914C37E520018D529 /* hex_editor.c */, + AB43B38A14C37E520018D529 /* hex_editor.h */, + AB43B38B14C37E520018D529 /* inffast.c */, + AB43B38C14C37E520018D529 /* inffast.h */, + AB43B38D14C37E520018D529 /* inffixed.h */, + AB43B38E14C37E520018D529 /* inflate.c */, + AB43B38F14C37E520018D529 /* inflate.h */, + AB43B39014C37E520018D529 /* inftrees.c */, + AB43B39114C37E520018D529 /* inftrees.h */, + AB43B39214C37E520018D529 /* kext_patcher.c */, + AB43B39314C37E520018D529 /* kext_patcher.h */, + AB43B39414C37E520018D529 /* Makefile */, + AB43B39514C37E520018D529 /* mkext.h */, + AB43B39614C37E520018D529 /* trees.c */, + AB43B39714C37E520018D529 /* trees.h */, + AB43B39814C37E520018D529 /* zconf.h */, + AB43B39914C37E520018D529 /* zlib.h */, + AB43B39A14C37E520018D529 /* zutil.c */, + AB43B39B14C37E520018D529 /* zutil.h */, + ); + path = KextPatcher; + sourceTree = ""; + }; + AB43B39C14C37E520018D529 /* Keymapper */ = { + isa = PBXGroup; + children = ( + AB43B39D14C37E520018D529 /* Keylayout.c */, + AB43B39E14C37E520018D529 /* Keylayout.h */, + AB43B39F14C37E520018D529 /* Keymapper.c */, + AB43B3A014C37E520018D529 /* Makefile */, + AB43B3A114C37E520018D529 /* term.h */, + ); + path = Keymapper; + sourceTree = ""; + }; + AB43B3A314C37E520018D529 /* Memory */ = { + isa = PBXGroup; + children = ( + AB43B3A414C37E520018D529 /* dram_controllers.c */, + AB43B3A514C37E520018D529 /* dram_controllers.h */, + AB43B3A614C37E520018D529 /* GPL_V2_LICENSE */, + AB43B3A714C37E520018D529 /* Makefile */, + AB43B3A814C37E520018D529 /* mem.c */, + AB43B3A914C37E520018D529 /* mem.h */, + AB43B3AA14C37E520018D529 /* Memory.c */, + AB43B3AB14C37E520018D529 /* MEMTEST86_LICENSE */, + AB43B3AC14C37E520018D529 /* memvendors.h */, + AB43B3AD14C37E520018D529 /* README */, + AB43B3AE14C37E520018D529 /* spd.c */, + AB43B3AF14C37E520018D529 /* spd.h */, + ); + path = Memory; + sourceTree = ""; + }; + AB43B3B014C37E520018D529 /* NetbookInstaller */ = { + isa = PBXGroup; + children = ( + AB43B3B114C37E520018D529 /* Makefile */, + AB43B3B214C37E520018D529 /* NBI.c */, + ); + path = NetbookInstaller; + sourceTree = ""; + }; + AB43B3B314C37E520018D529 /* Networking */ = { + isa = PBXGroup; + children = ( + AB43B3B414C37E520018D529 /* Makefile */, + AB43B3B514C37E520018D529 /* Networking.c */, + ); + path = Networking; + sourceTree = ""; + }; + AB43B3B614C37E520018D529 /* RamDiskLoader */ = { + isa = PBXGroup; + children = ( + AB43B3B714C37E520018D529 /* Makefile */, + AB43B3B814C37E520018D529 /* ramdisk.c */, + AB43B3B914C37E520018D529 /* ramdisk.h */, + AB43B3BA14C37E520018D529 /* RamDiskLoader.c */, + ); + path = RamDiskLoader; + sourceTree = ""; + }; + AB43B3BB14C37E520018D529 /* Resolution */ = { + isa = PBXGroup; + children = ( + AB43B3BC14C37E520018D529 /* 915resolution.c */, + AB43B3BD14C37E520018D529 /* 915resolution.h */, + AB43B3BE14C37E520018D529 /* edid.c */, + AB43B3BF14C37E520018D529 /* edid.h */, + AB43B3C014C37E520018D529 /* Makefile */, + AB43B3C114C37E520018D529 /* Resolution.c */, + AB43B3C214C37E520018D529 /* shortatombios.h */, + ); + path = Resolution; + sourceTree = ""; + }; + AB43B3C314C37E520018D529 /* SMBiosGetters */ = { + isa = PBXGroup; + children = ( + AB43B3C414C37E520018D529 /* Makefile */, + AB43B3C514C37E520018D529 /* mysmbios.c */, + AB43B3C614C37E520018D529 /* mysmbios.h */, + AB43B3C714C37E520018D529 /* README */, + AB43B3C814C37E520018D529 /* smbios_decode.c */, + AB43B3C914C37E520018D529 /* smbios_getters.c */, + AB43B3CA14C37E520018D529 /* smbios_getters.h */, + AB43B3CB14C37E520018D529 /* SMBiosGetters.c */, + ); + path = SMBiosGetters; + sourceTree = ""; + }; + AB43B3CC14C37E520018D529 /* SMBiosPatcher */ = { + isa = PBXGroup; + children = ( + AB43B3CD14C37E520018D529 /* Makefile */, + AB43B3CE14C37E520018D529 /* README */, + AB43B3CF14C37E520018D529 /* smbios_patcher.c */, + AB43B3D014C37E520018D529 /* smbios_patcher.h */, + AB43B3D114C37E520018D529 /* SMBiosPatcher.c */, + ); + path = SMBiosPatcher; + sourceTree = ""; + }; + AB43B3D214C37E520018D529 /* USBFix */ = { + isa = PBXGroup; + children = ( + AB43B3D314C37E520018D529 /* Makefile */, + AB43B3D414C37E520018D529 /* usb.c */, + AB43B3D514C37E520018D529 /* USBFix.c */, + ); + path = USBFix; + sourceTree = ""; + }; + AB43B3D614C37E520018D529 /* YellowIconFixer */ = { + isa = PBXGroup; + children = ( + AB43B3D714C37E520018D529 /* Makefile */, + AB43B3D814C37E520018D529 /* YellowIconFixer.c */, + ); + path = YellowIconFixer; + sourceTree = ""; + }; + AB43B3D914C37E520018D529 /* util */ = { + isa = PBXGroup; + children = ( + AB43B3DA14C37E520018D529 /* amlsgn.m */, + AB43B3DB14C37E520018D529 /* bdmesg.c */, + AB43B3DC14C37E530018D529 /* Intel_Acpi */, + AB43B3E214C37E530018D529 /* machOconv.c */, + AB43B3E314C37E530018D529 /* Makefile */, + AB43B3E414C37E530018D529 /* Symbols.c */, + AB43B3E514C37E530018D529 /* WKdm.h */, + AB43B3E614C37E530018D529 /* WKdmDecompress.c */, + ); path = util; sourceTree = ""; }; + AB43B3DC14C37E530018D529 /* Intel_Acpi */ = { + isa = PBXGroup; + children = ( + AB43B3DD14C37E530018D529 /* acpidecode.h */, + AB43B3DE14C37E530018D529 /* datatype.h */, + AB43B3DF14C37E530018D529 /* intel_acpi.h */, + AB43B3E014C37E530018D529 /* ppm.h */, + AB43B3E114C37E530018D529 /* ppmsetup.h */, + ); + path = Intel_Acpi; + sourceTree = ""; + }; + B0056CD411F3868000754B65 /* sym */ = { + isa = PBXGroup; + children = ( + B0056CD511F3868000754B65 /* i386 */, + ); + path = sym; + sourceTree = ""; + }; + B0056CD511F3868000754B65 /* i386 */ = { + isa = PBXGroup; + children = ( + B0056CD611F3868000754B65 /* boot */, + B0056CD711F3868000754B65 /* boot.sys */, + B0056CD811F3868000754B65 /* boot0 */, + B0056CD911F3868000754B65 /* boot0hfs */, + B0056CDA11F3868000754B65 /* boot1f32 */, + B0056CDB11F3868000754B65 /* boot1h */, + B0056CDC11F3868000754B65 /* boot1he */, + B0056CDD11F3868000754B65 /* boot1hp */, + B0056CDE11F3868000754B65 /* cdboot */, + B0056CDF11F3868000754B65 /* chain0 */, + B0056CE011F3868000754B65 /* embedded.h */, + B0056CE111F3868000754B65 /* libsa.a */, + B0056CE211F3868000754B65 /* libsaio.a */, + B0056CE311F3868000754B65 /* machOconv */, + B0056CE411F3868000754B65 /* vers.h */, + ); + path = i386; + sourceTree = ""; + }; B0056D8311F3868000754B65 /* package */ = { isa = PBXGroup; children = ( Index: branches/cparm/CHANGES =================================================================== --- branches/cparm/CHANGES (revision 1803) +++ branches/cparm/CHANGES (revision 1804) @@ -1,3 +1,9 @@ +- Added cpu_intel_amd.c (not by default, you need to edit the makefile in the libsaio directory to compile it) +- Implemented a stack_protector (seems to work) +- Sync'd libsa with Xnu +- Removed lcc_kext dependency from the make file +- Fixed some bugs + - Updated the default theme to v 1.1 (credit to blackosx) - Updated LogintoLion with he haiku device logo (credit to blackosx) - Updated for the gui Index: branches/cparm/i386/libsaio/console.c =================================================================== --- branches/cparm/i386/libsaio/console.c (revision 1803) +++ branches/cparm/i386/libsaio/console.c (revision 1804) @@ -68,11 +68,11 @@ void sputc(int c, struct putc_info * pi) { if (pi->last_str) - if (pi->str == pi->last_str) - { - *(pi->str) = '\0'; - return; - } + if (pi->str == pi->last_str) + { + *(pi->str) = '\0'; + return; + } *(pi->str)++ = c; } @@ -87,13 +87,13 @@ { va_list ap; struct putc_info pi; - + if (!msgbuf) return; - + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) return; - + va_start(ap, fmt); pi.str = cursor; pi.last_str = 0; @@ -106,7 +106,7 @@ { if (!msgbuf) return; - + Node *node = DT__FindNode("/", false); if (node) DT__AddProperty(node, "boot-log", strlen((char *)msgbuf) + 1, msgbuf); @@ -124,21 +124,19 @@ for (c = 0; c < 8; c++) putc(' '); return; } - + if ( c == '\n' ) { putc('\r'); } - + putc(c); } int getc() { - int c = bgetc(); + int c = bgetc(); - //execute_hook("Keymapper", &c, NULL, NULL, NULL, NULL, NULL); - if ((c & 0xff) == 0) return c; else @@ -151,9 +149,9 @@ int getchar() { register int c = getc(); - + if ( c == '\r' ) c = '\n'; - + if ( c >= ' ' && c < 0x7f) putchar(c); return (c); @@ -163,16 +161,16 @@ { va_list ap; va_start(ap, fmt); - + prf(fmt, ap, putchar, 0); { - /* Kabyl: BooterLog */ + /* Kabyl: BooterLog */ struct putc_info pi; - + if (!msgbuf) return 0; - + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) return 0; pi.str = cursor; @@ -180,7 +178,7 @@ prf(fmt, ap, sputc, &pi); cursor += strlen((char *)cursor); } - + va_end(ap); return 0; } @@ -194,14 +192,14 @@ { prf(fmt, ap, putchar, 0); } - + { - /* Kabyl: BooterLog */ + /* Kabyl: BooterLog */ struct putc_info pi; - + if (!msgbuf) return 0; - + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) return 0; pi.str = cursor; @@ -209,7 +207,7 @@ prf(fmt, ap, sputc, &pi); cursor += strlen((char *)cursor); } - + va_end(ap); return(0); } @@ -219,7 +217,7 @@ va_list ap; gErrors = true; va_start(ap, fmt); - + prf(fmt, ap, putchar, 0); va_end(ap); @@ -229,10 +227,10 @@ void stop(const char * fmt, ...) { va_list ap; - + printf("\n"); va_start(ap, fmt); - + prf(fmt, ap, putchar, 0); va_end(ap); @@ -247,3 +245,28 @@ printf("Press a key to continue..."); getc(); } + +char * newStringWithFormat(const char * fmt, ...) +{ + va_list ap; + struct putc_info pi; + int len; + char *str = NULL; + + va_start(ap, fmt); + pi.last_str = 0; + len = prf_fmt_str_len(fmt, ap); + if (len > 0) + { + str = malloc(len+1); + if (!str) return NULL; + } + pi.str = str; + + prf(fmt, ap, sputc, &pi); + *pi.str = '\0'; + va_end(ap); + + return str; + +} \ No newline at end of file Index: branches/cparm/i386/libsaio/arc4random.c =================================================================== --- branches/cparm/i386/libsaio/arc4random.c (revision 0) +++ branches/cparm/i386/libsaio/arc4random.c (revision 1804) @@ -0,0 +1,277 @@ + +#include "libsaio.h" + +/* + * License for L15_Swap, L15_InitState, L_SCHEDULE, L15_KSA, L15_Discard, L15, L15_Byte + * + * Copyright (c) 2004, 2005, 2006 Robin J Carey. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/kern/kern_nrandom.c,v 1.7 2008/08/01 04:42:30 dillon Exp $ + */ + +/* + * IMPORTANT NOTE: LByteType must be exactly 8-bits in size or this software + * will not function correctly. + */ +typedef unsigned char LByteType; +#define L15_STATE_SIZE 256 +static LByteType L15_x, L15_y; +static LByteType L15_start_x; +static LByteType L15_state[L15_STATE_SIZE]; + +/* + * PRIVATE FUNCS: + */ +static void L15(const LByteType * const key, const size_t keyLen); +static void L15_Swap(const LByteType pos1, const LByteType pos2); +static void L15_InitState(void); +static void L15_KSA(const LByteType * const key, + const size_t keyLen); +static void L15_Discard(const LByteType numCalls); +/* + * PUBLIC INTERFACE: + */ +static LByteType L15_Byte(void); + +static __inline void +L15_Swap(const LByteType pos1, const LByteType pos2) +{ + const LByteType save1 = L15_state[pos1]; + + L15_state[pos1] = L15_state[pos2]; + L15_state[pos2] = save1; +} + +static void +L15_InitState (void) +{ + size_t i; + for (i = 0; i < L15_STATE_SIZE; ++i) + L15_state[i] = i; +} + +#define L_SCHEDULE(xx) \ + \ +for (i = 0; i < L15_STATE_SIZE; ++i) { \ + L15_Swap(i, (stateIndex += (L15_state[i] + (xx)))); \ +} + +static void +L15_KSA (const LByteType * const key, const size_t keyLen) +{ + size_t i, keyIndex; + LByteType stateIndex = 0; + + L_SCHEDULE(keyLen); + for (keyIndex = 0; keyIndex < keyLen; ++keyIndex) { + L_SCHEDULE(key[keyIndex]); + } +} + +static void +L15_Discard(const LByteType numCalls) +{ + LByteType i; + for (i = 0; i < numCalls; ++i) { + (void)L15_Byte(); + } +} + +/* + * PUBLIC INTERFACE: + */ +static void +L15(const LByteType * const key, const size_t keyLen) +{ + L15_x = L15_start_x = 0; + L15_y = L15_STATE_SIZE - 1; + L15_InitState(); + L15_KSA(key, keyLen); + L15_Discard(L15_Byte()); +} + +static LByteType +L15_Byte(void) +{ + LByteType z; + + L15_Swap(L15_state[L15_x], L15_y); + z = (L15_state [L15_x++] + L15_state[L15_y--]); + if (L15_x == L15_start_x) { + --L15_y; + } + return (L15_state[z]); +} + + + +/*- + * THE BEER-WARE LICENSE + * + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you + * think this stuff is worth it, you can buy me a beer in return. + * + * Dan Moschuk + * + * $FreeBSD: src/sys/libkern/arc4random.c,v 1.3.2.2 2001/09/17 07:06:50 silby Exp $ + */ + + +#define ARC4_MAXRUNS 16384 +#define ARC4_RESEED_SECONDS 300 * 18 +#define ARC4_KEYBYTES 32 /* 256 bit key */ + +static u_int8_t arc4_i, arc4_j; +static int arc4_initialized = 0; +static int arc4_numruns = 0; +static u_int8_t arc4_sbox[256]; +static u_int32_t arc4_tv_nextreseed; + +static u_int8_t arc4_randbyte(void); + +static __inline void +arc4_swap(u_int8_t *a, u_int8_t *b) +{ + u_int8_t c; + + c = *a; + *a = *b; + *b = c; +} + +/* + * Stir our S-box. + */ +static void +arc4_randomstir (void) +{ + u_int8_t key[256]; + int r, n; + + /* + * XXX read_random() returns unsafe numbers if the entropy + * device is not loaded -- MarkM. + */ + + { + for (r = 0; r < ARC4_KEYBYTES; ++r) + ((u_char *)key)[r] = L15_Byte(); + } + + /* If r == 0 || -1, just use what was on the stack. */ + if (r > 0) + { + for (n = r; n < sizeof(key); n++) + key[n] = key[n % r]; + } + + for (n = 0; n < 256; n++) + { + arc4_j = (arc4_j + arc4_sbox[n] + key[n]) % 256; + arc4_swap(&arc4_sbox[n], &arc4_sbox[arc4_j]); + } + arc4_i = arc4_j = 0; + + /* Reset for next reseed cycle. */ + arc4_tv_nextreseed = time18(); + arc4_tv_nextreseed += ARC4_RESEED_SECONDS; + arc4_numruns = 0; +} + +/* + * Initialize our S-box to its beginning defaults. + */ +static void +arc4_init(void) +{ + int n; + + u_int32_t now = time18(); + L15((const LByteType *)&now, sizeof(u_int32_t)); + + arc4_i = arc4_j = 0; + for (n = 0; n < 256; n++) + arc4_sbox[n] = (u_int8_t) n; + + arc4_randomstir(); + arc4_initialized = 1; + + /* + * Throw away the first N words of output, as suggested in the + * paper "Weaknesses in the Key Scheduling Algorithm of RC4" + * by Fluher, Mantin, and Shamir. (N = 256 in our case.) + */ + for (n = 0; n < 256*4; n++) + arc4_randbyte(); +} + +/* + * Generate a random byte. + */ +static u_int8_t +arc4_randbyte(void) +{ + u_int8_t arc4_t; + + arc4_i = (arc4_i + 1) % 256; + arc4_j = (arc4_j + arc4_sbox[arc4_i]) % 256; + + arc4_swap(&arc4_sbox[arc4_i], &arc4_sbox[arc4_j]); + + arc4_t = (arc4_sbox[arc4_i] + arc4_sbox[arc4_j]) % 256; + return arc4_sbox[arc4_t]; +} + +void +arc4rand(void *ptr, u_int len, int reseed) +{ + u_char *p; + u_int32_t tv_now; + + /* Initialize array if needed. */ + if (!arc4_initialized) + arc4_init(); + + tv_now = time18(); + + if (reseed || + (arc4_numruns > ARC4_MAXRUNS) || + (tv_now > arc4_tv_nextreseed)) + arc4_randomstir(); + + arc4_numruns += len; + p = ptr; + while (len--) + *p++ = arc4_randbyte(); +} + +uint32_t +arc4random(void) +{ + uint32_t ret; + + arc4rand(&ret, sizeof ret, 0); + return ret; +} Index: branches/cparm/i386/libsaio/Makefile =================================================================== --- branches/cparm/i386/libsaio/Makefile (revision 1803) +++ branches/cparm/i386/libsaio/Makefile (revision 1804) @@ -11,11 +11,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING #DEBUG = -DDEBUG_CPU=1 -DDEBUG_MEM=1 -DDEBUG_SPD=1 -DDEBUG_PCI=1 -DDEBUG_SMBIOS=1 -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float DEFINES= @@ -33,7 +33,7 @@ VPATH = $(OBJROOT):$(SYMROOT) -SAIO_OBJS = table.o asm.o bios.o biosfn.o \ +SAIO_OBJS = table.o asm.o bios.o biosfn.o arc4random.o stack_protector.o \ disk.o sys.o cache.o bootstruct.o \ stringTable.o load.o pci.o allocate.o misc.o \ vbe.o hfs.o hfs_compare.o \ Index: branches/cparm/i386/libsaio/cpu_intel_amd.c =================================================================== --- branches/cparm/i386/libsaio/cpu_intel_amd.c (revision 0) +++ branches/cparm/i386/libsaio/cpu_intel_amd.c (revision 1804) @@ -0,0 +1,956 @@ +/* + * Copyright 2008 Islam Ahmed Zaid. All rights reserved. + * AsereBLN: 2009: cleanup and bugfix + */ + +#include "libsaio.h" +#include "platform.h" +#include "cpu.h" + +#ifndef DEBUG_CPU +#define DEBUG_CPU 0 +#endif + +#if DEBUG_CPU +#define DBG(x...) printf(x) +#else +#define DBG(x...) msglog(x) +#endif + +//#define LEGACY_CPU + +// DFE: enable_PIT2 and disable_PIT2 come from older xnu + +/* + * Enable or disable timer 2. + * Port 0x61 controls timer 2: + * bit 0 gates the clock, + * bit 1 gates output to speaker. + */ +static inline void enable_PIT2(void) +{ + /* Enable gate, disable speaker */ + __asm__ volatile( + " inb $0x61,%%al \n\t" + " and $0xFC,%%al \n\t" /* & ~0x03 */ + " or $1,%%al \n\t" + " outb %%al,$0x61 \n\t" + : : : "%al" ); +} + +static inline void disable_PIT2(void) +{ + /* Disable gate and output to speaker */ + __asm__ volatile( + " inb $0x61,%%al \n\t" + " and $0xFC,%%al \n\t" /* & ~0x03 */ + " outb %%al,$0x61 \n\t" + : : : "%al" ); +} + +// DFE: set_PIT2_mode0, poll_PIT2_gate, and measure_tsc_frequency are +// roughly based on Linux code + +/* Set the 8254 channel 2 to mode 0 with the specified value. + In mode 0, the counter will initially set its gate low when the + timer expires. For this to be useful, you ought to set it high + before calling this function. The enable_PIT2 function does this. + */ +static inline void set_PIT2_mode0(uint16_t value) +{ + __asm__ volatile( + " movb $0xB0,%%al \n\t" + " outb %%al,$0x43 \n\t" + " movb %%dl,%%al \n\t" + " outb %%al,$0x42 \n\t" + " movb %%dh,%%al \n\t" + " outb %%al,$0x42" + : : "d"(value) /*: no clobber */ ); +} + +/* Returns the number of times the loop ran before the PIT2 signaled */ +static inline unsigned long poll_PIT2_gate(void) +{ + unsigned long count = 0; + unsigned char nmi_sc_val; + do { + ++count; + __asm__ volatile( + "inb $0x61,%0" + : "=q"(nmi_sc_val) /*:*/ /* no input */ /*:*/ /* no clobber */); + } while( (nmi_sc_val & 0x20) == 0); + return count; +} + +#ifdef LEGACY_CPU +static uint64_t measure_tsc_frequency(void); +/* + * DFE: Measures the TSC frequency in Hz (64-bit) using the ACPI PM timer + */ +static uint64_t measure_tsc_frequency(void) +{ + uint64_t tscStart; + uint64_t tscEnd; + uint64_t tscDelta = 0xffffffffffffffffULL; + unsigned long pollCount; + uint64_t retval = 0; + int i; + + /* Time how many TSC ticks elapse in 30 msec using the 8254 PIT + * counter 2. We run this loop 3 times to make sure the cache + * is hot and we take the minimum delta from all of the runs. + * That is to say that we're biased towards measuring the minimum + * number of TSC ticks that occur while waiting for the timer to + * expire. That theoretically helps avoid inconsistencies when + * running under a VM if the TSC is not virtualized and the host + * steals time. The TSC is normally virtualized for VMware. + */ + for(i = 0; i < 10; ++i) + { + enable_PIT2(); + set_PIT2_mode0(CALIBRATE_LATCH); + tscStart = rdtsc64(); + pollCount = poll_PIT2_gate(); + tscEnd = rdtsc64(); + /* The poll loop must have run at least a few times for accuracy */ + if(pollCount <= 1) + continue; + /* The TSC must increment at LEAST once every millisecond. We + * should have waited exactly 30 msec so the TSC delta should + * be >= 30. Anything less and the processor is way too slow. + */ + if((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC) + continue; + // tscDelta = min(tscDelta, (tscEnd - tscStart)) + if( (tscEnd - tscStart) < tscDelta ) + tscDelta = tscEnd - tscStart; + } + /* tscDelta is now the least number of TSC ticks the processor made in + * a timespan of 0.03 s (e.g. 30 milliseconds) + * Linux thus divides by 30 which gives the answer in kiloHertz because + * 1 / ms = kHz. But we're xnu and most of the rest of the code uses + * Hz so we need to convert our milliseconds to seconds. Since we're + * dividing by the milliseconds, we simply multiply by 1000. + */ + + /* Unlike linux, we're not limited to 32-bit, but we do need to take care + * that we're going to multiply by 1000 first so we do need at least some + * arithmetic headroom. For now, 32-bit should be enough. + * Also unlike Linux, our compiler can do 64-bit integer arithmetic. + */ + if(tscDelta > (1ULL<<32)) + retval = 0; + else + { + retval = tscDelta * 1000 / 30; + } + disable_PIT2(); + return retval; +} +#endif + + +#define MSR_AMD_APERF 0x000000E8 +/* + * Original comment/code: + * "DFE: Measures the Max Performance Frequency in Hz (64-bit)" + * + * Measures the Actual Performance Frequency in Hz (64-bit) + * (just a naming change, mperf --> aperf ) + */ +static uint64_t measure_aperf_frequency(void) +{ + uint64_t aperfStart; + uint64_t aperfEnd; + uint64_t aperfDelta = 0xffffffffffffffffULL; + unsigned long pollCount; + uint64_t retval = 0; + int i; + + /* Time how many APERF ticks elapse in 30 msec using the 8254 PIT + * counter 2. We run this loop 3 times to make sure the cache + * is hot and we take the minimum delta from all of the runs. + * That is to say that we're biased towards measuring the minimum + * number of APERF ticks that occur while waiting for the timer to + * expire. + */ + for(i = 0; i < 10; ++i) + { + enable_PIT2(); + set_PIT2_mode0(CALIBRATE_LATCH); + aperfStart = rdmsr64(MSR_AMD_APERF); + pollCount = poll_PIT2_gate(); + aperfEnd = rdmsr64(MSR_AMD_APERF); + /* The poll loop must have run at least a few times for accuracy */ + if (pollCount <= 1) + continue; + /* The TSC must increment at LEAST once every millisecond. + * We should have waited exactly 30 msec so the APERF delta should + * be >= 30. Anything less and the processor is way too slow. + */ + if ((aperfEnd - aperfStart) <= CALIBRATE_TIME_MSEC) + continue; + // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) + if ( (aperfEnd - aperfStart) < aperfDelta ) + aperfDelta = aperfEnd - aperfStart; + } + /* mperfDelta is now the least number of MPERF ticks the processor made in + * a timespan of 0.03 s (e.g. 30 milliseconds) + */ + + if (aperfDelta > (1ULL<<32)) + retval = 0; + else + { + retval = aperfDelta * 1000 / 30; + } + disable_PIT2(); + return retval; +} + + +/* + License for x2apic_enabled, get_apicbase, compute_bclk. + + Copyright (c) 2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +static inline __attribute__((always_inline)) void rdmsr32(uint32_t msr, uint32_t * lo_data_addr, uint32_t * hi_data_addr); +static inline __attribute__((always_inline)) void wrmsr32(uint32_t msr, uint32_t lo_data, uint32_t hi_data); +static uint32_t x2apic_enabled(void); +static uint32_t get_apicbase(void); +static uint32_t compute_bclk(void); +static inline __attribute__((always_inline)) void rdmsr32(uint32_t msr, uint32_t * lo_data_addr, uint32_t * hi_data_addr) +{ + __asm__ volatile( + "rdmsr" + : "=a" (*lo_data_addr), "=d" (*hi_data_addr) + : "c" (msr) + ); +} +static inline __attribute__((always_inline)) void wrmsr32(uint32_t msr, uint32_t lo_data, uint32_t hi_data) +{ + __asm__ __volatile__ ( + "wrmsr" + : /* No outputs */ + : "c" (msr), "a" (lo_data), "d" (hi_data) + ); +} +#define MSR_APIC_BASE 0x1B +#define APIC_TMR_INITIAL_CNT 0x380 +#define APIC_TMR_CURRENT_CNT 0x390 +#define APIC_TMR_DIVIDE_CFG 0x3E0 +#define MSR_APIC_TMR_INITIAL_CNT 0x838 +#define MSR_APIC_TMR_CURRENT_CNT 0x839 +#define MSR_APIC_TMR_DIVIDE_CFG 0x83E +static uint32_t x2apic_enabled(void) +{ + uint64_t temp64; + + temp64 = rdmsr64(MSR_APIC_BASE); + + return (uint32_t) (temp64 & (1 << 10)) ? 1 : 0; +} +static uint32_t get_apicbase(void) +{ + uint64_t temp64; + + temp64 = rdmsr64(MSR_APIC_BASE); + + return (uint32_t) (temp64 & 0xfffff000); +} +static uint32_t compute_bclk(void) +{ + uint32_t dummy; + uint32_t start, stop; + uint8_t temp8; + uint16_t delay_count; + uint32_t bclk; + +#define DELAY_IN_US 1000 + + // Compute fixed delay as time + // delay count = desired time * PIT frequency + // PIT frequency = 1.193182 MHz + delay_count = 1193182 / DELAY_IN_US; + + // PIT channel 2 gate is controlled by IO port 0x61, bit 0 +#define PIT_CH2_LATCH_REG 0x61 +#define CH2_SPEAKER (1 << 1) // bit 1 -- 1 = speaker enabled 0 = speaker disabled +#define CH2_GATE_IN (1 << 0) // bit 0 -- 1 = gate enabled, 0 = gate disabled +#define CH2_GATE_OUT (1 << 5) // bit 5 -- 1 = gate latched, 0 = gate not latched + + // PIT Command register +#define PIT_MODE_COMMAND_REG 0x43 +#define SELECT_CH2 (2 << 6) +#define ACCESS_MODE_LOBYTE_HIBYTE (3 << 4) +#define MODE0_INTERRUPT_ON_TERMINAL_COUNT 0 // Despite name, no interrupts on CH2 + + // PIT Channel 2 data port +#define PIT_CH2_DATA 0x42 + + // Disable the PIT channel 2 speaker and gate + temp8 = inb(PIT_CH2_LATCH_REG); + temp8 &= ~(CH2_SPEAKER | CH2_GATE_IN); + outb(PIT_CH2_LATCH_REG, temp8); + + // Setup command and mode + outb(PIT_MODE_COMMAND_REG, SELECT_CH2 | ACCESS_MODE_LOBYTE_HIBYTE | MODE0_INTERRUPT_ON_TERMINAL_COUNT); + + // Set time for fixed delay + outb(PIT_CH2_DATA, (uint8_t) (delay_count)); + outb(PIT_CH2_DATA, (uint8_t) (delay_count >> 8)); + + // Prepare to enable channel 2 gate but leave the speaker disabled + temp8 = inb(PIT_CH2_LATCH_REG); + temp8 &= ~CH2_SPEAKER; + temp8 |= CH2_GATE_IN; + + if (x2apic_enabled()) + { + // Set APIC Timer Divide Value as 2 + wrmsr32(MSR_APIC_TMR_DIVIDE_CFG, 0, 0); + + // start APIC timer with a known value + start = ~0UL; + wrmsr32(MSR_APIC_TMR_INITIAL_CNT, start, 0); + } + else + { + // Set APIC Timer Divide Value as 2 + *(volatile uint32_t *)(uint32_t) (get_apicbase() + APIC_TMR_DIVIDE_CFG) = 0UL; + + // start APIC timer with a known value + start = ~0UL; + *(volatile uint32_t *)(uint32_t) (get_apicbase() + APIC_TMR_INITIAL_CNT) = start; + } + + // Actually start the PIT channel 2 + outb(PIT_CH2_LATCH_REG, temp8); + + // Wait for the fixed delay + while (!(inb(PIT_CH2_LATCH_REG) & CH2_GATE_OUT)); + + if (x2apic_enabled()) + { + // read the APIC timer to determine the change that occurred over this fixed delay + rdmsr32(MSR_APIC_TMR_CURRENT_CNT, &stop, &dummy); + + // stop APIC timer + wrmsr32(MSR_APIC_TMR_INITIAL_CNT, 0, 0); + + } + else + { + // read the APIC timer to determine the change that occurred over this fixed delay + stop = *(volatile uint32_t *)(uint32_t) (get_apicbase() + APIC_TMR_CURRENT_CNT); + + // stop APIC timer + *(volatile uint32_t *)(uint32_t) (get_apicbase() + APIC_TMR_INITIAL_CNT) = 0UL; + } + + // Disable channel 2 speaker and gate input + temp8 = inb(PIT_CH2_LATCH_REG); + temp8 &= ~(CH2_SPEAKER | CH2_GATE_IN); + outb(PIT_CH2_LATCH_REG, temp8); + + bclk = (start - stop) * 2 / DELAY_IN_US; + + // Round bclk to the nearest 100/12 integer value + bclk = ((((bclk * 24) + 100) / 200) * 200) / 24; + + return bclk; +} + + +/* + * Calculates the FSB and CPU frequencies using specific MSRs for each CPU + * - multi. is read from a specific MSR. In the case of Intel, there is: + * a max multi. (used to calculate the FSB freq.), + * and a current multi. (used to calculate the CPU freq.) + * - fsbFrequency = tscFrequency / multi + * - cpuFrequency = fsbFrequency * multi + */ + +void scan_cpu(PlatformInfo_t *p) +{ + uint64_t tscFrequency = 0, fsbFrequency = 0, cpuFrequency = 0; + uint64_t msr; + uint8_t maxcoef = 0, maxdiv = 0, currcoef = 0, currdiv = 0; + uint32_t reg[4]; + uint32_t cores_per_package = 0; + uint32_t logical_per_package = 0; + + do_cpuid(0, reg); + p->CPU.Vendor = reg[ebx]; + p->CPU.cpuid_max_basic = reg[eax]; + + if (p->CPU.Vendor == 0x756E6547 /* Intel */) + { + do_cpuid2(0x00000004, 0, reg); + cores_per_package = bitfield(reg[eax], 31, 26) + 1; + } + else if (p->CPU.Vendor != 0x68747541 /* AMD */) + { + stop("Error: CPU unsupported\n"); + halt(); + } + + /* get extended cpuid results */ + do_cpuid(0x80000000, reg); + p->CPU.cpuid_max_ext = reg[eax]; + + /* Begin of Copyright: from Apple's XNU cpuid.c */ + + /* get brand string (if supported) */ + if (p->CPU.cpuid_max_ext > 0x80000004) + { + char str[128], *s; + /* + * The brand string 48 bytes (max), guaranteed to + * be NUL terminated. + */ + do_cpuid(0x80000002, reg); + bcopy((char *)reg, &str[0], 16); + do_cpuid(0x80000003, reg); + bcopy((char *)reg, &str[16], 16); + do_cpuid(0x80000004, reg); + bcopy((char *)reg, &str[32], 16); + for (s = str; *s != '\0'; s++) + { + if (*s != ' ') break; + } + + strlcpy(p->CPU.BrandString, s, sizeof(p->CPU.BrandString)); + + if (!strncmp(p->CPU.BrandString, CPUID_STRING_UNKNOWN, min(sizeof(p->CPU.BrandString), (unsigned)strlen(CPUID_STRING_UNKNOWN) + 1))) + { + /* + * This string means we have a firmware-programmable brand string, + * and the firmware couldn't figure out what sort of CPU we have. + */ + p->CPU.BrandString[0] = '\0'; + } + } + + /* + * Get processor signature and decode + * and bracket this with the approved procedure for reading the + * the microcode version number a.k.a. signature a.k.a. BIOS ID + */ + if (p->CPU.Vendor == 0x756E6547 /* Intel */) + { + wrmsr64(MSR_IA32_BIOS_SIGN_ID, 0); + do_cpuid(1, reg); + p->CPU.MicrocodeVersion = + (uint32_t) (rdmsr64(MSR_IA32_BIOS_SIGN_ID) >> 32); + } + else if (p->CPU.Vendor != 0x68747541 /* AMD */) + do_cpuid(1, reg); + + p->CPU.Signature = reg[eax]; + p->CPU.Stepping = bitfield(reg[eax], 3, 0); + p->CPU.Model = bitfield(reg[eax], 7, 4); + p->CPU.Family = bitfield(reg[eax], 11, 8); + p->CPU.ExtModel = bitfield(reg[eax], 19, 16); + p->CPU.ExtFamily = bitfield(reg[eax], 27, 20); + p->CPU.Brand = bitfield(reg[ebx], 7, 0); + p->CPU.Features = quad(reg[ecx], reg[edx]); + + /* Fold extensions into family/model */ + if (p->CPU.Family == 0x0f) + p->CPU.Family += p->CPU.ExtFamily; + if (p->CPU.Family == 0x0f || p->CPU.Family == 0x06) + p->CPU.Model += (p->CPU.ExtModel << 4); + + if (p->CPU.Features & CPUID_FEATURE_HTT) + logical_per_package = + bitfield(reg[ebx], 23, 16); + else + logical_per_package = 1; + + if (p->CPU.cpuid_max_ext >= 0x80000001) + { + do_cpuid(0x80000001, reg); + p->CPU.ExtFeatures = + quad(reg[ecx], reg[edx]); + + } + + if (p->CPU.cpuid_max_ext >= 0x80000007) + { + do_cpuid(0x80000007, reg); + + /* Fold in the Invariant TSC feature bit, if present */ + p->CPU.ExtFeatures |= + reg[edx] & (uint32_t)CPUID_EXTFEATURE_TSCI; + + if (p->CPU.Vendor == 0x68747541 /* AMD */) + { + /* Fold in the Hardware P-State control feature bit, if present */ + p->CPU.ExtFeatures |= + reg[edx] & (uint32_t)_Bit(7); + + /* Fold in the read-only effective frequency interface feature bit, if present */ + p->CPU.ExtFeatures |= + reg[edx] & (uint32_t)_Bit(10); + } + + } + + if (p->CPU.Vendor == 0x68747541 /* AMD */) + { + if (p->CPU.cpuid_max_ext >= 0x80000008) + { + if (p->CPU.Features & CPUID_FEATURE_HTT) + { + do_cpuid(0x80000008, reg); + cores_per_package = bitfield(reg[ecx], 7 , 0) + 1; // NC + 1 + } + } + } + if (p->CPU.cpuid_max_basic >= 0x5) { + /* + * Extract the Monitor/Mwait Leaf info: + */ + do_cpuid(5, reg); + if (p->CPU.Vendor == 0x756E6547 /* Intel */) + { + p->CPU.sub_Cstates = reg[edx]; + } + + p->CPU.extensions = reg[ecx]; + } + + if (p->CPU.Vendor == 0x756E6547 /* Intel */) + { + if (p->CPU.cpuid_max_basic >= 0x6) + { + /* + * The thermal and Power Leaf: + */ + do_cpuid(6, reg); + p->CPU.dynamic_acceleration = bitfield(reg[eax], 1, 1); // "Dynamic Acceleration Technology (Turbo Mode)" + p->CPU.invariant_APIC_timer = bitfield(reg[eax], 2, 2); // "Invariant APIC Timer" + p->CPU.fine_grain_clock_mod = bitfield(reg[eax], 4, 4); + } + + if ((p->CPU.Vendor == 0x756E6547 /* Intel */) && + (p->CPU.Family == 0x06)) + { + /* + * Find the number of enabled cores and threads + * (which determines whether SMT/Hyperthreading is active). + */ + switch (p->CPU.Model) + { + + case CPUID_MODEL_DALES_32NM: + case CPUID_MODEL_WESTMERE: + case CPUID_MODEL_WESTMERE_EX: + { + msr = rdmsr64(MSR_CORE_THREAD_COUNT); + p->CPU.NoThreads = bitfield((uint32_t)msr, 15, 0); + p->CPU.NoCores = bitfield((uint32_t)msr, 19, 16); + break; + } + + case CPUID_MODEL_NEHALEM: + case CPUID_MODEL_FIELDS: + case CPUID_MODEL_DALES: + case CPUID_MODEL_NEHALEM_EX: + case CPUID_MODEL_SANDYBRIDGE: + case CPUID_MODEL_JAKETOWN: + { + msr = rdmsr64(MSR_CORE_THREAD_COUNT); + p->CPU.NoThreads = bitfield((uint32_t)msr, 15, 0); + p->CPU.NoCores = bitfield((uint32_t)msr, 31, 16); + break; + } + } + } + } + + if (p->CPU.NoCores == 0) + { + if (p->CPU.Vendor == 0x68747541 /* AMD */) + { + if (!cores_per_package) { + //legacy method + if ((p->CPU.ExtFeatures & _HBit(1)/* CmpLegacy */) && ( p->CPU.Features & CPUID_FEATURE_HTT) ) + cores_per_package = logical_per_package; + else + cores_per_package = 1; + } + } + p->CPU.NoThreads = logical_per_package; + p->CPU.NoCores = cores_per_package ? cores_per_package : 1 ; + } + + /* End of Copyright: from Apple's XNU cpuid.c */ + + fsbFrequency = (uint64_t)(compute_bclk() * 1000000); + +#ifdef LEGACY_CPU + tscFrequency = measure_tsc_frequency(); +#endif + + if (p->CPU.Vendor == 0x68747541 /* AMD */) + { + +#define K8_FIDVID_STATUS 0xC0010042 +#define K10_COFVID_STATUS 0xC0010071 + if (p->CPU.ExtFeatures & _Bit(10)) + { + cpuFrequency = measure_aperf_frequency(); + } + + if ((p->CPU.Vendor == 0x68747541 /* AMD */) && (p->CPU.Family == 0x0f)) + { + switch(p->CPU.ExtFamily) + { + case 0x00: /* K8 */ + msr = rdmsr64(K8_FIDVID_STATUS); + maxcoef = bitfield(msr, 21, 16) / 2 + 4; + currcoef = bitfield(msr, 5, 0) / 2 + 4; + break; + + case 0x01: /* K10 */ + { + //uint32_t reg[4]; + msr = rdmsr64(K10_COFVID_STATUS); + /* + do_cpuid2(0x00000006, 0, reg); + EffFreq: effective frequency interface + if (bitfield(reg[ecx], 0, 0) == 1) + { + uint64_t aperf = measure_aperf_frequency(); + cpuFrequency = aperf; + } + */ + // NOTE: tsc runs at the maccoeff (non turbo) + // *not* at the turbo frequency. + maxcoef = bitfield(msr, 54, 49) / 2 + 4; + currcoef = bitfield(msr, 5, 0) + 0x10; + currdiv = 2 << bitfield(msr, 8, 6); + + break; + } + case 0x05: /* K14 */ + msr = rdmsr64(K10_COFVID_STATUS); + currcoef = (bitfield(msr, 54, 49) + 0x10) << 2; + currdiv = (bitfield(msr, 8, 4) + 1) << 2; + currdiv += bitfield(msr, 3, 0); + + break; + + case 0x02: /* K11 */ + DBG("K11 detected, but not supported !!!\n"); + // not implimented + break; + } + + if (!fsbFrequency) + { + if (maxcoef) + { + if (currdiv) + { + if (!currcoef) currcoef = maxcoef; + if (!cpuFrequency) + fsbFrequency = ((tscFrequency * currdiv) / currcoef); + else + fsbFrequency = ((cpuFrequency * currdiv) / currcoef); + + DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); + } else { + if (!cpuFrequency) + fsbFrequency = (tscFrequency / maxcoef); + else + fsbFrequency = (cpuFrequency / maxcoef); + DBG("%d\n", currcoef); + } + } + else if (currcoef) + { + if (currdiv) + { + fsbFrequency = ((tscFrequency * currdiv) / currcoef); + DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); + } else { + fsbFrequency = (tscFrequency / currcoef); + DBG("%d\n", currcoef); + } + } + } + + } + + // NOTE: This is not the approved method, + // the method provided by AMD is: + // if ((PowerNow == enabled (p->CPU.cpuid_max_ext >= 0x80000007)) && (StartupFID(??) != MaxFID(??))) then "mobile processor present" + + if (strstr(p->CPU.BrandString, "obile")) + p->CPU.isMobile = true; + else + p->CPU.isMobile = false; + + DBG("%s platform detected.\n", p->CPU.isMobile?"Mobile":"Desktop"); + } + else if ((p->CPU.Vendor == 0x756E6547 /* Intel */) && + ((p->CPU.Family == 0x06) || + (p->CPU.Family == 0x0f))) + { + if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0c) || + (p->CPU.Family == 0x0f && p->CPU.Model >= 0x03)) + { + /* Nehalem CPU model */ + if (p->CPU.Family == 0x06 && (p->CPU.Model == CPUID_MODEL_NEHALEM || + p->CPU.Model == CPUID_MODEL_FIELDS || + p->CPU.Model == CPUID_MODEL_DALES || + p->CPU.Model == CPUID_MODEL_DALES_32NM || + p->CPU.Model == CPUID_MODEL_WESTMERE || + p->CPU.Model == CPUID_MODEL_NEHALEM_EX || + p->CPU.Model == CPUID_MODEL_WESTMERE_EX || + p->CPU.Model == CPUID_MODEL_SANDYBRIDGE || + p->CPU.Model == CPUID_MODEL_JAKETOWN)) + { + uint8_t bus_ratio_max = 0, bus_ratio_min = 0; + uint32_t max_ratio = 0; + uint64_t flex_ratio = 0; + msr = rdmsr64(MSR_PLATFORM_INFO); +#if DEBUG_CPU + DBG("msr(%d): platform_info %08x\n", __LINE__, msr & 0xffffffff); +#endif + bus_ratio_max = (msr >> 8) & 0xff; + bus_ratio_min = (msr >> 40) & 0xff; + msr = rdmsr64(MSR_FLEX_RATIO); +#if DEBUG_CPU + DBG("msr(%d): flex_ratio %08x\n", __LINE__, msr & 0xffffffff); +#endif + if ((msr >> 16) & 0x01) + { + flex_ratio = (msr >> 8) & 0xff; + /* bcc9: at least on the gigabyte h67ma-ud2h, + where the cpu multipler can't be changed to + allow overclocking, the flex_ratio msr has unexpected (to OSX) + contents. These contents cause mach_kernel to + fail to compute the bus ratio correctly, instead + causing the system to crash since tscGranularity + is inadvertently set to 0. + */ + if (flex_ratio == 0) + { + /* Clear bit 16 (evidently the + presence bit) */ + wrmsr64(MSR_FLEX_RATIO, (msr & 0xFFFFFFFFFFFEFFFFULL)); + msr = rdmsr64(MSR_FLEX_RATIO); +#if DEBUG_CPU + DBG("Unusable flex ratio detected. MSR Patched to %08x\n", msr & 0xffffffff); +#endif + } + else + { + if (bus_ratio_max > flex_ratio) + { + bus_ratio_max = flex_ratio; + } + } + } +#ifdef LEGACY_CPU + if (bus_ratio_max) + { + fsbFrequency = (tscFrequency / bus_ratio_max); + } +#endif + //valv: Turbo Ratio Limit + if ((p->CPU.Model != 0x2e) && (p->CPU.Model != 0x2f)) + { + //msr = rdmsr64(MSR_TURBO_RATIO_LIMIT); + cpuFrequency = bus_ratio_max * fsbFrequency; + max_ratio = bus_ratio_max * 10; + } + else + { +#ifdef LEGACY_CPU + cpuFrequency = tscFrequency; +#else + cpuFrequency = bus_ratio_max * fsbFrequency; +#endif + } +#if DEBUG_CPU + DBG("Sticking with [BCLK: %dMhz, Bus-Ratio: %d]\n", fsbFrequency / 1000000, max_ratio); +#endif + currcoef = bus_ratio_max; + + tscFrequency = cpuFrequency; + } + else + { + msr = rdmsr64(MSR_IA32_PERF_STATUS); +#if DEBUG_CPU + DBG("msr(%d): ia32_perf_stat 0x%08x\n", __LINE__, msr & 0xffffffff); +#endif + currcoef = (msr >> 8) & 0x1f; + /* Non-integer bus ratio for the max-multi*/ + maxdiv = (msr >> 46) & 0x01; + /* Non-integer bus ratio for the current-multi (undocumented)*/ + currdiv = (msr >> 14) & 0x01; + + if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0e) || + (p->CPU.Family == 0x0f)) // This will always be model >= 3 + { + /* On these models, maxcoef defines TSC freq */ + maxcoef = (msr >> 40) & 0x1f; + } + else + { + /* On lower models, currcoef defines TSC freq */ + /* XXX */ + maxcoef = currcoef; + } + if (!currcoef) currcoef = maxcoef; +#ifdef LEGACY_CPU + if (maxcoef) + { + + if (maxdiv) + { + fsbFrequency = ((tscFrequency * 2) / ((maxcoef * 2) + 1)); + } + else + { + fsbFrequency = (tscFrequency / maxcoef); + } + + if (currdiv) + { + cpuFrequency = (fsbFrequency * ((currcoef * 2) + 1) / 2); + } + else + { + cpuFrequency = (fsbFrequency * currcoef); + } +#if DEBUG_CPU + DBG("max: %d%s current: %d%s\n", maxcoef, maxdiv ? ".5" : "",currcoef, currdiv ? ".5" : ""); +#endif + } +#else + + + if (currdiv) + { + cpuFrequency = (fsbFrequency * ((currcoef * 2) + 1) / 2); + } + else + { + cpuFrequency = (fsbFrequency * currcoef); + } + + if (maxcoef) + { + if (maxdiv) + { + tscFrequency = (fsbFrequency * ((maxcoef * 2) + 1)) / 2; + } + else + { + tscFrequency = fsbFrequency * maxcoef; + } + } +#if DEBUG_CPU + DBG("max: %d%s current: %d%s\n", maxcoef, maxdiv ? ".5" : "",currcoef, currdiv ? ".5" : ""); +#endif + +#endif // LEGACY_CPU + + } + } + /* Mobile CPU ? */ + //Slice + p->CPU.isMobile = false; + switch (p->CPU.Model) + { + case 0x0D: + p->CPU.isMobile = true; + break; + case 0x02: + case 0x03: + case 0x04: + case 0x06: + p->CPU.isMobile = (rdmsr64(0x2C) & (1 << 21)); + break; + default: + p->CPU.isMobile = (rdmsr64(0x17) & (1 << 28)); + break; + } + + DBG("%s platform detected.\n", p->CPU.isMobile?"Mobile":"Desktop"); + } + + if (!cpuFrequency) cpuFrequency = tscFrequency; + if (!tscFrequency) tscFrequency = cpuFrequency; + + p->CPU.MaxCoef = maxcoef; + p->CPU.MaxDiv = maxdiv; + p->CPU.CurrCoef = currcoef; + p->CPU.CurrDiv = currdiv; + + p->CPU.TSCFrequency = tscFrequency ; + p->CPU.FSBFrequency = fsbFrequency ; + p->CPU.CPUFrequency = cpuFrequency ; + + DBG("CPU: Vendor/Model/ExtModel: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Model, p->CPU.ExtModel); + DBG("CPU: Family/ExtFamily: 0x%x/0x%x\n", p->CPU.Family, p->CPU.ExtFamily); + if (p->CPU.Vendor == 0x68747541 /* AMD */) + { + DBG("CPU (AMD): TSCFreq: %dMHz\n", p->CPU.TSCFrequency / 1000000); + DBG("CPU (AMD): FSBFreq: %dMHz\n", p->CPU.FSBFrequency / 1000000); + DBG("CPU (AMD): CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000); + DBG("CPU (AMD): MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef); + DBG("CPU (AMD): MaxDiv/CurrDiv: 0x%x/0x%x\n", p->CPU.MaxDiv, p->CPU.CurrDiv); + } + else + { + DBG("CPU: TSCFreq: %dMHz\n", p->CPU.TSCFrequency / 1000000); + DBG("CPU: FSBFreq: %dMHz\n", p->CPU.FSBFrequency / 1000000); + DBG("CPU: CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000); + DBG("CPU: MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef); + DBG("CPU: MaxDiv/CurrDiv: 0x%x/0x%x\n", p->CPU.MaxDiv, p->CPU.CurrDiv); + } + + DBG("CPU: NoCores/NoThreads: %d/%d\n", p->CPU.NoCores, p->CPU.NoThreads); + DBG("CPU: Features: 0x%08x\n", p->CPU.Features); + DBG("CPU: ExtFeatures: 0x%08x\n", p->CPU.ExtFeatures); + + if (p->CPU.Vendor == 0x756E6547 /* Intel */) + DBG("CPU: MicrocodeVersion: %d\n", p->CPU.MicrocodeVersion); + +#if DEBUG_CPU + pause(); +#endif + +} Index: branches/cparm/i386/libsaio/internal_modules.h =================================================================== --- branches/cparm/i386/libsaio/internal_modules.h (revision 1803) +++ branches/cparm/i386/libsaio/internal_modules.h (revision 1804) @@ -26,7 +26,6 @@ // Done !!! - // ps: i swear the next version will be more simple } #endif /* __INTERNAL_MODULES_H */ \ No newline at end of file Index: branches/cparm/i386/libsaio/sys.c =================================================================== --- branches/cparm/i386/libsaio/sys.c (revision 1803) +++ branches/cparm/i386/libsaio/sys.c (revision 1804) @@ -45,7 +45,7 @@ * Add routine, ptol(), to parse partition letters. * */ - + /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement @@ -55,7 +55,7 @@ */ /* Copyright 2007 VMware Inc. - "Preboot" ramdisk support added by David Elliott + "Preboot" ramdisk support added by David Elliott */ #include @@ -138,16 +138,16 @@ long LoadVolumeFile(BVRef bvr, const char *filePath) { long fileSize; - + // Read file into load buffer. The data in the load buffer will be // overwritten by the next LoadFile() call. - + gFSLoadAddress = (void *) LOAD_ADDR; - + fileSize = bvr->fs_loadfile(bvr, (char *)filePath); - + // Return the size of the file, or -1 if load failed. - + return fileSize; } @@ -160,12 +160,12 @@ { const char * filePath; BVRef bvr; - + // Resolve the boot volume from the file spec. - + if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) return -1; - + return LoadVolumeFile(bvr, filePath); } @@ -173,13 +173,13 @@ { const char *filePath; BVRef bvr; - + if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) return -1; - + if (bvr->fs_readfile == NULL) return -1; - + return bvr->fs_readfile(bvr, (char *)filePath, buffer, offset, length); } @@ -192,19 +192,19 @@ long length2; // Resolve the boot volume from the file spec. - + if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) return -1; - + *binary = (void *)kLoadAddr; - + // Read file into load buffer. The data in the load buffer will be // overwritten by the next LoadFile() call. - + gFSLoadAddress = (void *) LOAD_ADDR; - + readFile = bvr->fs_readfile; - + if (readFile != NULL) { // Read the first 4096 bytes (fat header) length = readFile(bvr, (char *)filePath, *binary, 0, 0x1000); @@ -221,7 +221,7 @@ length2 = readFile(bvr, (char *)filePath, (void *)(kLoadAddr + length), length, 0); //if (length2 == -1) return -1; if (length2 < 0) return -1; - + length += (unsigned long)length2; } } @@ -231,7 +231,7 @@ ThinFatFile(binary, &length); } } - + return length; } @@ -243,38 +243,38 @@ char *p = uuidStr; MD5_CTX md5c; uint8_t mdresult[16]; - + bzero(mdresult, sizeof(mdresult)); - + // just like AppleFileSystemDriver MD5Init(&md5c); MD5Update(&md5c, kFSUUIDNamespaceSHA1, sizeof(kFSUUIDNamespaceSHA1)); MD5Update(&md5c, uubytes, nbytes); MD5Final(mdresult, &md5c); - + // this UUID has been made version 3 style (i.e. via namespace) // see "-uuid-urn-" IETF draft (which otherwise copies byte for byte) mdresult[6] = 0x30 | ( mdresult[6] & 0x0F ); mdresult[8] = 0x80 | ( mdresult[8] & 0x3F ); - - + + // generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292 i = 0; fmtbase = 0; for(fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++) { for(i=0; i < uuidfmt[fmtidx]; i++) { uint8_t byte = mdresult[fmtbase+i]; char nib; - + nib = byte >> 4; *p = nib + '0'; // 0x4 -> '4' if(*p > '9') *p = (nib - 9 + ('A'-1)); // 0xB -> 'B' p++; - + nib = byte & 0xf; *p = nib + '0'; // 0x4 -> '4' if(*p > '9') *p = (nib - 9 + ('A'-1)); // 0xB -> 'B' p++; - + } fmtbase += i; if(fmtidx < sizeof(uuidfmt)-1) @@ -282,7 +282,7 @@ else *p = '\0'; } - + return 0; } @@ -296,18 +296,18 @@ { const char * dirPath; BVRef bvr; - + // Resolve the boot volume from the dir spec. - + if ((bvr = getBootVolumeRef(dirSpec, &dirPath)) == NULL) return -1; - + // Return 0 on success, or -1 if there are no additional entries. - + return bvr->fs_getdirentry( bvr, - /* dirPath */ (char *)dirPath, - /* dirIndex */ dirIndex, - /* dirEntry */ (char **)name, flags, time, 0, 0 ); + /* dirPath */ (char *)dirPath, + /* dirIndex */ dirIndex, + /* dirEntry */ (char **)name, flags, time, 0, 0 ); } //========================================================================== @@ -321,15 +321,15 @@ { long long index = 0; const char * entryName; - + if (gMakeDirSpec == 0) gMakeDirSpec = (char *)malloc(1024); - + if (!dirSpec) { long idx, len; - + len = strlen(name); - + for (idx = len; idx && (name[idx] != '/' && name[idx] != '\\'); idx--) {} if (idx == 0) { gMakeDirSpec[0] = '/'; @@ -341,7 +341,7 @@ } dirSpec = gMakeDirSpec; } - + while (GetDirEntry(dirSpec, &index, &entryName, flags, time) == 0) { if (strcmp(entryName, name) == 0) @@ -356,12 +356,12 @@ static int GetFreeFd(void) { int fd; - + // Locate a free descriptor slot. for (fd = 0; fd < NFILES; fd++) { if (iob[fd].i_flgs == 0) { return fd; - } + } } stop("Out of file descriptors"); // not reached @@ -377,7 +377,7 @@ static struct iob * iob_from_fdesc(int fdesc) { register struct iob * io; - + if (fdesc < 0 || fdesc >= NFILES || ((io = &iob[fdesc])->i_flgs & F_ALLOC) == 0) return NULL; @@ -396,18 +396,18 @@ struct iob *io; int fdesc; int i; - + if (bvr == NULL) { return -1; } - + fdesc = GetFreeFd(); io = &iob[fdesc]; bzero(io, sizeof(*io)); - + // Mark the descriptor as taken. io->i_flgs = F_ALLOC; - + // Find the next available memory block in the download buffer. io->i_buf = (char *) LOAD_ADDR; for (i = 0; i < NFILES; i++) { @@ -416,7 +416,7 @@ } io->i_buf = max(iob[i].i_filesize + iob[i].i_buf, io->i_buf); } - + // Load entire file into memory. Unnecessary open() calls must be avoided. gFSLoadAddress = io->i_buf; io->i_filesize = bvr->fs_loadfile(bvr, (char *)filePath); @@ -435,7 +435,7 @@ { const char *filepath; BVRef bvr; - + // Resolve the boot volume from the file spec. if ((bvr = getBootVolumeRef(path, &filepath)) != NULL) { #if UNUSED @@ -453,22 +453,22 @@ int open_bvdev(const char *bvd, const char *path) #endif { - const struct devsw *dp; + const struct devsw *dp; const char *cp; BVRef bvr; int i; int len; int unit; int partition; - + if ((i = open(path)) >= 0) { return i; } - + if (bvd == NULL || (len = strlen(bvd)) < 2) { return -1; } - + for (dp=devsw; dp->name; dp++) { if (bvd[0] == dp->name[0] && bvd[1] == dp->name[1]) { unit = 0; @@ -496,7 +496,7 @@ return open_bvr(bvr, path); #endif } - } + } return -1; } @@ -506,12 +506,12 @@ int close(int fdesc) { struct iob * io; - + if ((io = iob_from_fdesc(fdesc)) == NULL) return (-1); - + io->i_flgs = 0; - + return 0; } @@ -525,17 +525,17 @@ if ((io = iob_from_fdesc(fdesc)) == NULL) return (-1); - + if ((io->i_offset + count) > (unsigned int)io->i_filesize) count = io->i_filesize - io->i_offset; - + if (count <= 0) return 0; // end of file - + bcopy(io->i_buf + io->i_offset, buf, count); - + io->i_offset += count; - + return count; } @@ -546,10 +546,10 @@ int file_size(int fdesc) { struct iob * io; - + if ((io = iob_from_fdesc(fdesc)) == 0) return 0; - + return io->i_filesize; } @@ -560,22 +560,22 @@ struct dirstuff * dirp = 0; const char * dirPath; BVRef bvr; - + if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL) goto error; - + dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff)); if (dirp == NULL) goto error; - + dirp->dir_path = newString(dirPath); if (dirp->dir_path == NULL) goto error; - + dirp->dir_bvr = bvr; - + return dirp; - + error: closedir(dirp); return NULL; @@ -598,10 +598,10 @@ long * time) { return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr, - /* dirPath */ dirp->dir_path, - /* dirIndex */ &dirp->dir_index, - /* dirEntry */ (char **)name, flags, time, - 0, 0); + /* dirPath */ dirp->dir_path, + /* dirIndex */ &dirp->dir_index, + /* dirEntry */ (char **)name, flags, time, + 0, 0); } #if UNUSED @@ -768,21 +768,21 @@ //========================================================================== int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags, - long * time, FinderInfo *finderInfo, long *infoValid) + long * time, FinderInfo *finderInfo, long *infoValid) { return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr, - /* dirPath */ dirp->dir_path, - /* dirIndex */ &dirp->dir_index, - /* dirEntry */ (char **)name, - flags, time, - finderInfo, infoValid); + /* dirPath */ dirp->dir_path, + /* dirIndex */ &dirp->dir_index, + /* dirEntry */ (char **)name, + flags, time, + finderInfo, infoValid); } //========================================================================== const char * systemConfigDir() { if (gBootFileType == kNetworkDeviceType) - return ""; + return ""; return "/Library/Preferences/SystemConfiguration"; } @@ -794,23 +794,23 @@ void scanBootVolumes( int biosdev, int * count ) { - BVRef bvr = 0; - - bvr = diskScanBootVolumes(biosdev, count); - if (bvr == NULL) - { + BVRef bvr = 0; + + bvr = diskScanBootVolumes(biosdev, count); + if (bvr == NULL) + { #ifdef NBP_SUPPORT - bvr = nbpScanBootVolumes(biosdev, count); - if (bvr != NULL) - { - gBootFileType = kNetworkDeviceType; - } + bvr = nbpScanBootVolumes(biosdev, count); + if (bvr != NULL) + { + gBootFileType = kNetworkDeviceType; + } #endif - } - else - { - gBootFileType = kBlockDeviceType; - } + } + else + { + gBootFileType = kBlockDeviceType; + } } //========================================================================== @@ -820,23 +820,23 @@ void scanDisks(void) #endif { - #define MAX_HDD_COUNT 32 - int bvCount; - int hd = 0; - - // Testing up to MAX_HDD_COUNT hard drives. +#define MAX_HDD_COUNT 32 + int bvCount; + int hd = 0; + + // Testing up to MAX_HDD_COUNT hard drives. while(!testBiosread(0x80 + hd, 0) && hd < MAX_HDD_COUNT) { - bvCount = 0; - scanBootVolumes(0x80 + hd, &bvCount); - hd++; + bvCount = 0; + scanBootVolumes(0x80 + hd, &bvCount); + hd++; } - - // Also scanning CD/DVD drive. + + // Also scanning CD/DVD drive. if (biosDevIsCDROM(gBIOSDev)) { - bvCount = 0; - scanBootVolumes(gBIOSDev, &bvCount); + bvCount = 0; + scanBootVolumes(gBIOSDev, &bvCount); } } @@ -922,9 +922,9 @@ int gBIOSDev; /*! - This is like boot2's gBootVolume except it is for the internal use of - libsaio to track which volume an unqualified path should be relative to. - This replaces bootInfo->kernDev as the carrier of this information. + This is like boot2's gBootVolume except it is for the internal use of + libsaio to track which volume an unqualified path should be relative to. + This replaces bootInfo->kernDev as the carrier of this information. */ static BVRef gRootVolume; @@ -939,35 +939,35 @@ void setBootGlobals(BVRef chain) { - // Record default boot device. - gBootVolume = selectBootVolume(chain); - - // turbo - Save the ORIGINAL boot volume too for loading our mkext - if (!gBIOSBootVolume) gBIOSBootVolume = gBootVolume; - - setRootVolume(gBootVolume); + // Record default boot device. + gBootVolume = selectBootVolume(chain); + + // turbo - Save the ORIGINAL boot volume too for loading our mkext + if (!gBIOSBootVolume) gBIOSBootVolume = gBootVolume; + + setRootVolume(gBootVolume); } /*! - Extracts the volume selector from the pathname, returns the selected - BVRef, and sets *outPath to the remainder of the path. - If the path did not include a volume selector then the current volume - is used. When called with a volume selector the current volume - is changed to the selected volume unless the volume selector is - that of a ramdisk. + Extracts the volume selector from the pathname, returns the selected + BVRef, and sets *outPath to the remainder of the path. + If the path did not include a volume selector then the current volume + is used. When called with a volume selector the current volume + is changed to the selected volume unless the volume selector is + that of a ramdisk. */ BVRef getBootVolumeRef( const char * path, const char ** outPath ) { const char * cp; BVRef bvr = gRootVolume; int biosdev = gBIOSDev; - + // Search for left parenthesis in the path specification. - + for (cp = path; *cp; cp++) { if (*cp == LP || *cp == '/') break; } - + if (*cp != LP) // no left paren found { // Path is using the implicit current device so if there is @@ -983,11 +983,11 @@ int i; int unit = -1; int part = -1; - + cp++; - + // Check the 2 character device name pointed by 'xp'. - + for (dp = devsw; dp->name; dp++) { if ((xp[0] == dp->name[0]) && (xp[1] == dp->name[1])) @@ -1001,14 +1001,14 @@ // Extract the optional unit number from the specification. // hd(unit) or hd(unit, part). - + i = 0; while (*cp >= '0' && *cp <= '9') { i = i * 10 + *cp++ - '0'; unit = i; } - + // Unit is no longer optional and never really was. // If the user failed to specify it then the unit number from the previous kernDev // would have been used which makes little sense anyway. @@ -1016,42 +1016,42 @@ // second hard disk (i.e. unit 1) then fd() would select the second floppy drive! if(unit == -1) return NULL; - + // Extract the optional partition number from the specification. - + if (*cp == ',') part = atoi(++cp); - + // If part is not specified part will be -1 whereas before it would have been // whatever the last partition was which makes about zero sense if the device // has been switched. - + // Skip past the right paren. - + for ( ; *cp && *cp != RP; cp++) /* LOOP */; if (*cp == RP) cp++; biosdev = dp->biosdev + unit; bvr = newBootVolumeRef(biosdev, part); - + if(bvr == NULL) return NULL; } else { // Bad device specifier, skip past the right paren. - + for ( cp++; *cp && *cp != RP; cp++) /* LOOP */; if (*cp == RP) cp++; // If gRootVolume was NULL, then bvr will be NULL as well which // should be caught by the caller. } - + // Returns the file path following the device spec. // e.g. 'hd(1,b)mach_kernel' is reduced to 'mach_kernel'. - + *outPath = cp; - + return bvr; } @@ -1061,9 +1061,9 @@ static BVRef newBootVolumeRef( int biosdev, int partno ) { BVRef bvr, bvr1, bvrChain; - + bvr = bvr1 = NULL; - + // Try resolving "rd" and "bt" devices first. execute_hook("newRamDisk_BVR", &biosdev, &bvr1, NULL, NULL, NULL, NULL); @@ -1077,21 +1077,21 @@ else { // Fetch the volume list from the device. - + scanBootVolumes( biosdev, NULL ); bvrChain = getBVChainForBIOSDev(biosdev); - + // Look for a perfect match based on device and partition number. - + for ( bvr1 = NULL, bvr = bvrChain; bvr; bvr = bvr->next ) { if ( ( bvr->flags & kBVFlagNativeBoot ) == 0 ) continue; - + bvr1 = bvr; if ( bvr->part_no == partno ) break; } } - + return bvr ? bvr : bvr1; } @@ -1105,7 +1105,7 @@ return 0; *str = '\0'; - + if (bvr) { const struct devsw *dp = devsw; Index: branches/cparm/i386/libsaio/disk.c =================================================================== --- branches/cparm/i386/libsaio/disk.c (revision 1803) +++ branches/cparm/i386/libsaio/disk.c (revision 1804) @@ -196,6 +196,7 @@ #ifdef APPLE_PARTITION_MAP_SUPPORT static BVRef diskScanAPMBootVolumes( int biosdev, int * countPtr ); #endif +static TagPtr XMLGetElementWithID( TagPtr dict, const char* id ); static bool getOSVersion(BVRef bvr, char *str); //========================================================================== @@ -333,8 +334,8 @@ rc = 0; break; } - error(" EBIOS read error: %s\n", bios_error(rc), rc); - error(" Block 0x%x Sectors %d\n", secno, xnsecs); + printf(" EBIOS read error: %s\n", bios_error(rc), rc); + printf(" Block 0x%x Sectors %d\n", secno, xnsecs); sleep(1); } } @@ -375,8 +376,8 @@ rc = 0; break; } - error(" BIOS read error: %s\n", bios_error(rc), rc); - error(" Block %d, Cyl %d Head %d Sector %d\n", + printf(" BIOS read error: %s\n", bios_error(rc), rc); + printf(" Block %d, Cyl %d Head %d Sector %d\n", secno, cyl, head, sec); sleep(1); } @@ -417,7 +418,7 @@ if(biosdev >= 0x100 && (execute_hook("isRamDiskRegistred", NULL, NULL, NULL, NULL, NULL, NULL) == EFI_SUCCESS)){ int ret = -1; - execute_hook("p_ramdiskReadBytes", &biosdev, &blkno, &byteoff, &byteCount, buffer, &ret); + execute_hook("p_ramdiskReadBytes", &biosdev, (void*)(unsigned long)&blkno, &byteoff, &byteCount, buffer, &ret); return ret; } #endif @@ -1049,17 +1050,19 @@ /* Let's try assuming we are on a hybrid HFS/ISO9660 CD. */ bvr = newFDiskBVRef( - biosdev, 0, - 0, - &cdpart, - HFSInitPartition, - HFSLoadFile, + biosdev, 0, + 0, + &cdpart, + HFSInitPartition, + HFSLoadFile, HFSReadFile, - HFSGetDirEntry, + HFSGetDirEntry, HFSGetFileBlock, HFSGetUUID, - 0, - kBIOSDevTypeHardDrive); + HFSGetDescription, + HFSFree, + 0, + kBIOSDevTypeHardDrive, 0); bvr->next = map->bvr; map->bvr = bvr; map->bvrcnt++; @@ -1519,12 +1522,36 @@ } } +static TagPtr XMLGetElementWithID( TagPtr dict, const char* id ) +{ + if(dict->type != kTagTypeArray) return 0; + + int element = 0; + TagPtr tmp = dict->tag; + int entry_count = XMLTagCount(dict); + + while(element < entry_count) + { + char *Identifier = NULL; + Identifier = XMLCastString(XMLGetProperty(tmp, (const char*)"Identifier")); + + if (Identifier && (strcmp(Identifier, id) == 0)) + { + return tmp; + } + + element++; + tmp = tmp->tagNext; + } + + return tmp; +} + static bool getOSVersion(BVRef bvr, char *str) { bool valid = false; config_file_t systemVersion; char dirSpec[512]; - long flags, time; sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); @@ -1543,15 +1570,32 @@ } else { - sprintf(dirSpec, "hd(%d,%d)/", BIOS_DEV_UNIT(bvr), bvr->part_no); + /* Much clean */ + sprintf(dirSpec, "hd(%d,%d)/Mac OS X Install Data/index.sproduct", BIOS_DEV_UNIT(bvr), bvr->part_no); - if (GetFileInfo(dirSpec, "Mac OS X Install Data", &flags, &time) == 0) - { - /*** DIRTY HACK (would be better to have a plist) ***/ - *str = '\0'; - strncat(str, "10.7", 4); - return true; - } + if (!loadConfigFile(dirSpec, &systemVersion)) + { + TagPtr pkg_p = XMLCastArray(XMLGetProperty(systemVersion.dictionary, (const char*)"Packages")); + + if (pkg_p) + { + + char *version = NULL; + + version = XMLCastString(XMLGetProperty( + XMLGetElementWithID(pkg_p, + "com.apple.mpkg.OSInstall"), + (const char*)"Version")); + + if (version && strlen(version) >= 4) + { + *str = '\0'; + strncat(str, version, 4); + return true; + + } + } + } } } @@ -2127,7 +2171,7 @@ int rc; if ((len & (BPS-1)) != 0) { - error("raw disk read not sector aligned"); + printf("raw disk read not sector aligned"); return -1; } secno += bvr->part_boff; @@ -2143,8 +2187,8 @@ if ((rc = ebiosread(bvr->biosdev, secno, secs)) != 0) { /* Ignore corrected ECC errors */ if (rc != ECC_CORRECTED_ERR) { - error(" EBIOS read error: %s\n", bios_error(rc), rc); - error(" Block %d Sectors %d\n", secno, secs); + printf(" EBIOS read error: %s\n", bios_error(rc), rc); + printf(" Block %d Sectors %d\n", secno, secs); return rc; } } @@ -2168,7 +2212,7 @@ int rc; if ((len & (BPS-1)) != 0) { - error("raw disk write not sector aligned"); + printf("raw disk write not sector aligned"); return -1; } secno += bvr->part_boff; @@ -2183,8 +2227,8 @@ bcopy( cbuf, trackbuf, copy_len ); //printf("rdr: ebioswrite(%d, %d, %d)\n", bvr->biosdev, secno, secs); if ((rc = ebioswrite(bvr->biosdev, secno, secs)) != 0) { - error(" EBIOS write error: %s\n", bios_error(rc), rc); - error(" Block %d Sectors %d\n", secno, secs); + printf(" EBIOS write error: %s\n", bios_error(rc), rc); + printf(" Block %d Sectors %d\n", secno, secs); return rc; } len -= copy_len; Index: branches/cparm/i386/libsaio/stack_protector.c =================================================================== --- branches/cparm/i386/libsaio/stack_protector.c (revision 0) +++ branches/cparm/i386/libsaio/stack_protector.c (revision 1804) @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "libsaio.h" + +#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) + +long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + +void __guard_setup(void) __attribute__ ((visibility ("hidden"))); + +void __stack_chk_fail(void); + + +void +__guard_setup(void) +{ + if (__stack_chk_guard[0]!=0) return; + + size_t i; + long guard[__arraycount(__stack_chk_guard)]; + + arc4rand(guard, sizeof(guard), 0); + for (i = 0; i < __arraycount(guard); i++) + __stack_chk_guard[i] = guard[i]; + + if (__stack_chk_guard[0]!=0 && *__stack_chk_guard != 0) return; + + /* If a random generator can't be used, the protector switches the guard + to the "terminator canary" */ + ((char*)__stack_chk_guard)[0] = 0; ((char*)__stack_chk_guard)[1] = 0; + ((char*)__stack_chk_guard)[2] = '\n'; ((char*)__stack_chk_guard)[3] = 255; + +} + +void +__stack_chk_fail() +{ +#ifndef BOOT1 + stop("stack overflow"); +#endif + for(;;); +} Index: branches/cparm/i386/libsaio/pci.c =================================================================== --- branches/cparm/i386/libsaio/pci.c (revision 1803) +++ branches/cparm/i386/libsaio/pci.c (revision 1804) @@ -159,7 +159,7 @@ char *get_pci_dev_path(pci_dt_t *pci_dt) { char* buffer = malloc(sizeof(char) * 256); - + pci_dt_t *current; pci_dt_t *end; char tmp[64]; @@ -195,7 +195,7 @@ while (current) { - execute_hook("PCIDevice", current, NULL/* &ret*/, NULL, NULL, NULL, NULL); + execute_hook("PCIDevice", (void*)current, NULL, NULL, NULL, NULL, NULL); setup_pci_devs(current->children); current = current->next; Index: branches/cparm/i386/libsaio/stringTable.c =================================================================== --- branches/cparm/i386/libsaio/stringTable.c (revision 1803) +++ branches/cparm/i386/libsaio/stringTable.c (revision 1804) @@ -30,8 +30,8 @@ #include "libsaio.h" #include "xml.h" -extern char *Language; -extern char *LoadableFamilies; +static char * AllocInitStringWithLength(const char * oldString, int len); +static char * AllocInitZeroEndedStringWithLength(const char * oldString, int len); bool sysConfigValid; #if UNUSED @@ -43,28 +43,28 @@ { int c; while (n--) { - c = *key++; - if (c == '\\') { - switch(c = *key++) { - case 'n': - c = '\n'; - break; - case 'r': - c = '\r'; - break; - case 't': - c = '\t'; - break; - default: - break; - } - } else if (c == '\"') { - /* Premature end of key */ - return 1; - } - if (c != *str++) { - return 1; - } + c = *key++; + if (c == '\\') { + switch(c = *key++) { + case 'n': + c = '\n'; + break; + case 'r': + c = '\r'; + break; + case 't': + c = '\t'; + break; + default: + break; + } + } else if (c == '\"') { + /* Premature end of key */ + return 1; + } + if (c != *str++) { + return 1; + } } return 0; } @@ -73,7 +73,7 @@ { register const char *table = *table_p; register bool found = false; - + while (*table && !found) { if (*table == '\\') table += 2; @@ -94,18 +94,18 @@ register int len; register char *tab; char *buf; - + len = strlen(key); tab = (char *)table; buf = (char *)malloc(len + 3); - + sprintf(buf, "\"%s\"", key); len = strlen(buf); - + while(*tab) { if(strncmp(buf, tab, len) == 0) { char c; - + while((c = *(tab + len)) != ';') { if(c == 0) { len = -1; @@ -122,21 +122,21 @@ len = -1; out: free(buf); - + if(len == -1) return false; - + while((*tab = *(tab + len))) { tab++; } - + return true; } char * newStringFromList( - char **list, - int *size -) + char **list, + int *size + ) { char *begin = *list, *end; char *newstr; @@ -144,16 +144,16 @@ int bufsize; while (*begin && newsize && isspace(*begin)) { - begin++; - newsize--; + begin++; + newsize--; } end = begin; while (*end && newsize && !isspace(*end)) { - end++; - newsize--; + end++; + newsize--; } if (begin == end) - return 0; + return 0; bufsize = end - begin + 1; newstr = malloc(bufsize); strlcpy(newstr, begin, bufsize); @@ -168,7 +168,7 @@ int stringLength(const char *table, int compress) { int ret = 0; - + while (*table) { if (*table == '\\') @@ -204,11 +204,11 @@ return true; } } else { - + // Legacy plist-style table - + } - + return false; } @@ -220,40 +220,40 @@ * \n escapes in the string. */ char *newStringForStringTableKey( - char *table, - char *key, - config_file_t *config -) + char *table, + char *key, + config_file_t *config + ) { const char *val; char *newstr, *p; int size; if (getValueForConfigTableKey(config, key, &val, &size)) { - newstr = (char *)malloc(size+1); - for (p = newstr; size; size--, p++, val++) { - if ((*p = *val) == '\\') { - switch (*++val) { - case 'r': - *p = '\r'; - break; - case 'n': - *p = '\n'; - break; - case 't': - *p = '\t'; - break; - default: - *p = *val; - break; + newstr = (char *)malloc(size+1); + for (p = newstr; size; size--, p++, val++) { + if ((*p = *val) == '\\') { + switch (*++val) { + case 'r': + *p = '\r'; + break; + case 'n': + *p = '\n'; + break; + case 't': + *p = '\t'; + break; + default: + *p = *val; + break; + } + size--; + } } - size--; - } - } - *p = '\0'; - return newstr; + *p = '\0'; + return newstr; } else { - return 0; + return 0; } } @@ -267,11 +267,11 @@ int size; if (getValueForKey(key, &val, &size, config) && size) { - newstr = (char *)malloc(size + 1); - strlcpy(newstr, val, size + 1); - return newstr; + newstr = (char *)malloc(size + 1); + strlcpy(newstr, val, size + 1); + return newstr; } else { - return 0; + return 0; } } @@ -284,15 +284,15 @@ static const char *getToken(const char *line, const char **begin, int *len) { if (*line == '\"') { - *begin = ++line; - while (*line && *line != '\"') - line++; - *len = line++ - *begin; + *begin = ++line; + while (*line && *line != '\"') + line++; + *len = line++ - *begin; } else { - *begin = line; - while (*line && !isspace(*line) && *line != '=') - line++; - *len = line - *begin; + *begin = line; + while (*line && !isspace(*line) && *line != '=') + line++; + *len = line - *begin; } return line; } @@ -304,25 +304,25 @@ bool retval = false; while (*line) { - /* look for keyword or argument */ - while (isspace(*line)) line++; - - /* now look for '=' or whitespace */ - line = getToken(line, &key, &key_len); - /* line now points to '=' or space */ - if (*line && !isspace(*line)) { - line = getToken(++line, &value, &value_len); - } else { - value = line; - value_len = 0; - } - if ((strlen(match) == key_len) - && strncmp(match, key, key_len) == 0) { - *matchval = value; - *len = value_len; - retval = true; + /* look for keyword or argument */ + while (isspace(*line)) line++; + + /* now look for '=' or whitespace */ + line = getToken(line, &key, &key_len); + /* line now points to '=' or space */ + if (*line && !isspace(*line)) { + line = getToken(++line, &value, &value_len); + } else { + value = line; + value_len = 0; + } + if ((strlen(match) == key_len) + && strncmp(match, key, key_len) == 0) { + *matchval = value; + *len = value_len; + retval = true; /* Continue to look for this key; last one wins. */ - } + } } return retval; } @@ -330,10 +330,10 @@ /* Return NULL if no option has been successfully retrieved, or the string otherwise */ const char * getStringForKey(const char * key, config_file_t *config) { - static const char* value =0; - int len=0; - if(!getValueForKey(key, &value, &len, config)) value = 0; - return value; + static const char* value =0; + int len=0; + if(!getValueForKey(key, &value, &len, config)) value = 0; + return value; } @@ -515,15 +515,15 @@ printSystemConfig(char *p1) { char *p2 = p1, tmp; - + while (*p1 != '\0') { - while (*p2 != '\0' && *p2 != '\n') p2++; - tmp = *p2; - *p2 = '\0'; - printf("%s\n", p1); - *p2 = tmp; - if (tmp == '\0') break; - p1 = ++p2; + while (*p2 != '\0' && *p2 != '\n') p2++; + tmp = *p2; + *p2 = '\0'; + printf("%s\n", p1); + *p2 = tmp; + if (tmp == '\0') break; + p1 = ++p2; } } #endif @@ -543,20 +543,20 @@ TagPtr tag; pos = 0; char *configBuffer; - + configBuffer = malloc(strlen(buffer)+1); strcpy(configBuffer, buffer); - + while (1) { length = XMLParseNextTag(configBuffer + pos, &tag); if (length == -1) break; - + pos += length; - + if (tag == 0) continue; if (tag->type == kTagTypeDict) break; - + XMLFreeTag(tag); } free(configBuffer); @@ -603,7 +603,7 @@ "rd(0,0)/Extra/org.chameleon.Boot.plist", // Add compatibility with the trunk "/Extra/org.chameleon.Boot.plist", // Add compatibility with the trunk "bt(0,0)/Extra/org.chameleon.Boot.plist" // Add compatibility with the trunk - + }; int i,fd, count, ret=-1; @@ -722,7 +722,7 @@ int loadHelperConfig(config_file_t *config) { int rfd, pfd, sfd, count, ret=-1; - + char *dirspec[] = { "/com.apple.boot.P/Library/Preferences/SystemConfiguration/com.apple.Boot.plist", "/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist", @@ -760,7 +760,7 @@ sysConfigValid = true; ret=0; } - + } else { @@ -774,7 +774,7 @@ count = read(pfd, config->plist, IO_CONFIG_DATA_SIZE); close(pfd); close(rfd); - + // build xml dictionary ParseXMLFile(config->plist, &config->dictionary); sysConfigValid = true; @@ -793,7 +793,7 @@ ret=0; } - + } else { @@ -811,72 +811,117 @@ } } - + } - + return ret; } #endif +static char * AllocInitStringWithLength(const char * oldString, int len) +{ + char *Buf = NULL; + Buf = malloc(len); + if (Buf == NULL) return NULL; + + if (oldString != NULL) + strlcpy(Buf, oldString,len); + + return Buf; +} + +static char * AllocInitZeroEndedStringWithLength(const char * oldString, int len) +{ + if (len > 0) + { + return AllocInitStringWithLength( oldString, len + 1); + } + return NULL; +} + char * newString(const char * oldString) -{ +{ if ( oldString ) - return strcpy(malloc(strlen(oldString)+1), oldString); - else - return NULL; + { + int len = strlen(oldString); + + if (len > 0) + { + return AllocInitZeroEndedStringWithLength(oldString, len); + } + } + return NULL; } +char * newStringWithLength(const char * oldString, int len) +{ + if (len > 0) + { + return AllocInitZeroEndedStringWithLength(oldString, len); + } + return NULL; +} + +char * newEmptyStringWithLength(int len) +{ + if (len > 0) + { + return AllocInitZeroEndedStringWithLength(NULL, len); + } + return NULL; +} + /* * Extracts the next argument from the command line, double quotes are allowed here. */ char * getNextArg(char ** argPtr, char * val) { - char * ptr = *argPtr; - const char * strStart; - int len = 0; - bool isQuoted = false; - - *val = '\0'; - - // Scan for the next non-whitespace character. - while ( *ptr && (*ptr == ' ' || *ptr == '=') ) - { - ptr++; - } - - strStart = ptr; - - // Skip the leading double quote character. - if (*ptr == '\"') - { - isQuoted = true; - ptr++; - strStart++; - } - - // Scan for the argument terminator character. - // This can be either a NULL character - in case we reach the end of the string, - // a double quote in case of quoted argument, - // or a whitespace character (' ' or '=') for non-quoted argument. - while (*ptr && !( (isQuoted && (*ptr == '\"')) || - (!isQuoted && (*ptr == ' ' || *ptr == '=')) ) - ) - { - ptr++; - } - - len = ptr - strStart; - - // Skip the closing double quote character and adjust - // the starting pointer for the next getNextArg call. - if (*ptr && isQuoted && *ptr == '\"') - ptr++; - - // Copy the extracted argument to val. - strncat(val, strStart, len); - - // Set command line pointer. - *argPtr = ptr; - - return ptr; + char * ptr = *argPtr; + const char * strStart; + int len = 0; + bool isQuoted = false; + + *val = '\0'; + + // Scan for the next non-whitespace character. + while ( *ptr && (*ptr == ' ' || *ptr == '=') ) + { + ptr++; + } + + strStart = ptr; + + // Skip the leading double quote character. + if (*ptr == '\"') + { + isQuoted = true; + ptr++; + strStart++; + } + + // Scan for the argument terminator character. + // This can be either a NULL character - in case we reach the end of the string, + // a double quote in case of quoted argument, + // or a whitespace character (' ' or '=') for non-quoted argument. + while (*ptr && !( (isQuoted && (*ptr == '\"')) || + (!isQuoted && (*ptr == ' ' || *ptr == '=')) ) + ) + { + ptr++; + } + + len = ptr - strStart; + + // Skip the closing double quote character and adjust + // the starting pointer for the next getNextArg call. + if (*ptr && isQuoted && *ptr == '\"') + ptr++; + + // Copy the extracted argument to val. + strncat(val, strStart, len); + + // Set command line pointer. + *argPtr = ptr; + + return ptr; } Index: branches/cparm/i386/libsaio/saio_types.h =================================================================== --- branches/cparm/i386/libsaio/saio_types.h (revision 1803) +++ branches/cparm/i386/libsaio/saio_types.h (revision 1804) @@ -45,7 +45,7 @@ /* * Max size fo config data array, in bytes. */ -#define IO_CONFIG_DATA_SIZE 4096 // was 163840 +#define IO_CONFIG_DATA_SIZE 40960 // was 4096 // was 163840 #define rand_tab_len 100 Index: branches/cparm/i386/libsaio/fake_efi.c =================================================================== --- branches/cparm/i386/libsaio/fake_efi.c (revision 1803) +++ branches/cparm/i386/libsaio/fake_efi.c (revision 1804) @@ -186,7 +186,7 @@ gEfiConfigurationTable64[i].VendorTable = (EFI_PTR32)table; gNumTables64++ ; } - + Node *tableNode = DT__AddChild(gEfiConfigurationTableNode, mallocStringForGuid(pGuid)); // Use the pointer to the GUID we just stuffed into the system table @@ -253,7 +253,7 @@ num = (EFI_UINTN)gST64->NumberOfTableEntries; } - msglog("EFI Configuration table :\n"); + msglog("EFI Configuration table :\n"); for (i=0; ivoidret_instructions, VOIDRET_INSTRUCTIONS, sizeof(VOIDRET_INSTRUCTIONS));\ - memcpy(fakeEfiPages->unsupportedret_instructions, UNSUPPORTEDRET_INSTRUCTIONS, sizeof(UNSUPPORTEDRET_INSTRUCTIONS));\ - /*-------------------------------------------------------------------- - * System table*/\ - EFI_SYSTEM_TABLE_##mode *efiSystemTable = gST##mode = &fakeEfiPages->efiSystemTable;\ - efiSystemTable->Hdr.Signature = EFI_SYSTEM_TABLE_SIGNATURE;\ - efiSystemTable->Hdr.Revision = EFI_SYSTEM_TABLE_REVISION;\ - efiSystemTable->Hdr.HeaderSize = sizeof(EFI_SYSTEM_TABLE_##mode);\ - efiSystemTable->Hdr.CRC32 = 0;/*Initialize to zero and then do CRC32*/ \ - efiSystemTable->Hdr.Reserved = 0;\ - efiSystemTable->FirmwareVendor = pto(mode, &fakeEfiPages->firmwareVendor);\ - memcpy(fakeEfiPages->firmwareVendor, FIRMWARE_VENDOR, sizeof(FIRMWARE_VENDOR));\ - efiSystemTable->FirmwareRevision = FIRMWARE_REVISION;\ - /* XXX: We may need to have basic implementations of ConIn/ConOut/StdErr - * The EFI spec states that all handles are invalid after boot services have been - * exited so we can probably get by with leaving the handles as zero. - */\ - efiSystemTable->ConsoleInHandle = 0;\ - efiSystemTable->ConIn = 0;\ - efiSystemTable->ConsoleOutHandle = 0;\ - efiSystemTable->ConOut = 0;\ - efiSystemTable->StandardErrorHandle = 0;\ - efiSystemTable->StdErr = 0;\ - efiSystemTable->RuntimeServices = pto(mode,&fakeEfiPages->efiRuntimeServices) ;\ - /* According to the EFI spec, BootServices aren't valid after the - * boot process is exited so we can probably do without it. - * Apple didn't provide a definition for it in pexpert/i386/efi.h - * so I'm guessing they don't use it. - */\ - efiSystemTable->BootServices = 0;\ - efiSystemTable->NumberOfTableEntries = 0;\ - efiSystemTable->ConfigurationTable = pto(mode,fakeEfiPages->efiConfigurationTable);\ - /* We're done. Now CRC32 the thing so the kernel will accept it. - * Must be initialized to zero before CRC32, done above. - */\ - gST##mode->Hdr.CRC32 = crc32(0L, gST##mode, gST##mode->Hdr.HeaderSize);\ - /*-------------------------------------------------------------------- - * Runtime services*/\ - EFI_RUNTIME_SERVICES_##mode *efiRuntimeServices = &fakeEfiPages->efiRuntimeServices;\ - efiRuntimeServices->Hdr.Signature = EFI_RUNTIME_SERVICES_SIGNATURE;\ - efiRuntimeServices->Hdr.Revision = EFI_RUNTIME_SERVICES_REVISION;\ - efiRuntimeServices->Hdr.HeaderSize = sizeof(EFI_RUNTIME_SERVICES_##mode);\ - efiRuntimeServices->Hdr.CRC32 = 0;\ - efiRuntimeServices->Hdr.Reserved = 0;\ - /* There are a number of function pointers in the efiRuntimeServices table. - * These are the Foundation (e.g. core) services and are expected to be present on - * all EFI-compliant machines. Some kernel extensions (notably AppleEFIRuntime) - * will call these without checking to see if they are null. - * - * We don't really feel like doing an EFI implementation in the bootloader - * but it is nice if we can at least prevent a complete crash by - * at least providing some sort of implementation until one can be provided - * nicely in a kext. - */\ - void (*voidret_fp)() = (void*)fakeEfiPages->voidret_instructions;\ - void (*unsupportedret_fp)() = (void*)fakeEfiPages->unsupportedret_instructions;\ - efiRuntimeServices->GetTime = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->SetTime = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->GetWakeupTime = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->SetWakeupTime = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->SetVirtualAddressMap = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->ConvertPointer = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->GetVariable = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->GetNextVariableName = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->SetVariable = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->GetNextHighMonotonicCount = pto(mode,unsupportedret_fp);\ - efiRuntimeServices->ResetSystem = pto(mode,voidret_fp);\ - /*We're done. Now CRC32 the thing so the kernel will accept it*/\ - efiRuntimeServices->Hdr.CRC32 = crc32(0L, efiRuntimeServices, efiRuntimeServices->Hdr.HeaderSize);\ - /*-------------------------------------------------------------------- - * Finish filling in the rest of the boot args that we need.*/\ - bootArgs->efiSystemTable = (uint32_t)efiSystemTable;\ - bootArgs->efiMode = kBootArgsEfiMode##mode;\ - /* The bootArgs structure as a whole is bzero'd so we don't need to fill in - * things like efiRuntimeServices* and what not. - * - * In fact, the only code that seems to use that is the hibernate code so it - * knows not to save the pages. It even checks to make sure its nonzero. - */\ +struct fake_efi_pages \ +{\ +/* We use the fake_efi_pages struct so that we only need to do one kernel +* memory allocation for all needed EFI data. Otherwise, small allocations +* like the FIRMWARE_VENDOR string would take up an entire page. +* NOTE WELL: Do NOT assume this struct has any particular layout within itself. +* It is absolutely not intended to be publicly exposed anywhere +* We say pages (plural) although right now we are well within the 1 page size +* and probably will stay that way. +*/\ +EFI_SYSTEM_TABLE_##mode efiSystemTable;\ +EFI_RUNTIME_SERVICES_##mode efiRuntimeServices;\ +EFI_CONFIGURATION_TABLE_##mode efiConfigurationTable[MAX_CONFIGURATION_TABLE_ENTRIES];\ +EFI_CHAR16 firmwareVendor[sizeof(FIRMWARE_VENDOR)/sizeof(EFI_CHAR16)];\ +uint8_t voidret_instructions[sizeof(VOIDRET_INSTRUCTIONS)/sizeof(uint8_t)];\ +uint8_t unsupportedret_instructions[sizeof(UNSUPPORTEDRET_INSTRUCTIONS)/sizeof(uint8_t)];\ +};\ +struct fake_efi_pages *fakeEfiPages = (struct fake_efi_pages*)AllocateKernelMemory(sizeof(struct fake_efi_pages));\ +/* Zero out all the tables in case fields are added later*/\ +bzero(fakeEfiPages, sizeof(struct fake_efi_pages));\ +/*-------------------------------------------------------------------- +* Initialize some machine code that will return EFI_UNSUPPORTED for +* functions returning int and simply return for void functions.*/\ +memcpy(fakeEfiPages->voidret_instructions, VOIDRET_INSTRUCTIONS, sizeof(VOIDRET_INSTRUCTIONS));\ +memcpy(fakeEfiPages->unsupportedret_instructions, UNSUPPORTEDRET_INSTRUCTIONS, sizeof(UNSUPPORTEDRET_INSTRUCTIONS));\ +/*-------------------------------------------------------------------- +* System table*/\ +EFI_SYSTEM_TABLE_##mode *efiSystemTable = gST##mode = &fakeEfiPages->efiSystemTable;\ +efiSystemTable->Hdr.Signature = EFI_SYSTEM_TABLE_SIGNATURE;\ +efiSystemTable->Hdr.Revision = EFI_SYSTEM_TABLE_REVISION;\ +efiSystemTable->Hdr.HeaderSize = sizeof(EFI_SYSTEM_TABLE_##mode);\ +efiSystemTable->Hdr.CRC32 = 0;/*Initialize to zero and then do CRC32*/ \ +efiSystemTable->Hdr.Reserved = 0;\ +efiSystemTable->FirmwareVendor = pto(mode, &fakeEfiPages->firmwareVendor);\ +memcpy(fakeEfiPages->firmwareVendor, FIRMWARE_VENDOR, sizeof(FIRMWARE_VENDOR));\ +efiSystemTable->FirmwareRevision = FIRMWARE_REVISION;\ +/* XXX: We may need to have basic implementations of ConIn/ConOut/StdErr +* The EFI spec states that all handles are invalid after boot services have been +* exited so we can probably get by with leaving the handles as zero. +*/\ +efiSystemTable->ConsoleInHandle = 0;\ +efiSystemTable->ConIn = 0;\ +efiSystemTable->ConsoleOutHandle = 0;\ +efiSystemTable->ConOut = 0;\ +efiSystemTable->StandardErrorHandle = 0;\ +efiSystemTable->StdErr = 0;\ +efiSystemTable->RuntimeServices = pto(mode,&fakeEfiPages->efiRuntimeServices) ;\ +/* According to the EFI spec, BootServices aren't valid after the +* boot process is exited so we can probably do without it. +* Apple didn't provide a definition for it in pexpert/i386/efi.h +* so I'm guessing they don't use it. +*/\ +efiSystemTable->BootServices = 0;\ +efiSystemTable->NumberOfTableEntries = 0;\ +efiSystemTable->ConfigurationTable = pto(mode,fakeEfiPages->efiConfigurationTable);\ +/* We're done. Now CRC32 the thing so the kernel will accept it. +* Must be initialized to zero before CRC32, done above. +*/\ +gST##mode->Hdr.CRC32 = crc32(0L, gST##mode, gST##mode->Hdr.HeaderSize);\ +/*-------------------------------------------------------------------- +* Runtime services*/\ +EFI_RUNTIME_SERVICES_##mode *efiRuntimeServices = &fakeEfiPages->efiRuntimeServices;\ +efiRuntimeServices->Hdr.Signature = EFI_RUNTIME_SERVICES_SIGNATURE;\ +efiRuntimeServices->Hdr.Revision = EFI_RUNTIME_SERVICES_REVISION;\ +efiRuntimeServices->Hdr.HeaderSize = sizeof(EFI_RUNTIME_SERVICES_##mode);\ +efiRuntimeServices->Hdr.CRC32 = 0;\ +efiRuntimeServices->Hdr.Reserved = 0;\ +/* There are a number of function pointers in the efiRuntimeServices table. +* These are the Foundation (e.g. core) services and are expected to be present on +* all EFI-compliant machines. Some kernel extensions (notably AppleEFIRuntime) +* will call these without checking to see if they are null. +* +* We don't really feel like doing an EFI implementation in the bootloader +* but it is nice if we can at least prevent a complete crash by +* at least providing some sort of implementation until one can be provided +* nicely in a kext. +*/\ +void (*voidret_fp)() = (void*)fakeEfiPages->voidret_instructions;\ +void (*unsupportedret_fp)() = (void*)fakeEfiPages->unsupportedret_instructions;\ +efiRuntimeServices->GetTime = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->SetTime = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->GetWakeupTime = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->SetWakeupTime = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->SetVirtualAddressMap = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->ConvertPointer = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->GetVariable = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->GetNextVariableName = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->SetVariable = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->GetNextHighMonotonicCount = pto(mode,unsupportedret_fp);\ +efiRuntimeServices->ResetSystem = pto(mode,voidret_fp);\ +/*We're done. Now CRC32 the thing so the kernel will accept it*/\ +efiRuntimeServices->Hdr.CRC32 = crc32(0L, efiRuntimeServices, efiRuntimeServices->Hdr.HeaderSize);\ +/*-------------------------------------------------------------------- +* Finish filling in the rest of the boot args that we need.*/\ +bootArgs->efiSystemTable = (uint32_t)efiSystemTable;\ +bootArgs->efiMode = kBootArgsEfiMode##mode;\ +/* The bootArgs structure as a whole is bzero'd so we don't need to fill in +* things like efiRuntimeServices* and what not. +* +* In fact, the only code that seems to use that is the hibernate code so it +* knows not to save the pages. It even checks to make sure its nonzero. +*/\ } /* @@ -713,30 +713,30 @@ DT__AddProperty(chosenNode, kBootUUIDKey, strlen(bootInfo->uuidStr)+1, bootInfo->uuidStr); #if 0 if (gRootPath[0]) - { - - DT__AddProperty(chosenNode, "rootpath" or try "root-matching", strlen(gRootPath)+1, gRootPath); - - } - else + { + + DT__AddProperty(chosenNode, "rootpath" or try "root-matching", strlen(gRootPath)+1, gRootPath); + + } + else #endif - if (gRootDevice) - { - - DT__AddProperty(chosenNode, "boot-device-path", strlen(gRootDevice)+1, gRootDevice); - - } + if (gRootDevice) + { + + DT__AddProperty(chosenNode, "boot-device-path", strlen(gRootDevice)+1, gRootDevice); + + } // "boot-file" is not used by kextcache if there is no "boot-device-path" or if there is a valid "rootpath" , // but i let it by default since it may be used by another service DT__AddProperty(chosenNode, "boot-file", strlen(bootInfo->bootFile)+1, (EFI_CHAR16*)bootInfo->bootFile); - + if (bootInfo->adler32) DT__AddProperty(chosenNode, "boot-kernelcache-adler32", sizeof(unsigned long), &bootInfo->adler32); } } - + // We could also just do DT__FindNode("/efi/platform", true) // But I think eventually we want to fill stuff in the efi node // too so we might as well create it so we have a pointer for it too. @@ -788,9 +788,9 @@ { DT__AddProperty(efiNode, MOTHERBOARD_NAME_PROP, strlen(DefaultPlatform)+1, DefaultPlatform); } - + } - + // Set up the /efi/configuration-table node which will eventually have several child nodes for // all of the configuration tables needed by various kernel extensions. gEfiConfigurationTableNode = DT__AddChild(efiNode, "configuration-table"); @@ -844,13 +844,13 @@ void setupSmbiosConfigFile(const char *filename) { static bool readSmbConfigFile = true; - + if (readSmbConfigFile == true) { char dirSpecSMBIOS[128] = ""; const char *override_pathname = NULL; int len = 0, err = 0; - + // Take in account user overriding if (getValueForKey("SMBIOS", &override_pathname, &len, &bootInfo->bootConfig) && len > 0) { @@ -869,7 +869,7 @@ err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig); } } - + if (err) { verbose("No SMBIOS config file found.\n"); @@ -907,7 +907,7 @@ } ACPI_TABLE_FACS *FacsPointer = (acpi_tables.FacsPointer64 != (void*)0ul) ? (ACPI_TABLE_FACS *)acpi_tables.FacsPointer64:(ACPI_TABLE_FACS *)acpi_tables.FacsPointer; - + Platform->hardware_signature = FacsPointer->HardwareSignature; } while (0); @@ -933,7 +933,7 @@ { if (smbios_p) addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL); - + if (Platform->CPU.Vendor == 0x756E6547 /* Intel */) { int num_cpus; @@ -954,7 +954,7 @@ } #endif } - + // PM_Model if (Platform->CPU.isServer == true) { @@ -968,7 +968,7 @@ { Platform->Type = Desktop; } - + // Invalidate the platform hardware signature (this needs to be verified with acpica, but i guess that 0xFFFFFFFF is an invalid signature) Platform->hardware_signature = 0xFFFFFFFF; @@ -993,7 +993,7 @@ { // Collect PCI info &| Generate device prop string setup_pci_devs(root_pci_dev); - + // load smbios.plist file if any setupSmbiosConfigFile("SMBIOS.plist"); setup_Smbios(); Index: branches/cparm/i386/libsaio/misc.c =================================================================== --- branches/cparm/i386/libsaio/misc.c (revision 1803) +++ branches/cparm/i386/libsaio/misc.c (revision 1804) @@ -178,10 +178,7 @@ int random (struct ran_obj* self) { - - //struct ran_opt * ret = (struct ran_opt * )malloc(sizeof(struct ran_opt)); - //ret = rt ; - + struct ran_obj * ret = self ; static int wheel = 0; Index: branches/cparm/i386/libsaio/saio_internal.h =================================================================== --- branches/cparm/i386/libsaio/saio_internal.h (revision 1803) +++ branches/cparm/i386/libsaio/saio_internal.h (revision 1804) @@ -27,6 +27,10 @@ #include "saio_types.h" +/* arc4random.c */ +extern void arc4rand(void *ptr, u_int len, int reseed); +extern uint32_t arc4random(void); + /* asm.s */ extern void real_to_prot(void); extern void prot_to_real(void); @@ -101,6 +105,7 @@ extern int error(const char *format, ...); extern int verbose(const char *format, ...); extern void stop(const char *format, ...); +extern char * newStringWithFormat(const char * fmt, ...); /* disk.c */ extern void rescanBIOSDevice(int biosdev); @@ -122,11 +127,11 @@ /* hfs_compare.c */ extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1, - u_int16_t *uniStr2, u_int32_t len2, int byte_order); + u_int16_t *uniStr2, u_int32_t len2, int byte_order); extern void utf_encodestr( const u_int16_t * ucsp, int ucslen, - u_int8_t * utf8p, u_int32_t bufsize, int byte_order ); + u_int8_t * utf8p, u_int32_t bufsize, int byte_order ); extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp, - u_int16_t *ucslen, u_int32_t bufsize, int byte_order ); + u_int16_t *ucslen, u_int32_t bufsize, int byte_order ); /* load.c */ extern bool gHaveKernelCache; @@ -184,6 +189,9 @@ #endif extern int loadOverrideConfig(config_file_t *configBuff); extern char * newString(const char *oldString); +extern char * newEmptyStringWithLength(int len); +extern char * newStringWithLength(const char * oldString, int len); + extern char * getNextArg(char ** ptr, char * val); extern int ParseXMLFile( char * buffer, TagPtr * dict ); Index: branches/cparm/i386/boot2/graphics.c =================================================================== --- branches/cparm/i386/boot2/graphics.c (revision 1803) +++ branches/cparm/i386/boot2/graphics.c (revision 1804) @@ -142,7 +142,7 @@ //bzero( outModeInfo, sizeof(*outModeInfo) ); bzero( outModeInfo, sizeof(VBEModeInfoBlock) ); - + // Get VBE controller info containing the list of supported modes. //bzero( &vbeInfo, sizeof(vbeInfo) ); @@ -168,7 +168,7 @@ //bzero( &modeInfo, sizeof(modeInfo) ); bzero( &modeInfo, sizeof(VBEModeInfoBlock) ); - + err = getVBEModeInfo( *modePtr, &modeInfo ); if ( err != errSuccess ) { @@ -241,7 +241,7 @@ matchedMode = *modePtr; //bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) ); bcopy( &modeInfo, outModeInfo, sizeof(VBEModeInfoBlock) ); - + break; } @@ -263,7 +263,7 @@ matchedMode = *modePtr; //bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) ); bcopy( &modeInfo, outModeInfo, sizeof(VBEModeInfoBlock) ); - + } return matchedMode; @@ -615,7 +615,7 @@ unsigned long params[4]; int count; int err = errSuccess; - + if ( mode == GRAPHICS_MODE ) { if ( (err=initGraphicsMode ()) == errSuccess ) { @@ -669,11 +669,11 @@ spinActivityIndicator(int sectors) { static unsigned long lastTickTime = 0, currentTickTime; - + bool doreturn = false; execute_hook("spinActivity_hook", §ors, &doreturn, NULL, NULL, NULL, NULL); if (doreturn == true) return; - + currentTickTime = time18(); // late binding if (currentTickTime < lastTickTime + MIN_TICKS) { Index: branches/cparm/i386/boot2/boot.c =================================================================== --- branches/cparm/i386/boot2/boot.c (revision 1803) +++ branches/cparm/i386/boot2/boot.c (revision 1804) @@ -1030,13 +1030,15 @@ { if (strcmp(name, name_compare) == 0) { - DBG("found : %s\n", name); + DBG("found : %s\n", name); + closedir(moduleDir); return true; } } else { - DBG("found : %s\n", name); + DBG("found : %s\n", name); + closedir(moduleDir); return true; } } @@ -1055,6 +1057,10 @@ #endif } + if (moduleDir) { + closedir(moduleDir); + + } return false; } Index: branches/cparm/i386/boot2/modules.c =================================================================== --- branches/cparm/i386/boot2/modules.c (revision 1803) +++ branches/cparm/i386/boot2/modules.c (revision 1804) @@ -25,7 +25,7 @@ moduleHook_t* moduleCallbacks = NULL; moduleList_t* loadedModules = NULL; symbolList_t* moduleSymbols = NULL; -unsigned int (*lookup_symbol)(const char*) = NULL; +unsigned int (*lookup_symbol)(const char*, int(*strcmp_callback)(const char*, const char*)) = NULL; #if DEBUG_MODULES VOID print_hook_list() @@ -71,7 +71,7 @@ if((UInt32)lookup_symbol != 0xFFFFFFFF) { - return status; + return EFI_SUCCESS; } } @@ -99,16 +99,18 @@ while(readdir(moduleDir, (const char**)&name, &flags, &time) >= 0) { if ((strcmp(SYMBOLS_MODULE,name)) == 0) continue; // if we found Symbols.dylib, just skip it - + int len = strlen(name); int ext_size = sizeof("dylib"); if (len >= ext_size) { if(strcmp(&name[len - ext_size], ".dylib") == 0) - { - char* tmp = malloc(len /*+ 1*/); - strlcpy(tmp, name, len + 1); + { + char *tmp = newString(name); + if (!tmp) { + continue; + } msglog("* Attempting to load module: %s\n", tmp); if(load_module(tmp) != EFI_SUCCESS) { @@ -129,8 +131,15 @@ DBG("Ignoring %s\n", name); } #endif - + } + + if (moduleDir) + { + closedir(moduleDir); + + } + #if DEBUG_MODULES print_symbol_list(); #endif @@ -143,8 +152,8 @@ EFI_STATUS load_module(char* module) { void (*module_start)(void) = NULL; - + // Check to see if the module has already been loaded if(is_module_loaded(module) == EFI_SUCCESS) { @@ -152,9 +161,13 @@ return EFI_ALREADY_STARTED; } - char modString[128]; int fh = -1; - sprintf(modString, "/Extra/modules/%s", module); + char *modString=NULL; + modString = newStringWithFormat( "/Extra/modules/%s", module); + if (!modString) { + printf("Unable to allocate module name : /Extra/modules/%s\n", module); + return EFI_OUT_OF_RESOURCES; + } fh = open(modString); if(fh < 0) { @@ -164,22 +177,30 @@ #else msglog("Unable to locate module %s\n", modString); #endif - return EFI_OUT_OF_RESOURCES; + free(modString); + return EFI_OUT_OF_RESOURCES; } EFI_STATUS ret = EFI_SUCCESS; { int moduleSize = file_size(fh); - char* module_base = (char*) malloc(moduleSize); - if (moduleSize && read(fh, module_base, moduleSize) == moduleSize) + + char* module_base = NULL; + + if (moduleSize > 0) { + module_base = (char*) malloc(moduleSize); + } + + if (module_base && read(fh, module_base, moduleSize) == moduleSize) + { DBG("Module %s read in.\n", modString); // Module loaded into memory, parse it module_start = parse_mach(module_base, &load_module, &add_symbol); - if(module_start && module_start != (void*)0xFFFFFFFF) + if(module_start && (module_start != (void*)0xFFFFFFFF)) { module_loaded(module/*moduleName, moduleVersion, moduleCompat*/); // Notify the system that it was laoded @@ -206,6 +227,7 @@ } } close(fh); + free(modString); return ret; } @@ -270,7 +292,7 @@ */ VOID register_hook_callback(const char* name, void(*callback)(void*, void*, void*, void*, void*, void*)) { - DBG("Adding callback for '%s' hook.\n", name); + DBG("Adding callback for hook '%s'.\n", name); moduleHook_t* hook = get_callback(name); @@ -278,6 +300,10 @@ { // append callbackList_t* newCallback = malloc(sizeof(callbackList_t)); + if (!newCallback) { + DBG("Unable to allocate memory for callback \n"); + return; + } newCallback->next = hook->callbacks; hook->callbacks = newCallback; newCallback->callback = callback; @@ -285,9 +311,18 @@ else { // create new hook - moduleHook_t* newHook = malloc(sizeof(moduleHook_t)); + moduleHook_t* newHook = malloc(sizeof(moduleHook_t)); + if (!newHook) { + DBG("Unable to allocate memory for hook '%s'.\n", name); + return; + } newHook->name = name; newHook->callbacks = malloc(sizeof(callbackList_t)); + if (!newHook->callbacks) { + DBG("Unable to allocate memory for callback \n"); + free(newHook); + return; + } newHook->callbacks->callback = callback; newHook->callbacks->next = NULL; @@ -324,14 +359,14 @@ // Module info /*char* moduleName = NULL; - UInt32 moduleVersion = 0; - UInt32 moduleCompat = 0; - */ + UInt32 moduleVersion = 0; + UInt32 moduleCompat = 0; + */ // TODO convert all of the structs to a union struct dyld_info_command* dyldInfoCommand = NULL; struct symtab_command* symtabCommand = NULL; - + { struct segment_command *segCommand = NULL; struct segment_command_64 *segCommand64 = NULL; @@ -392,7 +427,7 @@ { UInt32 sectionIndex; -#if HARD_DEBUG_MODULES +#if DEBUG_MODULES unsigned long fileaddr; long filesize; vmaddr = (segCommand->vmaddr & 0x3fffffff); @@ -403,8 +438,12 @@ printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n", segCommand->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize, (unsigned) segCommand->nsects, (unsigned)segCommand->flags); +#if DEBUG_MODULES==2 + getc(); #endif +#endif + sectionIndex = sizeof(struct segment_command); struct section *sect; @@ -437,8 +476,7 @@ { UInt32 sectionIndex; -#if HARD_DEBUG_MODULES - +#if DEBUG_MODULES unsigned long fileaddr; long filesize; vmaddr = (segCommand64->vmaddr & 0x3fffffff); @@ -449,8 +487,11 @@ printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n", segCommand64->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize, (unsigned) segCommand64->nsects, (unsigned)segCommand64->flags); +#if DEBUG_MODULES==2 + getc(); #endif +#endif sectionIndex = sizeof(struct segment_command_64); @@ -487,24 +528,31 @@ // TODO: verify version // = dylibCommand->dylib.current_version; // = dylibCommand->dylib.compatibility_version; - char* name = malloc(strlen(module) + strlen(".dylib") + 1); - sprintf(name, "%s.dylib", module); - if(dylib_loader == EFI_SUCCESS) + + char *name=NULL; + name = newStringWithFormat( "%s.dylib", module); + if (!name) { + printf("Unable to allocate module name : %s\n", module); + return NULL; + } + if(dylib_loader) { EFI_STATUS statue = dylib_loader(name); if( statue != EFI_SUCCESS) { - free(name); if (statue != EFI_ALREADY_STARTED) { // Unable to load dependancy + free(name); return NULL; } } } + free(name); + break; } case LC_ID_DYLIB: @@ -536,10 +584,10 @@ } //if(!moduleName) return NULL; } - + // bind_macho uses the symbols. module_start = (void*)handle_symtable((UInt32)binary, symtabCommand, symbol_handler, is64); - + // Rebase the module before binding it. if(dyldInfoCommand && dyldInfoCommand->rebase_off) { @@ -563,7 +611,7 @@ // This should be changed to bind when a symbol is referened at runtime instead. bind_macho(binary, (char*)dyldInfoCommand->lazy_bind_off, dyldInfoCommand->lazy_bind_size); } - + return module_start; } @@ -593,8 +641,8 @@ { immediate = rebase_stream[i] & REBASE_IMMEDIATE_MASK; opcode = rebase_stream[i] & REBASE_OPCODE_MASK; - + switch(opcode) { case REBASE_OPCODE_DONE: @@ -673,8 +721,8 @@ segmentAddress += sizeof(void*); } break; - + case REBASE_OPCODE_DO_REBASE_ULEB_TIMES: tmp = 0; bits = 0; @@ -732,7 +780,7 @@ index = 0; for (index = 0; index < tmp; ++index) { - + rebase_location(base + segmentAddress, (char*)base, type); segmentAddress += tmp2 + sizeof(void*); @@ -763,7 +811,7 @@ SInt32 addend = 0; // TODO: handle this SInt32 libraryOrdinal = 0; - + const char* symbolName = NULL; UInt8 symboFlags = 0; UInt32 symbolAddr = 0xFFFFFFFF; @@ -805,14 +853,14 @@ while(bind_stream[i] & 0x80); //DBG("BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB: %d\n", libraryOrdinal); - + break; case BIND_OPCODE_SET_DYLIB_SPECIAL_IMM: // NOTE: this is wrong, fortunately we don't use it libraryOrdinal = -immediate; //DBG("BIND_OPCODE_SET_DYLIB_SPECIAL_IMM: %d\n", libraryOrdinal); - + break; case BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: @@ -820,16 +868,16 @@ symbolName = (char*)&bind_stream[++i]; i += strlen((char*)&bind_stream[i]); //DBG("BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: %s, 0x%X\n", symbolName, symboFlags); - + symbolAddr = lookup_all_symbols(symbolName); - + break; case BIND_OPCODE_SET_TYPE_IMM: // Set bind type (pointer, absolute32, pcrel32) type = immediate; //DBG("BIND_OPCODE_SET_TYPE_IMM: %d\n", type); - + break; case BIND_OPCODE_SET_ADDEND_SLEB: @@ -902,7 +950,7 @@ if(symbolAddr != 0xFFFFFFFF) { address = segmentAddress + (UInt32)base; - + bind_location((UInt32*)address, (char*)symbolAddr, addend, BIND_TYPE_POINTER); } else if(strcmp(symbolName, SYMBOL_DYLD_STUB_BINDER) != 0) @@ -933,7 +981,7 @@ if(symbolAddr != 0xFFFFFFFF) { address = segmentAddress + (UInt32)base; - + bind_location((UInt32*)address, (char*)symbolAddr, addend, BIND_TYPE_POINTER); } else if(strcmp(symbolName, SYMBOL_DYLD_STUB_BINDER) != 0) @@ -941,8 +989,8 @@ printf("Unable to bind symbol %s\n", symbolName); } segmentAddress += tmp + sizeof(void*); - + break; case BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED: @@ -951,7 +999,7 @@ if(symbolAddr != 0xFFFFFFFF) { address = segmentAddress + (UInt32)base; - + bind_location((UInt32*)address, (char*)symbolAddr, addend, BIND_TYPE_POINTER); } else if(strcmp(symbolName, SYMBOL_DYLD_STUB_BINDER) != 0) @@ -959,12 +1007,12 @@ printf("Unable to bind symbol %s\n", symbolName); } segmentAddress += (immediate * sizeof(void*)) + sizeof(void*); - + break; case BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: - + tmp = 0; bits = 0; do @@ -973,8 +1021,8 @@ bits += 7; } while(bind_stream[i] & 0x80); - + tmp2 = 0; bits = 0; do @@ -986,15 +1034,15 @@ //DBG("BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB 0x%X 0x%X\n", tmp, tmp2); - + if(symbolAddr != 0xFFFFFFFF) { for(index = 0; index < tmp; index++) { address = segmentAddress + (UInt32)base; - + bind_location((UInt32*)address, (char*)symbolAddr, addend, BIND_TYPE_POINTER); segmentAddress += tmp2 + sizeof(void*); @@ -1033,22 +1081,22 @@ { // do actual update char* newValue = value + addend; - + switch (type) { case BIND_TYPE_POINTER: case BIND_TYPE_TEXT_ABSOLUTE32: break; - + case BIND_TYPE_TEXT_PCREL32: newValue -= ((UInt32)location + 4); - + break; default: return; } *location = (UInt32)newValue; - + } /* @@ -1089,9 +1137,9 @@ if (new_entry) { new_entry->next = loadedModules; - + loadedModules = new_entry; - + new_entry->module = (char*)name; // new_entry->version = version; // new_entry->compat = compat; @@ -1104,10 +1152,10 @@ while(entry) { DBG("Comparing %s with %s\n", name, entry->module); - char fullname[128]; - sprintf(fullname, "%s.dylib",name); - if((strcmp(entry->module, name) == 0) || (strcmp(entry->module, fullname) == 0)) + char *fullname = newStringWithFormat("%s.dylib",name); + if(fullname && ((strcmp(entry->module, name) == 0) || (strcmp(entry->module, fullname) == 0))) { + free(fullname); DBG("Located module %s\n", name); return EFI_SUCCESS; } @@ -1115,10 +1163,10 @@ { entry = entry->next; } - + } DBG("Module %s not found\n", name); - + return EFI_NOT_FOUND; } @@ -1130,7 +1178,7 @@ unsigned int addr = 0xFFFFFFFF; if(lookup_symbol && (UInt32)lookup_symbol != 0xFFFFFFFF) { - addr = lookup_symbol(name); + addr = lookup_symbol(name, &strcmp); if(addr != 0xFFFFFFFF) { DBG("Internal symbol %s located at 0x%X\n", name, addr); @@ -1138,7 +1186,7 @@ } } } - + { symbolList_t* entry = moduleSymbols; while(entry) @@ -1171,7 +1219,7 @@ * parse the symbol table * Lookup any undefined symbols */ - + unsigned int handle_symtable(UInt32 base, struct symtab_command* symtabCommand, long long(*symbol_handler)(char*, long long, char), char is64) { unsigned int module_start = 0xFFFFFFFF; @@ -1186,9 +1234,8 @@ { if(symbolEntry->n_value) { - if(strcmp(symbolString + symbolEntry->n_un.n_strx, "start") == 0) + if(strstr(symbolString + symbolEntry->n_un.n_strx, "module_start") || (strcmp(symbolString + symbolEntry->n_un.n_strx, "start") == 0)) { - // Module start located. 'start' is an alias so don't register it module_start = base + symbolEntry->n_value; DBG("n_value %x module_start %x\n", (unsigned)symbolEntry->n_value, (unsigned)module_start); } @@ -1196,10 +1243,10 @@ { symbol_handler(symbolString + symbolEntry->n_un.n_strx, (long long)base + symbolEntry->n_value, is64); } - -#if HARD_DEBUG_MODULES +#if DEBUG_MODULES bool isTexT = (((unsigned)symbolEntry->n_value > (unsigned)vmaddr) && ((unsigned)(vmaddr + vmsize) > (unsigned)symbolEntry->n_value )); printf("%s %s\n", isTexT ? "__TEXT :" : "__DATA(OR ANY) :", symbolString + symbolEntry->n_un.n_strx); +#if DEBUG_MODULES==2 if(strcmp(symbolString + symbolEntry->n_un.n_strx, "_BootHelp_txt") == 0) { @@ -1214,6 +1261,8 @@ printf("method 2: __DATA : BootHelp_txt[0] %x\n", BootHelp2[0]); } #endif +#endif + } symbolEntry++; @@ -1227,9 +1276,8 @@ while(symbolIndex < symtabCommand->nsyms) { - if(strcmp(symbolString + symbolEntry->n_un.n_strx, "start") == 0) + if(strstr(symbolString + symbolEntry->n_un.n_strx, "module_start") || (strcmp(symbolString + symbolEntry->n_un.n_strx, "start") == 0)) { - // Module start located. 'start' is an alias so don't register it module_start = base + symbolEntry->n_value; } else @@ -1241,7 +1289,7 @@ symbolIndex++; // TODO remove } } - + return module_start; } @@ -1264,6 +1312,9 @@ if(addr != 0xFFFFFFFF) { UInt32* jumpPointer = malloc(sizeof(UInt32*)); + if (!jumpPointer) { + return EFI_OUT_OF_RESOURCES; + } *binary++ = 0xFF; // Jump *binary++ = 0x25; // Long Jump @@ -1275,42 +1326,5 @@ } return EFI_NOT_FOUND; - -} - - -/* Nedded to divide 64bit numbers correctly. TODO: look into why modules need this - * And why it isn't needed when compiled into boot2 - * - * In the next versions, this will be surely replaced by the Apple's libcc_kext or the meklort's klibc - */ - -uint64_t __udivdi3(uint64_t numerator, uint64_t denominator) -{ - uint64_t quotient = 0, qbit = 1; - if (denominator) - { - while ((int64_t) denominator >= 0) - { - denominator <<= 1; - qbit <<= 1; - } - - while (denominator) - { - if (denominator <= numerator) - { - numerator -= denominator; - quotient += qbit; - } - denominator >>= 1; - qbit >>= 1; - } - - return quotient; - } - - stop("Divide by 0"); - return 0; } Index: branches/cparm/i386/boot2/modules.h =================================================================== --- branches/cparm/i386/boot2/modules.h (revision 1803) +++ branches/cparm/i386/boot2/modules.h (revision 1804) @@ -91,11 +91,11 @@ struct symtab_command* symtabCommand, long long(*symbol_handler)(char*, long long, char), char is64); - + unsigned int lookup_all_symbols(const char* name); EFI_STATUS replace_function(const char* symbol, void* newAddress); -extern unsigned int (*lookup_symbol)(const char*); +extern unsigned int (*lookup_symbol)(const char*, int(*strcmp_callback)(const char*, const char*)); #endif /* __BOOT_MODULES_H */ \ No newline at end of file Index: branches/cparm/i386/boot2/drivers.c =================================================================== --- branches/cparm/i386/boot2/drivers.c (revision 1803) +++ branches/cparm/i386/boot2/drivers.c (revision 1804) @@ -98,7 +98,7 @@ return 0; - + // Load extra drivers if a hook has been installed. int step = 0; @@ -121,7 +121,7 @@ step = 1; execute_hook("ramDiskLoadDrivers", &step, NULL, NULL, NULL, NULL, NULL); - + #endif // First try a specfic OS version folder ie 10.5 @@ -341,7 +341,7 @@ if (!length || (unsigned)length < sizeof (DriversPackage)) return -1; // call hook to notify modules that the mkext has been loaded - execute_hook("LoadDriverMKext", (void*)fileSpec, (void*)package, (void*) length, NULL, NULL, NULL); + execute_hook("LoadDriverMKext", (void*)fileSpec, (void*)package, &length, NULL, NULL, NULL); // Verify the MKext. @@ -723,7 +723,7 @@ { long ret; compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary; - + #if 0 printf("kernel header:\n"); printf("signature: 0x%x\n", kernel_header->signature); @@ -733,7 +733,7 @@ printf("compressed_size: 0x%x\n", kernel_header->compressed_size); getc(); #endif - + if (kernel_header->signature == OSSwapBigToHostConstInt32('comp')) { if (kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss')) @@ -743,10 +743,13 @@ } u_int32_t uncompressed_size, size; - void *buffer; uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size); - binary = buffer = malloc(uncompressed_size); + binary = malloc(uncompressed_size); + if (!binary) { + printf("Unable to allocate memory for uncompressed kernel\n"); + return -1; + } size = decompress_lzss((u_int8_t *) binary, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size)); Index: branches/cparm/i386/boot2/options.c =================================================================== --- branches/cparm/i386/boot2/options.c (revision 1803) +++ branches/cparm/i386/boot2/options.c (revision 1804) @@ -111,7 +111,7 @@ moveCursor( 0, row ); printf(msg); - + for ( time = time18(), timeout++; timeout > 0; ) { if ((ch = readKeyboardStatus())) @@ -142,11 +142,11 @@ //========================================================================== - char gBootArgs[BOOT_STRING_LEN]; - char * gBootArgsPtr = gBootArgs; - char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1; - char booterCommand[BOOT_STRING_LEN]; - char booterParam[BOOT_STRING_LEN]; +char gBootArgs[BOOT_STRING_LEN]; +char * gBootArgsPtr = gBootArgs; +char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1; +char booterCommand[BOOT_STRING_LEN]; +char booterParam[BOOT_STRING_LEN]; void clearBootArgs(void) { @@ -237,17 +237,17 @@ //========================================================================== - const MenuItem * gMenuItems = NULL; +const MenuItem * gMenuItems = NULL; - int gMenuItemCount; - int gMenuRow; - int gMenuHeight; - int gMenuTop; - int gMenuBottom; - int gMenuSelection; +int gMenuItemCount; +int gMenuRow; +int gMenuHeight; +int gMenuTop; +int gMenuBottom; +int gMenuSelection; - int gMenuStart; - int gMenuEnd; +int gMenuStart; +int gMenuEnd; void printMenuItem( const MenuItem * item, int highlight ) { @@ -564,22 +564,22 @@ timeout = multiboot_timeout; } else #endif - if (!getIntForKey(kTimeoutKey, &timeout, &bootInfo->bootConfig)) { - /* If there is no timeout key in the file use the default timeout - which is different for CDs vs. hard disks. However, if not booting - a CD and no config file could be loaded set the timeout - to zero which causes the menu to display immediately. - This way, if no partitions can be found, that is the disk is unpartitioned - or simply cannot be read) then an empty menu is displayed. - If some partitions are found, for example a Windows partition, then - these will be displayed in the menu as foreign partitions. - */ - if (isCDROM) { - timeout = kCDBootTimeout; - } else { - timeout = sysConfigValid ? kBootTimeout : 0; + if (!getIntForKey(kTimeoutKey, &timeout, &bootInfo->bootConfig)) { + /* If there is no timeout key in the file use the default timeout + which is different for CDs vs. hard disks. However, if not booting + a CD and no config file could be loaded set the timeout + to zero which causes the menu to display immediately. + This way, if no partitions can be found, that is the disk is unpartitioned + or simply cannot be read) then an empty menu is displayed. + If some partitions are found, for example a Windows partition, then + these will be displayed in the menu as foreign partitions. + */ + if (isCDROM) { + timeout = kCDBootTimeout; + } else { + timeout = sysConfigValid ? kBootTimeout : 0; + } } - } if (timeout < 0) { gBootMode |= kBootModeQuiet; @@ -773,35 +773,35 @@ } else #endif - if ( strcmp( booterCommand, "memory" ) == 0) - { - printMemoryInfo(); - } - else if (strcmp(booterCommand, "lspci") == 0) - { - lspci(); - } - else if (strcmp(booterCommand, "more") == 0) - { - showTextFile(booterParam); - } - else if (strcmp(booterCommand, "rd") == 0) - { - if (execute_hook("processRAMDiskCommand", (void*)argPtr, &booterParam, NULL, NULL, NULL, NULL) != EFI_SUCCESS) - showMessage("ramdisk module not found, please install RamdiskLoader.dylib in /Extra/modules/"); - } - else if (strcmp(booterCommand, "norescan") == 0) - { - if (gEnableCDROMRescan) + if ( strcmp( booterCommand, "memory" ) == 0) { - gEnableCDROMRescan = false; - break; + printMemoryInfo(); } - } - else - { - showHelp(); - } + else if (strcmp(booterCommand, "lspci") == 0) + { + lspci(); + } + else if (strcmp(booterCommand, "more") == 0) + { + showTextFile(booterParam); + } + else if (strcmp(booterCommand, "rd") == 0) + { + if (execute_hook("processRAMDiskCommand", (void*)argPtr, &booterParam, NULL, NULL, NULL, NULL) != EFI_SUCCESS) + showMessage("ramdisk module not found, please install RamdiskLoader.dylib in /Extra/modules/"); + } + else if (strcmp(booterCommand, "norescan") == 0) + { + if (gEnableCDROMRescan) + { + gEnableCDROMRescan = false; + break; + } + } + else + { + showHelp(); + } #endif key = 0; showBootPrompt(nextRow, showPrompt); @@ -900,7 +900,7 @@ int userCnt; char * argP; char * configKernelFlags; - + skipblanks( &cp ); // Update the unit and partition number. @@ -983,32 +983,40 @@ cnt = 0; } - configKernelFlags = malloc(cnt + 1); - strlcpy(configKernelFlags, val, cnt + 1); + configKernelFlags = newString(val); - - if (!getValueForBootKey(cp, kSafeModeFlag, &val, &cnt) && - !getValueForBootKey(configKernelFlags, kSafeModeFlag, &val, &cnt)) { - if (gBootMode & kBootModeSafe) { - copyArgument(0, kSafeModeFlag, strlen(kSafeModeFlag), &argP, &ArgCntRemaining); - } - } + { + bool isSafeMode = false; + if (configKernelFlags) { + isSafeMode = getValueForBootKey(configKernelFlags, kSafeModeFlag, &val, &cnt); + } + + if (!getValueForBootKey(cp, kSafeModeFlag, &val, &cnt) && + (isSafeMode == false)) { + if (gBootMode & kBootModeSafe) { + copyArgument(0, kSafeModeFlag, strlen(kSafeModeFlag), &argP, &ArgCntRemaining); + } + } + } - // Store the merged kernel flags and boot args. + if (configKernelFlags) { + // Store the merged kernel flags and boot args. + + cnt = strlen(configKernelFlags); + if (cnt) { + if (cnt > ArgCntRemaining) { + printf("Warning: boot arguments too long, truncating\n"); + cnt = ArgCntRemaining; + } + strncpy(argP, configKernelFlags, cnt); + argP[cnt++] = ' '; + ArgCntRemaining -= cnt; + } + } - cnt = strlen(configKernelFlags); - if (cnt) { - if (cnt > ArgCntRemaining) { - error("Warning: boot arguments too long, truncating\n"); - cnt = ArgCntRemaining; - } - strncpy(argP, configKernelFlags, cnt); - argP[cnt++] = ' '; - ArgCntRemaining -= cnt; - } userCnt = strlen(cp); if (userCnt > ArgCntRemaining) { - error("Warning: boot arguments too long, truncating\n"); + printf("Warning: boot arguments too long, truncating\n"); userCnt = ArgCntRemaining; } strncpy(&argP[cnt], cp, userCnt); @@ -1032,7 +1040,10 @@ strlcpy(gMKextName, val, cnt + 1); } - free(configKernelFlags); + if (configKernelFlags) + { + free(configKernelFlags); + } return 0; } @@ -1114,19 +1125,19 @@ char filename[512]; sprintf(filename, "BootHelp.txt"); - // Check Extra on booting partition - sprintf(dirspec,"/Extra/%s",filename); + // Check Extra on booting partition + sprintf(dirspec,"/Extra/%s",filename); + fd=open (dirspec); + if (fd<0) + { // Fall back to booter partition + sprintf(dirspec,"bt(0,0)/Extra/%s",filename); fd=open (dirspec); if (fd<0) - { // Fall back to booter partition - sprintf(dirspec,"bt(0,0)/Extra/%s",filename); - fd=open (dirspec); - if (fd<0) - { - printf("BootHelp not found: %s\n", filename); - return; - } + { + printf("BootHelp not found: %s\n", filename); + return; } + } int BootHelp_txt_len = file_size (fd); void *BootHelp_txt=malloc(BootHelp_txt_len); if (BootHelp_txt) @@ -1138,7 +1149,7 @@ close (fd); return; } - + close (fd); } #endif Index: branches/cparm/i386/boot2/Makefile =================================================================== --- branches/cparm/i386/boot2/Makefile (revision 1803) +++ branches/cparm/i386/boot2/Makefile (revision 1804) @@ -9,9 +9,9 @@ include ../MakePaths.dir OPTIM = -Os -Oz -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror -fstack-protector-all \ -fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float DEFINES= @@ -77,7 +77,7 @@ @echo "\t[LD] boot.sys" @$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \ -nostdlib -arch i386 -Wl,-segalign,20 \ - -o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext + -o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) @echo "\t[MACHOCONV] boot" @$(SYMROOT)/machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot &> /dev/null Index: branches/cparm/i386/modules/NetbookInstaller/Makefile =================================================================== --- branches/cparm/i386/modules/NetbookInstaller/Makefile (revision 1803) +++ branches/cparm/i386/modules/NetbookInstaller/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/RamDiskLoader/Makefile =================================================================== --- branches/cparm/i386/modules/RamDiskLoader/Makefile (revision 1803) +++ branches/cparm/i386/modules/RamDiskLoader/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/YellowIconFixer/Makefile =================================================================== --- branches/cparm/i386/modules/YellowIconFixer/Makefile (revision 1803) +++ branches/cparm/i386/modules/YellowIconFixer/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/KextPatcher/kext_patcher.c =================================================================== --- branches/cparm/i386/modules/KextPatcher/kext_patcher.c (revision 1803) +++ branches/cparm/i386/modules/KextPatcher/kext_patcher.c (revision 1804) @@ -130,7 +130,7 @@ void KextPatcher_start() { // Hooks into the following: - // execute_hook("LoadDriverMKext", (void*)package, (void*) length, NULL, NULL, NULL, NULL); + // execute_hook("LoadDriverMKext", (void*)package, &length, NULL, NULL, NULL, NULL); // execute_hook("LoadMatchedModules", module, &length, executableAddr, NULL, NULL, NULL); #if UNUSED register_hook_callback("PCIDevice", &KextPatcher_hook); Index: branches/cparm/i386/modules/KextPatcher/Makefile =================================================================== --- branches/cparm/i386/modules/KextPatcher/Makefile (revision 1803) +++ branches/cparm/i386/modules/KextPatcher/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/ACPIPatcher/Makefile =================================================================== --- branches/cparm/i386/modules/ACPIPatcher/Makefile (revision 1803) +++ branches/cparm/i386/modules/ACPIPatcher/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/GUI/gui.c =================================================================== --- branches/cparm/i386/modules/GUI/gui.c (revision 1803) +++ branches/cparm/i386/modules/GUI/gui.c (revision 1804) @@ -368,14 +368,14 @@ if (images[i].image == NULL) { images[i].image = malloc(sizeof(pixmap_t)); if (images[i].image == NULL) { - + DBG("Unable to allocate memory for %s.png\n", image); - + return 1; } } sprintf(dirspec, "%s/%s/%s.png", src, theme_name, image); - + width = 0; height = 0; imagedata = NULL; @@ -385,9 +385,9 @@ images[i].image->height = height; images[i].image->pixels = (pixel_t *)imagedata; flipRB(images[i].image); - + DBG("[ %s ] succesfully loaded and registred !!\n", dirspec); - + return 0; } #ifdef EMBED_THEME @@ -421,9 +421,9 @@ images[i].image->pixels = images[alt_image].image->pixels; } else { - + DBG("Unable to load %s, this image not vital anyway, reseting and returning success !!\n", dirspec); - + free(images[i].image); images[i].image = NULL; } @@ -444,7 +444,7 @@ free(images[i].image); images[i].image = NULL; return 1; - + } } @@ -459,9 +459,9 @@ static int loadGraphics(char *src) { DBG("Loading image into memory....\n",theme_name); - + LOADPNG(src, background, IMG_REQUIRED); - + LOADPNG(src, logo, IMG_REQUIRED); LOADPNG(src, device_generic, IMG_REQUIRED); @@ -532,12 +532,12 @@ LOADPNG(src, font_console, IMG_REQUIRED); LOADPNG(src, font_small, IMG_REQUIRED); - + DBG("Initializing font....\n",theme_name); - + initFont( &font_console, &images[iFontConsole]); initFont( &font_small, &images[iFontSmall]); - + DBG("Graphic objects successfully loaded !!\n",theme_name); return 0; @@ -913,18 +913,18 @@ #define MAX_tHEME 255 static int randomTheme(char *dirspec, const char **theme) { - + long ret, flags, time; long long index; const char * name; index = 0; uint8_t i=0; - + char *list[MAX_tHEME]; #ifdef EMBED_THEME - list[i] = ""; - i++; + list[i] = ""; + i++; #endif while (i < MAX_tHEME) { @@ -945,14 +945,14 @@ } if (i) { - + srand (time18()); *theme = list[(rand() % i)]; - + int ret = startGUI(); - + uint8_t l=0; #ifdef EMBED_THEME l++; @@ -981,10 +981,10 @@ if (!dummybool) { return 1; } - + getBoolForKey("RandomTheme", &theme_ran, &bootInfo->bootConfig); - + { long flags; long time; @@ -995,7 +995,7 @@ if (theme_ran) { -retry: + retry: ret = GetFileInfo("rd(0,0)/Extra/", "Themes", &flags, &time); if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) { sprintf(dirsrc, "rd(0,0)/Extra/Themes"); @@ -1047,7 +1047,7 @@ if (theme_ran) { - + ret = randomTheme(dirsrc, &theme_name); if (ret) printf("randomTheme Failed !! \n"); @@ -1060,7 +1060,7 @@ ret = startGUI(); if (ret) printf("Failed to load Theme : %s !! \n", theme_name); - + } #ifdef EMBED_THEME if (ret) { @@ -1086,35 +1086,35 @@ int val; char dirspec[256]; - + if ((unsigned)(strlen(theme_name) + strlen(dirsrc) + strlen("theme.plist") + 2 ) > sizeof(dirspec)) { DBG("Path of %s/%s/theme.plist to long\n", dirsrc, theme_name); return 1; } - + sprintf(dirspec, "%s/%s/theme.plist", dirsrc ,theme_name); - + if (loadConfigFile(dirspec, &bootInfo->themeConfig) != 0) { - + #ifdef EMBED_THEME - if (strlen(theme_name) == 0) { - config_file_t *config; + if (strlen(theme_name) == 0) { + config_file_t *config; + + config = &bootInfo->themeConfig; + if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) { - config = &bootInfo->themeConfig; - if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) { - - DBG("Unable to load embed theme plist datas.\n"); - - return 1; - } - } + DBG("Unable to load embed theme plist datas.\n"); + + return 1; + } + } #else - + DBG("Unable to load %s theme plist.\n",theme_name); - + return 1; - + #endif } @@ -1132,7 +1132,7 @@ else { printf("No getResolution function hook installed, using default resolution.\n",theme_name); - + } #endif @@ -1482,7 +1482,7 @@ void vramwrite (void *data, int width, int height) #else static inline - void vramwrite (void *data, int width) +void vramwrite (void *data, int width) #endif { if (VIDEO (depth) == 0x20 /*32*/ && VIDEO (rowBytes) == (unsigned long)gui.backbuffer->width * 4) @@ -1862,7 +1862,7 @@ int width = 0; int max_width = 0; int height = font->height; - + // calculate the width in pixels for (i=0; i < strlen(text); i++) { if (text[i] == '\n') @@ -2581,4 +2581,3 @@ return ch; } - Index: branches/cparm/i386/modules/GUI/Makefile =================================================================== --- branches/cparm/i386/modules/GUI/Makefile (revision 1803) +++ branches/cparm/i386/modules/GUI/Makefile (revision 1804) @@ -23,12 +23,12 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ -mpreferred-stack-boundary=2 -fno-align-functions \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common -fno-stack-protector #-fstack-protector-all + -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common #-fstack-protector-all DEFINES= CONFIG = hd Index: branches/cparm/i386/modules/KernelPatcher/Makefile =================================================================== --- branches/cparm/i386/modules/KernelPatcher/Makefile (revision 1803) +++ branches/cparm/i386/modules/KernelPatcher/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -O3 DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/Networking/Makefile =================================================================== --- branches/cparm/i386/modules/Networking/Makefile (revision 1803) +++ branches/cparm/i386/modules/Networking/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/GraphicsEnabler/Makefile =================================================================== --- branches/cparm/i386/modules/GraphicsEnabler/Makefile (revision 1803) +++ branches/cparm/i386/modules/GraphicsEnabler/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/SMBiosGetters/Makefile =================================================================== --- branches/cparm/i386/modules/SMBiosGetters/Makefile (revision 1803) +++ branches/cparm/i386/modules/SMBiosGetters/Makefile (revision 1804) @@ -23,12 +23,12 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ -mpreferred-stack-boundary=2 -fno-align-functions \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common -fno-stack-protector #-fstack-protector-all + -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common #-fstack-protector-all DEFINES= CONFIG = hd Index: branches/cparm/i386/modules/HibernateEnabler/Makefile =================================================================== --- branches/cparm/i386/modules/HibernateEnabler/Makefile (revision 1803) +++ branches/cparm/i386/modules/HibernateEnabler/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/Keymapper/Makefile =================================================================== --- branches/cparm/i386/modules/Keymapper/Makefile (revision 1803) +++ branches/cparm/i386/modules/Keymapper/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/USBFix/Makefile =================================================================== --- branches/cparm/i386/modules/USBFix/Makefile (revision 1803) +++ branches/cparm/i386/modules/USBFix/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/HPET/Makefile =================================================================== --- branches/cparm/i386/modules/HPET/Makefile (revision 1803) +++ branches/cparm/i386/modules/HPET/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/SMBiosPatcher/Makefile =================================================================== --- branches/cparm/i386/modules/SMBiosPatcher/Makefile (revision 1803) +++ branches/cparm/i386/modules/SMBiosPatcher/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/Resolution/Makefile =================================================================== --- branches/cparm/i386/modules/Resolution/Makefile (revision 1803) +++ branches/cparm/i386/modules/Resolution/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= CONFIG = hd Index: branches/cparm/i386/modules/CPUfreq/Makefile =================================================================== --- branches/cparm/i386/modules/CPUfreq/Makefile (revision 1803) +++ branches/cparm/i386/modules/CPUfreq/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/Memory/Makefile =================================================================== --- branches/cparm/i386/modules/Memory/Makefile (revision 1803) +++ branches/cparm/i386/modules/Memory/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/ACPICodec/acpi_codec.c =================================================================== --- branches/cparm/i386/modules/ACPICodec/acpi_codec.c (revision 1803) +++ branches/cparm/i386/modules/ACPICodec/acpi_codec.c (revision 1804) @@ -106,40 +106,7 @@ static U32 process_rsdt(ACPI_TABLE_RSDP *rsdp_mod , bool gen_xsdt, U32 *new_table_list); static ACPI_TABLE_FADT * patch_fadt(ACPI_TABLE_FADT *fadt, ACPI_TABLE_DSDT *new_dsdt, bool UpdateFADT); -#if OLD_SSDT -#include "modules.h" -struct aml_chunk -{ - unsigned char Type; - unsigned int Length; - char* Buffer; - - unsigned int Size; - - struct aml_chunk* Next; - struct aml_chunk* First; - struct aml_chunk* Last; -}; -static U32 get_needed_symbols (void); -static ACPI_TABLE_SSDT *generate_cst_ssdt(ACPI_TABLE_FADT* fadt); -static ACPI_TABLE_SSDT *generate_pss_ssdt(ACPI_TABLE_DSDT* dsdt); -struct aml_chunk* (*aml_create_node)(struct aml_chunk*) = NULL; -struct aml_chunk* (*aml_add_buffer)(struct aml_chunk*,const char*, unsigned int) = NULL; -struct aml_chunk* (*aml_add_byte)(struct aml_chunk*, unsigned char) = NULL; -struct aml_chunk* (*aml_add_word)(struct aml_chunk*, unsigned int) = NULL; -struct aml_chunk* (*aml_add_dword)(struct aml_chunk*, unsigned long) = NULL; -struct aml_chunk* (*aml_add_qword)(struct aml_chunk*, unsigned long long) = NULL; -struct aml_chunk* (*aml_add_scope)(struct aml_chunk*, const char*) = NULL; -struct aml_chunk* (*aml_add_name)(struct aml_chunk*, const char*) = NULL; -struct aml_chunk* (*aml_add_package)(struct aml_chunk*) = NULL; -struct aml_chunk* (*aml_add_alias)(struct aml_chunk*, const char*, const char*) = NULL; -void (*aml_destroy_node)(struct aml_chunk*) = NULL; -unsigned int (*aml_calculate_size)(struct aml_chunk*) = NULL; -unsigned int (*aml_write_node)(struct aml_chunk*, char*, unsigned int) = NULL; -bool (*aml_add_to_parent)(struct aml_chunk*, struct aml_chunk*) = NULL; -#else - #define IA32_MISC_ENABLES 0x01A0 #define MSR_TURBO_POWER_CURRENT_LIMIT 0x1AC #define MSR_PKG_CST_CONFIG_CONTROL 0x00E2 @@ -154,7 +121,7 @@ static U32 encode_pstate(U32 ratio); static void collect_cpu_info(CPU_DETAILS * cpu); #ifndef BETA -static U32 BuildCoreIPstateInfo(CPU_DETAILS * cpu); +//static U32 BuildCoreIPstateInfo(CPU_DETAILS * cpu); #endif static U32 BuildCstateInfo(CPU_DETAILS * cpu, U32 pmbase); static U32 BuildPstateInfo(CPU_DETAILS * cpu); @@ -190,11 +157,9 @@ static bool is_sandybridge(void); static bool is_jaketown(void); static U32 get_bclk(void); -static U32 computePstateRatio(const U32 max, const U32 min, const U32 turboEnabled, const U32 numStates, const U32 pstate); -static U32 computeNumPstates(const U32 max, const U32 min, const U32 turboEnabled, const U32 pssLimit); +//static U32 computePstateRatio(const U32 max, const U32 min, const U32 turboEnabled, const U32 numStates, const U32 pstate); +//static U32 computeNumPstates(const U32 max, const U32 min, const U32 turboEnabled, const U32 pssLimit); -#endif // OLD_SSDT - #if UNUSED static ACPI_TABLE_FACS* generate_facs(bool updatefacs ); #endif @@ -206,11 +171,7 @@ // Security space for SSDT , FACP & MADT table generation, // the size can be increased // note: the table will not placed in the reserved space if the 'normal' space is not full -#if OLD_SSDT -#define RESERVED_AERA 4 -#else #define RESERVED_AERA 3 -#endif #define ACPI_TABLE_LIST_FULL MAX_ACPI_TABLE + RESERVED_AERA + 1 @@ -802,685 +763,6 @@ return (cpu_map_error = 0); } -#if OLD_SSDT - -static U32 get_needed_symbols (void) -{ - /* aml_generator symbols */ - aml_create_node = (void*)lookup_all_symbols("_aml_create_node"); - if (aml_create_node == (void*)0xFFFFFFFF) goto Failed; - - aml_add_buffer = (void*)lookup_all_symbols("_aml_add_buffer"); - if (aml_add_buffer == (void*)0xFFFFFFFF) goto Failed; - - aml_add_byte = (void*)lookup_all_symbols("_aml_add_byte"); - if (aml_add_byte == (void*)0xFFFFFFFF) goto Failed; - - aml_add_word = (void*)lookup_all_symbols("_aml_add_word"); - if (aml_add_word == (void*)0xFFFFFFFF) goto Failed; - - aml_add_dword = (void*)lookup_all_symbols("_aml_add_dword"); - if (aml_add_dword == (void*)0xFFFFFFFF) goto Failed; - - aml_add_qword = (void*)lookup_all_symbols("_aml_add_qword"); - if (aml_add_qword == (void*)0xFFFFFFFF) goto Failed; - - aml_add_scope = (void*)lookup_all_symbols("_aml_add_scope"); - if (aml_add_scope == (void*)0xFFFFFFFF) goto Failed; - - aml_add_name = (void*)lookup_all_symbols("_aml_add_name"); - if (aml_add_name == (void*)0xFFFFFFFF) goto Failed; - - aml_add_package = (void*)lookup_all_symbols("_aml_add_package"); - if (aml_add_package == (void*)0xFFFFFFFF) goto Failed; - - aml_add_alias = (void*)lookup_all_symbols("_aml_add_alias"); - if (aml_add_alias == (void*)0xFFFFFFFF) goto Failed; - - aml_destroy_node = (void*)lookup_all_symbols("_aml_destroy_node"); - if (aml_destroy_node == (void*)0xFFFFFFFF) goto Failed; - - aml_calculate_size = (void*)lookup_all_symbols("_aml_calculate_size"); - if (aml_calculate_size == (void*)0xFFFFFFFF) goto Failed; - - aml_write_node = (void*)lookup_all_symbols("_aml_write_node"); - if (aml_write_node == (void*)0xFFFFFFFF) goto Failed; - - aml_add_to_parent = (void*)lookup_all_symbols("_aml_add_to_parent"); - if (aml_add_to_parent == (void*)0xFFFFFFFF) goto Failed; - - DBG("struct aml_chunk* _aml_create_node: 0x%x\n",(UInt32)aml_create_node); - DBG("struct aml_chunk* _aml_add_buffer: 0x%x\n",(UInt32)aml_add_buffer); - DBG("struct aml_chunk* _aml_add_byte: 0x%x\n",(UInt32)aml_add_byte); - DBG("struct aml_chunk* _aml_add_word: 0x%x\n",(UInt32)aml_add_word); - DBG("struct aml_chunk* _aml_add_dword: 0x%x\n",(UInt32)aml_add_dword); - DBG("struct aml_chunk* _aml_add_qword: 0x%x\n",(UInt32)aml_add_qword); - DBG("struct aml_chunk* _aml_add_scope: 0x%x\n",(UInt32)aml_add_scope); - DBG("struct aml_chunk* _aml_add_name: 0x%x\n",(UInt32)aml_add_name); - DBG("struct aml_chunk* _aml_add_package: 0x%x\n",(UInt32)aml_add_package); - DBG("struct aml_chunk* _aml_add_alias: 0x%x\n",(UInt32)aml_add_alias); - DBG("void _aml_destroy_node: 0x%x\n",(UInt32)aml_destroy_node); - DBG("unsigned int _aml_calculate_size: 0x%x\n",(UInt32)aml_calculate_size); - DBG("unsigned int _aml_write_node: 0x%x\n",(UInt32)aml_write_node); - DBG("bool _aml_add_to_parent: 0x%x\n",(UInt32)aml_add_to_parent); - return (1); -Failed: - printf("Failed to find aml_generator symbols, SSDT will not be generated !!!"); - return (0); -} - -static ACPI_TABLE_SSDT *generate_cst_ssdt(ACPI_TABLE_FADT* fadt) -{ - char ssdt_header[] = - { - 0x53, 0x53, 0x44, 0x54, 0xE7, 0x00, 0x00, 0x00, /* SSDT.... */ - 0x01, 0x17, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x41, /* ..PmRefA */ - 0x43, 0x70, 0x75, 0x43, 0x73, 0x74, 0x00, 0x00, /* CpuCst.. */ - 0x00, 0x10, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, /* ....INTL */ - 0x31, 0x03, 0x10, 0x20 /* 1.._ */ - }; - - char cstate_resource_template[] = - { - 0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x7F, - 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x79, 0x00 - }; - - if (Platform->CPU.Vendor != 0x756E6547) { - verbose ("Not an Intel platform: C-States will not be generated !!!\n"); - return (void *)0ul; - } - - if (fadt == (void *)0ul) { - verbose ("FACP not exists: C-States will not be generated !!!\n"); - return (void *)0ul; - } - - ACPI_TABLE_DSDT* dsdt = ((fadt->Header.Revision >= 3) && (fadt->XDsdt != 0)) ? (ACPI_TABLE_DSDT*)((U32)fadt->XDsdt):(ACPI_TABLE_DSDT*)fadt->Dsdt; - if (dsdt == (void *)0ul) { - verbose ("DSDT not found: C-States will not be generated !!!\n"); - return (void *)0ul; - } - - if (generate_cpu_map_from_acpi(dsdt) == 0) - { - bool c2_enabled = fadt->C2Latency < 100; - bool c3_enabled = fadt->C3Latency < 1000; - bool c4_enabled = false; - - getBoolForKey(kEnableC4State, &c4_enabled, &bootInfo->bootConfig); - - unsigned char cstates_count = 1 + (c2_enabled ? 1 : 0) + ((c3_enabled || c4_enabled) ? 1 : 0); - char *Lat = NULL, *Pw = NULL, *tmpstr =NULL; - int base = 16; - TagPtr personality = XMLCastDict(XMLGetProperty(bootInfo->bootConfig.dictionary, (const char*)"C-States")); - - if ((tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Base")))) { - - int mybase = strtol(tmpstr, NULL, 10); - - if (mybase == 8 || mybase == 10 || mybase == 16 ) - base = mybase; - } - - struct aml_chunk* root = aml_create_node(NULL); - aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header - struct aml_chunk* scop; - if (cpuNamespace == CPU_NAMESPACE_PR) - scop = aml_add_scope(root, "\\_PR_"); - else if (cpuNamespace == CPU_NAMESPACE_SB) - scop = aml_add_scope(root, "\\_SB_"); - else - { - aml_destroy_node(root); - goto out; - } - struct aml_chunk* name = aml_add_name(scop, "CST_"); - struct aml_chunk* pack = aml_add_package(name); - aml_add_byte(pack, cstates_count); - - struct aml_chunk* tmpl = aml_add_package(pack); - TagPtr match_Status = XMLGetProperty(personality, (const char*)"C1"); - if (match_Status) { - Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power")); - Lat = XMLCastString(XMLGetProperty(match_Status, (const char*)"Latency")); - } - cstate_resource_template[11] = 0x00; // C1 - aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template)); - aml_add_byte(tmpl, 0x01); // C1 - aml_add_byte(tmpl, (unsigned char)resolve_cst(0x01, Lat, base)); // Latency - aml_add_word(tmpl, resolve_cst(0x03e8, Pw, base)); // Power - // C2 - if (c2_enabled) - { - tmpl = aml_add_package(pack); - Lat = NULL; - Pw = NULL; - match_Status = XMLGetProperty(personality, (const char*)"C2"); - if (match_Status) { - Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power")); - Lat = XMLCastString(XMLGetProperty(match_Status, (const char*)"Latency")); - } - - cstate_resource_template[11] = 0x10; // C2 - aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template)); - aml_add_byte(tmpl, 0x02); // C2 - aml_add_word(tmpl, resolve_cst(fadt->C2Latency, Lat, base)); // Latency - aml_add_word(tmpl, resolve_cst(0x01f4, Pw, base)); // Power - } - - // C4 - if (c4_enabled) - { - tmpl = aml_add_package(pack); - Lat = NULL; - Pw = NULL; - match_Status = XMLGetProperty(personality, (const char*)"C4"); - if (match_Status) { - Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power")); - Lat = XMLCastString(XMLGetProperty(match_Status, (const char*)"Latency")); - } - cstate_resource_template[11] = 0x30; // C4 - aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template)); - aml_add_byte(tmpl, 0x04); // C4 - aml_add_word(tmpl, resolve_cst(fadt->C3Latency / 2, Lat, base)); // TODO: right latency for C4 - aml_add_word(tmpl, resolve_cst(0xfa, Pw, base)); // Power - - // you can check if the C4 state is correctly activated or not with the following command Lines (you will need the 'lspci for mac' package): - - // according to the intel ich10 dataheet ( Power Management PCI Configuration Registers (PM—D31:F0) ): - // setpci -s 0:1f.0 0xa0.w (must return an hex where bit 12 is 0 and bit 7 is 1, usually 06a0h ) - // setpci -s 0:1f.0 0xa6.b (must return an hex where bit 7 is 1, usually 80h ) - - - } - // C3 - else if (c3_enabled) - { - tmpl = aml_add_package(pack); - Lat = NULL; - Pw = NULL; - match_Status = XMLGetProperty(personality, (const char*)"C3"); - if (match_Status) { - Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power")); - Lat = XMLCastString(XMLGetProperty(match_Status, (const char*)"Latency")); - } - cstate_resource_template[11] = 0x20; // C3 - aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template)); - aml_add_byte(tmpl, 0x03); // C3 - aml_add_word(tmpl, resolve_cst(fadt->C3Latency , Lat, base)); - aml_add_word(tmpl, resolve_cst(0x015e, Pw, base)); // Power - - } - - // Aliaces - unsigned int i; - for (i = 0; i < cpu_map_count; i++) - { - char name[9]; - U32 nseg = *(U32*)cpu_map[i].nameseg; - if (cpuNamespace == CPU_NAMESPACE_PR) { - sprintf(name, "_PR_%c%c%c%c", - (int)(nseg & 0x000000ff), - (int)((nseg & 0x0000ff00) >> 8), - (int)((nseg & 0x00ff0000) >> 16), - (int)(nseg >> 24)); - } else if (cpuNamespace == CPU_NAMESPACE_SB) { - sprintf(name, "_SB_%c%c%c%c", - (int)(nseg & 0x000000ff), - (int)((nseg & 0x0000ff00) >> 8), - (int)((nseg & 0x00ff0000) >> 16), - (int)(nseg >> 24)); - } else { - aml_destroy_node(root); - goto out; - } - - scop = aml_add_scope(root, name); - aml_add_alias(scop, "CST_", "_CST"); - } - - aml_calculate_size(root); - - ACPI_TABLE_SSDT *ssdt = (ACPI_TABLE_SSDT *)AllocateKernelMemory(root->Size); - - aml_write_node(root, (void*)ssdt, 0); - - ssdt->Header.Length = root->Size; - - SetChecksum(&ssdt->Header); - - aml_destroy_node(root); - - verbose ("SSDT with CPU C-States generated successfully\n"); - - return ssdt; - } - else - { -out: - verbose ("ACPI CPUs not found: C-States will not be generated !!!\n"); - } - - return (void *)0ul; -} - -static ACPI_TABLE_SSDT *generate_pss_ssdt(ACPI_TABLE_DSDT* dsdt) -{ - - char ssdt_header[] = - { - 0x53, 0x53, 0x44, 0x54, 0x7E, 0x00, 0x00, 0x00, /* SSDT.... */ - 0x01, 0x6A, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x00, /* ..PmRef. */ - 0x43, 0x70, 0x75, 0x50, 0x6D, 0x00, 0x00, 0x00, /* CpuPm... */ - 0x00, 0x30, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, /* .0..INTL */ - 0x31, 0x03, 0x10, 0x20, /* 1.._ */ - }; - - if (Platform->CPU.Vendor != 0x756E6547) { - verbose ("Not an Intel platform: P-States will not be generated !!!\n"); - return (void *)0ul; - } - - if (!(Platform->CPU.Features & CPUID_FEATURE_MSR)) { - verbose ("Unsupported CPU: P-States will not be generated !!!\n"); - return (void *)0ul; - } - - if (dsdt == (void *)0ul) { - verbose ("DSDT not found: P-States will not be generated !!!\n"); - return (void *)0ul; - } - - if (generate_cpu_map_from_acpi(dsdt) == 0 ) - { - struct p_state /*initial,*/ maximum, minimum, p_states[32]; - U8 p_states_count = 0; - - // Retrieving P-States, ported from code by superhai (c) - switch (Platform->CPU.Family) { - case 0x06: - { - switch (Platform->CPU.Model) - { - case CPUID_MODEL_DOTHAN: - case CPUID_MODEL_YONAH: // Yonah - case CPUID_MODEL_MEROM: // Merom - case CPUID_MODEL_PENRYN: // Penryn - case CPUID_MODEL_ATOM: // Intel Atom (45nm) - { - bool cpu_dynamic_fsb = false; - - if (rdmsr64(MSR_IA32_EXT_CONFIG) & (1 << 27)) - { - wrmsr64(MSR_IA32_EXT_CONFIG, (rdmsr64(MSR_IA32_EXT_CONFIG) | (1 << 28))); - delay(1); - cpu_dynamic_fsb = rdmsr64(MSR_IA32_EXT_CONFIG) & (1 << 28); - } - - bool cpu_noninteger_bus_ratio = (rdmsr64(MSR_IA32_PERF_STATUS) & (1ULL << 46)); - - initial.Control = rdmsr64(MSR_IA32_PERF_STATUS); - - maximum.Control = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 32) & 0x1F3F) | (0x4000 * cpu_noninteger_bus_ratio); - maximum.CID = ((maximum.FID & 0x1F) << 1) | cpu_noninteger_bus_ratio; - - minimum.FID = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 24) & 0x1F) | (0x80 * cpu_dynamic_fsb); - minimum.VID = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 48) & 0x3F); - - if (minimum.FID == 0) - { - U64 msr; - U8 i; - // Probe for lowest fid - for (i = maximum.FID; i >= 0x6; i--) - { - msr = rdmsr64(MSR_IA32_PERF_CONTROL); - wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (i << 8) | minimum.VID); - intel_waitforsts(); - minimum.FID = (rdmsr64(MSR_IA32_PERF_STATUS) >> 8) & 0x1F; - delay(1); - } - - msr = rdmsr64(MSR_IA32_PERF_CONTROL); - wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (maximum.FID << 8) | maximum.VID); - intel_waitforsts(); - } - - if (minimum.VID == maximum.VID) - { - U64 msr; - U8 i; - // Probe for lowest vid - for (i = maximum.VID; i > 0xA; i--) - { - msr = rdmsr64(MSR_IA32_PERF_CONTROL); - wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (minimum.FID << 8) | i); - intel_waitforsts(); - minimum.VID = rdmsr64(MSR_IA32_PERF_STATUS) & 0x3F; - delay(1); - } - - msr = rdmsr64(MSR_IA32_PERF_CONTROL); - wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (maximum.FID << 8) | maximum.VID); - intel_waitforsts(); - } - - minimum.CID = ((minimum.FID & 0x1F) << 1) >> cpu_dynamic_fsb; - - // Sanity check - if (maximum.CID < minimum.CID) - { - DBG("Insane FID values!"); - p_states_count = 0; - } - else - { - // Finalize P-States - // Find how many P-States machine supports - p_states_count = maximum.CID - minimum.CID + 1; - - if (p_states_count > 32) // MAX_PSTATES ?? - p_states_count = 32; // MAX_PSTATES ?? - - U8 vidstep; - U8 i = 0, u, invalid = 0; - - vidstep = ((maximum.VID << 2) - (minimum.VID << 2)) / (p_states_count - 1); - - for (u = 0; u < p_states_count; u++) - { - i = u - invalid; - - p_states[i].CID = maximum.CID - u; - p_states[i].FID = (p_states[i].CID >> 1); - - if (p_states[i].FID < 0x6) - { - if (cpu_dynamic_fsb) - p_states[i].FID = (p_states[i].FID << 1) | 0x80; - } - else if (cpu_noninteger_bus_ratio) - { - p_states[i].FID = p_states[i].FID | (0x40 * (p_states[i].CID & 0x1)); - } - - if (i && p_states[i].FID == p_states[i-1].FID) - invalid++; - - p_states[i].VID = ((maximum.VID << 2) - (vidstep * u)) >> 2; - - U32 multiplier = p_states[i].FID & 0x1f; // = 0x08 - bool half = p_states[i].FID & 0x40; // = 0x01 - bool dfsb = p_states[i].FID & 0x80; // = 0x00 - U32 fsb = Platform->CPU.FSBFrequency / 1000000; // = 400 - U32 halffsb = (fsb + 1) >> 1; // = 200 - U32 frequency = (multiplier * fsb); // = 3200 - - p_states[i].Frequency = (frequency + (half * halffsb)) >> dfsb; // = 3200 + 200 = 3400 - } - - p_states_count -= invalid; - } - break; - } - case CPUID_MODEL_FIELDS: - case CPUID_MODEL_DALES: - case CPUID_MODEL_DALES_32NM: - case CPUID_MODEL_NEHALEM: - case CPUID_MODEL_NEHALEM_EX: - case CPUID_MODEL_WESTMERE: - case CPUID_MODEL_WESTMERE_EX: - case CPUID_MODEL_SANDYBRIDGE: - case CPUID_MODEL_JAKETOWN: - { - maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)... - minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff; - - verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control); - - // Sanity check - if (maximum.Control < minimum.Control) - { - DBG("Insane control values!"); - p_states_count = 0; - } - else - { - U8 i; - p_states_count = 0; - - for (i = maximum.Control; i >= minimum.Control; i--) - { - p_states[p_states_count].Control = i; - p_states[p_states_count].CID = p_states[p_states_count].Control << 1; - p_states[p_states_count].Frequency = (Platform->CPU.FSBFrequency / 1000000) * i; - p_states_count++; - if (p_states_count >= 32) { - - if (p_states_count > 32) // MAX_PSTATES ?? - p_states_count = 32; // MAX_PSTATES ?? - - break; - } - } - } - - break; - } - default: - verbose ("Unsupported CPU: P-States will not be generated !!!\n"); - break; - } - } - default: - break; - } - - // Generating SSDT - if (p_states_count) - { - unsigned int i; - - struct aml_chunk* root = aml_create_node(NULL); - aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header - struct aml_chunk* scop; - if (cpuNamespace == CPU_NAMESPACE_PR) - scop = aml_add_scope(root, "\\_PR_"); - else if (cpuNamespace == CPU_NAMESPACE_SB) - scop = aml_add_scope(root, "\\_SB_"); - else - { - aml_destroy_node(root); - goto out; - } - struct aml_chunk* name = aml_add_name(scop, "PSS_"); - struct aml_chunk* pack = aml_add_package(name); - - U8 minPSratio = (p_states[p_states_count-1].Frequency / (Platform->CPU.FSBFrequency / 10000000 )); - U8 maxPSratio = (p_states[0].Frequency / (Platform->CPU.FSBFrequency / 10000000 )); - - U8 cpu_div = Platform->CPU.CurrDiv; - U8 cpu_ratio = 0; - - if (cpu_div) - cpu_ratio = (Platform->CPU.CurrCoef * 10) + 5; - else - cpu_ratio = Platform->CPU.CurrCoef * 10; - - - int user_max_ratio = 0; - getIntForKey(kMaxRatio, &user_max_ratio, &bootInfo->bootConfig); - if (user_max_ratio >= minPSratio && maxPSratio >= user_max_ratio) { - - U8 maxcurrdiv = 0, maxcurrcoef = (int)(user_max_ratio / 10); - - U8 maxdiv = user_max_ratio - (maxcurrcoef * 10); - if (maxdiv > 0) - maxcurrdiv = 1; - - if (maxcurrdiv) - cpu_ratio = (maxcurrcoef * 10) + 5; - else - cpu_ratio = maxcurrcoef * 10; - } - - int user_min_ratio = 0; - getIntForKey(kMinRatio, &user_min_ratio, &bootInfo->bootConfig); - if (user_min_ratio >= minPSratio && cpu_ratio >= user_min_ratio) { - - U8 mincurrdiv = 0, mincurrcoef = (int)(user_min_ratio / 10); - - U8 mindiv = user_min_ratio - (mincurrcoef * 10); - - if (mindiv > 0) - mincurrdiv = 1; - - if (mincurrdiv) - minPSratio = (mincurrcoef * 10) + 5; - else - minPSratio = mincurrcoef * 10; - - } - - if (maxPSratio >= cpu_ratio && cpu_ratio >= minPSratio) maxPSratio = cpu_ratio; - - TagPtr personality = XMLCastDict(XMLGetProperty(bootInfo->bootConfig.dictionary, (const char*)"P-States")); - char* MatchStat = 0; - int dropPSS = 0, Pstatus = 0, base = 16; - int expert = 0;/* Default: 0 , mean mixed mode | expert mode : 1 , mean add only p-states found in boot.plist*/ - char *tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Mode")); - - if (strcmp(tmpstr,"Expert") == 0) { - p_states_count = XMLTagCount(personality) - 1 ; // - 1 = - ("Mode" tag) - expert = 1; - } - - - if ((tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Base")))) { - - if (expert) p_states_count--; // -= ("Base" tag) - - int mybase = strtol(tmpstr, NULL, 10); - - if (mybase == 8 || mybase == 10 || mybase == 16 ) - base = mybase; - } - - for (i = 0; i < p_states_count; i++) - { - sprintf(MatchStat, "%d",i); - TagPtr match_Status = XMLGetProperty(personality, (const char*)MatchStat); - - char *Lat1 = NULL, *clk = NULL, *Pw = NULL, *Lat2 = NULL, *Ctrl = NULL ; - - if (match_Status) { - - clk = XMLCastString(XMLGetProperty(match_Status, (const char*)"CoreFreq")); - Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power")); - Lat1 = XMLCastString(XMLGetProperty(match_Status, (const char*)"Transition Latency")); - Lat2 = XMLCastString(XMLGetProperty(match_Status, (const char*)"Bus Master Latency")); - Ctrl = XMLCastString(XMLGetProperty(match_Status, (const char*)"Control")); - - - } else if (expert) - continue; - - - unsigned long Frequency = 0x00000000; - - if (!expert) Frequency = p_states[i].Frequency; - - if (clk) - Frequency = strtoul((const char *)clk, NULL,base); - - if (!Frequency || Frequency > p_states[0].Frequency ) continue; - - U8 curr_ratio = (Frequency / (Platform->CPU.FSBFrequency / 10000000 )); - - if (curr_ratio > maxPSratio || minPSratio > curr_ratio) - goto dropPstate; - - struct aml_chunk* pstt = aml_add_package(pack); - aml_add_dword(pstt, Frequency); // CoreFreq (in MHz). - aml_add_dword(pstt, resolve_pss(0x00000000, Pw, base)); // Power (in milliWatts) - aml_add_dword(pstt, resolve_pss(0x0000000A, Lat1, base)); // Transition Latency (in microseconds). - aml_add_dword(pstt, resolve_pss(0x0000000A, Lat2, base)); // Bus Master Latency (in microseconds). - unsigned long Control = 0x00000000; - if (!expert) Control = p_states[i].Control; - aml_add_dword(pstt, resolve_pss(Control, Ctrl, base)); // Control - Pstatus++; - aml_add_dword(pstt, Pstatus); // Status - continue; - dropPstate: - - DBG("state with cpu frequency :%d and ratio :%d will be dropped\n",p_states[i].Frequency,curr_ratio); - - dropPSS++; - - - } - - - // Add aliaces - for (i = 0; i < cpu_map_count; i++) - { - char name[9]; - U32 nseg = *(U32*)cpu_map[i].nameseg; - if (cpuNamespace == CPU_NAMESPACE_PR) { - sprintf(name, "_PR_%c%c%c%c", - (int)(nseg & 0x000000ff), - (int)((nseg & 0x0000ff00) >> 8), - (int)((nseg & 0x00ff0000) >> 16), - (int)(nseg >> 24)); - } else if (cpuNamespace == CPU_NAMESPACE_SB) { - sprintf(name, "_SB_%c%c%c%c", - (int)(nseg & 0x000000ff), - (int)((nseg & 0x0000ff00) >> 8), - (int)((nseg & 0x00ff0000) >> 16), - (int)(nseg >> 24)); - } else { - aml_destroy_node(root); - goto out; - } - - scop = aml_add_scope(root, name); - aml_add_alias(scop, "PSS_", "_PSS"); - } - - aml_calculate_size(root); - - ACPI_TABLE_SSDT *ssdt = (ACPI_TABLE_SSDT *)AllocateKernelMemory(root->Size); - - aml_write_node(root, (void*)ssdt, 0); - - ssdt->Header.Length = root->Size; - - SetChecksum(&ssdt->Header); - - aml_destroy_node(root); - - verbose ("SSDT with CPU P-States generated successfully"); - - if (dropPSS) - verbose(", %d P-state(s) dropped",dropPSS); - - verbose("\n"); - - return ssdt; - } - } - else - { -out: - verbose("ACPI CPUs not found: P-States will not be generated !!!\n"); - } - - return (void *)0ul; -} -#else - static bool is_sandybridge(void) { return Platform->CPU.Model == CPUID_MODEL_SANDYBRIDGE; @@ -1495,7 +777,7 @@ { return (is_jaketown() || is_sandybridge()) ? 100 : 133; } - +/* //----------------------------------------------------------------------------- static U32 computePstateRatio(const U32 max, const U32 min, const U32 turboEnabled, const U32 numStates, const U32 pstate) { @@ -1516,7 +798,7 @@ numStates = (pssLimit < maxStates) ? pssLimit : maxStates; return (numStates < 2) ? 0 : numStates; } - +*/ #if BUILD_ACPI_TSS || pstate_power_support static U64 divU64byU64(U64 n, U64 d, U64 * rem) { @@ -1557,7 +839,7 @@ } } -#endif +#endif // BUILD_ACPI_TSS || pstate_power_support #if pstate_power_support static U64 mulU64byU64(U64 a, U64 b, U64 * high) @@ -1625,7 +907,7 @@ return ((ratio_factor * ratio_factor * ratio_factor * Core_TDP) / PRECISION_FACTOR_CUBED) + Uncore_TDP; } } -#endif +#endif // pstate_power_support static U32 encode_pstate(U32 ratio) { @@ -1936,7 +1218,7 @@ return (1); } #else - +/* //----------------------------------------------------------------------------- static U32 BuildCoreIPstateInfo(CPU_DETAILS * cpu) { @@ -1990,7 +1272,7 @@ return (1); } - +*/ //----------------------------------------------------------------------------- static U32 BuildPstateInfo(CPU_DETAILS * cpu) { @@ -2140,40 +1422,40 @@ case CPUID_MODEL_SANDYBRIDGE: case CPUID_MODEL_JAKETOWN: { - /* - maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)... - minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff; - - verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control); - - // Sanity check - if (maximum.Control < minimum.Control) - { - DBG("Insane control values!"); - p_states_count = 0; - } - else - { - U8 i; - p_states_count = 0; - - for (i = maximum.Control; i >= minimum.Control; i--) - { - p_states[p_states_count].Control = i; - p_states[p_states_count].CID = p_states[p_states_count].Control << 1; - p_states[p_states_count].Frequency = (Platform->CPU.FSBFrequency / 1000000) * i; - p_states_count++; - if (p_states_count >= MAX_PSTATES) { // was 32 - - if (p_states_count > MAX_PSTATES) // was 32 - p_states_count = MAX_PSTATES; // was 32 - - break; - } - } - } - */ + maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)... + minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff; + + verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control); + + // Sanity check + if (maximum.Control < minimum.Control) + { + DBG("Insane control values!"); + p_states_count = 0; + } + else + { + U8 i; + p_states_count = 0; + + for (i = maximum.Control; i >= minimum.Control; i--) + { + p_states[p_states_count].Control = i; + p_states[p_states_count].CID = p_states[p_states_count].Control << 1; + p_states[p_states_count].Frequency = (Platform->CPU.FSBFrequency / 1000000) * i; + p_states_count++; + if (p_states_count >= MAX_PSTATES) { // was 32 + + if (p_states_count > MAX_PSTATES) // was 32 + p_states_count = MAX_PSTATES; // was 32 + + break; + } + } + } + + /* U32 sta = BuildCoreIPstateInfo(cpu); if (sta) { @@ -2186,7 +1468,7 @@ verbose("CoreI _PSS Generation failed !!\n"); return (0); } - + */ break; } default: @@ -2423,7 +1705,7 @@ DBG("_PSS PGK generated successfully\n"); return (1); } -#endif +#endif // BETA //----------------------------------------------------------------------------- static U32 BuildCstateInfo(CPU_DETAILS * cpu, U32 pmbase) @@ -2802,7 +2084,7 @@ } return (1); } -#endif +#endif // BUILD_ACPI_TSS //----------------------------------------------------------------------------- U32 ProcessMadt(ACPI_TABLE_MADT * madt, MADT_INFO * madt_info, void * buffer, U32 bufferSize, U32 nb_cpu) @@ -4070,7 +3352,7 @@ return(current); } -#endif +#endif // BUILD_ACPI_CSD #if BUILD_ACPI_TSS //----------------------------------------------------------------------------- @@ -4283,7 +3565,7 @@ return(current); } -#endif +#endif // BUILD_ACPI_TSS //----------------------------------------------------------------------------- static U32 BuildSsdt(MADT_INFO * madt_info, ACPI_TABLE_DSDT *dsdt, void * buffer, U32 bufferSize, bool enable_cstates, bool enable_pstates, bool enable_tstates) @@ -4621,7 +3903,6 @@ return(1); } -#endif #if UNUSED static ACPI_TABLE_FACS* generate_facs(bool updatefacs ) @@ -5330,10 +4611,8 @@ bool update_acpi=false, gen_xsdt=false; bool gen_csta=false, gen_psta=false, speed_step=false; -#if !OLD_SSDT bool gen_ssdt=false; // will force to generate ssdt even if gen_csta and gen_psta = false bool gen_tsta=false; -#endif bool oem_dsdt=false, oem_fadt=false; // Find original rsdp @@ -5358,15 +4637,11 @@ gen_csta=getBoolForKey(kGenerateCStates, &tmpval, &bootInfo->bootConfig)&&tmpval; gen_psta=getBoolForKey(kGeneratePStates, &tmpval, &bootInfo->bootConfig)&&tmpval; -#if !OLD_SSDT gen_ssdt=getBoolForKey(KForceSSDT, &tmpval, &bootInfo->bootConfig)&&tmpval; -#endif update_acpi=getBoolForKey(kUpdateACPI, &tmpval, &bootInfo->bootConfig)&&tmpval; speed_step=getBoolForKey(kSpeedstep, &tmpval, &bootInfo->bootConfig)&&tmpval; -#if !OLD_SSDT turbo_enabled=(U32)getBoolForKey(kCoreTurbo, &tmpval, &bootInfo->bootConfig)&&tmpval; -#endif #if BUILD_ACPI_TSS gen_tsta=(U32)getBoolForKey(kGenerateTStates, &tmpval, &bootInfo->bootConfig)&&tmpval; #endif @@ -5668,50 +4943,7 @@ DsdtPtr = ((fadt_mod->Header.Revision >= 3) && (fadt_mod->XDsdt != 0)) ? (ACPI_TABLE_DSDT*)((U32)fadt_mod->XDsdt) :(ACPI_TABLE_DSDT*)fadt_mod->Dsdt; } -#if OLD_SSDT - if (get_needed_symbols()) - { - if (speed_step || gen_csta || gen_psta) - { - U8 empty = get_0ul_index_in_list(new_table_list, true); - - // Generate _CST SSDT - if ( speed_step || gen_csta) - { - if (empty != ACPI_TABLE_LIST_FULL) - { - if (new_table_list[empty] =(U32)generate_cst_ssdt(fadt_mod)) - { - if (speed_step || gen_psta) - empty = get_0ul_index_in_list(new_table_list,true); - } - } - else - { - printf("Error: not enought reserved space in the new acpi list for the _CST SSDT table,\n "); - printf(" please increase the RESERVED_AERA\n"); - } - } - - - // Generating _PSS SSDT - if (speed_step || gen_psta) - { - if (empty != ACPI_TABLE_LIST_FULL) - { - - new_table_list[empty] =(U32)generate_pss_ssdt(DsdtPtr); - - } - else - { - printf("Error: not enought reserved space in the new acpi list for the _PSS SSDT table,\n "); - printf(" please increase the RESERVED_AERA\n"); - } - } - } - } -#else + { MADT_INFO madt_info; bool strip_madt = true; @@ -5749,7 +4981,6 @@ ProcessSsdt(new_table_list, DsdtPtr, &madt_info, gen_csta, gen_psta, gen_tsta ); } } -#endif if ((rsdp_mod != (void *)0ul) && (rsdp_mod->Length >= ACPI_RSDP_REV0_SIZE) ) { Index: branches/cparm/i386/modules/ACPICodec/Makefile =================================================================== --- branches/cparm/i386/modules/ACPICodec/Makefile (revision 1803) +++ branches/cparm/i386/modules/ACPICodec/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/modules/HelloWorld/Makefile =================================================================== --- branches/cparm/i386/modules/HelloWorld/Makefile (revision 1803) +++ branches/cparm/i386/modules/HelloWorld/Makefile (revision 1804) @@ -23,11 +23,11 @@ OPTIM = -Os -Oz DEBUG = -DNOTHING -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common DEFINES= Index: branches/cparm/i386/libsa/libsa.h =================================================================== --- branches/cparm/i386/libsa/libsa.h (revision 1803) +++ branches/cparm/i386/libsa/libsa.h (revision 1804) @@ -34,97 +34,77 @@ #if 0 #include "C_Exception.h" #endif +#include "quad.h" +/* + * This macro casts away the qualifier from the variable + * + * Note: use at your own risk, removing qualifiers can result in + * catastrophic run-time failures. + */ +#ifndef __CAST_AWAY_QUALIFIER +#define __CAST_AWAY_QUALIFIER(variable, qualifier, type) (type) (long)(variable) +#endif /* * ctype stuff (aserebln) */ -static inline int isupper(char c) -{ - return (c >= 'A' && c <= 'Z'); -} +#define isupper(c) (c >= 'A' && c <= 'Z') +#define islower(c) (c >= 'a' && c <= 'z') +#define isalpha(c) ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) +#define isascii(c) ((c >= 0x20) && (c < 0x7f)) +#define isspace(c) (c == ' ' || c == '\t' || c == '\n' || c == '\12') +#define isdigit(c) (c >= '0' && c <= '9') +#define isxdigit(c) ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) +#define ispunct(c) (c == '.' || c == '-') //Azi: TODO - add more ponctuation characters as needed; at least these two, i need for PartNo. -static inline int islower(char c) -{ - return (c >= 'a' && c <= 'z'); -} +/* + * string.c + */ -static inline int isalpha(char c) -{ - return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); -} +extern char * strbreak(const char *str, char **next, long *len); +extern int ptol(const char * str); -static inline int isascii(char c) -{ - return ( (c >= 0x20) && (c < 0x7f) ); -} +extern void bcopy(const void *, void *, size_t); +extern void bzero(void *, size_t); -static inline int isspace(char c) -{ - return (c == ' ' || c == '\t' || c == '\n' || c == '\12'); -} +extern void *memcpy(void *, const void *, size_t); +extern int memcmp(const void *, const void *, size_t); +extern void *memmove(void *, const void *, size_t); +extern void *memset(void *, int, size_t); -static inline int isdigit(char c) -{ - return (c >= '0' && c <= '9'); -} +extern size_t strlen(const char *); +extern size_t strnlen(const char *, size_t); -static inline int isxdigit(char c) -{ - return ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')); -} +/* strcpy() is being deprecated. Please use strlcpy() instead. */ +extern char *strcpy(char *, const char *); +extern char *strncpy(char *, const char *, size_t); -//Azi: TODO - add more ponctuation characters as needed; at least these two, i need for PartNo. -static inline int ispunct(char c) -{ - return (c == '.' || c == '-'); -} +extern size_t strlcat(char *, const char *, size_t); +extern size_t strlcpy(char *, const char *, size_t); -/* - * string.c - */ -#ifndef bcopy -extern void bcopy(const void * src, void * dst, size_t len); -#endif - -#ifndef bzero -extern void bzero(void * dst, size_t len); -#endif - -extern void * memset(void * dst, int c, size_t n); -extern void * memcpy(void * dst, const void * src, size_t len); -extern int memcmp(const void * p1, const void * p2, int len); -extern int strcmp(const char * s1, const char * s2); -extern int strncmp(const char * s1, const char * s2, size_t n); -extern char * strcpy(char * s1, const char * s2); -extern char * strncpy(char * s1, const char * s2, size_t n); -extern char * strlcpy(char * s1, const char * s2, size_t n); -extern char * strstr(const char *in, const char *str); -extern int atoi(const char * str); -extern int ptol(const char * str); -extern int strlen(const char * str); -extern char * strcat(char * s1, const char * s2); +/* strcat() is being deprecated. Please use strlcat() instead. */ +extern char *strcat(char *, const char *); extern char * strncat(char * s1, const char * s2, size_t n); -extern char * strdup(const char *s1); +/* strcmp() is being deprecated. Please use strncmp() instead. */ +extern int strcmp(const char *, const char *); +extern int strncmp(const char *,const char *, size_t); + #if STRNCASECMP -extern int strncasecmp(const char * s1, const char * s2, size_t n); +extern int strcasecmp(const char *s1, const char *s2); +extern int strncasecmp(const char *s1, const char *s2, size_t n); #endif +extern char *strdup(const char *); +extern char *strchr(const char *s, int c); +extern int atoi(const char *); +extern char *itoa(int ,char *); +extern const char *strstr(const char *, const char *); -extern char * strchr(const char *str, int c); -extern char * strbreak(const char *str, char **next, long *len); - extern uint8_t checksum8( void * start, unsigned int length ); - extern unsigned long adler32( unsigned char * buffer, long length ); + /* - * error.c - */ -extern int errno; -#if UNUSED -extern char * strerror(int errnum); -#endif -/* * strtol.c */ extern long strtol(const char * nptr, char ** endptr, int base); @@ -136,6 +116,7 @@ */ extern void prf(const char * fmt, va_list ap, void (*putfn_p)(), void * putfn_arg); +extern int prf_fmt_str_len(const char * fmt, va_list ap); /* * printf.c Index: branches/cparm/i386/libsa/quad.h =================================================================== --- branches/cparm/i386/libsa/quad.h (revision 0) +++ branches/cparm/i386/libsa/quad.h (revision 1804) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)quad.h 8.1 (Berkeley) 6/4/93 + * $FreeBSD: src/sys/libkern/quad.h,v 1.9 1999/08/28 00:46:36 peter Exp $ + */ + +/* + * Quad arithmetic. + * + * This library makes the following assumptions: + * + * - The type long long (aka quad_t) exists. + * + * - A quad variable is exactly twice as long as `long'. + * + * - The machine's arithmetic is two's complement. + * + * This library can provide 128-bit arithmetic on a machine with 128-bit + * quads and 64-bit longs, for instance, or 96-bit arithmetic on machines + * with 48-bit longs. + */ + +#include +#include +#include + +/* + * Depending on the desired operation, we view a `long long' (aka quad_t) in + * one or more of the following formats. + */ +union uu { + quad_t q; /* as a (signed) quad */ + quad_t uq; /* as an unsigned quad */ + long sl[2]; /* as two signed longs */ + u_long ul[2]; /* as two unsigned longs */ +}; + +/* + * Define high and low longwords. + */ +#define Hi _QUAD_HIGHWORD +#define Lo _QUAD_LOWWORD + +/* + * Total number of bits in a quad_t and in the pieces that make it up. + * These are used for shifting, and also below for halfword extraction + * and assembly. + */ +#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT) +#define LONG_BITS (sizeof(long) * CHAR_BIT) +#define HALF_BITS (sizeof(long) * CHAR_BIT / 2) + +/* + * Extract high and low shortwords from longword, and move low shortword of + * longword to upper half of long, i.e., produce the upper longword of + * ((quad_t)(x) << (number_of_bits_in_long/2)). (`x' must actually be u_long.) + * + * These are used in the multiply code, to split a longword into upper + * and lower halves, and to reassemble a product as a quad_t, shifted left + * (sizeof(long)*CHAR_BIT/2). + */ +#define HHALF(x) ((x) >> HALF_BITS) +#define LHALF(x) ((x) & ((1 << HALF_BITS) - 1)) +#define LHUP(x) ((x) << HALF_BITS) + +quad_t __divdi3 __P((quad_t a, quad_t b)); +quad_t __moddi3 __P((quad_t a, quad_t b)); +u_quad_t __qdivrem __P((u_quad_t u, u_quad_t v, u_quad_t *rem)); +u_quad_t __udivdi3 __P((u_quad_t a, u_quad_t b)); +u_quad_t __umoddi3 __P((u_quad_t a, u_quad_t b)); + +/* + * XXX + * Compensate for gcc 1 vs gcc 2. Gcc 1 defines ?sh?di3's second argument + * as u_quad_t, while gcc 2 correctly uses int. Unfortunately, we still use + * both compilers. + */ +#if __GNUC__ >= 2 +typedef unsigned int qshift_t; +#else +typedef u_quad_t qshift_t; +#endif + + + + + + + + + Index: branches/cparm/i386/libsa/bzero.s =================================================================== --- branches/cparm/i386/libsa/bzero.s (revision 0) +++ branches/cparm/i386/libsa/bzero.s (revision 1804) @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + /* + * @OSF_COPYRIGHT@ + */ +/* + * Mach Operating System + * Copyright (c) 1991,1990 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + */ + +#include + +/* + * void *memset(void * addr, int pattern, size_t length) + */ + +LABEL(_memset) + pushl %edi + movl 4+ 4(%esp),%edi /* addr */ + movb 4+ 8(%esp),%al /* pattern */ + movl 4+ 12(%esp),%edx /* length */ + movb %al,%ah + movw %ax,%cx + shll $16,%eax + movw %cx,%ax + cld +/* zero longs */ + movl %edx,%ecx + shrl $2,%ecx + rep + stosl +/* zero bytes */ + movl %edx,%ecx + andl $3,%ecx + rep + stosb + movl 4+ 4(%esp),%eax /* returns its first argument */ + popl %edi + ret + +/* + * void bzero(char * addr, size_t length) + */ +LABEL(_bzero) + pushl %edi + movl 4+ 4(%esp),%edi /* addr */ + movl 4+ 8(%esp),%edx /* length */ + xorl %eax,%eax + cld +/* zero longs */ + movl %edx,%ecx + shrl $2,%ecx + rep + stosl +/* zero bytes */ + movl %edx,%ecx + andl $3,%ecx + rep + stosb + popl %edi + ret Index: branches/cparm/i386/libsa/umoddi3.c =================================================================== --- branches/cparm/i386/libsa/umoddi3.c (revision 0) +++ branches/cparm/i386/libsa/umoddi3.c (revision 1804) @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/libkern/umoddi3.c,v 1.6 1999/08/28 00:46:39 peter Exp $ + */ + +#include "quad.h" + +/* + * Return remainder after dividing two unsigned quads. + */ +u_quad_t +__umoddi3(a, b) +u_quad_t a, b; +{ + u_quad_t r; + + (void)__qdivrem(a, b, &r); + return (r); +} + + + + + + + + + Index: branches/cparm/i386/libsa/string.c =================================================================== --- branches/cparm/i386/libsa/string.c (revision 1803) +++ branches/cparm/i386/libsa/string.c (revision 1804) @@ -25,204 +25,186 @@ #include "libsa.h" -void * memset(void * dst, int val, size_t len) -{ - asm volatile ( "rep; stosb" - : "=c" (len), "=D" (dst) - : "0" (len), "1" (dst), "a" (val) - : "memory" ); +static int _mach_strlen(const char *str); +static char *STRDUP(const char *string); - return dst; -} - -#if 0 -void * memcpy(void * dst, const void * src, size_t len) -{ - asm volatile ( "rep; movsb" - : "=c" (len), "=D" (dst), "=S" (src) - : "0" (len), "1" (dst), "2" (src) - : "memory" ); - - return dst; -} - -void bcopy(const void * src, void * dst, size_t len) -{ - memcpy(dst, src, len); -} - -void bzero(void * dst, size_t len) -{ - memset(dst, 0, len); -} /* -void __bzero(void * dst, size_t len) -{ - memset(dst, 0, len); -} -*/ -#else -void * memcpy(void * dst, const void * src, size_t len) -{ - asm volatile ( "cld \n\t" - "movl %%ecx, %%edx \n\t" - "shrl $2, %%ecx \n\t" - "rep; movsl \n\t" - "movl %%edx, %%ecx \n\t" - "andl $3, %%ecx \n\t" - "rep; movsb \n\t" - : "=D" (dst) - : "c" (len), "D" (dst), "S" (src) - : "memory", "%edx" ); + * Abstract: + * strcmp (s1, s2) compares the strings "s1" and "s2". + * It returns 0 if the strings are identical. It returns + * > 0 if the first character that differs in the two strings + * is larger in s1 than in s2 or if s1 is longer than s2 and + * the contents are identical up to the length of s2. + * It returns < 0 if the first differing character is smaller + * in s1 than in s2 or if s1 is shorter than s2 and the + * contents are identical upto the length of s1. + * Deprecation Warning: + * strcmp() is being deprecated. Please use strncmp() instead. + */ - return dst; -} - -void bcopy(const void * src, void * dst, size_t len) +int +strcmp( + const char *s1, + const char *s2) { - asm volatile ( "cld \n\t" - "movl %%ecx, %%edx \n\t" - "shrl $2, %%ecx \n\t" - "rep; movsl \n\t" - "movl %%edx, %%ecx \n\t" - "andl $3, %%ecx \n\t" - "rep; movsb \n\t" - : - : "c" (len), "D" (dst), "S" (src) - : "memory", "%edx" ); + unsigned int a, b; + + do { + a = *s1++; + b = *s2++; + if (a != b) + return a-b; /* includes case when + 'a' is zero and 'b' is not zero + or vice versa */ + } while (a != '\0'); + + return 0; /* both are zero */ } -void bzero(void * dst, size_t len) -{ - asm volatile ( "xorl %%eax, %%eax \n\t" - "cld \n\t" - "movl %%ecx, %%edx \n\t" - "shrl $2, %%ecx \n\t" - "rep; stosl \n\t" - "movl %%edx, %%ecx \n\t" - "andl $3, %%ecx \n\t" - "rep; stosb \n\t" - : - : "c" (len), "D" (dst) - : "memory", "%eax" ); -} /* -void __bzero(void * dst, size_t len) -{ - asm volatile ( "xorl %%eax, %%eax \n\t" - "cld \n\t" - "movl %%ecx, %%edx \n\t" - "shrl $2, %%ecx \n\t" - "rep; stosl \n\t" - "movl %%edx, %%ecx \n\t" - "andl $3, %%ecx \n\t" - "rep; stosb \n\t" - : - : "c" (len), "D" (dst) - : "memory", "%eax" ); -}*/ -#endif + * Abstract: + * strncmp (s1, s2, n) compares the strings "s1" and "s2" + * in exactly the same way as strcmp does. Except the + * comparison runs for at most "n" characters. + */ -/* #if DONT_USE_GCC_BUILT_IN_STRLEN */ - - - -int strlen(const char * s) -{ - int n = 0; - while (*s++) n++; - return(n); -} - -/*#endif*/ - -/* NOTE: Moved from ntfs.c */ int -memcmp(const void *p1, const void *p2, int len) +strncmp( + const char *s1, + const char *s2, + size_t n) { - while (len--) { - if (*(const char*)(p1++) != *(const char*)(p2++)) - return -1; - } - return 0; -} - -int -strcmp(const char * s1, const char * s2) -{ - while (*s1 && (*s1 == *s2)) { - s1++; - s2++; + unsigned int a, b; + + while (n != 0) { + a = *s1++; + b = *s2++; + if (a != b) + return a-b; /* includes case when + 'a' is zero and 'b' is not zero + or vice versa */ + if (a == '\0') + return 0; /* both are zero */ + n--; } - return (*s1 - *s2); + + return 0; } -int strncmp(const char * s1, const char * s2, size_t len) -{ - register int n = len; - while (--n >= 0 && *s1 == *s2++) - if (*s1++ == '\0') - return(0); - return(n<0 ? 0 : *s1 - *--s2); -} +/* + * Abstract: + * strcpy copies the contents of the string "from" including + * the null terminator to the string "to". A pointer to "to" + * is returned. + * Deprecation Warning: + * strcpy() is being deprecated. Please use strlcpy() instead. + */ char * -strcpy(char * s1, const char * s2) +strcpy( + char *to, + const char *from) { - register char *ret = s1; - while ((*s1++ = *s2++)) + char *ret = to; + + while ((*to++ = *from++) != '\0') continue; + return ret; } +/* + * Abstract: + * strncpy copies "count" characters from the "from" string to + * the "to" string. If "from" contains less than "count" characters + * "to" will be padded with null characters until exactly "count" + * characters have been written. The return value is a pointer + * to the "to" string. + */ + char * -strncpy(char * s1, const char * s2, size_t n) +strncpy( + char *s1, + const char *s2, + size_t n) { - register char *ret = s1; - while (n && (*s1++ = *s2++)) - n--; - return ret; + char *os1 = s1; + unsigned long i; + + for (i = 0; i < n;) + if ((*s1++ = *s2++) == '\0') + for (i++; i < n; i++) + *s1++ = '\0'; + else + i++; + return (os1); } -char * -strlcpy(char * s1, const char * s2, size_t n) +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +size_t +strlcpy(char *dst, const char *src, size_t siz) { - register char *ret = s1; - while (n && (*s1++ = *s2++)) - n--; - if (!n) *--s1=0; - return ret; + char *d = dst; + const char *s = src; + size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) { + do { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0); + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ } -char * +/* + * History: + * 2002-01-24 gvdl Initial implementation of strstr + */ + +const char * strstr(const char *in, const char *str) { char c; size_t len; - + c = *str++; if (!c) - return (char *) in; // Trivial empty string case - + return (const char *) in; // Trivial empty string case + len = strlen(str); do { char sc; - + do { sc = *in++; if (!sc) return (char *) 0; } while (sc != c); } while (strncmp(in, str, len) != 0); - - return (char *) (in - 1); + + return (const char *) (in - 1); } int ptol(const char *str) { register int c = *str; - + if (c <= '7' && c >= '0') c -= '0'; else if (c <= 'h' && c >= 'a') @@ -231,67 +213,271 @@ return c; } +/* + * atoi: + * + * This function converts an ascii string into an integer. + * + * input : string + * output : a number + */ + int -atoi(const char *str) +atoi(const char *cp) { - register int sum = 0; - while (*str == ' ' || *str == '\t') - str++; - while (*str >= '0' && *str <= '9') { - sum *= 10; - sum += *str++ - '0'; + int number; + + for (number = 0; ('0' <= *cp) && (*cp <= '9'); cp++) + number = (number * 10) + (*cp - '0'); + + return( number ); +} + +/* + * convert an integer to an ASCII string. + * inputs: + * num integer to be converted + * str string pointer. + * + * outputs: + * pointer to string start. + */ + +char * +itoa( + int num, + char *str) +{ + char digits[11]; + char *dp; + char *cp = str; + + if (num == 0) { + *cp++ = '0'; } - return sum; + else { + dp = digits; + while (num) { + *dp++ = '0' + num % 10; + num /= 10; + } + while (dp != digits) { + *cp++ = *--dp; + } + } + *cp++ = '\0'; + + return str; } -char *strncat(char *s1, const char *s2, size_t n) +/* + * Appends src to string dst of size siz (unlike strncat, siz is the + * full size of dst, not space left). At most siz-1 characters + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * If retval >= siz, truncation occurred. + */ +size_t +strlcat(char *dst, const char *src, size_t siz) { - register char *ret = s1; - while (*s1) - s1++; - while (n-- && *s2) - *s1++ = *s2++; - *s1 = '\0'; - return ret; + char *d = dst; + const char *s = src; + size_t n = siz; + size_t dlen; + + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; + + if (n == 0) + return(dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; + n--; + } + s++; + } + *d = '\0'; + + return(dlen + (s - src)); /* count does not include NUL */ } -char *strcat(char *s1, const char *s2) +/* + * + */ + +char * +strncat(char *s1, const char *s2, unsigned long n) { - return(strncat(s1, s2, strlen(s2))); + char *os1; + int i = n; + + os1 = s1; + while (*s1++) + ; + --s1; + while ((*s1++ = *s2++)) + if (--i < 0) { + *--s1 = '\0'; + break; + } + return(os1); } -char *strdup(const char *s1) +static int +_mach_strlen(const char *str) { - return strcpy(malloc(strlen(s1) + 1), s1); + const char *p; + for (p = str; p; p++) { + if (*p == '\0') { + return (p - str); + } + } + /* NOTREACHED */ + return 0; } +size_t strlen(const char * str) +{ + return (size_t)_mach_strlen(str); +} + +/* + * Does the same thing as strlen, except only looks up + * to max chars inside the buffer. + * Taken from archive/kern-stuff/sbf_machine.c in + * seatbelt. + * inputs: + * s string whose length is to be measured + * max maximum length of string to search for null + * outputs: + * length of s or max; whichever is smaller + */ +size_t +strnlen(const char *s, size_t max) { + const char *es = s + max, *p = s; + while(*p && p != es) + p++; + + return p - s; +} + +/* + * Deprecation Warning: + * strcat() is being deprecated. Please use strlcat() instead. + */ +char * +strcat( + char *dest, + const char *src) +{ + char *old = dest; + + while (*dest) + ++dest; + while ((*dest++ = *src++)) + ; + return (old); +} + +/* + * STRDUP + * + * Description: The STRDUP function allocates sufficient memory for a copy + * of the string "string", does the copy, and returns a pointer + * it. The pointer may subsequently be used as an argument to + * the macro FREE(). + * + * Parameters: string String to be duplicated + * + * Returns: char * A pointer to the newly allocated string with + * duplicated contents in it. + * + * NULL If MALLOC() fails. + * + */ +static char * +STRDUP(const char *string) +{ + size_t len; + char *copy; + + len = strlen(string) + 1; + copy = malloc(len); + if (copy == NULL) + return (NULL); + bcopy(string, copy, len); + return (copy); +} + +char *strdup(const char *string) +{ + if (string) { + return STRDUP(string); + } + return (NULL); +} + #if STRNCASECMP -#define tolower(c) ((int)((c) & ~0x20)) -#define toupper(c) ((int)((c) | 0x20)) +// +// Lame implementation just for use by strcasecmp/strncasecmp +// +static int +tolower(unsigned char ch) +{ + if (ch >= 'A' && ch <= 'Z') + ch = 'a' + (ch - 'A'); + + return ch; +} -int strncasecmp(const char *s1, const char *s2, size_t len) +int +strcasecmp(const char *s1, const char *s2) { - register int n = len; - while (--n >= 0 && tolower(*s1) == tolower(*s2++)) - if (*s1++ == '\0') - return(0); - return(n<0 ? 0 : tolower(*s1) - tolower(*--s2)); + const unsigned char *us1 = (const u_char *)s1, + *us2 = (const u_char *)s2; + + while (tolower(*us1) == tolower(*us2++)) + if (*us1++ == '\0') + return (0); + return (tolower(*us1) - tolower(*--us2)); } + +int +strncasecmp(const char *s1, const char *s2, size_t n) +{ + if (n != 0) { + const unsigned char *us1 = (const u_char *)s1, + *us2 = (const u_char *)s2; + + do { + if (tolower(*us1) != tolower(*us2++)) + return (tolower(*us1) - tolower(*--us2)); + if (*us1++ == '\0') + break; + } while (--n != 0); + } + return (0); +} #endif -char* strchr(const char *str, int c) +/* + * + */ + +char *strchr(const char *str, int ch) { - do - { - if(*str == c) - return (char*)str; - } - while(*(str++)); - - return 0; -} - + do { + if (*str == ch) + return(__CAST_AWAY_QUALIFIER(str, const, char *)); + } while (*str++); + return ((char *) 0); +} + char* strbreak(const char *str, char **next, long *len) { char *start = (char*)str, *end; @@ -335,10 +521,10 @@ uint8_t csum = 0; uint8_t * cp = (uint8_t *) start; unsigned int i; - + for ( i = 0; i < length; i++) csum += *cp++; - + return csum; } @@ -383,4 +569,54 @@ { holdrand = holdrand * 214013L + 2531011L; return ((holdrand >> 16) & RAND_MAX); +} + +/*- + * For memcmp. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Compare memory regions. + */ +int +memcmp(const void *s1, const void *s2, size_t n) +{ + if (n != 0) { + const unsigned char *p1 = s1, *p2 = s2; + + do { + if (*p1++ != *p2++) + return (*--p1 - *--p2); + } while (--n != 0); + } + return (0); } \ No newline at end of file Index: branches/cparm/i386/libsa/udivdi3.c =================================================================== --- branches/cparm/i386/libsa/udivdi3.c (revision 0) +++ branches/cparm/i386/libsa/udivdi3.c (revision 1804) @@ -0,0 +1,61 @@ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/libkern/udivdi3.c,v 1.6 1999/08/28 00:46:38 peter Exp $ + */ + +#include "quad.h" + +/* + * Divide two unsigned quads. + */ +u_quad_t +__udivdi3(a, b) +u_quad_t a, b; +{ + + return (__qdivrem(a, b, (u_quad_t *)0)); +} + + + + + + + + + Index: branches/cparm/i386/libsa/qdivrem.c =================================================================== --- branches/cparm/i386/libsa/qdivrem.c (revision 0) +++ branches/cparm/i386/libsa/qdivrem.c (revision 1804) @@ -0,0 +1,277 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/libkern/qdivrem.c,v 1.8 1999/08/28 00:46:35 peter Exp $ + */ + +/* + * Multiprecision divide. This algorithm is from Knuth vol. 2 (2nd ed), + * section 4.3.1, pp. 257--259. + */ + +#include "quad.h" + +#define B (1 << HALF_BITS) /* digit base */ + +/* Combine two `digits' to make a single two-digit number. */ +#define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b)) + +/* select a type for digits in base B: use unsigned short if they fit */ +#if ULONG_MAX == 0xffffffff && USHRT_MAX >= 0xffff +typedef unsigned short digit; +#else +typedef u_long digit; +#endif + +/* + * Shift p[0]..p[len] left `sh' bits, ignoring any bits that + * `fall out' the left (there never will be any such anyway). + * We may assume len >= 0. NOTE THAT THIS WRITES len+1 DIGITS. + */ +static void +shl(register digit *p, register int len, register int sh) +{ + register int i; + + for (i = 0; i < len; i++) + p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh)); + p[i] = LHALF(p[i] << sh); +} + +/* + * __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v. + * + * We do this in base 2-sup-HALF_BITS, so that all intermediate products + * fit within u_long. As a consequence, the maximum length dividend and + * divisor are 4 `digits' in this base (they are shorter if they have + * leading zeros). + */ +u_quad_t +__qdivrem(uq, vq, arq) +u_quad_t uq, vq, *arq; +{ + union uu tmp; + digit *u, *v, *q; + register digit v1, v2; + u_long qhat, rhat, t; + int m, n, d, j, i; + digit uspace[5], vspace[5], qspace[5]; + + /* + * Take care of special cases: divide by zero, and u < v. + */ + if (vq == 0) { + /* divide by zero. */ + static volatile const unsigned int zero = 0; + + tmp.ul[Hi] = tmp.ul[Lo] = 1 / zero; + if (arq) + *arq = uq; + return (tmp.q); + } + if (uq < vq) { + if (arq) + *arq = uq; + return (0); + } + u = &uspace[0]; + v = &vspace[0]; + q = &qspace[0]; + + /* + * Break dividend and divisor into digits in base B, then + * count leading zeros to determine m and n. When done, we + * will have: + * u = (u[1]u[2]...u[m+n]) sub B + * v = (v[1]v[2]...v[n]) sub B + * v[1] != 0 + * 1 < n <= 4 (if n = 1, we use a different division algorithm) + * m >= 0 (otherwise u < v, which we already checked) + * m + n = 4 + * and thus + * m = 4 - n <= 2 + */ + tmp.uq = uq; + u[0] = 0; + u[1] = HHALF(tmp.ul[Hi]); + u[2] = LHALF(tmp.ul[Hi]); + u[3] = HHALF(tmp.ul[Lo]); + u[4] = LHALF(tmp.ul[Lo]); + tmp.uq = vq; + v[1] = HHALF(tmp.ul[Hi]); + v[2] = LHALF(tmp.ul[Hi]); + v[3] = HHALF(tmp.ul[Lo]); + v[4] = LHALF(tmp.ul[Lo]); + for (n = 4; v[1] == 0; v++) { + if (--n == 1) { + u_long rbj; /* r*B+u[j] (not root boy jim) */ + digit q1, q2, q3, q4; + + /* + * Change of plan, per exercise 16. + * r = 0; + * for j = 1..4: + * q[j] = floor((r*B + u[j]) / v), + * r = (r*B + u[j]) % v; + * We unroll this completely here. + */ + t = v[2]; /* nonzero, by definition */ + q1 = u[1] / t; + rbj = COMBINE(u[1] % t, u[2]); + q2 = rbj / t; + rbj = COMBINE(rbj % t, u[3]); + q3 = rbj / t; + rbj = COMBINE(rbj % t, u[4]); + q4 = rbj / t; + if (arq) + *arq = rbj % t; + tmp.ul[Hi] = COMBINE(q1, q2); + tmp.ul[Lo] = COMBINE(q3, q4); + return (tmp.q); + } + } + + /* + * By adjusting q once we determine m, we can guarantee that + * there is a complete four-digit quotient at &qspace[1] when + * we finally stop. + */ + for (m = 4 - n; u[1] == 0; u++) + m--; + for (i = 4 - m; --i >= 0;) + q[i] = 0; + q += 4 - m; + + /* + * Here we run Program D, translated from MIX to C and acquiring + * a few minor changes. + * + * D1: choose multiplier 1 << d to ensure v[1] >= B/2. + */ + d = 0; + for (t = v[1]; t < B / 2; t <<= 1) + d++; + if (d > 0) { + shl(&u[0], m + n, d); /* u <<= d */ + shl(&v[1], n - 1, d); /* v <<= d */ + } + /* + * D2: j = 0. + */ + j = 0; + v1 = v[1]; /* for D3 -- note that v[1..n] are constant */ + v2 = v[2]; /* for D3 */ + do { + register digit uj0, uj1, uj2; + + /* + * D3: Calculate qhat (\^q, in TeX notation). + * Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and + * let rhat = (u[j]*B + u[j+1]) mod v[1]. + * While rhat < B and v[2]*qhat > rhat*B+u[j+2], + * decrement qhat and increase rhat correspondingly. + * Note that if rhat >= B, v[2]*qhat < rhat*B. + */ + uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */ + uj1 = u[j + 1]; /* for D3 only */ + uj2 = u[j + 2]; /* for D3 only */ + if (uj0 == v1) { + qhat = B; + rhat = uj1; + goto qhat_too_big; + } else { + u_long nn = COMBINE(uj0, uj1); + qhat = nn / v1; + rhat = nn % v1; + } + while (v2 * qhat > COMBINE(rhat, uj2)) { + qhat_too_big: + qhat--; + if ((rhat += v1) >= B) + break; + } + /* + * D4: Multiply and subtract. + * The variable `t' holds any borrows across the loop. + * We split this up so that we do not require v[0] = 0, + * and to eliminate a final special case. + */ + for (t = 0, i = n; i > 0; i--) { + t = u[i + j] - v[i] * qhat - t; + u[i + j] = LHALF(t); + t = (B - HHALF(t)) & (B - 1); + } + t = u[j] - t; + u[j] = LHALF(t); + /* + * D5: test remainder. + * There is a borrow if and only if HHALF(t) is nonzero; + * in that (rare) case, qhat was too large (by exactly 1). + * Fix it by adding v[1..n] to u[j..j+n]. + */ + if (HHALF(t)) { + qhat--; + for (t = 0, i = n; i > 0; i--) { /* D6: add back. */ + t += u[i + j] + v[i]; + u[i + j] = LHALF(t); + t = HHALF(t); + } + u[j] = LHALF(u[j] + t); + } + q[j] = qhat; + } while (++j <= m); /* D7: loop on j. */ + + /* + * If caller wants the remainder, we have to calculate it as + * u[m..m+n] >> d (this is at most n digits and thus fits in + * u[m+1..m+n], but we may need more source digits). + */ + if (arq) { + if (d) { + for (i = m + n; i > m; --i) + u[i] = (u[i] >> d) | + LHALF(u[i - 1] << (HALF_BITS - d)); + u[i] = 0; + } + tmp.ul[Hi] = COMBINE(uspace[1], uspace[2]); + tmp.ul[Lo] = COMBINE(uspace[3], uspace[4]); + *arq = tmp.q; + } + + tmp.ul[Hi] = COMBINE(qspace[1], qspace[2]); + tmp.ul[Lo] = COMBINE(qspace[3], qspace[4]); + return (tmp.q); +} \ No newline at end of file Index: branches/cparm/i386/libsa/moddi3.c =================================================================== --- branches/cparm/i386/libsa/moddi3.c (revision 0) +++ branches/cparm/i386/libsa/moddi3.c (revision 1804) @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/libkern/moddi3.c,v 1.7 1999/08/28 00:46:34 peter Exp $ + */ + +#include "quad.h" + +/* + * Return remainder after dividing two signed quads. + * + * XXX + * If -1/2 should produce -1 on this machine, this code is wrong. + */ +quad_t +__moddi3(a, b) +quad_t a, b; +{ + u_quad_t ua, ub, ur; + int neg; + + if (a < 0) + ua = -(u_quad_t)a, neg = 1; + else + ua = a, neg = 0; + if (b < 0) + ub = -(u_quad_t)b; + else + ub = b; + (void)__qdivrem(ua, ub, &ur); + return (neg ? -ur : ur); +} \ No newline at end of file Index: branches/cparm/i386/libsa/setjmp.s =================================================================== --- branches/cparm/i386/libsa/setjmp.s (revision 1803) +++ branches/cparm/i386/libsa/setjmp.s (revision 1804) @@ -24,35 +24,27 @@ #include -#define O_EDI 0 -#define O_ESI 4 -#define O_EBX 8 -#define O_EBP 12 -#define O_ESP 16 -#define O_EIP 20 +LABEL(_setjmp) + movl 4(%esp),%ecx # fetch buffer + movl %ebx,0(%ecx) + movl %esi,4(%ecx) + movl %edi,8(%ecx) + movl %ebp,12(%ecx) # save frame pointer of caller + popl %edx + movl %esp,16(%ecx) # save stack pointer of caller + movl %edx,20(%ecx) # save pc of caller + xorl %eax,%eax + jmp *%edx -LEAF(_setjmp, 0) -X_LEAF(_set_label, _setjmp) - movl 4(%esp), %edx // address of save area - movl %edi, O_EDI(%edx) - movl %esi, O_ESI(%edx) - movl %ebx, O_EBX(%edx) - movl %ebp, O_EBP(%edx) - movl %esp, O_ESP(%edx) - movl (%esp), %ecx // %eip (return address) - movl %ecx, O_EIP(%edx) - subl %eax, %eax // retval <- 0 - ret - -LEAF(_longjmp, 0) -X_LEAF(_jump_label, _longjmp) - movl 4(%esp), %edx // address of save area - movl O_EDI(%edx), %edi - movl O_ESI(%edx), %esi - movl O_EBX(%edx), %ebx - movl O_EBP(%edx), %ebp - movl O_ESP(%edx), %esp - movl O_EIP(%edx), %eax // %eip (return address) - movl %eax, 0(%esp) - popl %eax // ret addr != 0 - jmp *%eax // indirect +LABEL(_longjmp) + movl 8(%esp),%eax # return(v) + movl 4(%esp),%ecx # fetch buffer + movl 0(%ecx),%ebx + movl 4(%ecx),%esi + movl 8(%ecx),%edi + movl 12(%ecx),%ebp + movl 16(%ecx),%esp + orl %eax,%eax + jnz 0f + incl %eax +0: jmp *20(%ecx) # done, return.... Index: branches/cparm/i386/libsa/divdi3.c =================================================================== --- branches/cparm/i386/libsa/divdi3.c (revision 0) +++ branches/cparm/i386/libsa/divdi3.c (revision 1804) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/libkern/divdi3.c,v 1.6 1999/08/28 00:46:31 peter Exp $ + */ + +#include "quad.h" + +/* + * Divide two signed quads. + * ??? if -1/2 should produce -1 on this machine, this code is wrong + */ +quad_t +__divdi3(a, b) +quad_t a, b; +{ + u_quad_t ua, ub, uq; + int neg; + + if (a < 0) + ua = -(u_quad_t)a, neg = 1; + else + ua = a, neg = 0; + if (b < 0) + ub = -(u_quad_t)b, neg ^= 1; + else + ub = b; + uq = __qdivrem(ua, ub, (u_quad_t *)0); + return (neg ? -uq : uq); +} Index: branches/cparm/i386/libsa/zalloc.c =================================================================== --- branches/cparm/i386/libsa/zalloc.c (revision 1803) +++ branches/cparm/i386/libsa/zalloc.c (revision 1804) @@ -69,6 +69,7 @@ #else static void * Malloc(size_t size); #endif +static void * __malloc (size_t size); #if ZDEBUG size_t zalloced_size; @@ -99,12 +100,12 @@ zalloced = (zmem *) zalloc_base; zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes; zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes; - if (size == 0) size = ZALLOC_LEN; + if (size == 0) size = ZALLOC_LEN; zavailable[0].size = size - (zavailable[0].start - zalloc_base); - zalloc_end = zalloc_base + size; + zalloc_end = zalloc_base + size; availableNodes = 1; allocedNodes = 0; - zerror = malloc_err_fn ? malloc_err_fn : malloc_error; + zerror = malloc_err_fn ? malloc_err_fn : malloc_error; } #define BEST_FIT 1 @@ -117,38 +118,38 @@ { int i; #if BEST_FIT - int bestFit; - size_t smallestSize; + int bestFit; + size_t smallestSize; #endif char * ret = 0; - + if ( !zalloc_base ) { // this used to follow the bss but some bios' corrupted it... malloc_init((char *)ZALLOC_ADDR, ZALLOC_LEN, ZALLOC_NODES, malloc_error); } - + size = ((size + 0xf) & ~0xf); - - /*if (size == 0) { - if (zerror) (*zerror)((char *)0xdeadbeef, 0, file, line); - }*/ + + /*if (size == 0) { + if (zerror) (*zerror)((char *)0xdeadbeef, 0, file, line); + }*/ if (size == 0 && zerror) #ifdef SAFE_MALLOC (*zerror)((char *)0xdeadbeef, 0, file, line); #else - (*zerror)((char *)0xdeadbeef, 0); + (*zerror)((char *)0xdeadbeef, 0); #endif #if BEST_FIT - smallestSize = 0; - bestFit = -1; + smallestSize = 0; + bestFit = -1; #endif - + for (i = 0; i < availableNodes; i++) { // find node with equal size, or if not found, - // then smallest node that fits. + // then smallest node that fits. if ( zavailable[i].size == size ) { zallocate(ret = zavailable[i].start, size); @@ -156,17 +157,17 @@ goto done; } #if BEST_FIT - else - { - if ((zavailable[i].size > size) && - ((smallestSize == 0) || - (zavailable[i].size < smallestSize))) - { - bestFit = i; - smallestSize = zavailable[i].size; - } - } - + else + { + if ((zavailable[i].size > size) && + ((smallestSize == 0) || + (zavailable[i].size < smallestSize))) + { + bestFit = i; + smallestSize = zavailable[i].size; + } + } + #else else if ( zavailable[i].size > size ) { @@ -176,66 +177,77 @@ goto done; } #endif - } + } #if BEST_FIT - if (bestFit != -1) - { - zallocate(ret = zavailable[bestFit].start, size); - zavailable[bestFit].start += size; - zavailable[bestFit].size -= size; - } + if (bestFit != -1) + { + zallocate(ret = zavailable[bestFit].start, size); + zavailable[bestFit].start += size; + zavailable[bestFit].size -= size; + } #endif - + done: #if ZDEBUG - zalloced_size += size; + zalloced_size += size; #endif return (void *) ret; } -void * -malloc (size_t size) +static void * +__malloc (size_t size) { + #ifdef SAFE_MALLOC - register void *ret = Safe_Malloc( size, __FILE__, __LINE__); + register void *ret = Safe_Malloc( size, __FILE__, __LINE__); #else - register void *ret = Malloc (size); -#endif - if (ret == 0 || ((char *)ret + size >= zalloc_end)) - { - if (zerror) + register void *ret = Malloc (size); +#endif + if (ret == 0 || ((char *)ret + size >= zalloc_end)) + { + if (zerror) #ifdef SAFE_MALLOC - (*zerror)(ret, size, __FILE__, __LINE__); + (*zerror)(ret, size, __FILE__, __LINE__); #else - (*zerror)(ret, size); + (*zerror)(ret, size); #endif - } - if (ret != 0) - { + } + if (ret != 0) + { bzero(ret, size); - } + } return ret; } +void * +malloc (size_t size) +{ + if (size > 0) + { + return __malloc(size); + } + return (void *)0; +} + void free(void * pointer) { - unsigned long rp; + unsigned long rp; int i, found = 0; - size_t tsize = 0; + size_t tsize = 0; char * start = pointer; - + #if i386 - // Get return address of our caller, - // in case we have to report an error below. - asm volatile ("movl %%esp, %%eax\n\t" - "subl $4, %%eax\n\t" - "movl 0(%%eax), %%eax" : "=a" (rp) ); + // Get return address of our caller, + // in case we have to report an error below. + asm volatile ("movl %%esp, %%eax\n\t" + "subl $4, %%eax\n\t" + "movl 0(%%eax), %%eax" : "=a" (rp) ); #else - rp = 0; + rp = 0; #endif - + if ( !start ) return; - + for (i = 0; i < allocedNodes; i++) { if ( zalloced[i].start == start ) @@ -248,24 +260,24 @@ zdelete(zalloced, i); allocedNodes--; found = 1; #if ZDEBUG - memset(pointer, 0x5A, tsize); + memset(pointer, 0x5A, tsize); #endif break; } } if ( !found ) { - if (zerror) + if (zerror) #ifdef SAFE_MALLOC - (*zerror)(pointer, rp, "free", 0); + (*zerror)(pointer, rp, "free", 0); #else - (*zerror)(pointer, rp); + (*zerror)(pointer, rp); #endif - else return; - } + else return; + } #if ZDEBUG - zalloced_size -= tsize; + zalloced_size -= tsize; #endif - + for (i = 0; i < availableNodes; i++) { if ((start + tsize) == zavailable[i].start) // merge it in @@ -275,40 +287,40 @@ zcoalesce(); return; } - + if ((i > 0) && - (zavailable[i-1].start + zavailable[i-1].size == start)) + (zavailable[i-1].start + zavailable[i-1].size == start)) { zavailable[i-1].size += tsize; zcoalesce(); return; } - + if ((start + tsize) < zavailable[i].start) { - if (++availableNodes > totalNodes) { - if (zerror) + if (++availableNodes > totalNodes) { + if (zerror) #ifdef SAFE_MALLOC - (*zerror)((char *)0xf000f000, 0, "free", 0); + (*zerror)((char *)0xf000f000, 0, "free", 0); #else - (*zerror)((char *)0xf000f000, 0); + (*zerror)((char *)0xf000f000, 0); #endif - } + } zinsert(zavailable, i); zavailable[i].start = start; zavailable[i].size = tsize; return; } } - - if (++availableNodes > totalNodes) { - if (zerror) + + if (++availableNodes > totalNodes) { + if (zerror) #ifdef SAFE_MALLOC - (*zerror)((char *)0xf000f000, 1, "free", 0); + (*zerror)((char *)0xf000f000, 1, "free", 0); #else - (*zerror)((char *)0xf000f000, 1); + (*zerror)((char *)0xf000f000, 1); #endif - } + } zavailable[i].start = start; zavailable[i].size = tsize; zcoalesce(); @@ -325,13 +337,13 @@ zalloced[allocedNodes].start = start; zalloced[allocedNodes].size = size; if (++allocedNodes > totalNodes) { - if (zerror) + if (zerror) #ifdef SAFE_MALLOC - (*zerror)((char *)0xf000f000, 2, "zallocate", 0); + (*zerror)((char *)0xf000f000, 2, "zallocate", 0); #else - (*zerror)((char *)0xf000f000, 2); + (*zerror)((char *)0xf000f000, 2); #endif - }; + }; } static void @@ -339,14 +351,14 @@ { int i; zmem *z1, *z2; - + i = totalNodes-2; z1 = zp + i; z2 = z1 + 1; - + for (; i >= ndx; i--, z1--, z2--) { - *z2 = *z1; + *z2 = *z1; } } @@ -355,13 +367,13 @@ { int i; zmem *z1, *z2; - + z1 = zp + ndx; z2 = z1 + 1; - + for (i = ndx; i < totalNodes-1; i++, z1++, z2++) { - *z1 = *z2; + *z1 = *z2; } } @@ -369,11 +381,11 @@ zcoalesce(void) { int i; - + for (i = 0; i < availableNodes-1; i++) { if ( zavailable[i].start + zavailable[i].size == - zavailable[i+1].start ) + zavailable[i+1].start ) { zavailable[i].size += zavailable[i+1].size; zdelete(zavailable, i+1); availableNodes--; Index: branches/cparm/i386/libsa/prf.c =================================================================== --- branches/cparm/i386/libsa/prf.c (revision 1803) +++ branches/cparm/i386/libsa/prf.c (revision 1804) @@ -58,22 +58,22 @@ */ static void printn(n, b, flag, minwidth, putfn_p, putfn_arg) - u_long n; - int b, flag, minwidth; - void (*putfn_p)(); - void *putfn_arg; +u_long n; +int b, flag, minwidth; +void (*putfn_p)(); +void *putfn_arg; { char prbuf[11]; register char *cp; int width = 0, neg = 0; - + if (b == 10 && (int)n < 0) { neg = 1; n = (unsigned)(-(int)n); } cp = prbuf; do { - *cp++ = "0123456789abcdef0123456789ABCDEF"[(flag & UCASE) + n%b]; + *cp++ = "0123456789abcdef0123456789ABCDEF"[(flag & UCASE) + n%b]; n /= b; width++; } while (n); @@ -84,86 +84,163 @@ } while (width++ < minwidth) (*putfn_p)( (flag & ZERO) ? '0' : ' ', putfn_arg); - + do (*putfn_p)(*--cp, putfn_arg); while (cp > prbuf); } void prf( - char *fmt, - unsigned int *adx, - void (*putfn_p)(), - void *putfn_arg -) + char *fmt, + unsigned int *adx, + void (*putfn_p)(), + void *putfn_arg + ) { int b, c; char *s; int flag = 0, width = 0; - int minwidth; - + int minwidth; + loop: while ((c = *fmt++) != '%') { if(c == '\0') return; (*putfn_p)(c, putfn_arg); } - minwidth = 0; + minwidth = 0; again: c = *fmt++; switch (c) { - case 'l': - goto again; - case ' ': - flag |= SPACE; - goto again; - case '0': - if (minwidth == 0) { - /* this is a flag */ - flag |= ZERO; - goto again; - } /* fall through */ - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - minwidth *= 10; - minwidth += c - '0'; - goto again; + case 'l': + goto again; + case ' ': + flag |= SPACE; + goto again; + case '0': + if (minwidth == 0) { + /* this is a flag */ + flag |= ZERO; + goto again; + } /* fall through */ + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + minwidth *= 10; + minwidth += c - '0'; + goto again; case 'X': - flag |= UCASE; - /* fall through */ - case 'x': - b = 16; - goto number; - case 'd': - b = 10; - goto number; - case 'o': case 'O': - b = 8; -number: - printn((u_long)*adx, b, flag, minwidth, putfn_p, putfn_arg); - break; - case 's': - s = (char *)*adx; - while ((c = *s++)) { - (*putfn_p)(c, putfn_arg); - width++; - } - while (width++ < minwidth) - (*putfn_p)(' ', putfn_arg); - break; - case 'c': - (*putfn_p)((char)*adx, putfn_arg); - break; - default: + flag |= UCASE; + /* fall through */ + case 'x': + b = 16; + goto number; + case 'd': + b = 10; + goto number; + case 'o': case 'O': + b = 8; + number: + printn((u_long)*adx, b, flag, minwidth, putfn_p, putfn_arg); break; + case 's': + s = (char *)*adx; + while ((c = *s++)) { + (*putfn_p)(c, putfn_arg); + width++; + } + while (width++ < minwidth) + (*putfn_p)(' ', putfn_arg); + break; + case 'c': + (*putfn_p)((char)*adx, putfn_arg); + break; + default: + break; } adx++; goto loop; } + +int prf_fmt_str_len( + char *fmt, + unsigned int *adx + ) +{ + + int b, c, len =0; + char *s; + int flag = 0, width = 0; + int minwidth; + +loop: + while ((c = *fmt++) != '%') { + if(c == '\0') + return len; + len++; + } + minwidth = 0; +again: + c = *fmt++; + switch (c) { + case 'l': + goto again; + case ' ': + flag |= SPACE; + goto again; + case '0': + if (minwidth == 0) { + /* this is a flag */ + flag |= ZERO; + goto again; + } /* fall through */ + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + minwidth *= 10; + minwidth += c - '0'; + goto again; + case 'X': + flag |= UCASE; + /* fall through */ + case 'x': + b = 16; + goto number; + case 'd': + b = 10; + goto number; + case 'o': case 'O': + b = 8; + number: + len++; + break; + case 's': + s = (char *)*adx; + while ((c = *s++)) { + len++; + width++; + } + while (width++ < minwidth) + len++; + break; + case 'c': + len++; + break; + default: + break; + } + adx++; + goto loop; +} Index: branches/cparm/i386/libsa/strtol.c =================================================================== --- branches/cparm/i386/libsa/strtol.c (revision 1803) +++ branches/cparm/i386/libsa/strtol.c (revision 1804) @@ -66,7 +66,7 @@ * Added support for "0b101..." binary constants. * Commented out references to errno. */ - + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91"; #endif /* LIBC_SCCS and not lint */ @@ -81,17 +81,14 @@ * alphabets and digits are each contiguous. */ long -strtol(nptr, endptr, base) - const char *nptr; - char **endptr; - register int base; +strtol(const char *nptr, char **endptr, int base) { register const char *s = nptr; register unsigned long acc; register int c; register unsigned long cutoff; register int neg = 0, any, cutlim; - + /* * Skip white space and pick up leading +/- sign if any. * If base is 0, allow 0x for hex and 0 for octal, else @@ -111,14 +108,14 @@ s += 2; base = 16; } else if ((base == 0 || base == 2) && - c == '0' && (*s == 'b' || *s == 'B')) { + c == '0' && (*s == 'b' || *s == 'B')) { c = s[1]; s += 2; base = 2; } if (base == 0) base = c == '0' ? 8 : 10; - + /* * Compute the cutoff value between legal numbers and illegal * numbers. That is the largest legal value, divided by the @@ -148,7 +145,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim) ) any = -1; else { any = 1; @@ -158,11 +155,20 @@ } if (any < 0) { acc = neg ? LONG_MIN : LONG_MAX; -// errno = ERANGE; + // errno = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) - *endptr = (char *)(any ? s - 1 : nptr); + { + if(any) + { + *endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *); + } + else + { + *endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *); + } + } return (acc); } @@ -174,17 +180,14 @@ * alphabets and digits are each contiguous. */ unsigned long -strtoul(nptr, endptr, base) - const char *nptr; - char **endptr; - register int base; +strtoul(const char *nptr, char **endptr, int base) { register const char *s = nptr; register unsigned long acc; register int c; register unsigned long cutoff; register int neg = 0, any, cutlim; - + /* * See strtol for comments as to the logic used. */ @@ -202,7 +205,7 @@ s += 2; base = 16; } else if ((base == 0 || base == 2) && - c == '0' && (*s == 'b' || *s == 'B')) { + c == '0' && (*s == 'b' || *s == 'B')) { c = s[1]; s += 2; base = 2; @@ -220,7 +223,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim) ) any = -1; else { any = 1; @@ -230,11 +233,21 @@ } if (any < 0) { acc = ULONG_MAX; -// errno = ERANGE; + // errno = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) - *endptr = (char *)(any ? s - 1 : nptr); + { + if(any) + { + *endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *); + } + else + { + *endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *); + } + } + return (acc); } @@ -245,17 +258,16 @@ * alphabets and digits are each contiguous. */ unsigned long long -strtouq(nptr, endptr, base) - const char *nptr; - char **endptr; - register int base; +strtouq(const char *nptr, + char **endptr, + register int base) { register const char *s = nptr; register unsigned long long acc; register int c; register unsigned long long qbase, cutoff; register int neg, any, cutlim; - + /* * See strtoq for comments as to the logic used. */ @@ -301,10 +313,20 @@ } if (any < 0) { acc = UQUAD_MAX; -// errno = ERANGE; + // errno = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) - *endptr = (char *)(any ? s - 1 : nptr); + { + if(any) + { + *endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *); + } + else + { + *endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *); + } + } + return (acc); } Index: branches/cparm/i386/libsa/bcopy.s =================================================================== --- branches/cparm/i386/libsa/bcopy.s (revision 0) +++ branches/cparm/i386/libsa/bcopy.s (revision 1804) @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * @OSF_COPYRIGHT@ + */ +/* + * Mach Operating System + * Copyright (c) 1991,1990 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + */ + +#include + +/* void *memcpy((void *) to, (const void *) from, (size_t) bcount) */ + +LABEL(_memcpy) + pushl %edi + pushl %esi + movl 8+ 4(%esp),%edi /* to */ + movl %edi,%eax /* returns its first argument */ + movl 8+ 8(%esp),%esi /* from */ +memcpy_common: + movl 8+ 12(%esp),%edx /* number of bytes */ + cld +/* move longs*/ + movl %edx,%ecx + shrl $2,%ecx + rep + movsl +/* move bytes*/ + movl %edx,%ecx + andl $3,%ecx + rep + movsb + popl %esi + popl %edi + ret + +/* void bcopy((const char *) from, (char *) to, (unsigned int) count) */ + +LABEL(_bcopy_no_overwrite) + pushl %edi + pushl %esi + movl 8+ 8(%esp),%edi /* to */ + movl 8+ 4(%esp),%esi /* from */ + jmp memcpy_common + +/* bcopy16(from, to, bcount) using word moves */ + +LABEL(_bcopy16) + pushl %edi + pushl %esi + movl 8+12(%esp),%edx /* 8 for the two pushes above */ + movl 8+ 8(%esp),%edi + movl 8+ 4(%esp),%esi +/* move words */ +0: cld + movl %edx,%ecx + shrl $1,%ecx + rep + movsw +/* move bytes */ + movl %edx,%ecx + andl $1,%ecx + rep + movsb + popl %esi + popl %edi + ret + + + /* + * Based on NetBSD's bcopy.S from their libc. + * bcopy(src, dst, cnt) + * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 + */ +LABEL(_bcopy) + pushl %esi + pushl %edi + movl 12(%esp),%esi + movl 16(%esp),%edi + movl 20(%esp),%ecx + + movl %edi,%edx + subl %esi,%edx + cmpl %ecx,%edx /* overlapping && src < dst? */ + movl %ecx,%edx + jb 1f + + shrl $2,%ecx /* copy by 32-bit words */ + cld /* nope, copy forwards */ + rep + movsl + movl %edx,%ecx + andl $3,%ecx /* any bytes left? */ + rep + movsb + popl %edi + popl %esi + ret + + +1: + addl %ecx,%edi /* copy backwards */ + addl %ecx,%esi + decl %edi + decl %esi + andl $3,%ecx /* any fractional bytes? */ + std + rep + movsb + movl %edx,%ecx /* copy remainder by 32-bit words */ + shrl $2,%ecx + subl $3,%esi + subl $3,%edi + rep + movsl + popl %edi + popl %esi + cld + ret Index: branches/cparm/i386/libsa/Makefile =================================================================== --- branches/cparm/i386/libsa/Makefile (revision 1803) +++ branches/cparm/i386/libsa/Makefile (revision 1804) @@ -8,9 +8,9 @@ INSTALL_MD_DIR = $(DSTROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/machdep/i386 OPTIM = -Os -Oz -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \ +CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror -fstack-protector-all \ -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -mpreferred-stack-boundary=2 -fno-align-functions \ -march=pentium4 -msse2 -mfpmath=sse -msoft-float INC = -I. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSAIODIR) @@ -26,13 +26,12 @@ VPATH = $(OBJROOT):$(SYMROOT) -SA_OBJS = prf.o printf.o zalloc.o\ - string.o strtol.o error.o \ +SA_OBJS = qdivrem.o umoddi3.o udivdi3.o divdi3.o moddi3.o bzero.o bcopy.o prf.o printf.o zalloc.o\ + string.o strtol.o \ setjmp.o qsort.o efi_tables.o - -SFILES = setjmp.s -CFILES = prf.c printf.c zalloc.c \ +SFILES = setjmp.s bzero.s bcopy.s +CFILES = qdivrem.c umoddi3.c udivdi3.c divdi3.c moddi3.c prf.c printf.c zalloc.c \ string.c strtol.c error.c \ qsort.c efi_tables.c Index: branches/cparm/i386/util/Symbols.c =================================================================== --- branches/cparm/i386/util/Symbols.c (revision 1803) +++ branches/cparm/i386/util/Symbols.c (revision 1804) @@ -12,13 +12,11 @@ #include "Symbols.h" -static int strcmp(const char * s1, const char * s2); - void Symbols_start() { } -unsigned int lookup_symbol(const char* symbol) +unsigned int lookup_symbol(const char* symbol, int(*strcmp)(const char*, const char*)) { int upperLimit = sizeof(symbolList) / sizeof(symbolList[0]) - 1; int lowerLimit = 0; @@ -55,17 +53,26 @@ return symbolList[compareIndex].addr; } -/* - * strcmp - Copied from libsa/string.c due to symbols not able to be resolved at this point - */ -static int strcmp(const char * s1, const char * s2) -{ - while (*s1 && (*s1 == *s2)) { - s1++; - s2++; - } - return (*s1 - *s2); -} +#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) +long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static void __guard_setup(void) __attribute__((constructor)); +void __stack_chk_fail(void); + +static void +__guard_setup(void) +{ + /* Here the protector switches the guard + to the "terminator canary", and cannot report failure */ + ((char*)__stack_chk_guard)[0] = 0; ((char*)__stack_chk_guard)[1] = 0; + ((char*)__stack_chk_guard)[2] = '\n'; ((char*)__stack_chk_guard)[3] = 255; + +} + +void +__stack_chk_fail() +{ + for(;;); +} \ No newline at end of file Index: branches/cparm/i386/util/Makefile =================================================================== --- branches/cparm/i386/util/Makefile (revision 1803) +++ branches/cparm/i386/util/Makefile (revision 1804) @@ -18,7 +18,7 @@ CFILES = machOconv.c ALLSRC = $(CFILES) $(MFILES) $(HFILES) $(EXPORT_HFILES) -PROGRAMS = machOconv bdmesg +PROGRAMS = machOconv bdmesg amlsgn OUTFILES = $(PROGRAMS)