APPLE PUBLIC SOURCE LICENSE
-Version 1.1 - April 19,1999
+Version 2.0 - August 6, 2003
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
+By downloading or 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") makes publicly available 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 2.0 ("License"). As used in
+this License:
+
+1.1 "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
owned by or assigned to You and (ii) that cover subject matter in Your
Modifications, taken alone or in combination with Original Code.
+1.2 "Contributor" means any person or entity that creates or
+contributes to the creation of Modifications.
+
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.4 "Externally Deploy" means: (a) to sublicense, distribute or
+otherwise make Covered Code available, directly or indirectly, to
+anyone other than You; and/or (b) to use Covered Code, alone or as
+part of a Larger Work, in any way to provide a service, including but
+not limited to delivery of content, through electronic communication
+with a client other than You.
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
+to, the substance and/or structure of the Original Code, any previous
+Modifications, the combination of Original Code and any previous
+Modifications, and/or any respective portions thereof. 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
(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"
+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,
(50%) or more of the outstanding shares or beneficial ownership of
such entity.
-2. Permitted Uses; Conditions & Restrictions. Subject to the terms
+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
+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
+2.1 Unmodified Code. You may use, reproduce, display, perform,
+internally distribute within Your organization, and Externally Deploy
+verbatim, unmodified copies of the Original Code, for commercial or
+non-commercial purposes, provided that in each instance:
+
+(a) You must 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; and
+
+(b) You must include a copy of this License with every copy of Source
+Code of Covered Code and documentation You distribute or Externally
+Deploy, 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.
+
+2.2 Modified Code. You may modify Covered Code and use, reproduce,
+display, perform, internally distribute within Your organization, and
+Externally Deploy Your Modifications and Covered Code, for commercial
+or non-commercial purposes, provided that in each instance You also
+meet all of these conditions:
+
+(a) You must satisfy all the conditions of Section 2.1 with respect to
+the Source Code of the Covered Code;
+
+(b) You must duplicate, to the extent it does not already exist, the
+notice in Exhibit A in each file of the Source Code of all Your
+Modifications, and cause the modified files to carry prominent notices
+stating that You changed the files and the date of any change; and
+
+(c) If You Externally Deploy Your Modifications, You must make
+Source Code of all Your Externally Deployed Modifications either
+available to those to whom You have Externally Deployed Your
+Modifications, or publicly available. Source Code of Your Externally
+Deployed Modifications must be released under the terms set forth in
+this License, including the license grants set forth in Section 3
+below, for as long as you Externally Deploy the Covered Code or twelve
+(12) months from the date of initial External Deployment, whichever is
+longer. You should preferably distribute the Source Code of Your
+Externally Deployed Modifications electronically (e.g. download from a
+web site).
+
+2.3 Distribution of Executable Versions. In addition, if You
+Externally Deploy Covered Code (Original Code and/or Modifications) in
+object code, executable form only, You must 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.
+
+2.4 Third Party Rights. You expressly acknowledge and agree that
+although Apple and each Contributor grants the licenses to their
+respective portions of the Covered Code set forth herein, no
+assurances are provided by Apple or any Contributor that the Covered
+Code does not infringe the patent or other intellectual property
+rights of any other entity. Apple and each Contributor disclaim any
+liability to You for claims brought by any other entity based on
+infringement of intellectual property rights or otherwise. As a
+condition to exercising the rights and licenses granted hereunder, You
+hereby assume sole responsibility to secure any other intellectual
+property rights needed, if any. For example, if a third party patent
+license is required to allow You to distribute the Covered Code, it is
+Your responsibility to acquire that license before distributing the
+Covered Code.
+
+3. Your Grants. In consideration of, and as a condition to, the
+licenses granted to You under this License, You hereby grant to any
+person or entity receiving or distributing Covered Code under this
+License a non-exclusive, royalty-free, perpetual, irrevocable license,
+under Your Applicable Patent Rights and other intellectual property
+rights (other than patent) owned or controlled by You, to use,
+reproduce, display, perform, modify, sublicense, distribute and
+Externally Deploy Your Modifications of the same scope and extent as
+Apple's licenses under Sections 2.1 and 2.2 above.
+
+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.
+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
+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
+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 or any Contributor. 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 and every Contributor harmless for any liability
+incurred by or claims asserted against Apple or such Contributor 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.
+8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in
+part pre-release, untested, or not fully tested works. The Covered
+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 Covered Code, or any portion thereof, is at
+Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND
+WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND APPLE AND
+APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE" FOR THE
+PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM
+ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT
+NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF
+MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR
+PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST
+INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE
+FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS,
+THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR
+ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO
+ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE
+AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY.
+You acknowledge that the Covered 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 Covered Code could lead to death, personal injury, or severe
+physical or environmental damage.
+
+9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO
+EVENT SHALL APPLE OR ANY CONTRIBUTOR 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 COVERED CODE, OR
+ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY,
+TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF
+APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY
+REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF
+INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY
+TO YOU. In no event shall Apple's total liability to You for all
+damages (other than as may be required by applicable law) 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", "Mac OS",
+"QuickTime", "QuickTime Streaming Server" or any other trademarks,
+service marks, logos or trade names belonging to Apple (collectively
+"Apple Marks") or to any trademark, service mark, logo or trade name
+belonging to any Contributor. You agree not to use any Apple Marks in
+or as part of the name of products derived from the Original Code or
+to endorse or promote products derived from the Original Code other
+than as expressly 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. Subject to the licenses granted under this License,
+each Contributor retains all rights, title and interest in and to any
+Modifications made by such Contributor. 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.
12. Termination.
-12.1 Termination. This License and the rights granted hereunder will
- terminate:
+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
+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; provided that Apple did not first commence
+an action for patent infringement against You in that instance.
+
+12.2 Effect of Termination. Upon termination, You agree to immediately
+stop any further use, reproduction, modification, sublicensing and
+distribution of the Covered Code. 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. No party will be liable to any 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
+any 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.
+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
+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.
+legal association between or among You, Apple or any Contributor, 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
+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.4 Waiver; Construction. Failure by Apple or any Contributor 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
+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,
+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
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
+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
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
+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
+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.
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.
+"Portions Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+compliance with the License. Please obtain a copy of the License at
+http://www.opensource.apple.com/apsl/ and read it before using this
+file.
The Original Code and all software distributed under the License are
-distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+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."
+FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+Please see the License for the specific language governing rights and
+limitations under the License."
VPATH = $(OBJROOT):$(SYMROOT)
-GENERIC_SUBDIRS = gen
+GENERIC_SUBDIRS =
#
# Currently builds for i386
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#define DRIVER_PRIVATE
#import "sys/types.h"
-#import <dev/disk.h>
+#import <sys/disk.h>
#import <dev/i386/disk.h>
#import "libsaio.h"
#import "memory.h"
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*/
#import "libsaio.h"
-#import "kernBootStruct.h"
+#import "bootstruct.h"
#import <driverkit/configTablePrivate.h>
-extern KERNBOOTSTRUCT *kernBootStruct;
extern char *Language;
extern char *LoadableFamilies;
int *size
)
{
- if (getValueForBootKey(kernBootStruct->bootString, key, val, size))
+ if (getValueForBootKey(bootArgs->bootString, key, val, size))
return YES;
- else if (getValueForStringTableKey(kernBootStruct->config, key, val, size))
+ else if (getValueForStringTableKey(bootArgs->config, key, val, size))
return YES;
return NO;
int
loadConfigFile( char *configFile, char **table, int allocTable)
{
- char *configPtr = kernBootStruct->configEnd;
+ char *configPtr = bootArgs->configEnd;
int fd, count;
/* Read config file into memory */
if (allocTable) {
configPtr = malloc(file_size(fd)+2);
} else {
- if ((configPtr - kernBootStruct->config) > CONFIG_SIZE) {
+ if ((configPtr - bootArgs->config) > CONFIG_SIZE) {
error("No room in memory for config file %s\n",configFile);
close(fd);
return -1;
*configPtr++ = 0;
*configPtr = 0;
if (!allocTable)
- kernBootStruct->configEnd = configPtr;
+ bootArgs->configEnd = configPtr;
return 0;
} else {
error("Warning: No active drivers specified in system config\n");
}
- kernBootStruct->first_addr0 =
- (int)kernBootStruct->configEnd + 1024;
+ bootArgs->first_addr0 =
+ (int)bootArgs->configEnd + 1024;
return 0;
}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#import <ufs/fs.h>
#import <ufs/fsdir.h>
#import <sys/reboot.h>
-#import <architecture/byte_order.h>
+#import <libkern/OSByteOrder.h>
#import "libsaio.h"
#import "cache.h"
#import "kernBootStruct.h"
// for now it is little endian FS for intel
nb = bap[i];
#else
- nb = NXSwapBigLongToHost(bap[i]);
+ nb = OSSwapBigToHostInt32(bap[i]);
#endif 1
#else BIG_ENDIAN_FS
nb = bap[i];
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#import <sys/param.h>
#import <sys/vnode.h>
#import <ufs/fsdir.h>
-#import <architecture/byte_order.h>
+#include <libkern/OSByteOrder.h>
#import "ufs_byteorder.h"
#import "libsaio.h"
-#define swapBigLongToHost(thing) ((thing) = NXSwapBigLongToHost(thing))
-#define swapBigShortToHost(thing) ((thing) = NXSwapBigShortToHost(thing))
+#define swapBigLongToHost(thing) ((thing) = OSSwapBigToHostInt32(thing))
+#define swapBigShortToHost(thing) ((thing) = OSSwapBigToHostInt16(thing))
void
swapBigIntsToHost(int *array, int count)
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#import <sys/disktab.h>
#import <sys/vnode.h>
#import <sys/buf.h>
-#import <dev/disk.h>
+#import <sys/disk.h>
#import <ufs/fs.h>
#import <ufs/inode.h>
+#include <IOKit/storage/IONeXTPartitionScheme.h>
+
void byte_swap_ints(int *array, int count);
void byte_swap_shorts(short *array, int count);
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <mach/mach.h>
#include <sys/file.h>
#include <mach-o/loader.h>
-#include <architecture/byte_order.h>
+#include <libkern/OSByteOrder.h>
int infile, outfile;
)
{
if (swap_ends)
- return NXSwapLong(x);
+ return OSSwapInt32(x);
else
return x;
}
VPATH = $(OBJROOT):$(SYMROOT)
-# SUBDIRS = rcz util libsa libsaio sarld nasm boot2 boot1 boot0 strings
-SUBDIRS = rcz util libsa libsaio nasm boot2 boot1 boot0 strings
+# The order of building is important.
+SUBDIRS = rcz util libsa libsaio nasm boot2 boot1 boot1u boot0 cdboot strings
all tags clean debug install installhdrs:
@for i in ${SUBDIRS}; \
-; Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+; Copyright (c) 1999-2002 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.
+; Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
;
; The Original Code and all software distributed under the License are
-; distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; 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.
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
+; limitations under the License.
;
; @APPLE_LICENSE_HEADER_END@
;
; Boot Loader: boot0
;
; A small boot sector program written in x86 assembly whose only
-; responsibility is to locate the booter partition, load the
-; booter into memory, and jump to the booter's entry point.
-; The booter partition can be a primary or a logical partition.
+; responsibility is to locate the active partition, load the
+; partition booter into memory, and jump to the booter's entry point.
+; It leaves the boot drive in DL and a pointer to the partition entry in SI.
;
-; This boot loader can be placed at any of the following places:
-; 1. Master Boot Record (MBR)
-; 2. Boot sector of an extended partition
-; 3. Boot sector of a primary partition
-; 4. Boot sector of a logical partition
+; This boot loader must be placed in the Master Boot Record.
;
; In order to coexist with a fdisk partition table (64 bytes), and
; leave room for a two byte signature (0xAA55) in the end, boot0 is
DEBUG EQU 0
;
-; Set to 1 to support loading the booter (boot2) from a
+; Set to 1 to support loading the partition booter (boot1) from a
; logical partition.
;
EXT_PART_SUPPORT EQU 1
kMBRPartTable EQU kMBRBuffer + kPartTableOffset
kExtPartTable EQU kExtBuffer + kPartTableOffset
-kBoot2Sectors EQU 112 ; sectors to load for boot2
-kBoot2Address EQU 0x0000 ; boot2 load address
-kBoot2Segment EQU 0x2000 ; boot2 load segment
-
kSectorBytes EQU 512 ; sector size in bytes
kBootSignature EQU 0xAA55 ; boot sector signature
kPartTypeExtWin EQU 0x0f ; Windows extended partition type
kPartTypeExtLinux EQU 0x85 ; Linux extended partition type
+kPartActive EQU 0x80
+
%ifdef FLOPPY
kDriveNumber EQU 0x00
%else
kDriveNumber EQU 0x80
%endif
-;
-; In memory variables.
-;
-ebios_lba dd 0 ; starting LBA of the intial extended partition.
-read_func dw 0 ; pointer to the LBA or CHS read function
-
;
; Format of fdisk partition entry.
;
; Clear various flags in memory.
;
xor eax, eax
- mov [ebios_lba], eax ; clear EBIOS LBA offset
- mov WORD [read_func], read_chs ; assume CHS support
-
- ;
- ; Since this code may not always reside in the MBR, always start by
- ; loading the MBR to kMBRBuffer.
- ;
- mov al, 1 ; load one sector
- xor bx, bx
- mov es, bx ; MBR load segment = 0
- mov bx, kMBRBuffer ; MBR load address
- mov si, bx ; pointer to fake partition entry
- mov WORD [si], 0x0000 ; CHS DX: head = 0
- mov WORD [si + 2], 0x0001 ; CHS CX: cylinder = 0, sector = 1
-
- call load
- jc .next_drive ; MBR load error
+ mov [ebios_lba], eax ; clear EBIOS LBA offset
+ mov [ebios_present], al ; clear EBIOS support flag
;
; Check if EBIOS is supported for this hard drive.
cmp bx, 0xAA55 ; check BX = 0xAA55
jnz .ebios_check_done
test cl, 0x01 ; check enhanced drive read support
- mov WORD [read_func], read_lba ; use read_lba for reads
+ setnz [ebios_present] ; EBIOS supported, set flag
DebugChar('E') ; EBIOS supported
.ebios_check_done:
+ ;
+ ; Since this code may not always reside in the MBR, always start by
+ ; loading the MBR to kMBRBuffer.
+ ;
+ mov al, 1 ; load one sector
+ xor bx, bx
+ mov es, bx ; MBR load segment = 0
+ mov bx, kMBRBuffer ; MBR load address
+ mov si, bx ; pointer to fake partition entry
+ mov WORD [si], 0x0000 ; CHS DX: head = 0
+ mov WORD [si + 2], 0x0001 ; CHS CX: cylinder = 0, sector = 1
+
+ call load
+ jc .next_drive ; MBR load error
+
;
; Look for the booter partition in the MBR partition table,
; which is at offset kMBRPartTable.
jmp SHORT hang
;--------------------------------------------------------------------------
-; Find the boot partition and load the booter from the partition.
+; Find the active (boot) partition and load the booter from the partition.
;
; Arguments:
; AH = recursion nesting level
.loop:
;
- ; First scan through the partition table looking for the boot
+ ; First scan through the partition table looking for the active
; partition. Postpone walking the extended partition chain for
; the second pass. Do not merge the two without changing the
; buffering scheme used to store extended partition tables.
call print_hex
%endif
- cmp BYTE [si + part.type], kPartTypeBoot
+ cmp BYTE [si + part.bootid], kPartActive
jne .continue
+ DebugChar('*')
+
;
- ; Found boot partition, read boot2 image to memory.
+ ; Found boot partition, read boot sector to memory.
;
- mov al, kBoot2Sectors
- mov bx, kBoot2Segment
+ mov al, 1
+ mov bx, kBoot0Segment
mov es, bx
- mov bx, kBoot2Address
+ mov bx, kBoot0LoadAddr
call load ; will not return on success
jc .continue ; load error, keep looking?
+ ;
+ ; Fix up absolute block location in partition record.
;
- ; Jump to boot2. The drive number is already in register DL.
+ mov eax, [si + part.lba]
+ add eax, [ebios_lba]
+ mov [si + part.lba], eax
+
;
- ; The first sector loaded from the disk is reserved for the boot
- ; block (boot0), adjust the jump location by adding a sector offset.
+ ; Jump to partition booter. The drive number is already in register DL.
+ ; SI is pointing to the modified partition entry.
;
- jmp kBoot2Segment:kBoot2Address + kSectorBytes
+ jmp kBoot0Segment:kBoot0LoadAddr
.continue:
add si, part_size ; advance SI to next partition entry
;
load:
push cx
- mov cx, 5 ; number of times to retry
+ test BYTE [ebios_present], 1
+ jz .chs
-.loop:
- call [read_func] ; call either read_chs or read_lba
- jnc .exit ; load success
- loop .loop ; retry on error
+.ebios:
+ mov cx, 5 ; load retry count
+.ebios_loop:
+ call read_lba ; use INT13/F42
+ jnc .exit
+ loop .ebios_loop
-.exit:
+.chs:
+ mov cx, 5 ; load retry count
+.chs_loop:
+ call read_chs ; use INT13/F2
+ jnc .exit
+ loop .chs_loop
+
+.exit
pop cx
ret
int 0x13 ; INT 13
jnc .exit
- DebugChar('e') ; indicate INT13/F2 error
+ DebugChar('r') ; indicate INT13/F2 error
;
; Issue a disk reset on error.
jnc .exit
- DebugChar('E') ; indicate INT13/F42 error
+ DebugChar('R') ; indicate INT13/F42 error
;
; Issue a disk reset on error.
.exit
ret
-%if DEBUG
+%if DEBUG
+
;--------------------------------------------------------------------------
; Write a ASCII character to the console.
;
call print_char
ret
+getc:
+ pusha
+ mov ah, 0
+ int 0x16
+ popa
+ ret
+
%endif ; DEBUG
;--------------------------------------------------------------------------
; NULL terminated strings.
;
-boot_error_str db 10, 13, 'Boot Error', 0
+boot_error_str db 10, 13, 'Error', 0
;--------------------------------------------------------------------------
; Pad the rest of the 512 byte sized booter with zeroes. The last
; If the booter code becomes too large, then nasm will complain
; that the 'times' argument is negative.
+;
+; In memory variables.
+;
+ebios_lba dd 0 ; starting LBA of the intial extended partition.
+ebios_present db 0 ; 1 if EBIOS is supported, 0 otherwise.
+
pad_boot
times 446-($-$$) db 0
NASM = $(SYMROOT)/nasm
-VERSIONED_FILES = boot1 boot1f
+VERSIONED_FILES = boot1h boot1f
VERS = `vers_string -f 5.0 | tr - .`
-NEW_VERS = Rhapsody boot1 v$(VERS)
+NEW_VERS = Darwin boot1h v$(VERS)
ifneq "" "$(wildcard /bin/mkdirs)"
MKDIRS = /bin/mkdirs
else
all: $(DIRS_NEEDED) $(VERSIONED_FILES)
-boot1: boot1.s Makefile
+boot1h: boot1.s Makefile
$(NASM) -dBOOTDEV=HDISK -dVERS="'$(NEW_VERS)'" boot1.s -o $(SYMROOT)/$@
boot1f: boot1.s Makefile
$(NASM) -dBOOTDEV=FLOPPY -dVERS="'$(NEW_VERS)'" boot1.s -o $(SYMROOT)/$@
install_i386:: all $(INSTALLDIR)
- cp $(SYMROOT)/boot1 $(INSTALLDIR)/
+ cp $(SYMROOT)/boot1h $(INSTALLDIR)/
cp $(SYMROOT)/boot1f $(INSTALLDIR)/
cd $(INSTALLDIR); chmod u+w $(VERSIONED_FILES)
-; Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+; Copyright (c) 1999-2002 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.
+; Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
;
; The Original Code and all software distributed under the License are
-; distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; 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.
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
+; limitations under the License.
;
; @APPLE_LICENSE_HEADER_END@
;
-; Boot Loader: boot0
+; Partition Boot Loader: boot1h
;
-; A small boot sector program written in x86 assembly whose only
-; responsibility is to locate the booter partition, load the
-; booter into memory, and jump to the booter's entry point.
-; The booter partition can be a primary or a logical partition.
-; But the booter partition must reside within the 8GB limit
-; imposed by CHS addressing + translation.
+; This program is designed to reside in sector 0 of an HFS+ partition.
+; The HFS+ partition can be a primary or a logical partition.
+; It expects that the MBR has left the drive number in DL
+; and a pointer to the partition entry in SI.
;
-; This boot loader can be placed at any of the following places:
-; * Master Boot Record (MBR)
-; * Boot sector of an extended partition
-; * Boot sector of a primary partition
-; * Boot sector of a logical partition
-;
-; In order to coexist with a fdisk partition table (64 bytes), and
-; leave room for a two byte signature (0xAA55) in the end, boot0 is
-; restricted to 446 bytes (512 - 64 - 2). If boot0 did not have to
-; live in the MBR, then we would have 510 bytes to play with.
-;
-; boot0 is always loaded by the BIOS or another first level booter
-; to 0:7C00h.
+; This version requires a BIOS with EBIOS (LBA) support.
;
; This code is written for the NASM assembler.
; nasm boot0.s -o boot0
-;--------------------------------------------------------------------------
-; Constants.
-
-FLOPPY EQU 0x00 ; floppy dev number
-HDISK EQU 0x80 ; hard drive dev number
-DEBUG EQU 0 ; enable debugging output
-
-BOOTSEG EQU 0x0 ; our sole segment
-BOOTSP EQU 0xFFF0 ; stack pointer
-BOOTLOAD EQU 0x7C00 ; booter load address
-BOOTRELOC EQU 0xE000 ; booter is relocated here
-BOOTSIG EQU 0xAA55 ; booter signature
-
-BOOT2_SIZE EQU 112 ; load this many blocks for boot2
-BOOT2_ADDR EQU 0x0200 ; where to load boot2
-BOOT2_SEG EQU 0x2000
-
-%IF BOOTDEV = FLOPPY
-DRIVE_NUM EQU FLOPPY ; floppy drive
-%ELSE
-DRIVE_NUM EQU HDISK ; "C" drive
-%ENDIF
-SECTOR_BYTES EQU 512 ; sector size in bytes
-
-BUF_MBR EQU 0x1000 ; memory buffer for MBR
-BUF_EXT EQU 0x1200 ; memory buffer for extended partition
-
-TABLE_MAIN EQU BUF_MBR + 0x1be ; location of main partition table
-TABLE_EXT EQU BUF_EXT + 0x1be ; location of ext partition table
-ENTRY_SIZE EQU 16 ; size of each fdisk partition entry
-TYPE_BOOT EQU 0xab ; partition type we are looking for
-TYPE_EXT EQU 0x05 ; extended partition type
-TYPE_EXT_1 EQU 0x0f ; Windows extended partition
-TYPE_EXT_2 EQU 0x85 ; Linux extended partition
-EXT_LEVELS_MAX EQU 128 ; max extended partition levels
+;
+; Set to 1 to enable obscure debug messages.
+;
+DEBUG EQU 0
+;
+; Set to 1 to support loading the booter (boot2) from a
+; logical partition.
+;
+EXT_PART_SUPPORT EQU 0
-;--------------------------------------------------------------------------
-; Start of text segment.
+;
+; Various constants.
+;
+kBoot0Segment EQU 0x0000
+kBoot0Stack EQU 0xFFF0 ; boot0 stack pointer
+kBoot0LoadAddr EQU 0x7C00 ; boot0 load address
+kBoot0RelocAddr EQU 0xE000 ; boot0 relocated address
- SEGMENT .text
+ebios_lba EQU 0xEF00 ; storage for variables
- ORG 0xE000 ; must match BOOTRELOC
+kMBRBuffer EQU 0x1000 ; MBR buffer address
+kExtBuffer EQU 0x1200 ; EXT boot block buffer address
-;--------------------------------------------------------------------------
-; Loaded at 0:7c00h.
-;
-start
- ; Set up the stack to grow down from BOOTSEG:BOOTSP.
- ; Interrupts should be off while the stack is being manipulated.
- ;
- cli ; interrupts off
- mov ax, BOOTSEG ;
- mov ss, ax ; ss <- BOOTSEG
- mov sp, BOOTSP ; sp <- BOOTSP
- sti ; reenable interrupts
+kPartTableOffset EQU 0x1be
+kMBRPartTable EQU kMBRBuffer + kPartTableOffset
+kExtPartTable EQU kExtBuffer + kPartTableOffset
- ; Relocate the booter code from DS:SI to ES:DI,
- ; or from 0:7C00h to BOOTSEG:BOOTRELOC.
- ;
- mov es, ax ; es <- BOOTSEG
- mov ds, ax ; ds <- BOOTSEG
+kBoot2Sectors EQU 112 ; sectors to load for boot2
+kBoot2Address EQU 0x0000 ; boot2 load address
+kBoot2Segment EQU 0x2000 ; boot2 load segment
- mov si, BOOTLOAD ; si <- BOOTLOAD (source)
- mov di, BOOTRELOC ; di <- BOOTRELOC (destination)
- ;
- cld ; auto-increment SI and/or DI registers
- mov cx, 256 ; copy 256 words (512 bytes)
- repnz movsw ; repeat string move (word) operation
+kSectorBytes EQU 512 ; sector size in bytes
+kBootSignature EQU 0xAA55 ; boot sector signature
- ; Code relocated, jump to start_reloc in relocated location.
- ;
- jmp BOOTSEG:start_reloc
+kPartCount EQU 4 ; number of paritions per table
+kPartTypeBoot EQU 0xab ; boot2 partition type
+kPartTypeHFS EQU 0xaf
+kPartTypeExtDOS EQU 0x05 ; DOS extended partition type
+kPartTypeExtWin EQU 0x0f ; Windows extended partition type
+kPartTypeExtLinux EQU 0x85 ; Linux extended partition type
+
+kPartActive EQU 0x80
-;--------------------------------------------------------------------------
-; Start execution from the relocated location.
-;
-start_reloc
- mov al, '=' ; indicate execution start
- call putchar
+;;
+;; HFS constants
+;;
+kHFSSig EQU 0x4442 ; HFS volume signature
+kAlBlStOffset EQU 0x1c
+kEmbedStartOffset EQU 0x7e
+kAlBlkSizOffset EQU 0x14
- ; Get disk parameters (CHS) using INT13/F8 call.
- ;
- mov dl, DRIVE_NUM ; boot drive is drive C
- mov ah, 8 ; Read Disk Driver Parameter function
- int 0x13
- and cl, 0x3f ; sectors/track
- mov [max_sectors], cl
- mov [max_heads], dh
- jc error
+;;
+;; HFS+ constants
+;;
+kHFSPlusSig EQU 0x2B48 ; HFS+ volume signature
+kBlockSizeOffset EQU 0x28
+kExtentOffset EQU 0x1c0
+
+kHFSBuffer EQU 0x1400 ; HFS volume header address
- mov al, '>' ; indicate INT13/F8 success
- call putchar
+kHFSSigAddr EQU kHFSBuffer
+kHFSAlBlSt EQU kHFSBuffer + kAlBlStOffset
+kHFSEmbedStart EQU kHFSBuffer + kEmbedStartOffset
+kHFSAlBlkSiz EQU kHFSBuffer + kAlBlkSizOffset
- ; Since this code may not always reside in the MBR, we will always
- ; start by loading the MBR to BUF_MBR.
- ;
- mov WORD [chs_cx], 0x0001 ; cyl = 0, sect = 1
- mov BYTE [chs_dx + 1], 0 ; head = 0
- xor cx, cx ; skip 0 sectors
- mov ax, 1 ; read 1 sector
- mov bx, BUF_MBR ; load buffer
- call load
- jc error
+kHFSPlusSigAddr EQU kHFSBuffer
+kHFSPlusBlockSize EQU kHFSBuffer + kBlockSizeOffset
+kHFSPlusExtent EQU kHFSBuffer + kExtentOffset
- mov di, TABLE_MAIN ; argument for find_booter
- cmp WORD [di + 64], BOOTSIG ; correct signature found?
- jne error ; Oops! no signature!
- mov bl, TYPE_BOOT ; look for this partition type
- mov bh, 0 ; initial nesting level is 0
- call find_booter
-error
- mov si, load_error
- call message
-hang_1
- jmp hang_1
+%ifdef FLOPPY
+kDriveNumber EQU 0x00
+%else
+kDriveNumber EQU 0x80
+%endif
-;--------------------------------------------------------------------------
-; Locate the booter partition and load the booter.
;
-; Arguments:
-; di - pointer to fdisk partition table.
-; bl - partition type to look for.
+; Format of fdisk partition entry.
;
-; The following registers are modified:
-; ax, bh
+; The symbol 'part_size' is automatically defined as an `EQU'
+; giving the size of the structure.
;
-find_booter
- push cx
- push si
-
- mov si, di ; si <- pointer to partition table
- mov cx, 4 ; 4 partition entries per table
+ struc part
+.bootid: resb 1 ; bootable or not
+.head: resb 1 ; starting head, sector, cylinder
+.sect: resb 1 ;
+.cyl: resb 1 ;
+.type: resb 1 ; partition type
+.endhead resb 1 ; ending head, sector, cylinder
+.endsect: resb 1 ;
+.endcyl: resb 1 ;
+.lba: resd 1 ; starting lba
+.sectors resd 1 ; size in sectors
+ endstruc
-find_booter_pri
- ;
- ; Hunt for a fdisk partition type that matches the value in bl.
- ;
-%IF DEBUG
- mov al, bh ; log partition type seen
- call putspace
- mov al, [si + 4]
- call display_byte
-%ENDIF
+;
+; Macros.
+;
+%macro DebugCharMacro 1
+ mov al, %1
+ call print_char
+ call getc
+%endmacro
- cmp BYTE [si + 4], bl ; Is this the booter partition?
- je load_booter ; yes, load the booter
+%if DEBUG
+%define DebugChar(x) DebugCharMacro x
+%else
+%define DebugChar(x)
+%endif
+
+
+;--------------------------------------------------------------------------
+; Start of text segment.
- add si, ENTRY_SIZE ; si <- next partition entry
- loop find_booter_pri ; loop while cx is not zero
+ SEGMENT .text
- ; No primary (or perhaps logical) booter partition found in the
- ; current partition table. Restart and look for extended partitions.
- ;
- mov si, di ; si <- pointer to partition table
- mov cx, 4 ; 4 partition entries per table
+ ORG 0xE000 ; must match kBoot0RelocAddr
-find_booter_ext
+;--------------------------------------------------------------------------
+; Boot code is loaded at 0:7C00h.
+;
+start
;
- ; Look for extended partition entries in the partition table.
+ ; Set up the stack to grow down from kBoot0Segment:kBoot0Stack.
+ ; Interrupts should be off while the stack is being manipulated.
;
-%IF DEBUG
- mov al, bh ; log partition type seen
- call putspace
- mov al, 'E'
- call putchar
- mov al, [si + 4]
- call display_byte
-%ENDIF
+ cli ; interrupts off
+ xor ax, ax ; zero ax
+ mov ss, ax ; ss <- 0
+ mov sp, kBoot0Stack ; sp <- top of stack
+ sti ; reenable interrupts
- cmp BYTE [si + 4], TYPE_EXT ; Is this an extended partition?
- je find_booter_ext_2 ; yes, load its partition table
+ mov es, ax ; es <- 0
+ mov ds, ax ; ds <- 0
- cmp BYTE [si + 4], TYPE_EXT_1 ; Is this an extended partition?
- je find_booter_ext_2 ; yes, load its partition table
+ DebugChar('H')
- cmp BYTE [si + 4], TYPE_EXT_2 ; Is this an extended partition?
- je find_booter_ext_2 ; yes, load its partition table
+%if DEBUG
+ mov eax, [si + part.lba]
+ call print_hex
+%endif
-find_booter_ext_1
;
- ; si is not pointing to an extended partition entry,
- ; try the next entry in the partition table.
+ ; Clear various flags in memory.
;
- add si, ENTRY_SIZE ; si <- next partition entry
- loop find_booter_ext ; loop while cx is not zero
-
- jmp find_booter_end ; give up
-
-find_booter_ext_2
- cmp bh, EXT_LEVELS_MAX
- ja find_booter_end ; in too deep!
-
- inc bh ; increment nesting level counter
-
- ; Prepare the arguments for the load function call to
- ; load the extended partition table into memory.
- ; Note that si points to the extended partition entry.
- ;
- mov ax, [si] ; DH/DL
- mov [chs_dx], ax
- mov ax, [si + 2] ; CH/CL
- mov [chs_cx], ax
- pusha
- xor cx, cx ; skip 0 sectors
- mov ax, 1 ; read 1 sector
- mov bx, BUF_EXT ; load to BUF_EXT
+ xor eax, eax
+ mov [ebios_lba], eax ; clear EBIOS LBA offset
+
+ cmp BYTE [si + part.type], kPartTypeHFS
+ jne .part_err
+ cmp BYTE [si + part.bootid], kPartActive
+ jne .part_err
+
+ jmp find_startup
+
+.part_err:
+ DebugChar('P')
+ jmp hang
+
+;;; ---------------------------------------
+;;;
+;;; find_startup - Find HFS+ startup file in a partition.
+;;;
+;;; Arguments:
+;;; DL = drive number (0x80 + unit number)
+;;; SI = pointer to the partition entry.
+;;;
+;;; On success, loads booter and jumps to it.
+;;;
+find_startup:
+ DebugChar(']')
+
+ mov al, 1 ; read 1 sector
+ xor bx, bx
+ mov es, bx ; es = 0
+ mov bx, kHFSBuffer ; load volume header
+ mov ecx, DWORD 2
call load
- popa
-
- jc find_booter_ext_3 ; bail out if load failed
-
- mov di, TABLE_EXT ; di <- pointer to new partition table
- cmp WORD [di + 64], BOOTSIG
- jne find_booter_ext_3 ; OhOh! no signature!
-
- call find_booter ; recursion...
-
-find_booter_ext_3
- dec bh ; decrement nesting level counter
-
- ; If we got here, then we know there isn't a booter
- ; partition linked from this partition entry.
-
- test bh, bh ; if we are at level 0, then
- jz find_booter_ext_1 ; look for next extended partition entry
-
-find_booter_end
- pop si
- pop cx
- ret
-
-;--------------------------------------------------------------------------
-; Yeah! Found the booter partition. The first sector in this partition
-; is reserved for the boot sector code (us). So load the booter
-; starting from the second sector in the partition, then jump to the
-; start of the booter.
-;
-load_booter
- mov ax, [si] ; DH/DL
- mov [chs_dx], ax
- mov ax, [si + 2] ; CH/CL
- mov [chs_cx], ax
-
- mov cx, 1 ; skip the initial boot sector
- mov ax, BOOT2_SIZE ; read BOOT2_SIZE sectors
- mov bx, BOOT2_SEG
+ jnc .ok ; load error
+
+ jmp startup_err
+
+.ok
+ mov ax, [kHFSSigAddr]
+ cmp ax, kHFSSig
+ jne .hfs_plus
+
+ DebugChar('|')
+ mov ebx, [kHFSAlBlkSiz]
+ bswap ebx
+ sar ebx, 9
+
+ xor eax, eax
+ mov ax, [kHFSEmbedStart]
+ xchg al, ah ; byte-swap
+ push dx
+ mul ebx ; result in eax
+ pop dx
+
+ xor ebx, ebx
+ mov bx, [kHFSAlBlSt]
+ xchg bl, bh ; byte-swap
+ add eax, ebx
+
+ ;; now eax has sector of HFS+ partition
+ inc eax
+ inc eax
+ mov ecx, eax
+
+ mov al, 1 ; read 1 sector
+ xor bx, bx
+ mov es, bx ; es = 0
+ mov bx, kHFSBuffer ; load volume header
+ call load
+ jc startup_err ; load error
+
+.hfs_plus
+ DebugChar('}')
+ mov ax, [kHFSPlusSigAddr]
+ cmp ax, kHFSPlusSig
+ jne startup_err
+
+;;; Now the HFS+ volume header is in our buffer.
+
+ DebugChar('*')
+ mov eax, [kHFSPlusBlockSize]
+ bswap eax
+ sar eax, 9
+
+ mov ebx, [kHFSPlusExtent]
+ bswap ebx
+ push dx
+ mul ebx ; result in eax
+ pop dx
+
+ dec eax
+ dec eax
+; add [ebios_lba], eax ; offset to startup file
+; mov ecx, [ebios_lba]
+ add ecx, eax
+
+ DebugChar('!')
+
+ mov al, kBoot2Sectors
+ mov bx, kBoot2Segment
mov es, bx
- mov bx, BOOT2_ADDR ; where to place boot2 code
- call load ; load it...
+ mov bx, kBoot2Address + kSectorBytes
+ call load
+ jc startup_err
- xor edx, edx
- mov dl, DRIVE_NUM ; argument for boot2
+ DebugChar('Y')
+ ;
+ ; Jump to boot2. The drive number is already in register DL.
+ ;
+ jmp kBoot2Segment:kBoot2Address + kSectorBytes
+
+startup_err:
- jmp BOOT2_SEG:BOOT2_ADDR ; there is no going back now!
+ DebugChar('X')
+
+hang:
+ hlt
+ jmp SHORT hang
;--------------------------------------------------------------------------
-; Load sectors from disk using INT13/F2 call. The sectors are loaded
-; one sector at a time to avoid any BIOS bugs, and eliminate
-; complexities with crossing track boundaries, and other gotchas.
+; load - Load one or more sectors from a partition.
;
; Arguments:
-; cx - number of sectors to skip
-; ax - number of sectors to read
-; bx - pointer to the memory buffer (must not cross a segment boundary)
-; [chs_cx][chs_dx] - CHS starting position
+; AL = number of 512-byte sectors to read.
+; ES:BX = pointer to where the sectors should be stored.
+; ECX = sector offset in partition
+; DL = drive number (0x80 + unit number)
+; SI = pointer to the partition entry.
;
; Returns:
; CF = 0 success
-; CF = 1 error
-;
-; The caller must save any registers it needs.
-;
-load
- jcxz load_sectors
- call next_sector ; [chs_cx][chs_dx] <- next sector
- loop load
-
-load_sectors
- mov cx, ax ; cx <- number of sectors to read
-
-load_loop
- call read_sector ; load a single sector
- jc load_exit ; abort if carry flag is set
- add bx, SECTOR_BYTES ; increment buffer pointer
- call next_sector ; [chs_cx][chs_dx] <- next sector
- loop load_loop
- clc ; successful exit
-load_exit
- ret
+; 1 error
+;
+; load:
+; ; push cx
+
+; .ebios:
+; ; mov cx, 5 ; load retry count
+; .ebios_loop:
+; call read_lba ; use INT13/F42
+; jnc .exit
+; ; loop .ebios_loop
+
+; .exit
+; pop cx
+; ret
+
;--------------------------------------------------------------------------
-; Read a single sector from the hard disk.
+; read_lba - Read sectors from a partition using LBA addressing.
;
; Arguments:
-; [chs_cx][chs_dx] - CHS starting position
-; es:bx - pointer to the sector memory buffer
-; (must not cross a segment boundary)
+; AL = number of 512-byte sectors to read (valid from 1-127).
+; ES:BX = pointer to where the sectors should be stored.
+; ECX = sector offset in partition
+; DL = drive number (0x80 + unit number)
+; SI = pointer to the partition entry.
;
; Returns:
; CF = 0 success
-; CF = 1 error
+; 1 error
;
-; Caller's cx register is preserved.
+read_lba:
+load:
+ pushad ; save all registers
+ mov bp, sp ; save current SP
+
;
-read_sector
- push cx
- mov cx, 5 ; try 5 times to read the sector
+ ; Create the Disk Address Packet structure for the
+ ; INT13/F42 (Extended Read Sectors) on the stack.
+ ;
-read_sector_1
- mov bp, cx ; save cx
+ ; push DWORD 0 ; offset 12, upper 32-bit LBA
+ push ds ; For sake of saving memory,
+ push ds ; push DS register, which is 0.
- mov cx, [chs_cx]
- mov dx, [chs_dx]
- mov dl, DRIVE_NUM ; drive number
- mov ax, 0x0201 ; Func 2, read 1 sector
- int 0x13 ; read sector
- jnc read_sector_ok ; CF = 0 indicates success
+ add ecx, [ebios_lba] ; offset 8, lower 32-bit LBA
+ add ecx, [si + part.lba]
- mov al, '*' ; sector read error indicator
- call putchar
+ push ecx
- xor ax, ax ; Reset the drive and retry the read
- int 0x13
+ push es ; offset 6, memory segment
- mov cx, bp
- loop read_sector_1 ; retry while cx is not zero
+ push bx ; offset 4, memory offset
- stc ; set carry flag to indicate error
- pop cx
- ret
+ xor ah, ah ; offset 3, must be 0
+ push ax ; offset 2, number of sectors
-read_sector_ok
- mov al, '.' ; successful sector read indicator
- call putchar
- clc ; success, clear carry flag
- pop cx
- ret
+%if DEBUG
+ push ax
+ DebugChar('-') ; absolute sector offset
+ mov eax, ecx
+ call print_hex
+ DebugChar('=') ; count
+ pop ax
+ call print_hex
+%endif
+
+ push WORD 16 ; offset 0-1, packet size
-;--------------------------------------------------------------------------
-; Given the current CHS position stored in [chs_cx][chs_dx], update
-; it so that the value in [chs_cx][chs_dx] points to the following
-; sector.
;
-; Arguments:
-; [chs_cx][chs_dx] - CHS position
+ ; INT13 Func 42 - Extended Read Sectors
;
-; [max_sectors] and [max_heads] must be valid.
+ ; Arguments:
+ ; AH = 0x42
+ ; DL = drive number (80h + drive unit)
+ ; DS:SI = pointer to Disk Address Packet
;
-; Caller's ax and bx registers are preserved.
+ ; Returns:
+ ; AH = return status (sucess is 0)
+ ; carry = 0 success
+ ; 1 error
;
-next_sector
- push ax
- push bx
-
- ; Extract the CHS values from the packed register values in memory.
+ ; Packet offset 2 indicates the number of sectors read
+ ; successfully.
;
- mov al, [chs_cx]
- and al, 0x3f ; al <- sector number (1-63)
-
- mov bx, [chs_cx]
- rol bl, 2
- ror bx, 8
- and bx, 0x03ff ; bx <- cylinder number
-
- mov ah, [chs_dx + 1] ; ah <- head number
-
- inc al ; Increment CHS by one sector.
- cmp al, [max_sectors]
- jbe next_sector_done
-
- inc ah
- cmp ah, [max_heads]
- jbe next_sector_new_head
-
- inc bx
+; mov dl, kDriveNumber
+ mov si, sp
+ mov ah, 0x42
+ int 0x13
-next_sector_new_cyl
- xor ah, ah ; head number starts at 0
+ jnc .exit
-next_sector_new_head
- mov al, 1 ; sector number starts at 1
+%if DEBUG
+ call print_hex
+%endif
+ DebugChar('R') ; indicate INT13/F42 error
-next_sector_done
- ; Reassemble the CHS values back into the packed representation
- ; in memory.
;
- mov [chs_cx + 1], bl ; lower 8-bits of the 10-bit cylinder
- ror bh, 2
- or bh, al
- mov [chs_cx], bh ; cylinder & sector number
- mov [chs_dx + 1], ah ; head number
+ ; Issue a disk reset on error.
+ ; Should this be changed to Func 0xD to skip the diskette controller
+ ; reset?
+ ;
+ xor ax, ax ; Func 0
+ int 0x13 ; INT 13
+ stc ; set carry to indicate error
- pop bx
- pop ax
+.exit:
+ mov sp, bp ; restore SP
+ popad
ret
-;--------------------------------------------------------------------------
+%if 0
+;-------------------------------------------------------------------------
; Write a string to the console.
;
; Arguments:
-; ds:si pointer to a NULL terminated string.
+; DS:SI pointer to a NULL terminated string.
;
-; The following registers are modified:
-; ax, bx, si
+; Clobber list:
+; AX, BX, SI
;
-message
- mov bx, 1 ; bh=0, bl=1 (blue)
+print_string
+ mov bx, 1 ; BH=0, BL=1 (blue)
cld ; increment SI after each lodsb call
-message_loop
- lodsb ; load a byte from DS:SI into al
+.loop
+ lodsb ; load a byte from DS:SI into AL
cmp al, 0 ; Is it a NULL?
- je message_done ; yes, all done
- mov ah, 0xE ; bios INT10 Func 0xE
- int 0x10 ; bios display a byte in tty mode
- jmp short message_loop
-message_done
+ je .exit ; yes, all done
+ mov ah, 0xE ; INT10 Func 0xE
+ int 0x10 ; display byte in tty mode
+ jmp short .loop
+.exit
ret
+%endif
+
+%if DEBUG
;--------------------------------------------------------------------------
; Write a ASCII character to the console.
;
; Arguments:
-; al contains the ASCII character printed.
-;
-putchar
- push bx
- mov bx, 1 ; bh=0, bl=1 (blue)
- mov ah, 0x0e ; bios int 10, function 0xe
- int 0x10 ; bios display a byte in tty mode
- pop bx
+; AL = ASCII character.
+;
+print_char
+ pushad
+ mov bx, 1 ; BH=0, BL=1 (blue)
+ mov ah, 0x0e ; bios INT 10, Function 0xE
+ int 0x10 ; display byte in tty mode
+ popad
ret
-%IF DEBUG
-;==========================================================================
-; DEBUG FUNCTION START
-;
-; If DEBUG is set to 1, this booter will become too large for the MBR,
-; but it will still be less than 510 bytes, which is fine for a partition's
-; boot sector.
-;==========================================================================
-
;--------------------------------------------------------------------------
; Write a variable number of spaces to the console.
;
; Arguments:
-; al number to spaces to display
+; AL = number to spaces.
;
-putspace
- push cx
+print_spaces:
+ pushad
xor cx, cx
- mov cl, al ; use cx as the loop counter
+ mov cl, al ; use CX as the loop counter
mov al, ' ' ; character to print
-putspace_loop
- jcxz putspace_done
- call putchar
- loop putspace_loop
-putspace_done
- pop cx
+.loop:
+ jcxz .exit
+ call print_char
+ loop .loop
+.exit:
+ popad
ret
;--------------------------------------------------------------------------
-; Write the hex byte value to the console.
+; Write the byte value to the console in hex.
;
; Arguments:
-; al contains the byte to be displayed. e.g. if al is 0x3f, then 3F
-; will be displayed on screen.
+; AL = Value to be displayed in hex.
;
-display_byte
+print_hex:
+ pushad
+ mov cx, WORD 4
+ bswap eax
+.loop
push ax
ror al, 4
- call display_nibble ; display upper nibble
+ call print_nibble ; display upper nibble
pop ax
- call display_nibble ; display lower nibble
- ;
- mov ax, 10 ; display carriage return
- call putchar
- mov ax, 13
- call putchar
+ call print_nibble ; display lower nibble
+ ror eax, 8
+ loop .loop
+
+ mov al, 10 ; carriage return
+ call print_char
+ mov al, 13
+ call print_char
+ popad
ret
-display_nibble
+print_nibble:
and al, 0x0f
add al, '0'
cmp al, '9'
- jna display_nibble_1
+ jna .print_ascii
add al, 'A' - '9' - 1
-display_nibble_1
- call putchar
+.print_ascii:
+ call print_char
ret
-;==========================================================================
-; DEBUG FUNCTION END
-;==========================================================================
-%ENDIF
-
-; Disk parameters gathered through INT13/F8 call.
-;
-max_sectors db 0 ; number of sectors per track
-max_heads db 0 ; number of heads
+getc:
+ mov ah, 0
+ int 0x16
+ ret
-; Parameters to our load function.
-;
-chs_cx dw 0x0001 ; cx register for INT13/F2 call
-chs_dx dw 0x0000 ; dx register for INT13/F2 call
+%endif ; DEBUG
;--------------------------------------------------------------------------
; NULL terminated strings.
;
-load_error db 10, 13, 'Load Error', 0
+; boot_error_str db 10, 13, 'Error', 0
;--------------------------------------------------------------------------
; Pad the rest of the 512 byte sized booter with zeroes. The last
; that the 'times' argument is negative.
pad_boot
- times 446-($-$$) db 0
+ times 510-($-$$) db 0
-%IF BOOTDEV = FLOPPY
+%ifdef FLOPPY
;--------------------------------------------------------------------------
; Put fake partition entries for the bootable floppy image
;
part2relsect dd 0x00000082 ; start after booter
; part2numsect dd 0x00000abe ; 1.44MB - 65K
part2numsect dd 0x000015fe ; 2.88MB - 65K
-%ENDIF
+%endif
pad_table_and_sig
times 510-($-$$) db 0
- dw BOOTSIG
+ dw kBootSignature
END
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
;
; @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.
+; Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
;
; The Original Code and all software distributed under the License are
-; distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; 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.
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
+; limitations under the License.
;
; @APPLE_LICENSE_HEADER_END@
;
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
--- /dev/null
+DIR = boot1u
+include ../MakePaths.dir
+
+#
+# these paths are only valid in subdirectories of this directory
+#
+OBJROOT=../../obj/i386/boot1u
+SYMROOT=../../sym/i386
+DSTROOT=../../dst/i386
+SRCROOT=/tmp
+
+OPTIM = -Os
+CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
+ -fno-builtin -DSAIO_INTERNAL_USER -static \
+ -fomit-frame-pointer -mpreferred-stack-boundary=2 \
+ -fno-align-functions
+DEFINES=
+CONFIG = hd
+SYMDIR = $(SYMROOT)
+LIBSADIR = ../libsa
+LIBSAIODIR = ../libsaio
+UTILDIR = ../util
+INC = -I. -I.. -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(UTILDIR)
+ifneq "" "$(wildcard /bin/mkdirs)"
+ MKDIRS = /bin/mkdirs
+else
+ MKDIRS = /bin/mkdir -p
+endif
+AS = as
+LD = ld
+LIBS= -L$(SYMDIR) -lsaio -lsa
+#LIBS= -L$(SYMDIR)
+
+OTHER_FILES =
+
+INSTALLDIR = $(DSTROOT)/usr/standalone/i386
+VPATH = $(OBJROOT):$(SYMROOT)
+
+# The ordering is important;
+# boot1u.o must be first.
+#OBJS = $(OBJROOT)/boot1u.o $(OBJROOT)/asm.o $(OBJROOT)/bios.o $(OBJROOT)/boot.o $(OBJROOT)/string.o $(OBJROOT)/malloc.o $(OBJROOT)/disk.o $(OBJROOT)/put.o
+OBJS = boot1u.o asm.o bios.o boot.o string.o malloc.o disk.o put.o
+
+# OBJS += $(OBJROOT)/../libsaio/ufs.o \
+# $(OBJROOT)/../libsaio/cache.o \
+# $(OBJROOT)/../libsaio/ufs_byteorder.o \
+# $(OBJROOT)/../libsaio/table.o \
+# $(OBJROOT)/../libsaio/misc.o
+
+# OBJS += $(OBJROOT)/../libsa/prf.o $(OBJROOT)/../libsa/printf.o
+
+# We get the following object files out of libsaio:
+# ufs.o cache.o ufs_byteorder.o table.o
+# and these from libsa:
+# prf.o printf.o
+# If they increase in size, or if other accidental dependencies
+# are created with other .o files in libsaio.a, then boot1u can get too large.
+# Use care in changing the library.
+
+UTILDIR = ../util
+SFILES = boot1u.s bios.s asm.s
+CFILES = boot.c disk.c string.c put.c malloc.c
+HFILES =
+OTHERFILES = Makefile
+ALLSRC = $(FOREIGNSRC) $(FOREIGNBIN) $(SFILES) $(CFILES) \
+ $(HFILES) $(OTHERFILES)
+DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
+BOOT1UADDR = 10200
+MAXBOOTSIZE = 7680
+NASM = $(SYMROOT)/nasm
+
+all: $(DIRS_NEEDED) boot1u0 boot1u
+
+boot1u0: boot1u0.s Makefile $(NASM)
+ $(NASM) boot1u0.s -o $(SYMROOT)/$@
+
+boot1u: $(SYMROOT)/machOconv $(OBJS) boot1u0
+ $(LD) -static -preload -segaddr __TEXT $(BOOT1UADDR) -segalign 20 \
+ -o $(SYMROOT)/boot1u.sys $(OBJS) $(LIBS) -lcc_kext
+ size $(SYMROOT)/boot1u.sys
+ $(SYMROOT)/machOconv $(SYMROOT)/boot1u.sys $(SYMROOT)/boot1u.post
+ ls -l $(SYMROOT)/boot1u.post
+ @( size=`ls -l $(SYMROOT)/boot1u.post | awk '{ print $$5}'` ; \
+ if expr "$$size" ">" "$(MAXBOOTSIZE)" > /dev/null ;\
+ then \
+ echo "Booter executable larger than $(MAXBOOTSIZE) bytes" ;\
+ exit 1;\
+ fi)
+ cat $(SYMROOT)/boot1u0 $(SYMROOT)/boot1u.post | dd obs=8k conv=osync of=$(SYMROOT)/boot1u
+ rm $(SYMROOT)/boot1u.post
+
+
+install_i386:: all $(INSTALLDIR)
+ cp $(SYMROOT)/boot1u $(OTHER_FILES) $(INSTALLDIR)
+ cd $(INSTALLDIR); chmod u+w boot1u $(OTHER_FILES)
+
+clean::
+ rm -f $(SYMROOT)/boot1u.sys $(SYMROOT)/boot1u
+
+include ../MakeInc.dir
+
+#dependencies
+-include $(OBJROOT)/Makedep
--- /dev/null
+/*
+ * Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_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.
+ */
+/*
+ * HISTORY
+ * $Log: asm.s,v $
+ * Revision 1.2 2003/04/08 20:28:27 curtisg
+ * Merged PR-3073653, PR-3172003.
+ *
+ * Revision 1.1.2.1 2003/04/05 00:48:42 curtisg
+ * Changes for 3073653.
+ *
+ * Revision 1.4 2002/10/02 00:06:18 curtisg
+ * Integrating PR-3032510.
+ *
+ * Revision 1.3.6.1 2002/08/30 21:16:29 curtisg
+ * KERNBOOTSTRUCT is going away in favor of KernelBootArgs_t in <pexpert/i386/boot.h>.
+ *
+ * Revision 1.3 2002/07/09 14:06:21 jliu
+ * Merging changes from PR-2954224 branch in boot/i386.
+ *
+ * Revision 1.2.30.1 2002/07/05 16:24:51 jliu
+ * Merged UFS/HFS/HFS+ filesystem support from BootX.
+ * Moved boot2 load address due to increased size. boot0/boot1 also changed.
+ * Updated boot graphics and CLUT.
+ * Added support to chain load foreign booters.
+ * Fixed param passing bug in network loader.
+ * Misc cleanup in libsaio.
+ *
+ * Revision 1.2 2000/05/23 23:01:11 lindak
+ * Merged PR-2309530 into Kodiak (liu i386 booter: does not support label-less
+ * ufs partitions)
+ *
+ * Revision 1.1.1.2.4.1 2000/05/13 17:07:39 jliu
+ * New boot0 (boot1 has been deprecated). Booter must now reside in its own partition, no disk label required.
+ *
+ * Revision 1.1.1.2 1999/08/04 21:16:57 wsanchez
+ * Impoort of boot-66
+ *
+ * Revision 1.3 1999/08/04 21:12:12 wsanchez
+ * Update APSL
+ *
+ * Revision 1.2 1999/03/25 05:48:30 wsanchez
+ * Add APL.
+ * Remove unused gzip code.
+ * Remove unused Adobe fonts.
+ *
+ * Revision 1.1.1.1.66.2 1999/03/16 16:08:54 wsanchez
+ * Substitute License
+ *
+ * Revision 1.1.1.1.66.1 1999/03/16 07:33:21 wsanchez
+ * Add APL
+ *
+ * Revision 1.1.1.1 1997/12/05 21:57:57 wsanchez
+ * Import of boot-25 (~mwatson)
+ *
+ * Revision 2.1.1.2 90//03//22 17:59:50 rvb
+ * Added _sp() => where is the stack at. [kupfer]
+ *
+ * Revision 2.1.1.1 90//02//09 17:25:04 rvb
+ * Add Intel copyright
+ * [90//02//09 rvb]
+ *
+ */
+
+
+// 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 Intel Corporation
+// Copyright 1988, 1989 by Intel Corporation
+//
+
+#include <architecture/i386/asm_help.h>
+#include "memory.h"
+
+#define data32 .byte 0x66
+#define addr32 .byte 0x67
+
+ .file "asm.s"
+
+CR0_PE_ON = 0x1
+CR0_PE_OFF = 0x7ffffffe
+
+STACK32_BASE = ADDR32(STACK_SEG, 0)
+STACK16_SEG = STACK_SEG
+CODE32_BASE = ADDR32(BOOT1U_SEG, 0)
+CODE16_SEG = BOOT1U_SEG
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// Pointer to 6-bytes in memory that contains the base address and the limit
+// (size of GDT table in bytes) of the GDT. The LGDT is the only instruction
+// that directly loads a linear address (not a segment relative address) and
+// a limit in protected mode.
+
+.globl _Gdtr
+ .data
+ .align 2, 0x90
+_Gdtr:
+ .word GDTLIMIT
+ .long vtop(_Gdt)
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// Data area for __switch_stack.
+//
+save_sp: .long STACK_OFS
+save_ss: .long STACK_SEG
+
+ .text
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// real_to_prot()
+//
+// Transfer from real mode to protected mode.
+// Preserves all registers except EAX.
+//
+LABEL(__real_to_prot)
+
+ // Interrupts are disabled in protected mode.
+
+ cli
+
+ // Load the Global Descriptor Table Register (GDTR).
+
+ addr32
+ data32
+ lgdt OFFSET1U16(_Gdtr)
+
+ // Enter protected mode by setting the PE bit in CR0.
+
+ mov %cr0, %eax
+ data32
+ or $CR0_PE_ON, %eax
+ mov %eax, %cr0
+
+ // Make intrasegment jump to flush the processor pipeline and
+ // reload CS register.
+
+ data32
+ ljmp $0x08, $xprot
+
+xprot:
+ // we are in USE32 mode now
+ // set up the protected mode segment registers : DS, SS, ES, FS, GS
+
+ mov $0x10, %eax
+ movw %ax, %ds
+ movw %ax, %ss
+ movw %ax, %es
+ movw %ax, %fs
+ movw %ax, %gs
+
+ // Convert STACK_SEG:SP to 32-bit linear stack pointer.
+
+ movzwl %sp, %eax
+ addl $STACK32_BASE, %eax
+ movl %eax, %esp
+
+ // Convert STACK_SEG:BP to 32-bit linear base pointer.
+
+ movzwl %bp, %eax
+ addl $STACK32_BASE, %eax
+ movl %eax, %ebp
+
+ // Modify the caller's return address on the stack from
+ // segment offset to linear address.
+
+ popl %eax
+ addl $CODE32_BASE, %eax
+ pushl %eax
+
+ ret
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// prot_to_real()
+//
+// Transfer from protected mode to real mode.
+// Preserves all registers except EAX.
+//
+LABEL(__prot_to_real)
+
+ // Set up segment registers appropriate for real mode.
+
+ movw $0x30, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %fs
+ movw %ax, %gs
+ movw %ax, %ss
+
+ ljmp $0x18, $x16 // change to USE16 mode
+
+x16:
+ mov %cr0, %eax // clear the PE bit of CR0
+ data32
+ and $CR0_PE_OFF, %eax
+ mov %eax, %cr0
+
+ // make intersegment jmp to flush the processor pipeline
+ // and reload CS register
+
+ data32
+ ljmp $CODE16_SEG, $xreal - CODE32_BASE
+
+xreal:
+ // we are in real mode now
+ // set up the real mode segment registers : DS, DS, ES, FS, GS
+
+ movw %cs, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %fs
+ movw %ax, %gs
+
+ // load stack segment register SS.
+
+ data32
+ movl $STACK16_SEG, %eax
+ movw %ax, %ss
+
+ // clear top 16-bits of ESP and EBP.
+
+ data32
+ movzwl %sp, %esp
+ data32
+ movzwl %bp, %ebp
+
+ // Modify caller's return address on the stack
+ // from linear address to segment offset.
+
+ data32
+ popl %eax
+ data32
+ movzwl %ax, %eax
+ data32
+ pushl %eax
+
+ // Reenable maskable interrupts.
+
+ sti
+
+ data32
+ ret
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// halt()
+//
+LABEL(_halt)
+ hlt
+ jmp _halt
+
+#if 0
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// startprog(phyaddr, arg)
+// Start the program on protected mode where phyaddr is the entry point.
+// Passes arg to the program in %eax.
+//
+LABEL(_startprog)
+ push %ebp
+ mov %esp, %ebp
+
+ mov 0xc(%ebp), %eax // argument to program
+ mov 0x8(%ebp), %ecx // entry offset
+ mov $0x28, %ebx // segment
+ push %ebx
+ push %ecx
+
+ // set up %ds and %es
+
+ mov $0x20, %ebx
+ movw %bx, %ds
+ movw %bx, %es
+
+ lret
+#endif
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// Returns the current stack pointer.
+//
+LABEL(__sp)
+ mov %esp, %eax
+ ret
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// Returns the current frame pointer.
+//
+LABEL(__bp)
+ mov %ebp, %eax
+ ret
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// switch_stack()
+//
+// Switches stack pointer between SS:SP and memory save_ss:save_sp.
+// Call this function from real mode only!!!
+//
+// AX, DI, and SI are clobbered.
+//
+LABEL(__switch_stack)
+ popl %eax # save return address
+ popl %edi # discard upper 16-bit
+
+ data32
+ addr32
+ movl OFFSET1U16(save_ss), %esi # new SS to SI
+
+ data32
+ addr32
+ movl OFFSET1U16(save_sp), %edi # new SP to DI
+
+ addr32
+ mov %ss, OFFSET1U16(save_ss) # save current SS to memory
+
+ data32
+ addr32
+ movl %esp, OFFSET1U16(save_sp) # save current SP to memory
+
+ cli
+ mov %si, %ss # switch stack
+ mov %di, %sp
+ sti
+
+ pushl %eax # push IP of caller onto the new stack
+
+ xorl %eax, %eax
+ xorl %esi, %esi
+ xorl %edi, %edi
+
+ ret
+
+#if 0
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// loader()
+//
+// Issue a request to the network loader.
+//
+LABEL(_loader)
+ enter $0, $0
+ pushal
+
+ #
+ # Pass a far pointer to the command structure
+ # to the INT call through DX:CX.
+ #
+ # The command code is in BX.
+ #
+
+ movw 8(%ebp), %bx # 8[EBP] = command code
+ movw 12(%ebp), %cx # 12[EBP] = command structure offset
+ movw 14(%ebp), %dx # 14[EBP] = command structure segment
+
+ call __prot_to_real # Revert to real mode
+
+ ###### Real Mode Begin ######
+
+ data32
+ call __switch_stack # Switch to NBP stack
+
+ int $0x2b # Call NBP
+
+ data32
+ call __switch_stack # Restore stack
+
+ data32
+ call __real_to_prot # Back to protected mode
+
+ ###### Real Mode End ######
+
+ popal
+ leave
+ ret
+#endif
+
+#if 0
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+// pcpy(src, dst, cnt)
+// where src is a virtual address and dst is a physical address
+//
+LABEL(_pcpy)
+ push %ebp
+ mov %esp, %ebp
+ push %es
+ push %esi
+ push %edi
+ push %ecx
+
+ cld
+
+ // set %es to point at the flat segment
+
+ mov $0x20, %eax
+ movw %ax , %es
+
+ mov 0x8(%ebp), %esi // source
+ mov 0xc(%ebp), %edi // destination
+ mov 0x10(%ebp), %ecx // count
+
+ rep
+ movsb
+
+ pop %ecx
+ pop %edi
+ pop %esi
+ pop %es
+ pop %ebp
+
+ ret
+#endif
--- /dev/null
+/*
+ * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright 1993 NeXT Computer, Inc.
+ * All rights reserved.
+ *
+ * Harness for calling real-mode BIOS functions.
+ */
+
+#include <architecture/i386/asm_help.h>
+#include "memory.h"
+
+#define data32 .byte 0x66
+#define addr32 .byte 0x67
+
+#define O_INT 0
+#define O_EAX 4
+#define O_EBX 8
+#define O_ECX 12
+#define O_EDX 16
+#define O_EDI 20
+#define O_ESI 24
+#define O_EBP 28
+#define O_CS 32
+#define O_DS 34
+#define O_ES 36
+#define O_FLG 38
+
+.data
+ .lcomm save_eax, 4,2
+ .lcomm save_edx, 4,2
+ .lcomm save_es, 2,1
+ .lcomm save_flag, 2,1
+ .lcomm new_eax, 4,2
+ .lcomm new_edx, 4,2
+ .lcomm new_es, 2,1
+
+.text
+
+/*============================================================================
+ * Call real-mode BIOS INT functions.
+ *
+ */
+LABEL(_bios)
+ enter $0, $0
+ pushal
+
+ movl 8(%ebp), %edx // address of save area
+ movb O_INT(%edx), %al // save int number
+ movb %al, do_int+1
+
+ movl O_EBX(%edx), %ebx
+ movl O_ECX(%edx), %ecx
+ movl O_EDI(%edx), %edi
+ movl O_ESI(%edx), %esi
+ movl O_EBP(%edx), %ebp
+ movl %edx, save_edx
+ movl O_EAX(%edx), %eax
+ movl %eax, new_eax
+ movl O_EDX(%edx), %eax
+ movl %eax, new_edx
+ movw O_ES(%edx), %ax
+ movl %ax, new_es
+
+ call __prot_to_real
+
+ data32
+ addr32
+ mov OFFSET1U16(new_eax), %eax
+ data32
+ addr32
+ mov OFFSET1U16(new_edx), %edx
+ data32
+ addr32
+ mov OFFSET1U16(new_es), %es
+
+do_int:
+ int $0x00
+ pushf
+ data32
+ addr32
+ movl %eax, OFFSET1U16(save_eax)
+ popl %eax // actually pop %ax
+ addr32
+ movl %eax, OFFSET1U16(save_flag) // actually movw
+ mov %es, %ax
+ addr32
+ movl %eax, OFFSET1U16(save_es) // actually movw
+ data32
+ call __real_to_prot
+
+ movl %edx, new_edx // save new edx before clobbering
+ movl save_edx, %edx
+ movl new_edx, %eax // now move it into buffer
+ movl %eax, O_EDX(%edx)
+ movl save_eax, %eax
+ movl %eax, O_EAX(%edx)
+ movw save_es, %ax
+ movw %ax, O_ES(%edx)
+ movw save_flag, %ax
+ movw %ax, O_FLG(%edx)
+ movl %ebx, O_EBX(%edx)
+ movl %ecx, O_ECX(%edx)
+ movl %edi, O_EDI(%edx)
+ movl %esi, O_ESI(%edx)
+ movl %ebp, O_EBP(%edx)
+
+ popal
+ leave
+
+ ret
+
--- /dev/null
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <libsa.h>
+#include <libsa/memory.h>
+#include <saio_types.h>
+#include <saio_internal.h>
+
+#include <fdisk.h>
+#include <ufs.h>
+
+#include "boot1u.h"
+#include "disk.h"
+
+#include <io_inline.h>
+
+void *gFSLoadAddress;
+
+//#define BOOT_FILE "/foo"
+#define BOOT_FILE "/usr/standalone/i386/boot"
+
+
+//==========================================================================
+// Zero the BSS.
+
+static void zeroBSS()
+{
+ extern char _DATA__bss__begin, _DATA__bss__end;
+ extern char _DATA__common__begin, _DATA__common__end;
+
+ bzero( &_DATA__bss__begin,
+ (&_DATA__bss__end - &_DATA__bss__begin) );
+
+ bzero( &_DATA__common__begin,
+ (&_DATA__common__end - &_DATA__common__begin) );
+}
+
+struct BootVolume bv;
+
+extern char chainbootdev;
+
+void boot(int biosdev, void *partPtr)
+{
+ struct fdisk_part part;
+ int cc;
+
+ zeroBSS();
+
+ // printf("Hello, world.\n");
+
+ // Enable A20 gate before accessing memory above 1Mb.
+ enableA20();
+
+ biosdev = biosdev & 0xFF;
+ chainbootdev = biosdev;
+
+ /* Don't believe the passed-in partition table */
+ cc = findUFSPartition(biosdev, &part);
+ if (cc<0) {
+ printf("No UFS partition\n");
+ halt();
+ }
+
+ initUFSBVRef(&bv, biosdev, &part);
+
+ gFSLoadAddress = (void *)BOOT2_ADDR;
+ cc = UFSLoadFile(&bv, BOOT_FILE);
+ if (cc < 0) {
+ printf("Could not load" BOOT_FILE "\n");
+ halt();
+ }
+ // Return to execute booter
+}
--- /dev/null
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#define bcopy(src, dst, len) memcpy((dst), (src), (len))
+#define bzero(dst, len) memset((dst),'\0', (len))
--- /dev/null
+/*
+ * Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_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.
+ */
+
+/*
+ * bootu() -- second stage boot.
+ *
+ * This function must be located at 0:BOOTER_ADDR and will be called
+ * by boot1 or by NBP.
+ */
+
+#include <architecture/i386/asm_help.h>
+#include "memory.h"
+
+#define data32 .byte 0x66
+#define addr32 .byte 0x67
+#define retf .byte 0xcb
+
+ .file "bootu.s"
+
+ .data
+
+EXPORT(_chainbootdev) .byte 0x80
+EXPORT(_chainbootflag) .byte 0x00
+
+.text
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Booter entry point. Called by the MBR booter.
+# This routine must be the first in the TEXT segment.
+#
+# Arguments:
+# DL = Boot drive number
+# SI = Pointer to partition table entry.
+#
+LABEL(bootu)
+ pushl %ecx # Save general purpose registers
+ pushl %ebx
+ pushl %ebp
+ pushl %esi
+ pushl %edi
+ push %ds # Save DS, ES
+ push %es
+
+ mov %cs, %ax # Update segment registers.
+ mov %ax, %ds # Set DS and ES to match CS
+ mov %ax, %es
+
+ xor %ebx, %ebx
+ mov %si, %bx # save si
+
+ data32
+ call __switch_stack # Switch to new stack
+
+ data32
+ call __real_to_prot # Enter protected mode.
+
+ # We are now in 32-bit protected mode.
+ # Transfer execution to C by calling boot().
+
+ pushl %ebx
+ pushl %edx # bootdev
+ call _boot
+
+start_boot2:
+ xorl %edx, %edx
+ movb _chainbootdev, %dl # Setup DL with the BIOS device number
+
+ call __prot_to_real # Back to real mode.
+
+ data32
+ call __switch_stack # Restore original stack
+
+ pop %es # Restore original ES and DS
+ pop %ds
+ popl %edi # Restore all general purpose registers
+ popl %esi # except EAX.
+ popl %ebp
+ popl %ebx
+ popl %ecx
+
+ data32
+ ljmp $0x2000, $0x0200 # Jump to boot code already in memory
+
--- /dev/null
+; Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
+;
+; @APPLE_LICENSE_HEADER_START@
+;
+; Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
+;
+; The Original Code and all software distributed under the License are
+; distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+; INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
+; limitations under the License.
+;
+; @APPLE_LICENSE_HEADER_END@
+;
+; Boot Loader: boot0
+;
+; A small boot sector program written in x86 assembly whose only
+; responsibility is to locate the booter partition, load the
+; booter into memory, and jump to the booter's entry point.
+; The booter partition can be a primary or a logical partition.
+;
+; This boot loader can be placed at any of the following places:
+; 1. Master Boot Record (MBR)
+; 2. Boot sector of an extended partition
+; 3. Boot sector of a primary partition
+; 4. Boot sector of a logical partition
+;
+; In order to coexist with a fdisk partition table (64 bytes), and
+; leave room for a two byte signature (0xAA55) in the end, boot0 is
+; restricted to 446 bytes (512 - 64 - 2). If boot0 did not have to
+; live in the MBR, then we would have 510 bytes to work with.
+;
+; boot0 is always loaded by the BIOS or another booter to 0:7C00h.
+;
+; This code is written for the NASM assembler.
+; nasm boot0.s -o boot0
+
+
+;
+; Set to 1 to enable obscure debug messages.
+;
+DEBUG EQU 0
+
+;
+; Set to 1 to support loading the booter (boot2) from a
+; logical partition.
+;
+EXT_PART_SUPPORT EQU 1
+
+;
+; Various constants.
+;
+kBoot0Segment EQU 0x0000
+kBoot0Stack EQU 0xFFF0 ; boot0 stack pointer
+kBoot0LoadAddr EQU 0x7C00 ; boot0 load address
+kBoot0RelocAddr EQU 0xE000 ; boot0 relocated address
+
+kMBRBuffer EQU 0x1000 ; MBR buffer address
+kExtBuffer EQU 0x1200 ; EXT boot block buffer address
+
+kPartTableOffset EQU 0x1be
+kMBRPartTable EQU kMBRBuffer + kPartTableOffset
+kExtPartTable EQU kExtBuffer + kPartTableOffset
+
+kBoot1uSectors EQU 16 ; sectors to load for boot2
+kBoot1uAddress EQU 0x0000 ; boot2 load address
+kBoot1uSegment EQU 0x1000 ; boot2 load segment
+
+kSectorBytes EQU 512 ; sector size in bytes
+kBootSignature EQU 0xAA55 ; boot sector signature
+
+kPartCount EQU 4 ; number of paritions per table
+kPartTypeBoot EQU 0xab ; boot2 partition type
+kPartTypeUFS EQU 0xa8 ;
+kPartTypeExtDOS EQU 0x05 ; DOS extended partition type
+kPartTypeExtWin EQU 0x0f ; Windows extended partition type
+kPartTypeExtLinux EQU 0x85 ; Linux extended partition type
+kPartActive EQU 0x80
+
+%ifdef FLOPPY
+kDriveNumber EQU 0x00
+%else
+kDriveNumber EQU 0x80
+%endif
+
+;
+; In memory variables.
+;
+ebios_lba dd 0 ; starting LBA of the intial extended partition.
+ebios_present db 0 ; 1 if EBIOS is supported, 0 otherwise.
+
+;
+; Format of fdisk partition entry.
+;
+; The symbol 'part_size' is automatically defined as an `EQU'
+; giving the size of the structure.
+;
+ struc part
+.bootid: resb 1 ; bootable or not
+.head: resb 1 ; starting head, sector, cylinder
+.sect: resb 1 ;
+.cyl: resb 1 ;
+.type: resb 1 ; partition type
+.endhead resb 1 ; ending head, sector, cylinder
+.endsect: resb 1 ;
+.endcyl: resb 1 ;
+.lba: resd 1 ; starting lba
+.sectors resd 1 ; size in sectors
+ endstruc
+
+;
+; Macros.
+;
+%macro DebugCharMacro 1
+ mov al, %1
+ call print_char
+%endmacro
+
+%if DEBUG
+%define DebugChar(x) DebugCharMacro x
+%else
+%define DebugChar(x)
+%endif
+
+;--------------------------------------------------------------------------
+; Start of text segment.
+
+ SEGMENT .text
+
+ ORG 0xE000 ; must match kBoot0RelocAddr
+
+;--------------------------------------------------------------------------
+; Boot code is loaded at 0:7C00h.
+;
+start
+ ;
+ ; Set up the stack to grow down from kBoot0Segment:kBoot0Stack.
+ ; Interrupts should be off while the stack is being manipulated.
+ ;
+ cli ; interrupts off
+ xor ax, ax ; zero ax
+ mov ss, ax ; ss <- 0
+ mov sp, kBoot0Stack ; sp <- top of stack
+ sti ; reenable interrupts
+
+ mov es, ax ; es <- 0
+ mov ds, ax ; ds <- 0
+
+ ;
+ ; Relocate boot0 code.
+ ;
+ mov si, kBoot0LoadAddr ; si <- source
+ mov di, kBoot0RelocAddr ; di <- destination
+ ;
+ cld ; auto-increment SI and/or DI registers
+ mov cx, kSectorBytes/2 ; copy 256 words
+ repnz movsw ; repeat string move (word) operation
+
+ ; Code relocated, jump to start_reloc in relocated location.
+ ;
+ jmp 0:start_reloc
+
+;--------------------------------------------------------------------------
+; Start execution from the relocated location.
+;
+start_reloc:
+
+ DebugChar('*')
+
+ mov dl, kDriveNumber ; starting BIOS drive number
+
+.loop:
+
+%if DEBUG
+ mov al, dl
+ call print_hex
+%endif
+
+ ;
+ ; Clear various flags in memory.
+ ;
+ xor eax, eax
+ mov [ebios_lba], eax ; clear EBIOS LBA offset
+ mov [ebios_present], al ; clear EBIOS support flag
+
+ ;
+ ; Since this code may not always reside in the MBR, always start by
+ ; loading the MBR to kMBRBuffer.
+ ;
+ mov al, 1 ; load one sector
+ xor bx, bx
+ mov es, bx ; MBR load segment = 0
+ mov bx, kMBRBuffer ; MBR load address
+ mov si, bx ; pointer to fake partition entry
+ mov WORD [si], 0x0000 ; CHS DX: head = 0
+ mov WORD [si + 2], 0x0001 ; CHS CX: cylinder = 0, sector = 1
+
+ call load
+ jc .next_drive ; MBR load error
+
+ ;
+ ; Check if EBIOS is supported for this hard drive.
+ ;
+ mov ah, 0x41 ; Function 0x41
+ mov bx, 0x55AA ; check signature
+; mov dl, kDriveNumber ; Drive number
+ int 0x13
+
+ ;
+ ; If successful, the return values are as follows:
+ ;
+ ; carry = 0
+ ; ah = major version of EBIOS extensions (0x21 = version 1.1)
+ ; al = altered
+ ; bx = 0xAA55
+ ; cx = support bits. bit 0 must be set for function 0x42.
+ ;
+ jc .ebios_check_done
+ cmp bx, 0xAA55 ; check BX = 0xAA55
+ jnz .ebios_check_done
+ test cl, 0x01 ; check enhanced drive read support
+ setnz [ebios_present] ; EBIOS supported, set flag
+ DebugChar('E') ; EBIOS supported
+.ebios_check_done:
+
+ ;
+ ; Look for the booter partition in the MBR partition table,
+ ; which is at offset kMBRPartTable.
+ ;
+ mov di, kMBRPartTable ; pointer to partition table
+ mov ah, 0 ; initial nesting level is 0
+ call find_boot ; will not return on success
+
+.next_drive:
+;; inc dl ; next drive number
+;; test dl, 0x84 ; went through all 4 drives?
+;; jz .loop ; not yet, loop again
+
+ mov si, boot_error_str
+ call print_string
+
+hang:
+ hlt
+ jmp SHORT hang
+
+;--------------------------------------------------------------------------
+; Find the boot partition and load the booter from the partition.
+;
+; Arguments:
+; AH = recursion nesting level
+; DL = drive number (0x80 + unit number)
+; DI = pointer to fdisk partition table.
+;
+; Clobber list:
+; AX, BX, EBP
+;
+find_boot:
+ push cx ; preserve CX and SI
+ push si
+
+ ;
+ ; Check for boot block signature 0xAA55 following the 4 partition
+ ; entries.
+ ;
+ cmp WORD [di + part_size * kPartCount], kBootSignature
+ jne .exit ; boot signature not found
+
+ mov si, di ; make SI a pointer to partition table
+ mov cx, kPartCount ; number of partition entries per table
+
+.loop:
+ ;
+ ; First scan through the partition table looking for the boot
+ ; partition. Postpone walking the extended partition chain for
+ ; the second pass. Do not merge the two without changing the
+ ; buffering scheme used to store extended partition tables.
+ ;
+%if DEBUG
+ mov al, ah ; indent based on nesting level
+ call print_spaces
+ mov al, [si + part.type] ; print partition type
+ call print_hex
+%endif
+
+ cmp BYTE [si + part.type], kPartTypeUFS
+ jne .continue
+ cmp BYTE [si + part.bootid], kPartActive
+ jne .continue
+
+ ;
+ ; Found boot partition, read boot1u image to memory.
+ ;
+ mov al, kBoot1uSectors
+ mov bx, kBoot1uSegment
+ mov es, bx
+ mov bx, kBoot1uAddress
+ call load ;
+ jc .continue ; load error, keep looking?
+
+DebugChar('^')
+ ;
+ ; Jump to boot1u. The drive number is already in register DL.
+ ;
+ ; The first sector loaded from the disk is reserved for the boot
+ ; block (boot1), adjust the jump location by adding a sector offset.
+ ;
+ jmp kBoot1uSegment:kBoot1uAddress + kSectorBytes
+
+.continue:
+ add si, part_size ; advance SI to next partition entry
+ loop .loop ; loop through all partition entries
+
+%if EXT_PART_SUPPORT
+ ;
+ ; No primary (or logical) boot partition found in the current
+ ; partition table. Restart and look for extended partitions.
+ ;
+ mov si, di ; make SI a pointer to partition table
+ mov cx, kPartCount ; number of partition entries per table
+
+.ext_loop:
+
+ mov al, [si + part.type] ; AL <- partition type
+
+ cmp al, kPartTypeExtDOS ; Extended DOS
+ je .ext_load
+
+ cmp al, kPartTypeExtWin ; Extended Windows(95)
+ je .ext_load
+
+ cmp al, kPartTypeExtLinux ; Extended Linux
+ je .ext_load
+
+.ext_continue:
+ ;
+ ; Advance si to the next partition entry in the extended
+ ; partition table.
+ ;
+ add si, part_size ; advance SI to next partition entry
+ loop .ext_loop ; loop through all partition entries
+ jmp .exit ; boot partition not found
+
+.ext_load:
+ ;
+ ; Setup the arguments for the load function call to bring the
+ ; extended partition table into memory.
+ ; Remember that SI points to the extended partition entry.
+ ;
+ mov al, 1 ; read 1 sector
+ xor bx, bx
+ mov es, bx ; es = 0
+ mov bx, kExtBuffer ; load extended boot sector
+ call load
+ jc .ext_continue ; load error
+
+ ;
+ ; The LBA address of all extended partitions is relative based
+ ; on the LBA address of the extended partition in the MBR, or
+ ; the extended partition at the head of the chain. Thus it is
+ ; necessary to save the LBA address of the first extended partition.
+ ;
+ or ah, ah
+ jnz .ext_find_boot
+ mov ebp, [si + part.lba]
+ mov [ebios_lba], ebp
+
+.ext_find_boot:
+ ;
+ ; Call find_boot recursively to scan through the extended partition
+ ; table. Load DI with a pointer to the extended table in memory.
+ ;
+ inc ah ; increment recursion level
+ mov di, kExtPartTable ; partition table pointer
+ call find_boot ; recursion...
+ ;dec ah
+
+ ;
+ ; Since there is an "unwritten" rule that limits each partition table
+ ; to have 0 or 1 extended partitions, there is no point in looking for
+ ; any additional extended partition entries at this point. There is no
+ ; boot partition linked beyond the extended partition that was loaded
+ ; above.
+ ;
+
+%endif ; EXT_PART_SUPPORT
+
+.exit:
+ ;
+ ; Boot partition not found. Giving up.
+ ;
+ pop si
+ pop cx
+ ret
+
+;--------------------------------------------------------------------------
+; load - Load one or more sectors from a partition.
+;
+; Arguments:
+; AL = number of 512-byte sectors to read.
+; ES:BX = pointer to where the sectors should be stored.
+; DL = drive number (0x80 + unit number)
+; SI = pointer to the partition entry.
+;
+; Returns:
+; CF = 0 success
+; 1 error
+;
+load:
+ push cx
+ test BYTE [ebios_present], 1
+ jz .chs
+
+.ebios:
+ mov cx, 5 ; load retry count
+.ebios_loop:
+ call read_lba ; use INT13/F42
+ jnc .exit
+ loop .ebios_loop
+
+.chs:
+ mov cx, 5 ; load retry count
+.chs_loop:
+ call read_chs ; use INT13/F2
+ jnc .exit
+ loop .chs_loop
+
+.exit
+ pop cx
+ ret
+
+;--------------------------------------------------------------------------
+; read_chs - Read sectors from a partition using CHS addressing.
+;
+; Arguments:
+; AL = number of 512-byte sectors to read.
+; ES:BX = pointer to where the sectors should be stored.
+; DL = drive number (0x80 + unit number)
+; SI = pointer to the partition entry.
+;
+; Returns:
+; CF = 0 success
+; 1 error
+;
+read_chs:
+ pusha ; save all registers
+
+ ;
+ ; Read the CHS start values from the partition entry.
+ ;
+ mov dh, [ si + part.head ] ; drive head
+ mov cx, [ si + part.sect ] ; drive sector + cylinder
+
+ ;
+ ; INT13 Func 2 - Read Disk Sectors
+ ;
+ ; Arguments:
+ ; AH = 2
+ ; AL = number of sectors to read
+ ; CH = lowest 8 bits of the 10-bit cylinder number
+ ; CL = bits 6 & 7: cylinder number bits 8 and 9
+ ; bits 0 - 5: starting sector number (1-63)
+ ; DH = starting head number (0 to 255)
+ ; DL = drive number (80h + drive unit)
+ ; es:bx = pointer where to place sectors read from disk
+ ;
+ ; Returns:
+ ; AH = return status (sucess is 0)
+ ; AL = burst error length if ah=0x11 (ECC corrected)
+ ; carry = 0 success
+ ; 1 error
+ ;
+; mov dl, kDriveNumber
+ mov ah, 0x02 ; Func 2
+ int 0x13 ; INT 13
+ jnc .exit
+
+ DebugChar('r') ; indicate INT13/F2 error
+
+ ;
+ ; Issue a disk reset on error.
+ ; Should this be changed to Func 0xD to skip the diskette controller
+ ; reset?
+ ;
+ xor ax, ax ; Func 0
+ int 0x13 ; INT 13
+ stc ; set carry to indicate error
+
+.exit:
+ popa
+ ret
+
+;--------------------------------------------------------------------------
+; read_lba - Read sectors from a partition using LBA addressing.
+;
+; Arguments:
+; AL = number of 512-byte sectors to read (valid from 1-127).
+; ES:BX = pointer to where the sectors should be stored.
+; DL = drive number (0x80 + unit number)
+; SI = pointer to the partition entry.
+;
+; Returns:
+; CF = 0 success
+; 1 error
+;
+read_lba:
+ pusha ; save all registers
+ mov bp, sp ; save current SP
+
+ ;
+ ; Create the Disk Address Packet structure for the
+ ; INT13/F42 (Extended Read Sectors) on the stack.
+ ;
+
+ ; push DWORD 0 ; offset 12, upper 32-bit LBA
+ push ds ; For sake of saving memory,
+ push ds ; push DS register, which is 0.
+
+ mov ecx, [ebios_lba] ; offset 8, lower 32-bit LBA
+ add ecx, [si + part.lba]
+ push ecx
+
+ push es ; offset 6, memory segment
+
+ push bx ; offset 4, memory offset
+
+ xor ah, ah ; offset 3, must be 0
+ push ax ; offset 2, number of sectors
+
+ push WORD 16 ; offset 0-1, packet size
+
+ ;
+ ; INT13 Func 42 - Extended Read Sectors
+ ;
+ ; Arguments:
+ ; AH = 0x42
+ ; DL = drive number (80h + drive unit)
+ ; DS:SI = pointer to Disk Address Packet
+ ;
+ ; Returns:
+ ; AH = return status (sucess is 0)
+ ; carry = 0 success
+ ; 1 error
+ ;
+ ; Packet offset 2 indicates the number of sectors read
+ ; successfully.
+ ;
+; mov dl, kDriveNumber
+ mov si, sp
+ mov ah, 0x42
+ int 0x13
+
+ jnc .exit
+
+ DebugChar('R') ; indicate INT13/F42 error
+
+ ;
+ ; Issue a disk reset on error.
+ ; Should this be changed to Func 0xD to skip the diskette controller
+ ; reset?
+ ;
+ xor ax, ax ; Func 0
+ int 0x13 ; INT 13
+ stc ; set carry to indicate error
+
+.exit:
+ mov sp, bp ; restore SP
+ popa
+ ret
+
+;--------------------------------------------------------------------------
+; Write a string to the console.
+;
+; Arguments:
+; DS:SI pointer to a NULL terminated string.
+;
+; Clobber list:
+; AX, BX, SI
+;
+print_string
+ mov bx, 1 ; BH=0, BL=1 (blue)
+ cld ; increment SI after each lodsb call
+.loop
+ lodsb ; load a byte from DS:SI into AL
+ cmp al, 0 ; Is it a NULL?
+ je .exit ; yes, all done
+ mov ah, 0xE ; INT10 Func 0xE
+ int 0x10 ; display byte in tty mode
+ jmp short .loop
+.exit
+ ret
+
+%if DEBUG
+
+;--------------------------------------------------------------------------
+; Write a ASCII character to the console.
+;
+; Arguments:
+; AL = ASCII character.
+;
+print_char
+ pusha
+ mov bx, 1 ; BH=0, BL=1 (blue)
+ mov ah, 0x0e ; bios INT 10, Function 0xE
+ int 0x10 ; display byte in tty mode
+ popa
+ ret
+
+;--------------------------------------------------------------------------
+; Write a variable number of spaces to the console.
+;
+; Arguments:
+; AL = number to spaces.
+;
+print_spaces:
+ pusha
+ xor cx, cx
+ mov cl, al ; use CX as the loop counter
+ mov al, ' ' ; character to print
+.loop:
+ jcxz .exit
+ call print_char
+ loop .loop
+.exit:
+ popa
+ ret
+
+;--------------------------------------------------------------------------
+; Write the byte value to the console in hex.
+;
+; Arguments:
+; AL = Value to be displayed in hex.
+;
+print_hex:
+ push ax
+ ror al, 4
+ call print_nibble ; display upper nibble
+ pop ax
+ call print_nibble ; display lower nibble
+
+ mov al, 10 ; carriage return
+ call print_char
+ mov al, 13
+ call print_char
+ ret
+
+print_nibble:
+ and al, 0x0f
+ add al, '0'
+ cmp al, '9'
+ jna .print_ascii
+ add al, 'A' - '9' - 1
+.print_ascii:
+ call print_char
+ ret
+
+%endif ; DEBUG
+
+;--------------------------------------------------------------------------
+; NULL terminated strings.
+;
+boot_error_str db 10, 13, 'Error', 0
+
+;--------------------------------------------------------------------------
+; Pad the rest of the 512 byte sized booter with zeroes. The last
+; two bytes is the mandatory boot sector signature.
+;
+; If the booter code becomes too large, then nasm will complain
+; that the 'times' argument is negative.
+
+;;pad_boot
+ ;; times 446-($-$$) db 0
+
+%ifdef FLOPPY
+;--------------------------------------------------------------------------
+; Put fake partition entries for the bootable floppy image
+;
+part1bootid db 0x80 ; first partition active
+part1head db 0x00 ; head #
+part1sect db 0x02 ; sector # (low 6 bits)
+part1cyl db 0x00 ; cylinder # (+ high 2 bits of above)
+part1systid db 0xab ; Apple boot partition
+times 3 db 0x00 ; ignore head/cyl/sect #'s
+part1relsect dd 0x00000001 ; start at sector 1
+part1numsect dd 0x00000080 ; 64K for booter
+part2bootid db 0x00 ; not active
+times 3 db 0x00 ; ignore head/cyl/sect #'s
+part2systid db 0xa8 ; Apple UFS partition
+times 3 db 0x00 ; ignore head/cyl/sect #'s
+part2relsect dd 0x00000082 ; start after booter
+; part2numsect dd 0x00000abe ; 1.44MB - 65K
+part2numsect dd 0x000015fe ; 2.88MB - 65K
+%endif
+
+pad_table_and_sig
+ times 510-($-$$) db 0
+ dw kBootSignature
+
+ END
--- /dev/null
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <string.h>
+#include "boot1u.h"
+#include <memory.h>
+#include <saio_types.h>
+#include <saio_internal.h>
+#include <fdisk.h>
+
+#include "ufs.h"
+
+/*
+ * trackbuf points to the start of the track cache. Biosread()
+ * will store the sectors read from disk to this memory area.
+ *
+ * biosbuf points to a sector within the track cache, and is
+ * updated by Biosread().
+ */
+#if 0
+static const char * const trackbuf = (char *) ptov(BIOS_ADDR);
+#endif
+static const char * biosbuf = (char *) ptov(BIOS_ADDR);
+
+/*
+ * 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 UFS_FRONT_PORCH 0
+
+#define ECC_CORRECTED_ERR 0x11
+
+//#undef DEBUG_DISK
+//#define DEBUG_DISK(x) printf x
+
+extern void bios(biosBuf_t *bb);
+
+static biosBuf_t bb;
+int ebiosread(int dev, long sec, int count)
+{
+ int i;
+ static struct {
+ unsigned char size;
+ unsigned char reserved;
+ unsigned char numblocks;
+ unsigned char reserved2;
+ unsigned short bufferOffset;
+ unsigned short bufferSegment;
+ unsigned long long startblock;
+ } addrpacket = {0};
+ addrpacket.size = sizeof(addrpacket);
+
+ for (i=0;;) {
+ bb.intno = 0x13;
+ bb.eax.r.h = 0x42;
+ bb.edx.r.l = dev;
+ bb.esi.rr = OFFSET((unsigned)&addrpacket);
+ bb.ds = SEGMENT((unsigned)&addrpacket);
+ addrpacket.reserved = addrpacket.reserved2 = 0;
+ addrpacket.numblocks = count;
+ addrpacket.bufferOffset = OFFSET(ptov(BIOS_ADDR));
+ addrpacket.bufferSegment = SEGMENT(ptov(BIOS_ADDR));
+ addrpacket.startblock = sec;
+ bios(&bb);
+ if ((bb.eax.r.h == 0x00) || (i++ >= 5))
+ break;
+
+ /* reset disk subsystem and try again */
+ bb.eax.r.h = 0x00;
+ bios(&bb);
+ }
+ return bb.eax.r.h;
+}
+
+//==========================================================================
+// Use BIOS INT13 calls to read the sector specified. This function will
+// also perform read-ahead to cache a few subsequent sector to the sector
+// cache.
+//
+// Return:
+// 0 on success, or an error code from INT13/F2 or INT13/F42 BIOS call.
+
+static int Biosread( int biosdev, unsigned int secno )
+{
+ int rc;
+
+ DEBUG_DISK(("Biosread dev %x sec %d \n", biosdev, secno));
+
+ rc = ebiosread(biosdev, secno, 1);
+ if (rc == ECC_CORRECTED_ERR) {
+ rc = 0;
+ }
+ return rc;
+}
+
+//==========================================================================
+
+static int readBytes( int biosdev, unsigned int blkno,
+ unsigned int byteCount, void * buffer )
+{
+
+ char * cbuf = (char *) buffer;
+ int error;
+ int copy_len;
+
+ DEBUG_DISK(("%s: dev %x block %x [%d] -> 0x%x...", __FUNCTION__,
+ biosdev, blkno, byteCount, (unsigned)cbuf));
+
+ for ( ; byteCount; cbuf += BPS, blkno++ )
+ {
+ error = Biosread( biosdev, blkno );
+ if ( error )
+ {
+ DEBUG_DISK(("error\n"));
+ return (-1);
+ }
+
+ copy_len = (byteCount > BPS) ? BPS : byteCount;
+ bcopy( biosbuf, cbuf, copy_len );
+ byteCount -= copy_len;
+ }
+
+ DEBUG_DISK(("done\n"));
+
+ return 0;
+}
+
+//==========================================================================
+
+//==========================================================================
+// Handle seek request from filesystem modules.
+
+void diskSeek( BVRef bvr, long long position )
+{
+ bvr->fs_boff = position / BPS;
+}
+
+//==========================================================================
+// Handle read request from filesystem modules.
+
+int diskRead( BVRef bvr, long addr, long length )
+{
+ return readBytes( bvr->biosdev,
+ bvr->fs_boff + bvr->part_boff,
+ length,
+ (void *) addr );
+}
+
+int
+findUFSPartition(int dev, struct fdisk_part *_fp)
+{
+ struct disk_blk0 *db;
+ struct fdisk_part *fp;
+ int i, cc;
+ unsigned long offset = 0;
+
+ db = (struct disk_blk0 *)biosbuf;
+ for (i=0; i<FDISK_NPART; i++) {
+ DEBUG_DISK(("i=%d, %ld\n", i, offset));
+ if (i==0) {
+ DEBUG_DISK(("reading\n"));
+ cc = Biosread(dev, offset);
+ if (cc < 0) {
+ return cc;
+ }
+ }
+ fp = (struct fdisk_part *)&db->parts[i];
+ DEBUG_DISK(("systid %x\n", fp->systid));
+ if (fp->systid == 0xA8) {
+ bcopy(fp, _fp, sizeof(struct fdisk_part));
+ _fp->relsect += offset;
+ DEBUG_DISK(("found %d\n", i));
+ return 0;
+ } else if (fp->systid == 0x05 ||
+ fp->systid == 0x0F ||
+ fp->systid == 0x85) {
+ offset += fp->relsect;
+ i = -1;
+ continue;
+ }
+ }
+ return -1;
+}
+
+
+void
+initUFSBVRef( BVRef bvr, int biosdev, const struct fdisk_part * part)
+{
+ bvr->biosdev = biosdev;
+ bvr->part_no = 0;
+ bvr->part_boff = part->relsect + UFS_FRONT_PORCH/BPS,
+ bvr->part_type = part->systid;
+ bvr->fs_loadfile = UFSLoadFile;
+ bvr->fs_getdirentry = UFSGetDirEntry;
+ bvr->description = 0;
+}
+
+void putc(int ch)
+{
+ bb.intno = 0x10;
+ bb.ebx.r.h = 0x00; /* background black */
+ bb.ebx.r.l = 0x0F; /* foreground white */
+ bb.eax.r.h = 0x0e;
+ bb.eax.r.l = ch;
+ bios(&bb);
+}
+
+int bgetc(void)
+{
+ bb.intno = 0x16;
+ bb.eax.r.h = 0x00;
+ bios(&bb);
+ return bb.eax.rr;
+}
+
+void delay(int ms)
+{
+ bb.intno = 0x15;
+ bb.eax.r.h = 0x86;
+ bb.ecx.rr = ms >> 16;
+ bb.edx.rr = ms & 0xFFFF;
+ bios(&bb);
+}
--- /dev/null
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+extern void initUFSBVRef( BVRef bvr, int biosdev, const struct fdisk_part * part);
+extern int findUFSPartition(int dev, struct fdisk_part *_fp);
--- /dev/null
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <libsa.h>
+#include <libsa/memory.h>
+
+static void *m_ptr = (void *)ZALLOC_ADDR;
+
+void *malloc(size_t size)
+{
+ void *result = m_ptr;
+ m_ptr += size;
+ return result;
+}
+
+void free(void *ptr)
+{
+ // Do nothing
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include "libsa.h"
+
+extern void putc(int c);
+
+/*
+ * write one character to console
+ */
+void putchar(int c)
+{
+ if ( c == '\t' )
+ {
+ for (c = 0; c < 8; c++) putc(' ');
+ return;
+ }
+
+ if ( c == '\n' )
+ {
+ putc('\r');
+ }
+
+ putc(c);
+}
+
+int printf(const char * fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ prf(fmt, ap, putchar, 0);
+ va_end(ap);
+ return 0;
+}
+
+int verbose(const char * fmt, ...)
+{
+#if 1
+ va_list ap;
+
+ va_start(ap, fmt);
+ prf(fmt, ap, putchar, 0);
+ va_end(ap);
+#endif
+ return(0);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/* string operations */
+
+#include "libsa.h"
+
+void * memset(void * dst, int val, size_t len)
+{
+ asm( "rep; stosb"
+ : "=c" (len), "=D" (dst)
+ : "0" (len), "1" (dst), "a" (val)
+ : "memory" );
+
+ return dst;
+}
+
+void * memcpy(void * dst, const void * src, size_t len)
+{
+ asm( "rep; movsb"
+ : "=c" (len), "=D" (dst), "=S" (src)
+ : "0" (len), "1" (dst), "2" (src)
+ : "memory" );
+
+ return dst;
+}
+
+void bcopy(const void * src, void * dst, size_t len)
+{
+ memcpy(dst, src, len);
+}
+
+void bzero(void * dst, size_t len)
+{
+ memset(dst, 0, len);
+}
+
+#if 0
+/* #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 = 0;
+ while (*s++) n++;
+ return(n);
+}
+
+/*#endif*/
+#endif
+
+int
+strcmp(const char * s1, const char * s2)
+{
+ while (*s1 && (*s1 == *s2)) {
+ s1++;
+ s2++;
+ }
+ return (*s1 - *s2);
+}
+
+#if 0
+int strncmp(const char * s1, const char * s2, size_t len)
+{
+ register int n = len;
+ while (--n >= 0 && *s1 == *s2++)
+ if (*s1++ == '\0')
+ return(0);
+ return(n<0 ? 0 : *s1 - *--s2);
+}
+
+char *
+strcpy(char * s1, const char * s2)
+{
+ register char *ret = s1;
+ while (*s1++ = *s2++)
+ continue;
+ return ret;
+}
+#endif
+
+char *
+strncpy(char * s1, const char * s2, size_t n)
+{
+ register char *ret = s1;
+ while (n && (*s1++ = *s2++))
+ n--;
+ return ret;
+}
+
+char *
+strlcpy(char * s1, const char * s2, size_t n)
+{
+ register char *ret = s1;
+ while (n && (*s1++ = *s2++))
+ n--;
+ if (!n) *--s1=0;
+ return ret;
+}
+
+#if 0
+int
+ptol(const 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;
+}
+#endif
+
+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;
+}
+
+#if 0
+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
+#endif
OPTIM = -Os
CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
- -fno-builtin -DSAIO_INTERNAL_USER -static
+ -fno-builtin -DSAIO_INTERNAL_USER -static \
+ -fomit-frame-pointer -mpreferred-stack-boundary=2 \
+ -fno-align-functions
DEFINES=
CONFIG = hd
SYMDIR = $(SYMROOT)
LD = ld
# LIBS= -lc_static
LIBS= -L$(SYMDIR) -lsaio -lsa -lrcz
+LIBDEP= $(SYMDIR)/libsaio.a $(SYMDIR)/libsa.a $(SYMDIR)/librcz.a
OTHER_FILES =
# The ordering is important;
# boot2.o must be first.
-OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o
+OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o
# button.o browser.o scrollbar.o == NOTYET
UTILDIR = ../util
SFILES = boot2.s
CFILES = boot.c graphics.c drivers.c prompt.c options.c
-HFILES = boot.h
+HFILES = boot.h appleClut8.h appleboot.h
OTHERFILES = Makefile
ALLSRC = $(FOREIGNSRC) $(FOREIGNBIN) $(SFILES) $(CFILES) \
$(HFILES) $(OTHERFILES)
all: $(DIRS_NEEDED) boot
-boot: machOconv $(OBJS)
+boot: machOconv $(OBJS) $(LIBDEP)
$(LD) -static -preload -segaddr __TEXT $(BOOT2ADDR) -segalign 20 \
-o $(SYMROOT)/boot.sys $(OBJS) $(LIBS) -lcc_kext
machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
static const unsigned char appleClut8[ 256 * 3 ] =
{
- 0xff,0xff,0xff, 0xfe,0xfe,0xfe, 0xfd,0xfd,0xfd, 0xb8,0x27,0x2b,
- 0xfc,0xfc,0xfc, 0xff,0xff,0x00, 0xfa,0xfa,0xfa, 0xf9,0xf9,0xf9,
- 0xf8,0xf8,0xf8, 0xf7,0xf7,0xf7, 0xf6,0xf6,0xf6, 0xf5,0xf5,0xf5,
- 0xf4,0xf4,0xf4, 0xf2,0xf2,0xf2, 0xf1,0xf1,0xf1, 0x00,0x00,0x00,
- 0xef,0xef,0xef, 0xee,0xee,0xee, 0xed,0xed,0xed, 0xeb,0xeb,0xeb,
- 0xe8,0xe8,0xe8, 0xe7,0xe7,0xe7, 0xc9,0x38,0x3e, 0xe5,0xe5,0xe5,
- 0xff,0x00,0xff, 0xfb,0xfb,0xfb, 0xde,0x6c,0x72, 0xe0,0xe0,0xe0,
- 0xe8,0x86,0x90, 0xde,0xde,0xde, 0xdd,0xdd,0xdd, 0xd3,0x7e,0x8d,
- 0xd9,0xd9,0xd9, 0xf3,0x96,0xa6, 0xb1,0x1c,0x39, 0xff,0x00,0x00,
- 0xbe,0x5e,0x72, 0xd3,0xd3,0xd3, 0xc6,0x2e,0x67, 0xd1,0xd1,0xd1,
- 0xa3,0x06,0x45, 0xce,0xce,0xce, 0xcc,0xcc,0xff, 0xcc,0xcc,0xcc,
- 0xc6,0x8f,0xa7, 0xe1,0xd3,0xd9, 0xce,0x9e,0xb4, 0xca,0xca,0xca,
- 0xbf,0x3f,0x7d, 0xc9,0xc9,0xc9, 0xf4,0x89,0xbe, 0xc6,0xc6,0xc6,
- 0xd6,0x51,0x97, 0xc9,0x2c,0x84, 0x96,0x1a,0x6a, 0xc2,0xc2,0xc2,
- 0xf3,0x6f,0xc6, 0xe5,0x4c,0xbb, 0xb7,0x5a,0x9c, 0xbf,0xbf,0xbf,
- 0xbe,0xbe,0xbe, 0xbd,0xbd,0xbd, 0xb8,0x21,0xa2, 0xd3,0x44,0xc0,
- 0xc2,0x66,0xb7, 0xf4,0x66,0xe6, 0xfc,0x73,0xfd, 0xb9,0xb9,0xb9,
- 0xea,0xdf,0xea, 0xd4,0x71,0xd5, 0xf9,0x8b,0xff, 0xf5,0xad,0xff,
- 0xbc,0x92,0xc2, 0xc7,0x4f,0xd9, 0xa0,0x44,0xaf, 0xc8,0x8c,0xd5,
- 0xd7,0x74,0xf7, 0xb4,0xb4,0xb4, 0xda,0x95,0xf9, 0xed,0xcb,0xff,
- 0xb2,0xb2,0xb2, 0xa1,0x61,0xd7, 0xb2,0x85,0xe2, 0x59,0x26,0x9c,
- 0x7c,0x51,0xcc, 0xb0,0xb0,0xb0, 0xb4,0x8e,0xfc, 0xd5,0xc0,0xff,
- 0x5d,0x32,0xcc, 0x7b,0x5c,0xe5, 0xc0,0xb0,0xfd, 0x60,0x53,0xad,
- 0x12,0x0c,0x7e, 0x2e,0x29,0x99, 0x79,0x78,0xe9, 0x5b,0x5c,0xd0,
- 0x69,0x6a,0xcc, 0x93,0x94,0xf8, 0x92,0x92,0xc3, 0x41,0x44,0xba,
- 0xa8,0xab,0xff, 0xa3,0xa3,0xa3, 0xdb,0xdd,0xea, 0x31,0x49,0xaa,
- 0x70,0x8f,0xf9, 0x48,0x66,0xc1, 0x5c,0x7e,0xe9, 0xe2,0xe5,0xeb,
- 0xb0,0xcd,0xff, 0x6c,0x89,0xb7, 0x34,0x65,0xaf, 0x8c,0xb9,0xff,
- 0x37,0x79,0xd4, 0x5a,0x99,0xea, 0x0e,0x4c,0x95, 0x79,0xb9,0xff,
- 0x8a,0xa3,0xbc, 0x20,0x61,0x9d, 0x8f,0xae,0xca, 0x0a,0x60,0xa8,
- 0x3f,0x94,0xd9, 0x63,0xb5,0xf9, 0xe2,0xe8,0xed, 0x28,0x6a,0x99,
- 0x55,0xb2,0xe7, 0x32,0x89,0xa9, 0xcf,0xda,0xde, 0x29,0xa1,0xc7,
- 0x86,0xa9,0xb4, 0x00,0x5f,0x79, 0x0c,0x77,0x8e, 0x12,0x8f,0xab,
- 0x41,0xba,0xd5, 0x24,0x82,0x83, 0x2c,0xc4,0xc3, 0x1a,0xab,0xa6,
- 0x4b,0xa8,0xa2, 0x0a,0x93,0x85, 0x0d,0xa5,0x96, 0x26,0xbc,0xac,
- 0x04,0x81,0x72, 0x19,0xb3,0x86, 0x29,0xc1,0x94, 0x21,0x9c,0x71,
- 0x02,0x8c,0x50, 0x35,0xd0,0x89, 0x46,0xa5,0x76, 0x02,0x7d,0x39,
- 0x29,0xc9,0x71, 0x57,0xd6,0x8f, 0xa2,0xb5,0xaa, 0x01,0x88,0x2a,
- 0x74,0xbe,0x8a, 0x19,0xb6,0x47, 0x2d,0xc6,0x51, 0x38,0xde,0x5d,
- 0x4c,0xf4,0x6f, 0x91,0x9c,0x93, 0x00,0x8e,0x19, 0x10,0xaf,0x28,
- 0xe3,0xe3,0xe3, 0x08,0xa1,0x1a, 0x59,0xc2,0x61, 0xf0,0xf0,0xf0,
- 0x8f,0x9c,0x90, 0x23,0xce,0x2a, 0x12,0xba,0x17, 0x01,0x8a,0x02,
- 0x03,0x9a,0x02, 0x40,0xe4,0x40, 0x08,0xb2,0x05, 0x13,0xcc,0x0f,
- 0x36,0xd7,0x32, 0x28,0xe9,0x1f, 0x53,0xfb,0x4c, 0x6f,0xaf,0x6a,
- 0x71,0xe0,0x67, 0x32,0xc0,0x12, 0x29,0xa5,0x08, 0x5c,0xdd,0x35,
- 0x00,0xff,0xff, 0x63,0xc8,0x45, 0x86,0xfd,0x5b, 0x71,0xf6,0x39,
- 0x55,0xcc,0x15, 0x00,0xff,0x00, 0x90,0xca,0x6e, 0x43,0xa7,0x01,
- 0x8d,0xe4,0x37, 0xb3,0xf0,0x64, 0x85,0x8e,0x7a, 0xb0,0xfa,0x4d,
- 0xd6,0xd6,0xd6, 0x88,0xd0,0x1a, 0x6a,0xa7,0x03, 0x98,0xbf,0x41,
- 0xcd,0xf8,0x51, 0x94,0xa4,0x55, 0x91,0xb0,0x0a, 0xda,0xf1,0x3c,
- 0xba,0xca,0x53, 0xb9,0xc3,0x28, 0xb1,0xba,0x12, 0xd2,0xd9,0x26,
- 0xe8,0xec,0x2d, 0x98,0x96,0x02, 0xad,0xad,0x5c, 0xe2,0xd8,0x38,
- 0xd9,0xc4,0x38, 0xa8,0x9a,0x50, 0x00,0x00,0xff, 0xbe,0xae,0x5e,
- 0x9a,0x98,0x8e, 0xac,0x8d,0x0d, 0xc5,0xa0,0x2b, 0xdb,0xb5,0x48,
- 0xdd,0x00,0x00, 0x9c,0x6d,0x03, 0xd4,0xa8,0x47, 0xb7,0x71,0x17,
- 0xdc,0xa1,0x5a, 0xb9,0x9c,0x7c, 0xb4,0xab,0xa2, 0x9e,0x4b,0x01,
- 0xc8,0x78,0x35, 0xd2,0x8d,0x51, 0xad,0x52,0x0f, 0x00,0xbb,0x00,
- 0xb2,0x66,0x38, 0xb1,0xa6,0x9f, 0xb1,0x87,0x6f, 0xa4,0x34,0x03,
- 0xee,0x9e,0x85, 0xc9,0x73,0x5a, 0xe6,0x94,0x7c, 0xa9,0x22,0x06,
- 0xdb,0x87,0x74, 0xb0,0x2e,0x15, 0xb7,0x5a,0x50, 0xb2,0x42,0x3b,
- 0xcd,0x73,0x6e, 0xd9,0x58,0x58, 0xac,0xac,0xac, 0xa0,0xa0,0xa0,
- 0x9a,0x9a,0x9a, 0x92,0x92,0x92, 0x8e,0x8e,0x8e, 0xbb,0xbb,0xbb,
- 0x81,0x81,0x81, 0x88,0x88,0x88, 0x77,0x77,0x77, 0x55,0x55,0x55,
- 0x44,0x44,0x44, 0x22,0x22,0x22, 0x7b,0x7b,0x7b, 0x00,0x00,0x00
+ 0xff,0xff,0xff, 0xbf,0xbf,0xbf, 0xbe,0xbe,0xbe, 0xbd,0xbd,0xbd,
+ 0xbc,0xbc,0xbc, 0xff,0xff,0x00, 0xba,0xba,0xba, 0xb9,0xb9,0xb9,
+ 0xb8,0xb8,0xb8, 0xb7,0xb7,0xb7, 0xb6,0xb6,0xb6, 0xb5,0xb5,0xb5,
+ 0xb4,0xb4,0xb4, 0xb3,0xb3,0xb3, 0xb2,0xb2,0xb2, 0x00,0x00,0x00,
+ 0xb1,0xb1,0xb1, 0xb0,0xb0,0xb0, 0xaf,0xaf,0xaf, 0xae,0xae,0xae,
+ 0xad,0xad,0xad, 0xac,0xac,0xac, 0xab,0xab,0xab, 0xaa,0xaa,0xaa,
+ 0xff,0x00,0xff, 0xa9,0xa9,0xa9, 0xa8,0xa8,0xa8, 0xa7,0xa7,0xa7,
+ 0xa6,0xa6,0xa6, 0xa5,0xa5,0xa5, 0xa4,0xa4,0xa4, 0xa3,0xa3,0xa3,
+ 0xa2,0xa2,0xa2, 0xa1,0xa1,0xa1, 0xa0,0xa0,0xa0, 0xff,0x00,0x00,
+ 0x9f,0x9f,0x9f, 0x9e,0x9e,0x9e, 0x9d,0x9d,0x9d, 0x9c,0x9c,0x9c,
+ 0x9b,0x9b,0x9b, 0x9a,0x9a,0x9a, 0xcc,0xcc,0xff, 0xcc,0xcc,0xcc,
+ 0x99,0x99,0x99, 0x98,0x98,0x98, 0x97,0x97,0x97, 0x96,0x96,0x96,
+ 0x95,0x95,0x95, 0x94,0x94,0x94, 0x93,0x93,0x93, 0x92,0x92,0x92,
+ 0x91,0x91,0x91, 0x90,0x90,0x90, 0x8f,0x8f,0x8f, 0x8e,0x8e,0x8e,
+ 0x8d,0x8d,0x8d, 0x8c,0x8c,0x8c, 0x8b,0x8b,0x8b, 0x8a,0x8a,0x8a,
+ 0x89,0x89,0x89, 0x87,0x87,0x87, 0x86,0x86,0x86, 0x85,0x85,0x85,
+ 0x84,0x84,0x84, 0x83,0x83,0x83, 0x82,0x82,0x82, 0x81,0x81,0x81,
+ 0x80,0x80,0x80, 0x7f,0x7f,0x7f, 0x7e,0x7e,0x7e, 0x7d,0x7d,0x7d,
+ 0x7c,0x7c,0x7c, 0x7b,0x7b,0x7b, 0x7a,0x7a,0x7a, 0x79,0x79,0x79,
+ 0x78,0x78,0x78, 0x76,0x76,0x76, 0x75,0x75,0x75, 0x74,0x74,0x74,
+ 0x73,0x73,0x73, 0x72,0x72,0x72, 0x71,0x71,0x71, 0x70,0x70,0x70,
+ 0x6f,0x6f,0x6f, 0x6e,0x6e,0x6e, 0x6d,0x6d,0x6d, 0x6c,0x6c,0x6c,
+ 0x6b,0x6b,0x6b, 0x6a,0x6a,0x6a, 0x69,0x69,0x69, 0x68,0x68,0x68,
+ 0x67,0x67,0x67, 0x66,0x66,0x66, 0x64,0x64,0x64, 0x63,0x63,0x63,
+ 0x62,0x62,0x62, 0x61,0x61,0x61, 0x60,0x60,0x60, 0x5f,0x5f,0x5f,
+ 0x5e,0x5e,0x5e, 0x5d,0x5d,0x5d, 0x5c,0x5c,0x5c, 0x5b,0x5b,0x5b,
+ 0x5a,0x5a,0x5a, 0x59,0x59,0x59, 0x58,0x58,0x58, 0x57,0x57,0x57,
+ 0x56,0x56,0x56, 0x54,0x54,0x54, 0x53,0x53,0x53, 0x52,0x52,0x52,
+ 0x51,0x51,0x51, 0x50,0x50,0x50, 0x4f,0x4f,0x4f, 0x4e,0x4e,0x4e,
+ 0x4d,0x4d,0x4d, 0x4c,0x4c,0x4c, 0x4b,0x4b,0x4b, 0x4a,0x4a,0x4a,
+ 0x49,0x49,0x49, 0x48,0x48,0x48, 0x47,0x47,0x47, 0x46,0x46,0x46,
+ 0x45,0x45,0x45, 0x43,0x43,0x43, 0x42,0x42,0x42, 0x41,0x41,0x41,
+ 0x40,0x40,0x40, 0x3f,0x3f,0x3f, 0x3e,0x3e,0x3e, 0x3d,0x3d,0x3d,
+ 0x3c,0x3c,0x3c, 0x3b,0x3b,0x3b, 0x3a,0x3a,0x3a, 0x39,0x39,0x39,
+ 0x38,0x38,0x38, 0x37,0x37,0x37, 0x36,0x36,0x36, 0x35,0x35,0x35,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x00,0xff,0xff, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x00,0xff,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x00,0x00,0xff, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0xdd,0x00,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x00,0xbb,0x00,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
+ 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0xbb,0xbb,0xbb,
+ 0x65,0x65,0x65, 0x88,0x88,0x88, 0x77,0x77,0x77, 0x55,0x55,0x55,
+ 0x44,0x44,0x44, 0x22,0x22,0x22, 0x65,0x65,0x65, 0x00,0x00,0x00
};
#endif /* !__BOOT2_APPLECLUT8_H */
--- /dev/null
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/*
+ * appleboot.h - Apple logo shown durring boot
+ *
+ * Copyright (c) 2002 Apple Computer, Inc.
+ *
+ * DRI: Josh de Cesare
+ */
+
+#define kAppleBootWidth (128)
+#define kAppleBootHeight (128)
+#define kAppleBootOffset (0)
+#define kAppleBootFrames (1)
+#define kAppleBootFPS (0)
+#define kAppleBootRLEBlocks (686)
+
+// The original data was 16K in size (128x128) and would make the booter
+// cross a 64K segment boundary. boot0 cannot load more than 127 sectors
+// without changes. To eiminate that complexity, the data was run length
+// encoded to save space. The reduced size is 1372 bytes.
+
+const unsigned char gAppleBootPictRLE[] =
+{
+ 0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0x50, 0x01, 0x01, 0x02, 0x01, 0x17,
+ 0x01, 0x34, 0x01, 0x47, 0x03, 0x50, 0x01, 0x13, 0x76, 0x01, 0x01, 0x03,
+ 0x01, 0x20, 0x01, 0x40, 0x06, 0x50, 0x01, 0x13, 0x75, 0x01, 0x01, 0x1a,
+ 0x01, 0x42, 0x07, 0x50, 0x01, 0xfa, 0x01, 0x0a, 0x73, 0x01, 0x01, 0x07,
+ 0x01, 0x34, 0x09, 0x50, 0x01, 0x43, 0x01, 0x02, 0x72, 0x01, 0x01, 0x0e,
+ 0x01, 0x43, 0x0a, 0x50, 0x01, 0x36, 0x72, 0x01, 0x01, 0x14, 0x01, 0x4a,
+ 0x0b, 0x50, 0x01, 0x20, 0x71, 0x01, 0x01, 0x12, 0x01, 0x4b, 0x0b, 0x50,
+ 0x01, 0x4d, 0x01, 0x0b, 0x70, 0x01, 0x01, 0x0b, 0x01, 0x48, 0x0c, 0x50,
+ 0x01, 0xf9, 0x70, 0x01, 0x01, 0x03, 0x01, 0x3e, 0x0d, 0x50, 0x01, 0x1f,
+ 0x70, 0x01, 0x01, 0x2f, 0x0d, 0x50, 0x01, 0x48, 0x01, 0x06, 0x6f, 0x01,
+ 0x01, 0x15, 0x01, 0x4f, 0x0d, 0x50, 0x01, 0x27, 0x6f, 0x01, 0x01, 0x02,
+ 0x01, 0x3f, 0x0d, 0x50, 0x01, 0x45, 0x01, 0xf7, 0x6f, 0x01, 0x01, 0x1d,
+ 0x0e, 0x50, 0x01, 0x19, 0x6f, 0x01, 0x01, 0x02, 0x01, 0x40, 0x0d, 0x50,
+ 0x01, 0x2f, 0x70, 0x01, 0x01, 0x15, 0x0d, 0x50, 0x01, 0x3b, 0x01, 0x03,
+ 0x70, 0x01, 0x01, 0x34, 0x0c, 0x50, 0x01, 0x3f, 0x01, 0x07, 0x70, 0x01,
+ 0x01, 0xf7, 0x01, 0x47, 0x0b, 0x50, 0x01, 0xf9, 0x01, 0x07, 0x71, 0x01,
+ 0x01, 0x14, 0x0b, 0x50, 0x01, 0x36, 0x01, 0xf7, 0x72, 0x01, 0x01, 0x24,
+ 0x09, 0x50, 0x01, 0x4d, 0x01, 0x28, 0x74, 0x01, 0x01, 0x33, 0x08, 0x50,
+ 0x01, 0x3f, 0x01, 0x14, 0x75, 0x01, 0x01, 0x3a, 0x06, 0x50, 0x01, 0x41,
+ 0x01, 0x1f, 0x01, 0x02, 0x76, 0x01, 0x01, 0x3a, 0x03, 0x50, 0x01, 0x48,
+ 0x01, 0x35, 0x01, 0x17, 0x01, 0x02, 0x78, 0x01, 0x01, 0x15, 0x01, 0x33,
+ 0x01, 0x27, 0x01, 0x15, 0x01, 0xf7, 0x67, 0x01, 0x01, 0x02, 0x01, 0x08,
+ 0x01, 0x0e, 0x01, 0x13, 0x01, 0x14, 0x01, 0x12, 0x01, 0x0d, 0x01, 0x06,
+ 0x01, 0x02, 0x1c, 0x01, 0x01, 0x04, 0x01, 0x0b, 0x01, 0x12, 0x01, 0x17,
+ 0x01, 0x19, 0x01, 0x15, 0x01, 0x11, 0x01, 0x08, 0x01, 0x02, 0x4e, 0x01,
+ 0x01, 0x02, 0x01, 0x11, 0x01, 0x26, 0x01, 0x39, 0x01, 0x44, 0x01, 0x4c,
+ 0x01, 0x4f, 0x02, 0x50, 0x01, 0x4f, 0x01, 0x4d, 0x01, 0x4a, 0x01, 0x3f,
+ 0x01, 0x31, 0x01, 0x19, 0x01, 0xf7, 0x15, 0x01, 0x01, 0x0b, 0x01, 0x1c,
+ 0x01, 0x2e, 0x01, 0xf9, 0x01, 0x46, 0x01, 0x4d, 0x04, 0x50, 0x01, 0x4f,
+ 0x01, 0x4b, 0x01, 0x42, 0x01, 0x34, 0x01, 0x1f, 0x01, 0x0a, 0x49, 0x01,
+ 0x01, 0xf7, 0x01, 0x21, 0x01, 0x3f, 0x01, 0x4f, 0x0d, 0x50, 0x01, 0x47,
+ 0x01, 0x2d, 0x01, 0x0d, 0x10, 0x01, 0x01, 0x0d, 0x01, 0x25, 0x01, 0x3d,
+ 0x01, 0xfa, 0x0e, 0x50, 0x01, 0x4c, 0x01, 0x37, 0x01, 0x15, 0x45, 0x01,
+ 0x01, 0x04, 0x01, 0x25, 0x01, 0x45, 0x12, 0x50, 0x01, 0x4d, 0x01, 0x39,
+ 0x01, 0x19, 0x01, 0x02, 0x0a, 0x01, 0x01, 0x09, 0x01, 0x21, 0x01, 0xf9,
+ 0x01, 0x4d, 0x14, 0x50, 0x01, 0xf9, 0x01, 0x15, 0x42, 0x01, 0x01, 0x17,
+ 0x01, 0x42, 0x17, 0x50, 0x01, 0x42, 0x01, 0x27, 0x01, 0x0e, 0x01, 0x02,
+ 0x03, 0x01, 0x01, 0x02, 0x01, 0x0b, 0x01, 0x1f, 0x01, 0x38, 0x01, 0x4b,
+ 0x19, 0x50, 0x01, 0x33, 0x01, 0x06, 0x3e, 0x01, 0x01, 0x03, 0x01, 0x2e,
+ 0x1b, 0x50, 0x01, 0x4d, 0x01, 0x43, 0x01, 0x3a, 0x01, 0x37, 0x01, 0x3a,
+ 0x01, 0x42, 0x01, 0x4d, 0x1d, 0x50, 0x01, 0x42, 0x01, 0x0e, 0x3c, 0x01,
+ 0x01, 0x0a, 0x01, 0xf9, 0x41, 0x50, 0x01, 0x48, 0x01, 0x13, 0x3a, 0x01,
+ 0x01, 0x0d, 0x01, 0x45, 0x43, 0x50, 0x01, 0x4b, 0x01, 0x12, 0x38, 0x01,
+ 0x01, 0x10, 0x01, 0x48, 0x45, 0x50, 0x01, 0x48, 0x01, 0x0b, 0x36, 0x01,
+ 0x01, 0x0c, 0x01, 0x48, 0x47, 0x50, 0x01, 0x3d, 0x01, 0x03, 0x34, 0x01,
+ 0x01, 0x07, 0x01, 0x42, 0x49, 0x50, 0x01, 0x21, 0x34, 0x01, 0x01, 0x37,
+ 0x49, 0x50, 0x01, 0x42, 0x01, 0x12, 0x33, 0x01, 0x01, 0x22, 0x49, 0x50,
+ 0x01, 0x34, 0x01, 0xf7, 0x33, 0x01, 0x01, 0x0b, 0x01, 0x4b, 0x48, 0x50,
+ 0x01, 0x2c, 0x35, 0x01, 0x01, 0x36, 0x48, 0x50, 0x01, 0x29, 0x35, 0x01,
+ 0x01, 0x11, 0x01, 0x4f, 0x47, 0x50, 0x01, 0x2e, 0x36, 0x01, 0x01, 0x36,
+ 0x47, 0x50, 0x01, 0x3a, 0x01, 0x02, 0x35, 0x01, 0x01, 0x0b, 0x01, 0xfa,
+ 0x46, 0x50, 0x01, 0x46, 0x01, 0x08, 0x36, 0x01, 0x01, 0x26, 0x46, 0x50,
+ 0x01, 0x4e, 0x01, 0x15, 0x36, 0x01, 0x01, 0x02, 0x01, 0x40, 0x46, 0x50,
+ 0x01, 0x31, 0x37, 0x01, 0x01, 0x0e, 0x01, 0x4e, 0x45, 0x50, 0x01, 0x49,
+ 0x01, 0x08, 0x37, 0x01, 0x01, 0x25, 0x46, 0x50, 0x01, 0x29, 0x38, 0x01,
+ 0x01, 0x39, 0x45, 0x50, 0x01, 0x4c, 0x01, 0x0a, 0x37, 0x01, 0x01, 0xf7,
+ 0x01, 0x47, 0x45, 0x50, 0x01, 0x3a, 0x38, 0x01, 0x01, 0x10, 0x01, 0x4f,
+ 0x45, 0x50, 0x01, 0x22, 0x38, 0x01, 0x01, 0x1d, 0x46, 0x50, 0x01, 0x12,
+ 0x38, 0x01, 0x01, 0x29, 0x45, 0x50, 0x01, 0x4b, 0x01, 0x07, 0x38, 0x01,
+ 0x01, 0x36, 0x45, 0x50, 0x01, 0x42, 0x01, 0x02, 0x38, 0x01, 0x01, 0xf9,
+ 0x45, 0x50, 0x01, 0x3e, 0x39, 0x01, 0x01, 0x42, 0x45, 0x50, 0x01, 0x3c,
+ 0x39, 0x01, 0x01, 0x46, 0x45, 0x50, 0x01, 0x3b, 0x39, 0x01, 0x01, 0x48,
+ 0x45, 0x50, 0x01, 0xf9, 0x39, 0x01, 0x01, 0x48, 0x45, 0x50, 0x01, 0x3f,
+ 0x01, 0x02, 0x38, 0x01, 0x01, 0x46, 0x45, 0x50, 0x01, 0x48, 0x01, 0xf7,
+ 0x38, 0x01, 0x01, 0x43, 0x45, 0x50, 0x01, 0x4e, 0x01, 0x0e, 0x38, 0x01,
+ 0x01, 0x3f, 0x46, 0x50, 0x01, 0x1c, 0x38, 0x01, 0x01, 0x3a, 0x46, 0x50,
+ 0x01, 0x33, 0x38, 0x01, 0x01, 0x34, 0x46, 0x50, 0x01, 0x46, 0x01, 0x04,
+ 0x37, 0x01, 0x01, 0x2c, 0x47, 0x50, 0x01, 0x19, 0x37, 0x01, 0x01, 0x1f,
+ 0x47, 0x50, 0x01, 0x3a, 0x37, 0x01, 0x01, 0x15, 0x47, 0x50, 0x01, 0x4e,
+ 0x01, 0x11, 0x36, 0x01, 0x01, 0x0a, 0x01, 0xfa, 0x47, 0x50, 0x01, 0x37,
+ 0x36, 0x01, 0x01, 0x02, 0x01, 0x42, 0x47, 0x50, 0x01, 0x4f, 0x01, 0x15,
+ 0x36, 0x01, 0x01, 0x37, 0x48, 0x50, 0x01, 0x42, 0x01, 0x04, 0x35, 0x01,
+ 0x01, 0x25, 0x49, 0x50, 0x01, 0x2c, 0x35, 0x01, 0x01, 0x13, 0x49, 0x50,
+ 0x01, 0x4e, 0x01, 0x15, 0x34, 0x01, 0x01, 0xf7, 0x01, 0x47, 0x49, 0x50,
+ 0x01, 0x48, 0x01, 0x0b, 0x34, 0x01, 0x01, 0x37, 0x4a, 0x50, 0x01, 0x44,
+ 0x01, 0x0a, 0x33, 0x01, 0x01, 0x1f, 0x4b, 0x50, 0x01, 0x44, 0x01, 0x0d,
+ 0x32, 0x01, 0x01, 0x0a, 0x01, 0xfa, 0x4b, 0x50, 0x01, 0x48, 0x01, 0x17,
+ 0x32, 0x01, 0x01, 0x3a, 0x4c, 0x50, 0x01, 0x4f, 0x01, 0x2c, 0x01, 0x04,
+ 0x30, 0x01, 0x01, 0x1f, 0x4e, 0x50, 0x01, 0x41, 0x01, 0x19, 0x2f, 0x01,
+ 0x01, 0x07, 0x01, 0x4a, 0x4e, 0x50, 0x01, 0x44, 0x30, 0x01, 0x01, 0x33,
+ 0x4e, 0x50, 0x01, 0x36, 0x30, 0x01, 0x01, 0x14, 0x4e, 0x50, 0x01, 0x1f,
+ 0x30, 0x01, 0x01, 0x02, 0x01, 0x3f, 0x4c, 0x50, 0x01, 0x4d, 0x01, 0x0b,
+ 0x31, 0x01, 0x01, 0x1e, 0x4c, 0x50, 0x01, 0x3c, 0x32, 0x01, 0x01, 0x04,
+ 0x01, 0x44, 0x4b, 0x50, 0x01, 0x20, 0x33, 0x01, 0x01, 0x20, 0x4a, 0x50,
+ 0x01, 0x4a, 0x01, 0x07, 0x33, 0x01, 0x01, 0x04, 0x01, 0x43, 0x49, 0x50,
+ 0x01, 0x30, 0x35, 0x01, 0x01, 0x1c, 0x48, 0x50, 0x01, 0x4d, 0x01, 0x0e,
+ 0x35, 0x01, 0x01, 0x02, 0x01, 0x3e, 0x47, 0x50, 0x01, 0x36, 0x37, 0x01,
+ 0x01, 0x14, 0x01, 0x4f, 0x45, 0x50, 0x01, 0x4d, 0x01, 0x0e, 0x38, 0x01,
+ 0x01, 0x32, 0x45, 0x50, 0x01, 0x33, 0x39, 0x01, 0x01, 0x07, 0x01, 0x47,
+ 0x43, 0x50, 0x01, 0x4b, 0x01, 0x0b, 0x3a, 0x01, 0x01, 0x1c, 0x43, 0x50,
+ 0x01, 0x26, 0x3c, 0x01, 0x01, 0x37, 0x41, 0x50, 0x01, 0x41, 0x01, 0x04,
+ 0x3c, 0x01, 0x01, 0x08, 0x01, 0x48, 0x3f, 0x50, 0x01, 0x4e, 0x01, 0x13,
+ 0x3e, 0x01, 0x01, 0x19, 0x3f, 0x50, 0x01, 0x2d, 0x40, 0x01, 0x01, 0x2e,
+ 0x3d, 0x50, 0x01, 0x3f, 0x01, 0x03, 0x40, 0x01, 0x01, 0x03, 0x01, 0xf9,
+ 0x3b, 0x50, 0x01, 0x4a, 0x01, 0x0d, 0x42, 0x01, 0x01, 0x09, 0x01, 0x46,
+ 0x39, 0x50, 0x01, 0x4e, 0x01, 0x19, 0x44, 0x01, 0x01, 0x11, 0x01, 0x4b,
+ 0x38, 0x50, 0x01, 0x25, 0x46, 0x01, 0x01, 0x17, 0x01, 0x4d, 0x36, 0x50,
+ 0x01, 0x2e, 0x48, 0x01, 0x01, 0x1b, 0x01, 0x4d, 0x34, 0x50, 0x01, 0x31,
+ 0x4a, 0x01, 0x01, 0x17, 0x01, 0x4a, 0x14, 0x50, 0x01, 0x4d, 0x01, 0x44,
+ 0x01, 0x3b, 0x01, 0x34, 0x01, 0x2e, 0x01, 0x2c, 0x01, 0x2e, 0x01, 0x35,
+ 0x01, 0x3e, 0x01, 0x4a, 0x14, 0x50, 0x01, 0x2e, 0x4c, 0x01, 0x01, 0x0e,
+ 0x01, 0x41, 0x10, 0x50, 0x01, 0x4a, 0x01, 0x37, 0x01, 0x1f, 0x01, 0x0c,
+ 0x01, 0x03, 0x07, 0x01, 0x01, 0x06, 0x01, 0x15, 0x01, 0x2d, 0x01, 0x41,
+ 0x0f, 0x50, 0x01, 0x4a, 0x01, 0x1f, 0x4e, 0x01, 0x01, 0xf7, 0x01, 0x2e,
+ 0x01, 0xfa, 0x0b, 0x50, 0x01, 0x4f, 0x01, 0xf9, 0x01, 0x1e, 0x01, 0x07,
+ 0x0e, 0x01, 0x01, 0x02, 0x01, 0x14, 0x01, 0x31, 0x01, 0x48, 0x0b, 0x50,
+ 0x01, 0x37, 0x01, 0x0c, 0x51, 0x01, 0x01, 0x0d, 0x01, 0x2f, 0x01, 0x45,
+ 0x01, 0x4f, 0x05, 0x50, 0x01, 0x4f, 0x01, 0x43, 0x01, 0x2e, 0x01, 0x11,
+ 0x14, 0x01, 0x01, 0x07, 0x01, 0x1f, 0x01, 0x3c, 0x01, 0x4c, 0x04, 0x50,
+ 0x01, 0x4f, 0x01, 0x46, 0x01, 0x33, 0x01, 0x13, 0x55, 0x01, 0x01, 0x04,
+ 0x01, 0x12, 0x01, 0x1f, 0x01, 0x26, 0x01, 0x28, 0x01, 0x26, 0x01, 0x1e,
+ 0x01, 0x10, 0x01, 0x02, 0x19, 0x01, 0x01, 0x09, 0x01, 0x16, 0x01, 0x1e,
+ 0x01, 0x1f, 0x01, 0x1c, 0x01, 0x11, 0x01, 0x04, 0xff, 0x01, 0xff, 0x01,
+ 0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0xff, 0x01,
+ 0xff, 0x01, 0xb3, 0x01
+};
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*/
#include "boot.h"
+#include "bootstruct.h"
+#include "sl.h"
/*
* The user asked for boot graphics.
*/
BOOL gBootGraphics = NO;
-int gBIOSDev;
long gBootMode = kBootModeNormal;
+static char gBootKernelCacheFile[512];
static BOOL gUnloadPXEOnExit = 0;
*/
#define kBootErrorTimeout 5
+/*
+ * Default path to kernel cache file
+ */
+#define kDefaultCachePath "/System/Library/Caches/com.apple.kernelcaches/kernelcache"
+
//==========================================================================
// Zero the BSS.
(&_DATA__common__end - &_DATA__common__begin) );
}
+//==========================================================================
+// Malloc error function
+
+static void malloc_error(char *addr, size_t size)
+{
+ printf("\nMemory allocation error (0x%x, 0x%x)\n",
+ (unsigned)addr, (unsigned)size);
+ asm("hlt");
+}
+
//==========================================================================
// execKernel - Load the kernel image (mach-o) and jump to its entry point.
-static int execKernel(int fd)
+static int ExecKernel(void *binary)
{
- register KERNBOOTSTRUCT * kbp = kernBootStruct;
- static struct mach_header head;
entry_t kernelEntry;
int ret;
- verbose("Loading kernel %s\n", kbp->bootFile);
-
- // Perform the actual load.
+ bootArgs->kaddr = bootArgs->ksize = 0;
- kbp->kaddr = kbp->ksize = 0;
-
- ret = loadprog( kbp->kernDev, fd,
- &head,
- &kernelEntry,
- (char **) &kbp->kaddr,
- &kbp->ksize );
- close(fd);
- clearActivityIndicator();
+ ret = DecodeKernel(binary,
+ &kernelEntry,
+ (char **) &bootArgs->kaddr,
+ &bootArgs->ksize );
if ( ret != 0 )
return ret;
+ // Reserve space for boot args
+ reserveKernBootStruct();
+
// Load boot drivers from the specifed root path.
- LoadDrivers("/");
+ if (!gHaveKernelCache) {
+ LoadDrivers("/");
+ }
+
clearActivityIndicator();
if (gErrors) {
if ( APMPresent() ) APMConnect32();
}
- // Cleanup the PXE base code.
+ // Cleanup the PXE base code.
- if ( gUnloadPXEOnExit )
- {
+ if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) {
if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess )
{
printf("nbpUnloadBaseCode error %d\n", (int) ret);
// Jump to kernel's entry point. There's no going back now.
- startprog( kernelEntry );
+ startprog( kernelEntry, bootArgs );
// Not reached
extern int ReadPCIBusInfo(PCI_bus_info_t *);
extern void PCI_Bus_Init(PCI_bus_info_t *);
- ReadPCIBusInfo( &kernBootStruct->pciInfo );
+ ReadPCIBusInfo( &bootArgs->pciInfo );
//
// Initialize PCI matching support in the booter.
// Not used, commented out to minimize code size.
//
- // PCI_Bus_Init( &kernBootStruct->pciInfo );
+ // PCI_Bus_Init( &bootArgs->pciInfo );
}
//==========================================================================
void boot(int biosdev)
{
- register KERNBOOTSTRUCT * kbp = kernBootStruct;
- int fd;
int status;
+ char *bootFile;
zeroBSS();
+ // Initialize malloc
+
+ malloc_init(0, 0, 0, malloc_error);
+
// Enable A20 gate before accessing memory above 1Mb.
enableA20();
// Set reminder to unload the PXE base code. Neglect to unload
// the base code will result in a hang or kernel panic.
- if ( BIOS_DEV_TYPE(biosdev) == kBIOSDevTypeNetwork )
- gUnloadPXEOnExit = 1;
-
-#if 0
gUnloadPXEOnExit = 1;
- biosdev = 0x80;
-#endif
// Record the device that the booter was loaded from.
// Display banner and show hardware info.
setCursorPosition( 0, 0, 0 );
- printf( bootBanner, kbp->convmem, kbp->extmem );
+ printf( bootBanner, bootArgs->convmem, bootArgs->extmem );
printVBEInfo();
// Parse args, load and start kernel.
while (1)
{
+ const char *val;
+ int len, trycache;
+ long flags, cachetime, time;
+ int ret = -1;
+
// Initialize globals.
sysConfigValid = 0;
gErrors = 0;
+ // Reset config space.
+ bootArgs->configEnd = bootArgs->config;
+
getBootOptions();
status = processBootOptions();
if ( status == 1 ) break;
// Found and loaded a config file. Proceed with boot.
- printf("Loading Darwin/x86\n");
+ // Check for cache file.
- if ( (fd = openfile( kbp->bootFile, 0 )) >= 0 )
- {
- execKernel(fd); // will not return on success
+ if (getValueForKey(kKernelCacheKey, &val, &len)) {
+ strncpy(gBootKernelCacheFile, val, len);
+ gBootKernelCacheFile[len] = '\0';
+ } else {
+ strcpy(gBootKernelCacheFile, kDefaultCachePath);
}
- else
- {
- error("Can't find %s\n", kbp->bootFile);
- if ( BIOS_DEV_TYPE(gBIOSDev) == kBIOSDevTypeFloppy )
+ trycache = (((gBootMode & kBootModeSafe) == 0) &&
+ (gBootFileType == kBlockDeviceType) &&
+ (gBootKernelCacheFile[0] != '\0'));
+
+ printf("Loading Darwin/x86\n");
+
+ if (trycache) do {
+
+ // if we haven't found the kernel yet, don't use the cache
+ ret = GetFileInfo(NULL, bootArgs->bootFile, &flags, &time);
+ if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)) {
+ trycache = 0;
+ break;
+ }
+ ret = GetFileInfo(NULL, gBootKernelCacheFile, &flags, &cachetime);
+ if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)
+ || (cachetime < time)) {
+ trycache = 0;
+ break;
+ }
+ ret = GetFileInfo("/System/Library/", "Extensions", &flags, &time);
+ if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)
+ && (cachetime < time)) {
+ trycache = 0;
+ break;
+ }
+ } while (0);
+
+ do {
+ if (trycache) {
+ bootFile = gBootKernelCacheFile;
+ verbose("Loading kernel cache %s\n", bootFile);
+ ret = LoadFile(bootFile);
+ if (ret >= 0) {
+ break;
+ }
+ }
+ bootFile = bootArgs->bootFile;
+ verbose("Loading kernel %s\n", bootFile);
+ ret = LoadFile(bootFile);
+ } while (0);
+
+ clearActivityIndicator();
+
+ if (ret < 0) {
+ error("Can't find %s\n", bootFile);
+
+ if ( gBootFileType == kBIOSDevTypeFloppy )
{
// floppy in drive, but failed to load kernel.
gBIOSDev = kBIOSDevTypeHardDrive;
initKernBootStruct( gBIOSDev );
printf("Attempt to load from hard drive.");
}
- else if ( BIOS_DEV_TYPE(gBIOSDev) == kBIOSDevTypeNetwork )
+ else if ( gBootFileType == kNetworkDeviceType )
{
// Return control back to PXE. Don't unload PXE base code.
gUnloadPXEOnExit = 0;
break;
}
+ } else {
+ /* Won't return if successful. */
+ ret = ExecKernel((void *)kLoadAddr);
}
+
} /* while(1) */
- if (gUnloadPXEOnExit) nbpUnloadBaseCode();
+ if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) {
+ nbpUnloadBaseCode();
+ }
}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#define kQuietBootKey "Quiet Boot"
#define kKernelFlagsKey "Kernel Flags"
#define kKernelNameKey "Kernel"
+#define kKernelCacheKey "Kernel Cache"
/*
* A global set by boot() to record the device that the booter
* drivers.c
*/
extern long LoadDrivers(char * dirSpec);
+extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
/*
* options.c
extern void getBootOptions();
extern int processBootOptions();
+/*
+ * lzss.c
+ */
+extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);
+
+struct compressed_kernel_header {
+ u_int32_t signature;
+ u_int32_t compress_type;
+ u_int32_t adler32;
+ u_int32_t uncompressed_size;
+ u_int32_t compressed_size;
+ u_int32_t reserved[11];
+ char platform_name[64];
+ char root_path[256];
+ u_int8_t data[0];
+};
+typedef struct compressed_kernel_header compressed_kernel_header;
+
#endif /* !__BOOT2_BOOT_H */
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
data32
call __real_to_prot # Enter protected mode.
+ fninit # FPU init
+
# We are now in 32-bit protected mode.
# Transfer execution to C by calling boot().
*
* @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.0 (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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
* DRI: Josh de Cesare
*/
+#include <mach-o/fat.h>
+#include <libkern/OSByteOrder.h>
+#include <mach/machine.h>
+
#include "sl.h"
#include "boot.h"
-
-enum {
- kTagTypeNone = 0,
- kTagTypeDict,
- kTagTypeKey,
- kTagTypeString,
- kTagTypeInteger,
- kTagTypeData,
- kTagTypeDate,
- kTagTypeFalse,
- kTagTypeTrue,
- kTagTypeArray
-};
-
-#define kXMLTagPList "plist "
-#define kXMLTagDict "dict"
-#define kXMLTagKey "key"
-#define kXMLTagString "string"
-#define kXMLTagInteger "integer"
-#define kXMLTagData "data"
-#define kXMLTagDate "date"
-#define kXMLTagFalse "false/"
-#define kXMLTagTrue "true/"
-#define kXMLTagArray "array"
-
-#define kPropCFBundleIdentifier ("CFBundleIdentifier")
-#define kPropCFBundleExecutable ("CFBundleExecutable")
-#define kPropOSBundleRequired ("OSBundleRequired")
-#define kPropOSBundleLibraries ("OSBundleLibraries")
-#define kPropIOKitPersonalities ("IOKitPersonalities")
-#define kPropIONameMatch ("IONameMatch")
-
-struct Tag {
- long type;
- char *string;
- struct Tag *tag;
- struct Tag *tagNext;
-};
-typedef struct Tag Tag, *TagPtr;
+#include "bootstruct.h"
+#include "xml.h"
struct Module {
struct Module *nextModule;
kCFBundleType3
};
+static unsigned long Alder32( unsigned char * buffer, long length );
+
static long FileLoadDrivers(char *dirSpec, long plugin);
static long NetLoadDrivers(char *dirSpec);
static long LoadDriverMKext(char *fileSpec);
static long LoadMatchedModules(void);
static long MatchPersonalities(void);
static long MatchLibraries(void);
-static TagPtr GetProperty(TagPtr dict, char *key);
-// static ModulePtr FindModule(char *name);
+#ifdef NOTDEF
+static ModulePtr FindModule(char *name);
+static void ThinFatFile(void **loadAddrP, unsigned long *lengthP);
+#endif
static long ParseXML(char *buffer, ModulePtr *module, TagPtr *personalities);
-static long ParseNextTag(char *buffer, TagPtr *tag);
-static long ParseTagList(char *buffer, TagPtr *tag, long type, long empty);
-static long ParseTagKey(char *buffer, TagPtr *tag);
-static long ParseTagString(char *buffer, TagPtr *tag);
-static long ParseTagInteger(char *buffer, TagPtr *tag);
-static long ParseTagData(char *buffer, TagPtr *tag);
-static long ParseTagDate(char *buffer, TagPtr *tag);
-static long ParseTagBoolean(char *buffer, TagPtr *tag, long type);
-static long GetNextTag(char *buffer, char **tag, long *start);
-static long FixDataMatchingTag(char *buffer, char *tag);
-static TagPtr NewTag(void);
-static void FreeTag(TagPtr tag);
-static char *NewSymbol(char *string);
-static void FreeSymbol(char *string);
-// static void DumpTag(TagPtr tag, long depth);
+static long InitDriverSupport(void);
static ModulePtr gModuleHead, gModuleTail;
static TagPtr gPersonalityHead, gPersonalityTail;
static char * gTempSpec;
static char * gFileName;
-//==========================================================================
-// BootX shim functions.
-
-#define kPageSize 4096
-#define RoundPage(x) ((((unsigned)(x)) + kPageSize - 1) & ~(kPageSize - 1))
-
-static long gImageFirstBootXAddr;
-static long gImageLastKernelAddr;
-
-static void *
-AllocateBootXMemory( long size )
-{
- long addr = gImageFirstBootXAddr - size;
-
- if ( addr < gImageLastKernelAddr ) return 0;
-
- bzero((void *)addr, size);
-
- gImageFirstBootXAddr = addr;
-
- return (void *)addr;
-}
-
-static long
-AllocateKernelMemory( long inSize )
-{
- long addr = gImageLastKernelAddr;
-
- gImageLastKernelAddr += RoundPage(inSize);
-
- if ( gImageLastKernelAddr > gImageFirstBootXAddr )
- stop( "AllocateKernelMemory error" );
-
- kernBootStruct->ksize = gImageLastKernelAddr - kernBootStruct->kaddr;
-
- return addr;
-}
-
-static long
-AllocateMemoryRange(char * rangeName, long start, long length, long type)
-{
- if ( kernBootStruct->numBootDrivers < NDRIVERS )
- {
- int num = kernBootStruct->numBootDrivers;
-
- kernBootStruct->driverConfig[num].address = start;
- kernBootStruct->driverConfig[num].size = length;
- kernBootStruct->driverConfig[num].type = type;
- kernBootStruct->numBootDrivers++;
- }
- else
- {
- stop( "AllocateMemoryRange error" );
- }
- return 0;
-}
-
-// Map BootX types to boot counterparts.
-
-#define gBootFileType BIOS_DEV_TYPE(gBIOSDev)
-enum {
- kNetworkDeviceType = kBIOSDevTypeNetwork,
- kBlockDeviceType = kBIOSDevTypeHardDrive
-};
-
-
-static long
-InitDriverSupport()
-{
- gExtensionsSpec = (char *) malloc( 4096 );
- gDriverSpec = (char *) malloc( 4096 );
- gFileSpec = (char *) malloc( 4096 );
- gTempSpec = (char *) malloc( 4096 );
- gFileName = (char *) malloc( 4096 );
-
- if ( !gExtensionsSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName )
- stop("InitDriverSupport error");
-
- gImageLastKernelAddr = RoundPage( kernBootStruct->kaddr +
- kernBootStruct->ksize );
-
- gImageFirstBootXAddr = ( KERNEL_ADDR + KERNEL_LEN );
-
- return 0;
-}
static unsigned long
Alder32( unsigned char * buffer, long length )
return result;
}
+
+//==========================================================================
+// InitDriverSupport
+
+static long
+InitDriverSupport( void )
+{
+ gExtensionsSpec = (char *) malloc( 4096 );
+ gDriverSpec = (char *) malloc( 4096 );
+ gFileSpec = (char *) malloc( 4096 );
+ gTempSpec = (char *) malloc( 4096 );
+ gFileName = (char *) malloc( 4096 );
+
+ if ( !gExtensionsSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName )
+ stop("InitDriverSupport error");
+
+ return 0;
+}
+
//==========================================================================
// LoadDrivers
{
NetLoadDrivers(dirSpec);
}
- else /* if ( gBootFileType == kBlockDeviceType ) */
+ else if ( gBootFileType == kBlockDeviceType )
{
strcpy(gExtensionsSpec, dirSpec);
strcat(gExtensionsSpec, "System/Library/");
FileLoadDrivers(gExtensionsSpec, 0);
}
-#if 0
else
{
return 0;
}
-#endif
MatchPersonalities();
ret = LoadDriverPList(dirSpec, gFileName, bundleType);
if (ret != 0)
{
- // printf("LoadDrivers: failed\n");
+ //printf("LoadDrivers: failed for '%s'/'%s'\n", dirSpec, gFileName);
}
if (!plugin)
{
long tries;
-#if 0
+#if NODEF
long cnt;
// Get the name of the kernel
#endif
// INTEL modification
- sprintf(gDriverSpec, "%s%s.mkext", dirSpec, kernBootStruct->bootFile);
+ sprintf(gDriverSpec, "%s%s.mkext", dirSpec, bootArgs->bootFile);
verbose("NetLoadDrivers: Loading from [%s]\n", gDriverSpec);
static long
LoadDriverMKext( char * fileSpec )
{
- long driversAddr, driversLength;
+ unsigned long driversAddr, driversLength;
+ long length;
char segName[32];
DriversPackage * package = (DriversPackage *)kLoadAddr;
-#define GetPackageElement(e) NXSwapBigLongToHost(package->e)
+#define GetPackageElement(e) OSSwapBigToHostInt32(package->e)
// Load the MKext.
- if (LoadFile(fileSpec) == -1) return -1;
+ length = LoadFile(fileSpec);
+ if (length == -1) return -1;
+
+ ThinFatFile((void **)&package, &length);
// Verify the MKext.
if (( GetPackageElement(signature1) != kDriverPackageSignature1) ||
// Make space for the MKext.
driversLength = GetPackageElement(length);
driversAddr = AllocateKernelMemory(driversLength);
-
+
// Copy the MKext.
- memcpy((void *)driversAddr, (void *)kLoadAddr, driversLength);
+ memcpy((void *)driversAddr, (void *)package, driversLength);
// Add the MKext to the memory map.
sprintf(segName, "DriversPackage-%lx", driversAddr);
ModulePtr module;
TagPtr personalities;
char * buffer = 0;
- char * tmpDriverPath = 0;
+ char * tmpDriverPath = 0;
long ret = -1;
do {
sprintf(gFileSpec, "%s/%s/%s", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/MacOS/" : "");
- driverPathLength = strlen(gFileSpec);
+ driverPathLength = strlen(gFileSpec) + 1;
- tmpDriverPath = malloc(driverPathLength + 1);
+ tmpDriverPath = malloc(driverPathLength);
if (tmpDriverPath == 0) break;
strcpy(tmpDriverPath, gFileSpec);
length = LoadFile(gFileSpec);
if (length == -1) break;
- buffer = malloc(length + 1);
+ length = length + 1;
+ buffer = malloc(length);
if (buffer == 0) break;
- strncpy(buffer, (char *)kLoadAddr, length);
+ strlcpy(buffer, (char *)kLoadAddr, length);
// Parse the plist.
ret = ParseXML(buffer, &module, &personalities);
- if (ret != 0) break;
+ if (ret != 0) { break; }
// Allocate memory for the driver path and the plist.
- module->driverPath = AllocateBootXMemory(driverPathLength + 1);
- module->plistAddr = AllocateBootXMemory(length + 1);
+ module->driverPath = tmpDriverPath;
+ module->plistAddr = (void *)malloc(length);
if ((module->driverPath == 0) || (module->plistAddr == 0))
break;
// Save the driver path in the module.
-
- strcpy(module->driverPath, tmpDriverPath);
+ //strcpy(module->driverPath, tmpDriverPath);
+ tmpDriverPath = 0;
// Add the plist to the module.
- strncpy(module->plistAddr, (char *)kLoadAddr, length);
- module->plistLength = length + 1;
+ strlcpy(module->plistAddr, (char *)kLoadAddr, length);
+ module->plistLength = length;
// Add the module to the end of the module list.
return ret;
}
+#if 0
+//==========================================================================
+// ThinFatFile
+// Checks the loaded file for a fat header; if present, updates
+// loadAddr and length to be the portion of the fat file relevant
+// to the current architecture; otherwise leaves them unchanged.
+
+static void
+ThinFatFile(void **loadAddrP, unsigned long *lengthP)
+{
+ // Check for fat files.
+ struct fat_header *fhp = (struct fat_header *)kLoadAddr;
+ struct fat_arch *fap = (struct fat_arch *)((void *)kLoadAddr +
+ sizeof(struct fat_header));
+ int nfat, swapped;
+ void *loadAddr = 0;
+ unsigned long length = 0;
+
+ if (fhp->magic == FAT_MAGIC) {
+ nfat = fhp->nfat_arch;
+ swapped = 0;
+ } else if (fhp->magic == FAT_CIGAM) {
+ nfat = OSSwapInt32(fhp->nfat_arch);
+ swapped = 1;
+ } else {
+ nfat = 0;
+ swapped = 0;
+ }
+
+ for (; nfat > 0; nfat--, fap++) {
+ if (swapped) {
+ fap->cputype = OSSwapInt32(fap->cputype);
+ fap->offset = OSSwapInt32(fap->offset);
+ fap->size = OSSwapInt32(fap->size);
+ }
+ if (fap->cputype == CPU_TYPE_I386) {
+ loadAddr = (void *)kLoadAddr + fap->offset;
+ length = fap->size;
+ break;
+ }
+ }
+ if (loadAddr)
+ *loadAddrP = loadAddr;
+ if (length)
+ *lengthP = length;
+}
+#endif
+
//==========================================================================
// LoadMatchedModules
{
if (module->willLoad)
{
- prop = GetProperty(module->dict, kPropCFBundleExecutable);
+ prop = XMLGetProperty(module->dict, kPropCFBundleExecutable);
+
if (prop != 0)
{
fileName = prop->string;
if (length != -1)
{
+ void *driverModuleAddr = (void *)kLoadAddr;
+ if (length != 0)
+ {
+ ThinFatFile(&driverModuleAddr, &length);
+ }
+
// Make make in the image area.
driverLength = sizeof(DriverInfo) + module->plistLength + length;
driverAddr = AllocateKernelMemory(driverLength);
strcpy(driver->plistAddr, module->plistAddr);
if (length != 0)
{
- memcpy(driver->moduleAddr, (void *)kLoadAddr, driver->moduleLength);
+ memcpy(driver->moduleAddr, driverModuleAddr, length);
}
// Add an entry to the memory map.
static long
MatchPersonalities( void )
{
-#warning IONameMatch support not implemented
+ /* IONameMatch support not implemented */
return 0;
}
{
if (module->willLoad == 1)
{
- prop = GetProperty(module->dict, kPropOSBundleLibraries);
+ prop = XMLGetProperty(module->dict, kPropOSBundleLibraries);
if (prop != 0)
{
prop = prop->tag;
module2 = gModuleHead;
while (module2 != 0)
{
- prop2 = GetProperty(module2->dict, kPropCFBundleIdentifier);
+ prop2 = XMLGetProperty(module2->dict, kPropCFBundleIdentifier);
if ((prop2 != 0) && (!strcmp(prop->string, prop2->string)))
{
if (module2->willLoad == 0) module2->willLoad = 1;
return 0;
}
-//==========================================================================
-// GetProperty
-
-static TagPtr
-GetProperty( TagPtr dict, char * key )
-{
- TagPtr tagList, tag;
-
- if (dict->type != kTagTypeDict) return 0;
-
- tag = 0;
- tagList = dict->tag;
- while (tagList)
- {
- tag = tagList;
- tagList = tag->tagNext;
-
- if ((tag->type != kTagTypeKey) || (tag->string == 0)) continue;
-
- if (!strcmp(tag->string, key)) return tag->tag;
- }
-
- return 0;
-}
//==========================================================================
// FindModule
while (1)
{
- length = ParseNextTag(buffer + pos, &moduleDict);
+ length = XMLParseNextTag(buffer + pos, &moduleDict);
if (length == -1) break;
pos += length;
if (moduleDict == 0) continue;
if (moduleDict->type == kTagTypeDict) break;
- FreeTag(moduleDict);
+ XMLFreeTag(moduleDict);
}
if (length == -1) return -1;
- required = GetProperty(moduleDict, kPropOSBundleRequired);
+ required = XMLGetProperty(moduleDict, kPropOSBundleRequired);
if ( (required == 0) ||
(required->type != kTagTypeString) ||
!strcmp(required->string, "Safe Boot"))
{
- FreeTag(moduleDict);
+ XMLFreeTag(moduleDict);
return -2;
}
- tmpModule = AllocateBootXMemory(sizeof(Module));
+ tmpModule = (ModulePtr)malloc(sizeof(Module));
if (tmpModule == 0)
{
- FreeTag(moduleDict);
+ XMLFreeTag(moduleDict);
return -1;
}
tmpModule->dict = moduleDict;
// Get the personalities.
- *personalities = GetProperty(moduleDict, kPropIOKitPersonalities);
+ *personalities = XMLGetProperty(moduleDict, kPropIOKitPersonalities);
return 0;
}
-//==========================================================================
-// ParseNextTag
+#if NOTDEF
+static char gPlatformName[64];
+#endif
-static long
-ParseNextTag( char * buffer, TagPtr * tag )
+long
+DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize)
{
- long length, pos;
- char * tagName;
-
- length = GetNextTag(buffer, &tagName, 0);
- if (length == -1) return -1;
-
- pos = length;
- if (!strncmp(tagName, kXMLTagPList, 6))
- {
- length = 0;
- }
- else if (!strcmp(tagName, kXMLTagDict))
- {
- length = ParseTagList(buffer + pos, tag, kTagTypeDict, 0);
- }
- else if (!strcmp(tagName, kXMLTagDict "/"))
- {
- length = ParseTagList(buffer + pos, tag, kTagTypeDict, 1);
- }
- else if (!strcmp(tagName, kXMLTagKey))
- {
- length = ParseTagKey(buffer + pos, tag);
- }
- else if (!strcmp(tagName, kXMLTagString))
- {
- length = ParseTagString(buffer + pos, tag);
- }
- else if (!strcmp(tagName, kXMLTagInteger))
- {
- length = ParseTagInteger(buffer + pos, tag);
- }
- else if (!strcmp(tagName, kXMLTagData))
- {
- length = ParseTagData(buffer + pos, tag);
- }
- else if (!strcmp(tagName, kXMLTagDate))
- {
- length = ParseTagDate(buffer + pos, tag);
- }
- else if (!strcmp(tagName, kXMLTagFalse))
- {
- length = ParseTagBoolean(buffer + pos, tag, kTagTypeFalse);
- }
- else if (!strcmp(tagName, kXMLTagTrue))
- {
- length = ParseTagBoolean(buffer + pos, tag, kTagTypeTrue);
- }
- else if (!strcmp(tagName, kXMLTagArray))
- {
- length = ParseTagList(buffer + pos, tag, kTagTypeArray, 0);
- }
- else if (!strcmp(tagName, kXMLTagArray "/"))
- {
- length = ParseTagList(buffer + pos, tag, kTagTypeArray, 1);
- }
- else
- {
- *tag = 0;
- length = 0;
- }
+ long ret;
+ compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary;
+ u_int32_t uncompressed_size, size;
+ void *buffer;
- if (length == -1) return -1;
-
- return pos + length;
-}
-
-//==========================================================================
-// ParseTagList
+#if 0
+ printf("kernel header:\n");
+ printf("signature: 0x%x\n", kernel_header->signature);
+ printf("compress_type: 0x%x\n", kernel_header->compress_type);
+ printf("adler32: 0x%x\n", kernel_header->adler32);
+ printf("uncompressed_size: 0x%x\n", kernel_header->uncompressed_size);
+ printf("compressed_size: 0x%x\n", kernel_header->compressed_size);
+ getc();
+#endif
-static long
-ParseTagList( char * buffer, TagPtr * tag, long type, long empty )
-{
- long length, pos;
- TagPtr tagList, tmpTag;
-
- tagList = 0;
- pos = 0;
-
- if (!empty)
- {
- while (1)
- {
- length = ParseNextTag(buffer + pos, &tmpTag);
- if (length == -1) break;
-
- pos += length;
-
- if (tmpTag == 0) break;
- tmpTag->tagNext = tagList;
- tagList = tmpTag;
- }
-
- if (length == -1)
- {
- FreeTag(tagList);
+ if (kernel_header->signature == OSSwapBigToHostConstInt32('comp')) {
+ if (kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss')) {
+ error("kernel compression is bad\n");
return -1;
}
- }
-
- tmpTag = NewTag();
- if (tmpTag == 0)
- {
- FreeTag(tagList);
- return -1;
- }
-
- tmpTag->type = type;
- tmpTag->string = 0;
- tmpTag->tag = tagList;
- tmpTag->tagNext = 0;
-
- *tag = tmpTag;
-
- return pos;
-}
-
-//==========================================================================
-// ParseTagKey
-
-static long
-ParseTagKey( char * buffer, TagPtr * tag )
-{
- long length, length2;
- char *string;
- TagPtr tmpTag, subTag;
-
- length = FixDataMatchingTag(buffer, kXMLTagKey);
- if (length == -1) return -1;
-
- length2 = ParseNextTag(buffer + length, &subTag);
- if (length2 == -1) return -1;
-
- tmpTag = NewTag();
- if (tmpTag == 0)
- {
- FreeTag(subTag);
- return -1;
- }
-
- string = NewSymbol(buffer);
- if (string == 0)
- {
- FreeTag(subTag);
- FreeTag(tmpTag);
- return -1;
- }
-
- tmpTag->type = kTagTypeKey;
- tmpTag->string = string;
- tmpTag->tag = subTag;
- tmpTag->tagNext = 0;
-
- *tag = tmpTag;
-
- return length + length2;
-}
-
-//==========================================================================
-// ParseTagString
-
-static long
-ParseTagString( char * buffer, TagPtr * tag )
-{
- long length;
- char * string;
- TagPtr tmpTag;
-
- length = FixDataMatchingTag(buffer, kXMLTagString);
- if (length == -1) return -1;
-
- tmpTag = NewTag();
- if (tmpTag == 0) return -1;
-
- string = NewSymbol(buffer);
- if (string == 0)
- {
- FreeTag(tmpTag);
- return -1;
- }
-
- tmpTag->type = kTagTypeString;
- tmpTag->string = string;
- tmpTag->tag = 0;
- tmpTag->tagNext = 0;
-
- *tag = tmpTag;
-
- return length;
-}
-
-//==========================================================================
-// ParseTagInteger
-
-static long
-ParseTagInteger( char * buffer, TagPtr * tag )
-{
- long length, integer;
- TagPtr tmpTag;
-
- length = FixDataMatchingTag(buffer, kXMLTagInteger);
- if (length == -1) return -1;
-
- tmpTag = NewTag();
- if (tmpTag == 0) return -1;
-
- integer = 0;
-
- tmpTag->type = kTagTypeInteger;
- tmpTag->string = (char *)integer;
- tmpTag->tag = 0;
- tmpTag->tagNext = 0;
-
- *tag = tmpTag;
-
- return length;
-}
-
-//==========================================================================
-// ParseTagData
-
-static long
-ParseTagData( char * buffer, TagPtr * tag )
-{
- long length;
- TagPtr tmpTag;
-
- length = FixDataMatchingTag(buffer, kXMLTagData);
- if (length == -1) return -1;
-
- tmpTag = NewTag();
- if (tmpTag == 0) return -1;
-
- tmpTag->type = kTagTypeData;
- tmpTag->string = 0;
- tmpTag->tag = 0;
- tmpTag->tagNext = 0;
-
- *tag = tmpTag;
-
- return length;
-}
-
-//==========================================================================
-// ParseTagDate
-
-static long
-ParseTagDate( char * buffer, TagPtr * tag )
-{
- long length;
- TagPtr tmpTag;
-
- length = FixDataMatchingTag(buffer, kXMLTagDate);
- if (length == -1) return -1;
-
- tmpTag = NewTag();
- if (tmpTag == 0) return -1;
-
- tmpTag->type = kTagTypeDate;
- tmpTag->string = 0;
- tmpTag->tag = 0;
- tmpTag->tagNext = 0;
-
- *tag = tmpTag;
-
- return length;
-}
-
-//==========================================================================
-// ParseTagBoolean
-
-static long
-ParseTagBoolean( char * buffer, TagPtr * tag, long type )
-{
- TagPtr tmpTag;
-
- tmpTag = NewTag();
- if (tmpTag == 0) return -1;
-
- tmpTag->type = type;
- tmpTag->string = 0;
- tmpTag->tag = 0;
- tmpTag->tagNext = 0;
-
- *tag = tmpTag;
-
- return 0;
-}
-
-//==========================================================================
-// GetNextTag
-
-static long
-GetNextTag( char * buffer, char ** tag, long * start )
-{
- long cnt, cnt2;
-
- if (tag == 0) return -1;
-
- // Find the start of the tag.
- cnt = 0;
- while ((buffer[cnt] != '\0') && (buffer[cnt] != '<')) cnt++;
- if (buffer[cnt] == '\0') return -1;
-
- // Find the end of the tag.
- cnt2 = cnt + 1;
- while ((buffer[cnt2] != '\0') && (buffer[cnt2] != '>')) cnt2++;
- if (buffer[cnt2] == '\0') return -1;
-
- // Fix the tag data.
- *tag = buffer + cnt + 1;
- buffer[cnt2] = '\0';
- if (start) *start = cnt;
-
- return cnt2 + 1;
-}
-
-//==========================================================================
-// FixDataMatchingTag
-
-static long
-FixDataMatchingTag( char * buffer, char * tag )
-{
- long length, start, stop;
- char * endTag;
-
- start = 0;
- while (1)
- {
- length = GetNextTag(buffer + start, &endTag, &stop);
- if (length == -1) return -1;
-
- if ((*endTag == '/') && !strcmp(endTag + 1, tag)) break;
- start += length;
- }
+#if NOTDEF
+ if (kernel_header->platform_name[0] && strcmp(gPlatformName, kernel_header->platform_name))
+ return -1;
+ if (kernel_header->root_path[0] && strcmp(gBootFile, kernel_header->root_path))
+ return -1;
+#endif
- buffer[start + stop] = '\0';
+ uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size);
+ binary = buffer = malloc(uncompressed_size);
- return start + length;
-}
-
-//==========================================================================
-// NewTag
-
-#define kTagsPerBlock (0x1000)
-
-static TagPtr gTagsFree;
-
-static TagPtr
-NewTag( void )
-{
- long cnt;
- TagPtr tag;
-
- if (gTagsFree == 0)
- {
- tag = (TagPtr)AllocateBootXMemory(kTagsPerBlock * sizeof(Tag));
- if (tag == 0) return 0;
-
- // Initalize the new tags.
- for (cnt = 0; cnt < kTagsPerBlock; cnt++)
- {
- tag[cnt].type = kTagTypeNone;
- tag[cnt].string = 0;
- tag[cnt].tag = 0;
- tag[cnt].tagNext = tag + cnt + 1;
+ size = decompress_lzss((u_int8_t *) binary, &kernel_header->data[0],
+ OSSwapBigToHostInt32(kernel_header->compressed_size));
+ if (uncompressed_size != size) {
+ error("size mismatch from lzss: %x\n", size);
+ return -1;
+ }
+ if (OSSwapBigToHostInt32(kernel_header->adler32) !=
+ Alder32(binary, uncompressed_size)) {
+ printf("adler mismatch\n");
+ return -1;
}
- tag[kTagsPerBlock - 1].tagNext = 0;
-
- gTagsFree = tag;
- }
-
- tag = gTagsFree;
- gTagsFree = tag->tagNext;
-
- return tag;
-}
-
-//==========================================================================
-// FreeTag
-
-static void
-FreeTag( TagPtr tag )
-{
- return;
- if (tag == 0) return;
-
- if (tag->string) FreeSymbol(tag->string);
-
- FreeTag(tag->tag);
- FreeTag(tag->tagNext);
-
- // Clear and free the tag.
- tag->type = kTagTypeNone;
- tag->string = 0;
- tag->tag = 0;
- tag->tagNext = gTagsFree;
- gTagsFree = tag;
-}
-
-//==========================================================================
-// Symbol object.
-
-struct Symbol
-{
- long refCount;
- struct Symbol *next;
- char string[1];
-};
-typedef struct Symbol Symbol, *SymbolPtr;
-
-static SymbolPtr FindSymbol(char * string, SymbolPtr * prevSymbol);
-
-static SymbolPtr gSymbolsHead;
-
-//==========================================================================
-// NewSymbol
-
-static char *
-NewSymbol( char * string )
-{
- SymbolPtr symbol;
-
- // Look for string in the list of symbols.
- symbol = FindSymbol(string, 0);
-
- // Add the new symbol.
- if (symbol == 0)
- {
- symbol = AllocateBootXMemory(sizeof(Symbol) + strlen(string));
- if (symbol == 0) return 0;
-
- // Set the symbol's data.
- symbol->refCount = 0;
- strcpy(symbol->string, string);
-
- // Add the symbol to the list.
- symbol->next = gSymbolsHead;
- gSymbolsHead = symbol;
}
- // Update the refCount and return the string.
- symbol->refCount++;
- return symbol->string;
-}
-
-//==========================================================================
-// FreeSymbol
-
-static void
-FreeSymbol( char * string )
-{
-#if 0
- SymbolPtr symbol, prev;
-
- // Look for string in the list of symbols.
- symbol = FindSymbol(string, &prev);
- if (symbol == 0) return;
-
- // Update the refCount.
- symbol->refCount--;
-
- if (symbol->refCount != 0) return;
-
- // Remove the symbol from the list.
- if (prev != 0) prev->next = symbol->next;
- else gSymbolsHead = symbol->next;
-
- // Free the symbol's memory.
- free(symbol);
-#endif
-}
-
-//==========================================================================
-// FindSymbol
-
-static SymbolPtr
-FindSymbol( char * string, SymbolPtr * prevSymbol )
-{
- SymbolPtr symbol, prev;
-
- symbol = gSymbolsHead;
- prev = 0;
-
- while (symbol != 0)
- {
- if (!strcmp(symbol->string, string)) break;
-
- prev = symbol;
- symbol = symbol->next;
- }
+ ThinFatFile(&binary, 0);
- if ((symbol != 0) && (prevSymbol != 0)) *prevSymbol = prev;
+ ret = DecodeMachO(binary, rentry, raddr, rsize);
- return symbol;
+ return ret;
}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include "boot.h"
#include "vbe.h"
#include "appleClut8.h"
-#include "happy_screen.h"
+#include "appleboot.h"
+#include "bootstruct.h"
/*
* for spinning disk
unsigned short height,
unsigned char * data );
-#define VIDEO(x) (kernBootStruct->video.v_ ## x)
+#define VIDEO(x) (bootArgs->video.v_ ## x)
//==========================================================================
unsigned char bitsPerPixel,
unsigned short attributesSet,
unsigned short attributesClear,
- VBEModeInfoBlock * outModeInfo )
+ VBEModeInfoBlock * outModeInfo,
+ unsigned short * vesaVersion )
{
VBEInfoBlock vbeInfo;
unsigned short * modePtr;
- VBEModeInfoBlock modeInfo;
+ VBEModeInfoBlock modeInfo;
unsigned char modeBitsPerPixel;
unsigned short matchedMode = modeEndOfList;
int err;
return modeEndOfList;
}
+ // Report the VESA major/minor version number.
+
+ if (vesaVersion) *vesaVersion = vbeInfo.VESAVersion;
+
// Loop through the mode list, and find the matching mode.
for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr );
break;
}
- // Save the next "best" mode in case a perfect match
- // is not found.
+ // Save the next "best" mode in case a perfect match is not found.
- if ( ( modeInfo.XResolution >= outModeInfo->XResolution ) &&
- ( modeInfo.YResolution >= outModeInfo->YResolution ) &&
- ( modeBitsPerPixel >= outModeInfo->BitsPerPixel ) )
+ if ( modeInfo.XResolution == outModeInfo->XResolution &&
+ modeInfo.YResolution == outModeInfo->YResolution &&
+ modeBitsPerPixel <= outModeInfo->BitsPerPixel )
{
- matchedMode = *modePtr;
- bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
+ continue; // Saved mode has more depth.
}
+ if ( modeInfo.XResolution < outModeInfo->XResolution ||
+ modeInfo.YResolution < outModeInfo->YResolution ||
+ modeBitsPerPixel < 16 )
+ {
+ continue; // Saved mode has more resolution.
+ }
+
+ matchedMode = *modePtr;
+ bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
}
return matchedMode;
}
}
+//==========================================================================
+// Simple decompressor for boot images encoded in RLE format.
+
+static char * decodeRLE( const void * rleData, int rleBlocks, int outBytes )
+{
+ char *out, *cp;
+
+ struct RLEBlock {
+ unsigned char count;
+ unsigned char value;
+ } * bp = (struct RLEBlock *) rleData;
+
+ out = cp = (char *) malloc( outBytes );
+ if ( out == NULL ) return NULL;
+
+ while ( rleBlocks-- )
+ {
+ memset( cp, bp->value, bp->count );
+ cp += bp->count;
+ bp++;
+ }
+
+ return out;
+}
+
//==========================================================================
// setVESAGraphicsMode
static int
setVESAGraphicsMode( unsigned short width,
unsigned short height,
- unsigned char bitsPerPixel )
+ unsigned char bitsPerPixel,
+ unsigned short refreshRate )
{
VBEModeInfoBlock minfo;
unsigned short mode;
+ unsigned short vesaVersion;
int err = errFuncNotSupported;
do {
maGraphicsModeBit |
maLinearFrameBufferAvailBit,
0,
- &minfo );
+ &minfo, &vesaVersion );
if ( mode == modeEndOfList )
{
break;
}
- // Set the mode.
+ if ( (vesaVersion >> 8) >= 3 && refreshRate >= 60 &&
+ (gBootMode & kBootModeSafe) == 0 )
+ {
+ VBECRTCInfoBlock timing;
+
+ // Generate CRTC timing for given refresh rate.
+
+ generateCRTCTiming( minfo.XResolution, minfo.YResolution,
+ refreshRate, kCRTCParamRefreshRate,
+ &timing );
+
+ // Find the actual pixel clock supported by the hardware.
+
+ getVBEPixelClock( mode, &timing.PixelClock );
+
+ // Re-compute CRTC timing based on actual pixel clock.
+
+ generateCRTCTiming( minfo.XResolution, minfo.YResolution,
+ timing.PixelClock, kCRTCParamPixelClock,
+ &timing );
+
+ // Set the video mode and use specified CRTC timing.
+
+ err = setVBEMode( mode | kLinearFrameBufferBit |
+ kCustomRefreshRateBit, &timing );
+ }
+ else
+ {
+ // Set the mode with default refresh rate.
- err = setVBEMode( mode | kLinearFrameBufferBit );
+ err = setVBEMode( mode | kLinearFrameBufferBit, NULL );
+ }
if ( err != errSuccess )
{
break;
// Update KernBootStruct using info provided by the selected
// VESA mode.
- kernBootStruct->graphicsMode = GRAPHICS_MODE;
- kernBootStruct->video.v_width = minfo.XResolution;
- kernBootStruct->video.v_height = minfo.YResolution;
- kernBootStruct->video.v_depth = minfo.BitsPerPixel;
- kernBootStruct->video.v_rowBytes = minfo.BytesPerScanline;
- kernBootStruct->video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr);
+ bootArgs->graphicsMode = GRAPHICS_MODE;
+ bootArgs->video.v_width = minfo.XResolution;
+ bootArgs->video.v_height = minfo.YResolution;
+ bootArgs->video.v_depth = minfo.BitsPerPixel;
+ bootArgs->video.v_rowBytes = minfo.BytesPerScanline;
+ bootArgs->video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr);
}
while ( 0 );
- if ( err == errSuccess )
- {
- char * happyScreen;
- short * happyScreen16;
- long * happyScreen32;
- long cnt, x, y;
-
- // Fill the background to white (same as BootX).
+ return err;
+}
- drawColorRectangle( 0, 0, minfo.XResolution, minfo.YResolution,
- 0x00 /* color index */ );
+//==========================================================================
+// drawBootGraphics
- // Prepare the data for the happy mac.
+static int
+drawBootGraphics( unsigned short width,
+ unsigned short height,
+ unsigned char bitsPerPixel,
+ unsigned short refreshRate )
+{
+ VBEModeInfoBlock minfo;
+ unsigned short mode;
+ unsigned short vesaVersion;
+ int err = errFuncNotSupported;
+
+ char * appleBoot = 0;
+ short * appleBoot16;
+ long * appleBoot32;
+ long cnt, x, y;
+ char * appleBootPict;
- switch ( VIDEO(depth) )
+ do {
+ mode = getVESAModeWithProperties( width, height, bitsPerPixel,
+ maColorModeBit |
+ maModeIsSupportedBit |
+ maGraphicsModeBit |
+ maLinearFrameBufferAvailBit,
+ 0,
+ &minfo, &vesaVersion );
+ if ( mode == modeEndOfList )
{
- case 16 :
- happyScreen16 = malloc(kHappyScreenWidth * kHappyScreenHeight * 2);
- for (cnt = 0; cnt < (kHappyScreenWidth * kHappyScreenHeight); cnt++)
- happyScreen16[cnt] = lookUpCLUTIndex(gHappyScreenPict[cnt], 16);
- happyScreen = (char *) happyScreen16;
- break;
+ break;
+ }
- case 32 :
- happyScreen32 = malloc(kHappyScreenWidth * kHappyScreenHeight * 4);
- for (cnt = 0; cnt < (kHappyScreenWidth * kHappyScreenHeight); cnt++)
- happyScreen32[cnt] = lookUpCLUTIndex(gHappyScreenPict[cnt], 32);
- happyScreen = (char *) happyScreen32;
- break;
+ // Fill the background to 75% grey (same as BootX).
- default :
- happyScreen = (char *) gHappyScreenPict;
- break;
- }
+ drawColorRectangle( 0, 0, minfo.XResolution, minfo.YResolution,
+ 0x01 /* color index */ );
+
+ appleBootPict = decodeRLE( gAppleBootPictRLE, kAppleBootRLEBlocks,
+ kAppleBootWidth * kAppleBootHeight );
- x = ( VIDEO(width) - kHappyScreenWidth ) / 2;
- y = ( VIDEO(height) - kHappyScreenHeight ) / 2 + kHappyScreenOffset;
+ // Prepare the data for the happy mac.
+
+ if ( appleBootPict )
+ {
+ switch ( VIDEO(depth) )
+ {
+ case 16 :
+ appleBoot16 = malloc(kAppleBootWidth * kAppleBootHeight * 2);
+ if ( !appleBoot16 ) break;
+ for (cnt = 0; cnt < (kAppleBootWidth * kAppleBootHeight); cnt++)
+ appleBoot16[cnt] = lookUpCLUTIndex(appleBootPict[cnt], 16);
+ appleBoot = (char *) appleBoot16;
+ break;
+
+ case 32 :
+ appleBoot32 = malloc(kAppleBootWidth * kAppleBootHeight * 4);
+ if ( !appleBoot32 ) break;
+ for (cnt = 0; cnt < (kAppleBootWidth * kAppleBootHeight); cnt++)
+ appleBoot32[cnt] = lookUpCLUTIndex(appleBootPict[cnt], 32);
+ appleBoot = (char *) appleBoot32;
+ break;
+
+ default :
+ appleBoot = (char *) appleBootPict;
+ break;
+ }
- // Draw the happy mac in the center of the display.
+ x = ( VIDEO(width) - kAppleBootWidth ) / 2;
+ y = ( VIDEO(height) - kAppleBootHeight ) / 2 + kAppleBootOffset;
+
+ // Draw the happy mac in the center of the display.
+
+ if ( appleBoot )
+ {
+ drawDataRectangle( x, y, kAppleBootWidth, kAppleBootHeight,
+ appleBoot );
+ }
- drawDataRectangle( x, y, kHappyScreenWidth, kHappyScreenHeight,
- happyScreen );
- }
+ free( appleBootPict );
+ }
+ } while (0);
return err;
}
static unsigned long lookUpCLUTIndex( unsigned char index,
unsigned char depth )
{
- long result, red, green, blue;
+ long result, red, green, blue;
- red = appleClut8[index * 3 + 0];
- green = appleClut8[index * 3 + 1];
- blue = appleClut8[index * 3 + 2];
+ red = appleClut8[index * 3 + 0];
+ green = appleClut8[index * 3 + 1];
+ blue = appleClut8[index * 3 + 2];
- switch (depth) {
+ switch (depth) {
case 16 :
result = ((red & 0xF8) << 7) |
((green & 0xF8) << 2) |
break;
}
- return result;
+ return result;
}
//==========================================================================
maColorModeBit |
maModeIsSupportedBit,
maGraphicsModeBit,
- &minfo );
+ &minfo, NULL );
}
- if ( ( mode == modeEndOfList ) || ( setVBEMode(mode) != errSuccess ) )
+ if ( ( mode == modeEndOfList ) || ( setVBEMode(mode, NULL) != errSuccess ) )
{
video_mode( 2 ); // VGA BIOS, 80x25 text mode.
minfo.XResolution = 80;
// Update KernBootStruct using info provided by the selected
// VESA mode.
- kernBootStruct->graphicsMode = TEXT_MODE;
- kernBootStruct->video.v_baseAddr = 0xb8000;
- kernBootStruct->video.v_width = minfo.XResolution;
- kernBootStruct->video.v_height = minfo.YResolution;
- kernBootStruct->video.v_depth = 8;
- kernBootStruct->video.v_rowBytes = 0x8000;
+ bootArgs->graphicsMode = TEXT_MODE;
+ bootArgs->video.v_baseAddr = 0xb8000;
+ bootArgs->video.v_width = minfo.XResolution;
+ bootArgs->video.v_height = minfo.YResolution;
+ bootArgs->video.v_depth = 8;
+ bootArgs->video.v_rowBytes = 0x8000;
return errSuccess; // always return success
}
unsigned long numbers[],
unsigned long maxArrayCount )
{
- char * propStr;
- int count = 0;
+ char * propStr;
+ unsigned long count = 0;
#define _isdigit(c) ((c) >= '0' && (c) <= '9')
if ( propStr )
{
char * delimiter = propStr;
+ char * p = propStr;
- while ( count < maxArrayCount && *propStr != '\0' )
+ while ( count < maxArrayCount && *p != '\0' )
{
- unsigned long val = strtoul( propStr, &delimiter, 10 );
- if ( propStr != delimiter )
+ unsigned long val = strtoul( p, &delimiter, 10 );
+ if ( p != delimiter )
{
numbers[count++] = val;
- propStr = delimiter;
+ p = delimiter;
}
- while ( ( *propStr != '\0' ) && !_isdigit(*propStr) )
- propStr++;
+ while ( ( *p != '\0' ) && !_isdigit(*p) )
+ p++;
}
free( propStr );
void
setVideoMode( int mode )
{
- unsigned long params[3];
+ unsigned long params[4];
int count;
int err = errSuccess;
if ( mode == GRAPHICS_MODE )
{
- count = getNumberArrayFromProperty( kGraphicsModeKey, params, 3 );
+ params[3] = 0;
+ count = getNumberArrayFromProperty( kGraphicsModeKey, params, 4 );
if ( count < 3 )
{
params[0] = 1024; // Default graphics mode is 1024x768x16.
if ( params[2] == 555 ) params[2] = 16;
if ( params[2] == 888 ) params[2] = 32;
- err = setVESAGraphicsMode( params[0], params[1], params[2] );
+ err = setVESAGraphicsMode( params[0], params[1], params[2], params[3] );
if ( err == errSuccess )
{
// If this boolean is set to true, then the console driver
// in the kernel will show the animated color wheel on the
// upper left corner.
- kernBootStruct->video.v_display = !gVerboseMode;
+ bootArgs->video.v_display = !gVerboseMode;
+
+ if (!gVerboseMode) {
+ drawBootGraphics( params[0], params[1], params[2], params[3] );
+ }
}
}
}
setVESATextMode( params[0], params[1], 4 );
- kernBootStruct->video.v_display = 0;
+ bootArgs->video.v_display = 0;
}
- currentIndicator = 0;
+ currentIndicator = 0;
}
//==========================================================================
int getVideoMode(void)
{
- return kernBootStruct->graphicsMode;
+ return bootArgs->graphicsMode;
}
//==========================================================================
return;
else
lastTickTime = currentTickTime;
-
+
if ( getVideoMode() == TEXT_MODE )
{
string[0] = indicator[currentIndicator];
+++ /dev/null
-/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * The contents of this file constitute Original Code as defined in and
- * 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.
- *
- * This 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@
- */
-/*
- * happy_screen.h - Picture displayed a the beginning of the boot process
- *
- * Copyright (c) 2002 Apple Computer, Inc.
- *
- * DRI: Josh de Cesare
- */
-
-#define kHappyScreenWidth (52)
-#define kHappyScreenHeight (44)
-#define kHappyScreenOffset (-44)
-
-static const unsigned char gHappyScreenPict[] =
-{
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x12,0x27,0xf7,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0xf7,0x27,0x12,0x00,0x00,
- 0x00,0x12,0x37,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x37,0x12,0x00,
- 0x00,0x27,0x50,0x43,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x43,0x50,0x27,0x00,
- 0x00,0xf7,0x50,0x20,0xa3,0x33,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x33,0xa3,0x20,0x50,0xf7,0x00,
- 0x00,0x50,0x50,0x00,0x33,0x33,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x33,0x33,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x37,0x3c,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x37,0x3c,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa3,0x55,0x55,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa3,0x55,0x55,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x4d,0x50,0x0d,0x00,0x00,0x00,0x12,0x33,0x09,0x00,0x00,0x00,0x00,0x0b,0x4d,0x50,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x15,0x01,0x00,0x00,0x07,0x4d,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x50,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2f,0x4d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x4d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2f,0x50,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x29,0x50,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1d,0x50,0x37,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xc0,0x27,0x17,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x50,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x50,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x50,0x33,0xa3,0x00,0x00,0x00,0x00,0xa3,0x33,0x50,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x2f,0x50,0x33,0x1b,0x0a,0x0a,0x1b,0x33,0x50,0x2f,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x2f,0x50,0x50,0x50,0x50,0x50,0x50,0x2f,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x1e,0x31,0x43,0x43,0x31,0x1e,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x4d,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x4d,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x00,0x33,0x33,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x33,0x33,0x00,0x50,0x50,0x00,
- 0x00,0x50,0x50,0x20,0xa3,0x33,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x33,0xa3,0x20,0x50,0x50,0x00,
- 0x00,0x27,0x50,0x43,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x43,0x50,0x27,0x00,
- 0x00,0x12,0x37,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x37,0x12,0x00,
- 0x00,0x00,0x12,0x27,0xf7,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0xf7,0x27,0x12,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
-};
--- /dev/null
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/**************************************************************
+ LZSS.C -- A Data Compression Program
+***************************************************************
+ 4/6/1989 Haruhiko Okumura
+ Use, distribute, and modify this program freely.
+ Please send me your improved versions.
+ PC-VAN SCIENCE
+ NIFTY-Serve PAF01022
+ CompuServe 74050,1022
+
+**************************************************************/
+/*
+ * lzss.c - Package for decompressing lzss compressed objects
+ *
+ * Copyright (c) 2003 Apple Computer, Inc.
+ *
+ * DRI: Josh de Cesare
+ */
+
+#include <sl.h>
+
+#define N 4096 /* size of ring buffer - must be power of 2 */
+#define F 18 /* upper limit for match_length */
+#define THRESHOLD 2 /* encode string into position and length
+ if match_length is greater than this */
+#define NIL N /* index for root of binary search trees */
+
+int
+decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen)
+{
+ /* ring buffer of size N, with extra F-1 bytes to aid string comparison */
+ u_int8_t text_buf[N + F - 1];
+ u_int8_t *dststart = dst;
+ u_int8_t *srcend = src + srclen;
+ int i, j, k, r, c;
+ unsigned int flags;
+
+ dst = dststart;
+ srcend = src + srclen;
+ for (i = 0; i < N - F; i++)
+ text_buf[i] = ' ';
+ r = N - F;
+ flags = 0;
+ for ( ; ; ) {
+ if (((flags >>= 1) & 0x100) == 0) {
+ if (src < srcend) c = *src++; else break;
+ flags = c | 0xFF00; /* uses higher byte cleverly */
+ } /* to count eight */
+ if (flags & 1) {
+ if (src < srcend) c = *src++; else break;
+ *dst++ = c;
+ text_buf[r++] = c;
+ r &= (N - 1);
+ } else {
+ if (src < srcend) i = *src++; else break;
+ if (src < srcend) j = *src++; else break;
+ i |= ((j & 0xF0) << 4);
+ j = (j & 0x0F) + THRESHOLD;
+ for (k = 0; k <= j; k++) {
+ c = text_buf[(i + k) & (N - 1)];
+ *dst++ = c;
+ text_buf[r++] = c;
+ r &= (N - 1);
+ }
+ }
+ }
+
+ return dst - dststart;
+}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include "boot.h"
+#include "bootstruct.h"
#include "fdisk.h"
enum {
static int countdown( const char * msg, int row, int timeout )
{
- int time;
+ unsigned long time;
int ch = 0;
int col = strlen(msg) + 1;
clearBootArgs();
clearScreenRows( kMenuTopRow, kScreenLastRow );
changeCursor( 0, kMenuTopRow, kCursorTypeUnderline, 0 );
- printf("Scanning device %x...", gBIOSDev);
+ verbose("Scanning device %x...", gBIOSDev);
// Get a list of bootable volumes on the device.
int processBootOptions()
{
- KERNBOOTSTRUCT * kbp = kernBootStruct;
const char * cp = gBootArgs;
const char * val = 0;
const char * kernel;
int cnt;
+ int userCnt;
+ int cntRemaining;
skipblanks( &cp );
return 1;
}
- kbp->kernDev &= ~((B_UNITMASK << B_UNITSHIFT ) |
+ bootArgs->kernDev &= ~((B_UNITMASK << B_UNITSHIFT ) |
(B_PARTITIONMASK << B_PARTITIONSHIFT));
- kbp->kernDev |= MAKEKERNDEV( 0,
- /* unit */ BIOS_DEV_UNIT(gBootVolume->biosdev),
+ bootArgs->kernDev |= MAKEKERNDEV( 0,
+ /* unit */ BIOS_DEV_UNIT(gBootVolume),
/* partition */ gBootVolume->part_no );
}
// Load config table specified by the user, or use the default.
- getValueForBootKey( cp, "config", &val, &cnt );
+ if (getValueForBootKey( cp, "config", &val, &cnt ) == FALSE) {
+ val = 0;
+ cnt = 0;
+ }
loadSystemConfig(val, cnt);
if ( !sysConfigValid ) return -1;
if (( kernel = extractKernelName((char **)&cp) ))
{
- strcpy( kbp->bootFile, kernel );
+ strcpy( bootArgs->bootFile, kernel );
}
else
{
if ( getValueForKey( kKernelNameKey, &val, &cnt ) )
- strncpy( kbp->bootFile, val, cnt );
+ strlcpy( bootArgs->bootFile, val, cnt+1 );
+ }
+
+ // Check to see if we should ignore saved kernel flags.
+ if (getValueForBootKey(cp, "-F", &val, &cnt) == FALSE) {
+ if (getValueForKey( kKernelFlagsKey, &val, &cnt ) == FALSE) {
+ val = 0;
+ cnt = 0;
+ }
}
// Store the merged kernel flags and boot args.
- getValueForKey( kKernelFlagsKey, &val, &cnt );
- if ( (strlen(cp) + 1 + cnt) < BOOT_STRING_LEN )
- {
- if (cnt) strncpy(kbp->bootString, val, cnt);
- sprintf(&kbp->bootString[cnt], "%s%s", cnt ? " " : "", cp);
+ cntRemaining = BOOT_STRING_LEN - 2; // save 1 for NULL, 1 for space
+ if (cnt > cntRemaining) {
+ error("Warning: boot arguments too long, truncated\n");
+ cnt = cntRemaining;
+ }
+ if (cnt) {
+ strncpy(bootArgs->bootString, val, cnt);
+ bootArgs->bootString[cnt++] = ' ';
}
+ cntRemaining = cntRemaining - cnt;
+ userCnt = strlen(cp);
+ if (userCnt > cntRemaining) {
+ error("Warning: boot arguments too long, truncated\n");
+ userCnt = cntRemaining;
+ }
+ strncpy(&bootArgs->bootString[cnt], cp, userCnt);
+ bootArgs->bootString[cnt+userCnt] = '\0';
gVerboseMode = getValueForKey( "-v", &val, &cnt ) ||
getValueForKey( "-s", &val, &cnt );
gBootGraphics = getBoolForKey( kBootGraphicsKey );
+ gBootGraphics = YES;
+ if ( getValueForKey(kBootGraphicsKey, &val, &cnt) && cnt &&
+ (val[0] == 'N' || val[0] == 'n') )
+ gBootGraphics = NO;
+
gBootMode = ( getValueForKey( "-f", &val, &cnt ) ) ?
kBootModeSafe : kBootModeNormal;
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
--- /dev/null
+
+DIR = cdboot
+include ../MakePaths.dir
+
+NASM = $(SYMROOT)/nasm
+INSTALLDIR = $(DSTROOT)/usr/standalone/i386
+DIRS_NEEDED = $(SYMROOT)
+
+all: $(DIRS_NEEDED) cdboot
+
+cdboot: cdboot.s $(SYMROOT)/boot Makefile $(NASM)
+ $(NASM) cdboot.s -o $(SYMROOT)/cdboot
+ dd if=$(SYMROOT)/boot of=$(SYMROOT)/cdboot conv=sync bs=2k seek=1
+
+biostest: biostest.asm Makefile $(NASM)
+ $(NASM) biostest.asm -o $(SYMROOT)/$@
+
+install_i386:: all $(INSTALLDIR)
+ cp $(SYMROOT)/cdboot $(INSTALLDIR)
+ cd $(INSTALLDIR); chmod u+w cdboot
+
+include ../MakeInc.dir
+
+#dependencies
+
--- /dev/null
+; Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+;
+; @APPLE_LICENSE_HEADER_START@
+;
+; Portions Copyright (c) 2002 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.2 (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@
+;
+
+kStackAddr EQU 0xFFF0
+
+ code16
+ ORG 0x7c00
+
+ SEGMENT .text
+
+boot equ $
+
+_start: cli
+ jmp 0:start
+ times 8-($-$$) nop ; Ensure table is at offset 8
+
+ ; El Torito boot information table, filled in by the
+ ; mkisofs -boot-info-table option
+bi_pvd: dd 0 ; LBA of primary volume descriptor
+bi_file: dd 0 ; LBA of boot file
+bi_length: dd 0 ; Length of boot file
+bi_csum: dd 0 ; Checksum of boot file
+bi_reserved: times 10 dd 0 ; Reserved
+
+
+
+start:
+ xor ax, ax
+ mov ss, ax
+ mov sp, kStackAddr
+ sti
+ cld
+ mov ds, ax
+ mov es, ax
+ mov [biosdrive], dl
+
+ mov si, header_str
+ call print_string
+
+ mov si, drive_str ; print drive number
+ call print_string
+ mov al, dl
+ call print_hex
+ mov si, crnl_str
+ call print_string
+
+test1: ; Test 1: El Torito status call
+ mov si, test1_str
+ call print_string
+
+ mov ax, 0x4b01
+ mov al, 0x01
+ ;; dl already contains drive number
+ mov esi, spec
+ int 0x13
+
+ jnc test1a ; CF clear?
+
+test1_fail:
+ mov si, test1_fail1_str
+ call print_string
+ jmp short test1_end
+
+test1a:
+ cmp [spec.drive], dl ; drive in spec packet matches?
+ jne test1a_fail
+ mov si, pass_str
+ call print_string
+ jmp short test1_end
+
+test1a_fail:
+ mov si, test1_fail2_str
+ call print_string
+
+test1_end:
+ mov si, crnl_str
+ call print_string
+
+
+test2: ; Check for EBIOS support
+ mov si, test2_str
+ call print_string
+
+ mov cx, 0
+ mov ah, 0x41
+ mov bx, 0x55aa
+ mov dl, [biosdrive]
+ int 0x13
+
+ jnc test2a ; CF clear?
+
+test2_fail:
+ mov si, test2_fail1_str
+ call print_string
+ jmp short test2_end
+
+test2a:
+ cmp bx, 0xaa55
+ je test2b
+
+test2a_fail:
+ mov si, test2_fail2_str
+ call print_string
+ jmp short test2_end
+
+test2b:
+ mov si, test2_vers_str ; print EDD version
+ call print_string
+ push cx
+ mov al, ah
+ call print_hex
+ mov si, test2_flag_str ; print EDD flags
+ call print_string
+ mov al, cl
+ call print_hex
+ mov al, ' '
+ call putc
+ pop cx
+ and cl, 0x01 ; EDD drive access?
+ jnz test2_pass
+
+test2b_fail:
+ mov si, test2_fail3_str
+ call print_string
+ jmp short test2_end
+
+test2_pass
+ mov si, pass_str
+ call print_string
+
+test2_end:
+ mov si, crnl_str
+ call print_string
+
+test3: ; Disk geometry
+ mov si, test3_str
+ call print_string
+
+ mov ah, 0x48
+ mov dl, [biosdrive]
+ mov si, disk_params
+ int 0x13
+
+ jnc test3a
+
+test3_fail:
+ mov si, test3_fail1_str
+ call print_string
+ jmp test3_end
+
+test3a:
+ cmp word [disk_params.nbps], 0x0800
+ je test3_pass
+
+test3a_fail:
+ mov al, [disk_params.nbps+1]
+ call print_hex
+ mov al, [disk_params.nbps]
+ call print_hex
+ mov al, ' '
+ call putc
+ mov si, test3_fail2_str
+ call print_string
+ jmp test3_end
+
+test3_pass:
+ mov si, pass_str
+ call print_string
+
+test3_end:
+ mov si, crnl_str
+ call print_string
+
+
+finished:
+ mov si, finished_str
+ call print_string
+
+halt: hlt
+ jmp short halt
+
+
+
+ ;; ----- Helper functions -----
+
+ ;; putc(ch)
+ ;; character in AL
+ ;; clobbers AX, BX
+putc: mov bx, 0x000f
+ mov ah, 0x0e
+ int 0x10
+ ret
+
+ ;; getc()
+ ;; clobbers AH
+ ;; returns character in AL
+getc: mov ah, 0
+ int 0x16
+ ret
+
+;--------------------------------------------------------------------------
+; Write the byte value to the console in hex.
+;
+; Arguments:
+; AL = Value to be displayed in hex.
+;
+print_hex:
+ push ax
+ ror al, 4
+ call print_nibble ; display upper nibble
+ pop ax
+ call print_nibble ; display lower nibble
+ ret
+
+print_nibble:
+ and al, 0x0f
+ add al, '0'
+ cmp al, '9'
+ jna .print_ascii
+ add al, 'A' - '9' - 1
+.print_ascii:
+ call putc
+ ret
+
+;--------------------------------------------------------------------------
+; Write a string to the console.
+;
+; Arguments:
+; DS:SI pointer to a NULL terminated string.
+;
+; Clobber list:
+; none
+;
+print_string:
+ pushad
+ mov bx, 1 ; BH=0, BL=1 (blue)
+.loop
+ lodsb ; load a byte from DS:SI into AL
+ cmp al, 0 ; Is it a NULL?
+ je .exit ; yes, all done
+ mov ah, 0xE ; INT10 Func 0xE
+ int 0x10 ; display byte in tty mode
+ jmp short .loop
+.exit
+ popad
+ ret
+
+
+ SEGMENT .data
+
+ ;; Strings
+
+header_str: db "BIOS test v0.3", 10,13, 0
+finished_str: db "Tests completed.", 10,13,0
+drive_str: db "Boot drive: ", 0
+pass_str: db "pass", 0
+fail_str: db "FAIL", 0
+crnl_str: db 10,13, 0
+test1_str: db "Test 1: El Torito status: ", 0
+test1_fail1_str: db "FAIL (CF=1)", 0
+test1_fail2_str: db "FAIL (spec drive)", 0
+test2_str: db "Test 2: EBIOS check: ", 0
+test2_vers_str: db "vers. ", 0
+test2_flag_str: db " flags ", 0
+test2_fail1_str: db "FAIL (CF=1)", 0
+test2_fail2_str: db "FAIL (BX != AA55)", 0
+test2_fail3_str: db "FAIL (CL & 1 == 0)", 0
+test3_str: db "Test 3: Geometry check: ", 0
+test3_fail1_str: db "FAIL (CF=1)", 0
+test3_fail2_str: db "FAIL (nbps != 0x200)", 0
+
+ ;; Other variables
+
+biosdrive: db 0
+
+ ;; El Torito spec packet
+spec:
+.size: db 0x13
+.type: db 0
+.drive: db 0
+.index: db 0
+.lba: dd 0
+.spec: dw 0
+.userseg: dw 0
+.loadseg: dw 0
+.seccnt: dw 0
+.cylcnt: db 0
+.ccl: db 0
+.hdcnt: db 0
+
+ ;; Disk parameter packet
+disk_params:
+.size: dw 66
+.flags: dw 0
+.cyls: dd 0
+.heads: dd 0
+.spt: dd 0
+.sectors: dd 0,0
+.nbps: dw 0
+.dpte_offset: dw 0
+.dpte_segment: dw 0
+.key: dw 0
+.ignored: times 34 db 0
+
+
--- /dev/null
+; Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+;
+; @APPLE_LICENSE_HEADER_START@
+;
+; Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+; compliance with the License. Please obtain a copy of the License at
+; http://www.opensource.apple.com/apsl/ and read it before using this
+; file.
+;
+; The Original Code and all software distributed under the License are
+; distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+; INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+; Please see the License for the specific language governing rights and
+; limitations under the License.
+;
+; @APPLE_LICENSE_HEADER_END@
+
+DEBUG EQU 0
+
+%macro DebugCharMacro 1
+ push ax
+ mov al, %1
+ call putc
+ pop ax
+%endmacro
+%macro DebugPauseMacro 0
+ push ax
+ call getc
+ pop ax
+%endmacro
+
+%if DEBUG
+%define DebugChar(x) DebugCharMacro x
+%define DebugPause(x) DebugPauseMacro
+%else
+%define DebugChar(x)
+%define DebugPause(x)
+%endif
+
+kBoot2Sectors EQU 112 ; sectors to load for boot2
+kBoot2Address EQU 0x0200 ; boot2 load address
+kBoot2Segment EQU 0x2000 ; boot2 load segment
+
+kBoot0Stack EQU 0xFFF0 ; boot0 stack pointer
+
+kReadBuffer EQU 0x1000 ; disk data buffer address
+
+kVolSectorOffset EQU 0x47 ; offset in buffer of sector number
+ ; in volume descriptor
+kBootSectorOffset EQU 0x28 ; offset in boot catalog
+ ; of sector number to load boot file
+kBootCountOffset EQU 0x26 ; offset in boot catalog
+ ; of number of sectors to read
+
+
+ code16
+ ORG 0x7c00
+
+ SEGMENT .text
+
+start:
+ cli
+ jmp 0:start1
+ times 8-($-$$) nop ; Put boot information table at offset 8
+
+ ; El Torito boot information table, filled in by the
+ ; mkisofs -boot-info-table option, if used.
+bi_pvd: dd 0 ; LBA of primary volume descriptor
+bi_file: dd 0 ; LBA of boot file
+bi_length: dd 0 ; Length of boot file
+bi_csum: dd 0 ; Checksum of boot file
+bi_reserved: times 10 dd 0 ; Reserved
+
+start1:
+ xor ax, ax ; zero %ax
+ mov ss, ax ; setup the
+ mov sp, kBoot0Stack ; stack
+ sti
+ cld ; increment SI after each lodsb call
+ mov ds, ax ; setup the
+ mov es, ax ; data segments
+ ;; BIOS boot drive is in DL
+
+ DebugChar('!')
+ DebugPause()
+
+%if DEBUG
+ mov eax, [kBoot2LoadAddr]
+ call print_hex
+ call getc
+%endif
+
+ ;;
+ ;; The BIOS likely didn't load the rest of the booter,
+ ;; so we have to fetch it ourselves.
+ ;;
+ xor ax, ax
+ mov es, ax
+ mov bx, kReadBuffer
+ mov al, 1
+ mov ecx, 17
+ call read_lba
+ jc error
+
+ DebugChar('A')
+
+ mov ecx, [kReadBuffer + kVolSectorOffset]
+%if DEBUG
+ mov eax, ecx
+ call print_hex
+ DebugPause()
+%endif
+ mov al, 1
+ call read_lba
+ jc error
+
+ ;; Now we have the boot catalog in the buffer.
+ ;; Really we should look at the validation entry, but oh well.
+
+ DebugChar('B')
+
+ mov ecx, [kReadBuffer + kBootSectorOffset]
+ inc ecx ; skip the first sector which is what we are in
+%if DEBUG
+ mov eax, ecx
+ call print_hex
+ DebugPause()
+%endif
+
+ mov ax, kBoot2Segment
+ mov es, ax
+
+ mov al, kBoot2Sectors / 4
+ mov bx, kBoot2Address
+ call read_lba
+ jc error
+
+ DebugChar('C')
+%if DEBUG
+ mov eax, [es:kBoot2Address]
+ call print_hex
+ DebugPause()
+%endif
+
+ xor ax, ax
+ mov es, ax
+
+ DebugChar('X')
+ DebugPause()
+
+ ;; Jump to newly-loaded booter
+ jmp kBoot2Segment:kBoot2Address
+
+error:
+ mov al, 'E'
+ call putc
+ hlt
+
+ ;;
+ ;; Support functions
+ ;;
+
+;--------------------------------------------------------------------------
+; read_lba - Read sectors from CD using LBA addressing.
+;
+; Arguments:
+; AL = number of 2048-byte sectors to read (valid from 1-127).
+; ES:BX = pointer to where the sectors should be stored.
+; ECX = sector offset in partition
+; DL = drive number (0x80 + unit number)
+;
+; Returns:
+; CF = 0 success
+; 1 error
+;
+read_lba:
+ pushad ; save all registers
+ mov bp, sp ; save current SP
+
+ ;
+ ; Create the Disk Address Packet structure for the
+ ; INT13/F42 (Extended Read Sectors) on the stack.
+ ;
+
+ ; push DWORD 0 ; offset 12, upper 32-bit LBA
+ push ds ; For sake of saving memory,
+ push ds ; push DS register, which is 0.
+
+ push ecx
+
+ push es ; offset 6, memory segment
+
+ push bx ; offset 4, memory offset
+
+ xor ah, ah ; offset 3, must be 0
+ push ax ; offset 2, number of sectors
+
+ push WORD 16 ; offset 0-1, packet size
+
+ ;
+ ; INT13 Func 42 - Extended Read Sectors
+ ;
+ ; Arguments:
+ ; AH = 0x42
+ ; DL = drive number (80h + drive unit)
+ ; DS:SI = pointer to Disk Address Packet
+ ;
+ ; Returns:
+ ; AH = return status (sucess is 0)
+ ; carry = 0 success
+ ; 1 error
+ ;
+ ; Packet offset 2 indicates the number of sectors read
+ ; successfully.
+ ;
+ mov si, sp
+ mov ah, 0x42
+ int 0x13
+
+ jnc .exit
+
+ DebugChar('R') ; indicate INT13/F42 error
+
+ ;
+ ; Issue a disk reset on error.
+ ; Should this be changed to Func 0xD to skip the diskette controller
+ ; reset?
+ ;
+ xor ax, ax ; Func 0
+ int 0x13 ; INT 13
+ stc ; set carry to indicate error
+
+.exit:
+ mov sp, bp ; restore SP
+ popad
+ ret
+
+;;
+;; Display a single character from AL.
+;;
+putc: pushad
+ mov bx, 0x1 ; attribute for output
+ mov ah, 0xe ; BIOS: put_char
+ int 0x10 ; call BIOS, print char in %al
+ popad
+ ret
+
+;;
+;; Get a character from the keyboard and return it in AL.
+;;
+getc: mov ah, 0
+ int 0x16
+ ret
+
+%if DEBUG
+;--------------------------------------------------------------------------
+; Write the 4-byte value to the console in hex.
+;
+; Arguments:
+; EAX = Value to be displayed in hex.
+;
+print_hex:
+ pushad
+ mov cx, WORD 4
+ bswap eax
+.loop
+ push ax
+ ror al, 4
+ call print_nibble ; display upper nibble
+ pop ax
+ call print_nibble ; display lower nibble
+ ror eax, 8
+ loop .loop
+
+ mov al, 10 ; carriage return
+ call putc
+ mov al, 13
+ call putc
+ popad
+ ret
+
+print_nibble:
+ and al, 0x0f
+ add al, '0'
+ cmp al, '9'
+ jna .print_ascii
+ add al, 'A' - '9' - 1
+.print_ascii:
+ call putc
+ ret
+
+%endif ; DEBUG
+
+
+
+ ;; Pad this file to a size of 2048 bytes (one CD sector).
+pad:
+ times 2048-($-$$) db 0
+
+ ;; Location of loaded boot2 code.
+kBoot2LoadAddr equ $
+
+ END
OPTIM = -Os
CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
- -fno-builtin -static
+ -fno-builtin -static -fomit-frame-pointer \
+ -mpreferred-stack-boundary=2 -fno-align-functions
INC = -I. -I$(SYMROOT) -I$(UTILDIR)
ifneq "" "$(wildcard /bin/mkdirs)"
string.c strtol.c error.c \
qsort.c
HFILES = memory.h
-EXPORTED_HFILES = libsa.h kernBootStruct.h memory.h
+EXPORTED_HFILES = libsa.h memory.h
INSTALLED_SA_HFILES = libsa.h
-INSTALLED_MD_HFILES = kernBootStruct.h
OTHERFILES = Makefile
ALLSRC = $(SFILES) $(CFILES) $(HFILES) $(OTHERFILES)
LIBS = libsa.a
installhdrs:: $(INSTALL_SA_DIR) $(INSTALL_MD_DIR)
cp $(INSTALLED_SA_HFILES) $(INSTALL_SA_DIR)
- cp $(INSTALLED_MD_HFILES) $(INSTALL_MD_DIR)
include ../MakeInc.dir
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
+++ /dev/null
-/*
- * 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.
- */
-
-#ifndef __BOOT_KERNBOOTSTRUCT_H
-#define __BOOT_KERNBOOTSTRUCT_H
-
-/*
- * Maximum number of boot drivers that can be loaded.
- */
-#define NDRIVERS 500
-
-/*
- * Types of boot driver that may be loaded by the booter.
- */
-enum {
- kBootDriverTypeInvalid = 0,
- kBootDriverTypeKEXT = 1,
- kBootDriverTypeMKEXT = 2
-};
-
-typedef struct {
- unsigned long address; // address where driver was loaded
- unsigned long size; // number of bytes
- unsigned long type; // driver type
-} driver_config_t;
-
-/*
- * APM BIOS information.
- */
-typedef struct {
- unsigned short major_vers; // == 0 if not present
- unsigned short minor_vers;
- unsigned long cs32_base;
- unsigned long cs16_base;
- unsigned long ds_base;
- unsigned long cs_length;
- unsigned long ds_length;
- unsigned long entry_offset;
- union {
- struct {
- unsigned long mode_16 :1;
- unsigned long mode_32 :1;
- unsigned long idle_slows_cpu :1;
- unsigned long reserved :29;
- } f;
- unsigned long data;
- } flags;
- unsigned long connected;
-} APM_config_t;
-
-/*
- * PCI bus information.
- */
-typedef struct _PCI_bus_info_t {
- union {
- struct {
- unsigned char configMethod1 :1;
- unsigned char configMethod2 :1;
- unsigned char :2;
- unsigned char specialCycle1 :1;
- unsigned char specialCycle2 :1;
- } s;
- unsigned char d;
- } u_bus;
- unsigned char maxBusNum;
- unsigned char majorVersion;
- unsigned char minorVersion;
- unsigned char BIOSPresent;
-} PCI_bus_info_t;
-
-/*
- * Video information.
- */
-struct boot_video {
- unsigned long v_baseAddr; // Base address of video memory
- unsigned long v_display; // Display Code (if Applicable
- unsigned long v_rowBytes; // Number of bytes per pixel row
- unsigned long v_width; // Width
- unsigned long v_height; // Height
- unsigned long v_depth; // Pixel Depth
-};
-
-typedef struct boot_video boot_video;
-
-#define GRAPHICS_MODE 1
-#define TEXT_MODE 0
-
-#define BOOT_STRING_LEN 160
-#define CONFIG_SIZE (12 * 4096)
-
-typedef struct {
- short version;
- char bootString[BOOT_STRING_LEN]; // boot arguments
- int magicCookie; // KERNBOOTMAGIC
- int numIDEs; // number of IDE drives
- int rootdev; // root device
- int convmem; // conventional memory
- int extmem; // extended memory
- char bootFile[128]; // kernel file name
- int firstAddr0; // first address for kern convmem
- int diskInfo[4]; // info for bios dev 80-83
- int graphicsMode; // booted in graphics mode?
- int kernDev; // device kernel was fetched from
- int numBootDrivers; // number of drivers loaded
- char * configEnd; // pointer to end of config files
- int kaddr; // kernel load address
- int ksize; // size of kernel
- driver_config_t driverConfig[NDRIVERS];
- char _reserved[2052];
- boot_video video;
- PCI_bus_info_t pciInfo;
- APM_config_t apmConfig;
- char config[CONFIG_SIZE];
-} KERNBOOTSTRUCT;
-
-#define KERNSTRUCT_ADDR ((KERNBOOTSTRUCT *) 0x11000)
-#define KERNBOOTMAGIC 0xa7a7a7a7
-
-#ifndef KERNEL
-extern KERNBOOTSTRUCT * kernBootStruct;
-#endif
-
-#endif /* !__BOOT_KERNBOOTSTRUCT_H */
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
extern int strncmp(const char * s1, const char * s2, size_t n);
extern char * strcpy(char * s1, const char * s2);
extern char * strncpy(char * s1, const char * s2, size_t n);
+extern char * strlcpy(char * s1, const char * s2, size_t n);
extern int atoi(const char * str);
extern int ptol(const char * str);
extern int strlen(const char * str);
/*
* zalloc.c
*/
-extern void malloc_init(char * start, int size, int nodes);
+extern void malloc_init(char * start, int size, int nodes, void (*malloc_error)(char *, size_t));
extern void * malloc(size_t size);
extern void free(void * start);
extern void * realloc(void * ptr, size_t size);
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#define STACK_SEG 0x3000
#define STACK_OFS 0xFFF0 // stack pointer
+#define BOOT1U_SEG 0x1000
+#define BOOT1U_OFS 0x0200
+
#define BOOT2_SEG BASE_SEG
#define BOOT2_OFS 0x0200 // 512 byte disk sector offset
#define BIOS_ADDR 0x0C00 // BIOS disk I/O buffer
-#define BIOS_LEN 0x2400 // 9K
+#define BIOS_LEN 0x2000 // 8K - divisible by 512 and 2048
/* These are all "virtual" addresses...
* which are physical addresses plus MEMBASE.
#define BOOTSTRUCT_LEN 0x00F000
#define BASE_ADDR ADDR32(BASE_SEG, 0)
+#define BASE1U_ADDR ADDR32(BOOT1U_SEG, 0)
+#define BOOT1U_ADDR ADDR32(BOOT1U_SEG, BOOT1U_OFS)
#define BOOT2_ADDR ADDR32(BOOT2_SEG, BOOT2_OFS)
#define VIDEO_ADDR 0x0A0000 // unusable space
#define VIDEO_LEN 0x060000
-#define KERNEL_ADDR 0x100000 // 15M kernel + drivers
-#define KERNEL_LEN 0xF00000
+#define KERNEL_ADDR 0x0100000 // 64M kernel + drivers
+#define KERNEL_LEN 0x4000000
-#define ZALLOC_ADDR 0x1000000 // 4M zalloc area
-#define ZALLOC_LEN 0x400000
+#define ZALLOC_ADDR 0x4100000 // 47M zalloc area
+#define ZALLOC_LEN 0x2F00000
-#define LOAD_ADDR 0x01400000 // File download buffer
-#define LOAD_LEN 0x800000 // Max file size
+#define LOAD_ADDR 0x7000000 // 16M File load buffer
+#define LOAD_LEN 0x1000000
#define TFTP_ADDR LOAD_ADDR // tftp download buffer
#define TFTP_LEN LOAD_LEN
* Extract segment/offset from a linear address.
*/
#define OFFSET16(addr) ((addr) - BASE_ADDR)
+#define OFFSET1U16(addr) ((addr) - BASE1U_ADDR)
#define OFFSET(addr) ((addr) & 0xFFFF)
#define SEGMENT(addr) (((addr) & 0xF0000) >> 4)
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
pn = a + n * es;
r = min(pa - (char *)a, pb - pa);
vecswap(a, pb - r, r);
- r = min(pd - pc, pn - pd - es);
+ r = min(pd - pc, (pn - pd) - (int)es);
vecswap(pb, pn - r, r);
- if ((r = pb - pa) > es)
+ if ((r = pb - pa) > (int)es)
qsort(a, r / es, es, cmp);
- if ((r = pd - pc) > es) {
+ if ((r = pd - pc) > (int)es) {
/* Iterate rather than recurse to save stack space */
a = pn - r;
n = r / es;
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
register char *ret = s1;
while (n && (*s1++ = *s2++))
n--;
- if (!n) *s1=0;
+ return ret;
+}
+
+char *
+strlcpy(char * s1, const char * s2, size_t n)
+{
+ register char *ret = s1;
+ while (n && (*s1++ = *s2++))
+ n--;
+ if (!n) *--s1=0;
return ret;
}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
typedef struct {
char * start;
- int size;
+ size_t size;
} zmem;
static zmem * zalloced;
static zmem * zavailable;
static short availableNodes, allocedNodes, totalNodes;
static char * zalloc_base;
-static void (*zerror)();
+static char * zalloc_end;
+static void (*zerror)(char *, size_t);
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 ZALLOC_NODES 1024
+#if ZDEBUG
+size_t zalloced_size;
+#endif
-static void malloc_error()
+#define ZALLOC_NODES 16384
+
+static void malloc_error(char *addr, size_t size)
{
- // printf("Out of memory\n");
+#ifdef i386
+ asm("hlt");
+#endif
}
// define the block of memory that the allocator will use
-void malloc_init(char * start, int size, int nodes)
+void malloc_init(char * start, int size, int nodes, void (*malloc_err_fn)(char *, size_t))
{
- zalloc_base = start;
- totalNodes = nodes;
+ zalloc_base = start ? start : (char *)ZALLOC_ADDR;
+ totalNodes = nodes ? nodes : ZALLOC_NODES;
zalloced = (zmem *) zalloc_base;
- start += sizeof(zmem) * nodes;
- zavailable = (zmem *) start;
- start += sizeof(zmem) * nodes;
- zavailable[0].start = start;
- zavailable[0].size = size;
+ zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes;;
+ zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes;
+ if (size == 0) size = ZALLOC_LEN;
+ zavailable[0].size = size - (zavailable[0].start - zalloc_base);
+ zalloc_end = zalloc_base + size;
availableNodes = 1;
allocedNodes = 0;
- zerror = malloc_error;
+ zerror = malloc_err_fn ? malloc_err_fn : malloc_error;
}
+#define BEST_FIT 1
+
void * malloc(size_t size)
{
int i;
+#if BEST_FIT
+ int bestFit;
+ size_t smallestSize;
+#endif
char * ret = 0;
if ( !zalloc_base )
{
// this used to follow the bss but some bios' corrupted it...
- malloc_init((char *)ZALLOC_ADDR, ZALLOC_LEN, ZALLOC_NODES);
+ malloc_init((char *)ZALLOC_ADDR, ZALLOC_LEN, ZALLOC_NODES, malloc_error);
}
size = ((size + 0xf) & ~0xf);
+
+ if (size == 0) {
+ if (zerror) (*zerror)((char *)0xdeadbeef, 0);
+ }
+#if BEST_FIT
+ smallestSize = 0;
+ bestFit = -1;
+#endif
for (i = 0; i < availableNodes; i++)
{
- // uses first possible node, doesn't try to find best fit
+ // find node with equal size, or if not found,
+ // then smallest node that fits.
if ( zavailable[i].size == size )
{
zallocate(ret = zavailable[i].start, size);
zdelete(zavailable, i); availableNodes--;
goto done;
}
+#if BEST_FIT
+ else
+ {
+ if ((zavailable[i].size > size) &&
+ ((smallestSize == 0) ||
+ (zavailable[i].size < smallestSize)))
+ {
+ bestFit = i;
+ smallestSize = zavailable[i].size;
+ }
+ }
+
+#else
else if ( zavailable[i].size > size )
{
zallocate(ret = zavailable[i].start, size);
zavailable[i].size -= size;
goto done;
}
- }
+#endif
+ }
+#if BEST_FIT
+ if (bestFit != -1)
+ {
+ zallocate(ret = zavailable[bestFit].start, size);
+ zavailable[bestFit].start += size;
+ zavailable[bestFit].size -= size;
+ }
+#endif
done:
- if ((ret == 0) || (ret + size >= (char *)(ZALLOC_ADDR + ZALLOC_LEN)))
+ if ((ret == 0) || (ret + size >= zalloc_end))
{
- if (zerror) (*zerror)(ret);
+ if (zerror) (*zerror)(ret, size);
}
if (ret != 0)
{
bzero(ret, size);
}
+#if ZDEBUG
+ zalloced_size += size;
+#endif
return (void *) ret;
}
void free(void * pointer)
{
- int i, tsize = 0, found = 0;
+ unsigned long rp;
+ int i, found = 0;
+ size_t tsize = 0;
char * start = pointer;
+#if i386
+ // Get return address of our caller,
+ // in case we have to report an error below.
+ asm("movl %%esp, %%eax\n\t"
+ "subl $4, %%eax\n\t"
+ "movl 0(%%eax), %%eax" : "=a" (rp) );
+#else
+ rp = 0;
+#endif
+
if ( !start ) return;
for (i = 0; i < allocedNodes; i++)
#endif
zdelete(zalloced, i); allocedNodes--;
found = 1;
+#if ZDEBUG
+ memset(pointer, 0x5A, tsize);
+#endif
break;
}
}
- if ( !found ) return;
+ if ( !found ) {
+ if (zerror) (*zerror)(pointer, rp);
+ else return;
+ }
+#if ZDEBUG
+ zalloced_size -= tsize;
+#endif
for (i = 0; i < availableNodes; i++)
{
}
if ((i > 0) &&
- (zavailable[i-1].start + zavailable[i-1].size == start))
+ (zavailable[i-1].start + zavailable[i-1].size == start))
{
zavailable[i-1].size += tsize;
zcoalesce();
if ((start + tsize) < zavailable[i].start)
{
- zinsert(zavailable, i); availableNodes++;
+ if (++availableNodes > totalNodes) {
+ if (zerror) (*zerror)((char *)0xf000f000, 0);
+ }
+ zinsert(zavailable, i);
zavailable[i].start = start;
zavailable[i].size = tsize;
return;
}
}
+ if (++availableNodes > totalNodes) {
+ if (zerror) (*zerror)((char *)0xf000f000, 1);
+ }
zavailable[i].start = start;
zavailable[i].size = tsize;
- availableNodes++;
zcoalesce();
return;
}
#endif
zalloced[allocedNodes].start = start;
zalloced[allocedNodes].size = size;
- allocedNodes++;
+ if (++allocedNodes > totalNodes) {
+ if (zerror) (*zerror)((char *)0xf000f000, 2);
+ };
}
static void
for (; i >= ndx; i--, z1--, z2--)
{
- z2->start = z1->start;
- z2->size = z1->size;
+ *z2 = *z1;
}
}
for (i = ndx; i < totalNodes-1; i++, z1++, z2++)
{
- z1->start = z2->start;
- z1->size = z2->size;
+ *z1 = *z2;
}
}
OPTIM = -Os
CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
- -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER -fno-builtin -static \
- -DRCZ_COMPRESSED_FILE_SUPPORT
+ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
+ -DRCZ_COMPRESSED_FILE_SUPPORT \
+ -fno-builtin -static -fomit-frame-pointer \
+ -mpreferred-stack-boundary=2 -fno-align-functions
DEFINES=
CONFIG = hd
-INC = -I../rcz -I. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSADIR) -I/System/Library/Frameworks/System.framework/PrivateHeaders
+INC = -I../rcz -I. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSADIR)
ifneq "" "$(wildcard /bin/mkdirs)"
MKDIRS = /bin/mkdirs
else
SAIO_OBJS = table.o asm.o bios.o biosfn.o \
disk.o sys.o cache.o bootstruct.o \
ufs.o ufs_byteorder.o \
- stringTable.o load.o misc.o \
- vbe.o nbp.o hfs.o hfs_compare.o
+ stringTable.o load.o memory.o misc.o \
+ vbe.o nbp.o hfs.o hfs_compare.o \
+ xml.o
SAIO_EXTERN_OBJS = console.o
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* HISTORY
* $Log: asm.s,v $
+ * Revision 1.5 2002/11/05 20:34:26 jliu
+ * Integrating:
+ * 3051234 boot shouldnt require Graphics = Yes
+ * 3091627 Need support for refresh rate adjustment
+ *
+ * Revision 1.4 2002/10/02 00:06:18 curtisg
+ * Integrating PR-3032510.
+ *
+ * Revision 1.3.6.1 2002/08/30 21:16:29 curtisg
+ * KERNBOOTSTRUCT is going away in favor of KernelBootArgs_t in <pexpert/i386/boot.h>.
+ *
* Revision 1.3 2002/07/09 14:06:21 jliu
* Merging changes from PR-2954224 branch in boot/i386.
*
.file "asm.s"
CR0_PE_ON = 0x1
-CR0_PE_OFF = 0x7ffffffe
+CR0_PE_OFF = 0x7ffffff0
STACK32_BASE = ADDR32(STACK_SEG, 0)
STACK16_SEG = STACK_SEG
jmp _halt
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-// startprog(phyaddr)
+// startprog(phyaddr, arg)
// Start the program on protected mode where phyaddr is the entry point.
+// Passes arg to the program in %eax.
//
LABEL(_startprog)
push %ebp
mov %esp, %ebp
+ mov 0xc(%ebp), %eax // argument to program
mov 0x8(%ebp), %ecx // entry offset
mov $0x28, %ebx // segment
push %ebx
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef __LIBSAIO_BIOS_H
#define __LIBSAIO_BIOS_H
+#include <pexpert/i386/boot.h>
+
typedef union {
unsigned int rx;
unsigned short rr;
} biosBuf_t;
#define EBIOS_FIXED_DISK_ACCESS 0x01
+#define EBIOS_LOCKING_ACCESS 0x02
#define EBIOS_ENHANCED_DRIVE_INFO 0x04
-extern unsigned char uses_ebios[];
+
+#define BASE_HD_DRIVE 0x80
#endif /* !__LIBSAIO_BIOS_H */
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
leave
ret
-
-/*============================================================================
- * Determines the total system memory size using various BIOS Int 15 calls.
- *
- */
-LABEL(_get_memsize)
- enter $0, $0 # create frame pointer (32 bit operand/stack)
- pushal # save all registers
-
- movl 8(%ebp), %ebx # push input structure pointer to stack
- pushl %ebx
-
- call __prot_to_real # switch to real mode
-
- ##################################################################
- # In real mode.
- # Do not forget the opcode overrides, since the assembler
- # does not know we have made a transition to 16-bit operation.
- ##################################################################
-
- data32
- movl $0xE801, %eax # Get memory size
- clc
- int $0x15
- data32
- jnc getmsz_e801
-
- data32
- movl $0xDA88, %eax # Get memory size
- clc
- int $0x15
- data32
- jnc getmsz_da88
-
- movb $0x8A, %ah # Get memory size
- clc
- int $0x15
- data32
- jnc getmsz_8a
-
- movb $0x88, %ah # Get memory size
- clc
- int $0x15
- data32
- jnc getmsz_88
-
- xorl %edx, %edx # Error, cannot get memory size
- xorl %eax, %eax
-
-getmsz_done:
- data32
- addr32
- pushl %eax # Push EAX to 32-bit stack
-
- data32
- call __real_to_prot # Back to protected mode. EAX is modified.
-
- ##################################################################
- # Back to protected mode.
- ##################################################################
-
- popl %eax # Pop EAX from stack
- popl %ebx # Pop pointer to register structure
-
- # Copy the result to the input structure pointed to by a pointer
- # which is on top of the stack. Write register EAX and EDX to the
- # structure.
-
- movl %eax, O_EAX(%ebx)
- movl %edx, O_EDX(%ebx)
-
- popal # restore all registers
- leave # undo enter operator
- ret
-
-getmsz_88:
- orl %eax, %eax
- data32
- jz getmsz_64m
- xorl %edx, %edx
-
-getmsz_8a:
- data32
- movl $1024, %ebx # Add in 1M
- addl %ebx, %eax
- adcl $0, %edx
- data32
- jmp getmsz_done
-
-getmsz_64m:
- data32
- movl $1, %edx
- xorl %eax, %eax
- data32
- jmp getmsz_done
-
-getmsz_da88:
- xor %dh, %dh
- movb %cl, %dl
- movl %ebx, %eax
- data32
- jmp getmsz_8a
-
-getmsz_e801:
- xorl %edx, %edx
- orl %ebx, %ebx
- data32
- jz getmsz_88
-
- data32
- movl $64, %eax
- mul %ebx
-
- data32
- movl $16384, %ebx
- addl %ebx, %eax
- adcl $0, %edx
-
- data32
- jmp getmsz_done
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
* All rights reserved.
*/
+#include "bootstruct.h"
#include "libsaio.h"
+#define MAX_DRIVES 8
+
static biosBuf_t bb;
-unsigned char uses_ebios[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int bgetc(void)
{
return time.i;
}
-int memsize(int which)
+unsigned long getMemoryMap( MemoryRange * rangeArray,
+ unsigned long maxRangeCount,
+ unsigned long * conMemSizePtr,
+ unsigned long * extMemSizePtr )
{
- int size;
-
- if ( which )
+ #define kMemoryMapSignature 'SMAP'
+ #define kDescriptorSizeMin 20
+
+ MemoryRange * range = rangeArray;
+ unsigned long count = 0;
+ unsigned long long conMemSize = 0;
+ unsigned long long extMemTop = 0;
+
+ // The memory pointed by the rangeArray must reside within the
+ // first megabyte.
+ //
+ // Prepare for the INT15 E820h call. Each call returns a single
+ // memory range. A continuation value is returned that must be
+ // provided on a subsequent call to fetch the next range.
+ //
+ // Certain BIOSes (Award 6.00PG) expect the upper word in EAX
+ // to be cleared on entry, otherwise only a single range will
+ // be reported.
+ //
+ // Some BIOSes will simply ignore the value of ECX on entry.
+ // Probably best to keep its value at 20 to avoid surprises.
+
+ bb.ebx.rx = 0; // Initial continuation value must be zero.
+
+ while ( count < maxRangeCount )
{
- // Get the total system memory discovered by the
- // BIOS in kilobytes.
+ bb.intno = 0x15;
+ bb.eax.rx = 0xe820;
+ bb.ecx.rx = kDescriptorSizeMin;
+ bb.edx.rx = kMemoryMapSignature;
+ bb.edi.rr = OFFSET( (unsigned long) range );
+ bb.es = SEGMENT( (unsigned long) range );
+ bios(&bb);
- get_memsize(&bb);
- size = (bb.edx.rr << 16) | bb.eax.rr;
+ // Check for errors.
- // Convert to extended memory size.
+ if ( bb.flags.cf
+ || bb.eax.rx != kMemoryMapSignature
+ || bb.ecx.rx != kDescriptorSizeMin ) break;
- size = ( size > 1024 ) ? size - 1024 : 0;
- }
- else
- {
- // Get amount of conventional memory available.
+ // Tally up the conventional/extended memory sizes.
- bb.intno = 0x12;
- bios(&bb);
- size = bb.eax.rr;
+ if ( range->type == kMemoryRangeUsable ||
+ range->type == kMemoryRangeACPI ||
+ range->type == kMemoryRangeNVS )
+ {
+ // Tally the conventional memory ranges.
+ if ( range->base + range->length <= 0xa0000 )
+ conMemSize += range->length;
+
+ // Record the top of extended memory.
+ if ( range->base >= EXTENDED_ADDR &&
+ range->base >= extMemTop )
+ extMemTop = range->base + range->length;
+ }
+
+ range++;
+ count++;
+
+ // Is this the last address range?
+
+ if ( bb.ebx.rx == 0 ) break;
}
- return size;
+
+ if (extMemTop) extMemTop -= EXTENDED_ADDR; // convert to size
+ *conMemSizePtr = conMemSize / 1024; // size in KB
+ *extMemSizePtr = extMemTop / 1024; // size in KB
+
+ return count;
+}
+
+unsigned long getExtendedMemorySize()
+{
+ // Get extended memory size for large configurations. Not used unless
+ // the INT15, E820H call (Get System Address Map) failed.
+ //
+ // Input:
+ //
+ // AX Function Code E801h
+ //
+ // Outputs:
+ //
+ // CF Carry Flag Carry cleared indicates no error.
+ // AX Extended 1 Number of contiguous KB between 1 and 16 MB,
+ // maximum 0x3C00 = 15 MB.
+ // BX Extended 2 Number of contiguous 64 KB blocks between
+ // 16 MB and 4 GB.
+ // CX Configured 1 Number of contiguous KB between 1 and 16 MB,
+ // maximum 0x3C00 = 15 MB.
+ // DX Configured 2 Number of contiguous 64 KB blocks between
+ // 16 MB and 4 GB.
+
+ bb.intno = 0x15;
+ bb.eax.rx = 0xe801;
+ bios(&bb);
+
+ // Return the size of memory above 1MB (extended memory) in kilobytes.
+
+ if ( bb.flags.cf == 0 ) return (bb.ebx.rr * 64 + bb.eax.rr);
+
+ // Get Extended memory size. Called on last resort since the return
+ // value is limited to 16-bits (a little less than 64MB max). May
+ // not be supported by modern BIOSes.
+ //
+ // Input:
+ //
+ // AX Function Code E801h
+ //
+ // Outputs:
+ //
+ // CF Carry Flag Carry cleared indicates no error.
+ // AX Memory Count Number of contiguous KB above 1MB.
+
+ bb.intno = 0x15;
+ bb.eax.rx = 0x88;
+ bios(&bb);
+
+ // Return the size of memory above 1MB (extended memory) in kilobytes.
+
+ return bb.flags.cf ? 0 : bb.eax.rr;
+}
+
+unsigned long getConventionalMemorySize()
+{
+ bb.intno = 0x12;
+ bios(&bb);
+ return bb.eax.rr; // kilobytes
}
void video_mode(int mode)
bios(&bb);
}
-unsigned int get_diskinfo(int drive)
+/* Check to see if the passed-in drive is in El Torito no-emulation mode. */
+int is_no_emulation(int drive)
{
- static struct {
- unsigned short size;
- unsigned short flags;
- unsigned long cylinders;
- unsigned long heads;
- unsigned long sectors;
- unsigned long long total_sectors;
- unsigned short bps;
- unsigned long params_p;
- } ebios = {0};
- unsigned char useEbios = 0;
+ struct packet {
+ unsigned char packet_size;
+ unsigned char media_type;
+ unsigned char drive_num;
+ unsigned char ctrlr_index;
+ unsigned long lba;
+ unsigned short device_spec;
+ unsigned short buffer_segment;
+ unsigned short load_segment;
+ unsigned short sector_count;
+ unsigned char cyl_count;
+ unsigned char sec_count;
+ unsigned char head_count;
+ unsigned char reseved;
+ };
+ static struct packet pkt;
- union {
- compact_diskinfo_t di;
- unsigned int ui;
- } ret;
- static int maxhd = 0;
+ bzero(&pkt, sizeof(pkt));
+ pkt.packet_size = 0x13;
+
+ bb.intno = 0x13;
+ bb.eax.r.h = 0x4b;
+ bb.eax.r.l = 0x01; // subfunc: get info
+ bb.edx.r.l = drive;
+ bb.esi.rr = OFFSET((unsigned)&pkt);
+ bb.ds = SEGMENT((unsigned)&pkt);
+
+ bios(&bb);
+#if DEBUG
+ printf("el_torito info drive %x\n", drive);
+
+ printf("--> cf %x, eax %x\n", bb.flags.cf, bb.eax.rr);
- ret.ui = 0;
+ printf("pkt_size: %x\n", pkt.packet_size);
+ printf("media_type: %x\n", pkt.media_type);
+ printf("drive_num: %x\n", pkt.drive_num);
+ printf("device_spec: %x\n", pkt.device_spec);
+ printf("press a key->\n");getc();
+#endif
+
+ /* Some BIOSes erroneously return cf = 1 */
+ /* Just check to see if the drive number is the same. */
+ if (pkt.drive_num == drive) {
+ if ((pkt.media_type & 0x0F) == 0) {
+ /* We are in no-emulation mode. */
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+#if DEBUG
+/*
+ * BIOS drive information.
+ */
+void print_drive_info(boot_drive_info_t *dp)
+{
+ // printf("buf_size = %x\n", dp->params.buf_size);
+ printf("info_flags = %x\n", dp->params.info_flags);
+ printf(" phys_cyls = %lx\n", dp->params. phys_cyls);
+ printf(" phys_heads = %lx\n", dp->params. phys_heads);
+ printf(" phys_spt = %lx\n", dp->params. phys_spt);
+ printf("phys_sectors = %lx%lx\n", ((unsigned long *)(&dp->params.phys_sectors))[1],
+ ((unsigned long *)(&dp->params.phys_sectors))[0]);
+ printf("phys_nbps = %x\n", dp->params.phys_nbps);
+ // printf("dpte_offset = %x\n", dp->params.dpte_offset);
+ // printf("dpte_segment = %x\n", dp->params.dpte_segment);
+ // printf("key = %x\n", dp->params.key);
+ // printf("path_len = %x\n", dp->params. path_len);
+ // printf("reserved1 = %x\n", dp->params. reserved1);
+ // printf("reserved2 = %x\n", dp->params.reserved2);
+ //printf("bus_type[4] = %x\n", dp->params. bus_type[4]);
+ //printf("interface_type[8] = %x\n", dp->params. interface_type[8]);
+ //printf("interface_path[8] = %x\n", dp->params. interface_path[8]);
+ //printf("dev_path[8] = %x\n", dp->params. dev_path[8]);
+ // printf("reserved3 = %x\n", dp->params. reserved3);
+ // printf("checksum = %x\n", dp->params. checksum);
+
+ printf(" io_port_base = %x\n", dp->dpte.io_port_base);
+ printf(" control_port_base = %x\n", dp->dpte.control_port_base);
+ printf(" head_flags = %x\n", dp->dpte. head_flags);
+ printf(" vendor_info = %x\n", dp->dpte. vendor_info);
+ printf(" irq = %x\n", dp->dpte. irq);
+ // printf(" irq_unused = %x\n", dp->dpte. irq_unused);
+ printf(" block_count = %x\n", dp->dpte. block_count);
+ printf(" dma_channe = %x\n", dp->dpte. dma_channel);
+ printf(" dma_type = %x\n", dp->dpte. dma_type);
+ printf(" pio_type = %x\n", dp->dpte. pio_type);
+ printf(" pio_unused = %x\n", dp->dpte. pio_unused);
+ printf(" option_flags = %x\n", dp->dpte.option_flags);
+ // printf(" reserved = %x\n", dp->dpte.reserved);
+ printf(" revision = %x\n", dp->dpte. revision);
+ // printf(" checksum = %x\n", dp->dpte. checksum);
+}
+
+#endif
+
+int get_drive_info(int drive, struct driveInfo *dp)
+{
+ boot_drive_info_t *di = &dp->di;
+ int ret = 0;
+
+#if 0
if (maxhd == 0) {
bb.intno = 0x13;
bb.eax.r.h = 0x08;
if (drive > maxhd)
return 0;
+#endif
+
+ bzero(dp, sizeof(struct driveInfo));
+ dp->biosdev = drive;
+
+ /* Check for El Torito no-emulation mode. */
+ dp->no_emulation = is_no_emulation(drive);
/* Check drive for EBIOS support. */
bb.intno = 0x13;
bb.edx.r.l = drive;
bb.ebx.rr = 0x55aa;
bios(&bb);
- if(bb.ebx.rr == 0xaa55 && bb.flags.cf == 0) {
+ if((bb.ebx.rr == 0xaa55) && (bb.flags.cf == 0)) {
/* Get flags for supported operations. */
- useEbios = bb.ecx.r.l;
+ dp->uses_ebios = bb.ecx.r.l;
}
- if (useEbios & EBIOS_ENHANCED_DRIVE_INFO) {
+ if (dp->uses_ebios & (EBIOS_ENHANCED_DRIVE_INFO | EBIOS_LOCKING_ACCESS | EBIOS_FIXED_DISK_ACCESS)) {
/* Get EBIOS drive info. */
- ebios.size = 26;
+ static struct drive_params params;
+
+ params.buf_size = sizeof(params);
bb.intno = 0x13;
bb.eax.r.h = 0x48;
bb.edx.r.l = drive;
- bb.esi.rr = OFFSET((unsigned)&ebios);
- bb.ds = SEGMENT((unsigned)&ebios);
+ bb.esi.rr = OFFSET((unsigned)¶ms);
+ bb.ds = SEGMENT((unsigned)¶ms);
bios(&bb);
- if(bb.flags.cf != 0) {
- useEbios = 0;
- }
+ if(bb.flags.cf != 0 /* || params.phys_sectors < 2097152 */) {
+ dp->uses_ebios = 0;
+ di->params.buf_size = 1;
+ } else {
+ bcopy(¶ms, &di->params, sizeof(params));
+
+ if (drive >= BASE_HD_DRIVE &&
+ (dp->uses_ebios & EBIOS_ENHANCED_DRIVE_INFO) &&
+ di->params.buf_size >= 30 &&
+ !(di->params.dpte_offset == 0xFFFF && di->params.dpte_segment == 0xFFFF)) {
+ void *ptr = (void *)(di->params.dpte_offset + ((unsigned int)di->params.dpte_segment << 4));
+ bcopy(ptr, &di->dpte, sizeof(di->dpte));
+ }
+ }
}
- bb.intno = 0x13;
- bb.eax.r.h = 0x08;
- bb.edx.r.l = drive;
- bios(&bb);
- if (bb.flags.cf == 0 && bb.eax.r.h == 0) {
- unsigned long cyl;
- unsigned long sec;
- unsigned long hds;
-
- hds = bb.edx.r.h;
- sec = bb.ecx.r.l & 0x3F;
- if(useEbios & EBIOS_ENHANCED_DRIVE_INFO) {
- cyl = (ebios.total_sectors / ((hds + 1) * sec)) - 1;
- }
- else {
- cyl = bb.ecx.r.h | ((bb.ecx.r.l & 0xC0) << 2);
- }
- ret.di.heads = hds;
- ret.di.sectors = sec;
- ret.di.cylinders = cyl;
+ if (di->params.phys_heads == 0 || di->params.phys_spt == 0) {
+ /* Either it's not EBIOS, or EBIOS didn't tell us. */
+ bb.intno = 0x13;
+ bb.eax.r.h = 0x08;
+ bb.edx.r.l = drive;
+ bios(&bb);
+ if (bb.flags.cf == 0 && bb.eax.r.h == 0) {
+ unsigned long cyl;
+ unsigned long sec;
+ unsigned long hds;
+
+ hds = bb.edx.r.h;
+ sec = bb.ecx.r.l & 0x3F;
+ if((dp->uses_ebios & EBIOS_ENHANCED_DRIVE_INFO) && (sec != 0)) {
+ cyl = (di->params.phys_sectors / ((hds + 1) * sec)) - 1;
+ }
+ else {
+ cyl = bb.ecx.r.h | ((bb.ecx.r.l & 0xC0) << 2);
+ }
+ di->params.phys_heads = hds;
+ di->params.phys_spt = sec;
+ di->params.phys_cyls = cyl;
+ } else {
+ ret = -1;
+ }
+ }
+
+ if (dp->no_emulation) {
+ /* Some BIOSes give us erroneous EBIOS support information.
+ * Assume that if you're on a CD, then you can use
+ * EBIOS disk calls.
+ */
+ dp->uses_ebios |= EBIOS_FIXED_DISK_ACCESS;
+ }
+#if DEBUG
+ print_drive_info(di);
+ printf("uses_ebios = 0x%x\n", dp->uses_ebios);
+ printf("press a key->\n");getc();
+#endif
+
+ if (ret == 0) {
+ dp->valid = 1;
}
- if(drive >= 0x80) uses_ebios[drive - 0x80] = useEbios;
- return ret.ui;
+ return ret;
}
void setCursorPosition(int x, int y, int page)
int terminateDiskEmulation()
{
- static char cd_spec[0x12];
+ static char cd_spec[0x13];
bb.intno = 0x13;
bb.eax.r.h = 0x4b;
int
APMPresent(void)
{
- KERNBOOTSTRUCT *kbp = kernBootStruct;
-
bb.intno = APM_INTNO;
bb.eax.r.h = APM_INTCODE;
bb.eax.r.l = 0x00;
(bb.ebx.r.h == 'P') &&
(bb.ebx.r.l == 'M')) {
/* Success */
- kbp->apmConfig.major_vers = bb.eax.r.h;
- kbp->apmConfig.minor_vers = bb.eax.r.l;
- kbp->apmConfig.flags.data = bb.ecx.rr;
+ bootArgs->apmConfig.major_vers = bb.eax.r.h;
+ bootArgs->apmConfig.minor_vers = bb.eax.r.l;
+ bootArgs->apmConfig.flags.data = bb.ecx.rr;
return 1;
}
return 0;
int
APMConnect32(void)
{
- KERNBOOTSTRUCT *kbp = kernBootStruct;
-
bb.intno = APM_INTNO;
bb.eax.r.h = APM_INTCODE;
bb.eax.r.l = 0x03;
bios(&bb);
if (bb.flags.cf == 0) {
/* Success */
- kbp->apmConfig.cs32_base = (bb.eax.rr) << 4;
- kbp->apmConfig.entry_offset = bb.ebx.rx;
- kbp->apmConfig.cs16_base = (bb.ecx.rr) << 4;
- kbp->apmConfig.ds_base = (bb.edx.rr) << 4;
- if (kbp->apmConfig.major_vers >= 1 &&
- kbp->apmConfig.minor_vers >= 1) {
- kbp->apmConfig.cs_length = bb.esi.rr;
- kbp->apmConfig.ds_length = bb.edi.rr;
+ bootArgs->apmConfig.cs32_base = (bb.eax.rr) << 4;
+ bootArgs->apmConfig.entry_offset = bb.ebx.rx;
+ bootArgs->apmConfig.cs16_base = (bb.ecx.rr) << 4;
+ bootArgs->apmConfig.ds_base = (bb.edx.rr) << 4;
+ if (bootArgs->apmConfig.major_vers >= 1 &&
+ bootArgs->apmConfig.minor_vers >= 1) {
+ bootArgs->apmConfig.cs_length = bb.esi.rr;
+ bootArgs->apmConfig.ds_length = bb.edi.rr;
} else {
- kbp->apmConfig.cs_length =
- kbp->apmConfig.ds_length = 64 * 1024;
+ bootArgs->apmConfig.cs_length =
+ bootArgs->apmConfig.ds_length = 64 * 1024;
}
- kbp->apmConfig.connected = 1;
+ bootArgs->apmConfig.connected = 1;
return 1;
}
return 0;
}
return -1;
}
+
+void sleep(int n)
+{
+ unsigned int endtime = (time18() + 18*n);
+ while (time18() < endtime);
+}
+
+void delay(int ms)
+{
+ bb.intno = 0x15;
+ bb.eax.r.h = 0x86;
+ bb.ecx.rr = ms >> 16;
+ bb.edx.rr = ms & 0xFFFF;
+ bios(&bb);
+}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*/
#include "libsaio.h"
+#include "bootstruct.h"
// CMOS access ports in I/O space.
//
* the kernel by the booter.
*/
-KERNBOOTSTRUCT * kernBootStruct = (KERNBOOTSTRUCT *) KERNSTRUCT_ADDR;
+KernelBootArgs_t *bootArgs;
void initKernBootStruct( int biosdev )
{
static int init_done = 0;
- unsigned char i;
+
+ bootArgs = (KernelBootArgs_t *)KERNSTRUCT_ADDR;
if ( !init_done )
{
- bzero( (char *) kernBootStruct, sizeof(*kernBootStruct) );
-
- // Get size of conventional memory.
-
- kernBootStruct->convmem = memsize(0);
-
- // Get size of extended memory.
-
- kernBootStruct->extmem = memsize(1);
-
- kernBootStruct->magicCookie = KERNBOOTMAGIC;
- kernBootStruct->configEnd = kernBootStruct->config;
- kernBootStruct->graphicsMode = TEXT_MODE;
+ bzero(bootArgs, sizeof(KernelBootArgs_t));
+
+ // Get system memory map. Also update the size of the
+ // conventional/extended memory for backwards compatibility.
+
+ bootArgs->memoryMapCount =
+ getMemoryMap( bootArgs->memoryMap, kMemoryMapCountMax,
+ (unsigned long *) &bootArgs->convmem,
+ (unsigned long *) &bootArgs->extmem );
+
+ if ( bootArgs->memoryMapCount == 0 )
+ {
+ // BIOS did not provide a memory map, systems with
+ // discontiguous memory or unusual memory hole locations
+ // may have problems.
+
+ bootArgs->convmem = getConventionalMemorySize();
+ bootArgs->extmem = getExtendedMemorySize();
+ }
+
+ bootArgs->magicCookie = KERNBOOTMAGIC;
+ bootArgs->configEnd = bootArgs->config;
+ bootArgs->graphicsMode = TEXT_MODE;
+ /* New style */
+ /* XXX initialize bootArgs here */
+
init_done = 1;
}
// Get number of ATA devices.
- kernBootStruct->numIDEs = countIDEDisks();
+ bootArgs->numDrives = countIDEDisks();
- // Get disk info from BIOS.
+ // Update kernDev from biosdev.
- for ( i = 0; i < 4; i++ )
- {
- kernBootStruct->diskInfo[i] = get_diskinfo(0x80 + i);
- }
+ bootArgs->kernDev = biosdev;
+}
- // Update kernDev from biosdev.
- switch ( BIOS_DEV_TYPE( biosdev ) )
- {
- case kBIOSDevTypeNetwork:
- kernBootStruct->kernDev = B_TYPE(DEV_EN); break;
- case kBIOSDevTypeHardDrive:
- kernBootStruct->kernDev = B_TYPE(DEV_HD); break;
- case kBIOSDevTypeFloppy:
- kernBootStruct->kernDev = B_TYPE(DEV_FD); break;
- }
+/* Copy boot args after kernel and record address. */
+
+void
+reserveKernBootStruct(void)
+{
+ void *oldAddr = bootArgs;
+ bootArgs = (KernelBootArgs_t *)AllocateKernelMemory(sizeof(KERNBOOTSTRUCT));
+ bcopy(oldAddr, bootArgs, sizeof(KernelBootArgs_t));
}
+
--- /dev/null
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <pexpert/i386/boot.h>
+
+extern KernelBootArgs_t *bootArgs;
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * 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.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
static char gCacheBuffer[kCacheSize];
#endif
+#if CACHE_STATS
unsigned long gCacheHits;
unsigned long gCacheMisses;
unsigned long gCacheEvicts;
+#endif
void CacheInit( CICell ih, long blockSize )
{
gCacheNumEntries = kCacheSize / gCacheBlockSize;
gCacheTime = 0;
+#if CACHE_STATS
gCacheHits = 0;
gCacheMisses = 0;
gCacheEvicts = 0;
+#endif
gCacheIH = ih;
// If the data was found copy it to the caller.
if (cnt != gCacheNumEntries) {
bcopy(gCacheBuffer + cnt * gCacheBlockSize, buffer, gCacheBlockSize);
+#if CACHE_STATS
gCacheHits++;
+#endif
return gCacheBlockSize;
}
// Read the data from the disk.
Seek(ih, offset);
Read(ih, (long)buffer, length);
+#if CACHE_STATS
if (cache) gCacheMisses++;
+#endif
// Put the data from the disk in the cache if needed.
if (loadCache) {
// If no free entry was found, use the oldest.
if (cnt == gCacheNumEntries) {
cnt = oldestEntry;
+#if CACHE_STATS
gCacheEvicts++;
+#endif
}
// Copy the data from disk to the new entry.
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
va_end(ap);
return(0);
}
+
+void stop(const char * msg)
+{
+ error("\n%s\n", msg);
+ halt();
+}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
* All rights reserved.
*/
+#include "bootstruct.h"
#include "libsaio.h"
#include "fdisk.h"
+#include "ufs.h"
+#include "hfs.h"
-/*
- * diskinfo unpacking.
- */
-#define SPT(di) ((di) & 0xff)
-#define HEADS(di) ((((di)>>8) & 0xff) + 1)
-#define SPC(di) (SPT(di) * HEADS(di))
+#include <limits.h>
+#include <IOKit/storage/IOApplePartitionScheme.h>
#define BPS 512 /* sector size of the device */
-#define N_CACHE_SECS (BIOS_LEN / BPS)
+#define CD_BPS 2048 /* CD-ROM block size */
+#define N_CACHE_SECS (BIOS_LEN / BPS) /* Must be a multiple of 4 for CD-ROMs */
#define UFS_FRONT_PORCH 0
+#define kAPMSector 2 /* Sector number of Apple partition map */
+#define kAPMCDSector 8 /* Translated sector of Apple partition map on a CD */
/*
* trackbuf points to the start of the track cache. Biosread()
static struct DiskBVMap * gDiskBVMap = NULL;
static struct disk_blk0 * gBootSector = NULL;
-extern long HFSInitPartition(CICell ih);
-extern long HFSLoadFile(CICell ih, char * filePath);
-extern long HFSGetDirEntry(CICell ih, char * dirPath, long * dirIndex,
- char ** name, long * flags, long * time);
-
-extern long UFSInitPartition(CICell ih);
-extern long UFSLoadFile(CICell ih, char * filePath);
-extern long UFSGetDirEntry(CICell ih, char * dirPath, long * dirIndex,
- char ** name, long * flags, long * time);
-
extern void spinActivityIndicator();
static void getVolumeDescription(BVRef bvr, char * str, long strMaxLen);
//==========================================================================
-static int getDiskGeometry( int biosdev, int * spt, int * spc )
+static int getDriveInfo( int biosdev, struct driveInfo *dip )
{
- static int cached_biosdev = -1;
- static int cached_spt = 0;
- static int cached_spc = 0;
+ static struct driveInfo cached_di;
+ int cc;
- if ( biosdev != cached_biosdev )
+ if ( !cached_di.valid || biosdev != cached_di.biosdev )
{
- long di = get_diskinfo(biosdev);
- if (di == 0) return (-1); // BIOS call error
-
- cached_spt = SPT(di);
- cached_spc = cached_spt * HEADS(di);
-
- DEBUG_DISK(("%s: %d sectors, %d heads\n",
- __FUNCTION__, cached_spt, (int)HEADS(di)));
+ cc = get_drive_info(biosdev, &cached_di);
+ if (cc < 0) {
+ cached_di.valid = 0;
+ return (-1); // BIOS call error
+ }
}
- *spt = cached_spt;
- *spc = cached_spc;
+ bcopy(&cached_di, dip, sizeof(cached_di));
return 0;
}
static int xbiosdev, xcyl, xhead;
static unsigned int xsec, xnsecs;
static BOOL cache_valid = FALSE;
+ struct driveInfo di;
int rc = -1;
int cyl, head, sec;
- int spt, spc;
int tries = 0;
+ int bps, divisor;
- // DEBUG_DISK(("Biosread dev %x sec %d \n", biosdev, secno));
+ if (getDriveInfo(biosdev, &di) < 0) {
+ return -1;
+ }
+ if (di.no_emulation) {
+ /* Always assume 2k block size; BIOS may lie about geometry */
+ bps = 2048;
+ } else {
+ bps = di.di.params.phys_nbps;
+ }
+ divisor = bps / BPS;
+
+ DEBUG_DISK(("Biosread dev %x sec %d bps %d\n", biosdev, secno, bps));
// To read the disk sectors, use EBIOS if we can. Otherwise,
// revert to the standard BIOS calls.
if ((biosdev >= kBIOSDevTypeHardDrive) &&
- (uses_ebios[biosdev - kBIOSDevTypeHardDrive] & EBIOS_FIXED_DISK_ACCESS))
+ (di.uses_ebios & EBIOS_FIXED_DISK_ACCESS))
{
if (cache_valid &&
(biosdev == xbiosdev) &&
(secno >= xsec) &&
- (secno < (xsec + xnsecs)))
+ ((unsigned int)secno < (xsec + xnsecs)))
{
biosbuf = trackbuf + (BPS * (secno - xsec));
return 0;
}
xnsecs = N_CACHE_SECS;
- xsec = secno;
+ xsec = (secno / divisor) * divisor;
cache_valid = FALSE;
- while ((rc = ebiosread(biosdev, secno, xnsecs)) && (++tries < 5))
+ while ((rc = ebiosread(biosdev, secno / divisor, xnsecs / divisor)) && (++tries < 5))
{
if (rc == ECC_CORRECTED_ERR) {
/* Ignore corrected ECC errors */
sleep(1);
}
}
- else if ( getDiskGeometry(biosdev, &spt, &spc) == 0 )
+ else
{
+ /* spc = spt * heads */
+ int spc = (di.di.params.phys_spt * di.di.params.phys_heads);
cyl = secno / spc;
- head = (secno % spc) / spt;
- sec = secno % spt;
+ head = (secno % spc) / di.di.params.phys_spt;
+ sec = secno % di.di.params.phys_spt;
if (cache_valid &&
(biosdev == xbiosdev) &&
(cyl == xcyl) &&
(head == xhead) &&
- (sec >= xsec) &&
- (sec < (xsec + xnsecs)))
+ ((unsigned int)sec >= xsec) &&
+ ((unsigned int)sec < (xsec + xnsecs)))
{
// this sector is in trackbuf cache
biosbuf = trackbuf + (BPS * (sec - xsec));
xcyl = cyl;
xhead = head;
xsec = sec;
- xnsecs = ((sec + N_CACHE_SECS) > spt) ? (spt - sec) : N_CACHE_SECS;
+ xnsecs = ((unsigned int)(sec + N_CACHE_SECS) > di.di.params.phys_spt) ? (di.di.params.phys_spt - sec) : N_CACHE_SECS;
cache_valid = FALSE;
while ((rc = biosread(biosdev, cyl, head, sec, xnsecs)) &&
if (rc == 0) {
cache_valid = TRUE;
}
- biosbuf = trackbuf;
+ biosbuf = trackbuf + (secno % divisor) * BPS;
xbiosdev = biosdev;
spinActivityIndicator();
0x85, /* Linux extended */
};
- int i;
+ unsigned int i;
for (i = 0; i < sizeof(extParts)/sizeof(extParts[0]); i++)
{
part->relsect += sExtBase;
*outPart = part;
- *partno = sExtDepth ? (sExtDepth + 4) : sNextPartNo;
+ *partno = sExtDepth ? (int)(sExtDepth + 4) : sNextPartNo;
break;
}
static BVRef newFDiskBVRef( int biosdev, int partno, unsigned int blkoff,
const struct fdisk_part * part,
FSInit initFunc, FSLoadFile loadFunc,
- FSGetDirEntry getdirFunc, int probe )
+ FSGetDirEntry getdirFunc, int probe, int type )
{
BVRef bvr = (BVRef) malloc( sizeof(*bvr) );
if ( bvr )
bvr->fs_loadfile = loadFunc;
bvr->fs_getdirentry = getdirFunc;
bvr->description = getVolumeDescription;
+ bvr->type = type;
if ( part->bootid & FDISK_ACTIVE )
bvr->flags |= kBVFlagPrimary;
//==========================================================================
-BVRef diskScanBootVolumes( int biosdev, int * countPtr )
+BVRef newAPMBVRef( int biosdev, int partno, unsigned int blkoff,
+ const DPME * part,
+ FSInit initFunc, FSLoadFile loadFunc,
+ FSGetDirEntry getdirFunc, int probe, int type )
+{
+ BVRef bvr = (BVRef) malloc( sizeof(*bvr) );
+ if ( bvr )
+ {
+ bzero(bvr, sizeof(*bvr));
+
+ bvr->biosdev = biosdev;
+ bvr->part_no = partno;
+ bvr->part_boff = blkoff;
+ bvr->fs_loadfile = loadFunc;
+ bvr->fs_getdirentry = getdirFunc;
+ bvr->description = getVolumeDescription;
+ bvr->type = type;
+ strlcpy(bvr->name, part->dpme_name, DPISTRLEN);
+ strlcpy(bvr->type_name, part->dpme_type, DPISTRLEN);
+
+ /*
+ if ( part->bootid & FDISK_ACTIVE )
+ bvr->flags |= kBVFlagPrimary;
+ */
+
+ // Probe the filesystem.
+
+ if ( initFunc )
+ {
+ bvr->flags |= kBVFlagNativeBoot;
+
+ if ( probe && initFunc( bvr ) != 0 )
+ {
+ // filesystem probe failed.
+
+ DEBUG_DISK(("%s: failed probe on dev %x part %d\n",
+ __FUNCTION__, biosdev, partno));
+
+ free(bvr);
+ bvr = NULL;
+ }
+ }
+ /*
+ else if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 )
+ {
+ bvr->flags |= kBVFlagForeignBoot;
+ }
+ */
+ else
+ {
+ free(bvr);
+ bvr = NULL;
+ }
+ }
+ return bvr;
+}
+
+//==========================================================================
+
+static BVRef diskScanFDiskBootVolumes( int biosdev, int * countPtr )
{
const struct fdisk_part * part;
struct DiskBVMap * map;
int partno = -1;
BVRef bvr;
BVRef booterUFS = NULL;
- int spc, spt;
-
- do {
- // Find an existing mapping for this device.
+ int spc;
+ struct driveInfo di;
+ boot_drive_info_t *dp;
- for ( map = gDiskBVMap; map; map = map->next )
- {
- if ( biosdev == map->biosdev ) break;
- }
- if ( map ) break;
+ /* Initialize disk info */
+ if (getDriveInfo(biosdev, &di) != 0) {
+ return NULL;
+ }
+ dp = &di.di;
+ spc = (dp->params.phys_spt * dp->params.phys_heads);
+ if (spc == 0) {
+ /* This is probably a CD-ROM; punt on the geometry. */
+ spc = 1;
+ }
+ do {
// Create a new mapping.
map = (struct DiskBVMap *) malloc( sizeof(*map) );
{
DEBUG_DISK(("%s: part %d [%x]\n", __FUNCTION__,
partno, part->systid));
-
bvr = 0;
switch ( part->systid )
{
case FDISK_UFS:
- bvr = newFDiskBVRef(
+ bvr = newFDiskBVRef(
biosdev, partno,
part->relsect + UFS_FRONT_PORCH/BPS,
part,
UFSInitPartition,
UFSLoadFile,
UFSGetDirEntry,
- 0 );
+ 0,
+ kBIOSDevTypeHardDrive);
break;
case FDISK_HFS:
HFSInitPartition,
HFSLoadFile,
HFSGetDirEntry,
- 0 );
+ 0,
+ kBIOSDevTypeHardDrive);
break;
case FDISK_BOOTER:
- if (getDiskGeometry(biosdev, &spt, &spc) != 0)
- break;
-
booterUFS = newFDiskBVRef(
biosdev, partno,
((part->relsect + spc - 1) / spc) * spc,
UFSInitPartition,
UFSLoadFile,
UFSGetDirEntry,
- 0 );
+ 0,
+ kBIOSDevTypeHardDrive);
break;
default:
biosdev, partno,
part->relsect,
part,
- 0, 0, 0, 0 );
+ 0, 0, 0, 0,
+ kBIOSDevTypeHardDrive);
break;
}
}
} while (0);
+ /*
+ * If no FDisk partition, then we will check for
+ * an Apple partition map elsewhere.
+ */
+#if 0
+ if (map->bvrcnt == 0) {
+ static struct fdisk_part cdpart;
+ cdpart.systid = 0xCD;
+
+ /* Let's try assuming we are on a hybrid HFS/ISO9660 CD. */
+ bvr = newFDiskBVRef(
+ biosdev, 0,
+ 0,
+ &cdpart,
+ HFSInitPartition,
+ HFSLoadFile,
+ HFSGetDirEntry,
+ 0,
+ kBIOSDevTypeHardDrive);
+ bvr->next = map->bvr;
+ map->bvr = bvr;
+ map->bvrcnt++;
+ }
+#endif
+
if (countPtr) *countPtr = map ? map->bvrcnt : 0;
return map ? map->bvr : NULL;
}
+//==========================================================================
+
+static BVRef diskScanAPMBootVolumes( int biosdev, int * countPtr )
+{
+ struct DiskBVMap * map;
+ struct Block0 *block0_p;
+ unsigned int blksize;
+ unsigned int factor;
+ void *buffer = malloc(BPS);
+
+ /* Check for alternate block size */
+ if (readBytes( biosdev, 0, BPS, buffer ) != 0) {
+ return NULL;
+ }
+ block0_p = buffer;
+ if (NXSwapBigShortToHost(block0_p->sbSig) == BLOCK0_SIGNATURE) {
+ blksize = NXSwapBigShortToHost(block0_p->sbBlkSize);
+ if (blksize != BPS) {
+ free(buffer);
+ buffer = malloc(blksize);
+ }
+ factor = blksize / BPS;
+ } else {
+ blksize = BPS;
+ factor = 1;
+ }
+
+ do {
+ // Create a new mapping.
+
+ map = (struct DiskBVMap *) malloc( sizeof(*map) );
+ if ( map )
+ {
+ int error;
+ DPME *dpme_p = (DPME *)buffer;
+ UInt32 i, npart = UINT_MAX;
+ BVRef bvr;
+
+ map->biosdev = biosdev;
+ map->bvr = NULL;
+ map->bvrcnt = 0;
+ map->next = gDiskBVMap;
+ gDiskBVMap = map;
+
+ for (i=0; i<npart; i++) {
+ error = readBytes( biosdev, (kAPMSector + i) * factor, blksize, buffer );
+
+ if (error || NXSwapBigShortToHost(dpme_p->dpme_signature) != DPME_SIGNATURE) {
+ break;
+ }
+
+ if (i==0) {
+ npart = NXSwapBigLongToHost(dpme_p->dpme_map_entries);
+ }
+ /*
+ printf("name = %s, %s%s %d -> %d [%d -> %d] {%d}\n",
+ dpme.dpme_name, dpme.dpme_type, (dpme.dpme_flags & DPME_FLAGS_BOOTABLE) ? "(bootable)" : "",
+ dpme.dpme_pblock_start, dpme.dpme_pblocks,
+ dpme.dpme_lblock_start, dpme.dpme_lblocks,
+ dpme.dpme_boot_block);
+ */
+
+ if (strcmp(dpme_p->dpme_type, "Apple_HFS") == 0) {
+ bvr = newAPMBVRef(biosdev,
+ i,
+ NXSwapBigLongToHost(dpme_p->dpme_pblock_start) * factor,
+ dpme_p,
+ HFSInitPartition,
+ HFSLoadFile,
+ HFSGetDirEntry,
+ 0,
+ kBIOSDevTypeHardDrive);
+ bvr->next = map->bvr;
+ map->bvr = bvr;
+ map->bvrcnt++;
+ }
+ }
+ }
+ } while (0);
+
+ free(buffer);
+
+ if (countPtr) *countPtr = map ? map->bvrcnt : 0;
+
+ return map ? map->bvr : NULL;
+}
+
+//==========================================================================
+
+BVRef diskScanBootVolumes( int biosdev, int * countPtr )
+{
+ struct DiskBVMap * map;
+ BVRef bvr;
+ int count = 0;
+
+ // Find an existing mapping for this device.
+
+ for ( map = gDiskBVMap; map; map = map->next ) {
+ if ( biosdev == map->biosdev ) {
+ count = map->bvrcnt;
+ break;
+ }
+ }
+
+ if (map == NULL) {
+ bvr = diskScanFDiskBootVolumes(biosdev, &count);
+ if (bvr == NULL) {
+ bvr = diskScanAPMBootVolumes(biosdev, &count);
+ }
+ } else {
+ bvr = map->bvr;
+ }
+ if (countPtr) *countPtr = count;
+ return bvr;
+}
+
+
//==========================================================================
static const struct NamedValue fdiskTypes[] =
{ FDISK_UFS, "Apple UFS" },
{ FDISK_HFS, "Apple HFS" },
{ FDISK_BOOTER, "Apple Boot/UFS" },
+ { 0xCD, "CD-ROM" },
{ 0x00, 0 } /* must be last */
};
unsigned char type = (unsigned char) bvr->part_type;
const char * name = getNameForValue( fdiskTypes, type );
+ if (name == NULL)
+ name = bvr->type_name;
+
if ( name )
sprintf( str, "hd(%d,%d) %s",
- BIOS_DEV_UNIT(bvr->biosdev), bvr->part_no, name );
+ BIOS_DEV_UNIT(bvr), bvr->part_no, name );
else
sprintf( str, "hd(%d,%d) TYPE %02x",
- BIOS_DEV_UNIT(bvr->biosdev), bvr->part_no, type );
+ BIOS_DEV_UNIT(bvr), bvr->part_no, type );
}
+
//==========================================================================
int readBootSector( int biosdev, unsigned int secno, void * buffer )
length,
(void *) addr );
}
+
+void turnOffFloppy(void)
+{
+ /*
+ * Disable floppy:
+ * Hold controller in reset,
+ * disable DMA and IRQ,
+ * turn off floppy motors.
+ */
+ outb(0x3F2, 0x00);
+}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * 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.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <sl.h>
#include <hfs/hfs_format.h>
+#include "hfs.h"
+
#define kBlockSize (0x200)
#define kMDBBaseOffset (2 * kBlockSize)
return 0;
}
- verbose("HFSInitPartition: %x\n", ih);
-
#ifdef __i386__
if (!gTempStr) gTempStr = (char *)malloc(4096);
if (!gLinkTemp) gLinkTemp = (char *)malloc(64);
Read(ih, (long)gHFSPlusHeader, kBlockSize);
// Not a HFS[+] volume.
- if (SWAP_BE16(gHFSPlus->signature) != kHFSPlusSigWord) return -1;
+ if (SWAP_BE16(gHFSPlus->signature) != kHFSPlusSigWord) {
+ verbose("HFS signature was not present.\n");
+ return -1;
+ }
gIsHFSPlus = 1;
gCacheBlockSize = gBlockSize = SWAP_BE32(gHFSPlus->blockSize);
char entry[512];
long dirID, result, length, flags;
- if (HFSInitPartition(ih) == -1) return -1;
-
verbose("Loading HFS%s file: [%s] from %x.\n",
(gIsHFSPlus ? "+" : ""), filePath, ih);
+ if (HFSInitPartition(ih) == -1) return -1;
+
dirID = kHFSRootFolderID;
// Skip a lead '\'. Start in the system folder if there are two.
if (filePath[0] == '/') {
if (filePath[1] == '/') {
if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]);
else dirID = SWAP_BE32(gHFSMDB->drFndrInfo[5]);
- if (dirID == 0) return -1;
+ if (dirID == 0) {
+ return -1;
+ }
filePath++;
}
filePath++;
}
result = ResolvePathToCatalogEntry(filePath, &flags, entry, dirID, 0);
- if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) return -1;
+ if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) {
+ return -1;
+ }
#if 0 // Not yet for Intel. System.config/Default.table will fail this check.
// Check file owner and permissions.
#endif
result = ReadFile(entry, &length);
- if (result == -1) return -1;
+ if (result == -1) {
+ return -1;
+ }
return length;
}
// Copy the file name to gTempStr
cnt = 0;
while ((filePath[cnt] != '/') && (filePath[cnt] != '\0')) cnt++;
- strncpy(gTempStr, filePath, cnt);
+ strlcpy(gTempStr, filePath, cnt+1);
// Move restPath to the right place.
if (filePath[cnt] != '\0') cnt++;
// restPath is the rest of the path if any.
result = ReadCatalogEntry(gTempStr, dirID, entry, dirIndex);
- if (result == -1) return -1;
+ if (result == -1) {
+ return -1;
+ }
GetCatalogEntryInfo(entry, flags, 0);
--- /dev/null
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+extern long HFSInitPartition(CICell ih);
+extern long HFSLoadFile(CICell ih, char * filePath);
+extern long HFSGetDirEntry(CICell ih, char * dirPath, long * dirIndex,
+ char ** name, long * flags, long * time);
+
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * 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.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * 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.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include "libsa.h"
#include "memory.h"
-#include "kernBootStruct.h"
#include "io_inline.h"
#include "saio_types.h"
#include "saio_internal.h"
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003 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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
- * Copyright 1993 NeXT Computer, Inc.
- * All rights reserved.
+ * load.c - Functions for decoding a Mach-o Kernel.
+ *
+ * Copyright (c) 1998-2003 Apple Computer, Inc.
+ *
*/
-#include "libsaio.h"
-#include "rcz_common.h"
-#include "rcz_decompress_file.h"
#include <mach-o/fat.h>
+#include <mach-o/loader.h>
+#include <mach/machine/thread_status.h>
-static int devMajor[3] = { 6, 3, 1 }; // sd, hd, fd major dev #'s
+#include <sl.h>
-static int xread(int fd, char * addr, int size);
-static int loadmacho(struct mach_header * head, int dev, int io,
- entry_t * rentry, char ** raddr, int * rsize,
- int file_offset);
+static long DecodeSegment(long cmdBase, unsigned int*load_addr, unsigned int *load_size);
+static long DecodeUnixThread(long cmdBase, unsigned int *entry);
-//==========================================================================
-// Open a file for reading. If the file doesn't exist,
-// try opening the compressed version.
-#ifdef RCZ_COMPRESSED_FILE_SUPPORT
-int openfile(const char * filename, int ignored)
-{
- unsigned char *buf;
- int fd, size, ret;
- unsigned char *addr;
+static unsigned long gBinaryAddress;
+BOOL gHaveKernelCache;
- if ((fd = open(filename, 0)) < 0) {
- buf = malloc(256);
- sprintf(buf, "%s%s", filename, RCZ_EXTENSION);
- if ((fd = open(buf, 0)) >= 0) {
- size = rcz_file_size(fd);
- addr = (unsigned char *)((KERNEL_ADDR + KERNEL_LEN) - size);
- ret = rcz_decompress_file(fd, addr);
- close(fd);
- if (ret < 0)
- fd = -1;
- else
- fd = openmem(addr, size);
- }
- free(buf);
- }
- return fd;
-}
-#else
-int openfile(char * filename, int ignored)
-{
- return open(filename, 0);
-}
-#endif
+// Public Functions
-//==========================================================================
-// loadprog
-
-int loadprog( int dev, int fd, struct mach_header * headOut,
- entry_t * entry, /* entry point */
- char ** addr, /* load address */
- int * size ) /* size of loaded program */
+long ThinFatFile(void **binary, unsigned long *length)
{
- struct mach_header head;
- int file_offset = 0;
-
-read_again:
-
- /* get file header */
- read(fd, (char *) &head, sizeof(head));
-
- if ( headOut )
- bcopy((char *) &head, (char *) headOut, sizeof(head));
-
- if ( head.magic == MH_MAGIC )
- {
- return loadmacho(&head, dev, fd, entry, addr, size, file_offset);
+ unsigned long nfat, swapped, size = 0;
+ struct fat_header *fhp = (struct fat_header *)*binary;
+ struct fat_arch *fap =
+ (struct fat_arch *)((unsigned long)*binary + sizeof(struct fat_header));
+
+ if (fhp->magic == FAT_MAGIC) {
+ nfat = fhp->nfat_arch;
+ swapped = 0;
+ } else if (fhp->magic == FAT_CIGAM) {
+ nfat = NXSwapInt(fhp->nfat_arch);
+ swapped = 1;
+ } else {
+ return -1;
+ }
+
+ for (; nfat > 0; nfat--, fap++) {
+ if (swapped) {
+ fap->cputype = NXSwapInt(fap->cputype);
+ fap->offset = NXSwapInt(fap->offset);
+ fap->size = NXSwapInt(fap->size);
}
- else if ( file_offset == 0 &&
- ((head.magic == FAT_CIGAM) || (head.magic == FAT_MAGIC)) )
- {
- int swap = (head.magic == FAT_CIGAM) ? 1 : 0;
- struct fat_header * fhp = (struct fat_header *) &head;
- struct fat_arch * fap;
- int i, narch = swap ? NXSwapLong(fhp->nfat_arch) : fhp->nfat_arch;
- int cpu, size;
- char * buf;
-
- size = sizeof(struct fat_arch) * narch;
- buf = malloc(size);
- b_lseek(fd, 0, 0);
- read(fd, buf, size);
- for ( i = 0, fap = (struct fat_arch *)(buf+sizeof(struct fat_header));
- i < narch;
- i++, fap++ )
- {
- cpu = swap ? NXSwapLong(fap->cputype) : fap->cputype;
- if (cpu == CPU_TYPE_I386)
- {
- /* that's specific enough */
- free(buf);
- file_offset = swap ? NXSwapLong(fap->offset) : fap->offset;
- b_lseek(fd, file_offset, 0);
- goto read_again;
- }
- }
- free(buf);
- error("Fat binary file doesn't contain i386 code\n");
- return -1;
+ if (fap->cputype == CPU_TYPE_I386) {
+ *binary = (void *) ((unsigned long)*binary + fap->offset);
+ size = fap->size;
+ break;
}
- error("Unrecognized binary format: %08x\n", head.magic);
- return -1;
+ }
+
+ if (length != 0) *length = size;
+
+ return 0;
}
-//==========================================================================
-// xread
-//
-// Read from file descriptor. addr is a physical address.
-
-static int xread( int fd, char * addr, int size )
+long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize)
{
- char * orgaddr = addr;
- long offset;
- unsigned count;
- long max;
-#define BUFSIZ 8192
- char * buf;
- int bufsize = BUFSIZ;
-
-#if 0
- printf("xread: addr=%x, size=%x\n", addr, size);
- sleep(1);
-#endif
-
- buf = malloc(BUFSIZ);
-
- // align your read to increase speed
- offset = tell(fd) & 4095;
- if ( offset != 0 )
- max = 4096 - offset;
- else
- max = bufsize;
-
- while ( size > 0 )
- {
- if ( size > max ) count = max;
- else count = size;
-#if 0
- printf("xread: loop size=%x, count=%x\n", size, count);
- sleep(1);
+ struct mach_header *mH;
+ unsigned long ncmds, cmdBase, cmd, cmdsize;
+ // long headerBase, headerAddr, headerSize;
+ unsigned int vmaddr = ~0;
+ unsigned int vmend = 0;
+ unsigned long cnt;
+ long ret = -1;
+ unsigned int entry;
+
+ gBinaryAddress = (unsigned long)binary;
+
+ // headerBase = gBinaryAddress;
+ cmdBase = (unsigned long)gBinaryAddress + sizeof(struct mach_header);
+
+ mH = (struct mach_header *)(gBinaryAddress);
+ if (mH->magic != MH_MAGIC) {
+ error("Mach-O file has bad magic number\n");
+ return -1;
+ }
+
+#if NOTDEF
+ printf("magic: %x\n", (unsigned)mH->magic);
+ printf("cputype: %x\n", (unsigned)mH->cputype);
+ printf("cpusubtype: %x\n", (unsigned)mH->cpusubtype);
+ printf("filetype: %x\n", (unsigned)mH->filetype);
+ printf("ncmds: %x\n", (unsigned)mH->ncmds);
+ printf("sizeofcmds: %x\n", (unsigned)mH->sizeofcmds);
+ printf("flags: %x\n", (unsigned)mH->flags);
+ getc();
#endif
-
- if ( read(fd, buf, count) != count) break;
-
- bcopy(buf, ptov(addr), count);
- size -= count;
- addr += count;
-
- max = bufsize;
-
-#if 0
- tick += count;
- if ( tick > (50*1024) )
- {
- putchar('+');
- tick = 0;
- }
+
+ ncmds = mH->ncmds;
+
+ for (cnt = 0; cnt < ncmds; cnt++) {
+ cmd = ((long *)cmdBase)[0];
+ cmdsize = ((long *)cmdBase)[1];
+ unsigned int load_addr;
+ unsigned int load_size;
+
+ switch (cmd) {
+
+ case LC_SEGMENT:
+ ret = DecodeSegment(cmdBase, &load_addr, &load_size);
+ if (ret == 0 && load_size != 0) {
+ vmaddr = min(vmaddr, load_addr);
+ vmend = max(vmend, load_addr + load_size);
+ }
+ break;
+
+ case LC_UNIXTHREAD:
+ ret = DecodeUnixThread(cmdBase, &entry);
+ break;
+
+ default:
+#if NOTDEF
+ printf("Ignoring cmd type %d.\n", (unsigned)cmd);
#endif
+ break;
}
-
- free(buf);
- return addr-orgaddr;
+
+ if (ret != 0) return -1;
+
+ cmdBase += cmdsize;
+ }
+
+ *rentry = (entry_t)( (unsigned long) entry & 0x3fffffff );
+ *rsize = vmend - vmaddr;
+ *raddr = (char *)vmaddr;
+
+ return ret;
}
-//==========================================================================
-// loadmacho
+// Private Functions
-static int loadmacho( struct mach_header * head, int dev, int io,
- entry_t * rentry, char ** raddr, int * rsize,
- int file_offset )
+static long DecodeSegment(long cmdBase, unsigned int *load_addr, unsigned int *load_size)
{
- int ncmds;
- void * cmds;
- void * cp;
- unsigned int entry = 0;
- int vmsize = 0;
- unsigned int vmaddr = ~0;
- unsigned int vmend = 0;
-
- struct xxx_thread_command {
- unsigned long cmd;
- unsigned long cmdsize;
- unsigned long flavor;
- unsigned long count;
- i386_thread_state_t state;
- } * th;
-
- // XXX should check cputype
- cmds = malloc(head->sizeofcmds);
- b_lseek(io, sizeof(struct mach_header) + file_offset, 0);
-
- if ( read(io, (char *) cmds, head->sizeofcmds) != head->sizeofcmds )
- {
- error("loadmacho: error reading commands\n");
- goto shread;
- }
-
- for ( ncmds = head->ncmds, cp = cmds; ncmds > 0; ncmds-- )
- {
- unsigned int addr;
-
-#define lcp ((struct load_command *) cp)
-#define scp ((struct segment_command *) cp)
-
- switch ( lcp->cmd )
- {
- case LC_SEGMENT:
- addr = (scp->vmaddr & 0x3fffffff) + (int)*raddr;
- if ( scp->filesize )
- {
- vmsize += scp->vmsize;
- vmaddr = min(vmaddr, addr);
- vmend = max(vmend, addr + scp->vmsize);
-
- // Zero any space at the end of the segment.
-
- bzero((char *)(addr + scp->filesize),
- scp->vmsize - scp->filesize);
-
- // FIXME: check to see if we overflow
- // the available space (should be passed in
- // as the size argument).
+ struct segment_command *segCmd;
+ unsigned long vmaddr, fileaddr;
+ long vmsize, filesize;
-#if 0
- printf("LC: fileoff %x, filesize %x, off %x, addr %x\n",
- scp->fileoff, scp->filesize, file_offset, addr);
- sleep(1);
+ segCmd = (struct segment_command *)cmdBase;
+
+ vmaddr = (segCmd->vmaddr & 0x3fffffff);
+ vmsize = segCmd->vmsize;
+
+ fileaddr = (gBinaryAddress + segCmd->fileoff);
+ filesize = segCmd->filesize;
+
+ if (filesize == 0) {
+ *load_addr = ~0;
+ *load_size = 0;
+ return 0;
+ }
+
+#if NOTDEF
+ printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
+ segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
+ (unsigned) segCmd->nsects, (unsigned)segCmd->flags);
+ getc();
#endif
+
+ if (vmaddr < KERNEL_ADDR ||
+ (vmaddr + vmsize) > (KERNEL_ADDR + KERNEL_LEN)) {
+ stop("Kernel overflows available space");
+ }
+
+ if (vmsize && (strcmp(segCmd->segname, "__PRELINK") == 0)) {
+ gHaveKernelCache = 1;
+ }
+
+ // Copy from file load area.
+ bcopy((char *)fileaddr, (char *)vmaddr, filesize);
+
+ // Zero space at the end of the segment.
+ bzero((char *)(vmaddr + filesize), vmsize - filesize);
- b_lseek(io, scp->fileoff + file_offset, 0);
- if ( xread(io, (char *)addr, scp->filesize)
- != scp->filesize)
- {
- error("loadmacho: error loading section\n");
- goto shread;
- }
- }
- break;
-
- case LC_THREAD:
- case LC_UNIXTHREAD:
- th = (struct xxx_thread_command *) cp;
- entry = th->state.eip;
- break;
- }
- cp += lcp->cmdsize;
- }
-
- kernBootStruct->rootdev = (dev & 0xffffff00) | devMajor[B_TYPE(dev)];
-
- free(cmds);
+ *load_addr = vmaddr;
+ *load_size = vmsize;
- *rentry = (entry_t)( (int) entry & 0x3fffffff );
- *rsize = vmend - vmaddr;
- *raddr = (char *)vmaddr;
+ return 0;
+}
- return 0;
-shread:
- free(cmds);
- return -1;
+static long DecodeUnixThread(long cmdBase, unsigned int *entry)
+{
+ i386_thread_state_t *i386ThreadState;
+
+ i386ThreadState = (i386_thread_state_t *)
+ (cmdBase + sizeof(struct thread_command) + 8);
+
+ *entry = i386ThreadState->eip;
+
+ return 0;
}
+
--- /dev/null
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include "sl.h"
+#include "saio_internal.h"
+#include "bootstruct.h"
+
+static long gImageLastKernelAddr;
+
+#define kPageSize 4096
+#define RoundPage(x) ((((unsigned)(x)) + kPageSize - 1) & ~(kPageSize - 1))
+
+
+long
+AllocateMemoryRange(char * rangeName, long start, long length, long type)
+{
+ if ( bootArgs->numBootDrivers < NDRIVERS )
+ {
+ int num = bootArgs->numBootDrivers;
+
+ bootArgs->driverConfig[num].address = start;
+ bootArgs->driverConfig[num].size = length;
+ bootArgs->driverConfig[num].type = type;
+ bootArgs->numBootDrivers++;
+ }
+ else
+ {
+ stop( "AllocateMemoryRange error" );
+ }
+ return 0;
+}
+
+long
+AllocateKernelMemory( long inSize )
+{
+ long addr;
+
+ if (gImageLastKernelAddr == 0) {
+ gImageLastKernelAddr = RoundPage( bootArgs->kaddr +
+ bootArgs->ksize );
+ }
+ addr = gImageLastKernelAddr;
+ gImageLastKernelAddr += RoundPage(inSize);
+
+ if ( gImageLastKernelAddr >= (KERNEL_ADDR + KERNEL_LEN) ) {
+ stop ("AllocateKernelMemory error");
+ }
+
+ bootArgs->ksize = gImageLastKernelAddr - bootArgs->kaddr;
+
+ return addr;
+}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/* write output port */
outb(PORT_B, CMD_WOUT);
+ delay(100);
/* wait until command is accepted */
while (inb(PORT_B) & KB_INFULL);
outb(PORT_A, KB_A20);
+ delay(100);
while (inb(PORT_B) & KB_INFULL); /* wait until done */
}
-
-void sleep(int n)
-{
- int endtime = (time18() + 18*n);
- while (time18() < endtime);
-}
-
-void turnOffFloppy(void)
-{
- /*
- * Disable floppy:
- * Hold controller in reset,
- * disable DMA and IRQ,
- * turn off floppy motors.
- */
- outb(0x3F2, 0x00);
-}
-
-char * newString(const char * oldString)
-{
- if ( oldString )
- return strcpy(malloc(strlen(oldString)+1), oldString);
- else
- return NULL;
-}
-
-void stop(const char * msg)
-{
- error("\n%s\n", msg);
- halt();
-}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
cmd.bufferSize = TFTP_LEN;
cmd.buffer = TFTP_ADDR;
- verbose("Loading file: %s\n", filePath);
+ verbose("Loading file: %s\n", filePath);
ret = nbp(nbpCommandTFTPReadFile, (nbpCommand_u *) &cmd);
- return (ret == nbpStatusSuccess) ? cmd.bufferSize : -1;
+ return (ret == nbpStatusSuccess) ? (long)cmd.bufferSize : -1;
}
/*==========================================================================
gNetBVR->fs_getdirentry = NBPGetDirEntry;
}
}
-
return gNetBVR;
}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef __LIBSAIO_NBP_CMD_H
#define __LIBSAIO_NBP_CMD_H
-typedef unsigned long UInt32;
-typedef unsigned char UInt8;
+#include <IOKit/IOTypes.h>
/*==========================================================================
* NBP return status codes.
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
extern void real_to_prot(void);
extern void prot_to_real(void);
extern void halt(void);
-extern void startprog(unsigned int address);
+extern void startprog(unsigned int address, void *arg);
extern void loader(UInt32 code, UInt32 cmdptr);
/* bios.s */
extern void bios(biosBuf_t *bb);
-extern void get_memsize(biosBuf_t *bb);
/* biosfn.c */
#ifdef EISA_SUPPORT
extern int bgetc(void);
extern int biosread(int dev, int cyl, int head, int sec, int num);
extern int ebiosread(int dev, long sec, int count);
+extern int get_drive_info(int drive, struct driveInfo *dp);
extern void putc(int ch);
extern void putca(int ch, int attr, int repeat);
extern int getc(void);
extern int readKeyboardStatus(void);
extern unsigned int time18(void);
+extern void delay(int ms);
extern unsigned int get_diskinfo(int dev);
extern int APMPresent(void);
extern int APMConnect32(void);
extern void scollPage(int x1, int y1, int x2, int y2, int attr, int rows, int dir);
extern void clearScreenRows(int y1, int y2);
extern void setActiveDisplayPage( int page );
+extern unsigned long getMemoryMap(struct MemoryRange * rangeArray, unsigned long maxRangeCount,
+ unsigned long * conMemSizePtr, unsigned long * extMemSizePtr);
+extern unsigned long getExtendedMemorySize();
+extern unsigned long getConventionalMemorySize();
+extern void sleep(int n);
/* bootstruct.c */
extern void initKernBootStruct(int biosdev);
+extern void reserveKernBootStruct(void);
+extern void copyKernBootStruct(void);
/* cache.c */
extern void CacheInit(CICell ih, long blockSize);
extern int printf(const char *format, ...);
extern int error(const char *format, ...);
extern int verbose(const char *format, ...);
+extern void stop(const char *message);
/* disk.c */
extern BVRef diskScanBootVolumes(int biosdev, int *count);
extern void diskSeek(BVRef bvr, long long position);
extern int diskRead(BVRef bvr, long addr, long length);
extern int readBootSector(int biosdev, unsigned int secno, void *buffer);
+extern void turnOffFloppy(void);
/* load.c */
-extern int openfile(const char *filename, int ignored);
-extern int loadprog(int dev, int fd, struct mach_header *headOut,
- entry_t *entry, char **addr, int *size);
+extern char gHaveKernelCache;
+extern long ThinFatFile(void **binary, unsigned long *length);
+extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);
+
+/* memory.c */
+long AllocateKernelMemory( long inSize );
+long AllocateMemoryRange(char * rangeName, long start, long length, long type);
/* misc.c */
-extern void sleep(int n);
extern void enableA20(void);
-extern void turnOffFloppy(void);
-extern char * newString(const char *oldString);
-extern void stop(const char *message);
/* nbp.c */
extern UInt32 nbpUnloadBaseCode();
extern BOOL getValueForKey(const char *key, const char **val, int *size);
extern BOOL getBoolForKey(const char *key);
extern BOOL getIntForKey(const char *key, int *val);
-#if 0
-extern char * loadLocalizableStrings(char *name, char *tableName);
-extern char * bundleLongName(char *bundleName, char *tableName);
-extern int loadOtherConfigs(int useDefault);
-#endif
extern int loadConfigFile(const char *configFile, const char **table, BOOL allocTable);
extern int loadConfigDir(const char *bundleName, BOOL useDefault, const char **table,
BOOL allocTable);
extern int loadSystemConfig(const char *which, int size);
extern void addConfig(const char *config);
+extern char * newString(const char *oldString);
/* sys.c */
extern long LoadFile(const char *fileSpec);
extern int b_lseek(int fdesc, int addr, int ptr);
extern int tell(int fdesc);
extern const char * usrDevices(void);
+extern const char * systemConfigDir(void);
extern struct dirstuff * opendir(const char *path);
extern int closedir(struct dirstuff *dirp);
extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);
extern BVRef selectBootVolume(BVRef chain);
extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen);
+extern int gBIOSDev;
+extern int gBootFileType;
+
#endif /* !__LIBSAIO_SAIO_INTERNAL_H */
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <sys/types.h>
#include "bios.h"
#include "nbp_cmd.h"
+#include <pexpert/i386/boot.h>
-#if 0
+#if DEBUG
#define DEBUG_DISK(x) printf x
#else
#define DEBUG_DISK(x)
int totalDrives;
};
+struct driveInfo {
+ boot_drive_info_t di;
+ int uses_ebios;
+ int no_emulation;
+ int biosdev;
+ int valid;
+};
+
+
struct BootVolume;
typedef struct BootVolume * BVRef;
typedef struct BootVolume * CICell;
BVRef dir_bvr; /* volume reference */
};
+#define BVSTRLEN 32
+
struct BootVolume {
BVRef next; /* list linkage pointer */
int biosdev; /* BIOS device number */
+ int type; /* device type (floppy, hd, network) */
unsigned int flags; /* attribute flags */
BVGetDescription description; /* BVGetDescription function */
int part_no; /* partition number (1 based) */
unsigned int fs_boff; /* 1st block # of next read */
FSLoadFile fs_loadfile; /* FSLoadFile function */
FSGetDirEntry fs_getdirentry; /* FSGetDirEntry function */
+ unsigned int bps; /* bytes per sector for this device */
+ char name[BVSTRLEN]; /* (name of partition) */
+ char type_name[BVSTRLEN]; /* (type of partition, eg. Apple_HFS) */
+
};
enum {
kBIOSDevMask = 0xFF
};
-#define BIOS_DEV_TYPE(d) ((d) & kBIOSDevTypeMask)
-#define BIOS_DEV_UNIT(d) ((d) & kBIOSDevUnitMask)
+//#define BIOS_DEV_TYPE(d) ((d) & kBIOSDevTypeMask)
+#define BIOS_DEV_UNIT(bvr) ((bvr)->biosdev - (bvr)->type)
/*
* KernBootStruct device types.
#define MAKEKERNDEV(t, u, p) MAKEBOOTDEV(t, 0, 0, u, p)
+enum {
+ kNetworkDeviceType = kBIOSDevTypeNetwork,
+ kBlockDeviceType = kBIOSDevTypeHardDrive
+} gBootFileType_t;
+
#endif /* !__LIBSAIO_SAIO_TYPES_H */
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
* All rights reserved.
*/
+#include "bootstruct.h"
#include "libsaio.h"
#include "stringConstants.h"
#include "legacy/configTablePrivate.h"
+#include "xml.h"
-extern KERNBOOTSTRUCT *kernBootStruct;
extern char *Language;
extern char *LoadableFamilies;
+static TagPtr gConfigDict;
+
static void eatThru(char val, const char **table_p);
static inline int isspace(char c)
char *begin = *list, *end;
char *newstr;
int newsize = *size;
+ int bufsize;
while (*begin && newsize && isspace(*begin)) {
begin++;
}
if (begin == end)
return 0;
- newstr = malloc(end - begin + 1);
- strncpy(newstr, begin, end - begin);
+ bufsize = end - begin + 1;
+ newstr = malloc(bufsize);
+ strlcpy(newstr, begin, bufsize);
*list = end;
*size = newsize;
return newstr;
return ret;
}
-// looks in table for strings of format << "key" = "value"; >>
-// or << "key"; >>
-BOOL getValueForStringTableKey(const char *table, const char *key, const char **val, int *size)
+BOOL getValueForConfigTableKey(const char *table, const char *key, const char **val, int *size)
{
int keyLength;
const char *tableKey;
- do
- {
- eatThru('\"',&table);
- tableKey = table;
- keyLength = strlen(key);
- if (keyLength &&
- (stringLength(table,1) == keyLength) &&
- (keyncmp(key, table, keyLength) == 0))
- {
- int c;
+ if (gConfigDict != 0 ) {
+ /* Look up key in XML dictionary */
+ TagPtr value;
+ value = XMLGetProperty(gConfigDict, key);
+ if (value != 0) {
+ if (value->type != kTagTypeString) {
+ error("Non-string tag '%s' found in config file\n",
+ key);
+ return NO;
+ }
+ *val = value->string;
+ *size = strlen(value->string);
+ return YES;
+ }
+ } else {
+ /* Legacy plist-style table */
+ 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);
+ /* 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
char *newstr, *p;
int size;
- if (getValueForStringTableKey(table, key, &val, &size)) {
+ if (getValueForConfigTableKey(table, key, &val, &size)) {
newstr = (char *)malloc(size+1);
for (p = newstr; size; size--, p++, val++) {
if ((*p = *val) == '\\') {
if (getValueForKey(key, &val, &size) && size) {
newstr = (char *)malloc(size + 1);
- strncpy(newstr, val, size);
+ strlcpy(newstr, val, size + 1);
return newstr;
} else {
return 0;
int *size
)
{
- if (getValueForBootKey(kernBootStruct->bootString, key, val, size))
+ if (getValueForBootKey(bootArgs->bootString, key, val, size))
return YES;
- else if (getValueForStringTableKey(kernBootStruct->config, key, val, size))
+ else if (getValueForConfigTableKey(bootArgs->config, key, val, size))
return YES;
return NO;
}
-#if 0
-#define LOCALIZABLE_PATH \
- "%s/%s.config/%s.lproj/%s.strings"
-char *
-loadLocalizableStrings(
- char *name,
- char *tableName
-)
-{
- char buf[256], *config;
- register int count, fd = -1;
- const char *device_dir = usrDevices();
-
- sprintf(buf, LOCALIZABLE_PATH, device_dir, name,
- Language, tableName);
- if ((fd = open(buf, 0)) < 0) {
- sprintf(buf, LOCALIZABLE_PATH, device_dir, name,
- "English", tableName);
- if ((fd = open(buf,0)) < 0) {
- return 0;
- }
- }
- count = file_size(fd);
- config = malloc(count);
- count = read(fd, config, count);
- close(fd);
- if (count <= 0) {
- free(config);
- return 0;
- }
- return config;
-}
-#endif
-
-#if 0 // XXX
-char *
-bundleLongName(
- char *bundleName,
- char *tableName
-)
-{
- char *table, *name, *version, *newName;
- char *path = malloc(256);
-
-#define LONG_NAME_FORMAT "%s (v%s)"
- sprintf(path, "%s/%s.config/%s.table",
- usrDevices(), bundleName, tableName ? tableName : "Default");
- if (loadConfigFile(path, &table, YES) == 0) {
- version = newStringForStringTableKey(table, "Version");
- free(table);
- } else {
- version = newString("0.0");
- }
- table = loadLocalizableStrings(bundleName,
- tableName ? tableName : "Localizable");
- if (table) {
- name = newStringForStringTableKey(table, "Long Name");
- free(table);
- } else {
- name = newString(bundleName);
- }
- newName = malloc(strlen(name)+strlen(version)+strlen(LONG_NAME_FORMAT));
- sprintf(newName, LONG_NAME_FORMAT, name, version);
- free(name); free(version);
- return newName;
-}
-#endif
-
int sysConfigValid;
-void
-addConfig(
- const char *config
-)
-{
- char *configPtr = kernBootStruct->configEnd;
- int len = strlen(config);
-
- if ((configPtr - kernBootStruct->config) > CONFIG_SIZE) {
- error("No room in memory for config files\n");
- return;
- }
- strcpy(configPtr, config);
- configPtr += (len + 1);
- *configPtr = 0;
- kernBootStruct->configEnd = configPtr;
-}
-
#define TABLE_EXPAND_SIZE 192
/*
int
loadConfigFile(const char *configFile, const char **table, BOOL allocTable)
{
- char *configPtr = kernBootStruct->configEnd;
+ char *configPtr = bootArgs->configEnd;
int fd, count;
/* Read config file into memory */
if (allocTable) {
configPtr = malloc(file_size(fd)+2+TABLE_EXPAND_SIZE);
} else {
- if ((configPtr - kernBootStruct->config) > CONFIG_SIZE) {
+ if ((configPtr - bootArgs->config) > CONFIG_SIZE) {
error("No room in memory for config files\n");
close(fd);
return -1;
*configPtr++ = 0;
*configPtr = 0;
if (!allocTable)
- kernBootStruct->configEnd = configPtr;
+ bootArgs->configEnd = configPtr;
return 0;
} else {
if (loadConfigFile(buf, table, allocTable) == 0) {
ret = 1;
} else {
- if (!allocTable)
+ if (!allocTable) {
error("Config file \"%s\" not found\n", buf);
+ sleep(1); // let the message be seen!
+ }
ret = -1;
}
}
#define LP '('
#define RP ')'
+#define SYSTEM_CONFIG_DIR "/Library/Preferences/SystemConfiguration"
+#define SYSTEM_CONFIG_FILE "/com.apple.Boot.plist"
+#define SYSTEM_CONFIG_PATH SYSTEM_CONFIG_DIR SYSTEM_CONFIG_FILE
+#define CONFIG_EXT ".plist"
+
+#if 1
+void
+printSystemConfig(void)
+{
+ char *p1 = bootArgs->config;
+ char *p2 = p1, tmp;
+
+ while (*p1 != '\0') {
+ while (*p2 != '\0' && *p2 != '\n') p2++;
+ tmp = *p2;
+ *p2 = '\0';
+ printf("%s\n", p1);
+ *p2 = tmp;
+ if (tmp == '\0') break;
+ p1 = ++p2;
+ }
+}
+#endif
+
static int sysconfig_dev;
+//==========================================================================
+// ParseXMLFile
+// Modifies the input buffer.
+// Expects to see one dictionary in the XML file.
+// Puts the first dictionary it finds in the
+// tag pointer and returns 0, or returns -1 if not found
+// (and does not modify dict pointer).
+//
+static long
+ParseXMLFile( char * buffer, TagPtr * dict )
+{
+ long length, pos;
+ TagPtr tag;
+ pos = 0;
+ char *configBuffer;
+
+ configBuffer = malloc(strlen(buffer)+1);
+ strcpy(configBuffer, buffer);
+
+ while (1)
+ {
+ length = XMLParseNextTag(configBuffer + pos, &tag);
+ if (length == -1) break;
+
+ pos += length;
+
+ if (tag == 0) continue;
+ if (tag->type == kTagTypeDict) break;
+
+ XMLFreeTag(tag);
+ }
+ free(configBuffer);
+ if (length < 0) {
+ return -1;
+ }
+ *dict = tag;
+ return 0;
+}
+
/* Returns 0 if requested config files were loaded,
* 1 if default files were loaded,
* -1 if no files were loaded.
char *buf, *bp;
const char *cp;
int ret, len, doDefault=0;
- const char *device_dir = usrDevices();
-#if 0
- printf("In Load system config which=%d ; size=%d\n", which, size);
- //sleep(1);
-#endif 1
- buf = bp = malloc(256);
- if (which && size)
- {
-#if 0
- printf("In Load system config alt\n");
- //sleep(1);
-#endif 1
- for(cp = which, len = size; len && *cp && *cp != LP; cp++, len--) ;
- if (*cp == LP) {
- while (len-- && *cp && *cp++ != RP) ;
- /* cp now points past device */
- strncpy(buf,which,cp - which);
- bp += cp - which;
- } else {
- cp = which;
- len = size;
- }
- if (*cp != '/') {
- strcpy(bp, device_dir);
- strcat(bp, "/System.config/");
- strncat(bp, cp, len);
- if (strncmp(cp + len - strlen(IO_TABLE_EXTENSION),
- IO_TABLE_EXTENSION, strlen(IO_TABLE_EXTENSION)) != 0)
- strcat(bp, IO_TABLE_EXTENSION);
- } else {
- strncpy(bp, cp, len);
- bp[size] = '\0';
- }
- if ((strcmp(bp, USR_SYSTEM_DEFAULT_FILE) == 0) ||
- (strcmp(bp, ARCH_SYSTEM_DEFAULT_FILE) == 0))
- doDefault = 1;
- ret = loadConfigFile(bp = buf, 0, 0);
+ buf = bp = malloc(512);
+ if (which && size) {
+ for(cp = which, len = size; len && *cp && *cp != LP; cp++, len--) ;
+ if (*cp == LP) {
+ while (len-- && *cp && *cp++ != RP) ;
+ /* cp now points past device */
+ strlcpy(buf,which,cp - which);
+ bp += cp - which;
+ } else {
+ cp = which;
+ len = size;
+ }
+ if (*cp != '/') {
+ strcpy(bp, systemConfigDir());
+ strcat(bp, "/");
+ strncat(bp, cp, len);
+ if (strncmp(cp + len - strlen(CONFIG_EXT),
+ CONFIG_EXT, strlen(CONFIG_EXT)) != 0)
+ strcat(bp, CONFIG_EXT);
+ } else {
+ strlcpy(bp, cp, len);
+ }
+ if ((strcmp(bp, SYSTEM_CONFIG_PATH) == 0)) {
+ doDefault = 1;
+ }
+ ret = loadConfigFile(bp = buf, 0, 0);
} else {
-#if 0
- printf("In default SYSTEM_CONFIG LOAD\n");
- //sleep(1);
-#endif 1
- ret = loadConfigDir((bp = SYSTEM_CONFIG), 0, 0, 0);
-#if 0
- printf("come back from SYSTEM_CONFIG loadConfigDir\n");
- //sleep(1);
-#endif 1
- }
+ strcpy(bp, systemConfigDir());
+ strcat(bp, SYSTEM_CONFIG_FILE);
+ ret = loadConfigFile(bp, 0, 0);
+ if (ret < 0) {
+ ret = loadConfigDir((bp = SYSTEM_CONFIG), 0, 0, 0);
+ }
+ }
sysconfig_dev = currentdev();
if (ret < 0) {
error("System config file '%s' not found\n", bp);
- } else
+ sleep(1);
+ } else {
sysConfigValid = 1;
+ // Check for XML file;
+ // if not XML, gConfigDict will remain 0.
+ ParseXMLFile(bootArgs->config, &gConfigDict);
+ }
free(buf);
return (ret < 0 ? ret : doDefault);
}
-#ifdef DISABLED
-int
-loadOtherConfigs(
- int useDefault
-)
-{
- char *val, *table;
- char *path = malloc(256);
- char *hintTable;
- char *installVersion = NULL, *thisVersion;
- char *longName, *tableName;
- int count;
- char *string;
- int ret;
- int old_dev = currentdev();
-
- if (sysconfig_dev)
- switchdev(sysconfig_dev);
- if (getValueForKey( "Boot Drivers", &val, &count))
- {
-#if 0
- printf("Loading Boot Drivers\n");
- sleep(1);
-#endif 1
- while (string = newStringFromList(&val, &count)) {
- /* Check installation hints... */
- sprintf(path, "%s/System.config/" INSTALL_HINTS
- "/%s.table", usrDevices(), string);
-
- if (getBoolForKey("Ignore Hints") == NO &&
- loadConfigFile(path, &hintTable, YES) == 0) {
- installVersion = newStringForStringTableKey(
- hintTable, "Version");
- longName = newStringForStringTableKey(
- hintTable, "Long Name");
- tableName = newStringForStringTableKey(
- hintTable, "Default Table");
- free(hintTable);
- } else {
- installVersion = longName = tableName = NULL;
- }
-
- ret = loadConfigDir(string, useDefault, &table, YES);
- if (ret >= 0) {
- thisVersion = newStringForStringTableKey(
- table, "Version");
- if (installVersion && thisVersion &&
- (strcmp(thisVersion, installVersion) != 0)) {
- /* Versions do not match */
- driverIsMissing(string, installVersion, longName,
- tableName, DRIVER_VERSION_MISMATCH);
- } else {
- struct driver_load_data dl;
-
- dl.name = string;
- if ((openDriverReloc(&dl)) >= 0) {
- verbose("Loading binary for %s device driver.\n",string);
- if (loadDriver(&dl) < 0) /// need to stop if error
- error("Error loading %s device driver.\n",string);
-#if 0
- printf("Calling link driver for %s\n", string);
-#endif 1
- if (linkDriver(&dl) < 0)
- error("Error linking %s device Driver.\n",string);
- }
- loadConfigDir(string, useDefault, NULL, NO);
- driverWasLoaded(string, table, NULL);
- free(table);
- free(string);
- free(installVersion); free(longName);
- free(tableName);
- }
- free(thisVersion);
- } else {
- /* driver not found */
- driverIsMissing(string, installVersion, longName,
- tableName, DRIVER_NOT_FOUND);
- }
-#if 0
- if (ret == 1)
- useDefault = 1; // use defaults from now on
-#endif
- }
- } else {
- error("Warning: No Boot drivers specified in system config.\n");
- }
- kernBootStruct->first_addr0 =
- (int)kernBootStruct->configEnd + 1024;
- free(path);
- switchdev(old_dev);
- return 0;
+char * newString(const char * oldString)
+{
+ if ( oldString )
+ return strcpy(malloc(strlen(oldString)+1), oldString);
+ else
+ return NULL;
}
-#endif /* DISABLED */
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*/
#include "libsaio.h"
+#include "bootstruct.h"
+
struct devsw {
const char * name;
unsigned char biosdev;
+ int type;
};
static struct devsw devsw[] =
{
- { "sd", 0x80 }, /* DEV_SD */
- { "hd", 0x80 }, /* DEV_HD */
- { "fd", 0x00 }, /* DEV_FD */
- { "en", 0xE0 }, /* DEV_EN */
+ { "sd", 0x80, kBIOSDevTypeHardDrive }, /* DEV_SD */
+ { "hd", 0x80, kBIOSDevTypeHardDrive }, /* DEV_HD */
+ { "fd", 0x00, kBIOSDevTypeFloppy }, /* DEV_FD */
+ { "en", 0xE0, kBIOSDevTypeNetwork }, /* DEV_EN */
{ 0, 0 }
};
//==========================================================================
// LoadFile - LOW-LEVEL FILESYSTEM FUNCTION.
// Load the specified file to the load buffer at LOAD_ADDR.
+// If the file is fat, load only the i386 portion.
long LoadFile(const char * fileSpec)
{
// GetFileInfo - LOW-LEVEL FILESYSTEM FUNCTION.
// Get attributes for the specified file.
+static char gMakeDirSpec[1024];
+
long GetFileInfo(const char * dirSpec, const char * name,
long * flags, long * time)
{
long index = 0;
const char * entryName;
+ if (!dirSpec) {
+ long idx, len;
+
+ len = strlen(name);
+
+ for (idx = len; idx && (name[idx] != '/' && name[idx] != '\\'); idx--) {}
+ if (idx == 0) {
+ gMakeDirSpec[0] = '/';
+ gMakeDirSpec[1] = '\0';
+ } else {
+ idx++;
+ strncpy(gMakeDirSpec, name, idx);
+ name += idx;
+ }
+ dirSpec = gMakeDirSpec;
+ }
+
while (GetDirEntry(dirSpec, &index, &entryName, flags, time) == 0)
{
if (strcmp(entryName, name) == 0)
gFSLoadAddress = io->i_buf;
io->i_filesize = bvr->fs_loadfile(bvr, (char *)filePath);
- if (io->i_filesize < 0) goto error;
+ if (io->i_filesize < 0) {
+ goto error;
+ }
return fdesc;
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
- if (io->i_offset + count > io->i_filesize)
+ if ((io->i_offset + count) > (unsigned int)io->i_filesize)
count = io->i_filesize - io->i_offset;
if (count <= 0)
int currentdev()
{
- return kernBootStruct->kernDev;
+ return bootArgs->kernDev;
}
//==========================================================================
int switchdev(int dev)
{
- kernBootStruct->kernDev = dev;
+ bootArgs->kernDev = dev;
return dev;
}
const char * usrDevices()
{
- return (B_TYPE(currentdev()) == DEV_EN) ? "" : "/private/Drivers/i386";
+ if (gBootFileType == kNetworkDeviceType)
+ return "";
+ return "/private/Drivers/i386";
}
//==========================================================================
+const char * systemConfigDir()
+{
+ if (gBootFileType == kNetworkDeviceType)
+ return "";
+ return "/Library/Preferences/SystemConfiguration";
+}
+
+//==========================================================================
+
+int gBootFileType;
+
BVRef scanBootVolumes( int biosdev, int * count )
{
BVRef bvr = 0;
- switch ( BIOS_DEV_TYPE( biosdev ) )
- {
- case kBIOSDevTypeFloppy:
- case kBIOSDevTypeHardDrive:
- bvr = diskScanBootVolumes( biosdev, count );
- break;
- case kBIOSDevTypeNetwork:
- bvr = nbpScanBootVolumes( biosdev, count );
- break;
+ bvr = diskScanBootVolumes(biosdev, count);
+ if (bvr == NULL) {
+ bvr = nbpScanBootVolumes(biosdev, count);
+ if (bvr != NULL) {
+ gBootFileType = kNetworkDeviceType;
+ }
+ } else {
+ gBootFileType = kBlockDeviceType;
}
return bvr;
}
if ( bvr->flags & kBVFlagPrimary ) bvr2 = bvr;
}
- bvr = bvr1 ? bvr1 :
- bvr2 ? bvr2 : chain;
+ bvr = bvr2 ? bvr2 :
+ bvr1 ? bvr1 : chain;
return bvr;
}
#define LP '('
#define RP ')'
-extern int gBIOSDev;
+int gBIOSDev;
static BVRef getBootVolumeRef( const char * path, const char ** outPath )
{
const char * cp;
BVRef bvr;
- int type = B_TYPE( kernBootStruct->kernDev );
- int unit = B_UNIT( kernBootStruct->kernDev );
- int part = B_PARTITION( kernBootStruct->kernDev );
+ int type = B_TYPE( bootArgs->kernDev );
+ int unit = B_UNIT( bootArgs->kernDev );
+ int part = B_PARTITION( bootArgs->kernDev );
int biosdev = gBIOSDev;
static BVRef lastBVR = 0;
static int lastKernDev;
if (*cp != LP) // no left paren found
{
cp = path;
- if ( lastBVR && lastKernDev == kernBootStruct->kernDev )
+ if ( lastBVR && lastKernDev == bootArgs->kernDev )
{
bvr = lastBVR;
goto quick_exit;
for ( ; *cp && *cp != RP; cp++) /* LOOP */;
if (*cp == RP) cp++;
- biosdev = dp->biosdev;
+ biosdev = dp->biosdev + unit;
}
else
{
if (*cp == RP) cp++;
}
- biosdev += (unit & kBIOSDevUnitMask);
-
if ((bvr = newBootVolumeRef(biosdev, part)) == NULL)
{
// error("newBootVolumeRef() error\n");
// Record the most recent device parameters in the
// KernBootStruct.
- kernBootStruct->kernDev = MAKEKERNDEV(type, unit, bvr->part_no);
+ bootArgs->kernDev = biosdev;
lastBVR = bvr;
- lastKernDev = kernBootStruct->kernDev;
+ lastKernDev = bootArgs->kernDev;
quick_exit:
// Returns the file path following the device spec.
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * 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.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <sl.h>
+#include "ufs.h"
#include "ufs_byteorder.h"
typedef struct dinode Inode, *InodePtr;
{
long ret, length, flags;
- if (UFSInitPartition(ih) == -1) return -1;
-
verbose("Loading UFS file: [%s] from %x.\n", filePath, (unsigned)ih);
+ if (UFSInitPartition(ih) == -1) return -1;
+
// Skip one or two leading '/'.
if (*filePath == '/') filePath++;
if (*filePath == '/') filePath++;
// Copy the file name to gTempName
cnt = 0;
while ((filePath[cnt] != '/') && (filePath[cnt] != '\0')) cnt++;
- strncpy(gTempName, filePath, cnt);
+ strlcpy(gTempName, filePath, cnt+1);
// Move restPath to the right place.
if (filePath[cnt] != '\0') cnt++;
}
*fileInodeNum = dir->d_ino;
- *name = strncpy(gTempName2, dir->d_name, dir->d_namlen);
+ *name = strlcpy(gTempName2, dir->d_name, dir->d_namlen+1);
return 0;
}
--- /dev/null
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+extern long UFSInitPartition(CICell ih);
+extern long UFSLoadFile(CICell ih, char * filePath);
+extern long UFSGetDirEntry(CICell ih, char * dirPath, long * dirIndex,
+ char ** name, long * flags, long * time);
+
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <sys/param.h>
#include <sys/vnode.h>
#include <ufs/ufs/dir.h>
-#include <architecture/byte_order.h>
+#include <libkern/OSByteOrder.h>
#include "ufs_byteorder.h"
#include "libsaio.h"
-#define swapBigLongToHost(thing) ((thing) = NXSwapBigLongToHost(thing))
-#define swapBigShortToHost(thing) ((thing) = NXSwapBigShortToHost(thing))
-#define byte_swap_longlong(thing) ((thing) = NXSwapBigLongLongToHost(thing))
-#define byte_swap_int(thing) ((thing) = NXSwapBigLongToHost(thing))
-#define byte_swap_short(thing) ((thing) = NXSwapBigShortToHost(thing))
+#define swapBigLongToHost(thing) ((thing) = OSSwapBigToHostInt32(thing))
+#define swapBigShortToHost(thing) ((thing) = OSSwapBigToHostInt16(thing))
+#define byte_swap_longlong(thing) ((thing) = OSSwapBigToHostInt64(thing))
+#define byte_swap_int(thing) ((thing) = OSSwapBigToHostInt32(thing))
+#define byte_swap_short(thing) ((thing) = OSSwapBigToHostInt16(thing))
void
byte_swap_longlongs(unsigned long long *array, int count)
{
register unsigned long long i;
- for (i = 0; i < count; i++)
+ for (i = 0; i < (unsigned long long)count; i++)
byte_swap_longlong(array[i]);
}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <sys/disktab.h>
#include <sys/vnode.h>
#include <sys/buf.h>
-#include <dev/disk.h>
+#include <sys/disk.h>
#include <ufs/ufs/quota.h>
-#include <ufs/ufs/inode.h>
+#include <ufs/ufs/dinode.h>
+#include <ufs/ufs/dir.h>
#include <ufs/ffs/fs.h>
+#include <IOKit/storage/IONeXTPartitionScheme.h>
+
void byte_swap_ints(int *array, int count);
void byte_swap_shorts(short *array, int count);
void byte_swap_longlongs(unsigned long long *array, int count);
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
return(bb.eax.r.h);
}
-int setVBEMode(unsigned short mode)
+/*
+ * Default GTF parameter values.
+ */
+#define kCellGranularity 8.0 // character cell granularity
+#define kMinVSyncPlusBP 550.0 // min VSync + BP interval (us)
+#define kMinFrontPorch 1.0 // minimum front porch in lines(V)/cells(H)
+#define kVSyncLines 3.0 // width of VSync in lines
+#define kHSyncWidth 8.0 // HSync as a percent of total line width
+#define kC 30.0 // C = (C'-J) * (K/256) + J
+#define kM 300.0 // M = K/256 * M'
+
+static inline double Round( double f )
{
- bb.intno = 0x10;
+ asm volatile ("frndint" : "=t" (f) : "0" (f));
+ return f;
+}
+
+static inline double Sqrt( double f )
+{
+ asm volatile ("fsqrt" : "=t" (f) : "0" (f));
+ return f;
+}
+
+int generateCRTCTiming( unsigned short width,
+ unsigned short height,
+ unsigned long paramValue,
+ int paramType,
+ VBECRTCInfoBlock * timing )
+{
+ double h_period_est, h_freq, h_period, h_total_pixels, h_sync_pixels;
+ double h_active_pixels, h_ideal_duty_cycle, h_blank_pixels, pixel_freq = 0;
+ double v_sync_plus_bp = 0, v_total_lines = 0, v_field_rate_est, v_frame_rate = 0;
+ const double h_pixels = (double) width;
+ const double v_lines = (double) height;
+
+ enum {
+ left_margin_pixels = 0,
+ right_margin_pixels = 0,
+ top_margin_lines = 0,
+ bot_margin_lines = 0,
+ interlace = 0
+ };
+
+ // Total number of active pixels in image and both margins
+ h_active_pixels = h_pixels + left_margin_pixels + right_margin_pixels;
+
+ if (paramType == kCRTCParamPixelClock)
+ {
+ // Pixel clock provided in MHz
+ pixel_freq = (double) paramValue / 1000000;
+
+ // Ideal horizontal period from the blanking duty cycle equation
+ h_period = ((kC - 100) + (Sqrt(((100 - kC) * (100 - kC)) + (0.4 * kM *
+ (h_active_pixels + right_margin_pixels + left_margin_pixels) /
+ pixel_freq)))) / 2.0 / kM * 1000;
+ }
+ else /* kCRTCParamRefreshRate */
+ {
+ double v_field_rate_in = (double) paramValue;
+
+ // Estimate the horizontal period
+ h_period_est = ((1 / v_field_rate_in) - kMinVSyncPlusBP / 1000000) /
+ (v_lines + (2 * top_margin_lines) + kMinFrontPorch + interlace) *
+ 1000000;
+
+ // Number of lines in Vsync + back porch
+ v_sync_plus_bp = Round(kMinVSyncPlusBP / h_period_est);
+
+ // Total number of lines in Vetical field period
+ v_total_lines = v_lines + top_margin_lines + bot_margin_lines +
+ v_sync_plus_bp + interlace + kMinFrontPorch;
+
+ // Estimate the vertical field frequency
+ v_field_rate_est = 1 / h_period_est / v_total_lines * 1000000;
+
+ // Find the actual horizontal period
+ h_period = h_period_est / (v_field_rate_in / v_field_rate_est);
+
+ // Find the vertical frame rate (no interlace)
+ v_frame_rate = 1 / h_period / v_total_lines * 1000000;
+ }
+
+ // Ideal blanking duty cycle from the blanking duty cycle equation
+ h_ideal_duty_cycle = kC - (kM * h_period / 1000);
+
+ // Number of pixels in the blanking time to the nearest double character cell
+ h_blank_pixels = Round(h_active_pixels * h_ideal_duty_cycle /
+ (100 - h_ideal_duty_cycle) / (2 * kCellGranularity)) *
+ (2 * kCellGranularity);
+
+ // Total number of horizontal pixels
+ h_total_pixels = h_active_pixels + h_blank_pixels;
+
+ if (paramType == kCRTCParamPixelClock)
+ {
+ // Horizontal frequency
+ h_freq = pixel_freq / h_total_pixels * 1000;
+
+ // Number of lines in V sync + back porch
+ v_sync_plus_bp = Round(kMinVSyncPlusBP * h_freq / 1000);
+
+ // Total number of lines in vertical field period
+ v_total_lines = v_lines + top_margin_lines + bot_margin_lines +
+ interlace + v_sync_plus_bp + kMinFrontPorch;
+
+ // Vertical frame frequency
+ v_frame_rate = Round(h_freq / v_total_lines * 1000);
+ }
+ else
+ {
+ // Find pixel clock frequency
+ pixel_freq = Round(h_total_pixels / h_period);
+ }
+
+ h_sync_pixels = Round(h_total_pixels * kHSyncWidth / 100 / kCellGranularity) *
+ kCellGranularity;
+
+ timing->HTotal = h_total_pixels;
+ timing->HSyncStart = h_active_pixels + (h_blank_pixels / 2) - h_sync_pixels;
+ timing->HSyncEnd = timing->HSyncStart + h_sync_pixels;
+ timing->VTotal = v_total_lines;
+ timing->VSyncStart = v_total_lines - v_sync_plus_bp;
+ timing->VSyncEnd = timing->VSyncStart + kVSyncLines;
+ timing->Flags = kCRTCNegativeHorizontalSync;
+ timing->PixelClock = pixel_freq * 1000000;
+ timing->RefreshRate = v_frame_rate * 100;
+
+ return 0;
+}
+
+int setVBEMode(unsigned short mode, const VBECRTCInfoBlock * timing)
+{
+ bb.intno = 0x10;
bb.eax.rr = funcSetMode;
bb.ebx.rr = mode;
+ if (timing) {
+ bb.es = SEG(timing);
+ bb.edi.rr = OFF(timing);
+ }
bios(&bb);
return(bb.eax.r.h);
}
*mode = bb.ebx.rr;
return(bb.eax.r.h);
}
+
+int getVBEPixelClock(unsigned short mode, unsigned long * pixelClock)
+{
+ bb.intno = 0x10;
+ bb.eax.rr = funcGetSetPixelClock;
+ bb.ebx.r.l = 0;
+ bb.ecx.rx = *pixelClock;
+ bb.edx.rr = mode;
+ bios(&bb);
+ *pixelClock = bb.ecx.rx;
+ return(bb.eax.r.h);
+}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
funcGetSetDisplayStart = 0x4F07,
funcGetSetPaletteFormat = 0x4F08,
funcGetSetPaletteData = 0x4F09,
- funcGetProtModeInterdace = 0x4F0A
+ funcGetProtModeInterdace = 0x4F0A,
+ funcGetSetPixelClock = 0x4F0B
};
enum {
* Get/Set VBE Mode parameters
*/
enum {
+ kCustomRefreshRateBit = (1 << 11),
kLinearFrameBufferBit = (1 << 14),
kPreserveMemoryBit = (1 << 15)
};
+/*
+ * CRTC information block passed to function 4F02
+ * to override default refresh rate.
+ */
+#pragma pack(1)
+
+typedef struct {
+ unsigned short HTotal;
+ unsigned short HSyncStart;
+ unsigned short HSyncEnd;
+ unsigned short VTotal;
+ unsigned short VSyncStart;
+ unsigned short VSyncEnd;
+ unsigned char Flags;
+ unsigned long PixelClock; /* in Hz */
+ unsigned short RefreshRate; /* units of 0.01 Hz */
+ unsigned char Reserved[40];
+} VBECRTCInfoBlock;
+
+#pragma options align=reset
+
+/*
+ * Defined flags for 'Flags' field in VBECRTCInfoBlock.
+ */
+enum {
+ kCRTCDoubleScannedMode = (1 << 0),
+ kCRTCInterlacedMode = (1 << 1),
+ kCRTCNegativeHorizontalSync = (1 << 2),
+ kCRTCNegativeVerticalSync = (1 << 3)
+};
+
+/*
+ * The type of paramter passed to generateCRTCTimings().
+ */
+enum {
+ kCRTCParamRefreshRate,
+ kCRTCParamPixelClock
+};
+
/*
* Palette
*/
extern int setVBEDACFormat(unsigned char format);
extern int setVBEPalette(void *palette);
extern int getVBEPalette(void *palette);
-extern int setVBEMode(unsigned short mode);
+extern int setVBEMode(unsigned short mode, const VBECRTCInfoBlock *timing);
extern int getVBECurrentMode(unsigned short *mode);
+extern int getVBEPixelClock(unsigned short mode, unsigned long *pixelClock);
+extern int generateCRTCTiming(unsigned short width,
+ unsigned short height,
+ unsigned long paramValue,
+ int paramType,
+ VBECRTCInfoBlock * timing);
#endif /* !__LIBSAIO_VBE_H */
--- /dev/null
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include "bootstruct.h"
+#include "libsaio.h"
+#include "sl.h"
+#include "xml.h"
+
+struct Module {
+ struct Module *nextModule;
+ long willLoad;
+ TagPtr dict;
+ char *plistAddr;
+ long plistLength;
+ char *driverPath;
+};
+typedef struct Module Module, *ModulePtr;
+
+struct DriverInfo {
+ char *plistAddr;
+ long plistLength;
+ void *moduleAddr;
+ long moduleLength;
+};
+typedef struct DriverInfo DriverInfo, *DriverInfoPtr;
+
+#define kDriverPackageSignature1 'MKXT'
+#define kDriverPackageSignature2 'MOSX'
+
+struct DriversPackage {
+ unsigned long signature1;
+ unsigned long signature2;
+ unsigned long length;
+ unsigned long alder32;
+ unsigned long version;
+ unsigned long numDrivers;
+ unsigned long reserved1;
+ unsigned long reserved2;
+};
+typedef struct DriversPackage DriversPackage;
+
+enum {
+ kCFBundleType2,
+ kCFBundleType3
+};
+
+
+#define USEMALLOC 1
+#define DOFREE 1
+
+static long ParseTagList(char *buffer, TagPtr *tag, long type, long empty);
+static long ParseTagKey(char *buffer, TagPtr *tag);
+static long ParseTagString(char *buffer, TagPtr *tag);
+static long ParseTagInteger(char *buffer, TagPtr *tag);
+static long ParseTagData(char *buffer, TagPtr *tag);
+static long ParseTagDate(char *buffer, TagPtr *tag);
+static long ParseTagBoolean(char *buffer, TagPtr *tag, long type);
+static long GetNextTag(char *buffer, char **tag, long *start);
+static long FixDataMatchingTag(char *buffer, char *tag);
+static TagPtr NewTag(void);
+static char *NewSymbol(char *string);
+#if DOFREE
+static void FreeSymbol(char *string);
+#endif
+
+
+//==========================================================================
+// XMLGetProperty
+
+TagPtr
+XMLGetProperty( TagPtr dict, const char * key )
+{
+ TagPtr tagList, tag;
+
+ if (dict->type != kTagTypeDict) return 0;
+
+ tag = 0;
+ tagList = dict->tag;
+ while (tagList)
+ {
+ tag = tagList;
+ tagList = tag->tagNext;
+
+ if ((tag->type != kTagTypeKey) || (tag->string == 0)) continue;
+
+ if (!strcmp(tag->string, key)) return tag->tag;
+ }
+
+ return 0;
+}
+
+
+//==========================================================================
+// XMLParseFile
+// Expects to see one dictionary in the XML file.
+// Puts the first dictionary it finds in the
+// tag pointer and returns 0, or returns -1 if not found.
+//
+long
+XMLParseFile( char * buffer, TagPtr * dict )
+{
+ long length, pos;
+ TagPtr tag;
+ pos = 0;
+
+ while (1)
+ {
+ length = XMLParseNextTag(buffer + pos, &tag);
+ if (length == -1) break;
+
+ pos += length;
+
+ if (tag == 0) continue;
+ if (tag->type == kTagTypeDict) break;
+
+ XMLFreeTag(tag);
+ }
+ if (length < 0) {
+ return -1;
+ }
+ *dict = tag;
+ return 0;
+}
+
+//==========================================================================
+// ParseNextTag
+
+long
+XMLParseNextTag( char * buffer, TagPtr * tag )
+{
+ long length, pos;
+ char * tagName;
+
+ length = GetNextTag(buffer, &tagName, 0);
+ if (length == -1) return -1;
+
+ pos = length;
+ if (!strncmp(tagName, kXMLTagPList, 6))
+ {
+ length = 0;
+ }
+ else if (!strcmp(tagName, kXMLTagDict))
+ {
+ length = ParseTagList(buffer + pos, tag, kTagTypeDict, 0);
+ }
+ else if (!strcmp(tagName, kXMLTagDict "/"))
+ {
+ length = ParseTagList(buffer + pos, tag, kTagTypeDict, 1);
+ }
+ else if (!strcmp(tagName, kXMLTagKey))
+ {
+ length = ParseTagKey(buffer + pos, tag);
+ }
+ else if (!strcmp(tagName, kXMLTagString))
+ {
+ length = ParseTagString(buffer + pos, tag);
+ }
+ else if (!strcmp(tagName, kXMLTagInteger))
+ {
+ length = ParseTagInteger(buffer + pos, tag);
+ }
+ else if (!strcmp(tagName, kXMLTagData))
+ {
+ length = ParseTagData(buffer + pos, tag);
+ }
+ else if (!strcmp(tagName, kXMLTagDate))
+ {
+ length = ParseTagDate(buffer + pos, tag);
+ }
+ else if (!strcmp(tagName, kXMLTagFalse))
+ {
+ length = ParseTagBoolean(buffer + pos, tag, kTagTypeFalse);
+ }
+ else if (!strcmp(tagName, kXMLTagTrue))
+ {
+ length = ParseTagBoolean(buffer + pos, tag, kTagTypeTrue);
+ }
+ else if (!strcmp(tagName, kXMLTagArray))
+ {
+ length = ParseTagList(buffer + pos, tag, kTagTypeArray, 0);
+ }
+ else if (!strcmp(tagName, kXMLTagArray "/"))
+ {
+ length = ParseTagList(buffer + pos, tag, kTagTypeArray, 1);
+ }
+ else
+ {
+ *tag = 0;
+ length = 0;
+ }
+
+ if (length == -1) return -1;
+
+ return pos + length;
+}
+
+//==========================================================================
+// ParseTagList
+
+static long
+ParseTagList( char * buffer, TagPtr * tag, long type, long empty )
+{
+ long length, pos;
+ TagPtr tagList, tmpTag;
+
+ tagList = 0;
+ pos = 0;
+
+ if (!empty)
+ {
+ while (1)
+ {
+ length = XMLParseNextTag(buffer + pos, &tmpTag);
+ if (length == -1) break;
+
+ pos += length;
+
+ if (tmpTag == 0) break;
+ tmpTag->tagNext = tagList;
+ tagList = tmpTag;
+ }
+
+ if (length == -1)
+ {
+ XMLFreeTag(tagList);
+ return -1;
+ }
+ }
+
+ tmpTag = NewTag();
+ if (tmpTag == 0)
+ {
+ XMLFreeTag(tagList);
+ return -1;
+ }
+
+ tmpTag->type = type;
+ tmpTag->string = 0;
+ tmpTag->tag = tagList;
+ tmpTag->tagNext = 0;
+
+ *tag = tmpTag;
+
+ return pos;
+}
+
+//==========================================================================
+// ParseTagKey
+
+static long
+ParseTagKey( char * buffer, TagPtr * tag )
+{
+ long length, length2;
+ char *string;
+ TagPtr tmpTag, subTag;
+
+ length = FixDataMatchingTag(buffer, kXMLTagKey);
+ if (length == -1) return -1;
+
+ length2 = XMLParseNextTag(buffer + length, &subTag);
+ if (length2 == -1) return -1;
+
+ tmpTag = NewTag();
+ if (tmpTag == 0)
+ {
+ XMLFreeTag(subTag);
+ return -1;
+ }
+
+ string = NewSymbol(buffer);
+ if (string == 0)
+ {
+ XMLFreeTag(subTag);
+ XMLFreeTag(tmpTag);
+ return -1;
+ }
+
+ tmpTag->type = kTagTypeKey;
+ tmpTag->string = string;
+ tmpTag->tag = subTag;
+ tmpTag->tagNext = 0;
+
+ *tag = tmpTag;
+
+ return length + length2;
+}
+
+//==========================================================================
+// ParseTagString
+
+static long
+ParseTagString( char * buffer, TagPtr * tag )
+{
+ long length;
+ char * string;
+ TagPtr tmpTag;
+
+ length = FixDataMatchingTag(buffer, kXMLTagString);
+ if (length == -1) return -1;
+
+ tmpTag = NewTag();
+ if (tmpTag == 0) return -1;
+
+ string = NewSymbol(buffer);
+ if (string == 0)
+ {
+ XMLFreeTag(tmpTag);
+ return -1;
+ }
+
+ tmpTag->type = kTagTypeString;
+ tmpTag->string = string;
+ tmpTag->tag = 0;
+ tmpTag->tagNext = 0;
+
+ *tag = tmpTag;
+ return length;
+}
+
+//==========================================================================
+// ParseTagInteger
+
+static long
+ParseTagInteger( char * buffer, TagPtr * tag )
+{
+ long length, integer;
+ TagPtr tmpTag;
+
+ length = FixDataMatchingTag(buffer, kXMLTagInteger);
+ if (length == -1) return -1;
+
+ tmpTag = NewTag();
+ if (tmpTag == 0) return -1;
+
+ integer = 0;
+
+ tmpTag->type = kTagTypeInteger;
+ tmpTag->string = (char *)integer;
+ tmpTag->tag = 0;
+ tmpTag->tagNext = 0;
+
+ *tag = tmpTag;
+
+ return length;
+}
+
+//==========================================================================
+// ParseTagData
+
+static long
+ParseTagData( char * buffer, TagPtr * tag )
+{
+ long length;
+ TagPtr tmpTag;
+
+ length = FixDataMatchingTag(buffer, kXMLTagData);
+ if (length == -1) return -1;
+
+ tmpTag = NewTag();
+ if (tmpTag == 0) return -1;
+
+ tmpTag->type = kTagTypeData;
+ tmpTag->string = 0;
+ tmpTag->tag = 0;
+ tmpTag->tagNext = 0;
+
+ *tag = tmpTag;
+
+ return length;
+}
+
+//==========================================================================
+// ParseTagDate
+
+static long
+ParseTagDate( char * buffer, TagPtr * tag )
+{
+ long length;
+ TagPtr tmpTag;
+
+ length = FixDataMatchingTag(buffer, kXMLTagDate);
+ if (length == -1) return -1;
+
+ tmpTag = NewTag();
+ if (tmpTag == 0) return -1;
+
+ tmpTag->type = kTagTypeDate;
+ tmpTag->string = 0;
+ tmpTag->tag = 0;
+ tmpTag->tagNext = 0;
+
+ *tag = tmpTag;
+
+ return length;
+}
+
+//==========================================================================
+// ParseTagBoolean
+
+static long
+ParseTagBoolean( char * buffer, TagPtr * tag, long type )
+{
+ TagPtr tmpTag;
+
+ tmpTag = NewTag();
+ if (tmpTag == 0) return -1;
+
+ tmpTag->type = type;
+ tmpTag->string = 0;
+ tmpTag->tag = 0;
+ tmpTag->tagNext = 0;
+
+ *tag = tmpTag;
+
+ return 0;
+}
+
+//==========================================================================
+// GetNextTag
+
+static long
+GetNextTag( char * buffer, char ** tag, long * start )
+{
+ long cnt, cnt2;
+
+ if (tag == 0) return -1;
+
+ // Find the start of the tag.
+ cnt = 0;
+ while ((buffer[cnt] != '\0') && (buffer[cnt] != '<')) cnt++;
+ if (buffer[cnt] == '\0') return -1;
+
+ // Find the end of the tag.
+ cnt2 = cnt + 1;
+ while ((buffer[cnt2] != '\0') && (buffer[cnt2] != '>')) cnt2++;
+ if (buffer[cnt2] == '\0') return -1;
+
+ // Fix the tag data.
+ *tag = buffer + cnt + 1;
+ buffer[cnt2] = '\0';
+ if (start) *start = cnt;
+
+ return cnt2 + 1;
+}
+
+//==========================================================================
+// FixDataMatchingTag
+// Modifies 'buffer' to add a '\0' at the end of the tag matching 'tag'.
+// Returns the length of the data found, counting the end tag,
+// or -1 if the end tag was not found.
+
+static long
+FixDataMatchingTag( char * buffer, char * tag )
+{
+ long length, start, stop;
+ char * endTag;
+
+ start = 0;
+ while (1)
+ {
+ length = GetNextTag(buffer + start, &endTag, &stop);
+ if (length == -1) return -1;
+
+ if ((*endTag == '/') && !strcmp(endTag + 1, tag)) break;
+ start += length;
+ }
+
+ buffer[start + stop] = '\0';
+
+ return start + length;
+}
+
+//==========================================================================
+// NewTag
+
+#define kTagsPerBlock (0x1000)
+
+static TagPtr gTagsFree;
+
+static TagPtr
+NewTag( void )
+{
+ long cnt;
+ TagPtr tag;
+
+ if (gTagsFree == 0)
+ {
+#if USEMALLOC
+ tag = (TagPtr)malloc(kTagsPerBlock * sizeof(Tag));
+#else
+ tag = (TagPtr)AllocateBootXMemory(kTagsPerBlock * sizeof(Tag));
+#endif
+ if (tag == 0) return 0;
+
+ // Initalize the new tags.
+ for (cnt = 0; cnt < kTagsPerBlock; cnt++)
+ {
+ tag[cnt].type = kTagTypeNone;
+ tag[cnt].string = 0;
+ tag[cnt].tag = 0;
+ tag[cnt].tagNext = tag + cnt + 1;
+ }
+ tag[kTagsPerBlock - 1].tagNext = 0;
+
+ gTagsFree = tag;
+ }
+
+ tag = gTagsFree;
+ gTagsFree = tag->tagNext;
+
+ return tag;
+}
+
+//==========================================================================
+// XMLFreeTag
+
+void
+XMLFreeTag( TagPtr tag )
+{
+#if DOFREE
+ if (tag == 0) return;
+
+ if (tag->string) FreeSymbol(tag->string);
+
+ XMLFreeTag(tag->tag);
+ XMLFreeTag(tag->tagNext);
+
+ // Clear and free the tag.
+ tag->type = kTagTypeNone;
+ tag->string = 0;
+ tag->tag = 0;
+ tag->tagNext = gTagsFree;
+ gTagsFree = tag;
+#else
+ return;
+#endif
+}
+
+//==========================================================================
+// Symbol object.
+
+struct Symbol
+{
+ long refCount;
+ struct Symbol *next;
+ char string[];
+};
+typedef struct Symbol Symbol, *SymbolPtr;
+
+static SymbolPtr FindSymbol(char * string, SymbolPtr * prevSymbol);
+
+static SymbolPtr gSymbolsHead;
+
+//==========================================================================
+// NewSymbol
+
+static char *
+NewSymbol( char * string )
+{
+static SymbolPtr lastGuy = 0;
+ SymbolPtr symbol;
+
+ // Look for string in the list of symbols.
+ symbol = FindSymbol(string, 0);
+
+ // Add the new symbol.
+ if (symbol == 0)
+ {
+#if USEMALLOC
+ symbol = (SymbolPtr)malloc(sizeof(Symbol) + 1 + strlen(string));
+#else
+ symbol = (SymbolPtr)AllocateBootXMemory(sizeof(Symbol) + 1 + strlen(string));
+#endif
+ if (symbol == 0) //return 0;
+ stop("NULL symbol!");
+
+ // Set the symbol's data.
+ symbol->refCount = 0;
+ strcpy(symbol->string, string);
+
+ // Add the symbol to the list.
+ symbol->next = gSymbolsHead;
+ gSymbolsHead = symbol;
+ }
+
+ // Update the refCount and return the string.
+ symbol->refCount++;
+
+ if (lastGuy && lastGuy->next != 0) stop("last guy not last!");
+ return symbol->string;
+}
+
+//==========================================================================
+// FreeSymbol
+
+#if DOFREE
+static void
+FreeSymbol( char * string )
+{
+ SymbolPtr symbol, prev;
+
+ // Look for string in the list of symbols.
+ symbol = FindSymbol(string, &prev);
+ if (symbol == 0) return;
+
+ // Update the refCount.
+ symbol->refCount--;
+
+ if (symbol->refCount != 0) return;
+
+ // Remove the symbol from the list.
+ if (prev != 0) prev->next = symbol->next;
+ else gSymbolsHead = symbol->next;
+
+ // Free the symbol's memory.
+ free(symbol);
+}
+#endif
+
+//==========================================================================
+// FindSymbol
+
+static SymbolPtr
+FindSymbol( char * string, SymbolPtr * prevSymbol )
+{
+ SymbolPtr symbol, prev;
+
+ symbol = gSymbolsHead;
+ prev = 0;
+
+ while (symbol != 0) {
+ if (!strcmp(symbol->string, string)) break;
+
+ prev = symbol;
+ symbol = symbol->next;
+ }
+
+ if ((symbol != 0) && (prevSymbol != 0)) *prevSymbol = prev;
+
+ return symbol;
+}
--- /dev/null
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef __LIBSAIO_XML_H
+#define __LIBSAIO_XML_H
+
+enum {
+ kTagTypeNone = 0,
+ kTagTypeDict,
+ kTagTypeKey,
+ kTagTypeString,
+ kTagTypeInteger,
+ kTagTypeData,
+ kTagTypeDate,
+ kTagTypeFalse,
+ kTagTypeTrue,
+ kTagTypeArray
+};
+
+#define kXMLTagPList "plist "
+#define kXMLTagDict "dict"
+#define kXMLTagKey "key"
+#define kXMLTagString "string"
+#define kXMLTagInteger "integer"
+#define kXMLTagData "data"
+#define kXMLTagDate "date"
+#define kXMLTagFalse "false/"
+#define kXMLTagTrue "true/"
+#define kXMLTagArray "array"
+
+
+#define kPropCFBundleIdentifier ("CFBundleIdentifier")
+#define kPropCFBundleExecutable ("CFBundleExecutable")
+#define kPropOSBundleRequired ("OSBundleRequired")
+#define kPropOSBundleLibraries ("OSBundleLibraries")
+#define kPropIOKitPersonalities ("IOKitPersonalities")
+#define kPropIONameMatch ("IONameMatch")
+
+struct Tag {
+ long type;
+ char *string;
+ struct Tag *tag;
+ struct Tag *tagNext;
+};
+typedef struct Tag Tag, *TagPtr;
+
+extern long gImageFirstBootXAddr;
+extern long gImageLastKernelAddr;
+
+TagPtr XMLGetProperty( TagPtr dict, const char * key );
+long XMLParseNextTag(char *buffer, TagPtr *tag);
+void XMLFreeTag(TagPtr tag);
+//==========================================================================
+// XMLParseFile
+// Expects to see one dictionary in the XML file.
+// Puts the first dictionary it finds in the
+// tag pointer and returns 0, or returns -1 if not found.
+//
+long XMLParseFile( char * buffer, TagPtr * dict );
+
+#if 0
+// BootX shim functions
+
+extern long AllocateBootXMemory( long inSize );
+extern long InitBootXMemorySupport(void);
+#endif
+
+#endif /* __LIBSAIO_XML_H */
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
SEEK_SET);
l = len;
while (l > 0) {
- long m = fread (buf, 1, (l>sizeof(buf)?sizeof(buf):l),
+ long m = fread (buf, 1, (l>(long)sizeof(buf)?(long)sizeof(buf):l),
fp);
if (!m) {
/*
};
int i;
- for (i=0; i<elements(regs); i++)
+ for (i=0; i<(int)elements(regs); i++)
if (input->basereg == regs[i]) break;
- if (i<elements(regs)) {
+ if (i<(int)elements(regs)) {
output->sib_present = FALSE;/* no SIB necessary */
output->bytes = 0; /* no offset necessary either */
output->modrm = 0xC0 | (rfield << 3) | (i/4);
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
case P_O32: slen += sprintf(output+slen, "o32 "); break;
}
- for (i = 0; i < elements(ico); i++)
+ for (i = 0; i < (int)elements(ico); i++)
if ((*p)->opcode == ico[i]) {
slen += sprintf(output+slen, "%s%s", icn[i],
whichcond(ins.condition));
break;
}
- if (i >= elements(ico))
+ if (i >= (int)elements(ico))
slen += sprintf(output+slen, "%s", insn_names[(*p)->opcode]);
colon = FALSE;
length += data - origdata; /* fix up for prefixes */
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
elements(insn_names)))>=0) {
return tv->t_type = TOKEN_INSN;
}
- for (i=0; i<elements(icn); i++)
+ for (i=0; i<(int)elements(icn); i++)
if (!strncmp(ourcopy, icn[i], strlen(icn[i]))) {
char *p = ourcopy + strlen(icn[i]);
tv->t_integer = ico[i];
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
if (lenread == 0)
eof = TRUE; /* help along systems with bad feof */
p += lenread;
- if (offset == nextsync) {
+ if (offset == (long)nextsync) {
if (synclen) {
printf("%08lX skipping 0x%lX bytes\n", offset, synclen);
offset += synclen;
while (p > q && (p - q >= INSN_MAX || lenread == 0)) {
lendis = disasm (q, outbuf, bits, offset, autosync);
if (!lendis || lendis > (p - q) ||
- lendis > nextsync-offset)
+ lendis > (int)(nextsync-offset))
lendis = eatbyte (q, outbuf);
output_ins (offset, q, lendis, outbuf);
q += lendis;
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
int i;
saa_rewind (syms);
- for (i=0; i<nsyms; i++) {
+ for (i=0; i<(int)nsyms; i++) {
struct Symbol *sym = saa_rstruct(syms);
fwritelong (sym->strpos, aoutfp);
fwritelong ((long)sym->type & ~SYM_WITH_SIZE, aoutfp);
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*/
symlen = 0;
saa_rewind (syms);
- for (i = 0; i < nsyms; i++) {
+ for (i = 0; i < (int)nsyms; i++) {
struct Symbol *sym = saa_rstruct (syms);
if (sym->segment == SECT_BSS)
sym->segment = SECT_DATA, sym->value += sdata.len;
* Write the symbol table.
*/
saa_rewind (syms);
- for (i = 0; i < nsyms; i++) {
+ for (i = 0; i < (int)nsyms; i++) {
struct Symbol *sym = saa_rstruct (syms);
fwriteshort (sym->strpos, as86fp);
fwriteshort (sym->flags, as86fp);
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
* The real symbols.
*/
saa_rewind (syms);
- for (i=0; i<nsyms; i++) {
+ for (i=0; i<(int)nsyms; i++) {
struct Symbol *sym = saa_rstruct (syms);
coff_symbol (sym->strpos == -1 ? sym->name : NULL,
sym->strpos, sym->value, sym->section,
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
while (*s) {
h += multipliers[i] * (unsigned char) (toupper(*s));
s++;
- if (++i >= sizeof(multipliers)/sizeof(*multipliers))
+ if (++i >= (int)sizeof(multipliers)/(int)sizeof(*multipliers))
i = 0;
}
h %= NHASH;
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
{
unsigned int c, j, k, jmatch, jabove;
int length;
- unsigned int even_length, word, token;
+ int even_length, word, token;
unsigned char *outorigin = out;
length = rcz_file_size(in_fd);
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*/
{
unsigned int c, j, k, jmatch, jabove;
- unsigned int length, even_length, word, token, version;
+ int length, even_length, word, token, version;
unsigned char *outorigin = out;
version = *in++;
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
The boot: prompt waits ten seconds for you to type advanced startup options.
-If you don't type anything, the computer continues starting up normally: It
+If you don't type anything, the computer continues starting up normally. It
uses the kernel and configuration files on the startup device, which it also
uses as the root device. Advanced startup options use the following syntax:
fd()mach_kernel rootdev=sd0a
If the computer won't start up properly, you may be able to start it up using
-the drivers you used to install Rhapsody. Type: config=Default
+safe mode. Type: -f
To continue starting up using standard options, press Return.
"Languages" = "English French German";
-"English" = "Type 1 to use the English language and USA keyboard while installing Rhapsody.\n";
-"French" = "Tapez 2 pour installer Rhapsody avec un clavier et des messages francais.\n";
-"German" = "Eingabe 3 fuer Rhapsody-Installation mit deutscher Sprache und Tastatur.\n";
+"English" = "Type 1 to use the English language and USA keyboard while installing Darwin.\n";
+"French" = "Tapez 2 pour installer Darwin avec un clavier et des messages francais.\n";
+"German" = "Eingabe 3 fuer Darwin-Installation mit deutscher Sprache und Tastatur.\n";
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
-#import "kernBootStruct.h"
+#import <pexpert/i386/boot.h>
main()
{
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
SIG = $(SYMROOT)/sig
SIG_OBJS = sig.o
-DIRS_NEEDED = $(OBJROOT) $(SYMROOT) $(LANGDIR) $(LOCALBIN)
+DIRS_NEEDED = $(OBJROOT) $(SYMROOT) $(LANGDIR)
#BITMAPS = Panel.image Wait1.image Wait2.image Wait3.image
BITMAPS = Panel.image
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <mach/mach_error.h>
#include <sys/file.h>
#include <mach-o/loader.h>
-#include <architecture/byte_order.h>
+#include <libkern/OSByteOrder.h>
#include <unistd.h>
int infile, outfile;
)
{
if (swap_ends)
- return NXSwapLong(x);
+ return OSSwapInt32(x);
else
return x;
}
perror("read mach header");
exit(1);
}
- if (nc < sizeof (mh)) {
+ if (nc < (int)sizeof (mh)) {
fprintf(stderr, "read mach header: premature EOF %d\n", nc);
exit(1);
}
perror("read load commands");
exit(1);
}
- if (nc < swap(mh.sizeofcmds)) {
+ if (nc < (int)swap(mh.sizeofcmds)) {
fprintf(stderr, "read load commands: premature EOF %d\n", nc);
exit(1);
}
perror("read segment data");
exit(1);
}
- if (nc < swap(scp->filesize)) {
+ if (nc < (int)swap(scp->filesize)) {
fprintf(stderr, "read segment data: premature EOF %d\n", nc);
exit(1);
}
nc = write(outfile, (void *)data, vmsize);
- if (nc < vmsize) {
+ if (nc < (int)vmsize) {
perror("write segment data");
exit(1);
}
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
*
* @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.
+ * Copyright (c) 1999-2003 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 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
*
* The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef lint
-static char rcsid[] = "$Header: /cvs/Darwin/boot/i386/util/tif_packbits.c,v 1.1.1.2 1999/08/04 21:17:19 wsanchez Exp $";
+static char rcsid[] = "$Header: /cvs/root/boot/i386/util/tif_packbits.c,v 1.1.1.2 1999/08/04 21:17:19 wsanchez Exp $";
#endif
/*