mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-23 04:09:43 +00:00
Remove architecture from Darling repo. Add symbol link to architecture submodule.
This commit is contained in:
parent
5a7959ec6e
commit
8f75c8c542
1
basic-headers/architecture
Symbolic link
1
basic-headers/architecture
Symbolic link
@ -0,0 +1 @@
|
||||
../src/external/architecture/
|
1
basic-headers/architecture/.gitignore
vendored
1
basic-headers/architecture/.gitignore
vendored
@ -1 +0,0 @@
|
||||
*~
|
@ -1,367 +0,0 @@
|
||||
APPLE PUBLIC SOURCE LICENSE
|
||||
Version 2.0 - August 6, 2003
|
||||
|
||||
Please read this License carefully before downloading this software.
|
||||
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
|
||||
necessary to use, reproduce and/or distribute the Original Code
|
||||
without infringement; and (b) in the case where You are the grantor of
|
||||
rights, (i) claims of patents that are now or hereafter acquired,
|
||||
owned by or assigned to You and (ii) that cover subject matter in Your
|
||||
Modifications, taken alone or in combination with Original Code.
|
||||
|
||||
1.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 "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 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
|
||||
statements that contains any part of Covered Code.
|
||||
|
||||
1.7 "Original Code" means (a) the Source Code of a program or other
|
||||
work as originally made available by Apple under this License,
|
||||
including the Source Code of any updates or upgrades to such programs
|
||||
or works made available by Apple under this License, and that has been
|
||||
expressly identified by Apple as such in the header file(s) of such
|
||||
work; and (b) the object code compiled from such Source Code and
|
||||
originally made available by Apple under this License.
|
||||
|
||||
1.8 "Source Code" means the human readable form of a program or other
|
||||
work that is suitable for making modifications to it, including all
|
||||
modules it contains, plus any associated interface definition files,
|
||||
scripts used to control compilation and installation of an executable
|
||||
(object code).
|
||||
|
||||
1.9 "You" or "Your" means an individual or a legal entity exercising
|
||||
rights under this License. For legal entities, "You" or "Your"
|
||||
includes any entity which controls, is controlled by, or is under
|
||||
common control with, You, where "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of fifty percent
|
||||
(50%) or more of the outstanding shares or beneficial ownership of
|
||||
such entity.
|
||||
|
||||
2. Permitted Uses; Conditions & Restrictions. Subject to the terms
|
||||
and conditions of this License, Apple hereby grants You, effective on
|
||||
the date You accept this License and download the Original Code, a
|
||||
world-wide, royalty-free, non-exclusive license, to the extent of
|
||||
Apple's Applicable Patent Rights and copyrights covering the Original
|
||||
Code, to do the following:
|
||||
|
||||
2.1 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.
|
||||
|
||||
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 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 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:
|
||||
|
||||
(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; 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.
|
||||
Government End Users acquire Covered Code with only those rights set
|
||||
forth herein.
|
||||
|
||||
13.2 Relationship of Parties. This License will not be construed as
|
||||
creating an agency, partnership, joint venture or any other form of
|
||||
legal association between 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
|
||||
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 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
|
||||
jurisdiction finds any provision of this License, or portion thereof,
|
||||
to be unenforceable, that provision of the License will be enforced to
|
||||
the maximum extent permissible so as to effect the economic benefits
|
||||
and intent of the parties, and the remainder of this License will
|
||||
continue in full force and effect. (b) Notwithstanding the foregoing,
|
||||
if applicable law prohibits or restricts You from fully and/or
|
||||
specifically complying with Sections 2 and/or 3 or prevents the
|
||||
enforceability of either of those Sections, this License will
|
||||
immediately terminate and You must immediately discontinue any use of
|
||||
the Covered Code and destroy all copies of it that are in your
|
||||
possession or control.
|
||||
|
||||
13.6 Dispute Resolution. Any litigation or other dispute resolution
|
||||
between You and Apple relating to this License shall take place in the
|
||||
Northern District of California, and You and Apple hereby consent to
|
||||
the personal jurisdiction of, and venue in, the state and federal
|
||||
courts within that District with respect to this License. The
|
||||
application of the United Nations Convention on Contracts for the
|
||||
International Sale of Goods is expressly excluded.
|
||||
|
||||
13.7 Entire Agreement; Governing Law. This License constitutes the
|
||||
entire agreement between the parties with respect to the subject
|
||||
matter hereof. This License shall be governed by the laws of the
|
||||
United States and the State of California, except that body of
|
||||
California law concerning conflicts of law.
|
||||
|
||||
Where You are located in the province of Quebec, Canada, the following
|
||||
clause applies: The parties hereby confirm that they have requested
|
||||
that this License and all related documents be drafted in English. Les
|
||||
parties ont exige que le present contrat et tous les documents
|
||||
connexes soient rediges en anglais.
|
||||
|
||||
EXHIBIT A.
|
||||
|
||||
"Portions Copyright (c) 1999-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."
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1996 NeXT Software, Inc.
|
||||
*
|
||||
* Natural alignment of shorts and longs.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 2 Sept 1992 Brian Raymor at NeXT
|
||||
* Moved over to architecture.
|
||||
* 18 August 1992 Jack Greenfield at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#if defined (__i386__)
|
||||
#include "architecture/i386/alignment.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
|
@ -1,327 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 _ARCH_ARM_ASM_HELP_H_
|
||||
#define _ARCH_ARM_ASM_HELP_H_
|
||||
|
||||
#include <architecture/arm/reg_help.h>
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
#if defined(__arm__)
|
||||
|
||||
#define ALIGN \
|
||||
.align 2
|
||||
|
||||
#define ROUND_TO_STACK(len) \
|
||||
(((len) + STACK_INCR - 1) / STACK_INCR * STACK_INCR)
|
||||
|
||||
/*
|
||||
* Macros for declaring procedures
|
||||
*
|
||||
* Use of these macros allows ctags to have a predictable way
|
||||
* to find various types of declarations. They also simplify
|
||||
* inserting appropriate symbol table information.
|
||||
*
|
||||
* NOTE: these simple stubs will be replaced with more
|
||||
* complicated versions once we know what the linker and gdb
|
||||
* will require as far as register use masks and frame declarations.
|
||||
* These macros may also be ifdef'ed in the future to contain profiling
|
||||
* code.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* TEXT -- declare start of text segment
|
||||
*/
|
||||
#define TEXT \
|
||||
.text
|
||||
|
||||
/*
|
||||
* DATA -- declare start of data segment
|
||||
*/
|
||||
#define DATA \
|
||||
.data
|
||||
|
||||
/*
|
||||
* LEAF -- declare global leaf procedure
|
||||
* NOTE: Control SHOULD NOT FLOW into a LEAF! A LEAF should only
|
||||
* be jumped to. (A leaf may do an align.) Use a LABEL() if you
|
||||
* need control to flow into the label.
|
||||
*/
|
||||
#define LEAF(name, localvarsize) \
|
||||
.globl name ;\
|
||||
ALIGN ;\
|
||||
name:
|
||||
|
||||
/*
|
||||
* X_LEAF -- declare alternate global label for leaf
|
||||
*/
|
||||
#define X_LEAF(name, value) \
|
||||
.globl name ;\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_LEAF -- declare private leaf procedure
|
||||
*/
|
||||
#define P_LEAF(name, localvarsize) \
|
||||
ALIGN ;\
|
||||
name:
|
||||
|
||||
/*
|
||||
* LABEL -- declare a global code label
|
||||
* MUST be used (rather than LEAF, NESTED, etc) if control
|
||||
* "flows into" the label.
|
||||
*/
|
||||
#define LABEL(name) \
|
||||
.globl name ;\
|
||||
name:
|
||||
|
||||
/*
|
||||
* NESTED -- declare procedure that invokes other procedures
|
||||
*/
|
||||
#define NESTED(name, localvarsize) \
|
||||
.globl name ;\
|
||||
ALIGN ;\
|
||||
name:
|
||||
|
||||
/*
|
||||
* X_NESTED -- declare alternate global label for nested proc
|
||||
*/
|
||||
#define X_NESTED(name, value) \
|
||||
.globl name ;\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_NESTED -- declare private nested procedure
|
||||
*/
|
||||
#define P_NESTED(name, localvarsize) \
|
||||
ALIGN ;\
|
||||
name:
|
||||
|
||||
/*
|
||||
* END -- mark end of procedure
|
||||
*/
|
||||
#define END(name)
|
||||
|
||||
/*
|
||||
* Storage definition macros
|
||||
* The main purpose of these is to allow an easy handle for ctags
|
||||
*/
|
||||
|
||||
/*
|
||||
* IMPORT -- import symbol
|
||||
*/
|
||||
#define IMPORT(name) \
|
||||
.reference name
|
||||
|
||||
/*
|
||||
* ABS -- declare global absolute symbol
|
||||
*/
|
||||
#define ABS(name, value) \
|
||||
.globl name ;\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_ABS -- declare private absolute symbol
|
||||
*/
|
||||
#define P_ABS(name, value) \
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* EXPORT -- declare global label for data
|
||||
*/
|
||||
#define EXPORT(name) \
|
||||
.globl name ;\
|
||||
name:
|
||||
|
||||
/*
|
||||
* BSS -- declare global zero'ed storage
|
||||
*/
|
||||
#define BSS(name,size) \
|
||||
.comm name,size
|
||||
|
||||
/*
|
||||
* P_BSS -- declare private zero'ed storage
|
||||
*/
|
||||
#define P_BSS(name,size) \
|
||||
.lcomm name,size
|
||||
|
||||
#if defined(__DYNAMIC__)
|
||||
#define GET_ADDRESS(reg,var) \
|
||||
ldr reg, 4f ;\
|
||||
3: ldr reg, [pc, reg] ;\
|
||||
b 5f ;\
|
||||
4: .long 6f - (3b + 8) ;\
|
||||
5: ;\
|
||||
.non_lazy_symbol_pointer ;\
|
||||
6: ;\
|
||||
.indirect_symbol var ;\
|
||||
.long 0 ;\
|
||||
.text ;\
|
||||
.align 2
|
||||
#else
|
||||
#define GET_ADDRESS(reg,var) \
|
||||
ldr reg, 3f ;\
|
||||
b 4f ;\
|
||||
3: .long var ;\
|
||||
4:
|
||||
#endif
|
||||
|
||||
#if defined(__DYNAMIC__)
|
||||
#define BRANCH_EXTERNAL(var) \
|
||||
GET_ADDRESS(ip, var) ;\
|
||||
bx ip
|
||||
#else
|
||||
#define BRANCH_EXTERNAL(var) ;\
|
||||
b var
|
||||
#endif
|
||||
|
||||
#if defined(__DYNAMIC__)
|
||||
#define CALL_EXTERNAL(var) \
|
||||
GET_ADDRESS(ip,var) ;\
|
||||
mov lr, pc ;\
|
||||
bx ip
|
||||
#else
|
||||
#define CALL_EXTERNAL(var) \
|
||||
bl var
|
||||
#endif
|
||||
|
||||
#define ENTRY_POINT(name) \
|
||||
.align 2 ;\
|
||||
.globl name ;\
|
||||
.text ;\
|
||||
name:
|
||||
|
||||
#else /* defined(__arm___) */
|
||||
|
||||
#if defined(__arm64__)
|
||||
|
||||
#define ALIGN .align 2
|
||||
|
||||
#define ROUND_TO_STACK(len) (((len) + (STACK_INCR - 1)) & ~(STACK_INCR - 1))
|
||||
|
||||
#define TEXT .text
|
||||
|
||||
#define DATA .data
|
||||
|
||||
#define LEAF(name, localvarsize) \
|
||||
.globl name %%\
|
||||
ALIGN %%\
|
||||
name:
|
||||
|
||||
#define X_LEAF(name, value) \
|
||||
.globl name %%\
|
||||
.set name, value
|
||||
|
||||
#define P_LEAF(name, localvarsize) \
|
||||
ALIGN %%\
|
||||
name:
|
||||
|
||||
|
||||
#define LABEL(name) \
|
||||
.globl name %%\
|
||||
name:
|
||||
|
||||
#define NESTED(name, localvarsize) \
|
||||
.globl name %%\
|
||||
ALIGN %%\
|
||||
name:
|
||||
|
||||
#define X_NESTED(name, value) \
|
||||
.globl name %%\
|
||||
.set name, value
|
||||
|
||||
#define P_NESTED(name, localvarsize)\
|
||||
ALIGN %%\
|
||||
name:
|
||||
|
||||
#define END(name)
|
||||
|
||||
#define IMPORT(name) \
|
||||
.reference name
|
||||
|
||||
#define ABS(name, value) \
|
||||
.globl name %%\
|
||||
.set name, value
|
||||
|
||||
#define P_ABS(name, value) \
|
||||
.set name, value
|
||||
|
||||
#define EXPORT(name) \
|
||||
.globl name %%\
|
||||
name:
|
||||
|
||||
#define BSS(name, size) \
|
||||
.comm name, size
|
||||
|
||||
#define P_BSS(name, size) \
|
||||
.lcomm name, size
|
||||
|
||||
|
||||
#if __LP64__
|
||||
#if defined(__DYNAMIC__)
|
||||
#define GET_ADDRESS(wreg, xreg, var) \
|
||||
adrp xreg, var@gotpage %%\
|
||||
ldr xreg, [xreg, var@gotpageoff]
|
||||
#else /* __DYNAMIC__ */
|
||||
#define GET_ADDRESS(wreg, xreg, var) \
|
||||
adrp xreg, var@page %%\
|
||||
add xreg, xreg, var@pageoff
|
||||
#endif /* __DYNAMIC__ */
|
||||
#else /* __LP64__ */
|
||||
/*
|
||||
* The adrp instruction can't encode 'w' registers which is why the 'x' register
|
||||
* is used in the below LP32 variants of GET_ADDRESS().
|
||||
*/
|
||||
#if defined(__DYNAMIC__)
|
||||
#define GET_ADDRESS(wreg, xreg, var) \
|
||||
adrp xreg, var@gotpage %%\
|
||||
ldr wreg, [xreg, var@gotpageoff]
|
||||
#else /* __DYNAMIC__ */
|
||||
#define GET_ADDRESS(wreg, xreg, var) \
|
||||
adrp xreg, var@page %%\
|
||||
add wreg, wreg, var@pageoff
|
||||
#endif /* __DYNAMIC__ */
|
||||
#endif /* __LP64__ */
|
||||
|
||||
/* The linker will link to stubs in the DYNAMIC case */
|
||||
#define BRANCH_EXTERNAL(var) \
|
||||
b var
|
||||
|
||||
/* The linker will link to stubs in the DYNAMIC case */
|
||||
#define CALL_EXTERNAL(var) \
|
||||
bl var
|
||||
|
||||
#define ENTRY_POINT(name) \
|
||||
.align 2 %%\
|
||||
.globl name %%\
|
||||
.text %%\
|
||||
name:
|
||||
#else /* defined(__arm64__) */
|
||||
#error Unknown architecture.
|
||||
#endif /* defined(__arm64__) */
|
||||
#endif /* defined(__arm__) */
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* _ARCH_ARM_ASM_HELP_H_ */
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 2007 Apple Computer, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_ARM_BYTE_ORDER_H_
|
||||
#define _ARCH_ARM_BYTE_ORDER_H_
|
||||
|
||||
#include <architecture/byte_order.h>
|
||||
|
||||
#endif /* _ARCH_ARM_BYTE_ORDER_H_ */
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004, 2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1991 NeXT Software, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/ppc/cframe.h
|
||||
* Author: Mike DeMoney, NeXT Software, Inc.
|
||||
*
|
||||
* This include file defines C calling sequence defines
|
||||
* for ppc port.
|
||||
*
|
||||
* HISTORY
|
||||
* 20-May-97 Umesh Vaishampayan (umeshv@apple.com)
|
||||
* Added C_RED_ZONE.
|
||||
* 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
|
||||
* Ported from m98k.
|
||||
* 11-June-91 Mike DeMoney (mike@next.com)
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_ARM_CFRAME_H_
|
||||
#define _ARCH_ARM_CFRAME_H_
|
||||
|
||||
/* Note that these values are copies of the somewhat more authoritative
|
||||
* values in <architecture/ppc/mode_independent_asm.h>. We do not
|
||||
* include that file to avoid breaking legacy clients due to name
|
||||
* collisions.
|
||||
*
|
||||
* Note also that C_ARGSAVE_LEN isn't well defined or useful in PPC.
|
||||
* Most legacy uses of it are assuming it is the minimum stack frame
|
||||
* size, which is what we define it to be.
|
||||
*/
|
||||
#if defined(__arm__)
|
||||
#define C_ARGSAVE_LEN 32 /* "minimum arg save area" (but see above) */
|
||||
#define C_STACK_ALIGN 16 /* stack must be 16 byte aligned */
|
||||
#define C_RED_ZONE 224 /* 224 bytes to skip over saved registers */
|
||||
#elif defined (__arm64__)
|
||||
#define C_STACK_ALIGN 16 /* stack must be 32 byte aligned */
|
||||
#else /* !defined(__arm__) && !defined(__arm64__) */
|
||||
#error Unknown architecture
|
||||
#endif /* !defined(__arm__) && !defined(__arm64__) */
|
||||
|
||||
#endif /* _ARCH_ARM_CFRAME_H_ */
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 _ARCH_ARM_REG_HELP_H_
|
||||
#define _ARCH_ARM_REG_HELP_H_
|
||||
|
||||
/* Bitfield definition aid */
|
||||
#define BITS_WIDTH(msb, lsb) ((msb)-(lsb)+1)
|
||||
#define BIT_WIDTH(pos) (1) /* mostly to record the position */
|
||||
|
||||
/* Mask creation */
|
||||
#define MKMASK(width, offset) (((unsigned)-1)>>(32-(width))<<(offset))
|
||||
#define BITSMASK(msb, lsb) MKMASK(BITS_WIDTH(msb, lsb), lsb & 0x1f)
|
||||
#define BITMASK(pos) MKMASK(BIT_WIDTH(pos), pos & 0x1f)
|
||||
|
||||
/* Register addresses */
|
||||
#if __ASSEMBLER__
|
||||
# define REG_ADDR(type, addr) (addr)
|
||||
#else /* __ASSEMBLER__ */
|
||||
# define REG_ADDR(type, addr) (*(volatile type *)(addr))
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
/* Cast a register to be an unsigned */
|
||||
#if defined(__arm__)
|
||||
#define CONTENTS(foo) (*(unsigned*) &(foo))
|
||||
/* Stack pointer must always be a multiple of 4 */
|
||||
#define STACK_INCR 4
|
||||
#elif defined(__arm64__)
|
||||
#define CONTENTS(foo) (*(unsigned long long*) &(foo))
|
||||
/* Stack pointer must always be a multiple of 16 */
|
||||
#define STACK_INCR 16
|
||||
#else /* !defined(__arm__) && !defined(__arm64__) */
|
||||
#error Unknown architecture.
|
||||
#endif /* !defined(__arm__) && !defined(__arm64__) */
|
||||
|
||||
#define ROUND_FRAME(x) ((((unsigned)(x)) + STACK_INCR - 1) & ~(STACK_INCR-1))
|
||||
|
||||
/* STRINGIFY -- perform all possible substitutions, then stringify */
|
||||
#define __STR(x) #x /* just a helper macro */
|
||||
#define STRINGIFY(x) __STR(x)
|
||||
|
||||
#endif /* _ARCH_ARM_REG_HELP_H_ */
|
@ -1,381 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Byte ordering conversion.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ARCHITECTURE_BYTE_ORDER_H_
|
||||
#define _ARCHITECTURE_BYTE_ORDER_H_
|
||||
|
||||
/*
|
||||
* Please note that the byte ordering functions in this file are deprecated.
|
||||
* A replacement API exists in libkern/OSByteOrder.h
|
||||
*/
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
typedef unsigned long NXSwappedFloat;
|
||||
typedef unsigned long long NXSwappedDouble;
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapShort(
|
||||
unsigned short inv
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapInt16((uint16_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapInt(
|
||||
unsigned int inv
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapInt32((uint32_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapLong(
|
||||
unsigned long inv
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapInt32((uint32_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapLongLong(
|
||||
unsigned long long inv
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapInt64((uint64_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedFloat
|
||||
NXConvertHostFloatToSwapped(float x)
|
||||
{
|
||||
union fconv {
|
||||
float number;
|
||||
NXSwappedFloat sf;
|
||||
} u;
|
||||
u.number = x;
|
||||
return u.sf;
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
float
|
||||
NXConvertSwappedFloatToHost(NXSwappedFloat x)
|
||||
{
|
||||
union fconv {
|
||||
float number;
|
||||
NXSwappedFloat sf;
|
||||
} u;
|
||||
u.sf = x;
|
||||
return u.number;
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedDouble
|
||||
NXConvertHostDoubleToSwapped(double x)
|
||||
{
|
||||
union dconv {
|
||||
double number;
|
||||
NXSwappedDouble sd;
|
||||
} u;
|
||||
u.number = x;
|
||||
return u.sd;
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
double
|
||||
NXConvertSwappedDoubleToHost(NXSwappedDouble x)
|
||||
{
|
||||
union dconv {
|
||||
double number;
|
||||
NXSwappedDouble sd;
|
||||
} u;
|
||||
u.sd = x;
|
||||
return u.number;
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedFloat
|
||||
NXSwapFloat(NXSwappedFloat x)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedDouble
|
||||
NXSwapDouble(NXSwappedDouble x)
|
||||
{
|
||||
return (NXSwappedDouble)OSSwapInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
/*
|
||||
* Identify the byte order
|
||||
* of the current host.
|
||||
*/
|
||||
|
||||
enum NXByteOrder {
|
||||
NX_UnknownByteOrder,
|
||||
NX_LittleEndian,
|
||||
NX_BigEndian
|
||||
};
|
||||
|
||||
static __inline__
|
||||
enum NXByteOrder
|
||||
NXHostByteOrder(void)
|
||||
{
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
return NX_LittleEndian;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
return NX_BigEndian;
|
||||
#else
|
||||
return NX_UnknownByteOrder;
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapBigShortToHost(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapBigToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapBigIntToHost(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapBigToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapBigLongToHost(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapBigToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapBigLongLongToHost(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapBigToHostInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
double
|
||||
NXSwapBigDoubleToHost(
|
||||
NXSwappedDouble x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapBigToHostInt64((uint64_t)x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
float
|
||||
NXSwapBigFloatToHost(
|
||||
NXSwappedFloat x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapBigToHostInt32((uint32_t)x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapHostShortToBig(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapHostToBigInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapHostIntToBig(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapHostToBigInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapHostLongToBig(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapHostToBigInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapHostLongLongToBig(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapHostToBigInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedDouble
|
||||
NXSwapHostDoubleToBig(
|
||||
double x
|
||||
)
|
||||
{
|
||||
return (NXSwappedDouble)OSSwapHostToBigInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedFloat
|
||||
NXSwapHostFloatToBig(
|
||||
float x
|
||||
)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapHostToBigInt32((uint32_t)NXConvertHostFloatToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapLittleShortToHost(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapLittleToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapLittleIntToHost(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapLittleLongToHost(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapLittleLongLongToHost(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapLittleToHostInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
double
|
||||
NXSwapLittleDoubleToHost(
|
||||
NXSwappedDouble x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapLittleToHostInt64((uint64_t)x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
float
|
||||
NXSwapLittleFloatToHost(
|
||||
NXSwappedFloat x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapLittleToHostInt32((uint32_t)x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapHostShortToLittle(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapHostToLittleInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapHostIntToLittle(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapHostToLittleInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapHostLongToLittle(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapHostToLittleInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapHostLongLongToLittle(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapHostToLittleInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedDouble
|
||||
NXSwapHostDoubleToLittle(
|
||||
double x
|
||||
)
|
||||
{
|
||||
return (NXSwappedDouble)OSSwapHostToLittleInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedFloat
|
||||
NXSwapHostFloatToLittle(
|
||||
float x
|
||||
)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapHostToLittleInt32((uint32_t)NXConvertHostFloatToSwapped(x));
|
||||
}
|
||||
|
||||
#endif /* _ARCHITECTURE_BYTE_ORDER_H_ */
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Natural alignment of shorts and longs (for i386)
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 2 Sept 1992 Brian Raymor at NeXT
|
||||
* Moved over to architecture.
|
||||
* 18 August 1992 Jack Greenfield at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_ALIGNMENT_H_
|
||||
#define _ARCH_I386_ALIGNMENT_H_
|
||||
|
||||
/*
|
||||
* NOP
|
||||
*/
|
||||
__inline__ static unsigned short
|
||||
get_align_short(void *ivalue)
|
||||
{
|
||||
return *((unsigned short *) ivalue);
|
||||
}
|
||||
|
||||
__inline__ static unsigned short
|
||||
put_align_short(unsigned short ivalue, void *ovalue)
|
||||
{
|
||||
return *((unsigned short *) ovalue) = ivalue;
|
||||
}
|
||||
|
||||
/*
|
||||
* NOP
|
||||
*/
|
||||
__inline__ static unsigned long
|
||||
get_align_long(void *ivalue)
|
||||
{
|
||||
return *((unsigned long *) ivalue);
|
||||
}
|
||||
|
||||
__inline__ static unsigned long
|
||||
put_align_long(unsigned long ivalue, void *ovalue)
|
||||
{
|
||||
return *((unsigned long *) ovalue) = ivalue;
|
||||
}
|
||||
|
||||
#endif /* _ARCH_I386_ALIGNMENT_H_ */
|
@ -1,398 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1991 NeXT Computer, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/i386/asm_help.h
|
||||
* Author: Mike DeMoney, NeXT Computer, Inc.
|
||||
* Modified for i386 by: Bruce Martin, NeXT Computer, Inc.
|
||||
*
|
||||
* This header file defines macros useful when writing assembly code
|
||||
* for the Intel i386 family processors.
|
||||
*
|
||||
* HISTORY
|
||||
* 10-Mar-92 Bruce Martin (bmartin@next.com)
|
||||
* Adapted to i386
|
||||
* 23-Jan-91 Mike DeMoney (mike@next.com)
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_ASM_HELP_H_
|
||||
#define _ARCH_I386_ASM_HELP_H_
|
||||
|
||||
#include <architecture/i386/reg_help.h>
|
||||
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
#define ALIGN \
|
||||
.align 2, 0x90
|
||||
|
||||
#define ROUND_TO_STACK(len) \
|
||||
(((len) + STACK_INCR - 1) / STACK_INCR * STACK_INCR)
|
||||
|
||||
#ifdef notdef
|
||||
#if defined(__i386__)
|
||||
#define CALL_MCOUNT \
|
||||
pushl %ebp ;\
|
||||
movl %esp, %ebp ;\
|
||||
.data ;\
|
||||
1: .long 0 ;\
|
||||
.text ;\
|
||||
lea 9b,%edx ;\
|
||||
call mcount ;\
|
||||
popl %ebp ;
|
||||
#elif defined(__x86_64__)
|
||||
#define CALL_MCOUNT \
|
||||
pushq %rbp ;\
|
||||
movq %rsp, %rbp ;\
|
||||
.data ;\
|
||||
1: .quad 0 ;\
|
||||
.text ;\
|
||||
lea 9b,%r13 ;\
|
||||
call mcount ;\
|
||||
popq %rbp ;
|
||||
#endif
|
||||
#else
|
||||
#define CALL_MCOUNT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prologue for functions that may call other functions. Saves
|
||||
* registers and sets up a C frame.
|
||||
*/
|
||||
#if defined(__i386__)
|
||||
#define NESTED_FUNCTION_PROLOGUE(localvarsize) \
|
||||
.set L__framesize,ROUND_TO_STACK(localvarsize) ;\
|
||||
.set L__nested_function, 1 ;\
|
||||
CALL_MCOUNT \
|
||||
.if L__framesize ;\
|
||||
pushl %ebp ;\
|
||||
movl %esp, %ebp ;\
|
||||
subl $L__framesize, %esp ;\
|
||||
.endif ;\
|
||||
pushl %edi ;\
|
||||
pushl %esi ;\
|
||||
pushl %ebx
|
||||
#elif defined(__x86_64__)
|
||||
#define NESTED_FUNCTION_PROLOGUE(localvarsize) \
|
||||
.set L__framesize,ROUND_TO_STACK(localvarsize) ;\
|
||||
.set L__nested_function, 1 ;\
|
||||
CALL_MCOUNT \
|
||||
.if L__framesize ;\
|
||||
pushq %rbp ;\
|
||||
movq %rsp, %rbp ;\
|
||||
subq $L__framesize, %rsp ;\
|
||||
.endif ;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prologue for functions that do not call other functions. Does not
|
||||
* save registers (this is the functions responsibility). Does set
|
||||
* up a C frame.
|
||||
*/
|
||||
#if defined(__i386__)
|
||||
#define LEAF_FUNCTION_PROLOGUE(localvarsize) \
|
||||
.set L__framesize,ROUND_TO_STACK(localvarsize) ;\
|
||||
.set L__nested_function, 0 ;\
|
||||
CALL_MCOUNT \
|
||||
.if L__framesize ;\
|
||||
pushl %ebp ;\
|
||||
movl %esp, %ebp ;\
|
||||
subl $L__framesize, %esp ;\
|
||||
.endif
|
||||
#elif defined(__x86_64__)
|
||||
#define LEAF_FUNCTION_PROLOGUE(localvarsize) \
|
||||
.set L__framesize,ROUND_TO_STACK(localvarsize) ;\
|
||||
.set L__nested_function, 0 ;\
|
||||
CALL_MCOUNT \
|
||||
.if L__framesize ;\
|
||||
pushq %rbp ;\
|
||||
movq %rsp, %rbp ;\
|
||||
subq $L__framesize, %rsp ;\
|
||||
.endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Epilogue for any function.
|
||||
*
|
||||
* We assume that all Leaf functions will be responsible for saving any
|
||||
* local registers they clobber.
|
||||
*/
|
||||
#if defined(__i386__)
|
||||
#define FUNCTION_EPILOGUE \
|
||||
.if L__nested_function ;\
|
||||
popl %ebx ;\
|
||||
popl %esi ;\
|
||||
popl %edi ;\
|
||||
.endif ;\
|
||||
.if L__framesize ;\
|
||||
movl %ebp, %esp ;\
|
||||
popl %ebp ;\
|
||||
.endif ;\
|
||||
ret
|
||||
#elif defined(__x86_64__)
|
||||
#define FUNCTION_EPILOGUE \
|
||||
.if L__framesize ;\
|
||||
movq %rbp, %rsp ;\
|
||||
popq %rbp ;\
|
||||
.endif ;\
|
||||
ret
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for declaring procedures
|
||||
*
|
||||
* Use of these macros allows ctags to have a predictable way
|
||||
* to find various types of declarations. They also simplify
|
||||
* inserting appropriate symbol table information.
|
||||
*
|
||||
* NOTE: these simple stubs will be replaced with more
|
||||
* complicated versions once we know what the linker and gdb
|
||||
* will require as far as register use masks and frame declarations.
|
||||
* These macros may also be ifdef'ed in the future to contain profiling
|
||||
* code.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* TEXT -- declare start of text segment
|
||||
*/
|
||||
#define TEXT \
|
||||
.text
|
||||
|
||||
/*
|
||||
* DATA -- declare start of data segment
|
||||
*/
|
||||
#define DATA \
|
||||
.data
|
||||
|
||||
/*
|
||||
* LEAF -- declare global leaf procedure
|
||||
* NOTE: Control SHOULD NOT FLOW into a LEAF! A LEAF should only
|
||||
* be jumped to. (A leaf may do an align.) Use a LABEL() if you
|
||||
* need control to flow into the label.
|
||||
*/
|
||||
#define LEAF(name, localvarsize) \
|
||||
.globl name ;\
|
||||
ALIGN ;\
|
||||
name: ;\
|
||||
LEAF_FUNCTION_PROLOGUE(localvarsize)
|
||||
|
||||
/*
|
||||
* X_LEAF -- declare alternate global label for leaf
|
||||
*/
|
||||
#define X_LEAF(name, value) \
|
||||
.globl name ;\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_LEAF -- declare private leaf procedure
|
||||
*/
|
||||
#define P_LEAF(name, localvarsize) \
|
||||
ALIGN ;\
|
||||
name: ;\
|
||||
LEAF_FUNCTION_PROLOGUE(localvarsize)
|
||||
|
||||
/*
|
||||
* LABEL -- declare a global code label
|
||||
* MUST be used (rather than LEAF, NESTED, etc) if control
|
||||
* "flows into" the label.
|
||||
*/
|
||||
#define LABEL(name) \
|
||||
.globl name ;\
|
||||
name:
|
||||
|
||||
/*
|
||||
* NESTED -- declare procedure that invokes other procedures
|
||||
*/
|
||||
#define NESTED(name, localvarsize) \
|
||||
.globl name ;\
|
||||
ALIGN ;\
|
||||
name: ;\
|
||||
NESTED_FUNCTION_PROLOGUE(localvarsize)
|
||||
|
||||
/*
|
||||
* X_NESTED -- declare alternate global label for nested proc
|
||||
*/
|
||||
#define X_NESTED(name, value) \
|
||||
.globl name ;\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_NESTED -- declare private nested procedure
|
||||
*/
|
||||
#define P_NESTED(name, localvarsize) \
|
||||
ALIGN ;\
|
||||
name: ;\
|
||||
NESTED_FUNCTION_PROLOGUE(localvarsize)
|
||||
|
||||
/*
|
||||
* END -- mark end of procedure
|
||||
*/
|
||||
#define END(name) \
|
||||
FUNCTION_EPILOGUE
|
||||
|
||||
|
||||
/*
|
||||
* Storage definition macros
|
||||
* The main purpose of these is to allow an easy handle for ctags
|
||||
*/
|
||||
|
||||
/*
|
||||
* IMPORT -- import symbol
|
||||
*/
|
||||
#define IMPORT(name) \
|
||||
.reference name
|
||||
|
||||
/*
|
||||
* ABS -- declare global absolute symbol
|
||||
*/
|
||||
#define ABS(name, value) \
|
||||
.globl name ;\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_ABS -- declare private absolute symbol
|
||||
*/
|
||||
#define P_ABS(name, value) \
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* EXPORT -- declare global label for data
|
||||
*/
|
||||
#define EXPORT(name) \
|
||||
.globl name ;\
|
||||
name:
|
||||
|
||||
/*
|
||||
* BSS -- declare global zero'ed storage
|
||||
*/
|
||||
#define BSS(name,size) \
|
||||
.comm name,size
|
||||
|
||||
|
||||
/*
|
||||
* P_BSS -- declare private zero'ed storage
|
||||
*/
|
||||
#define P_BSS(name,size) \
|
||||
.lcomm name,size
|
||||
|
||||
/*
|
||||
* dynamic/PIC macros for routines which reference external symbols
|
||||
*/
|
||||
|
||||
#if defined(__DYNAMIC__)
|
||||
#if defined(__i386__)
|
||||
#define PICIFY(var) \
|
||||
call 1f ; \
|
||||
1: ; \
|
||||
popl %edx ; \
|
||||
movl L ## var ## __non_lazy_ptr-1b(%edx),%edx
|
||||
#elif defined(__x86_64__)
|
||||
#define PICIFY(var) \
|
||||
movq var@GOTPCREL(%rip),%r11
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define CALL_EXTERN_AGAIN(func) \
|
||||
PICIFY(func) ; \
|
||||
call *%edx
|
||||
#elif defined(__x86_64__)
|
||||
#define CALL_EXTERN_AGAIN(func) \
|
||||
call func
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define NON_LAZY_STUB(var) \
|
||||
.section __IMPORT,__pointers,non_lazy_symbol_pointers ; \
|
||||
L ## var ## __non_lazy_ptr: ; \
|
||||
.indirect_symbol var ; \
|
||||
.long 0 ; \
|
||||
.text
|
||||
#elif defined(__x86_64__)
|
||||
#define NON_LAZY_STUB(var)
|
||||
#endif
|
||||
|
||||
#define CALL_EXTERN(func) \
|
||||
CALL_EXTERN_AGAIN(func) ; \
|
||||
NON_LAZY_STUB(func)
|
||||
|
||||
#if defined(__i386__)
|
||||
#define BRANCH_EXTERN(func) \
|
||||
PICIFY(func) ; \
|
||||
jmp *%edx ; \
|
||||
NON_LAZY_STUB(func)
|
||||
#elif defined(__x86_64__)
|
||||
#define BRANCH_EXTERN(func) \
|
||||
jmp func
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define PUSH_EXTERN(var) \
|
||||
PICIFY(var) ; \
|
||||
movl (%edx),%edx ; \
|
||||
pushl %edx ; \
|
||||
NON_LAZY_STUB(var)
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define REG_TO_EXTERN(reg, var) \
|
||||
PICIFY(var) ; \
|
||||
movl reg, (%edx) ; \
|
||||
NON_LAZY_STUB(var)
|
||||
#elif defined(__x86_64__)
|
||||
#define REG_TO_EXTERN(reg, var) \
|
||||
PICIFY(var) ; \
|
||||
mov reg, (%r11)
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define EXTERN_TO_REG(var, reg) \
|
||||
call 1f ; \
|
||||
1: ; \
|
||||
popl %edx ; \
|
||||
movl L ## var ##__non_lazy_ptr-1b(%edx),reg ; \
|
||||
NON_LAZY_STUB(var)
|
||||
#elif defined(__x86_64__)
|
||||
#define EXTERN_TO_REG(var, reg) \
|
||||
PICIFY(var) ; \
|
||||
mov (%r11), reg
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define BRANCH_EXTERN(func) jmp func
|
||||
#define PUSH_EXTERN(var) push var
|
||||
#define CALL_EXTERN(func) call func
|
||||
#define CALL_EXTERN_AGAIN(func) call func
|
||||
#if defined(__i386__)
|
||||
#define REG_TO_EXTERN(reg, var) mov reg, var
|
||||
#define EXTERN_TO_REG(var, reg) mov $ ## var, reg
|
||||
#elif defined(__x86_64__)
|
||||
#define REG_TO_EXTERN(reg, var) mov reg, var ## (%rip)
|
||||
#define EXTERN_TO_REG(var, reg) mov var ## (%rip), reg
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* _ARCH_I386_ASM_HELP_H_ */
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 _ARCH_I386_BYTE_ORDER_H_
|
||||
#define _ARCH_I386_BYTE_ORDER_H_
|
||||
|
||||
/*
|
||||
* Maintain source compatibility
|
||||
*/
|
||||
|
||||
#include <architecture/byte_order.h>
|
||||
|
||||
#endif /* _ARCH_I386_BYTE_ORDER_H_ */
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Intel386 Family: Special processor registers.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 5 April 1992 ? at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_CPU_H_
|
||||
#define _ARCH_I386_CPU_H_
|
||||
|
||||
/*
|
||||
* Control register 0
|
||||
*/
|
||||
|
||||
typedef struct _cr0 {
|
||||
unsigned int pe :1,
|
||||
mp :1,
|
||||
em :1,
|
||||
ts :1,
|
||||
:1,
|
||||
ne :1,
|
||||
:10,
|
||||
wp :1,
|
||||
:1,
|
||||
am :1,
|
||||
:10,
|
||||
nw :1,
|
||||
cd :1,
|
||||
pg :1;
|
||||
} cr0_t;
|
||||
|
||||
/*
|
||||
* Debugging register 6
|
||||
*/
|
||||
|
||||
typedef struct _dr6 {
|
||||
unsigned int b0 :1,
|
||||
b1 :1,
|
||||
b2 :1,
|
||||
b3 :1,
|
||||
:9,
|
||||
bd :1,
|
||||
bs :1,
|
||||
bt :1,
|
||||
:16;
|
||||
} dr6_t;
|
||||
|
||||
#endif /* _ARCH_I386_CPU_H_ */
|
@ -1,150 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Intel386 Family: Segment descriptors.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 29 March 1992 ? at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_DESC_H_
|
||||
#define _ARCH_I386_DESC_H_
|
||||
|
||||
/*
|
||||
* Code segment descriptor.
|
||||
*/
|
||||
|
||||
typedef struct code_desc {
|
||||
unsigned short limit00;
|
||||
unsigned short base00;
|
||||
unsigned char base16;
|
||||
unsigned char type :5,
|
||||
#define DESC_CODE_EXEC 0x18
|
||||
#define DESC_CODE_READ 0x1a
|
||||
dpl :2,
|
||||
present :1;
|
||||
unsigned char limit16 :4,
|
||||
:2,
|
||||
opsz :1,
|
||||
#define DESC_CODE_16B 0
|
||||
#define DESC_CODE_32B 1
|
||||
granular:1;
|
||||
#define DESC_GRAN_BYTE 0
|
||||
#define DESC_GRAN_PAGE 1
|
||||
unsigned char base24;
|
||||
} code_desc_t;
|
||||
|
||||
/*
|
||||
* Data segment descriptor.
|
||||
*/
|
||||
|
||||
typedef struct data_desc {
|
||||
unsigned short limit00;
|
||||
unsigned short base00;
|
||||
unsigned char base16;
|
||||
unsigned char type :5,
|
||||
#define DESC_DATA_RONLY 0x10
|
||||
#define DESC_DATA_WRITE 0x12
|
||||
dpl :2,
|
||||
present :1;
|
||||
unsigned char limit16 :4,
|
||||
:2,
|
||||
stksz :1,
|
||||
#define DESC_DATA_16B 0
|
||||
#define DESC_DATA_32B 1
|
||||
granular:1;
|
||||
unsigned char base24;
|
||||
} data_desc_t;
|
||||
|
||||
/*
|
||||
* LDT segment descriptor.
|
||||
*/
|
||||
|
||||
typedef struct ldt_desc {
|
||||
unsigned short limit00;
|
||||
unsigned short base00;
|
||||
unsigned char base16;
|
||||
unsigned char type :5,
|
||||
#define DESC_LDT 0x02
|
||||
:2,
|
||||
present :1;
|
||||
unsigned char limit16 :4,
|
||||
:3,
|
||||
granular:1;
|
||||
unsigned char base24;
|
||||
} ldt_desc_t;
|
||||
|
||||
#include <architecture/i386/sel.h>
|
||||
|
||||
/*
|
||||
* Call gate descriptor.
|
||||
*/
|
||||
|
||||
typedef struct call_gate {
|
||||
unsigned short offset00;
|
||||
sel_t seg;
|
||||
unsigned int argcnt :5,
|
||||
:3,
|
||||
type :5,
|
||||
#define DESC_CALL_GATE 0x0c
|
||||
dpl :2,
|
||||
present :1,
|
||||
offset16:16;
|
||||
} call_gate_t;
|
||||
|
||||
/*
|
||||
* Trap gate descriptor.
|
||||
*/
|
||||
|
||||
typedef struct trap_gate {
|
||||
unsigned short offset00;
|
||||
sel_t seg;
|
||||
unsigned int :8,
|
||||
type :5,
|
||||
#define DESC_TRAP_GATE 0x0f
|
||||
dpl :2,
|
||||
present :1,
|
||||
offset16:16;
|
||||
} trap_gate_t;
|
||||
|
||||
|
||||
/*
|
||||
* Interrupt gate descriptor.
|
||||
*/
|
||||
|
||||
typedef struct intr_gate {
|
||||
unsigned short offset00;
|
||||
sel_t seg;
|
||||
unsigned int :8,
|
||||
type :5,
|
||||
#define DESC_INTR_GATE 0x0e
|
||||
dpl :2,
|
||||
present :1,
|
||||
offset16:16;
|
||||
} intr_gate_t;
|
||||
|
||||
#endif /* _ARCH_I386_DESC_H_ */
|
@ -1,170 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Intel386 Family: Floating Point unit.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 5 October 1992 ? at NeXT
|
||||
* Added names to previously unamed fields in the mantissa.
|
||||
*
|
||||
* 5 April 1992 ? at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_FPU_H_
|
||||
#define _ARCH_I386_FPU_H_
|
||||
|
||||
/*
|
||||
* Data register.
|
||||
*/
|
||||
|
||||
typedef struct fp_data_reg {
|
||||
unsigned short mant;
|
||||
unsigned short mant1 :16,
|
||||
mant2 :16,
|
||||
mant3 :16;
|
||||
unsigned short exp :15,
|
||||
sign :1;
|
||||
} fp_data_reg_t;
|
||||
|
||||
/*
|
||||
* Data register stack.
|
||||
*/
|
||||
|
||||
typedef struct fp_stack {
|
||||
fp_data_reg_t ST[8];
|
||||
} fp_stack_t;
|
||||
|
||||
/*
|
||||
* Register stack tag word.
|
||||
*/
|
||||
|
||||
typedef struct fp_tag {
|
||||
unsigned short tag0 :2,
|
||||
tag1 :2,
|
||||
tag2 :2,
|
||||
tag3 :2,
|
||||
tag4 :2,
|
||||
tag5 :2,
|
||||
tag6 :2,
|
||||
tag7 :2;
|
||||
#define FP_TAG_VALID 0
|
||||
#define FP_TAG_ZERO 1
|
||||
#define FP_TAG_SPEC 2
|
||||
#define FP_TAG_EMPTY 3
|
||||
} fp_tag_t;
|
||||
|
||||
/*
|
||||
* Status word.
|
||||
*/
|
||||
|
||||
typedef struct fp_status {
|
||||
unsigned short invalid :1,
|
||||
denorm :1,
|
||||
zdiv :1,
|
||||
ovrfl :1,
|
||||
undfl :1,
|
||||
precis :1,
|
||||
stkflt :1,
|
||||
errsumm :1,
|
||||
c0 :1,
|
||||
c1 :1,
|
||||
c2 :1,
|
||||
tos :3,
|
||||
c3 :1,
|
||||
busy :1;
|
||||
} fp_status_t;
|
||||
|
||||
/*
|
||||
* Control word.
|
||||
*/
|
||||
|
||||
typedef struct fp_control {
|
||||
unsigned short invalid :1,
|
||||
denorm :1,
|
||||
zdiv :1,
|
||||
ovrfl :1,
|
||||
undfl :1,
|
||||
precis :1,
|
||||
:2,
|
||||
pc :2,
|
||||
#define FP_PREC_24B 0
|
||||
#define FP_PREC_53B 2
|
||||
#define FP_PREC_64B 3
|
||||
rc :2,
|
||||
#define FP_RND_NEAR 0
|
||||
#define FP_RND_DOWN 1
|
||||
#define FP_RND_UP 2
|
||||
#define FP_CHOP 3
|
||||
/*inf*/ :1,
|
||||
:3;
|
||||
} fp_control_t;
|
||||
|
||||
#include <architecture/i386/sel.h>
|
||||
|
||||
/*
|
||||
* Floating point 'environment'
|
||||
* used by FSTENV/FLDENV instructions.
|
||||
*/
|
||||
|
||||
typedef struct fp_env {
|
||||
fp_control_t control;
|
||||
unsigned short :16;
|
||||
fp_status_t status;
|
||||
unsigned short :16;
|
||||
fp_tag_t tag;
|
||||
unsigned short :16;
|
||||
unsigned int ip;
|
||||
sel_t cs;
|
||||
unsigned short opcode;
|
||||
unsigned int dp;
|
||||
sel_t ds;
|
||||
unsigned short :16;
|
||||
} fp_env_t;
|
||||
|
||||
/*
|
||||
* Floating point state
|
||||
* used by FSAVE/FRSTOR instructions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* To allow the the common idiom of:
|
||||
* #define environ (*_NSGetEnviron())
|
||||
* to be used these fields were renamed. Old code that that does
|
||||
* not use this idiom can use the old field names by defining
|
||||
* _ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_ .
|
||||
*/
|
||||
typedef struct fp_state {
|
||||
#if _ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_
|
||||
fp_env_t environ;
|
||||
fp_stack_t stack;
|
||||
#else
|
||||
fp_env_t fp_environ;
|
||||
fp_stack_t fp_stack;
|
||||
#endif
|
||||
} fp_state_t;
|
||||
|
||||
#endif /* _ARCH_I386_FPU_H_ */
|
@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Intel386 Family: Processor exception frame.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 31 August 1992 ? at NeXT
|
||||
* Added v86 mode stuff.
|
||||
*
|
||||
* 8 June 1992 ? at NeXT
|
||||
* Changed name of write field in err_code_t
|
||||
* which collided with write() in shlib.
|
||||
*
|
||||
* 30 March 1992 ? at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_FRAME_H_
|
||||
#define _ARCH_I386_FRAME_H_
|
||||
|
||||
/*
|
||||
* Format of the error code
|
||||
* generated by the hardware
|
||||
* for certain exceptions.
|
||||
*/
|
||||
|
||||
typedef union err_code {
|
||||
struct err_code_normal {
|
||||
unsigned int ext :1,
|
||||
tbl :2,
|
||||
#define ERR_GDT 0
|
||||
#define ERR_IDT 1
|
||||
#define ERR_LDT 2
|
||||
index :13,
|
||||
:16;
|
||||
} normal;
|
||||
struct err_code_pgfault {
|
||||
unsigned int prot :1,
|
||||
wrtflt :1,
|
||||
user :1,
|
||||
:29;
|
||||
} pgfault;
|
||||
} err_code_t;
|
||||
|
||||
#include <architecture/i386/sel.h>
|
||||
|
||||
/*
|
||||
* The actual hardware exception frame
|
||||
* is variable in size. An error code is
|
||||
* only pushed for certain exceptions.
|
||||
* Previous stack information is only
|
||||
* pushed for exceptions that cause a
|
||||
* change in privilege level. The dpl
|
||||
* field of the saved CS selector can be
|
||||
* used to determine whether this is the
|
||||
* case. If the interrupted task was
|
||||
* executing in v86 mode, then the data
|
||||
* segment registers are also present in
|
||||
* the exception frame (in addition to
|
||||
* previous stack information). This
|
||||
* case can be determined by examining
|
||||
* eflags.
|
||||
*/
|
||||
|
||||
typedef struct except_frame {
|
||||
err_code_t err;
|
||||
unsigned int eip;
|
||||
sel_t cs;
|
||||
unsigned int :0;
|
||||
unsigned int eflags;
|
||||
unsigned int esp;
|
||||
sel_t ss;
|
||||
unsigned int :0;
|
||||
unsigned short v_es;
|
||||
unsigned int :0;
|
||||
unsigned short v_ds;
|
||||
unsigned int :0;
|
||||
unsigned short v_fs;
|
||||
unsigned int :0;
|
||||
unsigned short v_gs;
|
||||
unsigned int :0;
|
||||
} except_frame_t;
|
||||
|
||||
/*
|
||||
* Values in eflags.
|
||||
*/
|
||||
|
||||
#define EFL_CF 0x00001
|
||||
#define EFL_PF 0x00004
|
||||
#define EFL_AF 0x00010
|
||||
#define EFL_ZF 0x00040
|
||||
#define EFL_SF 0x00080
|
||||
#define EFL_TF 0x00100
|
||||
#define EFL_IF 0x00200
|
||||
#define EFL_DF 0x00400
|
||||
#define EFL_OF 0x00800
|
||||
#define EFL_IOPL 0x03000
|
||||
#define EFL_NT 0x04000
|
||||
#define EFL_RF 0x10000
|
||||
#define EFL_VM 0x20000
|
||||
#define EFL_AC 0x40000
|
||||
|
||||
#define EFL_CLR 0xfff88028
|
||||
#define EFL_SET 0x00000002
|
||||
|
||||
#endif /* _ARCH_I386_FRAME_H_ */
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Intel 386 Family: IO space defines.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 11 August 1992 ? at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_IO_H_
|
||||
#define _ARCH_I386_IO_H_
|
||||
|
||||
typedef unsigned short io_addr_t;
|
||||
typedef unsigned short io_len_t;
|
||||
|
||||
#endif /* _ARCH_I386_IO_H_ */
|
@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
#ifndef _ARCH_I386_PIO_H_
|
||||
#define _ARCH_I386_PIO_H_
|
||||
|
||||
typedef unsigned short i386_ioport_t;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
static __inline__ unsigned long inl(
|
||||
i386_ioport_t port)
|
||||
{
|
||||
unsigned long datum;
|
||||
__asm__ volatile("inl %w1, %0" : "=a" (datum) : "Nd" (port));
|
||||
return(datum);
|
||||
}
|
||||
|
||||
static __inline__ unsigned short inw(
|
||||
i386_ioport_t port)
|
||||
{
|
||||
unsigned short datum;
|
||||
__asm__ volatile("inw %w1, %w0" : "=a" (datum) : "Nd" (port));
|
||||
return(datum);
|
||||
}
|
||||
|
||||
static __inline__ unsigned char inb(
|
||||
i386_ioport_t port)
|
||||
{
|
||||
unsigned char datum;
|
||||
__asm__ volatile("inb %w1, %b0" : "=a" (datum) : "Nd" (port));
|
||||
return(datum);
|
||||
}
|
||||
|
||||
static __inline__ void outl(
|
||||
i386_ioport_t port,
|
||||
unsigned long datum)
|
||||
{
|
||||
__asm__ volatile("outl %0, %w1" : : "a" (datum), "Nd" (port));
|
||||
}
|
||||
|
||||
static __inline__ void outw(
|
||||
i386_ioport_t port,
|
||||
unsigned short datum)
|
||||
{
|
||||
__asm__ volatile("outw %w0, %w1" : : "a" (datum), "Nd" (port));
|
||||
}
|
||||
|
||||
static __inline__ void outb(
|
||||
i386_ioport_t port,
|
||||
unsigned char datum)
|
||||
{
|
||||
__asm__ volatile("outb %b0, %w1" : : "a" (datum), "Nd" (port));
|
||||
}
|
||||
#endif /* defined(__GNUC__) */
|
||||
#endif /* _ARCH_I386_PIO_H_ */
|
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1991 NeXT Computer, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/i386/reg_help.h
|
||||
* Author: Mike DeMoney, NeXT Computer, Inc.
|
||||
* Modified for i386 by: Bruce Martin, NeXT Computer, Inc.
|
||||
*
|
||||
* This header file defines cpp macros useful for defining
|
||||
* machine register and doing machine-level operations.
|
||||
*
|
||||
* HISTORY
|
||||
* 10-Mar-92 Bruce Martin (bmartin@next.com)
|
||||
* Adapted to i386
|
||||
* 23-Jan-91 Mike DeMoney (mike@next.com)
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_REG_HELP_H_
|
||||
#define _ARCH_I386_REG_HELP_H_
|
||||
|
||||
/* Bitfield definition aid */
|
||||
#define BITS_WIDTH(msb, lsb) ((msb)-(lsb)+1)
|
||||
#define BIT_WIDTH(pos) (1) /* mostly to record the position */
|
||||
|
||||
/* Mask creation */
|
||||
#define MKMASK(width, offset) (((unsigned)-1)>>(32-(width))<<(offset))
|
||||
#define BITSMASK(msb, lsb) MKMASK(BITS_WIDTH(msb, lsb), lsb & 0x1f)
|
||||
#define BITMASK(pos) MKMASK(BIT_WIDTH(pos), pos & 0x1f)
|
||||
|
||||
/* Register addresses */
|
||||
#if __ASSEMBLER__
|
||||
# define REG_ADDR(type, addr) (addr)
|
||||
#else /* __ASSEMBLER__ */
|
||||
# define REG_ADDR(type, addr) (*(volatile type *)(addr))
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
/* Cast a register to be an unsigned */
|
||||
#define CONTENTS(foo) (*(unsigned *) &(foo))
|
||||
|
||||
/* Stack pointer must always be a multiple of 4 */
|
||||
#define STACK_INCR 4
|
||||
#define ROUND_FRAME(x) ((((unsigned)(x)) + STACK_INCR - 1) & ~(STACK_INCR-1))
|
||||
|
||||
/* STRINGIFY -- perform all possible substitutions, then stringify */
|
||||
#define __STR(x) #x /* just a helper macro */
|
||||
#define STRINGIFY(x) __STR(x)
|
||||
|
||||
/*
|
||||
* REG_PAIR_DEF -- define a register pair
|
||||
* Register pairs are appropriately aligned to allow access via
|
||||
* ld.d and st.d.
|
||||
*
|
||||
* Usage:
|
||||
* struct foo {
|
||||
* REG_PAIR_DEF(
|
||||
* bar_t *, barp,
|
||||
* afu_t, afu
|
||||
* );
|
||||
* };
|
||||
*
|
||||
* Access to individual entries of the pair is via the REG_PAIR
|
||||
* macro (below).
|
||||
*/
|
||||
#define REG_PAIR_DEF(type0, name0, type1, name1) \
|
||||
struct { \
|
||||
type0 name0 __attribute__(( aligned(8) )); \
|
||||
type1 name1; \
|
||||
} name0##_##name1
|
||||
|
||||
/*
|
||||
* REG_PAIR -- Macro to define names for accessing individual registers
|
||||
* of register pairs.
|
||||
*
|
||||
* Usage:
|
||||
* arg0 is first element of pair
|
||||
* arg1 is second element of pair
|
||||
* arg2 is desired element of pair
|
||||
* eg:
|
||||
* #define foo_barp REG_PAIR(barp, afu, afu)
|
||||
*/
|
||||
#define REG_PAIR(name0, name1, the_name) \
|
||||
name0##_##name1.the_name
|
||||
|
||||
#endif /* _ARCH_I386_REG_HELP_H_ */
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Intel386 Family: Segment selector.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 29 March 1992 ? at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_SEL_H_
|
||||
#define _ARCH_I386_SEL_H_
|
||||
|
||||
/*
|
||||
* Segment selector.
|
||||
*/
|
||||
|
||||
typedef struct sel {
|
||||
unsigned short rpl :2,
|
||||
#define KERN_PRIV 0
|
||||
#define USER_PRIV 3
|
||||
ti :1,
|
||||
#define SEL_GDT 0
|
||||
#define SEL_LDT 1
|
||||
index :13;
|
||||
} sel_t;
|
||||
|
||||
#define NULL_SEL ((sel_t) { 0, 0, 0 } )
|
||||
|
||||
#endif /* _ARCH_I386_SEL_H_ */
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Intel386 Family: Descriptor tables.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 30 March 1992 ? at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_TABLE_H_
|
||||
#define _ARCH_I386_TABLE_H_
|
||||
|
||||
#include <architecture/i386/desc.h>
|
||||
#include <architecture/i386/tss.h>
|
||||
|
||||
/*
|
||||
* A totally generic descriptor
|
||||
* table entry.
|
||||
*/
|
||||
|
||||
typedef union dt_entry {
|
||||
code_desc_t code;
|
||||
data_desc_t data;
|
||||
ldt_desc_t ldt;
|
||||
tss_desc_t task_state;
|
||||
call_gate_t call_gate;
|
||||
trap_gate_t trap_gate;
|
||||
intr_gate_t intr_gate;
|
||||
task_gate_t task_gate;
|
||||
} dt_entry_t;
|
||||
|
||||
#define DESC_TBL_MAX 8192
|
||||
|
||||
/*
|
||||
* Global descriptor table.
|
||||
*/
|
||||
|
||||
typedef union gdt_entry {
|
||||
code_desc_t code;
|
||||
data_desc_t data;
|
||||
ldt_desc_t ldt;
|
||||
call_gate_t call_gate;
|
||||
task_gate_t task_gate;
|
||||
tss_desc_t task_state;
|
||||
} gdt_entry_t;
|
||||
|
||||
typedef gdt_entry_t gdt_t;
|
||||
|
||||
/*
|
||||
* Interrupt descriptor table.
|
||||
*/
|
||||
|
||||
typedef union idt_entry {
|
||||
trap_gate_t trap_gate;
|
||||
intr_gate_t intr_gate;
|
||||
task_gate_t task_gate;
|
||||
} idt_entry_t;
|
||||
|
||||
typedef idt_entry_t idt_t;
|
||||
|
||||
/*
|
||||
* Local descriptor table.
|
||||
*/
|
||||
|
||||
typedef union ldt_entry {
|
||||
code_desc_t code;
|
||||
data_desc_t data;
|
||||
call_gate_t call_gate;
|
||||
task_gate_t task_gate;
|
||||
} ldt_entry_t;
|
||||
|
||||
typedef ldt_entry_t ldt_t;
|
||||
|
||||
#endif /* _ARCH_I386_TABLE_H_ */
|
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. 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 (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Intel386 Family: Task State Segment.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 29 March 1992 ? at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_I386_TSS_H_
|
||||
#define _ARCH_I386_TSS_H_
|
||||
|
||||
#include <architecture/i386/sel.h>
|
||||
|
||||
/*
|
||||
* Task State segment.
|
||||
*/
|
||||
|
||||
typedef struct tss {
|
||||
sel_t oldtss;
|
||||
unsigned int :0;
|
||||
unsigned int esp0;
|
||||
sel_t ss0;
|
||||
unsigned int :0;
|
||||
unsigned int esp1;
|
||||
sel_t ss1;
|
||||
unsigned int :0;
|
||||
unsigned int esp2;
|
||||
sel_t ss2;
|
||||
unsigned int :0;
|
||||
unsigned int cr3;
|
||||
unsigned int eip;
|
||||
unsigned int eflags;
|
||||
unsigned int eax;
|
||||
unsigned int ecx;
|
||||
unsigned int edx;
|
||||
unsigned int ebx;
|
||||
unsigned int esp;
|
||||
unsigned int ebp;
|
||||
unsigned int esi;
|
||||
unsigned int edi;
|
||||
sel_t es;
|
||||
unsigned int :0;
|
||||
sel_t cs;
|
||||
unsigned int :0;
|
||||
sel_t ss;
|
||||
unsigned int :0;
|
||||
sel_t ds;
|
||||
unsigned int :0;
|
||||
sel_t fs;
|
||||
unsigned int :0;
|
||||
sel_t gs;
|
||||
unsigned int :0;
|
||||
sel_t ldt;
|
||||
unsigned int :0;
|
||||
unsigned int t :1,
|
||||
:15,
|
||||
io_bmap :16;
|
||||
} tss_t;
|
||||
|
||||
#define TSS_SIZE(n) (sizeof (struct tss) + (n))
|
||||
|
||||
/*
|
||||
* Task State segment descriptor.
|
||||
*/
|
||||
|
||||
typedef struct tss_desc {
|
||||
unsigned short limit00;
|
||||
unsigned short base00;
|
||||
unsigned char base16;
|
||||
unsigned char type :5,
|
||||
#define DESC_TSS 0x09
|
||||
dpl :2,
|
||||
present :1;
|
||||
unsigned char limit16 :4,
|
||||
:3,
|
||||
granular:1;
|
||||
unsigned char base24;
|
||||
} tss_desc_t;
|
||||
|
||||
/*
|
||||
* Task gate descriptor.
|
||||
*/
|
||||
|
||||
typedef struct task_gate {
|
||||
unsigned short :16;
|
||||
sel_t tss;
|
||||
unsigned int :8,
|
||||
type :5,
|
||||
#define DESC_TASK_GATE 0x05
|
||||
dpl :2,
|
||||
present :1,
|
||||
:0;
|
||||
} task_gate_t;
|
||||
|
||||
#endif /* _ARCH_I386_TSS_H_ */
|
Loading…
Reference in New Issue
Block a user