···11-APPLE PUBLIC SOURCE LICENSE
22-Version 2.0 - August 6, 2003
33-44-Please read this License carefully before downloading this software.
55-By downloading or using this software, you are agreeing to be bound by
66-the terms of this License. If you do not or cannot agree to the terms
77-of this License, please do not download or use the software.
88-99-1. General; Definitions. This License applies to any program or other
1010-work which Apple Computer, Inc. ("Apple") makes publicly available and
1111-which contains a notice placed by Apple identifying such program or
1212-work as "Original Code" and stating that it is subject to the terms of
1313-this Apple Public Source License version 2.0 ("License"). As used in
1414-this License:
1515-1616-1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is
1717-the grantor of rights, (i) claims of patents that are now or hereafter
1818-acquired, owned by or assigned to Apple and (ii) that cover subject
1919-matter contained in the Original Code, but only to the extent
2020-necessary to use, reproduce and/or distribute the Original Code
2121-without infringement; and (b) in the case where You are the grantor of
2222-rights, (i) claims of patents that are now or hereafter acquired,
2323-owned by or assigned to You and (ii) that cover subject matter in Your
2424-Modifications, taken alone or in combination with Original Code.
2525-2626-1.2 "Contributor" means any person or entity that creates or
2727-contributes to the creation of Modifications.
2828-2929-1.3 "Covered Code" means the Original Code, Modifications, the
3030-combination of Original Code and any Modifications, and/or any
3131-respective portions thereof.
3232-3333-1.4 "Externally Deploy" means: (a) to sublicense, distribute or
3434-otherwise make Covered Code available, directly or indirectly, to
3535-anyone other than You; and/or (b) to use Covered Code, alone or as
3636-part of a Larger Work, in any way to provide a service, including but
3737-not limited to delivery of content, through electronic communication
3838-with a client other than You.
3939-4040-1.5 "Larger Work" means a work which combines Covered Code or portions
4141-thereof with code not governed by the terms of this License.
4242-4343-1.6 "Modifications" mean any addition to, deletion from, and/or change
4444-to, the substance and/or structure of the Original Code, any previous
4545-Modifications, the combination of Original Code and any previous
4646-Modifications, and/or any respective portions thereof. When code is
4747-released as a series of files, a Modification is: (a) any addition to
4848-or deletion from the contents of a file containing Covered Code;
4949-and/or (b) any new file or other representation of computer program
5050-statements that contains any part of Covered Code.
5151-5252-1.7 "Original Code" means (a) the Source Code of a program or other
5353-work as originally made available by Apple under this License,
5454-including the Source Code of any updates or upgrades to such programs
5555-or works made available by Apple under this License, and that has been
5656-expressly identified by Apple as such in the header file(s) of such
5757-work; and (b) the object code compiled from such Source Code and
5858-originally made available by Apple under this License.
5959-6060-1.8 "Source Code" means the human readable form of a program or other
6161-work that is suitable for making modifications to it, including all
6262-modules it contains, plus any associated interface definition files,
6363-scripts used to control compilation and installation of an executable
6464-(object code).
6565-6666-1.9 "You" or "Your" means an individual or a legal entity exercising
6767-rights under this License. For legal entities, "You" or "Your"
6868-includes any entity which controls, is controlled by, or is under
6969-common control with, You, where "control" means (a) the power, direct
7070-or indirect, to cause the direction or management of such entity,
7171-whether by contract or otherwise, or (b) ownership of fifty percent
7272-(50%) or more of the outstanding shares or beneficial ownership of
7373-such entity.
7474-7575-2. Permitted Uses; Conditions & Restrictions. Subject to the terms
7676-and conditions of this License, Apple hereby grants You, effective on
7777-the date You accept this License and download the Original Code, a
7878-world-wide, royalty-free, non-exclusive license, to the extent of
7979-Apple's Applicable Patent Rights and copyrights covering the Original
8080-Code, to do the following:
8181-8282-2.1 Unmodified Code. You may use, reproduce, display, perform,
8383-internally distribute within Your organization, and Externally Deploy
8484-verbatim, unmodified copies of the Original Code, for commercial or
8585-non-commercial purposes, provided that in each instance:
8686-8787-(a) You must retain and reproduce in all copies of Original Code the
8888-copyright and other proprietary notices and disclaimers of Apple as
8989-they appear in the Original Code, and keep intact all notices in the
9090-Original Code that refer to this License; and
9191-9292-(b) You must include a copy of this License with every copy of Source
9393-Code of Covered Code and documentation You distribute or Externally
9494-Deploy, and You may not offer or impose any terms on such Source Code
9595-that alter or restrict this License or the recipients' rights
9696-hereunder, except as permitted under Section 6.
9797-9898-2.2 Modified Code. You may modify Covered Code and use, reproduce,
9999-display, perform, internally distribute within Your organization, and
100100-Externally Deploy Your Modifications and Covered Code, for commercial
101101-or non-commercial purposes, provided that in each instance You also
102102-meet all of these conditions:
103103-104104-(a) You must satisfy all the conditions of Section 2.1 with respect to
105105-the Source Code of the Covered Code;
106106-107107-(b) You must duplicate, to the extent it does not already exist, the
108108-notice in Exhibit A in each file of the Source Code of all Your
109109-Modifications, and cause the modified files to carry prominent notices
110110-stating that You changed the files and the date of any change; and
111111-112112-(c) If You Externally Deploy Your Modifications, You must make
113113-Source Code of all Your Externally Deployed Modifications either
114114-available to those to whom You have Externally Deployed Your
115115-Modifications, or publicly available. Source Code of Your Externally
116116-Deployed Modifications must be released under the terms set forth in
117117-this License, including the license grants set forth in Section 3
118118-below, for as long as you Externally Deploy the Covered Code or twelve
119119-(12) months from the date of initial External Deployment, whichever is
120120-longer. You should preferably distribute the Source Code of Your
121121-Externally Deployed Modifications electronically (e.g. download from a
122122-web site).
123123-124124-2.3 Distribution of Executable Versions. In addition, if You
125125-Externally Deploy Covered Code (Original Code and/or Modifications) in
126126-object code, executable form only, You must include a prominent
127127-notice, in the code itself as well as in related documentation,
128128-stating that Source Code of the Covered Code is available under the
129129-terms of this License with information on how and where to obtain such
130130-Source Code.
131131-132132-2.4 Third Party Rights. You expressly acknowledge and agree that
133133-although Apple and each Contributor grants the licenses to their
134134-respective portions of the Covered Code set forth herein, no
135135-assurances are provided by Apple or any Contributor that the Covered
136136-Code does not infringe the patent or other intellectual property
137137-rights of any other entity. Apple and each Contributor disclaim any
138138-liability to You for claims brought by any other entity based on
139139-infringement of intellectual property rights or otherwise. As a
140140-condition to exercising the rights and licenses granted hereunder, You
141141-hereby assume sole responsibility to secure any other intellectual
142142-property rights needed, if any. For example, if a third party patent
143143-license is required to allow You to distribute the Covered Code, it is
144144-Your responsibility to acquire that license before distributing the
145145-Covered Code.
146146-147147-3. Your Grants. In consideration of, and as a condition to, the
148148-licenses granted to You under this License, You hereby grant to any
149149-person or entity receiving or distributing Covered Code under this
150150-License a non-exclusive, royalty-free, perpetual, irrevocable license,
151151-under Your Applicable Patent Rights and other intellectual property
152152-rights (other than patent) owned or controlled by You, to use,
153153-reproduce, display, perform, modify, sublicense, distribute and
154154-Externally Deploy Your Modifications of the same scope and extent as
155155-Apple's licenses under Sections 2.1 and 2.2 above.
156156-157157-4. Larger Works. You may create a Larger Work by combining Covered
158158-Code with other code not governed by the terms of this License and
159159-distribute the Larger Work as a single product. In each such instance,
160160-You must make sure the requirements of this License are fulfilled for
161161-the Covered Code or any portion thereof.
162162-163163-5. Limitations on Patent License. Except as expressly stated in
164164-Section 2, no other patent rights, express or implied, are granted by
165165-Apple herein. Modifications and/or Larger Works may require additional
166166-patent licenses from Apple which Apple may grant in its sole
167167-discretion.
168168-169169-6. Additional Terms. You may choose to offer, and to charge a fee for,
170170-warranty, support, indemnity or liability obligations and/or other
171171-rights consistent with the scope of the license granted herein
172172-("Additional Terms") to one or more recipients of Covered Code.
173173-However, You may do so only on Your own behalf and as Your sole
174174-responsibility, and not on behalf of Apple or any Contributor. You
175175-must obtain the recipient's agreement that any such Additional Terms
176176-are offered by You alone, and You hereby agree to indemnify, defend
177177-and hold Apple and every Contributor harmless for any liability
178178-incurred by or claims asserted against Apple or such Contributor by
179179-reason of any such Additional Terms.
180180-181181-7. Versions of the License. Apple may publish revised and/or new
182182-versions of this License from time to time. Each version will be given
183183-a distinguishing version number. Once Original Code has been published
184184-under a particular version of this License, You may continue to use it
185185-under the terms of that version. You may also choose to use such
186186-Original Code under the terms of any subsequent version of this
187187-License published by Apple. No one other than Apple has the right to
188188-modify the terms applicable to Covered Code created under this
189189-License.
190190-191191-8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in
192192-part pre-release, untested, or not fully tested works. The Covered
193193-Code may contain errors that could cause failures or loss of data, and
194194-may be incomplete or contain inaccuracies. You expressly acknowledge
195195-and agree that use of the Covered Code, or any portion thereof, is at
196196-Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND
197197-WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND APPLE AND
198198-APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE" FOR THE
199199-PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM
200200-ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT
201201-NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF
202202-MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR
203203-PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD
204204-PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST
205205-INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE
206206-FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS,
207207-THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR
208208-ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO
209209-ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE
210210-AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY.
211211-You acknowledge that the Covered Code is not intended for use in the
212212-operation of nuclear facilities, aircraft navigation, communication
213213-systems, or air traffic control machines in which case the failure of
214214-the Covered Code could lead to death, personal injury, or severe
215215-physical or environmental damage.
216216-217217-9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO
218218-EVENT SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL,
219219-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING
220220-TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED CODE, OR
221221-ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY,
222222-TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF
223223-APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
224224-DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY
225225-REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF
226226-INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY
227227-TO YOU. In no event shall Apple's total liability to You for all
228228-damages (other than as may be required by applicable law) under this
229229-License exceed the amount of fifty dollars ($50.00).
230230-231231-10. Trademarks. This License does not grant any rights to use the
232232-trademarks or trade names "Apple", "Apple Computer", "Mac", "Mac OS",
233233-"QuickTime", "QuickTime Streaming Server" or any other trademarks,
234234-service marks, logos or trade names belonging to Apple (collectively
235235-"Apple Marks") or to any trademark, service mark, logo or trade name
236236-belonging to any Contributor. You agree not to use any Apple Marks in
237237-or as part of the name of products derived from the Original Code or
238238-to endorse or promote products derived from the Original Code other
239239-than as expressly permitted by and in strict compliance at all times
240240-with Apple's third party trademark usage guidelines which are posted
241241-at http://www.apple.com/legal/guidelinesfor3rdparties.html.
242242-243243-11. Ownership. Subject to the licenses granted under this License,
244244-each Contributor retains all rights, title and interest in and to any
245245-Modifications made by such Contributor. Apple retains all rights,
246246-title and interest in and to the Original Code and any Modifications
247247-made by or on behalf of Apple ("Apple Modifications"), and such Apple
248248-Modifications will not be automatically subject to this License. Apple
249249-may, at its sole discretion, choose to license such Apple
250250-Modifications under this License, or on different terms from those
251251-contained in this License or may choose not to license them at all.
252252-253253-12. Termination.
254254-255255-12.1 Termination. This License and the rights granted hereunder will
256256-terminate:
257257-258258-(a) automatically without notice from Apple if You fail to comply with
259259-any term(s) of this License and fail to cure such breach within 30
260260-days of becoming aware of such breach;
261261-262262-(b) immediately in the event of the circumstances described in Section
263263-13.5(b); or
264264-265265-(c) automatically without notice from Apple if You, at any time during
266266-the term of this License, commence an action for patent infringement
267267-against Apple; provided that Apple did not first commence
268268-an action for patent infringement against You in that instance.
269269-270270-12.2 Effect of Termination. Upon termination, You agree to immediately
271271-stop any further use, reproduction, modification, sublicensing and
272272-distribution of the Covered Code. All sublicenses to the Covered Code
273273-which have been properly granted prior to termination shall survive
274274-any termination of this License. Provisions which, by their nature,
275275-should remain in effect beyond the termination of this License shall
276276-survive, including but not limited to Sections 3, 5, 8, 9, 10, 11,
277277-12.2 and 13. No party will be liable to any other for compensation,
278278-indemnity or damages of any sort solely as a result of terminating
279279-this License in accordance with its terms, and termination of this
280280-License will be without prejudice to any other right or remedy of
281281-any party.
282282-283283-13. Miscellaneous.
284284-285285-13.1 Government End Users. The Covered Code is a "commercial item" as
286286-defined in FAR 2.101. Government software and technical data rights in
287287-the Covered Code include only those rights customarily provided to the
288288-public as defined in this License. This customary commercial license
289289-in technical data and software is provided in accordance with FAR
290290-12.211 (Technical Data) and 12.212 (Computer Software) and, for
291291-Department of Defense purchases, DFAR 252.227-7015 (Technical Data --
292292-Commercial Items) and 227.7202-3 (Rights in Commercial Computer
293293-Software or Computer Software Documentation). Accordingly, all U.S.
294294-Government End Users acquire Covered Code with only those rights set
295295-forth herein.
296296-297297-13.2 Relationship of Parties. This License will not be construed as
298298-creating an agency, partnership, joint venture or any other form of
299299-legal association between or among You, Apple or any Contributor, and
300300-You will not represent to the contrary, whether expressly, by
301301-implication, appearance or otherwise.
302302-303303-13.3 Independent Development. Nothing in this License will impair
304304-Apple's right to acquire, license, develop, have others develop for
305305-it, market and/or distribute technology or products that perform the
306306-same or similar functions as, or otherwise compete with,
307307-Modifications, Larger Works, technology or products that You may
308308-develop, produce, market or distribute.
309309-310310-13.4 Waiver; Construction. Failure by Apple or any Contributor to
311311-enforce any provision of this License will not be deemed a waiver of
312312-future enforcement of that or any other provision. Any law or
313313-regulation which provides that the language of a contract shall be
314314-construed against the drafter will not apply to this License.
315315-316316-13.5 Severability. (a) If for any reason a court of competent
317317-jurisdiction finds any provision of this License, or portion thereof,
318318-to be unenforceable, that provision of the License will be enforced to
319319-the maximum extent permissible so as to effect the economic benefits
320320-and intent of the parties, and the remainder of this License will
321321-continue in full force and effect. (b) Notwithstanding the foregoing,
322322-if applicable law prohibits or restricts You from fully and/or
323323-specifically complying with Sections 2 and/or 3 or prevents the
324324-enforceability of either of those Sections, this License will
325325-immediately terminate and You must immediately discontinue any use of
326326-the Covered Code and destroy all copies of it that are in your
327327-possession or control.
328328-329329-13.6 Dispute Resolution. Any litigation or other dispute resolution
330330-between You and Apple relating to this License shall take place in the
331331-Northern District of California, and You and Apple hereby consent to
332332-the personal jurisdiction of, and venue in, the state and federal
333333-courts within that District with respect to this License. The
334334-application of the United Nations Convention on Contracts for the
335335-International Sale of Goods is expressly excluded.
336336-337337-13.7 Entire Agreement; Governing Law. This License constitutes the
338338-entire agreement between the parties with respect to the subject
339339-matter hereof. This License shall be governed by the laws of the
340340-United States and the State of California, except that body of
341341-California law concerning conflicts of law.
342342-343343-Where You are located in the province of Quebec, Canada, the following
344344-clause applies: The parties hereby confirm that they have requested
345345-that this License and all related documents be drafted in English. Les
346346-parties ont exige que le present contrat et tous les documents
347347-connexes soient rediges en anglais.
348348-349349-EXHIBIT A.
350350-351351-"Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
352352-Reserved.
353353-354354-This file contains Original Code and/or Modifications of Original Code
355355-as defined in and that are subject to the Apple Public Source License
356356-Version 2.0 (the 'License'). You may not use this file except in
357357-compliance with the License. Please obtain a copy of the License at
358358-http://www.opensource.apple.com/apsl/ and read it before using this
359359-file.
360360-361361-The Original Code and all software distributed under the License are
362362-distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
363363-EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
364364-INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
365365-FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
366366-Please see the License for the specific language governing rights and
367367-limitations under the License."
-42
basic-headers/architecture/alignment.h
···11-/*
22- * Copyright (c) 1999, 2008 Apple Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1996 NeXT Software, Inc.
2525- *
2626- * Natural alignment of shorts and longs.
2727- *
2828- * HISTORY
2929- *
3030- * 2 Sept 1992 Brian Raymor at NeXT
3131- * Moved over to architecture.
3232- * 18 August 1992 Jack Greenfield at NeXT
3333- * Created.
3434- */
3535-3636-#if defined (__i386__)
3737-#include "architecture/i386/alignment.h"
3838-#else
3939-#error architecture not supported
4040-#endif
4141-4242-
-327
basic-headers/architecture/arm/asm_help.h
···11-/*
22- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-2424-#ifndef _ARCH_ARM_ASM_HELP_H_
2525-#define _ARCH_ARM_ASM_HELP_H_
2626-2727-#include <architecture/arm/reg_help.h>
2828-2929-#ifdef __ASSEMBLER__
3030-3131-#if defined(__arm__)
3232-3333-#define ALIGN \
3434- .align 2
3535-3636-#define ROUND_TO_STACK(len) \
3737- (((len) + STACK_INCR - 1) / STACK_INCR * STACK_INCR)
3838-3939-/*
4040- * Macros for declaring procedures
4141- *
4242- * Use of these macros allows ctags to have a predictable way
4343- * to find various types of declarations. They also simplify
4444- * inserting appropriate symbol table information.
4545- *
4646- * NOTE: these simple stubs will be replaced with more
4747- * complicated versions once we know what the linker and gdb
4848- * will require as far as register use masks and frame declarations.
4949- * These macros may also be ifdef'ed in the future to contain profiling
5050- * code.
5151- *
5252- */
5353-5454-/*
5555- * TEXT -- declare start of text segment
5656- */
5757-#define TEXT \
5858- .text
5959-6060-/*
6161- * DATA -- declare start of data segment
6262- */
6363-#define DATA \
6464- .data
6565-6666-/*
6767- * LEAF -- declare global leaf procedure
6868- * NOTE: Control SHOULD NOT FLOW into a LEAF! A LEAF should only
6969- * be jumped to. (A leaf may do an align.) Use a LABEL() if you
7070- * need control to flow into the label.
7171- */
7272-#define LEAF(name, localvarsize) \
7373- .globl name ;\
7474- ALIGN ;\
7575-name:
7676-7777-/*
7878- * X_LEAF -- declare alternate global label for leaf
7979- */
8080-#define X_LEAF(name, value) \
8181- .globl name ;\
8282- .set name,value
8383-8484-/*
8585- * P_LEAF -- declare private leaf procedure
8686- */
8787-#define P_LEAF(name, localvarsize) \
8888- ALIGN ;\
8989-name:
9090-9191-/*
9292- * LABEL -- declare a global code label
9393- * MUST be used (rather than LEAF, NESTED, etc) if control
9494- * "flows into" the label.
9595- */
9696-#define LABEL(name) \
9797- .globl name ;\
9898-name:
9999-100100-/*
101101- * NESTED -- declare procedure that invokes other procedures
102102- */
103103-#define NESTED(name, localvarsize) \
104104- .globl name ;\
105105- ALIGN ;\
106106-name:
107107-108108-/*
109109- * X_NESTED -- declare alternate global label for nested proc
110110- */
111111-#define X_NESTED(name, value) \
112112- .globl name ;\
113113- .set name,value
114114-115115-/*
116116- * P_NESTED -- declare private nested procedure
117117- */
118118-#define P_NESTED(name, localvarsize) \
119119- ALIGN ;\
120120-name:
121121-122122-/*
123123- * END -- mark end of procedure
124124- */
125125-#define END(name)
126126-127127-/*
128128- * Storage definition macros
129129- * The main purpose of these is to allow an easy handle for ctags
130130- */
131131-132132-/*
133133- * IMPORT -- import symbol
134134- */
135135-#define IMPORT(name) \
136136- .reference name
137137-138138-/*
139139- * ABS -- declare global absolute symbol
140140- */
141141-#define ABS(name, value) \
142142- .globl name ;\
143143- .set name,value
144144-145145-/*
146146- * P_ABS -- declare private absolute symbol
147147- */
148148-#define P_ABS(name, value) \
149149- .set name,value
150150-151151-/*
152152- * EXPORT -- declare global label for data
153153- */
154154-#define EXPORT(name) \
155155- .globl name ;\
156156-name:
157157-158158-/*
159159- * BSS -- declare global zero'ed storage
160160- */
161161-#define BSS(name,size) \
162162- .comm name,size
163163-164164-/*
165165- * P_BSS -- declare private zero'ed storage
166166- */
167167-#define P_BSS(name,size) \
168168- .lcomm name,size
169169-170170-#if defined(__DYNAMIC__)
171171-#define GET_ADDRESS(reg,var) \
172172- ldr reg, 4f ;\
173173-3: ldr reg, [pc, reg] ;\
174174- b 5f ;\
175175-4: .long 6f - (3b + 8) ;\
176176-5: ;\
177177- .non_lazy_symbol_pointer ;\
178178-6: ;\
179179- .indirect_symbol var ;\
180180- .long 0 ;\
181181- .text ;\
182182- .align 2
183183-#else
184184-#define GET_ADDRESS(reg,var) \
185185- ldr reg, 3f ;\
186186- b 4f ;\
187187-3: .long var ;\
188188-4:
189189-#endif
190190-191191-#if defined(__DYNAMIC__)
192192-#define BRANCH_EXTERNAL(var) \
193193- GET_ADDRESS(ip, var) ;\
194194- bx ip
195195-#else
196196-#define BRANCH_EXTERNAL(var) ;\
197197- b var
198198-#endif
199199-200200-#if defined(__DYNAMIC__)
201201-#define CALL_EXTERNAL(var) \
202202- GET_ADDRESS(ip,var) ;\
203203- mov lr, pc ;\
204204- bx ip
205205-#else
206206-#define CALL_EXTERNAL(var) \
207207- bl var
208208-#endif
209209-210210-#define ENTRY_POINT(name) \
211211- .align 2 ;\
212212- .globl name ;\
213213- .text ;\
214214-name:
215215-216216-#else /* defined(__arm___) */
217217-218218-#if defined(__arm64__)
219219-220220-#define ALIGN .align 2
221221-222222-#define ROUND_TO_STACK(len) (((len) + (STACK_INCR - 1)) & ~(STACK_INCR - 1))
223223-224224-#define TEXT .text
225225-226226-#define DATA .data
227227-228228-#define LEAF(name, localvarsize) \
229229- .globl name %%\
230230- ALIGN %%\
231231-name:
232232-233233-#define X_LEAF(name, value) \
234234- .globl name %%\
235235- .set name, value
236236-237237-#define P_LEAF(name, localvarsize) \
238238- ALIGN %%\
239239-name:
240240-241241-242242-#define LABEL(name) \
243243- .globl name %%\
244244-name:
245245-246246-#define NESTED(name, localvarsize) \
247247- .globl name %%\
248248- ALIGN %%\
249249-name:
250250-251251-#define X_NESTED(name, value) \
252252- .globl name %%\
253253- .set name, value
254254-255255-#define P_NESTED(name, localvarsize)\
256256- ALIGN %%\
257257-name:
258258-259259-#define END(name)
260260-261261-#define IMPORT(name) \
262262- .reference name
263263-264264-#define ABS(name, value) \
265265- .globl name %%\
266266- .set name, value
267267-268268-#define P_ABS(name, value) \
269269- .set name, value
270270-271271-#define EXPORT(name) \
272272- .globl name %%\
273273-name:
274274-275275-#define BSS(name, size) \
276276- .comm name, size
277277-278278-#define P_BSS(name, size) \
279279- .lcomm name, size
280280-281281-282282-#if __LP64__
283283-#if defined(__DYNAMIC__)
284284-#define GET_ADDRESS(wreg, xreg, var) \
285285- adrp xreg, var@gotpage %%\
286286- ldr xreg, [xreg, var@gotpageoff]
287287-#else /* __DYNAMIC__ */
288288-#define GET_ADDRESS(wreg, xreg, var) \
289289- adrp xreg, var@page %%\
290290- add xreg, xreg, var@pageoff
291291-#endif /* __DYNAMIC__ */
292292-#else /* __LP64__ */
293293-/*
294294- * The adrp instruction can't encode 'w' registers which is why the 'x' register
295295- * is used in the below LP32 variants of GET_ADDRESS().
296296- */
297297-#if defined(__DYNAMIC__)
298298-#define GET_ADDRESS(wreg, xreg, var) \
299299- adrp xreg, var@gotpage %%\
300300- ldr wreg, [xreg, var@gotpageoff]
301301-#else /* __DYNAMIC__ */
302302-#define GET_ADDRESS(wreg, xreg, var) \
303303- adrp xreg, var@page %%\
304304- add wreg, wreg, var@pageoff
305305-#endif /* __DYNAMIC__ */
306306-#endif /* __LP64__ */
307307-308308-/* The linker will link to stubs in the DYNAMIC case */
309309-#define BRANCH_EXTERNAL(var) \
310310- b var
311311-312312-/* The linker will link to stubs in the DYNAMIC case */
313313-#define CALL_EXTERNAL(var) \
314314- bl var
315315-316316-#define ENTRY_POINT(name) \
317317- .align 2 %%\
318318- .globl name %%\
319319- .text %%\
320320-name:
321321-#else /* defined(__arm64__) */
322322-#error Unknown architecture.
323323-#endif /* defined(__arm64__) */
324324-#endif /* defined(__arm__) */
325325-#endif /* __ASSEMBLER__ */
326326-327327-#endif /* _ARCH_ARM_ASM_HELP_H_ */
-32
basic-headers/architecture/arm/byte_order.h
···11-/*
22- * Copyright (c) 2008 Apple Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 2007 Apple Computer, Inc. All rights reserved.
2525- */
2626-2727-#ifndef _ARCH_ARM_BYTE_ORDER_H_
2828-#define _ARCH_ARM_BYTE_ORDER_H_
2929-3030-#include <architecture/byte_order.h>
3131-3232-#endif /* _ARCH_ARM_BYTE_ORDER_H_ */
-62
basic-headers/architecture/arm/cframe.h
···11-/*
22- * Copyright (c) 1999-2004, 2008 Apple Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/* Copyright (c) 1991 NeXT Software, Inc. All rights reserved.
2424- *
2525- * File: architecture/ppc/cframe.h
2626- * Author: Mike DeMoney, NeXT Software, Inc.
2727- *
2828- * This include file defines C calling sequence defines
2929- * for ppc port.
3030- *
3131- * HISTORY
3232- * 20-May-97 Umesh Vaishampayan (umeshv@apple.com)
3333- * Added C_RED_ZONE.
3434- * 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
3535- * Ported from m98k.
3636- * 11-June-91 Mike DeMoney (mike@next.com)
3737- * Created.
3838- */
3939-4040-#ifndef _ARCH_ARM_CFRAME_H_
4141-#define _ARCH_ARM_CFRAME_H_
4242-4343-/* Note that these values are copies of the somewhat more authoritative
4444- * values in <architecture/ppc/mode_independent_asm.h>. We do not
4545- * include that file to avoid breaking legacy clients due to name
4646- * collisions.
4747- *
4848- * Note also that C_ARGSAVE_LEN isn't well defined or useful in PPC.
4949- * Most legacy uses of it are assuming it is the minimum stack frame
5050- * size, which is what we define it to be.
5151- */
5252-#if defined(__arm__)
5353-#define C_ARGSAVE_LEN 32 /* "minimum arg save area" (but see above) */
5454-#define C_STACK_ALIGN 16 /* stack must be 16 byte aligned */
5555-#define C_RED_ZONE 224 /* 224 bytes to skip over saved registers */
5656-#elif defined (__arm64__)
5757-#define C_STACK_ALIGN 16 /* stack must be 32 byte aligned */
5858-#else /* !defined(__arm__) && !defined(__arm64__) */
5959-#error Unknown architecture
6060-#endif /* !defined(__arm__) && !defined(__arm64__) */
6161-6262-#endif /* _ARCH_ARM_CFRAME_H_ */
-62
basic-headers/architecture/arm/reg_help.h
···11-/*
22- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-2424-#ifndef _ARCH_ARM_REG_HELP_H_
2525-#define _ARCH_ARM_REG_HELP_H_
2626-2727-/* Bitfield definition aid */
2828-#define BITS_WIDTH(msb, lsb) ((msb)-(lsb)+1)
2929-#define BIT_WIDTH(pos) (1) /* mostly to record the position */
3030-3131-/* Mask creation */
3232-#define MKMASK(width, offset) (((unsigned)-1)>>(32-(width))<<(offset))
3333-#define BITSMASK(msb, lsb) MKMASK(BITS_WIDTH(msb, lsb), lsb & 0x1f)
3434-#define BITMASK(pos) MKMASK(BIT_WIDTH(pos), pos & 0x1f)
3535-3636-/* Register addresses */
3737-#if __ASSEMBLER__
3838-# define REG_ADDR(type, addr) (addr)
3939-#else /* __ASSEMBLER__ */
4040-# define REG_ADDR(type, addr) (*(volatile type *)(addr))
4141-#endif /* __ASSEMBLER__ */
4242-4343-/* Cast a register to be an unsigned */
4444-#if defined(__arm__)
4545-#define CONTENTS(foo) (*(unsigned*) &(foo))
4646-/* Stack pointer must always be a multiple of 4 */
4747-#define STACK_INCR 4
4848-#elif defined(__arm64__)
4949-#define CONTENTS(foo) (*(unsigned long long*) &(foo))
5050-/* Stack pointer must always be a multiple of 16 */
5151-#define STACK_INCR 16
5252-#else /* !defined(__arm__) && !defined(__arm64__) */
5353-#error Unknown architecture.
5454-#endif /* !defined(__arm__) && !defined(__arm64__) */
5555-5656-#define ROUND_FRAME(x) ((((unsigned)(x)) + STACK_INCR - 1) & ~(STACK_INCR-1))
5757-5858-/* STRINGIFY -- perform all possible substitutions, then stringify */
5959-#define __STR(x) #x /* just a helper macro */
6060-#define STRINGIFY(x) __STR(x)
6161-6262-#endif /* _ARCH_ARM_REG_HELP_H_ */
-381
basic-headers/architecture/byte_order.h
···11-/*
22- * Copyright (c) 1999-2008 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Byte ordering conversion.
2727- *
2828- */
2929-3030-#ifndef _ARCHITECTURE_BYTE_ORDER_H_
3131-#define _ARCHITECTURE_BYTE_ORDER_H_
3232-3333-/*
3434- * Please note that the byte ordering functions in this file are deprecated.
3535- * A replacement API exists in libkern/OSByteOrder.h
3636- */
3737-3838-#include <libkern/OSByteOrder.h>
3939-4040-typedef unsigned long NXSwappedFloat;
4141-typedef unsigned long long NXSwappedDouble;
4242-4343-static __inline__ __attribute__((deprecated))
4444-unsigned short
4545-NXSwapShort(
4646- unsigned short inv
4747-)
4848-{
4949- return (unsigned short)OSSwapInt16((uint16_t)inv);
5050-}
5151-5252-static __inline__ __attribute__((deprecated))
5353-unsigned int
5454-NXSwapInt(
5555- unsigned int inv
5656-)
5757-{
5858- return (unsigned int)OSSwapInt32((uint32_t)inv);
5959-}
6060-6161-static __inline__ __attribute__((deprecated))
6262-unsigned long
6363-NXSwapLong(
6464- unsigned long inv
6565-)
6666-{
6767- return (unsigned long)OSSwapInt32((uint32_t)inv);
6868-}
6969-7070-static __inline__ __attribute__((deprecated))
7171-unsigned long long
7272-NXSwapLongLong(
7373- unsigned long long inv
7474-)
7575-{
7676- return (unsigned long long)OSSwapInt64((uint64_t)inv);
7777-}
7878-7979-static __inline__ __attribute__((deprecated))
8080-NXSwappedFloat
8181-NXConvertHostFloatToSwapped(float x)
8282-{
8383- union fconv {
8484- float number;
8585- NXSwappedFloat sf;
8686- } u;
8787- u.number = x;
8888- return u.sf;
8989-}
9090-9191-static __inline__ __attribute__((deprecated))
9292-float
9393-NXConvertSwappedFloatToHost(NXSwappedFloat x)
9494-{
9595- union fconv {
9696- float number;
9797- NXSwappedFloat sf;
9898- } u;
9999- u.sf = x;
100100- return u.number;
101101-}
102102-103103-static __inline__ __attribute__((deprecated))
104104-NXSwappedDouble
105105-NXConvertHostDoubleToSwapped(double x)
106106-{
107107- union dconv {
108108- double number;
109109- NXSwappedDouble sd;
110110- } u;
111111- u.number = x;
112112- return u.sd;
113113-}
114114-115115-static __inline__ __attribute__((deprecated))
116116-double
117117-NXConvertSwappedDoubleToHost(NXSwappedDouble x)
118118-{
119119- union dconv {
120120- double number;
121121- NXSwappedDouble sd;
122122- } u;
123123- u.sd = x;
124124- return u.number;
125125-}
126126-127127-static __inline__ __attribute__((deprecated))
128128-NXSwappedFloat
129129-NXSwapFloat(NXSwappedFloat x)
130130-{
131131- return (NXSwappedFloat)OSSwapInt32((uint32_t)x);
132132-}
133133-134134-static __inline__ __attribute__((deprecated))
135135-NXSwappedDouble
136136-NXSwapDouble(NXSwappedDouble x)
137137-{
138138- return (NXSwappedDouble)OSSwapInt64((uint64_t)x);
139139-}
140140-141141-/*
142142- * Identify the byte order
143143- * of the current host.
144144- */
145145-146146-enum NXByteOrder {
147147- NX_UnknownByteOrder,
148148- NX_LittleEndian,
149149- NX_BigEndian
150150-};
151151-152152-static __inline__
153153-enum NXByteOrder
154154-NXHostByteOrder(void)
155155-{
156156-#if defined(__LITTLE_ENDIAN__)
157157- return NX_LittleEndian;
158158-#elif defined(__BIG_ENDIAN__)
159159- return NX_BigEndian;
160160-#else
161161- return NX_UnknownByteOrder;
162162-#endif
163163-}
164164-165165-static __inline__ __attribute__((deprecated))
166166-unsigned short
167167-NXSwapBigShortToHost(
168168- unsigned short x
169169-)
170170-{
171171- return (unsigned short)OSSwapBigToHostInt16((uint16_t)x);
172172-}
173173-174174-static __inline__ __attribute__((deprecated))
175175-unsigned int
176176-NXSwapBigIntToHost(
177177- unsigned int x
178178-)
179179-{
180180- return (unsigned int)OSSwapBigToHostInt32((uint32_t)x);
181181-}
182182-183183-static __inline__ __attribute__((deprecated))
184184-unsigned long
185185-NXSwapBigLongToHost(
186186- unsigned long x
187187-)
188188-{
189189- return (unsigned long)OSSwapBigToHostInt32((uint32_t)x);
190190-}
191191-192192-static __inline__ __attribute__((deprecated))
193193-unsigned long long
194194-NXSwapBigLongLongToHost(
195195- unsigned long long x
196196-)
197197-{
198198- return (unsigned long long)OSSwapBigToHostInt64((uint64_t)x);
199199-}
200200-201201-static __inline__ __attribute__((deprecated))
202202-double
203203-NXSwapBigDoubleToHost(
204204- NXSwappedDouble x
205205-)
206206-{
207207- return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapBigToHostInt64((uint64_t)x));
208208-}
209209-210210-static __inline__ __attribute__((deprecated))
211211-float
212212-NXSwapBigFloatToHost(
213213- NXSwappedFloat x
214214-)
215215-{
216216- return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapBigToHostInt32((uint32_t)x));
217217-}
218218-219219-static __inline__ __attribute__((deprecated))
220220-unsigned short
221221-NXSwapHostShortToBig(
222222- unsigned short x
223223-)
224224-{
225225- return (unsigned short)OSSwapHostToBigInt16((uint16_t)x);
226226-}
227227-228228-static __inline__ __attribute__((deprecated))
229229-unsigned int
230230-NXSwapHostIntToBig(
231231- unsigned int x
232232-)
233233-{
234234- return (unsigned int)OSSwapHostToBigInt32((uint32_t)x);
235235-}
236236-237237-static __inline__ __attribute__((deprecated))
238238-unsigned long
239239-NXSwapHostLongToBig(
240240- unsigned long x
241241-)
242242-{
243243- return (unsigned long)OSSwapHostToBigInt32((uint32_t)x);
244244-}
245245-246246-static __inline__ __attribute__((deprecated))
247247-unsigned long long
248248-NXSwapHostLongLongToBig(
249249- unsigned long long x
250250-)
251251-{
252252- return (unsigned long long)OSSwapHostToBigInt64((uint64_t)x);
253253-}
254254-255255-static __inline__ __attribute__((deprecated))
256256-NXSwappedDouble
257257-NXSwapHostDoubleToBig(
258258- double x
259259-)
260260-{
261261- return (NXSwappedDouble)OSSwapHostToBigInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
262262-}
263263-264264-static __inline__ __attribute__((deprecated))
265265-NXSwappedFloat
266266-NXSwapHostFloatToBig(
267267- float x
268268-)
269269-{
270270- return (NXSwappedFloat)OSSwapHostToBigInt32((uint32_t)NXConvertHostFloatToSwapped(x));
271271-}
272272-273273-static __inline__ __attribute__((deprecated))
274274-unsigned short
275275-NXSwapLittleShortToHost(
276276- unsigned short x
277277-)
278278-{
279279- return (unsigned short)OSSwapLittleToHostInt16((uint16_t)x);
280280-}
281281-282282-static __inline__ __attribute__((deprecated))
283283-unsigned int
284284-NXSwapLittleIntToHost(
285285- unsigned int x
286286-)
287287-{
288288- return (unsigned int)OSSwapLittleToHostInt32((uint32_t)x);
289289-}
290290-291291-static __inline__ __attribute__((deprecated))
292292-unsigned long
293293-NXSwapLittleLongToHost(
294294- unsigned long x
295295-)
296296-{
297297- return (unsigned long)OSSwapLittleToHostInt32((uint32_t)x);
298298-}
299299-300300-static __inline__ __attribute__((deprecated))
301301-unsigned long long
302302-NXSwapLittleLongLongToHost(
303303- unsigned long long x
304304-)
305305-{
306306- return (unsigned long long)OSSwapLittleToHostInt64((uint64_t)x);
307307-}
308308-309309-static __inline__ __attribute__((deprecated))
310310-double
311311-NXSwapLittleDoubleToHost(
312312- NXSwappedDouble x
313313-)
314314-{
315315- return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapLittleToHostInt64((uint64_t)x));
316316-}
317317-318318-static __inline__ __attribute__((deprecated))
319319-float
320320-NXSwapLittleFloatToHost(
321321- NXSwappedFloat x
322322-)
323323-{
324324- return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapLittleToHostInt32((uint32_t)x));
325325-}
326326-327327-static __inline__ __attribute__((deprecated))
328328-unsigned short
329329-NXSwapHostShortToLittle(
330330- unsigned short x
331331-)
332332-{
333333- return (unsigned short)OSSwapHostToLittleInt16((uint16_t)x);
334334-}
335335-336336-static __inline__ __attribute__((deprecated))
337337-unsigned int
338338-NXSwapHostIntToLittle(
339339- unsigned int x
340340-)
341341-{
342342- return (unsigned int)OSSwapHostToLittleInt32((uint32_t)x);
343343-}
344344-345345-static __inline__ __attribute__((deprecated))
346346-unsigned long
347347-NXSwapHostLongToLittle(
348348- unsigned long x
349349-)
350350-{
351351- return (unsigned long)OSSwapHostToLittleInt32((uint32_t)x);
352352-}
353353-354354-static __inline__ __attribute__((deprecated))
355355-unsigned long long
356356-NXSwapHostLongLongToLittle(
357357- unsigned long long x
358358-)
359359-{
360360- return (unsigned long long)OSSwapHostToLittleInt64((uint64_t)x);
361361-}
362362-363363-static __inline__ __attribute__((deprecated))
364364-NXSwappedDouble
365365-NXSwapHostDoubleToLittle(
366366- double x
367367-)
368368-{
369369- return (NXSwappedDouble)OSSwapHostToLittleInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
370370-}
371371-372372-static __inline__ __attribute__((deprecated))
373373-NXSwappedFloat
374374-NXSwapHostFloatToLittle(
375375- float x
376376-)
377377-{
378378- return (NXSwappedFloat)OSSwapHostToLittleInt32((uint32_t)NXConvertHostFloatToSwapped(x));
379379-}
380380-381381-#endif /* _ARCHITECTURE_BYTE_ORDER_H_ */
-69
basic-headers/architecture/i386/alignment.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Natural alignment of shorts and longs (for i386)
2727- *
2828- * HISTORY
2929- *
3030- * 2 Sept 1992 Brian Raymor at NeXT
3131- * Moved over to architecture.
3232- * 18 August 1992 Jack Greenfield at NeXT
3333- * Created.
3434- */
3535-3636-#ifndef _ARCH_I386_ALIGNMENT_H_
3737-#define _ARCH_I386_ALIGNMENT_H_
3838-3939-/*
4040- * NOP
4141- */
4242-__inline__ static unsigned short
4343-get_align_short(void *ivalue)
4444-{
4545- return *((unsigned short *) ivalue);
4646-}
4747-4848-__inline__ static unsigned short
4949-put_align_short(unsigned short ivalue, void *ovalue)
5050-{
5151- return *((unsigned short *) ovalue) = ivalue;
5252-}
5353-5454-/*
5555- * NOP
5656- */
5757-__inline__ static unsigned long
5858-get_align_long(void *ivalue)
5959-{
6060- return *((unsigned long *) ivalue);
6161-}
6262-6363-__inline__ static unsigned long
6464-put_align_long(unsigned long ivalue, void *ovalue)
6565-{
6666- return *((unsigned long *) ovalue) = ivalue;
6767-}
6868-6969-#endif /* _ARCH_I386_ALIGNMENT_H_ */
-398
basic-headers/architecture/i386/asm_help.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/* Copyright (c) 1991 NeXT Computer, Inc. All rights reserved.
2424- *
2525- * File: architecture/i386/asm_help.h
2626- * Author: Mike DeMoney, NeXT Computer, Inc.
2727- * Modified for i386 by: Bruce Martin, NeXT Computer, Inc.
2828- *
2929- * This header file defines macros useful when writing assembly code
3030- * for the Intel i386 family processors.
3131- *
3232- * HISTORY
3333- * 10-Mar-92 Bruce Martin (bmartin@next.com)
3434- * Adapted to i386
3535- * 23-Jan-91 Mike DeMoney (mike@next.com)
3636- * Created.
3737- */
3838-3939-#ifndef _ARCH_I386_ASM_HELP_H_
4040-#define _ARCH_I386_ASM_HELP_H_
4141-4242-#include <architecture/i386/reg_help.h>
4343-4444-4545-#ifdef __ASSEMBLER__
4646-4747-#define ALIGN \
4848- .align 2, 0x90
4949-5050-#define ROUND_TO_STACK(len) \
5151- (((len) + STACK_INCR - 1) / STACK_INCR * STACK_INCR)
5252-5353-#ifdef notdef
5454-#if defined(__i386__)
5555-#define CALL_MCOUNT \
5656- pushl %ebp ;\
5757- movl %esp, %ebp ;\
5858- .data ;\
5959- 1: .long 0 ;\
6060- .text ;\
6161- lea 9b,%edx ;\
6262- call mcount ;\
6363- popl %ebp ;
6464-#elif defined(__x86_64__)
6565-#define CALL_MCOUNT \
6666- pushq %rbp ;\
6767- movq %rsp, %rbp ;\
6868- .data ;\
6969- 1: .quad 0 ;\
7070- .text ;\
7171- lea 9b,%r13 ;\
7272- call mcount ;\
7373- popq %rbp ;
7474-#endif
7575-#else
7676-#define CALL_MCOUNT
7777-#endif
7878-7979-/*
8080- * Prologue for functions that may call other functions. Saves
8181- * registers and sets up a C frame.
8282- */
8383-#if defined(__i386__)
8484-#define NESTED_FUNCTION_PROLOGUE(localvarsize) \
8585- .set L__framesize,ROUND_TO_STACK(localvarsize) ;\
8686- .set L__nested_function, 1 ;\
8787- CALL_MCOUNT \
8888- .if L__framesize ;\
8989- pushl %ebp ;\
9090- movl %esp, %ebp ;\
9191- subl $L__framesize, %esp ;\
9292- .endif ;\
9393- pushl %edi ;\
9494- pushl %esi ;\
9595- pushl %ebx
9696-#elif defined(__x86_64__)
9797-#define NESTED_FUNCTION_PROLOGUE(localvarsize) \
9898- .set L__framesize,ROUND_TO_STACK(localvarsize) ;\
9999- .set L__nested_function, 1 ;\
100100- CALL_MCOUNT \
101101- .if L__framesize ;\
102102- pushq %rbp ;\
103103- movq %rsp, %rbp ;\
104104- subq $L__framesize, %rsp ;\
105105- .endif ;
106106-#endif
107107-108108-/*
109109- * Prologue for functions that do not call other functions. Does not
110110- * save registers (this is the functions responsibility). Does set
111111- * up a C frame.
112112- */
113113-#if defined(__i386__)
114114-#define LEAF_FUNCTION_PROLOGUE(localvarsize) \
115115- .set L__framesize,ROUND_TO_STACK(localvarsize) ;\
116116- .set L__nested_function, 0 ;\
117117- CALL_MCOUNT \
118118- .if L__framesize ;\
119119- pushl %ebp ;\
120120- movl %esp, %ebp ;\
121121- subl $L__framesize, %esp ;\
122122- .endif
123123-#elif defined(__x86_64__)
124124-#define LEAF_FUNCTION_PROLOGUE(localvarsize) \
125125- .set L__framesize,ROUND_TO_STACK(localvarsize) ;\
126126- .set L__nested_function, 0 ;\
127127- CALL_MCOUNT \
128128- .if L__framesize ;\
129129- pushq %rbp ;\
130130- movq %rsp, %rbp ;\
131131- subq $L__framesize, %rsp ;\
132132- .endif
133133-#endif
134134-135135-/*
136136- * Epilogue for any function.
137137- *
138138- * We assume that all Leaf functions will be responsible for saving any
139139- * local registers they clobber.
140140- */
141141-#if defined(__i386__)
142142-#define FUNCTION_EPILOGUE \
143143- .if L__nested_function ;\
144144- popl %ebx ;\
145145- popl %esi ;\
146146- popl %edi ;\
147147- .endif ;\
148148- .if L__framesize ;\
149149- movl %ebp, %esp ;\
150150- popl %ebp ;\
151151- .endif ;\
152152- ret
153153-#elif defined(__x86_64__)
154154-#define FUNCTION_EPILOGUE \
155155- .if L__framesize ;\
156156- movq %rbp, %rsp ;\
157157- popq %rbp ;\
158158- .endif ;\
159159- ret
160160-#endif
161161-162162-/*
163163- * Macros for declaring procedures
164164- *
165165- * Use of these macros allows ctags to have a predictable way
166166- * to find various types of declarations. They also simplify
167167- * inserting appropriate symbol table information.
168168- *
169169- * NOTE: these simple stubs will be replaced with more
170170- * complicated versions once we know what the linker and gdb
171171- * will require as far as register use masks and frame declarations.
172172- * These macros may also be ifdef'ed in the future to contain profiling
173173- * code.
174174- *
175175- */
176176-177177-/*
178178- * TEXT -- declare start of text segment
179179- */
180180-#define TEXT \
181181- .text
182182-183183-/*
184184- * DATA -- declare start of data segment
185185- */
186186-#define DATA \
187187- .data
188188-189189-/*
190190- * LEAF -- declare global leaf procedure
191191- * NOTE: Control SHOULD NOT FLOW into a LEAF! A LEAF should only
192192- * be jumped to. (A leaf may do an align.) Use a LABEL() if you
193193- * need control to flow into the label.
194194- */
195195-#define LEAF(name, localvarsize) \
196196- .globl name ;\
197197- ALIGN ;\
198198-name: ;\
199199- LEAF_FUNCTION_PROLOGUE(localvarsize)
200200-201201-/*
202202- * X_LEAF -- declare alternate global label for leaf
203203- */
204204-#define X_LEAF(name, value) \
205205- .globl name ;\
206206- .set name,value
207207-208208-/*
209209- * P_LEAF -- declare private leaf procedure
210210- */
211211-#define P_LEAF(name, localvarsize) \
212212- ALIGN ;\
213213-name: ;\
214214- LEAF_FUNCTION_PROLOGUE(localvarsize)
215215-216216-/*
217217- * LABEL -- declare a global code label
218218- * MUST be used (rather than LEAF, NESTED, etc) if control
219219- * "flows into" the label.
220220- */
221221-#define LABEL(name) \
222222- .globl name ;\
223223-name:
224224-225225-/*
226226- * NESTED -- declare procedure that invokes other procedures
227227- */
228228-#define NESTED(name, localvarsize) \
229229- .globl name ;\
230230- ALIGN ;\
231231-name: ;\
232232- NESTED_FUNCTION_PROLOGUE(localvarsize)
233233-234234-/*
235235- * X_NESTED -- declare alternate global label for nested proc
236236- */
237237-#define X_NESTED(name, value) \
238238- .globl name ;\
239239- .set name,value
240240-241241-/*
242242- * P_NESTED -- declare private nested procedure
243243- */
244244-#define P_NESTED(name, localvarsize) \
245245- ALIGN ;\
246246-name: ;\
247247- NESTED_FUNCTION_PROLOGUE(localvarsize)
248248-249249-/*
250250- * END -- mark end of procedure
251251- */
252252-#define END(name) \
253253- FUNCTION_EPILOGUE
254254-255255-256256-/*
257257- * Storage definition macros
258258- * The main purpose of these is to allow an easy handle for ctags
259259- */
260260-261261-/*
262262- * IMPORT -- import symbol
263263- */
264264-#define IMPORT(name) \
265265- .reference name
266266-267267-/*
268268- * ABS -- declare global absolute symbol
269269- */
270270-#define ABS(name, value) \
271271- .globl name ;\
272272- .set name,value
273273-274274-/*
275275- * P_ABS -- declare private absolute symbol
276276- */
277277-#define P_ABS(name, value) \
278278- .set name,value
279279-280280-/*
281281- * EXPORT -- declare global label for data
282282- */
283283-#define EXPORT(name) \
284284- .globl name ;\
285285-name:
286286-287287-/*
288288- * BSS -- declare global zero'ed storage
289289- */
290290-#define BSS(name,size) \
291291- .comm name,size
292292-293293-294294-/*
295295- * P_BSS -- declare private zero'ed storage
296296- */
297297-#define P_BSS(name,size) \
298298- .lcomm name,size
299299-300300-/*
301301- * dynamic/PIC macros for routines which reference external symbols
302302- */
303303-304304-#if defined(__DYNAMIC__)
305305-#if defined(__i386__)
306306-#define PICIFY(var) \
307307- call 1f ; \
308308-1: ; \
309309- popl %edx ; \
310310- movl L ## var ## __non_lazy_ptr-1b(%edx),%edx
311311-#elif defined(__x86_64__)
312312-#define PICIFY(var) \
313313- movq var@GOTPCREL(%rip),%r11
314314-#endif
315315-316316-#if defined(__i386__)
317317-#define CALL_EXTERN_AGAIN(func) \
318318- PICIFY(func) ; \
319319- call *%edx
320320-#elif defined(__x86_64__)
321321-#define CALL_EXTERN_AGAIN(func) \
322322- call func
323323-#endif
324324-325325-#if defined(__i386__)
326326-#define NON_LAZY_STUB(var) \
327327-.section __IMPORT,__pointers,non_lazy_symbol_pointers ; \
328328-L ## var ## __non_lazy_ptr: ; \
329329-.indirect_symbol var ; \
330330-.long 0 ; \
331331-.text
332332-#elif defined(__x86_64__)
333333-#define NON_LAZY_STUB(var)
334334-#endif
335335-336336-#define CALL_EXTERN(func) \
337337- CALL_EXTERN_AGAIN(func) ; \
338338- NON_LAZY_STUB(func)
339339-340340-#if defined(__i386__)
341341-#define BRANCH_EXTERN(func) \
342342- PICIFY(func) ; \
343343- jmp *%edx ; \
344344- NON_LAZY_STUB(func)
345345-#elif defined(__x86_64__)
346346-#define BRANCH_EXTERN(func) \
347347- jmp func
348348-#endif
349349-350350-#if defined(__i386__)
351351-#define PUSH_EXTERN(var) \
352352- PICIFY(var) ; \
353353- movl (%edx),%edx ; \
354354- pushl %edx ; \
355355- NON_LAZY_STUB(var)
356356-#endif
357357-358358-#if defined(__i386__)
359359-#define REG_TO_EXTERN(reg, var) \
360360- PICIFY(var) ; \
361361- movl reg, (%edx) ; \
362362- NON_LAZY_STUB(var)
363363-#elif defined(__x86_64__)
364364-#define REG_TO_EXTERN(reg, var) \
365365- PICIFY(var) ; \
366366- mov reg, (%r11)
367367-#endif
368368-369369-#if defined(__i386__)
370370-#define EXTERN_TO_REG(var, reg) \
371371- call 1f ; \
372372-1: ; \
373373- popl %edx ; \
374374- movl L ## var ##__non_lazy_ptr-1b(%edx),reg ; \
375375- NON_LAZY_STUB(var)
376376-#elif defined(__x86_64__)
377377-#define EXTERN_TO_REG(var, reg) \
378378- PICIFY(var) ; \
379379- mov (%r11), reg
380380-#endif
381381-382382-#else
383383-#define BRANCH_EXTERN(func) jmp func
384384-#define PUSH_EXTERN(var) push var
385385-#define CALL_EXTERN(func) call func
386386-#define CALL_EXTERN_AGAIN(func) call func
387387-#if defined(__i386__)
388388-#define REG_TO_EXTERN(reg, var) mov reg, var
389389-#define EXTERN_TO_REG(var, reg) mov $ ## var, reg
390390-#elif defined(__x86_64__)
391391-#define REG_TO_EXTERN(reg, var) mov reg, var ## (%rip)
392392-#define EXTERN_TO_REG(var, reg) mov var ## (%rip), reg
393393-#endif
394394-#endif
395395-396396-#endif /* __ASSEMBLER__ */
397397-398398-#endif /* _ARCH_I386_ASM_HELP_H_ */
-33
basic-headers/architecture/i386/byte_order.h
···11-/*
22- * Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-2424-#ifndef _ARCH_I386_BYTE_ORDER_H_
2525-#define _ARCH_I386_BYTE_ORDER_H_
2626-2727-/*
2828- * Maintain source compatibility
2929- */
3030-3131-#include <architecture/byte_order.h>
3232-3333-#endif /* _ARCH_I386_BYTE_ORDER_H_ */
-74
basic-headers/architecture/i386/cpu.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Intel386 Family: Special processor registers.
2727- *
2828- * HISTORY
2929- *
3030- * 5 April 1992 ? at NeXT
3131- * Created.
3232- */
3333-3434-#ifndef _ARCH_I386_CPU_H_
3535-#define _ARCH_I386_CPU_H_
3636-3737-/*
3838- * Control register 0
3939- */
4040-4141-typedef struct _cr0 {
4242- unsigned int pe :1,
4343- mp :1,
4444- em :1,
4545- ts :1,
4646- :1,
4747- ne :1,
4848- :10,
4949- wp :1,
5050- :1,
5151- am :1,
5252- :10,
5353- nw :1,
5454- cd :1,
5555- pg :1;
5656-} cr0_t;
5757-5858-/*
5959- * Debugging register 6
6060- */
6161-6262-typedef struct _dr6 {
6363- unsigned int b0 :1,
6464- b1 :1,
6565- b2 :1,
6666- b3 :1,
6767- :9,
6868- bd :1,
6969- bs :1,
7070- bt :1,
7171- :16;
7272-} dr6_t;
7373-7474-#endif /* _ARCH_I386_CPU_H_ */
-150
basic-headers/architecture/i386/desc.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Intel386 Family: Segment descriptors.
2727- *
2828- * HISTORY
2929- *
3030- * 29 March 1992 ? at NeXT
3131- * Created.
3232- */
3333-3434-#ifndef _ARCH_I386_DESC_H_
3535-#define _ARCH_I386_DESC_H_
3636-3737-/*
3838- * Code segment descriptor.
3939- */
4040-4141-typedef struct code_desc {
4242- unsigned short limit00;
4343- unsigned short base00;
4444- unsigned char base16;
4545- unsigned char type :5,
4646-#define DESC_CODE_EXEC 0x18
4747-#define DESC_CODE_READ 0x1a
4848- dpl :2,
4949- present :1;
5050- unsigned char limit16 :4,
5151- :2,
5252- opsz :1,
5353-#define DESC_CODE_16B 0
5454-#define DESC_CODE_32B 1
5555- granular:1;
5656-#define DESC_GRAN_BYTE 0
5757-#define DESC_GRAN_PAGE 1
5858- unsigned char base24;
5959-} code_desc_t;
6060-6161-/*
6262- * Data segment descriptor.
6363- */
6464-6565-typedef struct data_desc {
6666- unsigned short limit00;
6767- unsigned short base00;
6868- unsigned char base16;
6969- unsigned char type :5,
7070-#define DESC_DATA_RONLY 0x10
7171-#define DESC_DATA_WRITE 0x12
7272- dpl :2,
7373- present :1;
7474- unsigned char limit16 :4,
7575- :2,
7676- stksz :1,
7777-#define DESC_DATA_16B 0
7878-#define DESC_DATA_32B 1
7979- granular:1;
8080- unsigned char base24;
8181-} data_desc_t;
8282-8383-/*
8484- * LDT segment descriptor.
8585- */
8686-8787-typedef struct ldt_desc {
8888- unsigned short limit00;
8989- unsigned short base00;
9090- unsigned char base16;
9191- unsigned char type :5,
9292-#define DESC_LDT 0x02
9393- :2,
9494- present :1;
9595- unsigned char limit16 :4,
9696- :3,
9797- granular:1;
9898- unsigned char base24;
9999-} ldt_desc_t;
100100-101101-#include <architecture/i386/sel.h>
102102-103103-/*
104104- * Call gate descriptor.
105105- */
106106-107107-typedef struct call_gate {
108108- unsigned short offset00;
109109- sel_t seg;
110110- unsigned int argcnt :5,
111111- :3,
112112- type :5,
113113-#define DESC_CALL_GATE 0x0c
114114- dpl :2,
115115- present :1,
116116- offset16:16;
117117-} call_gate_t;
118118-119119-/*
120120- * Trap gate descriptor.
121121- */
122122-123123-typedef struct trap_gate {
124124- unsigned short offset00;
125125- sel_t seg;
126126- unsigned int :8,
127127- type :5,
128128-#define DESC_TRAP_GATE 0x0f
129129- dpl :2,
130130- present :1,
131131- offset16:16;
132132-} trap_gate_t;
133133-134134-135135-/*
136136- * Interrupt gate descriptor.
137137- */
138138-139139-typedef struct intr_gate {
140140- unsigned short offset00;
141141- sel_t seg;
142142- unsigned int :8,
143143- type :5,
144144-#define DESC_INTR_GATE 0x0e
145145- dpl :2,
146146- present :1,
147147- offset16:16;
148148-} intr_gate_t;
149149-150150-#endif /* _ARCH_I386_DESC_H_ */
-170
basic-headers/architecture/i386/fpu.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Intel386 Family: Floating Point unit.
2727- *
2828- * HISTORY
2929- *
3030- * 5 October 1992 ? at NeXT
3131- * Added names to previously unamed fields in the mantissa.
3232- *
3333- * 5 April 1992 ? at NeXT
3434- * Created.
3535- */
3636-3737-#ifndef _ARCH_I386_FPU_H_
3838-#define _ARCH_I386_FPU_H_
3939-4040-/*
4141- * Data register.
4242- */
4343-4444-typedef struct fp_data_reg {
4545- unsigned short mant;
4646- unsigned short mant1 :16,
4747- mant2 :16,
4848- mant3 :16;
4949- unsigned short exp :15,
5050- sign :1;
5151-} fp_data_reg_t;
5252-5353-/*
5454- * Data register stack.
5555- */
5656-5757-typedef struct fp_stack {
5858- fp_data_reg_t ST[8];
5959-} fp_stack_t;
6060-6161-/*
6262- * Register stack tag word.
6363- */
6464-6565-typedef struct fp_tag {
6666- unsigned short tag0 :2,
6767- tag1 :2,
6868- tag2 :2,
6969- tag3 :2,
7070- tag4 :2,
7171- tag5 :2,
7272- tag6 :2,
7373- tag7 :2;
7474-#define FP_TAG_VALID 0
7575-#define FP_TAG_ZERO 1
7676-#define FP_TAG_SPEC 2
7777-#define FP_TAG_EMPTY 3
7878-} fp_tag_t;
7979-8080-/*
8181- * Status word.
8282- */
8383-8484-typedef struct fp_status {
8585- unsigned short invalid :1,
8686- denorm :1,
8787- zdiv :1,
8888- ovrfl :1,
8989- undfl :1,
9090- precis :1,
9191- stkflt :1,
9292- errsumm :1,
9393- c0 :1,
9494- c1 :1,
9595- c2 :1,
9696- tos :3,
9797- c3 :1,
9898- busy :1;
9999-} fp_status_t;
100100-101101-/*
102102- * Control word.
103103- */
104104-105105-typedef struct fp_control {
106106- unsigned short invalid :1,
107107- denorm :1,
108108- zdiv :1,
109109- ovrfl :1,
110110- undfl :1,
111111- precis :1,
112112- :2,
113113- pc :2,
114114-#define FP_PREC_24B 0
115115-#define FP_PREC_53B 2
116116-#define FP_PREC_64B 3
117117- rc :2,
118118-#define FP_RND_NEAR 0
119119-#define FP_RND_DOWN 1
120120-#define FP_RND_UP 2
121121-#define FP_CHOP 3
122122- /*inf*/ :1,
123123- :3;
124124-} fp_control_t;
125125-126126-#include <architecture/i386/sel.h>
127127-128128-/*
129129- * Floating point 'environment'
130130- * used by FSTENV/FLDENV instructions.
131131- */
132132-133133-typedef struct fp_env {
134134- fp_control_t control;
135135- unsigned short :16;
136136- fp_status_t status;
137137- unsigned short :16;
138138- fp_tag_t tag;
139139- unsigned short :16;
140140- unsigned int ip;
141141- sel_t cs;
142142- unsigned short opcode;
143143- unsigned int dp;
144144- sel_t ds;
145145- unsigned short :16;
146146-} fp_env_t;
147147-148148-/*
149149- * Floating point state
150150- * used by FSAVE/FRSTOR instructions.
151151- */
152152-153153-/*
154154- * To allow the the common idiom of:
155155- * #define environ (*_NSGetEnviron())
156156- * to be used these fields were renamed. Old code that that does
157157- * not use this idiom can use the old field names by defining
158158- * _ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_ .
159159- */
160160-typedef struct fp_state {
161161-#if _ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_
162162- fp_env_t environ;
163163- fp_stack_t stack;
164164-#else
165165- fp_env_t fp_environ;
166166- fp_stack_t fp_stack;
167167-#endif
168168-} fp_state_t;
169169-170170-#endif /* _ARCH_I386_FPU_H_ */
-129
basic-headers/architecture/i386/frame.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Intel386 Family: Processor exception frame.
2727- *
2828- * HISTORY
2929- *
3030- * 31 August 1992 ? at NeXT
3131- * Added v86 mode stuff.
3232- *
3333- * 8 June 1992 ? at NeXT
3434- * Changed name of write field in err_code_t
3535- * which collided with write() in shlib.
3636- *
3737- * 30 March 1992 ? at NeXT
3838- * Created.
3939- */
4040-4141-#ifndef _ARCH_I386_FRAME_H_
4242-#define _ARCH_I386_FRAME_H_
4343-4444-/*
4545- * Format of the error code
4646- * generated by the hardware
4747- * for certain exceptions.
4848- */
4949-5050-typedef union err_code {
5151- struct err_code_normal {
5252- unsigned int ext :1,
5353- tbl :2,
5454-#define ERR_GDT 0
5555-#define ERR_IDT 1
5656-#define ERR_LDT 2
5757- index :13,
5858- :16;
5959- } normal;
6060- struct err_code_pgfault {
6161- unsigned int prot :1,
6262- wrtflt :1,
6363- user :1,
6464- :29;
6565- } pgfault;
6666-} err_code_t;
6767-6868-#include <architecture/i386/sel.h>
6969-7070-/*
7171- * The actual hardware exception frame
7272- * is variable in size. An error code is
7373- * only pushed for certain exceptions.
7474- * Previous stack information is only
7575- * pushed for exceptions that cause a
7676- * change in privilege level. The dpl
7777- * field of the saved CS selector can be
7878- * used to determine whether this is the
7979- * case. If the interrupted task was
8080- * executing in v86 mode, then the data
8181- * segment registers are also present in
8282- * the exception frame (in addition to
8383- * previous stack information). This
8484- * case can be determined by examining
8585- * eflags.
8686- */
8787-8888-typedef struct except_frame {
8989- err_code_t err;
9090- unsigned int eip;
9191- sel_t cs;
9292- unsigned int :0;
9393- unsigned int eflags;
9494- unsigned int esp;
9595- sel_t ss;
9696- unsigned int :0;
9797- unsigned short v_es;
9898- unsigned int :0;
9999- unsigned short v_ds;
100100- unsigned int :0;
101101- unsigned short v_fs;
102102- unsigned int :0;
103103- unsigned short v_gs;
104104- unsigned int :0;
105105-} except_frame_t;
106106-107107-/*
108108- * Values in eflags.
109109- */
110110-111111-#define EFL_CF 0x00001
112112-#define EFL_PF 0x00004
113113-#define EFL_AF 0x00010
114114-#define EFL_ZF 0x00040
115115-#define EFL_SF 0x00080
116116-#define EFL_TF 0x00100
117117-#define EFL_IF 0x00200
118118-#define EFL_DF 0x00400
119119-#define EFL_OF 0x00800
120120-#define EFL_IOPL 0x03000
121121-#define EFL_NT 0x04000
122122-#define EFL_RF 0x10000
123123-#define EFL_VM 0x20000
124124-#define EFL_AC 0x40000
125125-126126-#define EFL_CLR 0xfff88028
127127-#define EFL_SET 0x00000002
128128-129129-#endif /* _ARCH_I386_FRAME_H_ */
-40
basic-headers/architecture/i386/io.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Intel 386 Family: IO space defines.
2727- *
2828- * HISTORY
2929- *
3030- * 11 August 1992 ? at NeXT
3131- * Created.
3232- */
3333-3434-#ifndef _ARCH_I386_IO_H_
3535-#define _ARCH_I386_IO_H_
3636-3737-typedef unsigned short io_addr_t;
3838-typedef unsigned short io_len_t;
3939-4040-#endif /* _ARCH_I386_IO_H_ */
-104
basic-headers/architecture/i386/pio.h
···11-/*
22- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * @OSF_COPYRIGHT@
2525- */
2626-/*
2727- * Mach Operating System
2828- * Copyright (c) 1991,1990 Carnegie Mellon University
2929- * All Rights Reserved.
3030- *
3131- * Permission to use, copy, modify and distribute this software and its
3232- * documentation is hereby granted, provided that both the copyright
3333- * notice and this permission notice appear in all copies of the
3434- * software, derivative works or modified versions, and any portions
3535- * thereof, and that both notices appear in supporting documentation.
3636- *
3737- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
3838- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
3939- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
4040- *
4141- * Carnegie Mellon requests users of this software to return to
4242- *
4343- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
4444- * School of Computer Science
4545- * Carnegie Mellon University
4646- * Pittsburgh PA 15213-3890
4747- *
4848- * any improvements or extensions that they make and grant Carnegie Mellon
4949- * the rights to redistribute these changes.
5050- */
5151-/*
5252- */
5353-#ifndef _ARCH_I386_PIO_H_
5454-#define _ARCH_I386_PIO_H_
5555-5656-typedef unsigned short i386_ioport_t;
5757-5858-#if defined(__GNUC__)
5959-static __inline__ unsigned long inl(
6060- i386_ioport_t port)
6161-{
6262- unsigned long datum;
6363- __asm__ volatile("inl %w1, %0" : "=a" (datum) : "Nd" (port));
6464- return(datum);
6565-}
6666-6767-static __inline__ unsigned short inw(
6868- i386_ioport_t port)
6969-{
7070- unsigned short datum;
7171- __asm__ volatile("inw %w1, %w0" : "=a" (datum) : "Nd" (port));
7272- return(datum);
7373-}
7474-7575-static __inline__ unsigned char inb(
7676- i386_ioport_t port)
7777-{
7878- unsigned char datum;
7979- __asm__ volatile("inb %w1, %b0" : "=a" (datum) : "Nd" (port));
8080- return(datum);
8181-}
8282-8383-static __inline__ void outl(
8484- i386_ioport_t port,
8585- unsigned long datum)
8686-{
8787- __asm__ volatile("outl %0, %w1" : : "a" (datum), "Nd" (port));
8888-}
8989-9090-static __inline__ void outw(
9191- i386_ioport_t port,
9292- unsigned short datum)
9393-{
9494- __asm__ volatile("outw %w0, %w1" : : "a" (datum), "Nd" (port));
9595-}
9696-9797-static __inline__ void outb(
9898- i386_ioport_t port,
9999- unsigned char datum)
100100-{
101101- __asm__ volatile("outb %b0, %w1" : : "a" (datum), "Nd" (port));
102102-}
103103-#endif /* defined(__GNUC__) */
104104-#endif /* _ARCH_I386_PIO_H_ */
-105
basic-headers/architecture/i386/reg_help.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/* Copyright (c) 1991 NeXT Computer, Inc. All rights reserved.
2424- *
2525- * File: architecture/i386/reg_help.h
2626- * Author: Mike DeMoney, NeXT Computer, Inc.
2727- * Modified for i386 by: Bruce Martin, NeXT Computer, Inc.
2828- *
2929- * This header file defines cpp macros useful for defining
3030- * machine register and doing machine-level operations.
3131- *
3232- * HISTORY
3333- * 10-Mar-92 Bruce Martin (bmartin@next.com)
3434- * Adapted to i386
3535- * 23-Jan-91 Mike DeMoney (mike@next.com)
3636- * Created.
3737- */
3838-3939-#ifndef _ARCH_I386_REG_HELP_H_
4040-#define _ARCH_I386_REG_HELP_H_
4141-4242-/* Bitfield definition aid */
4343-#define BITS_WIDTH(msb, lsb) ((msb)-(lsb)+1)
4444-#define BIT_WIDTH(pos) (1) /* mostly to record the position */
4545-4646-/* Mask creation */
4747-#define MKMASK(width, offset) (((unsigned)-1)>>(32-(width))<<(offset))
4848-#define BITSMASK(msb, lsb) MKMASK(BITS_WIDTH(msb, lsb), lsb & 0x1f)
4949-#define BITMASK(pos) MKMASK(BIT_WIDTH(pos), pos & 0x1f)
5050-5151-/* Register addresses */
5252-#if __ASSEMBLER__
5353-# define REG_ADDR(type, addr) (addr)
5454-#else /* __ASSEMBLER__ */
5555-# define REG_ADDR(type, addr) (*(volatile type *)(addr))
5656-#endif /* __ASSEMBLER__ */
5757-5858-/* Cast a register to be an unsigned */
5959-#define CONTENTS(foo) (*(unsigned *) &(foo))
6060-6161-/* Stack pointer must always be a multiple of 4 */
6262-#define STACK_INCR 4
6363-#define ROUND_FRAME(x) ((((unsigned)(x)) + STACK_INCR - 1) & ~(STACK_INCR-1))
6464-6565-/* STRINGIFY -- perform all possible substitutions, then stringify */
6666-#define __STR(x) #x /* just a helper macro */
6767-#define STRINGIFY(x) __STR(x)
6868-6969-/*
7070- * REG_PAIR_DEF -- define a register pair
7171- * Register pairs are appropriately aligned to allow access via
7272- * ld.d and st.d.
7373- *
7474- * Usage:
7575- * struct foo {
7676- * REG_PAIR_DEF(
7777- * bar_t *, barp,
7878- * afu_t, afu
7979- * );
8080- * };
8181- *
8282- * Access to individual entries of the pair is via the REG_PAIR
8383- * macro (below).
8484- */
8585-#define REG_PAIR_DEF(type0, name0, type1, name1) \
8686- struct { \
8787- type0 name0 __attribute__(( aligned(8) )); \
8888- type1 name1; \
8989- } name0##_##name1
9090-9191-/*
9292- * REG_PAIR -- Macro to define names for accessing individual registers
9393- * of register pairs.
9494- *
9595- * Usage:
9696- * arg0 is first element of pair
9797- * arg1 is second element of pair
9898- * arg2 is desired element of pair
9999- * eg:
100100- * #define foo_barp REG_PAIR(barp, afu, afu)
101101- */
102102-#define REG_PAIR(name0, name1, the_name) \
103103- name0##_##name1.the_name
104104-105105-#endif /* _ARCH_I386_REG_HELP_H_ */
-53
basic-headers/architecture/i386/sel.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Intel386 Family: Segment selector.
2727- *
2828- * HISTORY
2929- *
3030- * 29 March 1992 ? at NeXT
3131- * Created.
3232- */
3333-3434-#ifndef _ARCH_I386_SEL_H_
3535-#define _ARCH_I386_SEL_H_
3636-3737-/*
3838- * Segment selector.
3939- */
4040-4141-typedef struct sel {
4242- unsigned short rpl :2,
4343-#define KERN_PRIV 0
4444-#define USER_PRIV 3
4545- ti :1,
4646-#define SEL_GDT 0
4747-#define SEL_LDT 1
4848- index :13;
4949-} sel_t;
5050-5151-#define NULL_SEL ((sel_t) { 0, 0, 0 } )
5252-5353-#endif /* _ARCH_I386_SEL_H_ */
-98
basic-headers/architecture/i386/table.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Intel386 Family: Descriptor tables.
2727- *
2828- * HISTORY
2929- *
3030- * 30 March 1992 ? at NeXT
3131- * Created.
3232- */
3333-3434-#ifndef _ARCH_I386_TABLE_H_
3535-#define _ARCH_I386_TABLE_H_
3636-3737-#include <architecture/i386/desc.h>
3838-#include <architecture/i386/tss.h>
3939-4040-/*
4141- * A totally generic descriptor
4242- * table entry.
4343- */
4444-4545-typedef union dt_entry {
4646- code_desc_t code;
4747- data_desc_t data;
4848- ldt_desc_t ldt;
4949- tss_desc_t task_state;
5050- call_gate_t call_gate;
5151- trap_gate_t trap_gate;
5252- intr_gate_t intr_gate;
5353- task_gate_t task_gate;
5454-} dt_entry_t;
5555-5656-#define DESC_TBL_MAX 8192
5757-5858-/*
5959- * Global descriptor table.
6060- */
6161-6262-typedef union gdt_entry {
6363- code_desc_t code;
6464- data_desc_t data;
6565- ldt_desc_t ldt;
6666- call_gate_t call_gate;
6767- task_gate_t task_gate;
6868- tss_desc_t task_state;
6969-} gdt_entry_t;
7070-7171-typedef gdt_entry_t gdt_t;
7272-7373-/*
7474- * Interrupt descriptor table.
7575- */
7676-7777-typedef union idt_entry {
7878- trap_gate_t trap_gate;
7979- intr_gate_t intr_gate;
8080- task_gate_t task_gate;
8181-} idt_entry_t;
8282-8383-typedef idt_entry_t idt_t;
8484-8585-/*
8686- * Local descriptor table.
8787- */
8888-8989-typedef union ldt_entry {
9090- code_desc_t code;
9191- data_desc_t data;
9292- call_gate_t call_gate;
9393- task_gate_t task_gate;
9494-} ldt_entry_t;
9595-9696-typedef ldt_entry_t ldt_t;
9797-9898-#endif /* _ARCH_I386_TABLE_H_ */
-120
basic-headers/architecture/i386/tss.h
···11-/*
22- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
33- *
44- * @APPLE_LICENSE_HEADER_START@
55- *
66- * This file contains Original Code and/or Modifications of Original Code
77- * as defined in and that are subject to the Apple Public Source License
88- * Version 2.0 (the 'License'). You may not use this file except in
99- * compliance with the License. Please obtain a copy of the License at
1010- * http://www.opensource.apple.com/apsl/ and read it before using this
1111- * file.
1212- *
1313- * The Original Code and all software distributed under the License are
1414- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818- * Please see the License for the specific language governing rights and
1919- * limitations under the License.
2020- *
2121- * @APPLE_LICENSE_HEADER_END@
2222- */
2323-/*
2424- * Copyright (c) 1992 NeXT Computer, Inc.
2525- *
2626- * Intel386 Family: Task State Segment.
2727- *
2828- * HISTORY
2929- *
3030- * 29 March 1992 ? at NeXT
3131- * Created.
3232- */
3333-3434-#ifndef _ARCH_I386_TSS_H_
3535-#define _ARCH_I386_TSS_H_
3636-3737-#include <architecture/i386/sel.h>
3838-3939-/*
4040- * Task State segment.
4141- */
4242-4343-typedef struct tss {
4444- sel_t oldtss;
4545- unsigned int :0;
4646- unsigned int esp0;
4747- sel_t ss0;
4848- unsigned int :0;
4949- unsigned int esp1;
5050- sel_t ss1;
5151- unsigned int :0;
5252- unsigned int esp2;
5353- sel_t ss2;
5454- unsigned int :0;
5555- unsigned int cr3;
5656- unsigned int eip;
5757- unsigned int eflags;
5858- unsigned int eax;
5959- unsigned int ecx;
6060- unsigned int edx;
6161- unsigned int ebx;
6262- unsigned int esp;
6363- unsigned int ebp;
6464- unsigned int esi;
6565- unsigned int edi;
6666- sel_t es;
6767- unsigned int :0;
6868- sel_t cs;
6969- unsigned int :0;
7070- sel_t ss;
7171- unsigned int :0;
7272- sel_t ds;
7373- unsigned int :0;
7474- sel_t fs;
7575- unsigned int :0;
7676- sel_t gs;
7777- unsigned int :0;
7878- sel_t ldt;
7979- unsigned int :0;
8080- unsigned int t :1,
8181- :15,
8282- io_bmap :16;
8383-} tss_t;
8484-8585-#define TSS_SIZE(n) (sizeof (struct tss) + (n))
8686-8787-/*
8888- * Task State segment descriptor.
8989- */
9090-9191-typedef struct tss_desc {
9292- unsigned short limit00;
9393- unsigned short base00;
9494- unsigned char base16;
9595- unsigned char type :5,
9696-#define DESC_TSS 0x09
9797- dpl :2,
9898- present :1;
9999- unsigned char limit16 :4,
100100- :3,
101101- granular:1;
102102- unsigned char base24;
103103-} tss_desc_t;
104104-105105-/*
106106- * Task gate descriptor.
107107- */
108108-109109-typedef struct task_gate {
110110- unsigned short :16;
111111- sel_t tss;
112112- unsigned int :8,
113113- type :5,
114114-#define DESC_TASK_GATE 0x05
115115- dpl :2,
116116- present :1,
117117- :0;
118118-} task_gate_t;
119119-120120-#endif /* _ARCH_I386_TSS_H_ */