From 14c7c974991c850bfa0348affbd4bee3223205ee Mon Sep 17 00:00:00 2001 From: Apple Date: Tue, 23 Jan 2001 08:15:39 +0000 Subject: [PATCH] boot-80.1.tar.gz --- APPLE_LICENSE | 372 + Makefile | 66 + dpkg/control | 4 + gen/MakeInc.dir | 43 + gen/MakePaths.dir | 9 + gen/Makefile | 49 + gen/libsa/Makefile | 42 + gen/libsa/bsearch.c | 48 + gen/libsa/ctype.h | 33 + gen/libsa/error.c | 35 + gen/libsa/fontio.h | 51 + gen/libsa/getsegbyname.c | 54 + gen/libsa/io_inline.h | 116 + gen/libsa/kernBootStruct.h | 32 + gen/libsa/keys.h | 27 + gen/libsa/libsa.h | 115 + gen/libsa/mach.c | 100 + gen/libsa/malloc.c.00 | 37 + gen/libsa/memcpy.c | 74 + gen/libsa/memory.h | 69 + gen/libsa/memset.c | 151 + gen/libsa/prf.c | 161 + gen/libsa/setjmp.s | 57 + gen/libsa/sprintf.c | 74 + gen/libsa/string1.c | 134 + gen/libsa/string2.c | 74 + gen/libsa/strtol.c | 257 + gen/libsa/zalloc.c | 246 + gen/libsa/zalloc.h | 26 + gen/libsaio/cache.c | 94 + gen/libsaio/cache.h | 51 + gen/libsaio/disk.c | 300 + gen/libsaio/errorV.c | 45 + gen/libsaio/gets.c | 120 + gen/libsaio/localPrintf.c | 57 + gen/libsaio/localVPrintf.c | 52 + gen/libsaio/printf.c | 39 + gen/libsaio/reallyPrint.c | 46 + gen/libsaio/stringTable.c | 570 ++ gen/libsaio/sys.c | 861 ++ gen/libsaio/table.c | 86 + gen/libsaio/ufs_byteorder.c | 242 + gen/libsaio/ufs_byteorder.h | 49 + gen/libsaio/unpackbits.c | 104 + gen/rcz/Makefile | 51 + gen/rcz/README | 11 + gen/rcz/rcz.c | 178 + gen/rcz/rcz_common.c | 31 + gen/rcz/rcz_common.h | 37 + gen/rcz/rcz_compress_mem.c | 130 + gen/rcz/rcz_compress_mem.h | 34 + gen/rcz/rcz_decompress_file.c | 163 + gen/rcz/rcz_decompress_file.h | 38 + gen/rcz/rcz_decompress_mem.c | 102 + gen/rcz/rcz_decompress_mem.h | 28 + gen/util/Makefile | 94 + gen/util/machOconv.c | 156 + i386/MakeInc.dir | 50 + i386/MakePaths.dir | 9 + i386/Makefile | 49 + i386/boot0/Makefile | 21 + i386/boot0/boot0.s | 567 ++ i386/boot1/Makefile | 31 + i386/boot1/boot1 | Bin 0 -> 512 bytes i386/boot1/boot1.asm | 386 + i386/boot1/boot1.s | 600 ++ i386/boot1/boot1f | Bin 0 -> 512 bytes i386/boot1/gonext.c | 113 + i386/boot1/gonext.com | Bin 0 -> 7152 bytes i386/boot1/makefile.dos | 25 + i386/boot1/mkboot.bat | 17 + i386/boot1/nullboot1 | Bin 0 -> 512 bytes i386/boot1/nullboot1.asm | 108 + i386/boot1/nullboot1.s | 121 + i386/boot1/replace.c | 151 + i386/boot2/Makefile | 80 + i386/boot2/boot.c | 586 ++ i386/boot2/boot.h | 83 + i386/boot2/boot2.s | 98 + i386/boot2/graphics.c | 221 + i386/boot2/old/Language.table | 8 + i386/boot2/old/browser.c | 388 + i386/boot2/old/browser.h | 68 + i386/boot2/old/button.c | 88 + i386/boot2/old/button.h | 50 + i386/boot2/old/questionbox.c | 120 + i386/boot2/old/scanmemory.c | 395 + i386/boot2/old/scanmemory.sed | 6 + i386/boot2/old/scrollbar.c | 89 + i386/boot2/old/scrollbar.h | 36 + i386/boot2/old/sizememory.c | 73 + i386/boot2/old/start.s | 31 + i386/boot2/old/test | Bin 0 -> 50652 bytes i386/boot2/old/test.c | 35 + i386/boot2/prompt.c | 32 + i386/doc/Limits | 11 + i386/doc/README | 173 + i386/libsa/Makefile | 63 + i386/libsa/error.c | 35 + i386/libsa/kernBootStruct.h | 191 + i386/libsa/libsa.h | 110 + i386/libsa/memory.h | 83 + i386/libsa/prf.c | 161 + i386/libsa/printf.c | 72 + i386/libsa/qsort.c | 194 + i386/libsa/setjmp.s | 58 + i386/libsa/string.c | 161 + i386/libsa/strtol.c | 270 + i386/libsa/zalloc.c | 249 + i386/libsaio/Makefile | 81 + i386/libsaio/appleClut8.h | 102 + i386/libsaio/asm.s | 376 + i386/libsaio/bios.h | 73 + i386/libsaio/bios.s | 251 + i386/libsaio/biosfn.c | 445 + i386/libsaio/bootstruct.c | 116 + i386/libsaio/cache.c | 94 + i386/libsaio/cache.h | 56 + i386/libsaio/console.c | 125 + i386/libsaio/disk.c | 498 + i386/libsaio/drivers.h | 51 + i386/libsaio/gets.c | 115 + i386/libsaio/io_inline.h | 82 + i386/libsaio/legacy/PCI.h | 54 + i386/libsaio/legacy/asm.h | 101 + i386/libsaio/legacy/configTablePrivate.h | 30 + i386/libsaio/legacy/disk.h | 137 + i386/libsaio/legacy/fdisk.h | 51 + i386/libsaio/libsaio.h | 34 + i386/libsaio/load.c | 319 + i386/libsaio/misc.c | 121 + i386/libsaio/nbp.c | 78 + i386/libsaio/nbp.h | 59 + i386/libsaio/nbp_cmd.h | 86 + i386/libsaio/old/bios_old.s | 610 ++ i386/libsaio/old/shmalloc.c | 29 + i386/libsaio/old/stringTable.h.00 | 52 + i386/libsaio/old/stringTableNew.c | 564 ++ i386/libsaio/pci.c | 291 + i386/libsaio/pci.h | 41 + i386/libsaio/saio.h | 142 + i386/libsaio/saio_internal.h | 165 + i386/libsaio/saio_types.h | 58 + i386/libsaio/stringConstants.h | 38 + i386/libsaio/stringTable.c | 759 ++ i386/libsaio/sys.c | 1376 +++ i386/libsaio/table.c | 86 + i386/libsaio/ufs_byteorder.c | 247 + i386/libsaio/ufs_byteorder.h | 58 + i386/libsaio/vbe.c | 296 + i386/libsaio/vbe.h | 241 + i386/libsaio/vga.c | 289 + i386/libsaio/vga.h | 67 + i386/nasm/Makefile | 83 + i386/nasm/assemble.c | 1196 +++ i386/nasm/assemble.h | 41 + i386/nasm/disasm.c | 709 ++ i386/nasm/disasm.h | 41 + i386/nasm/doc/Licence | 98 + i386/nasm/doc/nasmdoc.txt | 8241 +++++++++++++++++ i386/nasm/eval.c | 784 ++ i386/nasm/eval.h | 57 + i386/nasm/float.c | 416 + i386/nasm/float.h | 39 + i386/nasm/insns.dat | 1039 +++ i386/nasm/insns.h | 89 + i386/nasm/insns.pl | 162 + i386/nasm/insnsa.c | 2716 ++++++ i386/nasm/insnsd.c | 3438 +++++++ i386/nasm/labels.c | 340 + i386/nasm/labels.h | 41 + i386/nasm/listing.c | 263 + i386/nasm/listing.h | 37 + i386/nasm/macros.c | 96 + i386/nasm/macros.pl | 28 + i386/nasm/names.c | 107 + i386/nasm/nasm.1 | 423 + i386/nasm/nasm.c | 1130 +++ i386/nasm/nasm.h | 773 ++ i386/nasm/nasmlib.c | 989 ++ i386/nasm/nasmlib.h | 195 + i386/nasm/ndisasm.1 | 117 + i386/nasm/ndisasm.c | 301 + i386/nasm/outaout.c | 919 ++ i386/nasm/outas86.c | 582 ++ i386/nasm/outbin.c | 386 + i386/nasm/outcoff.c | 755 ++ i386/nasm/outdbg.c | 189 + i386/nasm/outelf.c | 1067 +++ i386/nasm/outform.c | 65 + i386/nasm/outform.h | 199 + i386/nasm/outobj.c | 1794 ++++ i386/nasm/outrdf.c | 539 ++ i386/nasm/parser.c | 657 ++ i386/nasm/parser.h | 40 + i386/nasm/preproc.c | 3024 ++++++ i386/nasm/preproc.h | 42 + i386/nasm/standard.mac | 86 + i386/nasm/sync.c | 132 + i386/nasm/sync.h | 39 + i386/rcz/Makefile | 55 + i386/rcz/rcz_common.c | 31 + i386/rcz/rcz_common.h | 37 + i386/rcz/rcz_compress_file.c | 129 + i386/rcz/rcz_compress_file.h | 34 + i386/rcz/rcz_compress_mem.c | 130 + i386/rcz/rcz_compress_mem.h | 34 + i386/rcz/rcz_decompress_file.c | 163 + i386/rcz/rcz_decompress_file.h | 38 + i386/rcz/rcz_decompress_mem.c | 102 + i386/rcz/rcz_decompress_mem.h | 28 + i386/sarld/Makefile | 38 + i386/strings/BootHelp.txt | 19 + .../strings/English.lproj/Localizable.strings | 126 + i386/strings/English.lproj/NetInstall.strings | 126 + i386/strings/French.lproj/Localizable.strings | 78 + i386/strings/French.lproj/NetInstall.strings | 78 + i386/strings/German.lproj/Localizable.strings | 79 + i386/strings/German.lproj/NetInstall.strings | 79 + .../strings/Italian.lproj/Localizable.strings | 79 + i386/strings/Italian.lproj/NetInstall.strings | 79 + i386/strings/Language.table | 5 + i386/strings/Makefile | 45 + .../strings/Spanish.lproj/Localizable.strings | 79 + i386/strings/Spanish.lproj/NetInstall.strings | 79 + .../strings/Swedish.lproj/Localizable.strings | 78 + i386/strings/Swedish.lproj/NetInstall.strings | 78 + i386/testmodule/Makefile | 79 + i386/testmodule/install.def | 9 + i386/testmodule/install/Makefile | 77 + i386/testmodule/install/install.def | 9 + i386/testmodule/install/install.h | 30 + i386/testmodule/install/install.module | Bin 0 -> 89492 bytes i386/testmodule/install/mode.c | 95 + i386/testmodule/test.c | 45 + i386/testmodule/test.def | 3 + i386/testmodule/test.h | 33 + i386/testmodule/test.module | Bin 0 -> 46472 bytes i386/tests/Makefile | 14 + i386/tests/bootHelper.c | 58 + i386/tests/rldtest.c | 259 + i386/tests/satest.c | 110 + i386/tests/sizeof | Bin 0 -> 50036 bytes i386/tests/sizeof.c | 32 + i386/util/12.Charcoal | 3484 +++++++ i386/util/BooterBitmap.h | 70 + i386/util/BooterBitmap.m | 363 + i386/util/Default.font | Bin 0 -> 1387 bytes i386/util/FontBitmap.h | 231 + i386/util/Makefile | 96 + i386/util/Newpanel.image | Bin 0 -> 93224 bytes i386/util/Panel.image | Bin 0 -> 5584 bytes i386/util/Wait1.image | Bin 0 -> 88 bytes i386/util/Wait2.image | Bin 0 -> 88 bytes i386/util/Wait3.image | Bin 0 -> 88 bytes i386/util/bitmap.h | 49 + i386/util/cursor.h | 102 + i386/util/dot.h | 27 + i386/util/dot.tiff | Bin 0 -> 226 bytes i386/util/dot_bitmap.h | 50 + i386/util/dumptiff | Bin 0 -> 35844 bytes i386/util/dumptiff.m | 146 + i386/util/font.h | 69 + i386/util/hdot.h | 27 + i386/util/hdot_bitmap.h | 50 + i386/util/images.h | 5912 ++++++++++++ i386/util/machOconv.c | 156 + i386/util/mkfont.c | 581 ++ i386/util/ns_box.h | 27 + i386/util/ns_box.tiff | Bin 0 -> 23406 bytes i386/util/ns_box_bitmap.h | 397 + i386/util/ns_logo.h | 27 + i386/util/ns_logo.tiff | Bin 0 -> 750 bytes i386/util/ns_logo_bitmap.h | 102 + i386/util/ns_wait1.h | 27 + i386/util/ns_wait1.image | Bin 0 -> 88 bytes i386/util/ns_wait1_bitmap.h | 54 + i386/util/ns_wait2.h | 27 + i386/util/ns_wait2.image | Bin 0 -> 88 bytes i386/util/ns_wait2_bitmap.h | 54 + i386/util/ns_wait3.h | 27 + i386/util/ns_wait3.image | Bin 0 -> 88 bytes i386/util/ns_wait3_bitmap.h | 54 + i386/util/return.h | 27 + i386/util/return.tiff | Bin 0 -> 214 bytes i386/util/return_bitmap.h | 52 + i386/util/sig.c | 336 + i386/util/spin_cursor.h | 122 + i386/util/test.c | 31 + i386/util/test.def | 2 + i386/util/tif_packbits.c | 198 + 291 files changed, 72095 insertions(+) create mode 100644 APPLE_LICENSE create mode 100644 Makefile create mode 100644 dpkg/control create mode 100644 gen/MakeInc.dir create mode 100644 gen/MakePaths.dir create mode 100644 gen/Makefile create mode 100644 gen/libsa/Makefile create mode 100644 gen/libsa/bsearch.c create mode 100644 gen/libsa/ctype.h create mode 100644 gen/libsa/error.c create mode 100644 gen/libsa/fontio.h create mode 100644 gen/libsa/getsegbyname.c create mode 100644 gen/libsa/io_inline.h create mode 100644 gen/libsa/kernBootStruct.h create mode 100644 gen/libsa/keys.h create mode 100644 gen/libsa/libsa.h create mode 100644 gen/libsa/mach.c create mode 100644 gen/libsa/malloc.c.00 create mode 100644 gen/libsa/memcpy.c create mode 100644 gen/libsa/memory.h create mode 100644 gen/libsa/memset.c create mode 100644 gen/libsa/prf.c create mode 100644 gen/libsa/setjmp.s create mode 100644 gen/libsa/sprintf.c create mode 100644 gen/libsa/string1.c create mode 100644 gen/libsa/string2.c create mode 100644 gen/libsa/strtol.c create mode 100644 gen/libsa/zalloc.c create mode 100644 gen/libsa/zalloc.h create mode 100644 gen/libsaio/cache.c create mode 100644 gen/libsaio/cache.h create mode 100644 gen/libsaio/disk.c create mode 100644 gen/libsaio/errorV.c create mode 100644 gen/libsaio/gets.c create mode 100644 gen/libsaio/localPrintf.c create mode 100644 gen/libsaio/localVPrintf.c create mode 100644 gen/libsaio/printf.c create mode 100644 gen/libsaio/reallyPrint.c create mode 100644 gen/libsaio/stringTable.c create mode 100644 gen/libsaio/sys.c create mode 100644 gen/libsaio/table.c create mode 100644 gen/libsaio/ufs_byteorder.c create mode 100644 gen/libsaio/ufs_byteorder.h create mode 100644 gen/libsaio/unpackbits.c create mode 100644 gen/rcz/Makefile create mode 100644 gen/rcz/README create mode 100644 gen/rcz/rcz.c create mode 100644 gen/rcz/rcz_common.c create mode 100644 gen/rcz/rcz_common.h create mode 100644 gen/rcz/rcz_compress_mem.c create mode 100644 gen/rcz/rcz_compress_mem.h create mode 100644 gen/rcz/rcz_decompress_file.c create mode 100644 gen/rcz/rcz_decompress_file.h create mode 100644 gen/rcz/rcz_decompress_mem.c create mode 100644 gen/rcz/rcz_decompress_mem.h create mode 100644 gen/util/Makefile create mode 100644 gen/util/machOconv.c create mode 100644 i386/MakeInc.dir create mode 100644 i386/MakePaths.dir create mode 100644 i386/Makefile create mode 100644 i386/boot0/Makefile create mode 100644 i386/boot0/boot0.s create mode 100644 i386/boot1/Makefile create mode 100755 i386/boot1/boot1 create mode 100644 i386/boot1/boot1.asm create mode 100644 i386/boot1/boot1.s create mode 100755 i386/boot1/boot1f create mode 100644 i386/boot1/gonext.c create mode 100644 i386/boot1/gonext.com create mode 100644 i386/boot1/makefile.dos create mode 100755 i386/boot1/mkboot.bat create mode 100755 i386/boot1/nullboot1 create mode 100644 i386/boot1/nullboot1.asm create mode 100644 i386/boot1/nullboot1.s create mode 100644 i386/boot1/replace.c create mode 100644 i386/boot2/Makefile create mode 100644 i386/boot2/boot.c create mode 100644 i386/boot2/boot.h create mode 100644 i386/boot2/boot2.s create mode 100644 i386/boot2/graphics.c create mode 100644 i386/boot2/old/Language.table create mode 100644 i386/boot2/old/browser.c create mode 100644 i386/boot2/old/browser.h create mode 100644 i386/boot2/old/button.c create mode 100644 i386/boot2/old/button.h create mode 100644 i386/boot2/old/questionbox.c create mode 100644 i386/boot2/old/scanmemory.c create mode 100644 i386/boot2/old/scanmemory.sed create mode 100644 i386/boot2/old/scrollbar.c create mode 100644 i386/boot2/old/scrollbar.h create mode 100644 i386/boot2/old/sizememory.c create mode 100644 i386/boot2/old/start.s create mode 100755 i386/boot2/old/test create mode 100644 i386/boot2/old/test.c create mode 100644 i386/boot2/prompt.c create mode 100644 i386/doc/Limits create mode 100644 i386/doc/README create mode 100644 i386/libsa/Makefile create mode 100644 i386/libsa/error.c create mode 100644 i386/libsa/kernBootStruct.h create mode 100644 i386/libsa/libsa.h create mode 100644 i386/libsa/memory.h create mode 100644 i386/libsa/prf.c create mode 100644 i386/libsa/printf.c create mode 100644 i386/libsa/qsort.c create mode 100644 i386/libsa/setjmp.s create mode 100644 i386/libsa/string.c create mode 100644 i386/libsa/strtol.c create mode 100644 i386/libsa/zalloc.c create mode 100644 i386/libsaio/Makefile create mode 100644 i386/libsaio/appleClut8.h create mode 100644 i386/libsaio/asm.s create mode 100644 i386/libsaio/bios.h create mode 100644 i386/libsaio/bios.s create mode 100644 i386/libsaio/biosfn.c create mode 100644 i386/libsaio/bootstruct.c create mode 100644 i386/libsaio/cache.c create mode 100644 i386/libsaio/cache.h create mode 100644 i386/libsaio/console.c create mode 100644 i386/libsaio/disk.c create mode 100644 i386/libsaio/drivers.h create mode 100644 i386/libsaio/gets.c create mode 100644 i386/libsaio/io_inline.h create mode 100644 i386/libsaio/legacy/PCI.h create mode 100644 i386/libsaio/legacy/asm.h create mode 100644 i386/libsaio/legacy/configTablePrivate.h create mode 100644 i386/libsaio/legacy/disk.h create mode 100644 i386/libsaio/legacy/fdisk.h create mode 100644 i386/libsaio/libsaio.h create mode 100644 i386/libsaio/load.c create mode 100644 i386/libsaio/misc.c create mode 100644 i386/libsaio/nbp.c create mode 100644 i386/libsaio/nbp.h create mode 100644 i386/libsaio/nbp_cmd.h create mode 100644 i386/libsaio/old/bios_old.s create mode 100644 i386/libsaio/old/shmalloc.c create mode 100644 i386/libsaio/old/stringTable.h.00 create mode 100644 i386/libsaio/old/stringTableNew.c create mode 100644 i386/libsaio/pci.c create mode 100644 i386/libsaio/pci.h create mode 100644 i386/libsaio/saio.h create mode 100644 i386/libsaio/saio_internal.h create mode 100644 i386/libsaio/saio_types.h create mode 100644 i386/libsaio/stringConstants.h create mode 100644 i386/libsaio/stringTable.c create mode 100644 i386/libsaio/sys.c create mode 100644 i386/libsaio/table.c create mode 100644 i386/libsaio/ufs_byteorder.c create mode 100644 i386/libsaio/ufs_byteorder.h create mode 100644 i386/libsaio/vbe.c create mode 100644 i386/libsaio/vbe.h create mode 100644 i386/libsaio/vga.c create mode 100644 i386/libsaio/vga.h create mode 100644 i386/nasm/Makefile create mode 100644 i386/nasm/assemble.c create mode 100644 i386/nasm/assemble.h create mode 100644 i386/nasm/disasm.c create mode 100644 i386/nasm/disasm.h create mode 100644 i386/nasm/doc/Licence create mode 100644 i386/nasm/doc/nasmdoc.txt create mode 100644 i386/nasm/eval.c create mode 100644 i386/nasm/eval.h create mode 100644 i386/nasm/float.c create mode 100644 i386/nasm/float.h create mode 100644 i386/nasm/insns.dat create mode 100644 i386/nasm/insns.h create mode 100755 i386/nasm/insns.pl create mode 100644 i386/nasm/insnsa.c create mode 100644 i386/nasm/insnsd.c create mode 100644 i386/nasm/labels.c create mode 100644 i386/nasm/labels.h create mode 100644 i386/nasm/listing.c create mode 100644 i386/nasm/listing.h create mode 100644 i386/nasm/macros.c create mode 100755 i386/nasm/macros.pl create mode 100644 i386/nasm/names.c create mode 100644 i386/nasm/nasm.1 create mode 100644 i386/nasm/nasm.c create mode 100644 i386/nasm/nasm.h create mode 100644 i386/nasm/nasmlib.c create mode 100644 i386/nasm/nasmlib.h create mode 100644 i386/nasm/ndisasm.1 create mode 100644 i386/nasm/ndisasm.c create mode 100644 i386/nasm/outaout.c create mode 100644 i386/nasm/outas86.c create mode 100644 i386/nasm/outbin.c create mode 100644 i386/nasm/outcoff.c create mode 100644 i386/nasm/outdbg.c create mode 100644 i386/nasm/outelf.c create mode 100644 i386/nasm/outform.c create mode 100644 i386/nasm/outform.h create mode 100644 i386/nasm/outobj.c create mode 100644 i386/nasm/outrdf.c create mode 100644 i386/nasm/parser.c create mode 100644 i386/nasm/parser.h create mode 100644 i386/nasm/preproc.c create mode 100644 i386/nasm/preproc.h create mode 100644 i386/nasm/standard.mac create mode 100644 i386/nasm/sync.c create mode 100644 i386/nasm/sync.h create mode 100644 i386/rcz/Makefile create mode 100644 i386/rcz/rcz_common.c create mode 100644 i386/rcz/rcz_common.h create mode 100644 i386/rcz/rcz_compress_file.c create mode 100644 i386/rcz/rcz_compress_file.h create mode 100644 i386/rcz/rcz_compress_mem.c create mode 100644 i386/rcz/rcz_compress_mem.h create mode 100644 i386/rcz/rcz_decompress_file.c create mode 100644 i386/rcz/rcz_decompress_file.h create mode 100644 i386/rcz/rcz_decompress_mem.c create mode 100644 i386/rcz/rcz_decompress_mem.h create mode 100644 i386/sarld/Makefile create mode 100644 i386/strings/BootHelp.txt create mode 100644 i386/strings/English.lproj/Localizable.strings create mode 100644 i386/strings/English.lproj/NetInstall.strings create mode 100644 i386/strings/French.lproj/Localizable.strings create mode 100644 i386/strings/French.lproj/NetInstall.strings create mode 100644 i386/strings/German.lproj/Localizable.strings create mode 100644 i386/strings/German.lproj/NetInstall.strings create mode 100644 i386/strings/Italian.lproj/Localizable.strings create mode 100644 i386/strings/Italian.lproj/NetInstall.strings create mode 100644 i386/strings/Language.table create mode 100644 i386/strings/Makefile create mode 100644 i386/strings/Spanish.lproj/Localizable.strings create mode 100644 i386/strings/Spanish.lproj/NetInstall.strings create mode 100644 i386/strings/Swedish.lproj/Localizable.strings create mode 100644 i386/strings/Swedish.lproj/NetInstall.strings create mode 100644 i386/testmodule/Makefile create mode 100644 i386/testmodule/install.def create mode 100644 i386/testmodule/install/Makefile create mode 100644 i386/testmodule/install/install.def create mode 100644 i386/testmodule/install/install.h create mode 100755 i386/testmodule/install/install.module create mode 100644 i386/testmodule/install/mode.c create mode 100644 i386/testmodule/test.c create mode 100644 i386/testmodule/test.def create mode 100644 i386/testmodule/test.h create mode 100755 i386/testmodule/test.module create mode 100644 i386/tests/Makefile create mode 100644 i386/tests/bootHelper.c create mode 100644 i386/tests/rldtest.c create mode 100644 i386/tests/satest.c create mode 100755 i386/tests/sizeof create mode 100644 i386/tests/sizeof.c create mode 100644 i386/util/12.Charcoal create mode 100644 i386/util/BooterBitmap.h create mode 100644 i386/util/BooterBitmap.m create mode 100644 i386/util/Default.font create mode 100644 i386/util/FontBitmap.h create mode 100644 i386/util/Makefile create mode 100644 i386/util/Newpanel.image create mode 100644 i386/util/Panel.image create mode 100644 i386/util/Wait1.image create mode 100644 i386/util/Wait2.image create mode 100644 i386/util/Wait3.image create mode 100644 i386/util/bitmap.h create mode 100644 i386/util/cursor.h create mode 100644 i386/util/dot.h create mode 100644 i386/util/dot.tiff create mode 100644 i386/util/dot_bitmap.h create mode 100755 i386/util/dumptiff create mode 100644 i386/util/dumptiff.m create mode 100644 i386/util/font.h create mode 100644 i386/util/hdot.h create mode 100644 i386/util/hdot_bitmap.h create mode 100644 i386/util/images.h create mode 100644 i386/util/machOconv.c create mode 100644 i386/util/mkfont.c create mode 100644 i386/util/ns_box.h create mode 100644 i386/util/ns_box.tiff create mode 100644 i386/util/ns_box_bitmap.h create mode 100644 i386/util/ns_logo.h create mode 100644 i386/util/ns_logo.tiff create mode 100644 i386/util/ns_logo_bitmap.h create mode 100644 i386/util/ns_wait1.h create mode 100644 i386/util/ns_wait1.image create mode 100644 i386/util/ns_wait1_bitmap.h create mode 100644 i386/util/ns_wait2.h create mode 100644 i386/util/ns_wait2.image create mode 100644 i386/util/ns_wait2_bitmap.h create mode 100644 i386/util/ns_wait3.h create mode 100644 i386/util/ns_wait3.image create mode 100644 i386/util/ns_wait3_bitmap.h create mode 100644 i386/util/return.h create mode 100644 i386/util/return.tiff create mode 100644 i386/util/return_bitmap.h create mode 100644 i386/util/sig.c create mode 100644 i386/util/spin_cursor.h create mode 100644 i386/util/test.c create mode 100644 i386/util/test.def create mode 100644 i386/util/tif_packbits.c diff --git a/APPLE_LICENSE b/APPLE_LICENSE new file mode 100644 index 0000000..84687a4 --- /dev/null +++ b/APPLE_LICENSE @@ -0,0 +1,372 @@ +APPLE PUBLIC SOURCE LICENSE +Version 1.1 - April 19,1999 + +Please read this License carefully before downloading this software. +By downloading and using this software, you are agreeing to be bound +by the terms of this License. If you do not or cannot agree to the +terms of this License, please do not download or use the software. + +1. General; Definitions. This License applies to any program or other +work which Apple Computer, Inc. ("Apple") publicly announces as +subject to this Apple Public Source License and which contains a +notice placed by Apple identifying such program or work as "Original +Code" and stating that it is subject to the terms of this Apple Public +Source License version 1.1 (or subsequent version thereof), as it may +be revised from time to time by Apple ("License"). As used in this +License: + +1.1 "Affected Original Code" means only those specific portions of +Original Code that allegedly infringe upon any party's intellectual +property rights or are otherwise the subject of a claim of +infringement. + +1.2 "Applicable Patent Rights" mean: (a) in the case where Apple is +the grantor of rights, (i) claims of patents that are now or hereafter +acquired, owned by or assigned to Apple and (ii) that cover subject +matter contained in the Original Code, but only to the extent +necessary to use, reproduce and/or distribute the Original Code +without infringement; and (b) in the case where You are the grantor of +rights, (i) claims of patents that are now or hereafter acquired, +owned by or assigned to You and (ii) that cover subject matter in Your +Modifications, taken alone or in combination with Original Code. + +1.3 "Covered Code" means the Original Code, Modifications, the +combination of Original Code and any Modifications, and/or any +respective portions thereof. + +1.4 "Deploy" means to use, sublicense or distribute Covered Code other +than for Your internal research and development (R&D), and includes +without limitation, any and all internal use or distribution of +Covered Code within Your business or organization except for R&D use, +as well as direct or indirect sublicensing or distribution of Covered +Code by You to any third party in any form or manner. + +1.5 "Larger Work" means a work which combines Covered Code or portions +thereof with code not governed by the terms of this License. + +1.6 "Modifications" mean any addition to, deletion from, and/or change +to, the substance and/or structure of Covered Code. When code is +released as a series of files, a Modification is: (a) any addition to +or deletion from the contents of a file containing Covered Code; +and/or (b) any new file or other representation of computer program +statements that contains any part of Covered Code. + +1.7 "Original Code" means (a) the Source Code of a program or other +work as originally made available by Apple under this License, +including the Source Code of any updates or upgrades to such programs +or works made available by Apple under this License, and that has been +expressly identified by Apple as such in the header file(s) of such +work; and (b) the object code compiled from such Source Code and +originally made available by Apple under this License. + +1.8 "Source Code" means the human readable form of a program or other +work that is suitable for making modifications to it, including all +modules it contains, plus any associated interface definition files, +scripts used to control compilation and installation of an executable +(object code). + +1.9 "You" or "Your" means an individual or a legal entity exercising +rights under this License. For legal entities, "You" or "Your" +includes any entity which controls, is controlled by, or is under +common control with, You, where "control" means (a) the power, direct +or indirect, to cause the direction or management of such entity, +whether by contract or otherwise, or (b) ownership of fifty percent +(50%) or more of the outstanding shares or beneficial ownership of +such entity. + +2. Permitted Uses; Conditions & Restrictions. Subject to the terms +and conditions of this License, Apple hereby grants You, effective on +the date You accept this License and download the Original Code, a +world-wide, royalty-free, non- exclusive license, to the extent of +Apple's Applicable Patent Rights and copyrights covering the Original +Code, to do the following: + +2.1 You may use, copy, modify and distribute Original Code, with or +without Modifications, solely for Your internal research and +development, provided that You must in each instance: + +(a) retain and reproduce in all copies of Original Code the copyright +and other proprietary notices and disclaimers of Apple as they appear +in the Original Code, and keep intact all notices in the Original Code +that refer to this License; + +(b) include a copy of this License with every copy of Source Code of +Covered Code and documentation You distribute, and You may not offer +or impose any terms on such Source Code that alter or restrict this +License or the recipients' rights hereunder, except as permitted under +Section 6; and + +(c) completely and accurately document all Modifications that you have +made and the date of each such Modification, designate the version of +the Original Code you used, prominently include a file carrying such +information with the Modifications, and duplicate the notice in +Exhibit A in each file of the Source Code of all such Modifications. + +2.2 You may Deploy Covered Code, provided that You must in each + instance: + +(a) satisfy all the conditions of Section 2.1 with respect to the +Source Code of the Covered Code; + +(b) make all Your Deployed Modifications publicly available in Source +Code form via electronic distribution (e.g. download from a web site) +under the terms of this License and subject to the license grants set +forth in Section 3 below, and any additional terms You may choose to +offer under Section 6. You must continue to make the Source Code of +Your Deployed Modifications available for as long as you Deploy the +Covered Code or twelve (12) months from the date of initial +Deployment, whichever is longer; + +(c) if You Deploy Covered Code containing Modifications made by You, +inform others of how to obtain those Modifications by filling out and +submitting the information found at +http://www.apple.com/publicsource/modifications.html, if available; +and + +(d) if You Deploy Covered Code in object code, executable form only, +include a prominent notice, in the code itself as well as in related +documentation, stating that Source Code of the Covered Code is +available under the terms of this License with information on how and +where to obtain such Source Code. + +3. Your Grants. In consideration of, and as a condition to, the +licenses granted to You under this License: + +(a) You hereby grant to Apple and all third parties a non-exclusive, +royalty-free license, under Your Applicable Patent Rights and other +intellectual property rights owned or controlled by You, to use, +reproduce, modify, distribute and Deploy Your Modifications of the +same scope and extent as Apple's licenses under Sections 2.1 and 2.2; +and + +(b) You hereby grant to Apple and its subsidiaries a non-exclusive, +worldwide, royalty-free, perpetual and irrevocable license, under Your +Applicable Patent Rights and other intellectual property rights owned +or controlled by You, to use, reproduce, execute, compile, display, +perform, modify or have modified (for Apple and/or its subsidiaries), +sublicense and distribute Your Modifications, in any form, through +multiple tiers of distribution. + +4. Larger Works. You may create a Larger Work by combining Covered +Code with other code not governed by the terms of this License and +distribute the Larger Work as a single product. In each such +instance, You must make sure the requirements of this License are +fulfilled for the Covered Code or any portion thereof. + +5. Limitations on Patent License. Except as expressly stated in +Section 2, no other patent rights, express or implied, are granted by +Apple herein. Modifications and/or Larger Works may require +additional patent licenses from Apple which Apple may grant in its +sole discretion. + +6. Additional Terms. You may choose to offer, and to charge a fee +for, warranty, support, indemnity or liability obligations and/or +other rights consistent with the scope of the license granted herein +("Additional Terms") to one or more recipients of Covered +Code. However, You may do so only on Your own behalf and as Your sole +responsibility, and not on behalf of Apple. You must obtain the +recipient's agreement that any such Additional Terms are offered by +You alone, and You hereby agree to indemnify, defend and hold Apple +harmless for any liability incurred by or claims asserted against +Apple by reason of any such Additional Terms. + +7. Versions of the License. Apple may publish revised and/or new +versions of this License from time to time. Each version will be +given a distinguishing version number. Once Original Code has been +published under a particular version of this License, You may continue +to use it under the terms of that version. You may also choose to use +such Original Code under the terms of any subsequent version of this +License published by Apple. No one other than Apple has the right to +modify the terms applicable to Covered Code created under this +License. + +8. NO WARRANTY OR SUPPORT. The Original Code may contain in whole or +in part pre-release, untested, or not fully tested works. The +Original Code may contain errors that could cause failures or loss of +data, and may be incomplete or contain inaccuracies. You expressly +acknowledge and agree that use of the Original Code, or any portion +thereof, is at Your sole and entire risk. THE ORIGINAL CODE IS +PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND +AND APPLE AND APPLE'S LICENSOR(S) (FOR THE PURPOSES OF SECTIONS 8 AND +9, APPLE AND APPLE'S LICENSOR(S) ARE COLLECTIVELY REFERRED TO AS +"APPLE") EXPRESSLY DISCLAIM ALL WARRANTIES AND/OR CONDITIONS, EXPRESS +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +AND/OR CONDITIONS OF MERCHANTABILITY OR SATISFACTORY QUALITY AND +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY +RIGHTS. APPLE DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE +ORIGINAL CODE WILL MEET YOUR REQUIREMENTS, OR THAT THE OPERATION OF +THE ORIGINAL CODE WILL BE UNINTERRUPTED OR ERROR- FREE, OR THAT +DEFECTS IN THE ORIGINAL CODE WILL BE CORRECTED. NO ORAL OR WRITTEN +INFORMATION OR ADVICE GIVEN BY APPLE OR AN APPLE AUTHORIZED +REPRESENTATIVE SHALL CREATE A WARRANTY OR IN ANY WAY INCREASE THE +SCOPE OF THIS WARRANTY. You acknowledge that the Original Code is not +intended for use in the operation of nuclear facilities, aircraft +navigation, communication systems, or air traffic control machines in +which case the failure of the Original Code could lead to death, +personal injury, or severe physical or environmental damage. + +9. Liability. + +9.1 Infringement. If any portion of, or functionality implemented by, +the Original Code becomes the subject of a claim of infringement, +Apple may, at its option: (a) attempt to procure the rights necessary +for Apple and You to continue using the Affected Original Code; (b) +modify the Affected Original Code so that it is no longer infringing; +or (c) suspend Your rights to use, reproduce, modify, sublicense and +distribute the Affected Original Code until a final determination of +the claim is made by a court or governmental administrative agency of +competent jurisdiction and Apple lifts the suspension as set forth +below. Such suspension of rights will be effective immediately upon +Apple's posting of a notice to such effect on the Apple web site that +is used for implementation of this License. Upon such final +determination being made, if Apple is legally able, without the +payment of a fee or royalty, to resume use, reproduction, +modification, sublicensing and distribution of the Affected Original +Code, Apple will lift the suspension of rights to the Affected +Original Code by posting a notice to such effect on the Apple web site +that is used for implementation of this License. If Apple suspends +Your rights to Affected Original Code, nothing in this License shall +be construed to restrict You, at Your option and subject to applicable +law, from replacing the Affected Original Code with non-infringing +code or independently negotiating for necessary rights from such third +party. + +9.2 LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES SHALL APPLE BE +LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES +ARISING OUT OF OR RELATING TO THIS LICENSE OR YOUR USE OR INABILITY TO +USE THE ORIGINAL CODE, OR ANY PORTION THEREOF, WHETHER UNDER A THEORY +OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY +OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF +ANY REMEDY. In no event shall Apple's total liability to You for all +damages under this License exceed the amount of fifty dollars +($50.00). + +10. Trademarks. This License does not grant any rights to use the +trademarks or trade names "Apple", "Apple Computer", "Mac OS X", "Mac +OS X Server" or any other trademarks or trade names belonging to Apple +(collectively "Apple Marks") and no Apple Marks may be used to endorse +or promote products derived from the Original Code other than as +permitted by and in strict compliance at all times with Apple's third +party trademark usage guidelines which are posted at +http://www.apple.com/legal/guidelinesfor3rdparties.html. + +11. Ownership. Apple retains all rights, title and interest in and to +the Original Code and any Modifications made by or on behalf of Apple +("Apple Modifications"), and such Apple Modifications will not be +automatically subject to this License. Apple may, at its sole +discretion, choose to license such Apple Modifications under this +License, or on different terms from those contained in this License or +may choose not to license them at all. Apple's development, use, +reproduction, modification, sublicensing and distribution of Covered +Code will not be subject to this License. + +12. Termination. + +12.1 Termination. This License and the rights granted hereunder will + terminate: + +(a) automatically without notice from Apple if You fail to comply with +any term(s) of this License and fail to cure such breach within 30 +days of becoming aware of such breach; (b) immediately in the event of +the circumstances described in Section 13.5(b); or (c) automatically +without notice from Apple if You, at any time during the term of this +License, commence an action for patent infringement against Apple. + +12.2 Effect of Termination. Upon termination, You agree to +immediately stop any further use, reproduction, modification, +sublicensing and distribution of the Covered Code and to destroy all +copies of the Covered Code that are in your possession or control. +All sublicenses to the Covered Code which have been properly granted +prior to termination shall survive any termination of this License. +Provisions which, by their nature, should remain in effect beyond the +termination of this License shall survive, including but not limited +to Sections 3, 5, 8, 9, 10, 11, 12.2 and 13. Neither party will be +liable to the other for compensation, indemnity or damages of any sort +solely as a result of terminating this License in accordance with its +terms, and termination of this License will be without prejudice to +any other right or remedy of either party. + +13. Miscellaneous. + +13.1 Government End Users. The Covered Code is a "commercial item" as +defined in FAR 2.101. Government software and technical data rights +in the Covered Code include only those rights customarily provided to +the public as defined in this License. This customary commercial +license in technical data and software is provided in accordance with +FAR 12.211 (Technical Data) and 12.212 (Computer Software) and, for +Department of Defense purchases, DFAR 252.227-7015 (Technical Data -- +Commercial Items) and 227.7202-3 (Rights in Commercial Computer +Software or Computer Software Documentation). Accordingly, all U.S. +Government End Users acquire Covered Code with only those rights set +forth herein. + +13.2 Relationship of Parties. This License will not be construed as +creating an agency, partnership, joint venture or any other form of +legal association between You and Apple, and You will not represent to +the contrary, whether expressly, by implication, appearance or +otherwise. + +13.3 Independent Development. Nothing in this License will impair +Apple's right to acquire, license, develop, have others develop for +it, market and/or distribute technology or products that perform the +same or similar functions as, or otherwise compete with, +Modifications, Larger Works, technology or products that You may +develop, produce, market or distribute. + +13.4 Waiver; Construction. Failure by Apple to enforce any provision +of this License will not be deemed a waiver of future enforcement of +that or any other provision. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +will not apply to this License. + +13.5 Severability. (a) If for any reason a court of competent +jurisdiction finds any provision of this License, or portion thereof, +to be unenforceable, that provision of the License will be enforced to +the maximum extent permissible so as to effect the economic benefits +and intent of the parties, and the remainder of this License will +continue in full force and effect. (b) Notwithstanding the foregoing, +if applicable law prohibits or restricts You from fully and/or +specifically complying with Sections 2 and/or 3 or prevents the +enforceability of either of those Sections, this License will +immediately terminate and You must immediately discontinue any use of +the Covered Code and destroy all copies of it that are in your +possession or control. + +13.6 Dispute Resolution. Any litigation or other dispute resolution +between You and Apple relating to this License shall take place in the +Northern District of California, and You and Apple hereby consent to +the personal jurisdiction of, and venue in, the state and federal +courts within that District with respect to this License. The +application of the United Nations Convention on Contracts for the +International Sale of Goods is expressly excluded. + +13.7 Entire Agreement; Governing Law. This License constitutes the +entire agreement between the parties with respect to the subject +matter hereof. This License shall be governed by the laws of the +United States and the State of California, except that body of +California law concerning conflicts of law. + +Where You are located in the province of Quebec, Canada, the following +clause applies: The parties hereby confirm that they have requested +that this License and all related documents be drafted in English. Les +parties ont exige que le present contrat et tous les documents +connexes soient rediges en anglais. + +EXHIBIT A. + +"Portions Copyright (c) 1999 Apple Computer, Inc. All Rights +Reserved. 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 1.1 (the "License"). You may not use this file +except in compliance with the License. Please obtain a copy of the +License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the +License for the specific language governing rights and limitations +under the License." diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8dd7149 --- /dev/null +++ b/Makefile @@ -0,0 +1,66 @@ +export USE_APPLE_PB_SUPPORT = all + +# Makefile for kernel booter + +# CFLAGS = -O $(MORECPP) -arch i386 -g -munaligned-text +DEFINES= +CONFIG = hd +LIBDIR = libsa +INC = -I. -I$(LIBDIR) +ifneq "" "$(wildcard /bin/mkdirs)" + MKDIRS = /bin/mkdirs +else + MKDIRS = /bin/mkdir -p +endif +AS = as +LD = ld +PAX = /bin/pax + +OBJROOT = `pwd`/obj +SYMROOT = `pwd`/sym +DSTROOT = `pwd`/dst +SRCROOT = /tmp +ARCHLESS_RC_CFLAGS=`echo $(RC_CFLAGS) | sed 's/-arch [a-z0-9]*//g'` + +VPATH = $(OBJROOT):$(SYMROOT) + +GENERIC_SUBDIRS = gen + +# +# Currently builds for i386 +# + +all tags clean debug install installhdrs: $(SYMROOT) $(OBJROOT) + @if [ -z "$(RC_ARCHS)" ]; then \ + RC_ARCHS="i386"; \ + fi; \ + SUBDIRS="$(GENERIC_SUBDIRS) $$RC_ARCHS"; \ + for i in $$SUBDIRS; \ + do \ + if [ -d $$i ]; then \ + echo ================= make $@ for $$i =================; \ + ( OBJROOT=$(OBJROOT)/$${i}; \ + SYMROOT=$(SYMROOT)/$${i}; \ + DSTROOT=$(DSTROOT); \ + echo "$$OBJROOT $$SYMROOT $$DSTROOT"; \ + cd $$i; ${MAKE} \ + "OBJROOT=$$OBJROOT" \ + "SYMROOT=$$SYMROOT" \ + "DSTROOT=$$DSTROOT" \ + "SRCROOT=$$SRCROOT" \ + "RC_ARCHS=$$RC_ARCHS" \ + "TARGET=$$i" \ + "RC_KANJI=$(RC_KANJI)" \ + "JAPANESE=$(JAPANESE)" \ + "RC_CFLAGS=$(ARCHLESS_RC_CFLAGS)" $@ \ + ) || exit $?; \ + else \ + echo "========= nothing to build for $$i ========="; \ + fi; \ + done + +installsrc: + gnutar cf - . | (cd ${SRCROOT}; gnutar xpf -) + +$(SYMROOT) $(OBJROOT) $(DSTROOT): + @$(MKDIRS) $@ diff --git a/dpkg/control b/dpkg/control new file mode 100644 index 0000000..96192b0 --- /dev/null +++ b/dpkg/control @@ -0,0 +1,4 @@ +Package: boot +Maintainer: Darwin Developers +Description: Kernel booter +Build-Depends: build-base, adv-cmds, libc-hdrs, objc4-hdrs diff --git a/gen/MakeInc.dir b/gen/MakeInc.dir new file mode 100644 index 0000000..474c4ae --- /dev/null +++ b/gen/MakeInc.dir @@ -0,0 +1,43 @@ +# +# Common makefile targets. +# +# Define these variables (if desired) in directory makefiles: +# DIRS_NEEDED +# INSTALLDIR +# SRCROOT +# +ifneq "" "$(wildcard /bin/mkdirs)" + MKDIRS = /bin/mkdirs +else + MKDIRS = /bin/mkdir -p +endif + +installsrc:: $(SRCROOT) + cp $(ALLSRC) $(SRCROOT) + cd $(SRCROOT); chmod a-w $(ALLSRC) + +install:: installhdrs all + +install_i386:: all + +installhdrs:: + +clean:: + /bin/rm -rf $(OBJROOT) *~ + +.SUFFIXES: .s .i .c .o + +.c.o .m.o: + $(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \ + -MD -dependency-file $(OBJROOT)/$*.d + md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d + +#.s.o: +# cc $(INC) -E $< > $(OBJROOT)/$*.o2 +# $(AS) -o $(OBJROOT)/$@ $(OBJROOT)/$*.o2 + +.s.o: + cc -c $(INC) -arch i386 -o $(OBJROOT)/$@ $< + +$(DIRS_NEEDED) $(INSTALLDIR) $(SRCROOT): + $(MKDIRS) $@ diff --git a/gen/MakePaths.dir b/gen/MakePaths.dir new file mode 100644 index 0000000..4eb6750 --- /dev/null +++ b/gen/MakePaths.dir @@ -0,0 +1,9 @@ +# +# Default paths for subdirectories. +# + +OBJROOT=../../obj/gen/$(DIR) +SYMROOT=../../sym/gen +DSTROOT=../../dst +SRCROOT=/tmp + diff --git a/gen/Makefile b/gen/Makefile new file mode 100644 index 0000000..b9ce995 --- /dev/null +++ b/gen/Makefile @@ -0,0 +1,49 @@ + +# +# Machine-independent code +# + +#CFLAGS = -O $(MORECPP) -arch i386 -g -munaligned-text +DEFINES= +CONFIG = hd +LIBDIR = libsa +INC = -I. -I$(LIBDIR) +ifneq "" "$(wildcard /bin/mkdirs)" + MKDIRS = /bin/mkdirs +else + MKDIRS = /bin/mkdir -p +endif +AS = as +LD = ld +# LIBS= -lc_static + +# +# these paths are only valid in subdirectories of this directory +# +OBJROOT=`pwd`/../../obj/gen +SYMROOT=`pwd`/../../sym +DSTROOT=`pwd`/../../dst +SRCROOT=/tmp + +VPATH = $(OBJROOT):$(SYMROOT) + +SUBDIRS = rcz + +all tags clean debug install installhdrs: + @for i in ${SUBDIRS}; \ + do \ + echo ================= make $@ for $$i =================; \ + ( cd $$i; ${MAKE} \ + "OBJROOT=$(OBJROOT)/$$i" \ + "SYMROOT=$(SYMROOT)" \ + "DSTROOT=$(DSTROOT)" \ + "SRCROOT=$(SRCROOT)" \ + "RC_ARCHS=$(RC_ARCHS)" \ + "RC_KANJI=$(RC_KANJI)" \ + "JAPANESE=$(JAPANESE)" \ + "RC_CFLAGS=$(RC_CFLAGS)" $@ \ + ) || exit $?; \ + done + +installsrc: + tar cf - . | (cd ${SRCROOT}; tar xfBp -) diff --git a/gen/libsa/Makefile b/gen/libsa/Makefile new file mode 100644 index 0000000..20c0a10 --- /dev/null +++ b/gen/libsa/Makefile @@ -0,0 +1,42 @@ + +DIR = libsa +include ../MakePaths.dir + +UTILDIR = ../util +INSTALL_MI_DIR = $(DSTROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/machdep/machine + +DEBUG = -O +CFLAGS = $(DEBUG) $(MORECPP) -arch i386 -g -Wmost -Wno-precomp -munaligned-text +DEFINES= +CONFIG = hd +INC = -I. -I$(SYMROOT) -I$(UTILDIR) +ifneq "" "$(wildcard /bin/mkdirs)" + MKDIRS = /bin/mkdirs +else + MKDIRS = /bin/mkdir -p +endif +AS = as +LD = ld +# LIBS= -lc_static +LIBS= + +VPATH = $(OBJROOT):$(SYMROOT) + +INSTALLED_MI_HFILES = kernBootStruct.h + +clean:: + @echo "Nothing to clean (yet)" + +all: + @echo "Nothing to build (yet)" + +$(INSTALL_MI_DIR): + $(MKDIRS) $@ + +installhdrs:: $(INSTALL_MI_DIR) + cp $(INSTALLED_MI_HFILES) $(INSTALL_MI_DIR) + +include ../MakeInc.dir + +# dependencies +-include $(OBJROOT)/Makedep diff --git a/gen/libsa/bsearch.c b/gen/libsa/bsearch.c new file mode 100644 index 0000000..48070a8 --- /dev/null +++ b/gen/libsa/bsearch.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* bsearch -- from libc */ +#include "libsa.h" + +#undef bsearch +void * +bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { + int l = 0; + int u = nmemb - 1; + int m; + void *mp; + int r; + + while (l <= u) { + m = (l + u) / 2; + mp = (void *)(((char *)base) + (m * size)); + if ((r = (*compar) (key, mp)) == 0) { + return mp; + } else if (r < 0) { + u = m - 1; + } else { + l = m + 1; + } + } + return NULL; +} diff --git a/gen/libsa/ctype.h b/gen/libsa/ctype.h new file mode 100644 index 0000000..9a56c58 --- /dev/null +++ b/gen/libsa/ctype.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* standalone ctype.h */ + +#define isdigit(c) ((c) >= '0' && (c) <= '9') +#define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || \ + (c) == '\r' || (c) == '\v' || (c) == '\f') +#define isupper(c) ((c) >= 'A' && (c) <= 'Z') +#define islower(c) ((c) >= 'a' && (c) <= 'z') +#define isdigit(c) ((c) >= '0' && (c) <= '9') +#define isalpha(c) (islower(c) || isupper(c)) +#define isalnum(c) (isalpha(c) || isdigit(c)) \ No newline at end of file diff --git a/gen/libsa/error.c b/gen/libsa/error.c new file mode 100644 index 0000000..0dafad8 --- /dev/null +++ b/gen/libsa/error.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* error handling */ + +#import "libsa.h" + +int errno; + +char *strerror(int errnum) +{ + static char error_string[32]; + sprintf(error_string,"Error %d",errnum); + return error_string; +} diff --git a/gen/libsa/fontio.h b/gen/libsa/fontio.h new file mode 100644 index 0000000..08b8e3d --- /dev/null +++ b/gen/libsa/fontio.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* Font I/O functions */ + +extern int strwidth( + register const char *str +); + +extern int strheight( + const char *str +); + +#define CENTER_H 1 +#define CENTER_V 2 + +extern int blit_string( + const char *str, + int xpos, + int ypos, + int color, + int center +); + +extern void blit_clear( + int maxwidth, + int xpos, + int ypos, + int center, + int color +); diff --git a/gen/libsa/getsegbyname.c b/gen/libsa/getsegbyname.c new file mode 100644 index 0000000..125cf7f --- /dev/null +++ b/gen/libsa/getsegbyname.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993 NeXT, Inc. + * All rights reserved. + */ + +#import "libsa.h" + +/* + * This routine returns the segment_command structure for the named segment if + * it exist in the mach executible it is linked into. Otherwise it returns + * zero. It uses the specified mach_header pointer and just looks through the + * load commands. + */ +struct segment_command * +getsegbynamefromheader( +struct mach_header *mhp, +char *segname) +{ + struct segment_command *sgp; + long i; + + sgp = (struct segment_command *) + ((char *)mhp + sizeof(struct mach_header)); + for(i = 0; i < mhp->ncmds; i++){ + if(sgp->cmd == LC_SEGMENT) + if(strncmp(sgp->segname, segname, sizeof(sgp->segname)) == 0) + return(sgp); + sgp = (struct segment_command *)((char *)sgp + sgp->cmdsize); + } + return((struct segment_command *)0); +} diff --git a/gen/libsa/io_inline.h b/gen/libsa/io_inline.h new file mode 100644 index 0000000..3bfa75d --- /dev/null +++ b/gen/libsa/io_inline.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1992 NeXT Computer, Inc. + * + * Inlines for io space access. + * + * HISTORY + * + * 20 May 1992 ? at NeXT + * Created. + */ + +#import + +#if !defined(DEFINE_INLINE_FUNCTIONS) +static +#endif +inline +unsigned char +inb( + io_addr_t port +) +{ + unsigned char data; + + asm volatile( + "inb %1,%0" + + : "=a" (data) + : "d" (port)); + + return (data); +} + +#if !defined(DEFINE_INLINE_FUNCTIONS) +static +#endif +inline +unsigned short +inw( + io_addr_t port +) +{ + unsigned short data; + + asm volatile( + "inw %1,%0" + + : "=a" (data) + : "d" (port)); + + return (data); +} + +#if !defined(DEFINE_INLINE_FUNCTIONS) +static +#endif +inline +void +outb( + io_addr_t port, + unsigned char data +) +{ + static int xxx; + + asm volatile( + "outb %2,%1; lock; incl %0" + + : "=m" (xxx) + : "d" (port), "a" (data), "0" (xxx) + : "cc"); +} + +#if !defined(DEFINE_INLINE_FUNCTIONS) +static +#endif +inline +void +outw( + io_addr_t port, + unsigned short data +) +{ + static int xxx; + + asm volatile( + "outw %2,%1; lock; incl %0" + + : "=m" (xxx) + : "d" (port), "a" (data), "0" (xxx) + : "cc"); +} + diff --git a/gen/libsa/kernBootStruct.h b/gen/libsa/kernBootStruct.h new file mode 100644 index 0000000..a685321 --- /dev/null +++ b/gen/libsa/kernBootStruct.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * kernBootStruct.h + * What the booter leaves behind for the kernel. + */ + +#import + +#import ARCH_INCLUDE(, kernBootStruct.h) + diff --git a/gen/libsa/keys.h b/gen/libsa/keys.h new file mode 100644 index 0000000..1275551 --- /dev/null +++ b/gen/libsa/keys.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* key codes for some keys */ + +#define K_UP 0x4800 +#define K_DOWN 0x5000 \ No newline at end of file diff --git a/gen/libsa/libsa.h b/gen/libsa/libsa.h new file mode 100644 index 0000000..1346fc4 --- /dev/null +++ b/gen/libsa/libsa.h @@ -0,0 +1,115 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* Exported API for standalone library */ +#import +#import +#import +#import + +#ifndef bcopy +extern char *bcopy(char *src, char *dst, int n); +#endif +extern void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); +#ifndef bzero +extern int bzero(char *b, int length); +#endif +extern void *memset(void *s, int c, size_t n); + +/* + * These are defined internally by GCC + * + * extern void *memcpy(void *dst, const void *src, size_t len); + * extern size_t strlen(const char *s); + */ + +extern int errno; +extern struct segment_command * + getsegbynamefromheader(struct mach_header *mhp, char *segname); +extern int ptol(char *str); + +/* setjmp/longjmp: + * #include + * + * extern int setjmp(jmp_buf env); + * extern void longjmp( jmp_buf env, int val); + */ + +extern int slvprintf(char *buffer, int len, const char *fmt, va_list arg); +extern int sprintf(char *s, const char *format, ...); + +extern char *strcat(char *s1, const char *s2); +extern int strcmp(const char *s1, const char *s2); +extern char *strcpy(char *s1, const char *s2); +char *strerror(int errnum); +extern int strncmp(const char *s1, const char *s2, size_t n); +extern char *strncpy(char *s1, const char *s2, size_t n); +extern long strtol( + const char *nptr, + char **endptr, + register int base +); +extern unsigned long strtoul( + const char *nptr, + char **endptr, + register int base +); +extern int atoi(const char *str); + +/* Mach */ +extern port_t task_self_; +extern kern_return_t vm_allocate( + vm_task_t target_task, + vm_address_t *address, + vm_size_t size, + boolean_t anywhere +); +extern kern_return_t vm_deallocate( + vm_task_t target_task, + vm_address_t address, + vm_size_t size +); +extern kern_return_t host_info( + host_t host, + int flavor, + host_info_t host_info, + unsigned int *host_info_count +); +extern vm_size_t vm_page_size; +extern host_t host_self(void); +extern int getpagesize(void); +extern char *mach_error_string(int errnum); + +/* Malloc */ +extern void malloc_init(char *start, int size, int nodes); +extern void *malloc(size_t size); +extern void free(void *start); +extern void *realloc(void *ptr, size_t size); + +extern void prf( + const char *fmt, + va_list ap, + void (*putfn_p)(), + void *putfn_arg +); +extern int strncasecmp(const char *s1, const char *s2, size_t n); diff --git a/gen/libsa/mach.c b/gen/libsa/mach.c new file mode 100644 index 0000000..53ef503 --- /dev/null +++ b/gen/libsa/mach.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* mach simulation */ + +#import "libsa.h" + +port_t task_self_; + +char *mach_error_string(int errnum) +{ + extern char *strerror(int errnum); + + return strerror(errnum); +} + +kern_return_t vm_allocate( + vm_task_t target_task, + vm_address_t *address, + vm_size_t size, + boolean_t anywhere +) +{ + *address = (vm_address_t)malloc(size); + if (*address == 0) + return KERN_FAILURE; + else { + bzero(*address, size); + return KERN_SUCCESS; + } +} + +kern_return_t vm_deallocate( + vm_task_t target_task, + vm_address_t address, + vm_size_t size +) +{ + free((void *)address); + return KERN_SUCCESS; +} + +vm_size_t vm_page_size = 8192; + +kern_return_t host_info( + host_t host, + int flavor, + host_info_t host_info, + unsigned int *host_info_count +) +{ + host_basic_info_t hi = (host_basic_info_t) host_info; + + switch(flavor) { + case HOST_BASIC_INFO: + hi->max_cpus = 1; + hi->avail_cpus = 1; +// hi->memory_size = +// (kernBootStruct->convmem + kernBootStruct->extmem) * 1024; + hi->memory_size = 0; + hi->cpu_type = CPU_TYPE_I386; + hi->cpu_subtype = CPU_SUBTYPE_486; + break; + case HOST_PROCESSOR_SLOTS: + break; + case HOST_SCHED_INFO: + break; + } + return KERN_SUCCESS; +} + +host_t host_self(void) +{ + return 0; +} + +int getpagesize(void) +{ + return vm_page_size; +} diff --git a/gen/libsa/malloc.c.00 b/gen/libsa/malloc.c.00 new file mode 100644 index 0000000..72e5ec3 --- /dev/null +++ b/gen/libsa/malloc.c.00 @@ -0,0 +1,37 @@ +/* + * Copyright 1993 NeXT, Inc. + * All rights reserved. + * + * Malloc interface to zalloc. + */ + +#import "libsa.h" + +int +malloc_init( + char *start, + int size, + int nodes +) +{ + return zinit(start,size,nodes); +} + +void *malloc(size_t size) +{ + return zalloc(size); +} + +/* This is the simplest way possible. Should fix this. */ +void *realloc(void *start, size_t newsize) +{ + void *newstart = zalloc(newsize); + bcopy(start, newstart, newsize); + zfree(start); + return newstart; +} + +void free(void *start) +{ + (void) zfree(start); +} diff --git a/gen/libsa/memcpy.c b/gen/libsa/memcpy.c new file mode 100644 index 0000000..6bb9347 --- /dev/null +++ b/gen/libsa/memcpy.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * more string operations + * + */ + +#import "libsa.h" + +#if defined(NX_CURRENT_COMPILER_RELEASE) && (NX_CURRENT_COMPILER_RELEASE < 320) +#define SIREG "e" +#else +#define SIREG "S" +#endif + +#if i386 && !defined(DONT_USE_ASM) +/* Simple forward character copy */ +void *memcpy(void *dst, const void *src, size_t len) +{ + asm("rep; movsb" + : /* no outputs */ + : "&c" (len), "D" (dst), SIREG (src) + : "ecx", "esi", "edi"); + return (void *)src; +} +#else +void *memcpy( + void *dst, + const void *src, + size_t len +) +{ + register char *src_c, *dst_c; + + src_c = (char *)src; + dst_c = (char *)dst; + + while (len-- > 0) + *dst_c++ = *src_c++; + return src; +} +#endif + +/* + * copy n bytes from src to dst. Both src and dst are virtual addresses. + */ +char *bcopy(char *src, char *dst, int n) +{ + memcpy(dst, src, n); + return 0; +} + + diff --git a/gen/libsa/memory.h b/gen/libsa/memory.h new file mode 100644 index 0000000..d753fc8 --- /dev/null +++ b/gen/libsa/memory.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* memory addresses used by booter and friends */ + +/* these are all "virtual" addresses... + * which are physical addresses plus MEMBASE. + */ + +#define MEMBASE 0x0 +#define BASE_SEG 0x0 + +/* these are virtual addresses */ + +#define BIOS_ADDR 0x00C00 // BIOS buffer +#define BIOS_LEN 0x02400 // 9k +#define BOOTER_LOAD_ADDR 0x03000 // loaded here for compat. +#define BOOTER_ADDR 0x03000 // start of booter code +#define BOOTER_LEN 0x08000 // max of 32k +#define STACK_ADDR 0x0FFF0 +#define BOOTSTRUCT_ADDR 0x11000 +#define BOOTSTRUCT_LEN 0x0F000 // it's slightly smaller +#define EISA_CONFIG_ADDR 0x20000 +#define EISA_CONFIG_LEN 0x10000 +#define RLD_ADDR 0x30000 +#define RLD_LEN 0x24000 // 140k +#define ZALLOC_ADDR 0x54000 +#define ZALLOC_LEN 0x12000 // 72k +#define MODULE_ADDR 0x66000 +#define RLD_MEM_ADDR 0x680000 +#define RLD_MEM_LEN 0x100000 // 1Mb +#define KSYM_ADDR 0x780000 +#define KSYM_LEN 0x080000 // 512k + +/* these are physical values */ + +//#define CONVENTIONAL_LEN 0xA0000 // 640k +#define EXTENDED_ADDR 0x100000 // 1024k +#define KERNEL_BOOT_ADDR 0x100000 /* load at 1Mb */ + +#define KERNEL_SYMBOL_OFFSET 0x100000 /* load at top - 1Mb */ + +#define SAIO_TABLE_POINTER (BOOTER_ADDR + SAIO_TABLE_PTR_OFFSET) +#define SAIO_TABLE_PTR_OFFSET 0x30 + +#define ptov(paddr) ((paddr) - MEMBASE) +#define vtop(vaddr) ((vaddr) + MEMBASE) + +#define MIN_EXT_MEM_KB (7 * 1024) /* 8 Mb minimum total */ diff --git a/gen/libsa/memset.c b/gen/libsa/memset.c new file mode 100644 index 0000000..2abd6cf --- /dev/null +++ b/gen/libsa/memset.c @@ -0,0 +1,151 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* Copyright (c) 1991 NeXT Computer, Inc. All rights reserved. + * + * File: libc/i386/ansi/memset.c + * Author: Bruce Martin, NeXT Computer, Inc. + * + * This file contains machine dependent code for block compares + * on NeXT i386-based products. Currently tuned for the i486. + * + * This code is loosely based on some work done by Mike DeMoney + * for the m88k. + * + * HISTORY + * 14-Dec-93 Curtis Galloway + * Modified for the booter; simplified simple_char_set. + * + * 14-Aug-92 Bruce Martin (Bruce_Martin@NeXT.COM) + * Created. + */ + +#define MIN_TO_ALIGN 32 + +/* + * Convert a void * into a unsigned int so arithmetic can be done + * (Technically, the gnu C compiler is tolerant of arithmetic + * on void *, but ansi isn't; so we do this.) + */ +#define UNS(voidp) ((unsigned int)(voidp)) + +/* + * Number of bytes addr is past an object of 'align' size. + */ +#define BYTES_PAST_ALIGNMENT(voidp, align) \ + (UNS(voidp) & (align - 1)) + +/* + * Bytes moved by an unrolled loop + */ +#define LOOP_STRIDE(type, unroll) ((unroll) * sizeof(type)) + + +/* + * Len modulo LOOP_STRIDE + */ +#define MODULO_LOOP_UNROLL(len, type, unroll) \ + ((len) & (LOOP_STRIDE(type, unroll) - 1) & ~(sizeof(type) - 1)) + + +/* + * Convert a void * + offset into char, short, int, or long long reference + * based at that address + */ +#define CHAR(voidp, offset) (*(char *)(UNS(voidp) + (offset))) +#define SHORT(voidp, offset) (*(short *)(UNS(voidp) + (offset))) +#define INT(voidp, offset) (*(int *)(UNS(voidp) + (offset))) + + + +static inline void +simple_char_set(char *dst, int val, int len) +{ + asm("rep; stosb" + : /* no outputs */ + : "&c" (len), "D" (dst), "a" (val) + : "ecx", "edi", "eax"); +} + + + +void *memset(void *, int, unsigned long); + +int bzero(void *dst, unsigned long ulen) +{ + (void) memset(dst, 0, ulen); + return 0; +} + + +void *memset(void *dst, int val, unsigned long ulen) +{ + int len = ulen; + void *orig_dst = dst; + int need_to_set; + int alignment; + + val |= (val << 8); + val |= (val << 16); + + /* Always do a forward copy */ + + if (len < MIN_TO_ALIGN) { + simple_char_set(dst, val, len); + return orig_dst; + } + + if (need_to_set = BYTES_PAST_ALIGNMENT(dst, 2 * sizeof(int))) { + need_to_set = (2 * sizeof(int)) - need_to_set; + simple_char_set(dst, val, need_to_set); + len -= need_to_set; + UNS(dst) += need_to_set; + } + + alignment = MODULO_LOOP_UNROLL(len, int, 8); + UNS(dst) += alignment - LOOP_STRIDE(int, 8); + switch (alignment) { + do { + INT(dst, 0) = val; + case 28: INT(dst, 4) = val; + case 24: INT(dst, 8) = val; + case 20: INT(dst, 12) = val; + case 16: INT(dst, 16) = val; + case 12: INT(dst, 20) = val; + case 8: INT(dst, 24) = val; + case 4: INT(dst, 28) = val; + case 0: + UNS(dst) += LOOP_STRIDE(int, 8); + len -= LOOP_STRIDE(int, 8); + } while (len >= 0); + len &= sizeof(int) - 1; + } + + switch (len) { + case 3: CHAR(dst, 2) = val; + case 2: CHAR(dst, 1) = val; + case 1: CHAR(dst, 0) = val; + } + + return orig_dst; +} diff --git a/gen/libsa/prf.c b/gen/libsa/prf.c new file mode 100644 index 0000000..a9a74e5 --- /dev/null +++ b/gen/libsa/prf.c @@ -0,0 +1,161 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Mach Operating System + * Copyright (c) 1990 Carnegie-Mellon University + * Copyright (c) 1989 Carnegie-Mellon University + * Copyright (c) 1988 Carnegie-Mellon University + * Copyright (c) 1987 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)prf.c 7.1 (Berkeley) 6/5/86 + */ + +#include + +#define SPACE 1 +#define ZERO 2 + +/* + * Scaled down version of C Library printf. + * Used to print diagnostic information directly on console tty. + * Since it is not interrupt driven, all system activities are + * suspended. + * + */ + +/* + * Printn prints a number n in base b. + * We don't use recursion to avoid deep kernel stacks. + */ +static void +printn(n, b, flag, minwidth, putfn_p, 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++ = "0123456789abcdef"[n%b]; + n /= b; + width++; + } while (n); + + if (neg) { + (*putfn_p)('-', putfn_arg); + width++; + } + 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 +) +{ + int b, c; + char *s; + int flag = 0, minwidth = 0, width = 0; + +loop: + while ((c = *fmt++) != '%') { + if(c == '\0') + return; + (*putfn_p)(c, putfn_arg); + } +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': 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; + } + adx++; + goto loop; +} diff --git a/gen/libsa/setjmp.s b/gen/libsa/setjmp.s new file mode 100644 index 0000000..90c1ae1 --- /dev/null +++ b/gen/libsa/setjmp.s @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +#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 + +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 diff --git a/gen/libsa/sprintf.c b/gen/libsa/sprintf.c new file mode 100644 index 0000000..6850ace --- /dev/null +++ b/gen/libsa/sprintf.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993 NeXT, Inc. + * All rights reserved. + */ + +#import "libsa.h" + +struct putc_info { + char *str; + char *last_str; +}; + +static void +sputc( + int c, + struct putc_info *pi +) +{ + if (pi->last_str) + if (pi->str == pi->last_str) { + *(pi->str) = '\0'; + return; + } + *(pi->str)++ = c; +} + +/*VARARGS1*/ +int sprintf(char *str, const char *fmt, ...) +{ + va_list ap; + struct putc_info pi; + + va_start(ap, fmt); + pi.str = str; + pi.last_str = 0; + prf(fmt, ap, sputc, &pi); + *pi.str = '\0'; + va_end(ap); + return 0; +} + +/*VARARGS1*/ +int slvprintf(char *str, int len, const char *fmt, va_list ap ) +{ + struct putc_info pi; + pi.str = str; + pi.last_str = str + len - 1; + prf(fmt, ap, sputc, &pi); + *pi.str = '\0'; + return (pi.str - str); +} \ No newline at end of file diff --git a/gen/libsa/string1.c b/gen/libsa/string1.c new file mode 100644 index 0000000..6291112 --- /dev/null +++ b/gen/libsa/string1.c @@ -0,0 +1,134 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* string operations */ +#import "libsa.h" + +/*#if DONT_USE_GCC_BUILT_IN_STRLEN*/ + +#define tolower(c) ((int)((c) & ~0x20)) +#define toupper(c) ((int)((c) | 0x20)) + +int strlen(const char *s) +{ + int n; + + n = 0; + while (*s++) n++; + return(n); +} + +/*#endif*/ + +int +strcmp(const char *s1, const char *s2) +{ + while (*s1 && (*s1 == *s2)) { + s1++; + s2++; + } + return (*s1 - *s2); +} + +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); +} + +char * +strcpy(char *s1, const char *s2) +{ + register char *ret = s1; + while (*s1++ = *s2++) + continue; + return ret; +} + +char * +strncpy(char *s1, const char *s2, size_t n) +{ + register char *ret = s1; + while (n && (*s1++ = *s2++)) + n--; + if (!n) *s1=0; + return ret; +} + +int +ptol(char *str) +{ + register int c = *str; + + if (c <= '7' && c >= '0') + c -= '0'; + else if (c <= 'h' && c >= 'a') + c -= 'a'; + else c = 0; + return c; +} + +int +atoi(const char *str) +{ + register int sum = 0; + while (*str == ' ' || *str == '\t') + str++; + while (*str >= '0' && *str <= '9') { + sum *= 10; + sum += *str++ - '0'; + } + return sum; +} + + +char *strncat(char *s1, const char *s2, size_t n) +{ + register char *ret = s1; + while (*s1) + s1++; + while (n-- && *s2) + *s1++ = *s2++; + *s1 = '\0'; + return ret; +} + +char *strcat(char *s1, const char *s2) +{ + return(strncat(s1, s2, strlen(s2))); +} + +#if STRNCASECMP +int strncasecmp(const char *s1, const char *s2, size_t len) +{ + register int n = len; + while (--n >= 0 && tolower(*s1) == tolower(*s2++)) + if (*s1++ == '\0') + return(0); + return(n<0 ? 0 : tolower(*s1) - tolower(*--s2)); +} +#endif + diff --git a/gen/libsa/string2.c b/gen/libsa/string2.c new file mode 100644 index 0000000..ba525c7 --- /dev/null +++ b/gen/libsa/string2.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * more string operations + * + */ + +#import "libsa.h" + + +#if i386 && !defined(DONT_USE_ASM) +void *memset(void *dst, int val, size_t len) +{ + asm("rep; stosb" + : /* no outputs */ + : "&c" (len), "D" (dst), "a" (val) + : "ecx", "esi", "eax"); + return dst; +} +/* Simple forward character copy */ +void *memcpy(void *dst, const void *src, size_t len) +{ + asm("rep; movsb" + : /* no outputs */ + : "&c" (len), "D" (dst), "e" (src) + : "ecx", "esi", "edi"); + return src; +} +#else +void *memset(void *p, int val, size_t len) +{ + register char *ptr = (char *)p; + while (len-- > 0) *ptr++ = val; + return p; +} + +void *memcpy( + void *dst, + const void *src, + size_t len +) +{ + register char *src_c, *dst_c; + + src_c = (char *)src; + dst_c = (char *)dst; + + while (len-- > 0) + *dst_c++ = *src_c++; + return src; +} +#endif + diff --git a/gen/libsa/strtol.c b/gen/libsa/strtol.c new file mode 100644 index 0000000..2cf2b23 --- /dev/null +++ b/gen/libsa/strtol.c @@ -0,0 +1,257 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * 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. + * 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. + */ + +/* Modified by Curtis Galloway at NeXT June 1993, + * for use in the standalone library. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +//#include +#import "libsa.h" + +#import "ctype.h" + + +/* Fudge here -- to save space, make strtol and strtoul do the same + * conversion. If you really need that extra range on strtoul, too bad. + */ + +#define SIGNED 1 +#define UNSIGNED 0 + + +/* + * Convert a string to a long integer. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +static long +actual_strtol( + const char *nptr, + char **endptr, + register int base, + int is_signed +) +{ + 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 + * assume decimal; if base is already 16, allow 0x. + */ + do { + c = *s++; + } while (isspace(c)); + if (is_signed && c == '-') { + neg = 1; + c = *s++; + } else if (c == '+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + 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 + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, + * cutoff will be set to 214748364 and cutlim to either + * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated + * a value > 214748364, or equal but the next digit is > 7 (or 8), + * the number is too big, and we will return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; + cutlim = cutoff % (unsigned long)base; + cutoff /= (unsigned long)base; + for (acc = 0, any = 0;; c = *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = neg ? LONG_MIN : LONG_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? s - 1 : (char *)nptr; + return (acc); +} + +long +strtol( + const char *nptr, + char **endptr, + register int base +) +{ + return actual_strtol(nptr, endptr, base, SIGNED); +} + +unsigned long +strtoul( + const char *nptr, + char **endptr, + register int base +) +{ + return actual_strtol(nptr, endptr, base, UNSIGNED); +} + +#if notdef +/* + * Convert a string to an unsigned long integer. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +unsigned long +strtoul(nptr, endptr, base) + const char *nptr; + char **endptr; + register 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. + */ + do { + c = *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else if (c == '+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; + cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; + for (acc = 0, any = 0;; c = *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = ULONG_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? s - 1 : (char *)nptr; + return (acc); +} + +#endif notdef diff --git a/gen/libsa/zalloc.c b/gen/libsa/zalloc.c new file mode 100644 index 0000000..d0dce72 --- /dev/null +++ b/gen/libsa/zalloc.c @@ -0,0 +1,246 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993 NeXT Computer, Inc. + * All rights reserved. + * + * Sam's simple memory allocator. + * + */ + +#import "libsa.h" +#import "memory.h" +#import "zalloc.h" + +#define ZDEBUG 0 + +#if ZDEBUG +int zout; +#endif + +typedef struct { + char *start; + int size; +} zmem; + +static zmem *zalloced; +static zmem *zavailable; +static short availableNodes, allocedNodes, totalNodes; +static char *zalloc_base; + +static void zallocate(char *start,int size); +static void zinsert(zmem *zp, int ndx); +static void zdelete(zmem *zp, int ndx); +static void zcoalesce(void); + + +// define the block of memory that the allocator will use +void malloc_init(char *start, int size, int nodes) +{ + zalloc_base = start; + totalNodes = nodes; + zalloced = (zmem *)zalloc_base; + start += sizeof(zmem) * nodes; + zavailable = (zmem *)start; + start += sizeof(zmem) * nodes; + zavailable[0].start = start; + zavailable[0].size = size; + availableNodes = 1; + allocedNodes = 0; +} + +void * malloc(size_t size) +{ + int i; + char *ret = 0; +#if 0 + extern char _DATA__end; +#endif + if (!zalloc_base) + { + // this used to follow the bss but some bios' corrupted it... + malloc_init((char *)ZALLOC_ADDR, ZALLOC_LEN, ZALLOC_NODES); + } + + size = ((size + 0xf) & ~0xf); + + for (i=0; i size) + { + zallocate(ret = zavailable[i].start, size); + zavailable[i].start += size; + zavailable[i].size -= size; + goto done; + } + } + +done: +#if 0 +/* if (ret + size >= (char*)_sp()) _stop("stack clobbered"); */ + if (ret + size >= (char *)(ZALLOC_ADDR + ZALLOC_LEN)) + _stop("Out of memory"); +#endif + if (ret != 0) + bzero(ret, size); + return (void *)ret; +} + +void +free(void *pointer) +{ + int i, tsize, found = 0; + char *start = pointer; + + if (!start) return; + + for (i=0; i0 && (zavailable[i-1].start + zavailable[i-1].size == + start)) + { + zavailable[i-1].size += tsize; + zcoalesce(); + return; + } + + if ((start+tsize) < zavailable[i].start) + { + zinsert(zavailable, i); availableNodes++; + zavailable[i].start = start; + zavailable[i].size = tsize; + return; + } + } + + zavailable[i].start = start; + zavailable[i].size = tsize; + availableNodes++; + zcoalesce(); + return; +} + + +static void +zallocate(char *start,int size) +{ +#if ZDEBUG + zout += size; + printf(" alloc %d, total 0x%x\n",size,zout); +#endif + zalloced[allocedNodes].start = start; + zalloced[allocedNodes].size = size; + allocedNodes++; +} + +static void +zinsert(zmem *zp, int ndx) +{ + int i; + zmem *z1, *z2; + + i=totalNodes-2; + z1 = zp + i; + z2 = z1+1; + + for (; i>= ndx; i--, z1--, z2--) + { + z2->start = z1->start; + z2->size = z1->size; + } +} + +static void +zdelete(zmem *zp, int ndx) +{ + int i; + zmem *z1, *z2; + + z1 = zp + ndx; + z2 = z1+1; + + for (i=ndx; istart = z2->start; + z1->size = z2->size; + } +} + +static void +zcoalesce(void) +{ + int i; + for (i=0; initems = nitems; + cp->item_size = item_size; + return cp; +} + +/* + * Either find an item in the cache, or find where it should go. + * Returns 1 if found, 0 if not found. + * This function assumes that if you find an empty slot, you will use it; + * therefore, empty slots returned are marked valid. + */ +int cacheFind( + cache_t *cp, + int key1, + int key2, + char **ip +) +{ + item_t *iip, *min_p; + int i,j; + + for(i=j=0, iip = min_p = (item_t *)cp->storage; i < cp->nitems; i++) { + if (iip->referenced && (iip->key1 == key1) && (iip->key2 == key2)) { + *ip = iip->storage; + if (iip->referenced < 65535) + iip->referenced++; + return 1; + } + if (iip->referenced < min_p->referenced) { + min_p = iip; + j = i; + } + iip = (item_t *)((char *)iip + cp->item_size); + } + *ip = min_p->storage; + min_p->referenced = 1; + min_p->key1 = key1; + min_p->key2 = key2; + return 0; +} + +/* + * Flush the cache. + */ +void cacheFlush( + cache_t *cp +) +{ + int i; + item_t *ip; + + if (cp == 0) + return; + for(i=0, ip = (item_t *)cp->storage; i < cp->nitems; i++) { + ip->referenced = 0; + ip = (item_t *)((char *)ip + cp->item_size); + } +} diff --git a/gen/libsaio/cache.h b/gen/libsaio/cache.h new file mode 100644 index 0000000..193974f --- /dev/null +++ b/gen/libsaio/cache.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +typedef struct cache_item { + unsigned int referenced; + int key1, key2; + char storage[0]; +} item_t; + +typedef struct cache { + int nitems; + int item_size; + char storage[0]; +} cache_t; + +extern cache_t *cacheInit( + int nitems, + int item_size +); + +extern int cacheFind( + cache_t *cp, + int key1, + int key2, + char **ip +); + +extern void cacheFlush( + cache_t *cp +); diff --git a/gen/libsaio/disk.c b/gen/libsaio/disk.c new file mode 100644 index 0000000..77bbba0 --- /dev/null +++ b/gen/libsaio/disk.c @@ -0,0 +1,300 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Mach Operating System + * Copyright (c) 1990 Carnegie-Mellon University + * Copyright (c) 1989 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ + +/* + * INTEL CORPORATION PROPRIETARY INFORMATION + * + * This software is supplied under the terms of a license agreement or + * nondisclosure agreement with Intel Corporation and may not be copied + * nor disclosed except in accordance with the terms of that agreement. + * + * Copyright 1988, 1989 Intel Corporation + */ + +/* + * Copyright 1993 NeXT Computer, Inc. + * All rights reserved. + */ + +#define DRIVER_PRIVATE + +#import "sys/types.h" +#import +#import +#import "libsaio.h" +#import "memory.h" + +static Biosread(int biosdev, int secno); +static read_label(char *name, int biosdev, daddr_t *boff, int partition); +void diskActivityHook(void); +extern void spinActivityIndicator(void); + +/* diskinfo unpacking */ +#define SPT(di) ((di)&0xff) +#define HEADS(di) ((((di)>>8)&0xff)+1) +#define SPC(di) (SPT(di)*HEADS(di)) +#define BPS 512 /* sector size of the device */ +#define N_CACHE_SECS (BIOS_LEN / BPS) + +#define DOS_BSIZE 512 +#define DISKLABEL 15 /* sector num of disk label */ + +char *devsw[] = { + "sd", + "hd", + "fd", + NULL +}; + +struct diskinfo { + int spt; /* sectors per track */ + int spc; /* sectors per cylinder */ +} diskinfo; + +char *b[NBUFS]; +daddr_t blknos[NBUFS]; +struct iob iob[NFILES]; +int label_secsize; +static int label_cached; + +// intbuf is the whole buffer, biosbuf is the current cached sector +static char * const intbuf = (char *)ptov(BIOS_ADDR); +char *biosbuf; + +void +devopen(name, io) + char * name; + struct iob * io; +{ + long di; + + di = get_diskinfo(io->biosdev); + + /* initialize disk parameters -- spt and spc */ + io->i_error = 0; + io->dirbuf_blkno = -1; + + diskinfo.spt = SPT(di); + diskinfo.spc = diskinfo.spt * HEADS(di); + if (read_label(name, io->biosdev, &io->i_boff, io->partition) < 0) + { + io->i_error = EIO; + } +} + +void devflush() +{ + Biosread(0,-1); +} + + +int devread(io) + struct iob *io; +{ + long sector; + int offset; + int dev; + + io->i_flgs |= F_RDDATA; + + /* assume the best */ + io->i_error = 0; + + dev = io->i_ino.i_dev; + + sector = io->i_bn * (label_secsize/DOS_BSIZE); + + for (offset = 0; offset < io->i_cc; offset += BPS) { + + io->i_error = Biosread(io->biosdev, sector); + if (io->i_error) { + return(-1); + } + + /* copy 1 sector from the internal buffer biosbuf into buf */ + bcopy(biosbuf, &io->i_ma[offset], BPS); + + sector++; + } + + io->i_flgs &= ~F_TYPEMASK; + return (io->i_cc); +} + +/* A haque: Biosread(0,-1) means flush the sector cache. + */ +static int +Biosread(int biosdev, int secno) +{ + static int xbiosdev, xcyl=-1, xhead, xsec, xnsecs; + + int rc; + int cyl, head, sec; + int spt, spc; + int tries = 0; + + if (biosdev == 0 && secno == -1) { + xcyl = -1; + label_cached = 0; + return 0; + } + spt = diskinfo.spt; + spc = diskinfo.spc; + + cyl = secno / spc; + head = (secno % spc) / spt; + sec = secno % spt; + + if (biosdev == xbiosdev && cyl == xcyl && head == xhead && + sec >= xsec && sec < (xsec + xnsecs)) + { // this sector is in intbuf cache + biosbuf = intbuf + (BPS * (sec-xsec)); + return 0; + } + + xcyl = cyl; + label_cached = 1; + xhead = head; + xsec = sec; + xbiosdev = biosdev; + xnsecs = ((sec + N_CACHE_SECS) > spt) ? (spt - sec) : N_CACHE_SECS; + biosbuf = intbuf; + + while ((rc = biosread(biosdev,cyl,head,sec, xnsecs)) && (++tries < 5)) + { +#ifndef SMALL + error(" biosread error 0x%x @ %d, C:%d H:%d S:%d\n", + rc, secno, cyl, head, sec); +#endif + sleep(1); // on disk errors, bleh! + } + diskActivityHook(); + return rc; +} + +// extern char name[]; + +#ifndef SMALL +static int +read_label( + char *name, + int biosdev, + daddr_t *boff, + int partition +) +{ + struct disk_label *dlp; + struct fdisk_part *fd; + struct disk_blk0 *blk0; + char *cp; + int n, rc; + int part_offset = 0; + static int cached_boff; + + if (label_cached) { + *boff = cached_boff; + return 0; + } + + // read sector 0 into the internal buffer "biosbuf" + if ( rc = Biosread(biosdev, 0) ) + return -1; + + // Check for a valid boot block. + blk0 = (struct disk_blk0 *)biosbuf; + if (blk0->signature == DISK_SIGNATURE) { + // Check to see if the disk has been partitioned with FDISK + // to allow DOS and ufs filesystems to exist on the same spindle. + fd = (struct fdisk_part *)blk0->parts; + for ( n = 0; n < FDISK_NPART; n++, fd++) + if (fd->systid == FDISK_NEXTNAME) + { + part_offset = fd->relsect; + break; + } + } + /* It's not an error if there is not a valid boot block. */ + + /* Read the NeXT disk label. + * Since we can't count on it fitting in the sector cache, + * we'll put it elsewhere. + */ + dlp = (struct disk_label *)malloc(sizeof(*dlp) + BPS); + for(n = 0, cp = (char *)dlp; + n < ((sizeof(*dlp) + BPS - 1) / BPS); + n++, cp += BPS) { + if (rc = Biosread(biosdev, DISKLABEL + part_offset + n)) + goto error; + bcopy(biosbuf, cp, BPS); + } + + byte_swap_disklabel_in(dlp); + + /* Check label */ + + if (dlp->dl_version != DL_V3) { + error("bad disk label magic\n"); + goto error; + } + + label_secsize = dlp->dl_secsize; + + if ((dlp->dl_part[partition].p_base) < 0) { + error("no such partition\n"); + goto error; + } + + *boff = cached_boff = dlp->dl_front + dlp->dl_part[partition].p_base; + + if (!strcmp(name,"$LBL")) strcpy(name, dlp->dl_bootfile); + + free((char *)dlp); + return 0; +error: + free((char *)dlp); + return -1; +} + +#endif SMALL + + +/* replace this function if you want to change + * the way disk activity is indicated to the user. + */ + +void +diskActivityHook(void) +{ + spinActivityIndicator(); +} + + + diff --git a/gen/libsaio/errorV.c b/gen/libsaio/errorV.c new file mode 100644 index 0000000..231c7ec --- /dev/null +++ b/gen/libsaio/errorV.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993 NeXT, Inc. + * All rights reserved. + */ + +#import "libsa.h" +#import "saio_types.h" +#import "saio.h" +#import "libsaio.h" +#import "language.h" + +BOOL errors; + +int errorV(const char *format, va_list ap) +{ + char *val; + + val = 0; + errors = 1; + prf(format, ap, putchar, 0); + return 0; +} diff --git a/gen/libsaio/gets.c b/gen/libsaio/gets.c new file mode 100644 index 0000000..5fdc758 --- /dev/null +++ b/gen/libsaio/gets.c @@ -0,0 +1,120 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993, NeXT Computer Inc. + * All rights reserved. + */ + +#import "libsaio.h" + +int gets(char *buf); + +/* + * return a string in buf iff typing is begun within timeout units + */ +int +Gets( + char *buf, + int timeout, + char *prompt, + char *message +) +{ + int ch = 0; + int next_second; + + printf("%s",prompt); + if (message) + printf("%s",message); + if (timeout) { +#if 0 + printf("["); + for (i = 0; i < timeout; i++) + putchar('-'); + printf("]\b\b"); +#endif + + for(next_second = time18() + 18; timeout; ) { + if (ch = readKeyboardStatus()) { + break; + } + if (time18() >= next_second) { + next_second += 18; + timeout--; +#if 0 + printf(" \b\b"); +#endif + } + } +#if 0 + putchar('\r'); + printf("%s",prompt); + for (i = 0; i < strlen(message) + orig_timeout + 4; i++) + putchar(' '); + putchar('\r'); + printf("%s",prompt); +#endif + + if (ch == 0) { + printf("\n"); + return 0; + } + } + return(gets(buf)); +} + +int +gets( + char *buf +) +{ + char *lp; + int c; + + lp = buf; + for (;;) { + c = getchar() & 0x7f; + if (c < ' ' && c != '\n' && c != '\b') c = 0; + if (c == 0x7f) c = '\b'; + + switch(c) { + case '\0': + continue; + case '\n': + *lp++ = '\0'; + putchar('\n'); + return 1; + case '\b': + if (lp > buf) { + lp--; + putchar('\b'); + putchar(' '); + putchar('\b'); + } + continue; + default: + *lp++ = c; + } + } +} diff --git a/gen/libsaio/localPrintf.c b/gen/libsaio/localPrintf.c new file mode 100644 index 0000000..b9b6ad8 --- /dev/null +++ b/gen/libsaio/localPrintf.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993 NeXT Computer, Inc. + * All rights reserved. + */ + +#ifdef SAIO_INTERNAL_USER +#undef SAIO_INTERNAL_USER +#endif +#import "libsa.h" +#import "saio_types.h" +#import "saio.h" +#import "libsaio.h" + + +int localPrintf(const char *format, ...) +{ + va_list ap; + char *val; + + val = 0; + va_start(ap, format); + localVPrintf(format, ap); + va_end(ap); + return 0; +} + +int error(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + errorV(format, ap); + va_end(ap); + return(0); +} diff --git a/gen/libsaio/localVPrintf.c b/gen/libsaio/localVPrintf.c new file mode 100644 index 0000000..e6ce692 --- /dev/null +++ b/gen/libsaio/localVPrintf.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993 NeXT Computer, Inc. + * All rights reserved. + */ + +#import "libsa.h" +#import "saio_types.h" +#import "saio.h" +#import "libsaio.h" +#import "language.h" + + +int localVPrintf(const char *format, va_list ap) +{ + char *val; + + val = 0; + if (LanguageConfig) { + if (val = (char *)newStringForStringTableKey(LanguageConfig, + (char *)format)) { + format = val; + } + } + prf(format, ap, putchar, 0); + if (val) { + free(val); + } + return 0; +} diff --git a/gen/libsaio/printf.c b/gen/libsaio/printf.c new file mode 100644 index 0000000..f282f6e --- /dev/null +++ b/gen/libsaio/printf.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* Standalone I/O stubs. */ + +#import "libsa.h" +#import "saio_types.h" +#import "saio.h" +#import "libsaio.h" + +int printf(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + prf(format, ap, putchar, 0); + va_end(ap); + return 0; +} + diff --git a/gen/libsaio/reallyPrint.c b/gen/libsaio/reallyPrint.c new file mode 100644 index 0000000..b47ad07 --- /dev/null +++ b/gen/libsaio/reallyPrint.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993 NeXT, Inc. + * All rights reserved. + */ + +#import "libsaio.h" +#import "console.h" + +int +reallyPrint(const char *fmt, ...) +{ + va_list ap; + int tShow = showText; + + va_start(ap, fmt); + showText = 1; + prf(fmt, ap, putchar, 0); + va_end(ap); + showText = tShow; + return 0; +} + + diff --git a/gen/libsaio/stringTable.c b/gen/libsaio/stringTable.c new file mode 100644 index 0000000..66f10e9 --- /dev/null +++ b/gen/libsaio/stringTable.c @@ -0,0 +1,570 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. 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 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource 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 OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright 1993 NeXT, Inc. + * All rights reserved. + */ + +#import "libsaio.h" +#import "kernBootStruct.h" +#import + +extern KERNBOOTSTRUCT *kernBootStruct; +extern char *Language; +extern char *LoadableFamilies; + +static void eatThru(char val, char **table_p); + +static inline int isspace(char c) +{ + return (c == ' ' || c == '\t'); +} + +/* + * Compare a string to a key with quoted characters + */ +static inline int +keyncmp(char *str, char *key, int n) +{ + 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; + } + } + return 0; +} + +static void eatThru(char val, char **table_p) +{ + register char *table = *table_p; + register BOOL found = NO; + + while (*table && !found) + { + if (*table == '\\') table += 2; + else + { + if (*table == val) found = YES; + table++; + } + } + *table_p = table; +} + +char * +newStringFromList( + char **list, + int *size +) +{ + char *begin = *list, *end; + char *newstr; + int newsize = *size; + + while (*begin && newsize && isspace(*begin)) { + begin++; + newsize--; + } + end = begin; + while (*end && newsize && !isspace(*end)) { + end++; + newsize--; + } + if (begin == end) + return 0; + newstr = malloc(end - begin + 1); + strncpy(newstr, begin, end - begin); + *list = end; + *size = newsize; + return newstr; +} + +/* + * compress == compress escaped characters to one character + */ +int stringLength(char *table, int compress) +{ + int ret = 0; + + while (*table) + { + if (*table == '\\') + { + table += 2; + ret += 1 + (compress ? 0 : 1); + } + else + { + if (*table == '\"') return ret; + ret++; + table++; + } + } + return ret; +} + + +// looks in table for strings of format << "key" = "value"; >> +// or << "key"; >> +BOOL getValueForStringTableKey(char *table, char *key, char **val, int *size) +{ + int keyLength; + char *tableKey; + + do + { + eatThru('\"',&table); + tableKey = table; + keyLength = strlen(key); + if (keyLength && + (stringLength(table,1) == keyLength) && + (keyncmp(key, table, keyLength) == 0)) + { + int c; + + /* found the key; now look for either + * '=' or ';' + */ + while (c = *table) { + ++table; + if (c == '\\') { + ++table; + continue; + } else if (c == '=' || c == ';') { + break; + } + } + if (c == ';') { + table = tableKey; + } else { + eatThru('\"',&table); + } + *val = table; + *size = stringLength(table,0); + return YES; + } + + eatThru(';',&table); + + } while (*table); + + return NO; +} + + +/* + * Returns a new malloc'ed string if one is found + * in the string table matching 'key'. Also translates + * \n escapes in the string. + */ +char *newStringForStringTableKey( + char *table, + char *key +) +{ + char *val, *newstr, *p; + int size; + + if (getValueForStringTableKey(table, key, &val, &size)) { + newstr = 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--; + } + } + *p = '\0'; + return newstr; + } else { + return 0; + } +} + +char * +newStringForKey(char *key) +{ + char *val, *newstr; + int size; + + if (getValueForKey(key, &val, &size) && size) { + newstr = malloc(size + 1); + strncpy(newstr, val, size); + return newstr; + } else { + return 0; + } +} + +/* parse a command line + * in the form: [ ...] [