mirror of
https://github.com/darlinghq/darling.git
synced 2026-05-24 13:38:37 -05:00
Generate syscall wrappers also for ppc, arm and arm64
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,456 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1996 NeXT Software, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/ppc/asm_help.h
|
||||
* Author: Mike DeMoney, NeXT Software, Inc.
|
||||
*
|
||||
* This header file defines macros useful when writing assembly code
|
||||
* for the PowerPC processors.
|
||||
* r12 is used as the tmp register / PICIFY base.
|
||||
*
|
||||
* HISTORY
|
||||
* 20-May-97 Umesh Vaishampayan (umeshv@apple.com)
|
||||
* Implemented Dynamic / PIC macros.
|
||||
*
|
||||
* 28-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
|
||||
* added ".align" directive to various macros to avoid alignment
|
||||
* faults. Moved Register Usage #defines to reg_help.h as that's
|
||||
* where they should have been in the first place.
|
||||
* Added Dynamic / PIC macroes for routines which refernce external
|
||||
* symbols. Not implemented fully as yet.
|
||||
*
|
||||
* 05-Nov-92 Mike DeMoney (mike@next.com)
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_PPC_ASM_HELP_H_
|
||||
#define _ARCH_PPC_ASM_HELP_H_
|
||||
|
||||
#include <architecture/ppc/reg_help.h>
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
/*
|
||||
* ppc stack frames look like this after procedure prolog has
|
||||
* been executed:
|
||||
*
|
||||
* Higher address:
|
||||
* .........
|
||||
* +-------------------------------+
|
||||
* | caller's LR |
|
||||
* +-------------------------------+
|
||||
* | caller's CR |
|
||||
* +-------------------------------+
|
||||
* Caller's SP->| caller's caller's sp | ^^ Caller's Frame ^^
|
||||
* +===============================+ vv Called Rtn Frame vv
|
||||
* | Save Area for | FPF 31
|
||||
* ..........
|
||||
* | Caller's FPF's | FPF n
|
||||
* +-------------------------------+
|
||||
* | Save Area for | GRF 31
|
||||
* ..........
|
||||
* | Caller's GRF's | GRF n
|
||||
* +-------------------------------+
|
||||
* | alignment pad |
|
||||
* ............
|
||||
* | (if necessary) |
|
||||
* +-------------------------------+
|
||||
* | Local |
|
||||
* ........
|
||||
* | Variables |
|
||||
* +-------------------------------+
|
||||
* SP + X -> | aN for FUTURE call |
|
||||
* +-------------------------------+
|
||||
* ..........
|
||||
* +-------------------------------+
|
||||
* SP + 28 -> | a1 for FUTURE call |
|
||||
* +-------------------------------+
|
||||
* SP + 24 -> | a0 for FUTURE call |
|
||||
* +-------------------------------+
|
||||
* SP + 20 -> | caller's TOC |
|
||||
* +-------------------------------+
|
||||
* SP + 16 -> | reserved |
|
||||
* +-------------------------------+
|
||||
* SP + 12 -> | reserved |
|
||||
* +-------------------------------+
|
||||
* SP + 8 -> | LR callee-save for FUTURE call|
|
||||
* +-------------------------------+
|
||||
* SP + 4 -> | CR callee-save for FUTURE call|
|
||||
* +-------------------------------+
|
||||
* SP -> | caller's sp |
|
||||
* +===============================+
|
||||
* Lower address:
|
||||
*
|
||||
* NOTE: All state with the exception of LR and CR are saved in the
|
||||
* called routines frame. LR and CR are saved in the CALLER'S FRAME.
|
||||
*
|
||||
* ALSO NOTE: Args to the called routine are found in the caller's frame.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARG(n) -- stack offset to n'th argument
|
||||
*
|
||||
* NOTE CAREFULLY! These macros start numbering arguments at 1 (NOT 0)
|
||||
* The first argument is ARG(1).
|
||||
*
|
||||
* ALSO NOTE: This stack offset is only valid if using routine
|
||||
* DOES NOT alter SP.
|
||||
*
|
||||
*/
|
||||
#define ARG(n) ((((n) - 1) * 4) + 24)
|
||||
|
||||
/*
|
||||
* Macros for building stack frame according to C calling conventions.
|
||||
* lr, cr, and sp are saved.
|
||||
*
|
||||
* NOTE WELL: localvarsize is in bytes, maxargsout is a count of words,
|
||||
* grfsaved and fpfsaved is a count of registers. BE SURE TO COUNT
|
||||
* BOTH FP (r31) AND sN REGISTERS IN THE COUNT OF GRF REGISTERS SAVED!
|
||||
* This will be TWO more than the N of the highest sN register you
|
||||
* save: s2 implies you are saving s2, s1, s0, and fp => grfsaved
|
||||
* should be 4!
|
||||
*
|
||||
* FURTHER NOTE: These macros do NOT SAVE GRF or FPF registers. User
|
||||
* must do that. GRF sN regs should be saved via
|
||||
* stmw sN,SAVED_GRF_S(N)(sp)
|
||||
* where N is the highest numbered s* register to be saved. E.g. if
|
||||
* s0, s1, and s2 are to be saved use:
|
||||
* stmw s2,SAVED_GRF_S(2)(sp)
|
||||
* Note that this also saves fp.
|
||||
* An individual saved grf can be loaded via:
|
||||
* lwz s2,SAVED_GRF_S(2)(sp)
|
||||
* Analogous stuff works for fpf's.
|
||||
*
|
||||
* NOTE: these simple routines will be replaced with more complicated
|
||||
* ones once we know what the linker and gdb will require as for as
|
||||
* register use masks and frame declarations.
|
||||
*
|
||||
* Warning: ROUND_TO_STACK is only to be used in assembly language;
|
||||
* for C usage, use ROUND_FRAME() in reg_help.h.
|
||||
*/
|
||||
#define ROUND_TO_STACK(len) \
|
||||
(((len) + STACK_INCR - 1) / STACK_INCR * STACK_INCR)
|
||||
|
||||
#define BUILD_FRAME(localvarsize, maxargsout, grfsaved, fpfsaved) \
|
||||
.set __argoutsize, ROUND_TO_STACK((maxargsout) * 4) @\
|
||||
.if __argoutsize < 32 @\
|
||||
.set __argoutsize,32 @\
|
||||
.endif @\
|
||||
.set __framesize, ROUND_TO_STACK( \
|
||||
24 + __argoutsize + (localvarsize) \
|
||||
+ 4*(grfsaved) + 8*(fpfsaved)) @\
|
||||
.set __grfbase,(__framesize - 4*(grfsaved) - 8*(fpfsaved)) @\
|
||||
.set __fpfbase,(__framesize - 8*(fpfsaved)) @\
|
||||
mflr r0 @\
|
||||
mfcr r12 @\
|
||||
stw r0,8(sp) @\
|
||||
stw r12,4(sp) @\
|
||||
stwu r1,-__framesize(r1)
|
||||
|
||||
/*
|
||||
* Macros for referencing data in stack frame.
|
||||
*
|
||||
* NOTE WELL: ARG's and VAR's start at 1, NOT 0. Why ??? (FIXME)
|
||||
*/
|
||||
#define LOCAL_VAR(n) (((n)-1)*4 + __argoutsize + 24)
|
||||
#define SAVED_GRF_S(n) (__grfbase + ((grfsaved) - (n) - 2) * 4)
|
||||
#define SAVED_FRF_FS(n) (__fpfbase + ((fpfsaved) - (n) - 1) * 4)
|
||||
#define ARG_IN(n) (ARG(n) + __framesize)
|
||||
#define ARG_OUT(n) (ARG(n) + 0)
|
||||
#define SAVED_FP (__grfbase + ((grfsaved) - 1) * 4)
|
||||
#define SAVED_LR (__framesize + 8)
|
||||
#define SAVED_CR (__framesize + 4)
|
||||
|
||||
/*
|
||||
* Macros for unwinding stack frame.
|
||||
* NOTE: GRF's and FPF's are NOT RESTORED. User must do this before
|
||||
* using this macro.
|
||||
*/
|
||||
#define RETURN \
|
||||
.if __framesize @\
|
||||
lwz32 r0,r1,SAVED_LR @\
|
||||
lwz32 r12,r1,SAVED_CR @\
|
||||
addic sp,r1,__framesize @\
|
||||
mtlr r0 @\
|
||||
mtcrf 0xff,r12 @\
|
||||
blr @\
|
||||
.else @\
|
||||
blr @\
|
||||
.endif
|
||||
|
||||
|
||||
/*
|
||||
* Macros for declaring procedures
|
||||
*
|
||||
* Use of these macros allows ctags to have a predictable way
|
||||
* to find various types of declarations. They also simplify
|
||||
* inserting appropriate symbol table information.
|
||||
*
|
||||
* NOTE: these simple stubs will be replaced with more
|
||||
* complicated versions once we know what the linker and gdb
|
||||
* will require as far as register use masks and frame declarations.
|
||||
* These macros may also be ifdef'ed in the future to contain profiling
|
||||
* code.
|
||||
*
|
||||
* FIXME: Document what makes a leaf a LEAF and a handler a HANDLER.
|
||||
* (E.g. leaf's have return pc in lr, NESTED's have rpc in offset off
|
||||
* sp, handlers have rpc in exception frame which is found via exception
|
||||
* link, etc etc.)
|
||||
*/
|
||||
|
||||
/*
|
||||
* TEXT -- declare start of text segment
|
||||
*/
|
||||
#define TEXT \
|
||||
.text @\
|
||||
.align 2
|
||||
|
||||
/*
|
||||
* LEAF -- declare global leaf procedure
|
||||
* NOTE: Control SHOULD NOT FLOW into a LEAF! A LEAF should only
|
||||
* be jumped to. (A leaf may do an align.) Use a LABEL() if you
|
||||
* need control to flow into the label.
|
||||
*/
|
||||
#define LEAF(name) \
|
||||
.align 2 @\
|
||||
.globl name @\
|
||||
name: @\
|
||||
.set __framesize,0
|
||||
|
||||
/*
|
||||
* X_LEAF -- declare alternate global label for leaf
|
||||
*/
|
||||
#define X_LEAF(name, value) \
|
||||
.globl name @\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_LEAF -- declare private leaf procedure
|
||||
*/
|
||||
#define P_LEAF(name) \
|
||||
.align 2 @\
|
||||
name: @\
|
||||
.set __framesize,0
|
||||
|
||||
/*
|
||||
* LABEL -- declare a global code label
|
||||
* MUST be used (rather than LEAF, NESTED, etc) if control
|
||||
* "flows into" the label.
|
||||
*/
|
||||
#define LABEL(name) \
|
||||
.align 2 @\
|
||||
.globl name @\
|
||||
name:
|
||||
|
||||
/*
|
||||
* NESTED -- declare procedure that invokes other procedures
|
||||
*/
|
||||
#define NESTED(name, localvarsize, maxargsout, grfsaved, fpfsaved)\
|
||||
.align 2 @\
|
||||
.globl name @\
|
||||
name: @\
|
||||
BUILD_FRAME(localvarsize, maxargsout, grfsaved, fpfsaved)
|
||||
|
||||
/*
|
||||
* X_NESTED -- declare alternate global label for nested proc
|
||||
*/
|
||||
#define X_NESTED(name, value) \
|
||||
.globl name @\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_NESTED -- declare private nested procedure
|
||||
*/
|
||||
#define P_NESTED(name, localvarsize, maxargsout, grfsaved, fpfsaved)\
|
||||
.align 2 @\
|
||||
name: @\
|
||||
BUILD_FRAME(locavarsize, maxargsout, grfsaved, fpfsaved)
|
||||
|
||||
/*
|
||||
* HANDLER -- declare procedure with exception frame rather than
|
||||
* standard C frame
|
||||
*/
|
||||
#define HANDLER(name) \
|
||||
.align 2 @\
|
||||
.globl name @\
|
||||
name:
|
||||
|
||||
/*
|
||||
* X_HANDLER -- declare alternate name for exception handler
|
||||
* (Should appear immediately before a HANDLER declaration or
|
||||
* another X_HANDLER declaration)
|
||||
*/
|
||||
#define X_HANDLER(name) \
|
||||
.align 2 @\
|
||||
.globl name @\
|
||||
name:
|
||||
|
||||
/*
|
||||
* P_HANDLER -- declare private handler
|
||||
*/
|
||||
#define P_HANDLER(name) \
|
||||
.align 2 @\
|
||||
name:
|
||||
|
||||
/*
|
||||
* END -- mark end of procedure
|
||||
* FIXME: Unimplemented for now.
|
||||
*/
|
||||
#define END(name)
|
||||
|
||||
/*
|
||||
* BL -- call procedure (relative)
|
||||
*/
|
||||
#define BL(name) \
|
||||
bl name
|
||||
|
||||
/*
|
||||
* Storage definition macros
|
||||
* The main purpose of these is to allow an easy handle for ctags
|
||||
*/
|
||||
|
||||
/*
|
||||
* IMPORT -- import symbol
|
||||
*/
|
||||
#define IMPORT(name) \
|
||||
.reference name
|
||||
|
||||
/*
|
||||
* ABS -- declare global absolute symbol
|
||||
*/
|
||||
#define ABS(name, value) \
|
||||
.globl name @\
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* P_ABS -- declare private absolute symbol
|
||||
*/
|
||||
#define P_ABS(name, value) \
|
||||
.set name,value
|
||||
|
||||
/*
|
||||
* EXPORT -- declare global label for data
|
||||
*/
|
||||
#define EXPORT(name) \
|
||||
.align 2 @\
|
||||
.globl name @\
|
||||
name:
|
||||
|
||||
/*
|
||||
* BSS -- declare global zero'ed storage
|
||||
*/
|
||||
#define BSS(name,size) \
|
||||
.comm name,size
|
||||
|
||||
|
||||
/*
|
||||
* P_BSS -- declare private zero'ed storage
|
||||
*/
|
||||
#define P_BSS(name,size) \
|
||||
.lcomm name,size
|
||||
|
||||
/*
|
||||
* dynamic/PIC macros for routines which reference external symbols
|
||||
*/
|
||||
#if defined(__DYNAMIC__)
|
||||
#define PICIFY_REG r12
|
||||
|
||||
/* Assume that the lr is saved before calling any of these macros */
|
||||
/* using PICIFY() */
|
||||
|
||||
#define PICIFY(var) \
|
||||
mflr r0 @\
|
||||
bl 1f @\
|
||||
1: mflr PICIFY_REG @\
|
||||
mtlr r0 @\
|
||||
addis PICIFY_REG, PICIFY_REG, ha16(L ## var ## $non_lazy_ptr - 1b) @\
|
||||
lwz PICIFY_REG, lo16(L ## var ## $non_lazy_ptr - 1b)(PICIFY_REG)
|
||||
|
||||
#define CALL_EXTERN_AGAIN(var) \
|
||||
PICIFY(var) @\
|
||||
mtctr PICIFY_REG @\
|
||||
mflr r0 @\
|
||||
stw r0,8(r1) @\
|
||||
stwu r1,-56(r1) @\
|
||||
bctrl @\
|
||||
addic r1,r1,56 @\
|
||||
lwz r0,8(r1) @\
|
||||
mtlr r0
|
||||
|
||||
#define NON_LAZY_STUB(var) \
|
||||
.non_lazy_symbol_pointer @\
|
||||
.align 2 @\
|
||||
L ## var ## $non_lazy_ptr: @\
|
||||
.indirect_symbol var @\
|
||||
.long 0 @\
|
||||
.text @\
|
||||
.align 2
|
||||
|
||||
#define BRANCH_EXTERN(var) \
|
||||
PICIFY(var) @\
|
||||
mtctr PICIFY_REG @\
|
||||
bctr @\
|
||||
NON_LAZY_STUB(var)
|
||||
|
||||
#define CALL_EXTERN(var) \
|
||||
CALL_EXTERN_AGAIN(var) @\
|
||||
NON_LAZY_STUB(var)
|
||||
|
||||
#define REG_TO_EXTERN(reg, var) \
|
||||
PICIFY(var) @\
|
||||
stw reg, 0(PICIFY_REG) @\
|
||||
NON_LAZY_STUB(var)
|
||||
|
||||
#define EXTERN_TO_REG(reg, var) \
|
||||
PICIFY(var) @\
|
||||
lwz reg, 0(PICIFY_REG) @\
|
||||
NON_LAZY_STUB(var)
|
||||
|
||||
#else /* ! __DYNAMIC__ */
|
||||
#define TMP_REG r12
|
||||
#define BRANCH_EXTERN(var) \
|
||||
b var
|
||||
|
||||
#define CALL_EXTERN(var) \
|
||||
bl var
|
||||
|
||||
#define CALL_EXTERN_AGAIN(var) \
|
||||
CALL_EXTERN(var)
|
||||
|
||||
#define REG_TO_EXTERN(reg, var) \
|
||||
lis TMP_REG, ha16(var) @\
|
||||
stw reg, lo16(var)(TMP_REG)
|
||||
|
||||
#define EXTERN_TO_REG(reg, var) \
|
||||
lis reg, ha16(var) @\
|
||||
lwz reg, lo16(var)(reg)
|
||||
|
||||
#endif /* __DYNAMIC__ */
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
#endif /* _ARCH_PPC_ASM_HELP_H_ */
|
||||
@@ -0,0 +1,306 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1996 NeXT Software, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/ppc/basic_regs.h
|
||||
* Author: Doug Mitchell, NeXT Software, Inc.
|
||||
*
|
||||
* Basic ppc registers.
|
||||
*
|
||||
* HISTORY
|
||||
* 22-May-97 Umesh Vaishampayan (umeshv@apple.com)
|
||||
Updated to match MPCFPE32B/AD 1/97 REV. 1
|
||||
* 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
|
||||
* Ported from m98k.
|
||||
* 05-Nov-92 Doug Mitchell at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_PPC_BASIC_REGS_H_
|
||||
#define _ARCH_PPC_BASIC_REGS_H_
|
||||
|
||||
#include <architecture/ppc/reg_help.h>
|
||||
#include <architecture/ppc/macro_help.h>
|
||||
|
||||
#if !defined(__ASSEMBLER__)
|
||||
|
||||
/*
|
||||
* Number of General Purpose registers.
|
||||
*/
|
||||
#define PPC_NGP_REGS 32
|
||||
|
||||
/*
|
||||
* Common half-word used in Machine State Register and in
|
||||
* various exception frames. Defined as a macro because the compiler
|
||||
* will align a struct to a word boundary when used inside another struct.
|
||||
*/
|
||||
#define MSR_BITS \
|
||||
unsigned ee:BIT_WIDTH(15), /* external intr enable */ \
|
||||
pr:BIT_WIDTH(14), /* problem state */ \
|
||||
fp:BIT_WIDTH(13), /* floating point avail */ \
|
||||
me:BIT_WIDTH(12), /* machine check enable */ \
|
||||
fe0:BIT_WIDTH(11), /* fp exception mode 0 */ \
|
||||
se:BIT_WIDTH(10), /* single step enable */ \
|
||||
be:BIT_WIDTH(9), /* branch trace enable */ \
|
||||
fe1:BIT_WIDTH(8), /* fp exception mode 0 */ \
|
||||
rsvd1:BIT_WIDTH(7), /* reserved */ \
|
||||
ip:BIT_WIDTH(6), /* interrupt prefix */ \
|
||||
ir:BIT_WIDTH(5), /* instruction relocate */ \
|
||||
dr:BIT_WIDTH(4), /* data relocate */ \
|
||||
rsvd2:BITS_WIDTH(3,2), /* reserved */ \
|
||||
ri:BIT_WIDTH(1), /* recoverable exception */ \
|
||||
le:BIT_WIDTH(0) /* Little-endian mode */
|
||||
|
||||
/*
|
||||
* Machine state register.
|
||||
* Read and written via get_msr() and set_msr() inlines, below.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned rsvd3:BITS_WIDTH(31,19), // reserved
|
||||
pow:BIT_WIDTH(18), // Power management enable
|
||||
rsvd0: BIT_WIDTH(17), // reserved
|
||||
ile: BIT_WIDTH(16); // exception little endian
|
||||
|
||||
MSR_BITS; // see above
|
||||
} msr_t;
|
||||
|
||||
/*
|
||||
* Data Storage Interrupt Status Register (DSISR)
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned dse:BIT_WIDTH(31); // direct-store error
|
||||
unsigned tnf:BIT_WIDTH(30); // translation not found
|
||||
unsigned :BITS_WIDTH(29,28);
|
||||
unsigned pe:BIT_WIDTH(27); // protection error
|
||||
unsigned dsr:BIT_WIDTH(26); // lwarx/stwcx to direct-store
|
||||
unsigned rw:BIT_WIDTH(25); // 1 => store, 0 => load
|
||||
unsigned :BITS_WIDTH(24,23);
|
||||
unsigned dab:BIT_WIDTH(22); // data address bkpt (601)
|
||||
unsigned ssf:BIT_WIDTH(21); // seg table search failed
|
||||
unsigned :BITS_WIDTH(20,0);
|
||||
} dsisr_t;
|
||||
|
||||
/*
|
||||
* Instruction Storage Interrupt Status Register (really SRR1)
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned :BIT_WIDTH(31);
|
||||
unsigned tnf:BIT_WIDTH(30); // translation not found
|
||||
unsigned :BIT_WIDTH(29);
|
||||
unsigned dse:BIT_WIDTH(28); // direct-store fetch error
|
||||
unsigned pe:BIT_WIDTH(27); // protection error
|
||||
unsigned :BITS_WIDTH(26,22);
|
||||
unsigned ssf:BIT_WIDTH(21); // seg table search failed
|
||||
unsigned :BITS_WIDTH(20,16);
|
||||
MSR_BITS;
|
||||
} isisr_t;
|
||||
|
||||
/*
|
||||
* Alignment Interrupt Status Register (really DSISR)
|
||||
* NOTE: bit numbers in field *names* are in IBM'ese (0 is MSB).
|
||||
* FIXME: Yuck!!! Double Yuck!!!
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned :BITS_WIDTH(31,20);
|
||||
unsigned ds3031:BITS_WIDTH(19,18);// bits 30:31 if DS form
|
||||
unsigned :BIT_WIDTH(17);
|
||||
unsigned x2930:BITS_WIDTH(16,15); // bits 29:30 if X form
|
||||
unsigned x25:BIT_WIDTH(14); // bit 25 if X form or
|
||||
// bit 5 if D or DS form
|
||||
unsigned x2124:BITS_WIDTH(13,10); // bits 21:24 if X form or
|
||||
// bits 1:4 if D or DS form
|
||||
unsigned all615:BITS_WIDTH(9,0); // bits 6:15 of instr
|
||||
MSR_BITS;
|
||||
} aisr_t;
|
||||
|
||||
/*
|
||||
* Program Interrupt Status Register (really SRR1)
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned :BITS_WIDTH(31,21);
|
||||
unsigned fpee:BIT_WIDTH(20); // floating pt enable exception
|
||||
unsigned ill:BIT_WIDTH(19); // illegal instruction
|
||||
unsigned priv:BIT_WIDTH(18); // privileged instruction
|
||||
unsigned trap:BIT_WIDTH(17); // trap program interrupt
|
||||
unsigned subseq:BIT_WIDTH(16); // 1 => SRR0 points to
|
||||
// subsequent instruction
|
||||
MSR_BITS;
|
||||
} pisr_t;
|
||||
|
||||
/*
|
||||
* Condition register. May not be useful in C, let's see...
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned lt:BIT_WIDTH(31), // negative
|
||||
gt:BIT_WIDTH(30), // positive
|
||||
eq:BIT_WIDTH(29), // equal to zero
|
||||
so:BIT_WIDTH(28), // summary overflow
|
||||
fx:BIT_WIDTH(27), // floating point exception
|
||||
fex:BIT_WIDTH(26), // fp enabled exception
|
||||
vx:BIT_WIDTH(25), // fp invalid operation
|
||||
// exception
|
||||
ox:BIT_WIDTH(24), // fp overflow exception
|
||||
rsvd:BITS_WIDTH(23,0); // reserved
|
||||
} cr_t;
|
||||
|
||||
/*
|
||||
* Abstract values representing fe0:fe1.
|
||||
* See get_fp_exc_mode(), below.
|
||||
*/
|
||||
typedef enum {
|
||||
FEM_IGNORE_EXCEP, // ignore exceptions
|
||||
FEM_IMPR_NONREC, // imprecise nonrecoverable
|
||||
FEM_IMPR_RECOV, // imprecise recoverable
|
||||
FEM_PRECISE
|
||||
} fp_exc_mode_t;
|
||||
|
||||
|
||||
/*
|
||||
* Special purpose registers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Processor version register (special purpose register pvr).
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned version:BITS_WIDTH(31,16),
|
||||
revision:BITS_WIDTH(15,0);
|
||||
} pvr_t;
|
||||
|
||||
/*
|
||||
* Fixed point exception register (special purpose register xer)
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned so:BIT_WIDTH(31), // summary overflow
|
||||
ov:BIT_WIDTH(30), // overflow
|
||||
ca:BIT_WIDTH(29), // carry
|
||||
rsvd1:BITS_WIDTH(28,7), // reserved
|
||||
byte_count:BITS_WIDTH(6,0);
|
||||
} xer_t;
|
||||
|
||||
/*
|
||||
* Inlines and macros to manipulate the above registers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Get/set machine state register.
|
||||
*/
|
||||
static __inline__ msr_t
|
||||
get_msr()
|
||||
{
|
||||
msr_t __msr_tmp;
|
||||
__asm__ volatile ("mfmsr %0 /* mfmsr */" : "=r" (__msr_tmp));
|
||||
return __msr_tmp;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
set_msr(msr_t msr)
|
||||
{
|
||||
__asm__ volatile ("mtmsr %0 /* mtmsr */ " : : "r" (msr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine current fp_exc_mode_t given prog_mode.
|
||||
*/
|
||||
static __inline__ fp_exc_mode_t
|
||||
get_fp_exc_mode(pmr_t pmr)
|
||||
{
|
||||
if(pmr.fe0)
|
||||
return pmr.fe1 ? FEM_PRECISE : FEM_IMPR_RECOV;
|
||||
else
|
||||
return pmr.fe1 ? FEM_IMPR_NONREC : FEM_IGNORE_EXCEP;
|
||||
}
|
||||
|
||||
/*
|
||||
* Software definitions for special purpose registers.
|
||||
* The same register is used as per_cpu data pointer and
|
||||
* vector base register. This requires that the vector
|
||||
* table be the first item in the per_cpu table.
|
||||
*/
|
||||
#define SR_EXCEPTION_TMP_LR sprg0
|
||||
#define SR_EXCEPTION_TMP_CR sprg1
|
||||
#define SR_EXCEPTION_TMP_AT sprg2
|
||||
#define SR_PER_CPU_DATA sprg3
|
||||
#define SR_VBR sprg3
|
||||
|
||||
/*
|
||||
* Get/set special purpose registers.
|
||||
*
|
||||
* GET_SPR - get SPR by name.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* {
|
||||
* xer_t some_xer;
|
||||
*
|
||||
* some_xer = GET_SPR(xer_t, xer);
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* This is a strange one. We're creating a list of C expressions within
|
||||
* a set of curlies; the last expression ("__spr_tmp;") is the return value
|
||||
* of the statement created by the curlies.
|
||||
*
|
||||
*/
|
||||
|
||||
#define GET_SPR(type, spr) \
|
||||
({ \
|
||||
unsigned __spr_tmp; \
|
||||
__asm__ volatile ("mfspr %0, " STRINGIFY(spr) : "=r" (__spr_tmp)); \
|
||||
*(type *)&__spr_tmp; \
|
||||
})
|
||||
|
||||
/*
|
||||
* Example usage of SET_SPR:
|
||||
*
|
||||
* {
|
||||
* xer_t some_xer;
|
||||
*
|
||||
* ...set up some_xer...
|
||||
* SET_SPR(xer, some_xer);
|
||||
* }
|
||||
*/
|
||||
#define SET_SPR(spr, val) \
|
||||
MACRO_BEGIN \
|
||||
__typeof__ (val) __spr_tmp = (val); \
|
||||
__asm__ volatile ("mtspr "STRINGIFY(spr) ", %0" : : "r" (__spr_tmp)); \
|
||||
MACRO_END
|
||||
|
||||
/*
|
||||
* Fully synchronize instruction stream.
|
||||
*/
|
||||
static __inline__ void
|
||||
ppc_sync()
|
||||
{
|
||||
__asm__ volatile ("sync /* sync */" : : );
|
||||
}
|
||||
|
||||
#endif /* ! __ASSEMBLER__ */
|
||||
|
||||
#endif /* _ARCH_PPC_BASIC_REGS_H_ */
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1991 NeXT Software, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/ppc/cframe.h
|
||||
* Author: Mike DeMoney, NeXT Software, Inc.
|
||||
*
|
||||
* This include file defines C calling sequence defines
|
||||
* for ppc port.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_PPC_CFRAME_H_
|
||||
#define _ARCH_PPC_CFRAME_H_
|
||||
|
||||
#if defined (__ppc64__)
|
||||
#define C_ARGSAVE_LEN 64 /* at least 64 bytes of arg save */
|
||||
#define C_STACK_ALIGN 32 /* stack must be 32 byte aligned */
|
||||
#define C_RED_ZONE 320 /* 320 bytes to skip over saved registers */
|
||||
#else
|
||||
#define C_ARGSAVE_LEN 32 /* at least 32 bytes of arg save */
|
||||
#define C_STACK_ALIGN 16 /* stack must be 16 byte aligned */
|
||||
#define C_RED_ZONE 224 /* 224 bytes to skip over saved registers */
|
||||
#endif
|
||||
|
||||
#endif /* _ARCH_PPC_CFRAME_H_ */
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1996 NeXT Software, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/ppc/fp_regs.h
|
||||
* Author: Doug Mitchell, NeXT Software, Inc.
|
||||
*
|
||||
* ppc floating point registers.
|
||||
*
|
||||
* HISTORY
|
||||
* 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
|
||||
* Ported from m98k.
|
||||
* 05-Nov-92 Doug Mitchell at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_PPC_FP_REGS_H_
|
||||
#define _ARCH_PPC_FP_REGS_H_
|
||||
|
||||
#include <architecture/ppc/reg_help.h>
|
||||
|
||||
#if !defined(__ASSEMBLER__)
|
||||
/*
|
||||
* Floating point status and control register.
|
||||
*
|
||||
* This struct is aligned to an 8-byte boundary because 64-bit
|
||||
* load/store instructions (lfd/stfd) are used to access it. The
|
||||
* FPSCR can only be read/written through other FP registers.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned unused[1] __attribute__(( aligned(8) ));
|
||||
unsigned fx:BIT_WIDTH(31), // exception summary
|
||||
fex:BIT_WIDTH(30), // enabled exception summary
|
||||
vx:BIT_WIDTH(29), // invalid op exception
|
||||
// summary
|
||||
ox:BIT_WIDTH(28), // overflow exception
|
||||
ux:BIT_WIDTH(27), // underflow exception
|
||||
zx:BIT_WIDTH(26), // divide by zero exception
|
||||
xx:BIT_WIDTH(25), // inexact exception
|
||||
vx_snan:BIT_WIDTH(24), // not a number exception
|
||||
vx_isi:BIT_WIDTH(23), // exception
|
||||
vx_idi:BIT_WIDTH(22), // exception
|
||||
vx_zdz:BIT_WIDTH(21), // exception
|
||||
vx_imz:BIT_WIDTH(20), // exception
|
||||
vx_xvc:BIT_WIDTH(19), // exception
|
||||
fr:BIT_WIDTH(18), // fraction rounded
|
||||
fi:BIT_WIDTH(17), // fraction inexact
|
||||
class:BIT_WIDTH(16), // class descriptor
|
||||
fl:BIT_WIDTH(15), // negative
|
||||
fg:BIT_WIDTH(14), // positive
|
||||
fe:BIT_WIDTH(13), // equal or zero
|
||||
fu:BIT_WIDTH(12), // not a number
|
||||
rsvd1:BIT_WIDTH(11), // reserved
|
||||
vx_soft:BIT_WIDTH(10), // software request exception
|
||||
rsvd2:BIT_WIDTH(9), // reserved
|
||||
vx_cvi:BIT_WIDTH(8), // invalid integer convert
|
||||
// exception
|
||||
ve:BIT_WIDTH(7), // invalid op exception enable
|
||||
oe:BIT_WIDTH(6), // overflow exception enable
|
||||
ue:BIT_WIDTH(5), // underflow exception enable
|
||||
ze:BIT_WIDTH(4), // divide by zero exception
|
||||
// enable
|
||||
xe:BIT_WIDTH(3), // inexact exception enable
|
||||
ni:BIT_WIDTH(2), // non-IEEE exception enable
|
||||
rn:BITS_WIDTH(1,0); // rounding control
|
||||
} ppc_fp_scr_t;
|
||||
|
||||
/*
|
||||
* Values for fp_scr_t.rn (rounding control).
|
||||
*/
|
||||
typedef enum {
|
||||
RN_NEAREST = 0,
|
||||
RN_TOWARD_ZERO = 1,
|
||||
RN_TOWARD_PLUS = 2,
|
||||
RN_TOWARD_MINUS = 3
|
||||
} ppc_fp_rn_t;
|
||||
|
||||
/*
|
||||
* ppc_fpf_t -- data types that MAY be in floating point register file
|
||||
* Actual data types supported is implementation dependent
|
||||
*/
|
||||
typedef union {
|
||||
float f; // 32 bit IEEE single
|
||||
double d; // 64 bit IEEE double
|
||||
|
||||
/*
|
||||
* Insure compiler aligns struct appropriately
|
||||
*/
|
||||
unsigned x[2] __attribute__(( aligned(8) ));
|
||||
} ppc_fpf_t;
|
||||
|
||||
/*
|
||||
* Number of FP registers.
|
||||
*/
|
||||
#define PPC_NFP_REGS 32
|
||||
|
||||
/*
|
||||
* Read/write FPSCR.
|
||||
* FIXME - these don't work, you need to go thru a fp register.
|
||||
*/
|
||||
typedef union {
|
||||
double __dbl;
|
||||
ppc_fp_scr_t __scr;
|
||||
} __fp_un_t;
|
||||
|
||||
static __inline__ ppc_fp_scr_t
|
||||
get_fp_scr()
|
||||
{
|
||||
__fp_un_t __fp_un;
|
||||
|
||||
__asm__ volatile ("mffs. %0 /* mffs */" \
|
||||
: "=f" (__fp_un.__dbl));
|
||||
return (__fp_un.__scr);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
set_fp_scr(ppc_fp_scr_t fp_scr)
|
||||
{
|
||||
__fp_un_t __fp_un;
|
||||
|
||||
__fp_un.__scr = fp_scr;
|
||||
__asm__ volatile ("mtfsf 0xff, %0; /* mtfsf */ " \
|
||||
: : "f" (__fp_un.__dbl));
|
||||
}
|
||||
|
||||
#endif /* ! __ASSEMBLER__ */
|
||||
|
||||
#endif /* _ARCH_PPC_FP_REGS_H_ */
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1996 NeXT Software, Inc.
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1989 Carnegie-Mellon University
|
||||
* Copyright (c) 1988 Carnegie-Mellon University
|
||||
* All rights reserved. The CMU software License Agreement specifies
|
||||
* the terms and conditions for use and redistribution.
|
||||
*
|
||||
* File: architecture/ppc/macro_help.h
|
||||
*
|
||||
* Provide help in making lint-free macro routines
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
|
||||
* Created from m98k version.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_PPC_MACRO_HELP_H_
|
||||
#define _ARCH_PPC_MACRO_HELP_H_
|
||||
|
||||
#ifndef MACRO_BEGIN
|
||||
# define MACRO_BEGIN do {
|
||||
#endif /* MACRO_BEGIN */
|
||||
|
||||
#ifndef MACRO_END
|
||||
# define MACRO_END } while (0)
|
||||
#endif /* MACRO_END */
|
||||
|
||||
#ifndef MACRO_RETURN
|
||||
# define MACRO_RETURN if (1) return
|
||||
#endif /* MACRO_RETURN */
|
||||
|
||||
#endif /* _ARCH_PPC_MACRO_HELP_H_ */
|
||||
|
||||
@@ -0,0 +1,420 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1996 NeXT Software, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/ppc/pseudo_inst.h
|
||||
* Author: Mike DeMoney
|
||||
*
|
||||
* This header file defines assembler pseudo-instruction macros for
|
||||
* for the ppc.
|
||||
*
|
||||
* NOTE: This is obviously only useful to include in assembly
|
||||
* code source.
|
||||
*
|
||||
* ALSO NOTE: These macros don't attempt to be 64-bit compatable
|
||||
*
|
||||
* HISTORY
|
||||
* 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
|
||||
* Ported from m98k.
|
||||
* 05-Nov-92 Mike DeMoney (mike@next.com)
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_PPC_PSEUDO_INST_H_
|
||||
#define _ARCH_PPC_PSEUDO_INST_H_
|
||||
|
||||
#include <architecture/ppc/reg_help.h>
|
||||
#include <architecture/ppc/asm_help.h>
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
/*
|
||||
* Pseudo instruction definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Macro package initialization
|
||||
*/
|
||||
.set __no_at,0 /* allow at by default */
|
||||
|
||||
/*
|
||||
* .at_off -- disable use of at by macros
|
||||
* .at_on -- enable use of at by macros
|
||||
*/
|
||||
.macro .at_off
|
||||
.set __no_at,1
|
||||
.endmacro
|
||||
|
||||
.macro .at_on
|
||||
.set __no_at,0
|
||||
.endmacro
|
||||
|
||||
/*
|
||||
* li32 rD,IMMED
|
||||
*
|
||||
* Load 32-bit immediate into rD
|
||||
* FIXME: Need a way to undefine built-in macro for this.
|
||||
*/
|
||||
.macro li32 // li32 rD,immed
|
||||
.if $n != 2
|
||||
.abort "invalid operands of li32"
|
||||
.endif
|
||||
.abs __is_abs,$1
|
||||
.if !__is_abs
|
||||
addis $0,0,hi16($1)
|
||||
ori $0,$0,lo16($1)
|
||||
.elseif $1 == 0
|
||||
addi $0,0,0
|
||||
.elseif ($1 & 0xffff) == 0
|
||||
addis $0,0,hi16($1)
|
||||
.elseif ($1 & 0xffff8000) == 0
|
||||
addi $0,0,$1
|
||||
.elseif ($1 & 0xffff8000) == 0xffff8000
|
||||
addi $0,0,$1
|
||||
.else
|
||||
addis $0,0,hi16($1)
|
||||
ori $0,$0,lo16($1)
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
|
||||
/*
|
||||
* andi32. rD,rS1,IMMED
|
||||
*
|
||||
* Perform "andi." with (possibly) 32-bit immediate
|
||||
*/
|
||||
.macro andi32. // andi32. rD,rS1,IMMED
|
||||
.if $n != 3
|
||||
.abort "invalid operands of andi."
|
||||
.endif
|
||||
.set __used_at,0
|
||||
.abs __is_abs,$2
|
||||
.if !__is_abs
|
||||
.set __used_at,1
|
||||
li32 at,$2
|
||||
and. $0,$1,at
|
||||
.elseif ($2 & 0xffff0000) == 0
|
||||
andi. $0,$1,$2
|
||||
.elseif ($2 & 0xffff) == 0
|
||||
andis. $0,$1,hi16($2)
|
||||
.else
|
||||
.set __used_at,1
|
||||
li32 at,$2
|
||||
and. $0,$1,at
|
||||
.endif
|
||||
.if __no_at & __used_at
|
||||
.abort "Macro uses at while .no_at in effect"
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
/*
|
||||
* ori32 rD,rS1,IMMED
|
||||
*
|
||||
* Perform "ori" with (possibly) 32-bit immediate
|
||||
*/
|
||||
.macro ori32 // ori32 rD,rS1,IMMED
|
||||
.if $n != 3
|
||||
.abort "invalid operands of ori"
|
||||
.endif
|
||||
.abs __is_abs,$2
|
||||
.if !__is_abs
|
||||
oris $0,$1,hi16($2)
|
||||
ori $0,$1,lo16($2)
|
||||
.elseif ($2 & 0xffff0000) == 0
|
||||
ori $0,$1,$2
|
||||
.elseif ($2 & 0xffff) == 0
|
||||
oris $0,$1,hi16($2)
|
||||
.else
|
||||
oris $0,$1,hi16($2)
|
||||
ori $0,$1,lo16($2)
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
/*
|
||||
* xori32 rD,rS1,IMMED
|
||||
*
|
||||
* Perform "xor" with (possibly) 32-bit immediate
|
||||
*/
|
||||
.macro xori32 // xori32 rD,rS1,IMMED
|
||||
.if $n != 3
|
||||
.abort "invalid operands of xori"
|
||||
.endif
|
||||
.abs __is_abs,$2
|
||||
.if !__is_abs
|
||||
xoris $0,$1,hi16($2)
|
||||
xori $0,$1,lo16($2)
|
||||
.elseif ($2 & 0xffff0000) == 0
|
||||
xori $0,$1,$2
|
||||
.elseif ($2 & 0xffff) == 0
|
||||
xoris $0,$1,hi16($2)
|
||||
.else
|
||||
xoris $0,$1,hi16($2)
|
||||
xori $0,$1,lo16($2)
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
|
||||
/*
|
||||
* MEMREF_INST -- macros to memory referencing instructions
|
||||
* "capable" of dealing with 32 bit offsets.
|
||||
*
|
||||
* NOTE: Because the assembler doesn't have any mechanism for easily
|
||||
* parsing the d(rS) syntax of register-displacement form instructions,
|
||||
* these instructions do NOT mirror the normal memory reference
|
||||
* instructions. The following "transformation" is used:
|
||||
* lbz rD,d(rS)
|
||||
* becomes:
|
||||
* lbz32 rD,rS,d
|
||||
* I.e.: "32" is appended to the instruction name and the base register
|
||||
* and displacement become the 2'nd and 3'rd comma-separated operands.
|
||||
*
|
||||
* The forms:
|
||||
* lbz32 rD,d
|
||||
* and:
|
||||
* lbz32 rD,rS
|
||||
* are also recognized and the missing operand is assumed 0.
|
||||
*
|
||||
* ALSO NOTE: r0 or zt should never be used as rS in these instructions.
|
||||
* Use "0" as rS in this case.
|
||||
*/
|
||||
#define MEMREF_INST(op) \
|
||||
.macro op ## 32 @\
|
||||
.set __used_at,0 @\
|
||||
.if $n == 3 @\
|
||||
.greg __is_greg,$1 @\
|
||||
.abs __is_abs,$2 @\
|
||||
.if __is_abs @\
|
||||
.if ($2 & 0xffff8000) == 0 @\
|
||||
op $0,$2($1) @\
|
||||
.elseif ($2 & 0xffff8000) == 0xffff8000 @\
|
||||
op $0,$2($1) @\
|
||||
.else @\
|
||||
.if !__is_greg @\
|
||||
.set __used_at,1 @\
|
||||
lis at,ha16($2) @\
|
||||
op $0,lo16($2)(at) @\
|
||||
.else @\
|
||||
.set __used_at,1 @\
|
||||
lis at,ha16($2) @\
|
||||
add at,at,$1 @\
|
||||
op $0,lo16($2)(at) @\
|
||||
.endif @\
|
||||
.endif @\
|
||||
.else @\
|
||||
.if !__is_greg @\
|
||||
.set __used_at,1 @\
|
||||
lis at,ha16($2) @\
|
||||
op $0,lo16($2)(at) @\
|
||||
.else @\
|
||||
.set __used_at,1 @\
|
||||
lis at,ha16($2) @\
|
||||
add at,at,$1 @\
|
||||
op $0,lo16($2)(at) @\
|
||||
.endif @\
|
||||
.endif @\
|
||||
.elseif $n == 2 @\
|
||||
.greg __is_greg,$1 @\
|
||||
.if !__is_greg @\
|
||||
.abs __is_abs,$1 @\
|
||||
.if __is_abs @\
|
||||
.if ($1 & 0xffff8000) == 0 @\
|
||||
op $0,$1(0) @\
|
||||
.elseif ($1 & 0xffff8000) == 0xffff8000 @\
|
||||
op $0,$1(0) @\
|
||||
.else @\
|
||||
.set __used_at,1 @\
|
||||
lis at,ha16($1) @\
|
||||
op $0,lo16($1)(at) @\
|
||||
.endif @\
|
||||
.else @\
|
||||
.set __used_at,1 @\
|
||||
lis at,ha16($1) @\
|
||||
op $0,lo16($1)(at) @\
|
||||
.endif @\
|
||||
.else @\
|
||||
op $0,0($1) @\
|
||||
.endif @\
|
||||
.else @\
|
||||
.abort "Invalid operands of " #op "32" @\
|
||||
.endif @\
|
||||
.if __no_at & __used_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.endif @\
|
||||
.endmacro
|
||||
|
||||
MEMREF_INST(lbz)
|
||||
MEMREF_INST(lhz)
|
||||
MEMREF_INST(lha)
|
||||
MEMREF_INST(lwz)
|
||||
MEMREF_INST(lwa)
|
||||
MEMREF_INST(ld)
|
||||
|
||||
MEMREF_INST(stb)
|
||||
MEMREF_INST(sth)
|
||||
MEMREF_INST(stw)
|
||||
MEMREF_INST(std)
|
||||
|
||||
MEMREF_INST(lmw)
|
||||
MEMREF_INST(lmd)
|
||||
MEMREF_INST(stmw)
|
||||
MEMREF_INST(stmd)
|
||||
|
||||
/*
|
||||
* ARITH_INST -- define 32-bit immediate forms of arithmetic
|
||||
* instructions
|
||||
*
|
||||
* E.g. addi32 rD,rS,IMMED
|
||||
*/
|
||||
#define ARITH_INST(op, op3, sf) \
|
||||
.macro op ## 32 ## sf @\
|
||||
.if $n != 3 @\
|
||||
.abort "invalid operands to " #op "32" @\
|
||||
.endif @\
|
||||
.abs __is_abs,$2 @\
|
||||
.if __is_abs @\
|
||||
.if ($2 & 0xffff8000) == 0 @\
|
||||
op##sf $0,$1,$2 @\
|
||||
.elseif ($2 & 0xffff8000) == 0xffff8000 @\
|
||||
op##sf $0,$1,$2 @\
|
||||
.elseif __no_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.else @\
|
||||
li32 at,$2 @\
|
||||
op3##sf $0,$1,at @\
|
||||
.endif @\
|
||||
.elseif __no_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.else @\
|
||||
li32 at,$2 @\
|
||||
op3##sf $0,$1,at @\
|
||||
.endif @\
|
||||
.endmacro
|
||||
|
||||
ARITH_INST(addi, add, )
|
||||
ARITH_INST(subi, sub, )
|
||||
ARITH_INST(addic, addc, )
|
||||
ARITH_INST(subic, subc, )
|
||||
ARITH_INST(addic, addc, .)
|
||||
ARITH_INST(subic, subc, .)
|
||||
ARITH_INST(mulli, mull, )
|
||||
|
||||
/*
|
||||
* CMPEX_INST -- define 32-bit immediate forms of extended compare
|
||||
* instructions
|
||||
*
|
||||
* E.g. cmpwi32 cr3,rS,IMMED
|
||||
* cmpwi32 rS,IMMED
|
||||
*/
|
||||
#define CMPEX_INST(op, op3) \
|
||||
.macro op ## 32 @\
|
||||
.if $n == 3 @\
|
||||
.abs __is_abs,$2 @\
|
||||
.if __is_abs @\
|
||||
.if ($2 & 0xffff8000) == 0 @\
|
||||
op $0,$1,$2 @\
|
||||
.elseif ($2 & 0xffff8000) == 0xffff8000 @\
|
||||
op $0,$1,$2 @\
|
||||
.elseif __no_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.else @\
|
||||
li32 at,$2 @\
|
||||
op3 $0,$1,at @\
|
||||
.endif @\
|
||||
.elseif __no_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.else @\
|
||||
li32 at,$2 @\
|
||||
op3 $0,$1,at @\
|
||||
.endif @\
|
||||
.elseif $n == 2 @\
|
||||
.abs __is_abs,$1 @\
|
||||
.if __is_abs @\
|
||||
.if ($1 & 0xffff8000) == 0 @\
|
||||
op $0,$1 @\
|
||||
.elseif ($1 & 0xffff8000) == 0xffff8000 @\
|
||||
op $0,$1 @\
|
||||
.elseif __no_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.else @\
|
||||
li32 at,$1 @\
|
||||
op3 $0,at @\
|
||||
.endif @\
|
||||
.elseif __no_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.else @\
|
||||
li32 at,$1 @\
|
||||
op3 $0,at @\
|
||||
.endif @\
|
||||
.else @\
|
||||
.abort "invalid operands to " #op "32" @\
|
||||
.endif @\
|
||||
.endmacro
|
||||
|
||||
CMPEX_INST(cmpdi, cmpd)
|
||||
CMPEX_INST(cmpwi, cmpw)
|
||||
CMPEX_INST(cmpldi, cmpld)
|
||||
CMPEX_INST(cmplwi, cmplw)
|
||||
|
||||
/*
|
||||
* CMP_INST -- define 32-bit immediate forms of standard compare
|
||||
* instructions
|
||||
*
|
||||
* E.g. cmpi32 cr3,0,rS,IMMED
|
||||
*/
|
||||
#define CMP_INST(op, op3) \
|
||||
.macro op ## 32 @\
|
||||
.if $n == 4 @\
|
||||
.abs __is_abs,$3 @\
|
||||
.if __is_abs @\
|
||||
.if ($3 & 0xffff8000) == 0 @\
|
||||
op $0,$1,$2,$3 @\
|
||||
.elseif ($3 & 0xffff8000) == 0xffff8000 @\
|
||||
op $0,$1,$2,$3 @\
|
||||
.elseif __no_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.else @\
|
||||
li32 at,$3 @\
|
||||
op3 $0,$1,$2,at @\
|
||||
.endif @\
|
||||
.elseif __no_at @\
|
||||
.abort "Macro uses at while .no_at in effect" @\
|
||||
.else @\
|
||||
li32 at,$3 @\
|
||||
op3 $0,$1,$2,at @\
|
||||
.endif @\
|
||||
.else @\
|
||||
.abort "invalid operands to " #op "32" @\
|
||||
.endif @\
|
||||
.endmacro
|
||||
|
||||
CMP_INST(cmpi, cmp)
|
||||
CMP_INST(cmpli, cmpl)
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* _ARCH_PPC_PSEUDO_INST_H_ */
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1996 NeXT Software, Inc. All rights reserved.
|
||||
*
|
||||
* File: architecture/ppc/reg_help.h
|
||||
* Author: Doug Mitchell, NeXT Computer, Inc.
|
||||
*
|
||||
* m98k-specific macros and inlines for defining machine registers.
|
||||
*
|
||||
* HISTORY
|
||||
* 05-Nov-92 Doug Mitchell at NeXT
|
||||
* Created.
|
||||
*
|
||||
* 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
|
||||
* Ported from m98k. Removed dependency on nrw directory.
|
||||
* Merged code from architecture/nrw/reg_help.h.
|
||||
* Moved Register Usage #defines from asm_help.h in here.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_PPC_REG_HELP_H_
|
||||
#define _ARCH_PPC_REG_HELP_H_
|
||||
|
||||
#if defined(__ASSEMBLER__)
|
||||
/*
|
||||
* GRF Register Usage Aliases
|
||||
*/
|
||||
#define zt r0 // architecturally 0 for mem refs only!
|
||||
// real reg other inst, caller-saved
|
||||
#define sp r1 // stack pointer, callee-saved
|
||||
#define toc r2 // tbl of contents, callee-saved
|
||||
#define a0 r3 // arg 0, return value 0, caller saved
|
||||
#define a1 r4 // arg 1, return value 1, caller saved
|
||||
#define a2 r5 // ....
|
||||
#define a3 r6
|
||||
#define a4 r7
|
||||
#define a5 r8
|
||||
#define a6 r9
|
||||
#define a7 r10 // arg 7, return value 7, caller saved
|
||||
#define ep r11 // environment ptr, caller saved
|
||||
#define at r12 // assembler temp, caller saved
|
||||
#define s17 r13 // callee-saved 17
|
||||
#define s16 r14
|
||||
#define s15 r15
|
||||
#define s14 r16
|
||||
#define s13 r17
|
||||
#define s12 r18
|
||||
#define s11 r19
|
||||
#define s10 r20
|
||||
#define s9 r21
|
||||
#define s8 r22
|
||||
#define s7 r23
|
||||
#define s6 r24
|
||||
#define s5 r25
|
||||
#define s4 r26
|
||||
#define s3 r27
|
||||
#define s2 r28
|
||||
#define s1 r29 // ....
|
||||
#define s0 r30 // callee-saved 0
|
||||
#define fp r31 // frame-pointer, callee-saved
|
||||
|
||||
/*
|
||||
* Conversion of GRF aliases to register numbers
|
||||
*/
|
||||
#define GRF_ZT 0 // architecturally 0 for mem refs only!
|
||||
// real reg other inst, caller-saved
|
||||
#define GRF_SP 1 // stack pointer, callee-saved
|
||||
#define GRF_TOC 2 // tbl of contents, callee-saved
|
||||
#define GRF_A0 3 // arg 0, return value 0, caller saved
|
||||
#define GRF_A1 4 // arg 1, return value 1, caller saved
|
||||
#define GRF_A2 5 // ....
|
||||
#define GRF_A3 6
|
||||
#define GRF_A4 7
|
||||
#define GRF_A5 8
|
||||
#define GRF_A6 9
|
||||
#define GRF_A7 10 // arg 7, return value 7, caller saved
|
||||
#define GRF_EP 11 // environment ptr, caller saved
|
||||
#define GRF_AT 12 // assembler temp, caller saved
|
||||
#define GRF_S17 13 // callee-saved 17
|
||||
#define GRF_S16 14
|
||||
#define GRF_S15 15
|
||||
#define GRF_S14 16
|
||||
#define GRF_S13 17
|
||||
#define GRF_S12 18
|
||||
#define GRF_S11 19
|
||||
#define GRF_S10 20
|
||||
#define GRF_S9 21
|
||||
#define GRF_S8 22
|
||||
#define GRF_S7 23
|
||||
#define GRF_S6 24
|
||||
#define GRF_S5 25
|
||||
#define GRF_S4 26
|
||||
#define GRF_S3 27
|
||||
#define GRF_S2 28
|
||||
#define GRF_S1 29 // ....
|
||||
#define GRF_S0 30 // callee-saved 0
|
||||
#define GRF_FP 31 // frame pointer, callee-saved
|
||||
|
||||
/*
|
||||
* FPF Register names
|
||||
*/
|
||||
#define ft0 f0 // scratch reg, caller-saved
|
||||
#define fa0 f1 // fp arg 0, return 0, caller-saved
|
||||
#define fa1 f2 // fp arg 1, caller-saved
|
||||
#define fa2 f3 // fp arg 2, caller-saved
|
||||
#define fa3 f4
|
||||
#define fa4 f5
|
||||
#define fa5 f6
|
||||
#define fa6 f7
|
||||
#define fa7 f8
|
||||
#define fa8 f9
|
||||
#define fa9 f10
|
||||
#define fa10 f11
|
||||
#define fa11 f12
|
||||
#define fa12 f13 // fp arg 12, caller-saved
|
||||
#define fs17 f14 // callee-saved 17
|
||||
#define fs16 f15
|
||||
#define fs15 f16
|
||||
#define fs14 f17
|
||||
#define fs13 f18
|
||||
#define fs12 f19
|
||||
#define fs11 f20
|
||||
#define fs10 f21
|
||||
#define fs9 f22
|
||||
#define fs8 f23
|
||||
#define fs7 f24
|
||||
#define fs6 f25
|
||||
#define fs5 f26
|
||||
#define fs4 f27
|
||||
#define fs3 f28
|
||||
#define fs2 f29
|
||||
#define fs1 f30
|
||||
#define fs0 f31 // callee-saved 0
|
||||
|
||||
/*
|
||||
* Conversion of FPF aliases to register numbers
|
||||
*/
|
||||
#define FPF_FT0 0 // scratch reg, caller-saved
|
||||
#define FPF_FA0 1 // fp arg 0, return 0, caller-saved
|
||||
#define FPF_FA1 2 // fp arg 1, caller-saved
|
||||
#define FPF_FA2 3 // fp arg 2, caller-saved
|
||||
#define FPF_FA3 4
|
||||
#define FPF_FA4 5
|
||||
#define FPF_FA5 6
|
||||
#define FPF_FA6 7
|
||||
#define FPF_FA7 8
|
||||
#define FPF_FA8 9
|
||||
#define FPF_FA9 10
|
||||
#define FPF_FA10 11
|
||||
#define FPF_FA11 12
|
||||
#define FPF_FA12 13 // fp arg 12, caller-saved
|
||||
#define FPF_FS17 14 // callee-saved 17
|
||||
#define FPF_FS16 15
|
||||
#define FPF_FS15 16
|
||||
#define FPF_FS14 17
|
||||
#define FPF_FS13 18
|
||||
#define FPF_FS12 19
|
||||
#define FPF_FS11 20
|
||||
#define FPF_FS10 21
|
||||
#define FPF_FS9 22
|
||||
#define FPF_FS8 23
|
||||
#define FPF_FS7 24
|
||||
#define FPF_FS6 25
|
||||
#define FPF_FS5 26
|
||||
#define FPF_FS4 27
|
||||
#define FPF_FS3 28
|
||||
#define FPF_FS2 29
|
||||
#define FPF_FS1 30
|
||||
#define FPF_FS0 31 // callee-saved 0
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
|
||||
/* Bitfield definition aid */
|
||||
#define BITS_WIDTH(msb, lsb) ((msb)-(lsb)+1)
|
||||
#define BIT_WIDTH(pos) (1) /* mostly to record the position */
|
||||
|
||||
/* Mask creation */
|
||||
#define MKMASK(width, offset) (((unsigned)-1)>>(32-(width))<<(offset))
|
||||
#define BITSMASK(msb, lsb) MKMASK(BITS_WIDTH(msb, lsb), lsb & 0x1f)
|
||||
#define BITMASK(pos) MKMASK(BIT_WIDTH(pos), pos & 0x1f)
|
||||
|
||||
/* Register addresses */
|
||||
#if __ASSEMBLER__
|
||||
# define REG_ADDR(type, addr) (addr)
|
||||
#else /* ! __ASSEMBLER__ */
|
||||
# define REG_ADDR(type, addr) (*(volatile type *)(addr))
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
/* Cast a register to be an unsigned */
|
||||
/* CAUTION : non naturally aligned foo can result into alignment traps
|
||||
* use at own risk.
|
||||
*/
|
||||
#define CONTENTS(foo) (*(unsigned *) &(foo))
|
||||
|
||||
/* STRINGIFY -- perform all possible substitutions, then stringify */
|
||||
#define __STR(x) #x /* just a helper macro */
|
||||
#define STRINGIFY(x) __STR(x)
|
||||
|
||||
/*
|
||||
* Stack pointer must always be a multiple of 16
|
||||
*/
|
||||
#define STACK_INCR 16
|
||||
#define ROUND_FRAME(x) ((((unsigned)(x)) + STACK_INCR - 1) & ~(STACK_INCR-1))
|
||||
|
||||
#endif /* _ARCH_PPC_REG_HELP_H_ */
|
||||
@@ -0,0 +1,320 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#ifndef _ARM_ASM_H_
|
||||
#define _ARM_ASM_H_
|
||||
|
||||
#include <arm/arch.h>
|
||||
|
||||
#define FRAME pushl %ebp; movl %esp, %ebp
|
||||
#define EMARF leave
|
||||
|
||||
|
||||
/* There is another definition of ALIGN for .c sources */
|
||||
#ifdef ASSEMBLER
|
||||
#define ALIGN 2
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#ifndef FALIGN
|
||||
#define FALIGN ALIGN
|
||||
#endif
|
||||
|
||||
#define LB(x,n) n
|
||||
#if __STDC__
|
||||
#ifndef __NO_UNDERSCORES__
|
||||
#define LCL(x) L ## x
|
||||
#define EXT(x) _ ## x
|
||||
#define LEXT(x) _ ## x ## :
|
||||
#else
|
||||
#define LCL(x) .L ## x
|
||||
#define EXT(x) x
|
||||
#define LEXT(x) x ## :
|
||||
#endif
|
||||
#define LBc(x,n) n ## :
|
||||
#define LBb(x,n) n ## b
|
||||
#define LBf(x,n) n ## f
|
||||
#else /* __STDC__ */
|
||||
#ifndef __NO_UNDERSCORES__
|
||||
#define LCL(x) L/**/x
|
||||
#define EXT(x) _/**/x
|
||||
#define LEXT(x) _/**/x/**/:
|
||||
#else /* __NO_UNDERSCORES__ */
|
||||
#define LCL(x) .L/**/x
|
||||
#define EXT(x) x
|
||||
#define LEXT(x) x/**/:
|
||||
#endif /* __NO_UNDERSCORES__ */
|
||||
#define LBc(x,n) n/**/:
|
||||
#define LBb(x,n) n/**/b
|
||||
#define LBf(x,n) n/**/f
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#define String .asciz
|
||||
#define Value .word
|
||||
#define Times(a,b) (a*b)
|
||||
#define Divide(a,b) (a/b)
|
||||
|
||||
#if 0 /* TOTOJK */
|
||||
#ifdef __ELF__
|
||||
#define ELF_FUNC(x) .type x,@function
|
||||
#define ELF_DATA(x) .type x,@object
|
||||
#define ELF_SIZE(x,s) .size x,s
|
||||
#else
|
||||
#define ELF_FUNC(x)
|
||||
#define ELF_DATA(x)
|
||||
#define ELF_SIZE(x,s)
|
||||
#endif
|
||||
#else
|
||||
#define ELF_FUNC(x)
|
||||
#define ELF_DATA(x)
|
||||
#define ELF_SIZE(x,s)
|
||||
#endif /* TODOJK */
|
||||
|
||||
#define Entry(x) .globl EXT(x); ELF_FUNC(EXT(x)); .align FALIGN; LEXT(x)
|
||||
#define ENTRY(x) Entry(x) MCOUNT
|
||||
#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
|
||||
ELF_FUNC(EXT(x)); ELF_FUNC(EXT(y)); \
|
||||
.align FALIGN; LEXT(x); LEXT(y) \
|
||||
MCOUNT
|
||||
#if __STDC__
|
||||
#define ASENTRY(x) .globl x; .align FALIGN; x ## : ELF_FUNC(x) MCOUNT
|
||||
#else
|
||||
#define ASENTRY(x) .globl x; .align FALIGN; x: ELF_FUNC(x) MCOUNT
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#define DATA(x) .globl EXT(x); ELF_DATA(EXT(x)); .align ALIGN; LEXT(x)
|
||||
|
||||
#define End(x) ELF_SIZE(x,.-x)
|
||||
#define END(x) End(EXT(x))
|
||||
#define ENDDATA(x) END(x)
|
||||
#define Enddata(x) End(x)
|
||||
|
||||
#ifdef ASSEMBLER
|
||||
|
||||
#define MCOUNT
|
||||
|
||||
#else /* NOT ASSEMBLER */
|
||||
|
||||
/* These defines are here for .c files that wish to reference global symbols
|
||||
* within __asm__ statements.
|
||||
*/
|
||||
#ifndef __NO_UNDERSCORES__
|
||||
#define CC_SYM_PREFIX "_"
|
||||
#else
|
||||
#define CC_SYM_PREFIX ""
|
||||
#endif /* __NO_UNDERSCORES__ */
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#ifdef ASSEMBLER
|
||||
|
||||
#if defined (_ARM_ARCH_4T)
|
||||
# define RET bx lr
|
||||
# define RETeq bxeq lr
|
||||
# define RETne bxne lr
|
||||
# ifdef __STDC__
|
||||
# define RETc(c) bx##c lr
|
||||
# else
|
||||
# define RETc(c) bx/**/c lr
|
||||
# endif
|
||||
#else
|
||||
# define RET mov pc, lr
|
||||
# define RETeq moveq pc, lr
|
||||
# define RETne movne pc, lr
|
||||
# ifdef __STDC__
|
||||
# define RETc(c) mov##c pc, lr
|
||||
# else
|
||||
# define RETc(c) mov/**/c pc, lr
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__thumb__)
|
||||
/* Provide a PI mechanism for thumb branching. */
|
||||
# define BRANCH_EXTERN(x) ldr pc, [pc, #-4] ; \
|
||||
.long EXT(x)
|
||||
#else
|
||||
# define BRANCH_EXTERN(x) b EXT(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* arg0: Register for thread pointer
|
||||
*/
|
||||
.macro READ_THREAD
|
||||
mrc p15, 0, $0, c13, c0, 4 /* Read TPIDRPRW */
|
||||
.endmacro
|
||||
|
||||
|
||||
/* Macros for loading up addresses that are external to the .s file.
|
||||
* LOAD_ADDR: loads the address for (label) into (reg). Not safe for
|
||||
* loading to the PC.
|
||||
* LOAD_ADDR_PC: Variant for loading to the PC; load the address of (label)
|
||||
* into the pc.
|
||||
* LOAD_ADDR_GEN_DEF: The general definition needed to support loading
|
||||
* a label address.
|
||||
*
|
||||
* Usage: For any label accessed, we require one (and only one) instance
|
||||
* of LOAD_ADDR_GEN_DEF(label).
|
||||
*
|
||||
* Example:
|
||||
* LOAD_ADDR(r0, arm_init)
|
||||
* LOAD_ADDR(lr, arm_init_cpu)
|
||||
* LOAD_ADDR_PC(arm_init)
|
||||
* ...
|
||||
*
|
||||
* LOAD_ADDR_GEN_DEF(arm_init)
|
||||
* LOAD_ADDR_GEN_DEF(arm_init_cpu)
|
||||
*/
|
||||
|
||||
#if SLIDABLE
|
||||
/* Definitions for a position dependent kernel using non-lazy pointers.
|
||||
*/
|
||||
|
||||
/* TODO: Make this work with thumb .s files. */
|
||||
#define PC_INC 0x8
|
||||
|
||||
/* We need wrapper macros in order to ensure that __LINE__ is expanded.
|
||||
*
|
||||
* There is some small potential for duplicate labels here, but because
|
||||
* we do not export the generated labels, it should not be an issue.
|
||||
*/
|
||||
|
||||
#define GLUE_LABEL_GUTS(label, tag) L_##label##_##tag##_glue
|
||||
#define GLUE_LABEL(label, tag) GLUE_LABEL_GUTS(label, tag)
|
||||
|
||||
#define LOAD_ADDR(reg, label) \
|
||||
movw reg, :lower16:(label##$non_lazy_ptr - (GLUE_LABEL(label, __LINE__) + PC_INC)) ; \
|
||||
movt reg, :upper16:(label##$non_lazy_ptr - (GLUE_LABEL(label, __LINE__) + PC_INC)) ; \
|
||||
GLUE_LABEL(label, __LINE__): ; \
|
||||
ldr reg, [pc, reg]
|
||||
|
||||
/* Designed with the understanding that directly branching to thumb code
|
||||
* is unreliable; this should allow for dealing with __thumb__ in
|
||||
* assembly; the non-thumb variant still needs to provide the glue label
|
||||
* to avoid failing to build on undefined symbols.
|
||||
*
|
||||
* TODO: Make this actually use a scratch register; this macro is convenient
|
||||
* for translating (ldr pc, [?]) to a slidable format without the risk of
|
||||
* clobbering registers, but it is also wasteful.
|
||||
*/
|
||||
#if defined(__thumb__)
|
||||
#define LOAD_ADDR_PC(label) \
|
||||
stmfd sp!, { r0 } ; \
|
||||
stmfd sp!, { r0 } ; \
|
||||
LOAD_ADDR(r0, label) ; \
|
||||
str r0, [sp, #4] ; \
|
||||
ldmfd sp!, { r0 } ; \
|
||||
ldmfd sp!, { pc }
|
||||
#else
|
||||
#define LOAD_ADDR_PC(label) \
|
||||
b EXT(label)
|
||||
#endif
|
||||
|
||||
#define LOAD_ADDR_GEN_DEF(label) \
|
||||
.section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers ; \
|
||||
.align 2 ; \
|
||||
label##$non_lazy_ptr: ; \
|
||||
.indirect_symbol EXT(label) ; \
|
||||
.long 0
|
||||
|
||||
#else /* !SLIDABLE */
|
||||
|
||||
/* Definitions for a position dependent kernel */
|
||||
#define LOAD_ADDR(reg, label) \
|
||||
ldr reg, L_##label
|
||||
|
||||
#if defined(__thumb__)
|
||||
#define LOAD_ADDR_PC(label) \
|
||||
ldr pc, L_##label
|
||||
#else
|
||||
#define LOAD_ADDR_PC(label) \
|
||||
b EXT(label)
|
||||
#endif
|
||||
|
||||
#define LOAD_ADDR_GEN_DEF(label) \
|
||||
.text ; \
|
||||
.align 2 ; \
|
||||
L_##label: ; \
|
||||
.long EXT(label)
|
||||
|
||||
#endif /* SLIDABLE */
|
||||
|
||||
/* The linker can deal with branching from ARM to thumb in unconditional
|
||||
* branches, but not in conditional branches. To support this in our
|
||||
* assembly (which allows us to build xnu without -mno-thumb), use the
|
||||
* following macros for branching conditionally to external symbols.
|
||||
* These macros are used just like the corresponding conditional branch
|
||||
* instructions.
|
||||
*/
|
||||
|
||||
#define SHIM_LABEL_GUTS(line_num) L_cond_extern_##line_num##_shim
|
||||
#define SHIM_LABEL(line_num) SHIM_LABEL_GUTS(line_num)
|
||||
|
||||
#define COND_EXTERN_BEQ(label) \
|
||||
bne SHIM_LABEL(__LINE__) ; \
|
||||
b EXT(label) ; \
|
||||
SHIM_LABEL(__LINE__):
|
||||
|
||||
#define COND_EXTERN_BLNE(label) \
|
||||
beq SHIM_LABEL(__LINE__) ; \
|
||||
bl EXT(label) ; \
|
||||
SHIM_LABEL(__LINE__):
|
||||
|
||||
#define COND_EXTERN_BLGT(label) \
|
||||
ble SHIM_LABEL(__LINE__) ; \
|
||||
bl EXT(label) ; \
|
||||
SHIM_LABEL(__LINE__):
|
||||
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#endif /* _ARM_ASM_H_ */
|
||||
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#ifndef _ARM_ASM_H_
|
||||
#define _ARM_ASM_H_
|
||||
|
||||
#include <arm/arch.h>
|
||||
|
||||
#ifndef __arm64__
|
||||
#error Why are we including this?
|
||||
#endif
|
||||
|
||||
/* There is another definition of ALIGN for .c sources */
|
||||
#ifdef __ASSEMBLER__
|
||||
#define ALIGN 2
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#ifndef FALIGN
|
||||
#define FALIGN ALIGN
|
||||
#endif
|
||||
|
||||
#define LB(x,n) n
|
||||
#if __STDC__
|
||||
#ifndef __NO_UNDERSCORES__
|
||||
#define LCL(x) L ## x
|
||||
#define EXT(x) _ ## x
|
||||
#define LEXT(x) _ ## x ## :
|
||||
#else
|
||||
#define LCL(x) .L ## x
|
||||
#define EXT(x) x
|
||||
#define LEXT(x) x ## :
|
||||
#endif
|
||||
#define LBc(x,n) n ## :
|
||||
#define LBb(x,n) n ## b
|
||||
#define LBf(x,n) n ## f
|
||||
#else /* __STDC__ */
|
||||
#ifndef __NO_UNDERSCORES__
|
||||
#define LCL(x) L/**/x
|
||||
#define EXT(x) _/**/x
|
||||
#define LEXT(x) _/**/x/**/:
|
||||
#else /* __NO_UNDERSCORES__ */
|
||||
#define LCL(x) .L/**/x
|
||||
#define EXT(x) x
|
||||
#define LEXT(x) x/**/:
|
||||
#endif /* __NO_UNDERSCORES__ */
|
||||
#define LBc(x,n) n/**/:
|
||||
#define LBb(x,n) n/**/b
|
||||
#define LBf(x,n) n/**/f
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#define String .asciz
|
||||
#define Value .word
|
||||
#define Times(a,b) (a*b)
|
||||
#define Divide(a,b) (a/b)
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
#if MACH_KDB
|
||||
#include <ddb/stab.h>
|
||||
/*
|
||||
* This pseudo-assembler line is added so that there will be at least
|
||||
* one N_SO entry in the symbol stable to define the current file name.
|
||||
*/
|
||||
#endif /* MACH_KDB */
|
||||
|
||||
/*
|
||||
* Multiline macros must use .macro syntax for now,
|
||||
* as there is no ARM64 statement separator.
|
||||
*/
|
||||
.macro ENTRY
|
||||
.align FALIGN
|
||||
.globl _$0
|
||||
_$0 :
|
||||
.endmacro
|
||||
|
||||
.macro ENTRY2
|
||||
.align FALIGN
|
||||
.globl _$0
|
||||
.globl _$1
|
||||
_$0 :
|
||||
_$1 :
|
||||
.endmacro
|
||||
|
||||
.macro READ_THREAD
|
||||
mrs $0, TPIDR_EL1
|
||||
.endmacro
|
||||
|
||||
.macro BRANCH_EXTERN
|
||||
b _$0
|
||||
.endmacro
|
||||
|
||||
.macro CALL_EXTERN
|
||||
bl _$0
|
||||
.endmacro
|
||||
|
||||
.macro MOV64
|
||||
movk $0, #((($1) >> 48) & 0x000000000000FFFF), lsl #48
|
||||
movk $0, #((($1) >> 32) & 0x000000000000FFFF), lsl #32
|
||||
movk $0, #((($1) >> 16) & 0x000000000000FFFF), lsl #16
|
||||
movk $0, #((($1) >> 00) & 0x000000000000FFFF), lsl #00
|
||||
.endmacro
|
||||
|
||||
.macro MOV32
|
||||
movz $0, #((($1) >> 16) & 0x000000000000FFFF), lsl #16
|
||||
movk $0, #((($1) >> 00) & 0x000000000000FFFF), lsl #00
|
||||
.endmacro
|
||||
|
||||
.macro ARM64_STACK_PROLOG
|
||||
#if __has_feature(ptrauth_returns)
|
||||
pacibsp
|
||||
#endif
|
||||
.endmacro
|
||||
|
||||
.macro ARM64_STACK_EPILOG
|
||||
#if __has_feature(ptrauth_returns)
|
||||
retab
|
||||
#else
|
||||
ret
|
||||
#endif
|
||||
.endmacro
|
||||
|
||||
#define PUSH_FRAME \
|
||||
stp fp, lr, [sp, #-16]! %% \
|
||||
mov fp, sp %%
|
||||
|
||||
#define POP_FRAME \
|
||||
mov sp, fp %% \
|
||||
ldp fp, lr, [sp], #16 %%
|
||||
|
||||
#define EXT(x) _ ## x
|
||||
|
||||
#ifdef XNU_KERNEL_PRIVATE
|
||||
.macro PANIC_UNIMPLEMENTED
|
||||
bl EXT(panic_unimplemented)
|
||||
.endmacro
|
||||
#endif
|
||||
|
||||
#else /* NOT __ASSEMBLER__ */
|
||||
|
||||
/* These defines are here for .c files that wish to reference global symbols
|
||||
* within __asm__ statements.
|
||||
*/
|
||||
#ifndef __NO_UNDERSCORES__
|
||||
#define CC_SYM_PREFIX "_"
|
||||
#else
|
||||
#define CC_SYM_PREFIX ""
|
||||
#endif /* __NO_UNDERSCORES__ */
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
# define BRANCH_EXTERN(x) b EXT(x)
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* _ARM_ASM_H_ */
|
||||
@@ -0,0 +1,618 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
#ifndef _MACH_ARM__STRUCTS_H_
|
||||
#define _MACH_ARM__STRUCTS_H_
|
||||
|
||||
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
|
||||
#include <machine/types.h> /* __uint32_t */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE struct __darwin_arm_exception_state
|
||||
_STRUCT_ARM_EXCEPTION_STATE
|
||||
{
|
||||
__uint32_t __exception; /* number of arm exception taken */
|
||||
__uint32_t __fsr; /* Fault status */
|
||||
__uint32_t __far; /* Virtual Fault Address */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE struct arm_exception_state
|
||||
_STRUCT_ARM_EXCEPTION_STATE
|
||||
{
|
||||
__uint32_t exception; /* number of arm exception taken */
|
||||
__uint32_t fsr; /* Fault status */
|
||||
__uint32_t far; /* Virtual Fault Address */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE64 struct __darwin_arm_exception_state64
|
||||
_STRUCT_ARM_EXCEPTION_STATE64
|
||||
{
|
||||
__uint64_t __far; /* Virtual Fault Address */
|
||||
__uint32_t __esr; /* Exception syndrome */
|
||||
__uint32_t __exception; /* number of arm exception taken */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE64 struct arm_exception_state64
|
||||
_STRUCT_ARM_EXCEPTION_STATE64
|
||||
{
|
||||
__uint64_t far; /* Virtual Fault Address */
|
||||
__uint32_t esr; /* Exception syndrome */
|
||||
__uint32_t exception; /* number of arm exception taken */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_THREAD_STATE struct __darwin_arm_thread_state
|
||||
_STRUCT_ARM_THREAD_STATE
|
||||
{
|
||||
__uint32_t __r[13]; /* General purpose register r0-r12 */
|
||||
__uint32_t __sp; /* Stack pointer r13 */
|
||||
__uint32_t __lr; /* Link register r14 */
|
||||
__uint32_t __pc; /* Program counter r15 */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_THREAD_STATE struct arm_thread_state
|
||||
_STRUCT_ARM_THREAD_STATE
|
||||
{
|
||||
__uint32_t r[13]; /* General purpose register r0-r12 */
|
||||
__uint32_t sp; /* Stack pointer r13 */
|
||||
__uint32_t lr; /* Link register r14 */
|
||||
__uint32_t pc; /* Program counter r15 */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if defined(KERNEL)
|
||||
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
|
||||
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1
|
||||
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
|
||||
|
||||
#define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t x[29]; /* General purpose registers x0-x28 */
|
||||
__uint64_t fp; /* Frame pointer x29 */
|
||||
__uint64_t lr; /* Link register x30 */
|
||||
__uint64_t sp; /* Stack pointer x31 */
|
||||
__uint64_t pc; /* Program counter */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
__uint32_t flags; /* Flags describing structure format */
|
||||
};
|
||||
|
||||
#else /* defined(KERNEL) */
|
||||
|
||||
/*
|
||||
* By default, the pointer fields in the arm_thread_state64_t structure are
|
||||
* opaque on the arm64e architecture and require the use of accessor macros.
|
||||
* This mode can also be enabled on the arm64 architecture by building with
|
||||
* -D__DARWIN_OPAQUE_ARM_THREAD_STATE64=1.
|
||||
*/
|
||||
#if defined(__arm64__) && defined(__LP64__)
|
||||
|
||||
#if __has_feature(ptrauth_calls)
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 1
|
||||
#define __DARWIN_PTRAUTH_ARM_THREAD_STATE64 1
|
||||
#endif /* __has_feature(ptrauth_calls) */
|
||||
|
||||
#ifndef __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
|
||||
#endif
|
||||
|
||||
#else /* defined(__arm64__) && defined(__LP64__) */
|
||||
|
||||
#undef __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
|
||||
|
||||
#endif /* defined(__arm64__) && defined(__LP64__) */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_THREAD_STATE64 struct __darwin_arm_thread_state64
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t __x[29]; /* General purpose registers x0-x28 */
|
||||
void* __opaque_fp; /* Frame pointer x29 */
|
||||
void* __opaque_lr; /* Link register x30 */
|
||||
void* __opaque_sp; /* Stack pointer x31 */
|
||||
void* __opaque_pc; /* Program counter */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
__uint32_t __opaque_flags; /* Flags describing structure format */
|
||||
};
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t __x[29]; /* General purpose registers x0-x28 */
|
||||
__uint64_t __fp; /* Frame pointer x29 */
|
||||
__uint64_t __lr; /* Link register x30 */
|
||||
__uint64_t __sp; /* Stack pointer x31 */
|
||||
__uint64_t __pc; /* Program counter */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
|
||||
};
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t x[29]; /* General purpose registers x0-x28 */
|
||||
void* __opaque_fp; /* Frame pointer x29 */
|
||||
void* __opaque_lr; /* Link register x30 */
|
||||
void* __opaque_sp; /* Stack pointer x31 */
|
||||
void* __opaque_pc; /* Program counter */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
__uint32_t __opaque_flags; /* Flags describing structure format */
|
||||
};
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t x[29]; /* General purpose registers x0-x28 */
|
||||
__uint64_t fp; /* Frame pointer x29 */
|
||||
__uint64_t lr; /* Link register x30 */
|
||||
__uint64_t sp; /* Stack pointer x31 */
|
||||
__uint64_t pc; /* Program counter */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
|
||||
};
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
|
||||
|
||||
/* Accessor macros for arm_thread_state64_t pointer fields */
|
||||
|
||||
#if __has_feature(ptrauth_calls) && defined(__LP64__)
|
||||
#include <ptrauth.h>
|
||||
|
||||
#if !__DARWIN_OPAQUE_ARM_THREAD_STATE64 || !__DARWIN_PTRAUTH_ARM_THREAD_STATE64
|
||||
#error "Invalid configuration"
|
||||
#endif
|
||||
|
||||
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1
|
||||
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_pc, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : __tsp->__opaque_pc); })
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the __darwin_arm_thread_state64_get_pc() macro in that case. */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_function(__tsp->__opaque_pc, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : NULL); })
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
__typeof__(fptr) __f = (fptr); __tsp->__opaque_pc = \
|
||||
(__f ? (!(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : ptrauth_auth_data(__f, \
|
||||
ptrauth_key_function_pointer, 0)) : __f); })
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_lr, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr")) : __tsp->__opaque_lr); })
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the __darwin_arm_thread_state64_get_lr() macro in that case. */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
|
||||
ptrauth_auth_function(__tsp->__opaque_lr, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr")) : NULL); })
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
__typeof__(fptr) __f = (fptr); __tsp->__opaque_lr = \
|
||||
(__f ? (!(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? (__tsp->__opaque_flags \
|
||||
&= ~__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR , \
|
||||
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr"))) : ptrauth_auth_data(__f, \
|
||||
ptrauth_key_function_pointer, 0)) : __f); })
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_sp && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_sp, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("sp")) : __tsp->__opaque_sp); })
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_sp = \
|
||||
(__p && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_sign_unauthenticated(__p, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("sp")) : __p); })
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_fp && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_fp, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("fp")) : __tsp->__opaque_fp); })
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_fp = \
|
||||
(__p && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_sign_unauthenticated(__p, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("fp")) : __p); })
|
||||
|
||||
#else /* __has_feature(ptrauth_calls) && defined(__LP64__) */
|
||||
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
|
||||
#ifndef __LP64__
|
||||
#error "Invalid configuration"
|
||||
#endif
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((uintptr_t)((ts).__opaque_pc))
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((ts).__opaque_pc)
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).__opaque_pc = (fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((uintptr_t)((ts).__opaque_lr))
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((ts).__opaque_lr)
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).__opaque_lr = (fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((uintptr_t)((ts).__opaque_sp))
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).__opaque_sp = (void*)(uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((uintptr_t)((ts).__opaque_fp))
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).__opaque_fp = (void*)(uintptr_t)(ptr))
|
||||
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#if __DARWIN_UNIX03
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((ts).__pc)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).__pc))
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).__pc = (uintptr_t)(fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((ts).__lr)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).__lr))
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).__lr = (uintptr_t)(fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((ts).__sp)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).__sp = (uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((ts).__fp)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).__fp = (uintptr_t)(ptr))
|
||||
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((ts).pc)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).pc))
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).pc = (uintptr_t)(fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((ts).lr)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).lr))
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).lr = (uintptr_t)(fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((ts).sp)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).sp = (uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((ts).fp)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).fp = (uintptr_t)(ptr))
|
||||
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
|
||||
#endif /* __has_feature(ptrauth_calls) && defined(__LP64__) */
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
|
||||
#endif /* !defined(KERNEL) */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_VFP_STATE struct __darwin_arm_vfp_state
|
||||
_STRUCT_ARM_VFP_STATE
|
||||
{
|
||||
__uint32_t __r[64];
|
||||
__uint32_t __fpscr;
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_VFP_STATE struct arm_vfp_state
|
||||
_STRUCT_ARM_VFP_STATE
|
||||
{
|
||||
__uint32_t r[64];
|
||||
__uint32_t fpscr;
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_NEON_STATE64 struct __darwin_arm_neon_state64
|
||||
#define _STRUCT_ARM_NEON_STATE struct __darwin_arm_neon_state
|
||||
|
||||
#if defined(__arm64__)
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
__uint128_t __v[32];
|
||||
__uint32_t __fpsr;
|
||||
__uint32_t __fpcr;
|
||||
};
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
__uint128_t __v[16];
|
||||
__uint32_t __fpsr;
|
||||
__uint32_t __fpcr;
|
||||
};
|
||||
#elif defined(__arm__)
|
||||
/*
|
||||
* No 128-bit intrinsic for ARM; leave it opaque for now.
|
||||
*/
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
#else
|
||||
#error Unknown architecture.
|
||||
#endif
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_NEON_STATE64 struct arm_neon_state64
|
||||
#define _STRUCT_ARM_NEON_STATE struct arm_neon_state
|
||||
|
||||
#if defined(__arm64__)
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
__uint128_t q[32];
|
||||
uint32_t fpsr;
|
||||
uint32_t fpcr;
|
||||
};
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
__uint128_t q[16];
|
||||
uint32_t fpsr;
|
||||
uint32_t fpcr;
|
||||
};
|
||||
#elif defined(__arm__)
|
||||
/*
|
||||
* No 128-bit intrinsic for ARM; leave it opaque for now.
|
||||
*/
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
#else
|
||||
#error Unknown architecture.
|
||||
#endif
|
||||
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
|
||||
#define _STRUCT_ARM_PAGEIN_STATE struct __arm_pagein_state
|
||||
_STRUCT_ARM_PAGEIN_STATE
|
||||
{
|
||||
int __pagein_error;
|
||||
};
|
||||
|
||||
/*
|
||||
* Debug State
|
||||
*/
|
||||
#if defined(__arm__)
|
||||
/* Old-fashioned debug state is only for ARM */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_DEBUG_STATE struct __darwin_arm_debug_state
|
||||
_STRUCT_ARM_DEBUG_STATE
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_DEBUG_STATE struct arm_debug_state
|
||||
_STRUCT_ARM_DEBUG_STATE
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#elif defined(__arm64__)
|
||||
|
||||
/* ARM's arm_debug_state is ARM64's arm_legacy_debug_state */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct arm_legacy_debug_state
|
||||
_STRUCT_ARM_LEGACY_DEBUG_STATE
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
};
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct arm_legacy_debug_state
|
||||
_STRUCT_ARM_LEGACY_DEBUG_STATE
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#else
|
||||
#error unknown architecture
|
||||
#endif
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_DEBUG_STATE32 struct __darwin_arm_debug_state32
|
||||
_STRUCT_ARM_DEBUG_STATE32
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
|
||||
#define _STRUCT_ARM_DEBUG_STATE64 struct __darwin_arm_debug_state64
|
||||
_STRUCT_ARM_DEBUG_STATE64
|
||||
{
|
||||
__uint64_t __bvr[16];
|
||||
__uint64_t __bcr[16];
|
||||
__uint64_t __wvr[16];
|
||||
__uint64_t __wcr[16];
|
||||
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_DEBUG_STATE32 struct arm_debug_state32
|
||||
_STRUCT_ARM_DEBUG_STATE32
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
|
||||
#define _STRUCT_ARM_DEBUG_STATE64 struct arm_debug_state64
|
||||
_STRUCT_ARM_DEBUG_STATE64
|
||||
{
|
||||
__uint64_t bvr[16];
|
||||
__uint64_t bcr[16];
|
||||
__uint64_t wvr[16];
|
||||
__uint64_t wcr[16];
|
||||
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_CPMU_STATE64 struct __darwin_arm_cpmu_state64
|
||||
_STRUCT_ARM_CPMU_STATE64
|
||||
{
|
||||
__uint64_t __ctrs[16];
|
||||
};
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_CPMU_STATE64 struct arm_cpmu_state64
|
||||
_STRUCT_ARM_CPMU_STATE64
|
||||
{
|
||||
__uint64_t ctrs[16];
|
||||
};
|
||||
#endif /* !__DARWIN_UNIX03 */
|
||||
|
||||
#endif /* _MACH_ARM__STRUCTS_H_ */
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: boolean.h
|
||||
*
|
||||
* Boolean type, for ARM.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_BOOLEAN_H_
|
||||
#define _MACH_ARM_BOOLEAN_H_
|
||||
|
||||
typedef int boolean_t;
|
||||
|
||||
#endif /* _MACH_ARM_BOOLEAN_H_ */
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_EXCEPTION_H_
|
||||
#define _MACH_ARM_EXCEPTION_H_
|
||||
|
||||
#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */
|
||||
|
||||
#define EXC_MASK_MACHINE 0
|
||||
|
||||
#define EXCEPTION_CODE_MAX 2 /* code and subcode */
|
||||
|
||||
/*
|
||||
* Trap numbers as defined by the hardware exception vectors.
|
||||
*/
|
||||
|
||||
/*
|
||||
* EXC_BAD_INSTRUCTION
|
||||
*/
|
||||
|
||||
#define EXC_ARM_UNDEFINED 1 /* Undefined */
|
||||
|
||||
/*
|
||||
* EXC_ARITHMETIC
|
||||
*/
|
||||
|
||||
#define EXC_ARM_FP_UNDEFINED 0 /* Undefined Floating Point Exception */
|
||||
#define EXC_ARM_FP_IO 1 /* Invalid Floating Point Operation */
|
||||
#define EXC_ARM_FP_DZ 2 /* Floating Point Divide by Zero */
|
||||
#define EXC_ARM_FP_OF 3 /* Floating Point Overflow */
|
||||
#define EXC_ARM_FP_UF 4 /* Floating Point Underflow */
|
||||
#define EXC_ARM_FP_IX 5 /* Inexact Floating Point Result */
|
||||
#define EXC_ARM_FP_ID 6 /* Floating Point Denormal Input */
|
||||
|
||||
/*
|
||||
* EXC_BAD_ACCESS
|
||||
* Note: do not conflict with kern_return_t values returned by vm_fault
|
||||
*/
|
||||
|
||||
#define EXC_ARM_DA_ALIGN 0x101 /* Alignment Fault */
|
||||
#define EXC_ARM_DA_DEBUG 0x102 /* Debug (watch/break) Fault */
|
||||
#define EXC_ARM_SP_ALIGN 0x103 /* SP Alignment Fault */
|
||||
#define EXC_ARM_SWP 0x104 /* SWP instruction */
|
||||
|
||||
/*
|
||||
* EXC_BREAKPOINT
|
||||
*/
|
||||
|
||||
#define EXC_ARM_BREAKPOINT 1 /* breakpoint trap */
|
||||
|
||||
|
||||
#endif /* _MACH_ARM_EXCEPTION_H_ */
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: kern_return.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young
|
||||
* Date: 1985
|
||||
*
|
||||
* Machine-dependent kernel return definitions.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_KERN_RETURN_H_
|
||||
#define _MACH_ARM_KERN_RETURN_H_
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
typedef int kern_return_t;
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#endif /* _MACH_ARM_KERN_RETURN_H_ */
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
|
||||
/* NDR record for Intel x86s */
|
||||
|
||||
#include <mach/ndr.h>
|
||||
|
||||
NDR_record_t NDR_record = {
|
||||
0, /* mig_reserved */
|
||||
0, /* mig_reserved */
|
||||
0, /* mig_reserved */
|
||||
NDR_PROTOCOL_2_0,
|
||||
NDR_INT_LITTLE_ENDIAN,
|
||||
NDR_CHAR_ASCII,
|
||||
NDR_FLOAT_IEEE,
|
||||
0,
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2018 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_PROCESSOR_INFO_H_
|
||||
#define _MACH_ARM_PROCESSOR_INFO_H_
|
||||
|
||||
#define PROCESSOR_CPU_STAT 0x10000003 /* Low-level CPU statistics */
|
||||
#define PROCESSOR_CPU_STAT64 0x10000004 /* Low-level CPU statistics, in full 64-bit */
|
||||
|
||||
#include <stdint.h> /* uint32_t, uint64_t */
|
||||
|
||||
struct processor_cpu_stat {
|
||||
uint32_t irq_ex_cnt;
|
||||
uint32_t ipi_cnt;
|
||||
uint32_t timer_cnt;
|
||||
uint32_t undef_ex_cnt;
|
||||
uint32_t unaligned_cnt;
|
||||
uint32_t vfp_cnt;
|
||||
uint32_t vfp_shortv_cnt;
|
||||
uint32_t data_ex_cnt;
|
||||
uint32_t instr_ex_cnt;
|
||||
};
|
||||
|
||||
typedef struct processor_cpu_stat processor_cpu_stat_data_t;
|
||||
typedef struct processor_cpu_stat *processor_cpu_stat_t;
|
||||
#define PROCESSOR_CPU_STAT_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(processor_cpu_stat_data_t) / sizeof(natural_t)))
|
||||
|
||||
struct processor_cpu_stat64 {
|
||||
uint64_t irq_ex_cnt;
|
||||
uint64_t ipi_cnt;
|
||||
uint64_t timer_cnt;
|
||||
uint64_t undef_ex_cnt;
|
||||
uint64_t unaligned_cnt;
|
||||
uint64_t vfp_cnt;
|
||||
uint64_t vfp_shortv_cnt;
|
||||
uint64_t data_ex_cnt;
|
||||
uint64_t instr_ex_cnt;
|
||||
uint64_t pmi_cnt;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
typedef struct processor_cpu_stat64 processor_cpu_stat64_data_t;
|
||||
typedef struct processor_cpu_stat64 *processor_cpu_stat64_t;
|
||||
#define PROCESSOR_CPU_STAT64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(processor_cpu_stat64_data_t) / sizeof(integer_t)))
|
||||
|
||||
#endif /* _MACH_ARM_PROCESSOR_INFO_H_ */
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_RPC_H_
|
||||
#define _MACH_ARM_RPC_H_
|
||||
|
||||
#endif /* _MACH_ARM_RPC_H_ */
|
||||
@@ -0,0 +1,440 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_SDT_ISA_H
|
||||
#define _MACH_ARM_SDT_ISA_H
|
||||
|
||||
/*
|
||||
* Only define when testing. This makes the calls into actual calls to
|
||||
* test functions.
|
||||
*/
|
||||
/* #define DTRACE_CALL_TEST */
|
||||
|
||||
#define DTRACE_STRINGIFY(s) #s
|
||||
#define DTRACE_TOSTRING(s) DTRACE_STRINGIFY(s)
|
||||
|
||||
#if defined(KERNEL)
|
||||
/*
|
||||
* For the kernel, set an explicit global label so the symbol can be located
|
||||
*/
|
||||
#ifdef __arm__
|
||||
#define DTRACE_LAB(p, n) \
|
||||
"__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n)
|
||||
|
||||
#define DTRACE_LABEL(p, n) \
|
||||
".pushsection __DATA, __data\n\t" \
|
||||
".p2align 2\n\t" \
|
||||
".globl " DTRACE_LAB(p, n) "\n\t" \
|
||||
DTRACE_LAB(p, n) ":" ".long 1f""\n\t" \
|
||||
".popsection" "\n\t" \
|
||||
"1:"
|
||||
#else /* __arm64__ */
|
||||
#define DTRACE_LAB(p, n) \
|
||||
"__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n)
|
||||
|
||||
#define DTRACE_LABEL(p, n) \
|
||||
".pushsection __DATA, __data\n\t" \
|
||||
".p2align 3\n\t" \
|
||||
".globl " DTRACE_LAB(p, n) "\n\t" \
|
||||
DTRACE_LAB(p, n) ":" ".quad 1f""\n\t" \
|
||||
".popsection" "\n\t" \
|
||||
"1:"
|
||||
#endif
|
||||
#else /* !KERNEL */
|
||||
#define DTRACE_LABEL(p, n) \
|
||||
"__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n) ":" "\n\t"
|
||||
#endif /* !KERNEL */
|
||||
|
||||
#ifdef DTRACE_CALL_TEST
|
||||
|
||||
#define DTRACE_CALL(p,n) \
|
||||
DTRACE_LABEL(p,n) \
|
||||
DTRACE_CALL_INSN(p,n)
|
||||
|
||||
#else /* !DTRACE_CALL_TEST */
|
||||
|
||||
#define DTRACE_CALL(p,n) \
|
||||
DTRACE_LABEL(p,n) \
|
||||
DTRACE_NOPS
|
||||
|
||||
#endif /* !DTRACE_CALL_TEST */
|
||||
|
||||
#if defined(__arm__)
|
||||
|
||||
#define DTRACE_NOPS \
|
||||
"nop" "\n\t"
|
||||
|
||||
#define DTRACE_CALL_INSN(p,n) \
|
||||
"blx _dtracetest" DTRACE_STRINGIFY(_##p##_##n) "\n\t"
|
||||
|
||||
#ifdef __thumb__
|
||||
#define DTRACE_ALLOC_STACK(n) \
|
||||
"sub sp, #" #n "\n\t"
|
||||
#define DTRACE_DEALLOC_STACK(n) \
|
||||
"add sp, #" #n "\n\t"
|
||||
#else
|
||||
#define DTRACE_ALLOC_STACK(n) \
|
||||
"sub sp, sp, #" #n "\n\t"
|
||||
#define DTRACE_DEALLOC_STACK(n) \
|
||||
"add sp, sp, #" #n "\n\t"
|
||||
#endif
|
||||
|
||||
#define ARG1_EXTENT 1
|
||||
#define ARGS2_EXTENT 2
|
||||
#define ARGS3_EXTENT 3
|
||||
#define ARGS4_EXTENT 4
|
||||
#define ARGS5_EXTENT 5
|
||||
#define ARGS6_EXTENT 6
|
||||
#define ARGS7_EXTENT 7
|
||||
#define ARGS8_EXTENT 8
|
||||
#define ARGS9_EXTENT 9
|
||||
#define ARGS10_EXTENT 10
|
||||
|
||||
#define DTRACE_CALL0ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_CALL(provider, name) \
|
||||
"# eat trailing nl+tab from DTRACE_CALL" \
|
||||
: \
|
||||
: \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL1ARG(provider, name) \
|
||||
asm volatile ("ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL2ARGS(provider, name) \
|
||||
asm volatile ("ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL3ARGS(provider, name) \
|
||||
asm volatile ("ldr r2, [%0, #8]" "\n\t" \
|
||||
"ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1", "r2" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL4ARGS(provider, name) \
|
||||
asm volatile ("ldr r3, [%0, #12]" "\n\t" \
|
||||
"ldr r2, [%0, #8]" "\n\t" \
|
||||
"ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1", "r2", "r3" \
|
||||
);
|
||||
|
||||
/*
|
||||
* One of our ARM32 ABIs (armv7k) mandates that the stack be aligned to 16 bytes.
|
||||
* We currently apply this constraint to all ARM32 DTRACE_CALL macros; hence the
|
||||
* macros below will overallocate for some ABIs.
|
||||
*/
|
||||
#define DTRACE_CALL5ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_ALLOC_STACK(16) \
|
||||
"ldr r0, [%0, #16]" "\n\t" \
|
||||
"str r0, [sp]" "\n\t" \
|
||||
"ldr r3, [%0, #12]" "\n\t" \
|
||||
"ldr r2, [%0, #8]" "\n\t" \
|
||||
"ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
DTRACE_DEALLOC_STACK(16) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1", "r2", "r3" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL6ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_ALLOC_STACK(16) \
|
||||
"ldr r1, [%0, #20]" "\n\t" \
|
||||
"ldr r0, [%0, #16]" "\n\t" \
|
||||
"str r1, [sp, #4]" "\n\t" \
|
||||
"str r0, [sp]" "\n\t" \
|
||||
"ldr r3, [%0, #12]" "\n\t" \
|
||||
"ldr r2, [%0, #8]" "\n\t" \
|
||||
"ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
DTRACE_DEALLOC_STACK(16) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1", "r2", "r3" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL7ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_ALLOC_STACK(16) \
|
||||
"ldr r2, [%0, #24]" "\n\t" \
|
||||
"ldr r1, [%0, #20]" "\n\t" \
|
||||
"ldr r0, [%0, #16]" "\n\t" \
|
||||
"str r2, [sp, #8]" "\n\t" \
|
||||
"str r1, [sp, #4]" "\n\t" \
|
||||
"str r0, [sp]" "\n\t" \
|
||||
"ldr r3, [%0, #12]" "\n\t" \
|
||||
"ldr r2, [%0, #8]" "\n\t" \
|
||||
"ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
DTRACE_DEALLOC_STACK(16) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1", "r2", "r3" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL8ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_ALLOC_STACK(16) \
|
||||
"ldr r3, [%0, #28]" "\n\t" \
|
||||
"ldr r2, [%0, #24]" "\n\t" \
|
||||
"ldr r1, [%0, #20]" "\n\t" \
|
||||
"ldr r0, [%0, #16]" "\n\t" \
|
||||
"str r3, [sp, #12]" "\n\t" \
|
||||
"str r2, [sp, #8]" "\n\t" \
|
||||
"str r1, [sp, #4]" "\n\t" \
|
||||
"str r0, [sp]" "\n\t" \
|
||||
"ldr r3, [%0, #12]" "\n\t" \
|
||||
"ldr r2, [%0, #8]" "\n\t" \
|
||||
"ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
DTRACE_DEALLOC_STACK(16) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1", "r2", "r3" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL9ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_ALLOC_STACK(32) \
|
||||
"ldr r0, [%0, #32]" "\n\t" \
|
||||
"str r0, [sp, #16]" "\n\t" \
|
||||
"ldr r3, [%0, #28]" "\n\t" \
|
||||
"ldr r2, [%0, #24]" "\n\t" \
|
||||
"ldr r1, [%0, #20]" "\n\t" \
|
||||
"ldr r0, [%0, #16]" "\n\t" \
|
||||
"str r3, [sp, #12]" "\n\t" \
|
||||
"str r2, [sp, #8]" "\n\t" \
|
||||
"str r1, [sp, #4]" "\n\t" \
|
||||
"str r0, [sp]" "\n\t" \
|
||||
"ldr r3, [%0, #12]" "\n\t" \
|
||||
"ldr r2, [%0, #8]" "\n\t" \
|
||||
"ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
DTRACE_DEALLOC_STACK(32) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1", "r2", "r3" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL10ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_ALLOC_STACK(32) \
|
||||
"ldr r1, [%0, #36]" "\n\t" \
|
||||
"ldr r0, [%0, #32]" "\n\t" \
|
||||
"str r1, [sp, #20]" "\n\t" \
|
||||
"str r0, [sp, #16]" "\n\t" \
|
||||
"ldr r3, [%0, #28]" "\n\t" \
|
||||
"ldr r2, [%0, #24]" "\n\t" \
|
||||
"ldr r1, [%0, #20]" "\n\t" \
|
||||
"ldr r0, [%0, #16]" "\n\t" \
|
||||
"str r3, [sp, #12]" "\n\t" \
|
||||
"str r2, [sp, #8]" "\n\t" \
|
||||
"str r1, [sp, #4]" "\n\t" \
|
||||
"str r0, [sp]" "\n\t" \
|
||||
"ldr r3, [%0, #12]" "\n\t" \
|
||||
"ldr r2, [%0, #8]" "\n\t" \
|
||||
"ldr r1, [%0, #4]" "\n\t" \
|
||||
"ldr r0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
DTRACE_DEALLOC_STACK(32) \
|
||||
: \
|
||||
: "l" (__dtrace_args) \
|
||||
: "memory", "r0", "r1", "r2", "r3" \
|
||||
);
|
||||
|
||||
#elif defined(__arm64__)
|
||||
|
||||
#define DTRACE_NOPS \
|
||||
"nop" "\n\t"
|
||||
|
||||
|
||||
#define DTRACE_CALL_INSN(p,n) \
|
||||
"bl _dtracetest" DTRACE_STRINGIFY(_##p##_##n) "\n\t"
|
||||
|
||||
#define DTRACE_ALLOC_STACK(n) \
|
||||
"sub sp, sp, #" #n "\n\t"
|
||||
#define DTRACE_DEALLOC_STACK(n) \
|
||||
"add sp, sp, #" #n "\n\t"
|
||||
|
||||
#define ARG1_EXTENT 1
|
||||
#define ARGS2_EXTENT 2
|
||||
#define ARGS3_EXTENT 3
|
||||
#define ARGS4_EXTENT 4
|
||||
#define ARGS5_EXTENT 5
|
||||
#define ARGS6_EXTENT 6
|
||||
#define ARGS7_EXTENT 7
|
||||
#define ARGS8_EXTENT 8
|
||||
#define ARGS9_EXTENT 9
|
||||
#define ARGS10_EXTENT 10
|
||||
|
||||
#define DTRACE_CALL0ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_CALL(provider, name) \
|
||||
"# eat trailing nl+tab from DTRACE_CALL" \
|
||||
: \
|
||||
: \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL1ARG(provider, name) \
|
||||
asm volatile ("ldr x0, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL2ARGS(provider, name) \
|
||||
asm volatile ("ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL3ARGS(provider, name) \
|
||||
asm volatile ("ldr x2, [%0, #16]" "\n\t" \
|
||||
"ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1", "x2" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL4ARGS(provider, name) \
|
||||
asm volatile ("ldp x2, x3, [%0, #16]" "\n\t" \
|
||||
"ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1", "x2", "x3" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL5ARGS(provider, name) \
|
||||
asm volatile ("ldr x4, [%0, #32]" "\n\t" \
|
||||
"ldp x2, x3, [%0, #16]" "\n\t" \
|
||||
"ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1", "x2", "x3", "x4" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL6ARGS(provider, name) \
|
||||
asm volatile ("ldp x4, x5, [%0, #32]" "\n\t" \
|
||||
"ldp x2, x3, [%0, #16]" "\n\t" \
|
||||
"ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1", "x2", "x3", "x4", "x5" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL7ARGS(provider, name) \
|
||||
asm volatile ("ldr x6, [%0, #48]" "\n\t" \
|
||||
"ldp x4, x5, [%0, #32]" "\n\t" \
|
||||
"ldp x2, x3, [%0, #16]" "\n\t" \
|
||||
"ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1", "x2", "x3", "x4", "x5", "x6" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL8ARGS(provider, name) \
|
||||
asm volatile ("ldp x6, x7, [%0, #48]" "\n\t" \
|
||||
"ldp x4, x5, [%0, #32]" "\n\t" \
|
||||
"ldp x2, x3, [%0, #16]" "\n\t" \
|
||||
"ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" \
|
||||
);
|
||||
|
||||
/* Keep stack 16 byte aligned per ABI requirements */
|
||||
#define DTRACE_CALL9ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_ALLOC_STACK(16) \
|
||||
"ldr x0, [%0, #64]" "\n\t" \
|
||||
"str x0, [sp]" "\n\t" \
|
||||
"ldp x6, x7, [%0, #48]" "\n\t" \
|
||||
"ldp x4, x5, [%0, #32]" "\n\t" \
|
||||
"ldp x2, x3, [%0, #16]" "\n\t" \
|
||||
"ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
DTRACE_DEALLOC_STACK(16) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" \
|
||||
);
|
||||
|
||||
#define DTRACE_CALL10ARGS(provider, name) \
|
||||
asm volatile ( \
|
||||
DTRACE_ALLOC_STACK(16) \
|
||||
"ldp x0, x1, [%0, #64]" "\n\t" \
|
||||
"stp x0, x1, [sp]" "\n\t" \
|
||||
"ldp x6, x7, [%0, #48]" "\n\t" \
|
||||
"ldp x4, x5, [%0, #32]" "\n\t" \
|
||||
"ldp x2, x3, [%0, #16]" "\n\t" \
|
||||
"ldp x0, x1, [%0]" "\n\t" \
|
||||
DTRACE_CALL(provider, name) \
|
||||
DTRACE_DEALLOC_STACK(16) \
|
||||
: \
|
||||
: "r" (__dtrace_args) \
|
||||
: "memory", "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" \
|
||||
);
|
||||
|
||||
#endif /* __arm__ */
|
||||
|
||||
#endif /* _MACH_ARM_SDT_ISA_H */
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* FILE_ID: syscall_sw.h
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_SYSCALL_SW_H_
|
||||
#define _MACH_ARM_SYSCALL_SW_H_
|
||||
|
||||
#if defined(__arm__)
|
||||
|
||||
#include <mach/machine/vm_param.h>
|
||||
#include <architecture/arm/asm_help.h>
|
||||
|
||||
/* 0 to 4 args are already loaded in r0-r3 */
|
||||
#define _kernel_trap_0to4(trap_name, trap_number) \
|
||||
mov r12, # ## trap_number /* load syscall number */ ; \
|
||||
swi #SWI_SYSCALL ; \
|
||||
bx lr /* return */ ;
|
||||
|
||||
#define _kernel_trap_5(trap_name, trap_number) \
|
||||
mov ip, sp /* save pointer to args */ ; \
|
||||
stmfd sp!, { r4-r5 } /* save r4-r5, keep stack 64-bit aligned */; \
|
||||
ldr r4, [ ip ] /* load arg 5 */ ; \
|
||||
mov r12, # ## trap_number /* load syscall number */ ; \
|
||||
swi #SWI_SYSCALL ; \
|
||||
ldmfd sp!, { r4-r5 } /* restore r4-r5 */ ;\
|
||||
bx lr /* return */ ;
|
||||
|
||||
#define _kernel_trap_6to9(trap_name, trap_number, save_regs, arg_regs) \
|
||||
mov ip, sp /* save pointer to args */ ; \
|
||||
stmfd sp!, { save_regs } /* callee saved regs */; \
|
||||
ldmia ip, { arg_regs } /* load arg registers (above r0-r3) */ ;\
|
||||
mov r12, # ## trap_number /* load syscall number */ ; \
|
||||
swi #SWI_SYSCALL ; \
|
||||
ldmfd sp!, { save_regs } /* restore callee saved regs */ ;\
|
||||
bx lr /* return */ ;
|
||||
|
||||
#define COMMA ,
|
||||
|
||||
/* For the armv7k ABI, the alignment requirements may add padding. So we
|
||||
* let the kernel figure it out and push extra on the stack to avoid un-needed
|
||||
* copy-ins. We are relying on arguments that aren't in registers starting
|
||||
* 32 bytes from sp. */
|
||||
#if __BIGGEST_ALIGNMENT__ > 4
|
||||
|
||||
#define _kernel_trap_0(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
#define _kernel_trap_1(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
#define _kernel_trap_2(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
#define _kernel_trap_3(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
#define _kernel_trap_4(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r5, r4-r5)
|
||||
#undef _kernel_trap_5
|
||||
#define _kernel_trap_5(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r5, r4-r5)
|
||||
#define _kernel_trap_6(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
#define _kernel_trap_7(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
#define _kernel_trap_8(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
#define _kernel_trap_9(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
#else // !(__BIGGEST_ALIGNMENT__ > 4)
|
||||
|
||||
#define _kernel_trap_0(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
#define _kernel_trap_1(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
#define _kernel_trap_2(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
#define _kernel_trap_3(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
#define _kernel_trap_4(trap_name, trap_number) _kernel_trap_0to4(trap_name, trap_number)
|
||||
/* _kernel_trap_5 defined above */
|
||||
#define _kernel_trap_6(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r5, r4-r5)
|
||||
/* need to save r8 not just for alignment but because mach_msg_trap overwrites the eighth argument */
|
||||
#define _kernel_trap_7(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r6 COMMA r8, r4-r6)
|
||||
#define _kernel_trap_8(trap_name, trap_number) _kernel_trap_6to9(trap_name, trap_number, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
/* there is only one nine-argument trap (mach_msg_overwrite_trap) and it doesn't use the ninth argument */
|
||||
#define _kernel_trap_9(trap_name, trap_number) _kernel_trap_8(trap_name, trap_number)
|
||||
|
||||
#endif // __BIGGEST_ALIGNMENT__ > 4
|
||||
|
||||
|
||||
/* select the appropriate trap macro based off the number of args */
|
||||
#define kernel_trap(trap_name, trap_number, num_args) \
|
||||
LEAF(_##trap_name, 0) \
|
||||
_kernel_trap_##num_args(trap_name, trap_number)
|
||||
|
||||
#elif defined(__arm64__)
|
||||
|
||||
#include <mach/machine/vm_param.h>
|
||||
|
||||
#define kernel_trap(trap_name, trap_number, num_args) \
|
||||
.globl _##trap_name %% \
|
||||
.text %% \
|
||||
.align 2 %% \
|
||||
_##trap_name: %% \
|
||||
mov x16, #(trap_number) %% \
|
||||
svc #SWI_SYSCALL %% \
|
||||
ret
|
||||
|
||||
#else
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_ARM_SYSCALL_SW_H_ */
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_THREAD_STATE_H_
|
||||
#define _MACH_ARM_THREAD_STATE_H_
|
||||
|
||||
/* Size of maximum exported thread state in words */
|
||||
#define ARM_THREAD_STATE_MAX (1296) /* Size of biggest state possible */
|
||||
|
||||
#if defined (__arm__) || defined(__arm64__)
|
||||
#define THREAD_STATE_MAX ARM_THREAD_STATE_MAX
|
||||
#else
|
||||
#error Unsupported arch
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_ARM_THREAD_STATE_H_ */
|
||||
@@ -0,0 +1,952 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* FILE_ID: thread_status.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ARM_THREAD_STATUS_H_
|
||||
#define _ARM_THREAD_STATUS_H_
|
||||
|
||||
#include <mach/machine/_structs.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/arm/thread_state.h>
|
||||
|
||||
/*
|
||||
* Support for determining the state of a thread
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Flavors
|
||||
*/
|
||||
|
||||
#define ARM_THREAD_STATE 1
|
||||
#define ARM_UNIFIED_THREAD_STATE ARM_THREAD_STATE
|
||||
#define ARM_VFP_STATE 2
|
||||
#define ARM_EXCEPTION_STATE 3
|
||||
#define ARM_DEBUG_STATE 4 /* pre-armv8 */
|
||||
#define THREAD_STATE_NONE 5
|
||||
#define ARM_THREAD_STATE64 6
|
||||
#define ARM_EXCEPTION_STATE64 7
|
||||
// ARM_THREAD_STATE_LAST 8 /* legacy */
|
||||
#define ARM_THREAD_STATE32 9
|
||||
|
||||
/* API */
|
||||
#define ARM_DEBUG_STATE32 14
|
||||
#define ARM_DEBUG_STATE64 15
|
||||
#define ARM_NEON_STATE 16
|
||||
#define ARM_NEON_STATE64 17
|
||||
#define ARM_CPMU_STATE64 18
|
||||
|
||||
#ifdef XNU_KERNEL_PRIVATE
|
||||
/* For kernel use */
|
||||
#define ARM_SAVED_STATE32 20
|
||||
#define ARM_SAVED_STATE64 21
|
||||
#define ARM_NEON_SAVED_STATE32 22
|
||||
#define ARM_NEON_SAVED_STATE64 23
|
||||
#endif /* XNU_KERNEL_PRIVATE */
|
||||
|
||||
|
||||
#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) 0
|
||||
|
||||
#define ARM_PAGEIN_STATE 27
|
||||
|
||||
#define VALID_THREAD_STATE_FLAVOR(x) \
|
||||
((x == ARM_THREAD_STATE) || \
|
||||
(x == ARM_VFP_STATE) || \
|
||||
(x == ARM_EXCEPTION_STATE) || \
|
||||
(x == ARM_DEBUG_STATE) || \
|
||||
(x == THREAD_STATE_NONE) || \
|
||||
(x == ARM_THREAD_STATE32) || \
|
||||
(x == ARM_THREAD_STATE64) || \
|
||||
(x == ARM_EXCEPTION_STATE64) || \
|
||||
(x == ARM_NEON_STATE) || \
|
||||
(x == ARM_NEON_STATE64) || \
|
||||
(x == ARM_DEBUG_STATE32) || \
|
||||
(x == ARM_DEBUG_STATE64) || \
|
||||
(x == ARM_PAGEIN_STATE) || \
|
||||
(ARM_STATE_FLAVOR_IS_OTHER_VALID(x)))
|
||||
|
||||
struct arm_state_hdr {
|
||||
uint32_t flavor;
|
||||
uint32_t count;
|
||||
};
|
||||
typedef struct arm_state_hdr arm_state_hdr_t;
|
||||
|
||||
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state_t;
|
||||
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state32_t;
|
||||
typedef _STRUCT_ARM_THREAD_STATE64 arm_thread_state64_t;
|
||||
|
||||
#if !defined(KERNEL)
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
|
||||
|
||||
/* Accessor macros for arm_thread_state64_t pointer fields */
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_pc(ts) \
|
||||
__darwin_arm_thread_state64_get_pc(ts)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the arm_thread_state64_get_pc() macro in that case. */
|
||||
#define arm_thread_state64_get_pc_fptr(ts) \
|
||||
__darwin_arm_thread_state64_get_pc_fptr(ts)
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
__darwin_arm_thread_state64_set_pc_fptr(ts, fptr)
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_lr(ts) \
|
||||
__darwin_arm_thread_state64_get_lr(ts)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the arm_thread_state64_get_lr() macro in that case. */
|
||||
#define arm_thread_state64_get_lr_fptr(ts) \
|
||||
__darwin_arm_thread_state64_get_lr_fptr(ts)
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
__darwin_arm_thread_state64_set_lr_fptr(ts, fptr)
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_sp(ts) \
|
||||
__darwin_arm_thread_state64_get_sp(ts)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define arm_thread_state64_set_sp(ts, ptr) \
|
||||
__darwin_arm_thread_state64_set_sp(ts, ptr)
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_fp(ts) \
|
||||
__darwin_arm_thread_state64_get_fp(ts)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define arm_thread_state64_set_fp(ts, ptr) \
|
||||
__darwin_arm_thread_state64_set_fp(ts, ptr)
|
||||
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
|
||||
#endif /* !defined(KERNEL) */
|
||||
|
||||
struct arm_unified_thread_state {
|
||||
arm_state_hdr_t ash;
|
||||
union {
|
||||
arm_thread_state32_t ts_32;
|
||||
arm_thread_state64_t ts_64;
|
||||
} uts;
|
||||
};
|
||||
#define ts_32 uts.ts_32
|
||||
#define ts_64 uts.ts_64
|
||||
typedef struct arm_unified_thread_state arm_unified_thread_state_t;
|
||||
|
||||
#define ARM_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state_t)/sizeof(uint32_t)))
|
||||
#define ARM_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state32_t)/sizeof(uint32_t)))
|
||||
#define ARM_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state64_t)/sizeof(uint32_t)))
|
||||
#define ARM_UNIFIED_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_unified_thread_state_t)/sizeof(uint32_t)))
|
||||
|
||||
|
||||
typedef _STRUCT_ARM_VFP_STATE arm_vfp_state_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE arm_neon_state_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE arm_neon_state32_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE64 arm_neon_state64_t;
|
||||
|
||||
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state_t;
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state32_t;
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE64 arm_exception_state64_t;
|
||||
|
||||
typedef _STRUCT_ARM_DEBUG_STATE32 arm_debug_state32_t;
|
||||
typedef _STRUCT_ARM_DEBUG_STATE64 arm_debug_state64_t;
|
||||
|
||||
typedef _STRUCT_ARM_PAGEIN_STATE arm_pagein_state_t;
|
||||
|
||||
#if defined(XNU_KERNEL_PRIVATE) && defined(__arm64__)
|
||||
/* See below for ARM64 kernel structure definition for arm_debug_state. */
|
||||
#else /* defined(XNU_KERNEL_PRIVATE) && defined(__arm64__) */
|
||||
/*
|
||||
* Otherwise not ARM64 kernel and we must preserve legacy ARM definitions of
|
||||
* arm_debug_state for binary compatability of userland consumers of this file.
|
||||
*/
|
||||
#if defined(__arm__)
|
||||
typedef _STRUCT_ARM_DEBUG_STATE arm_debug_state_t;
|
||||
#elif defined(__arm64__)
|
||||
typedef _STRUCT_ARM_LEGACY_DEBUG_STATE arm_debug_state_t;
|
||||
#else /* defined(__arm__) */
|
||||
#error Undefined architecture
|
||||
#endif /* defined(__arm__) */
|
||||
#endif /* defined(XNU_KERNEL_PRIVATE) && defined(__arm64__) */
|
||||
|
||||
#define ARM_VFP_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_vfp_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_exception_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_exception_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state32_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_PAGEIN_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_pagein_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_NEON_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_neon_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_NEON_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_neon_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define MACHINE_THREAD_STATE ARM_THREAD_STATE
|
||||
#define MACHINE_THREAD_STATE_COUNT ARM_UNIFIED_THREAD_STATE_COUNT
|
||||
|
||||
|
||||
/*
|
||||
* Largest state on this machine:
|
||||
*/
|
||||
#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
|
||||
|
||||
#ifdef XNU_KERNEL_PRIVATE
|
||||
|
||||
static inline boolean_t
|
||||
is_thread_state32(const arm_unified_thread_state_t *its)
|
||||
{
|
||||
return its->ash.flavor == ARM_THREAD_STATE32;
|
||||
}
|
||||
|
||||
static inline boolean_t
|
||||
is_thread_state64(const arm_unified_thread_state_t *its)
|
||||
{
|
||||
return its->ash.flavor == ARM_THREAD_STATE64;
|
||||
}
|
||||
|
||||
static inline arm_thread_state32_t*
|
||||
thread_state32(arm_unified_thread_state_t *its)
|
||||
{
|
||||
return &its->ts_32;
|
||||
}
|
||||
|
||||
static inline arm_thread_state64_t*
|
||||
thread_state64(arm_unified_thread_state_t *its)
|
||||
{
|
||||
return &its->ts_64;
|
||||
}
|
||||
|
||||
static inline const arm_thread_state32_t*
|
||||
const_thread_state32(const arm_unified_thread_state_t *its)
|
||||
{
|
||||
return &its->ts_32;
|
||||
}
|
||||
|
||||
static inline const arm_thread_state64_t*
|
||||
const_thread_state64(const arm_unified_thread_state_t *its)
|
||||
{
|
||||
return &its->ts_64;
|
||||
}
|
||||
|
||||
#if defined(__arm__)
|
||||
#include <arm/proc_reg.h>
|
||||
|
||||
#define ARM_SAVED_STATE (THREAD_STATE_NONE + 1)
|
||||
|
||||
struct arm_saved_state {
|
||||
uint32_t r[13]; /* General purpose register r0-r12 */
|
||||
uint32_t sp; /* Stack pointer r13 */
|
||||
uint32_t lr; /* Link register r14 */
|
||||
uint32_t pc; /* Program counter r15 */
|
||||
uint32_t cpsr; /* Current program status register */
|
||||
uint32_t fsr; /* Fault status */
|
||||
uint32_t far; /* Virtual Fault Address */
|
||||
uint32_t exception; /* exception number */
|
||||
};
|
||||
typedef struct arm_saved_state arm_saved_state_t;
|
||||
|
||||
/*
|
||||
* Just for coexistence with AArch64 code.
|
||||
*/
|
||||
typedef struct arm_saved_state arm_saved_state32_t;
|
||||
|
||||
static inline void
|
||||
copy_signed_thread_state(arm_saved_state_t *dst, const arm_saved_state_t *src)
|
||||
{
|
||||
*dst = *src;
|
||||
}
|
||||
|
||||
static inline arm_saved_state32_t*
|
||||
saved_state32(arm_saved_state_t *iss)
|
||||
{
|
||||
return iss;
|
||||
}
|
||||
|
||||
static inline boolean_t
|
||||
is_saved_state32(const arm_saved_state_t *iss __unused)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
struct arm_saved_state_tagged {
|
||||
uint32_t tag;
|
||||
struct arm_saved_state state;
|
||||
};
|
||||
typedef struct arm_saved_state_tagged arm_saved_state_tagged_t;
|
||||
|
||||
#define ARM_SAVED_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_saved_state_t)/sizeof(unsigned int)))
|
||||
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_pc(const arm_saved_state_t *iss)
|
||||
{
|
||||
return iss->pc;
|
||||
}
|
||||
|
||||
static inline void
|
||||
add_saved_state_pc(arm_saved_state_t *iss, int diff)
|
||||
{
|
||||
iss->pc += diff;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_pc(arm_saved_state_t *iss, register_t pc)
|
||||
{
|
||||
iss->pc = pc;
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_sp(const arm_saved_state_t *iss)
|
||||
{
|
||||
return iss->sp;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_sp(arm_saved_state_t *iss, register_t sp)
|
||||
{
|
||||
iss->sp = sp;
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_fp(const arm_saved_state_t *iss)
|
||||
{
|
||||
return iss->r[7];
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_fp(arm_saved_state_t *iss, register_t fp)
|
||||
{
|
||||
iss->r[7] = fp;
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_lr(const arm_saved_state_t *iss)
|
||||
{
|
||||
return iss->lr;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_lr(arm_saved_state_t *iss, register_t lr)
|
||||
{
|
||||
iss->lr = lr;
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_cpsr(const arm_saved_state_t *iss)
|
||||
{
|
||||
return iss->cpsr;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mask_saved_state_cpsr(arm_saved_state_t *iss, uint32_t set_bits, uint32_t clear_bits)
|
||||
{
|
||||
iss->cpsr |= set_bits;
|
||||
iss->cpsr &= clear_bits;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_cpsr(arm_saved_state_t *iss, register_t cpsr)
|
||||
{
|
||||
iss->cpsr = cpsr;
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_reg(const arm_saved_state_t *iss, unsigned regno)
|
||||
{
|
||||
return iss->r[regno];
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_reg(arm_saved_state_t *iss, unsigned regno, register_t val)
|
||||
{
|
||||
iss->r[regno] = val;
|
||||
}
|
||||
|
||||
#elif defined(__arm64__)
|
||||
|
||||
#include <kern/assert.h>
|
||||
#include <arm64/proc_reg.h>
|
||||
#define CAST_ASSERT_SAFE(type, val) (assert((val) == ((type)(val))), (type)(val))
|
||||
|
||||
/*
|
||||
* GPR context
|
||||
*/
|
||||
|
||||
struct arm_saved_state32 {
|
||||
uint32_t r[13]; /* General purpose register r0-r12 */
|
||||
uint32_t sp; /* Stack pointer r13 */
|
||||
uint32_t lr; /* Link register r14 */
|
||||
uint32_t pc; /* Program counter r15 */
|
||||
uint32_t cpsr; /* Current program status register */
|
||||
uint32_t far; /* Virtual fault address */
|
||||
uint32_t esr; /* Exception syndrome register */
|
||||
uint32_t exception; /* Exception number */
|
||||
};
|
||||
typedef struct arm_saved_state32 arm_saved_state32_t;
|
||||
|
||||
struct arm_saved_state32_tagged {
|
||||
uint32_t tag;
|
||||
struct arm_saved_state32 state;
|
||||
};
|
||||
typedef struct arm_saved_state32_tagged arm_saved_state32_tagged_t;
|
||||
|
||||
#define ARM_SAVED_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(arm_saved_state32_t)/sizeof(unsigned int)))
|
||||
|
||||
struct arm_saved_state64 {
|
||||
uint64_t x[29]; /* General purpose registers x0-x28 */
|
||||
uint64_t fp; /* Frame pointer x29 */
|
||||
uint64_t lr; /* Link register x30 */
|
||||
uint64_t sp; /* Stack pointer x31 */
|
||||
uint64_t pc; /* Program counter */
|
||||
uint32_t cpsr; /* Current program status register */
|
||||
uint32_t reserved; /* Reserved padding */
|
||||
uint64_t far; /* Virtual fault address */
|
||||
uint32_t esr; /* Exception syndrome register */
|
||||
uint32_t exception; /* Exception number */
|
||||
#if defined(HAS_APPLE_PAC)
|
||||
uint64_t jophash;
|
||||
#endif /* defined(HAS_APPLE_PAC) */
|
||||
};
|
||||
typedef struct arm_saved_state64 arm_saved_state64_t;
|
||||
|
||||
#define ARM_SAVED_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(arm_saved_state64_t)/sizeof(unsigned int)))
|
||||
|
||||
struct arm_saved_state64_tagged {
|
||||
uint32_t tag;
|
||||
struct arm_saved_state64 state;
|
||||
};
|
||||
typedef struct arm_saved_state64_tagged arm_saved_state64_tagged_t;
|
||||
|
||||
struct arm_saved_state {
|
||||
arm_state_hdr_t ash;
|
||||
union {
|
||||
struct arm_saved_state32 ss_32;
|
||||
struct arm_saved_state64 ss_64;
|
||||
} uss;
|
||||
} __attribute__((aligned(16)));
|
||||
#define ss_32 uss.ss_32
|
||||
#define ss_64 uss.ss_64
|
||||
|
||||
typedef struct arm_saved_state arm_saved_state_t;
|
||||
|
||||
#if defined(XNU_KERNEL_PRIVATE)
|
||||
#if defined(HAS_APPLE_PAC)
|
||||
/*
|
||||
* Methods used to sign and check thread state to detect corruptions of saved
|
||||
* thread state across exceptions and context switches.
|
||||
*/
|
||||
extern void ml_sign_thread_state(arm_saved_state_t *, uint64_t, uint32_t, uint64_t, uint64_t, uint64_t);
|
||||
|
||||
extern void ml_check_signed_state(const arm_saved_state_t *, uint64_t, uint32_t, uint64_t, uint64_t, uint64_t);
|
||||
|
||||
/* XXX: including stddef.f here breaks ctfmerge on some builds, so use __builtin_offsetof() instead of offsetof() */
|
||||
#define ss64_offsetof(x) __builtin_offsetof(struct arm_saved_state, ss_64.x)
|
||||
|
||||
/**
|
||||
* Verify the signed thread state in _iss, execute the assembly instructions
|
||||
* _instr, and re-sign the modified thread state. Varargs specify additional
|
||||
* inputs.
|
||||
*
|
||||
* _instr may read or modify the thread state in the following registers:
|
||||
*
|
||||
* x0: _iss
|
||||
* x1: authed _iss->ss_64.pc
|
||||
* w2: authed _iss->ss_64.cpsr
|
||||
* x3: authed _iss->ss_64.lr
|
||||
* x4: authed _iss->ss_64.x16
|
||||
* x5: authed _iss->ss_64.x17
|
||||
* x6: scratch register
|
||||
* x7: scratch register
|
||||
*/
|
||||
#define MANIPULATE_SIGNED_THREAD_STATE(_iss, _instr, ...) \
|
||||
asm volatile ( \
|
||||
"mov x8, lr" "\n" \
|
||||
"mov x0, %[iss]" "\n" \
|
||||
"ldp x4, x5, [x0, %[SS64_X16]]" "\n" \
|
||||
"ldr x6, [x0, %[SS64_PC]]" "\n" \
|
||||
"ldr w7, [x0, %[SS64_CPSR]]" "\n" \
|
||||
"ldr x3, [x0, %[SS64_LR]]" "\n" \
|
||||
"mov x1, x6" "\n" \
|
||||
"mov w2, w7" "\n" \
|
||||
"bl _ml_check_signed_state" "\n" \
|
||||
"mov x1, x6" "\n" \
|
||||
"mov w2, w7" "\n" \
|
||||
_instr "\n" \
|
||||
"bl _ml_sign_thread_state" "\n" \
|
||||
"mov lr, x8" "\n" \
|
||||
: \
|
||||
: [iss] "r"(_iss), \
|
||||
[SS64_X16] "i"(ss64_offsetof(x[16])), \
|
||||
[SS64_PC] "i"(ss64_offsetof(pc)), \
|
||||
[SS64_CPSR] "i"(ss64_offsetof(cpsr)), \
|
||||
[SS64_LR] "i"(ss64_offsetof(lr)),##__VA_ARGS__ \
|
||||
: "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8" \
|
||||
)
|
||||
|
||||
static inline void
|
||||
check_and_sign_copied_thread_state(arm_saved_state_t *dst, const arm_saved_state_t *src)
|
||||
{
|
||||
MANIPULATE_SIGNED_THREAD_STATE(src,
|
||||
"mov x0, %[dst]",
|
||||
[dst] "r"(dst)
|
||||
);
|
||||
}
|
||||
#endif /* defined(HAS_APPLE_PAC) */
|
||||
|
||||
static inline void
|
||||
copy_signed_thread_state(arm_saved_state_t *dst, const arm_saved_state_t *src)
|
||||
{
|
||||
*dst = *src;
|
||||
#if defined(HAS_APPLE_PAC)
|
||||
check_and_sign_copied_thread_state(dst, src);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* defined(XNU_KERNEL_PRIVATE) */
|
||||
|
||||
static inline boolean_t
|
||||
is_saved_state32(const arm_saved_state_t *iss)
|
||||
{
|
||||
return iss->ash.flavor == ARM_SAVED_STATE32;
|
||||
}
|
||||
|
||||
static inline boolean_t
|
||||
is_saved_state64(const arm_saved_state_t *iss)
|
||||
{
|
||||
return iss->ash.flavor == ARM_SAVED_STATE64;
|
||||
}
|
||||
|
||||
static inline arm_saved_state32_t*
|
||||
saved_state32(arm_saved_state_t *iss)
|
||||
{
|
||||
return &iss->ss_32;
|
||||
}
|
||||
|
||||
static inline const arm_saved_state32_t*
|
||||
const_saved_state32(const arm_saved_state_t *iss)
|
||||
{
|
||||
return &iss->ss_32;
|
||||
}
|
||||
|
||||
static inline arm_saved_state64_t*
|
||||
saved_state64(arm_saved_state_t *iss)
|
||||
{
|
||||
return &iss->ss_64;
|
||||
}
|
||||
|
||||
static inline const arm_saved_state64_t*
|
||||
const_saved_state64(const arm_saved_state_t *iss)
|
||||
{
|
||||
return &iss->ss_64;
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_pc(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? const_saved_state32(iss)->pc : const_saved_state64(iss)->pc;
|
||||
}
|
||||
|
||||
static inline void
|
||||
add_saved_state_pc(arm_saved_state_t *iss, int diff)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
uint64_t pc = saved_state32(iss)->pc + diff;
|
||||
saved_state32(iss)->pc = CAST_ASSERT_SAFE(uint32_t, pc);
|
||||
} else {
|
||||
#if defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC)
|
||||
MANIPULATE_SIGNED_THREAD_STATE(iss,
|
||||
"mov w6, %w[diff] \n"
|
||||
"add x1, x1, w6, sxtw \n"
|
||||
"str x1, [x0, %[SS64_PC]] \n",
|
||||
[diff] "r"(diff)
|
||||
);
|
||||
#else
|
||||
saved_state64(iss)->pc += diff;
|
||||
#endif /* defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC) */
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_pc(arm_saved_state_t *iss, register_t pc)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->pc = CAST_ASSERT_SAFE(uint32_t, pc);
|
||||
} else {
|
||||
#if defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC)
|
||||
MANIPULATE_SIGNED_THREAD_STATE(iss,
|
||||
"mov x1, %[pc] \n"
|
||||
"str x1, [x0, %[SS64_PC]] \n",
|
||||
[pc] "r"(pc)
|
||||
);
|
||||
#else
|
||||
saved_state64(iss)->pc = pc;
|
||||
#endif /* defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC) */
|
||||
}
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_sp(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? const_saved_state32(iss)->sp : const_saved_state64(iss)->sp;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_sp(arm_saved_state_t *iss, register_t sp)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->sp = CAST_ASSERT_SAFE(uint32_t, sp);
|
||||
} else {
|
||||
saved_state64(iss)->sp = sp;
|
||||
}
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_lr(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? const_saved_state32(iss)->lr : const_saved_state64(iss)->lr;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_lr(arm_saved_state_t *iss, register_t lr)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->lr = CAST_ASSERT_SAFE(uint32_t, lr);
|
||||
} else {
|
||||
#if defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC)
|
||||
MANIPULATE_SIGNED_THREAD_STATE(iss,
|
||||
"mov x3, %[lr] \n"
|
||||
"str x3, [x0, %[SS64_LR]] \n",
|
||||
[lr] "r"(lr)
|
||||
);
|
||||
#else
|
||||
saved_state64(iss)->lr = lr;
|
||||
#endif /* defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC) */
|
||||
}
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_fp(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? const_saved_state32(iss)->r[7] : const_saved_state64(iss)->fp;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_fp(arm_saved_state_t *iss, register_t fp)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->r[7] = CAST_ASSERT_SAFE(uint32_t, fp);
|
||||
} else {
|
||||
saved_state64(iss)->fp = fp;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int
|
||||
check_saved_state_reglimit(const arm_saved_state_t *iss, unsigned reg)
|
||||
{
|
||||
return is_saved_state32(iss) ? (reg < ARM_SAVED_STATE32_COUNT) : (reg < ARM_SAVED_STATE64_COUNT);
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_reg(const arm_saved_state_t *iss, unsigned reg)
|
||||
{
|
||||
if (!check_saved_state_reglimit(iss, reg)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return is_saved_state32(iss) ? (const_saved_state32(iss)->r[reg]) : (const_saved_state64(iss)->x[reg]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_reg(arm_saved_state_t *iss, unsigned reg, register_t value)
|
||||
{
|
||||
if (!check_saved_state_reglimit(iss, reg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->r[reg] = CAST_ASSERT_SAFE(uint32_t, value);
|
||||
} else {
|
||||
#if defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC)
|
||||
/* x16 and x17 are part of the jophash */
|
||||
if (reg == 16) {
|
||||
MANIPULATE_SIGNED_THREAD_STATE(iss,
|
||||
"mov x4, %[value] \n"
|
||||
"str x4, [x0, %[SS64_X16]] \n",
|
||||
[value] "r"(value)
|
||||
);
|
||||
return;
|
||||
} else if (reg == 17) {
|
||||
MANIPULATE_SIGNED_THREAD_STATE(iss,
|
||||
"mov x5, %[value] \n"
|
||||
"str x5, [x0, %[SS64_X17]] \n",
|
||||
[value] "r"(value),
|
||||
[SS64_X17] "i"(ss64_offsetof(x[17]))
|
||||
);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
saved_state64(iss)->x[reg] = value;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
get_saved_state_cpsr(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? const_saved_state32(iss)->cpsr : const_saved_state64(iss)->cpsr;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mask_saved_state_cpsr(arm_saved_state_t *iss, uint32_t set_bits, uint32_t clear_bits)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->cpsr |= set_bits;
|
||||
saved_state32(iss)->cpsr &= ~clear_bits;
|
||||
} else {
|
||||
#if defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC)
|
||||
MANIPULATE_SIGNED_THREAD_STATE(iss,
|
||||
"mov w6, %w[set_bits] \n"
|
||||
"orr w2, w2, w6, lsl #0 \n"
|
||||
"mov w6, %w[clear_bits] \n"
|
||||
"bic w2, w2, w6, lsl #0 \n"
|
||||
"str w2, [x0, %[SS64_CPSR]] \n",
|
||||
[set_bits] "r"(set_bits),
|
||||
[clear_bits] "r"(clear_bits)
|
||||
);
|
||||
#else
|
||||
saved_state64(iss)->cpsr |= set_bits;
|
||||
saved_state64(iss)->cpsr &= ~clear_bits;
|
||||
#endif /* defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC) */
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_cpsr(arm_saved_state_t *iss, uint32_t cpsr)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->cpsr = cpsr;
|
||||
} else {
|
||||
#if defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC)
|
||||
MANIPULATE_SIGNED_THREAD_STATE(iss,
|
||||
"mov w2, %w[cpsr] \n"
|
||||
"str w2, [x0, %[SS64_CPSR]] \n",
|
||||
[cpsr] "r"(cpsr)
|
||||
);
|
||||
#else
|
||||
saved_state64(iss)->cpsr = cpsr;
|
||||
#endif /* defined(XNU_KERNEL_PRIVATE) && defined(HAS_APPLE_PAC) */
|
||||
}
|
||||
}
|
||||
|
||||
static inline register_t
|
||||
get_saved_state_far(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? const_saved_state32(iss)->far : const_saved_state64(iss)->far;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_far(arm_saved_state_t *iss, register_t far)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->far = CAST_ASSERT_SAFE(uint32_t, far);
|
||||
} else {
|
||||
saved_state64(iss)->far = far;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
get_saved_state_esr(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? const_saved_state32(iss)->esr : const_saved_state64(iss)->esr;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_esr(arm_saved_state_t *iss, uint32_t esr)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->esr = esr;
|
||||
} else {
|
||||
saved_state64(iss)->esr = esr;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
get_saved_state_exc(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? const_saved_state32(iss)->exception : const_saved_state64(iss)->exception;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_saved_state_exc(arm_saved_state_t *iss, uint32_t exc)
|
||||
{
|
||||
if (is_saved_state32(iss)) {
|
||||
saved_state32(iss)->exception = exc;
|
||||
} else {
|
||||
saved_state64(iss)->exception = exc;
|
||||
}
|
||||
}
|
||||
|
||||
extern void panic_unimplemented(void);
|
||||
|
||||
static inline int
|
||||
get_saved_state_svc_number(const arm_saved_state_t *iss)
|
||||
{
|
||||
return is_saved_state32(iss) ? (int)const_saved_state32(iss)->r[12] : (int)const_saved_state64(iss)->x[ARM64_SYSCALL_CODE_REG_NUM]; /* Only first word counts here */
|
||||
}
|
||||
|
||||
typedef _STRUCT_ARM_LEGACY_DEBUG_STATE arm_legacy_debug_state_t;
|
||||
|
||||
struct arm_debug_aggregate_state {
|
||||
arm_state_hdr_t dsh;
|
||||
union {
|
||||
arm_debug_state32_t ds32;
|
||||
arm_debug_state64_t ds64;
|
||||
} uds;
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
typedef struct arm_debug_aggregate_state arm_debug_state_t;
|
||||
|
||||
#define ARM_LEGACY_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_legacy_debug_state_t)/sizeof(uint32_t)))
|
||||
|
||||
/*
|
||||
* NEON context
|
||||
*/
|
||||
typedef __uint128_t uint128_t;
|
||||
typedef uint64_t uint64x2_t __attribute__((ext_vector_type(2)));
|
||||
typedef uint32_t uint32x4_t __attribute__((ext_vector_type(4)));
|
||||
|
||||
struct arm_neon_saved_state32 {
|
||||
union {
|
||||
uint128_t q[16];
|
||||
uint64_t d[32];
|
||||
uint32_t s[32];
|
||||
} v;
|
||||
uint32_t fpsr;
|
||||
uint32_t fpcr;
|
||||
};
|
||||
typedef struct arm_neon_saved_state32 arm_neon_saved_state32_t;
|
||||
|
||||
#define ARM_NEON_SAVED_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_neon_saved_state32_t)/sizeof(unsigned int)))
|
||||
|
||||
struct arm_neon_saved_state64 {
|
||||
union {
|
||||
uint128_t q[32];
|
||||
uint64x2_t d[32];
|
||||
uint32x4_t s[32];
|
||||
} v;
|
||||
uint32_t fpsr;
|
||||
uint32_t fpcr;
|
||||
};
|
||||
typedef struct arm_neon_saved_state64 arm_neon_saved_state64_t;
|
||||
|
||||
#define ARM_NEON_SAVED_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_neon_saved_state64_t)/sizeof(unsigned int)))
|
||||
|
||||
struct arm_neon_saved_state {
|
||||
arm_state_hdr_t nsh;
|
||||
union {
|
||||
struct arm_neon_saved_state32 ns_32;
|
||||
struct arm_neon_saved_state64 ns_64;
|
||||
} uns;
|
||||
};
|
||||
typedef struct arm_neon_saved_state arm_neon_saved_state_t;
|
||||
#define ns_32 uns.ns_32
|
||||
#define ns_64 uns.ns_64
|
||||
|
||||
static inline boolean_t
|
||||
is_neon_saved_state32(const arm_neon_saved_state_t *state)
|
||||
{
|
||||
return state->nsh.flavor == ARM_NEON_SAVED_STATE32;
|
||||
}
|
||||
|
||||
static inline boolean_t
|
||||
is_neon_saved_state64(const arm_neon_saved_state_t *state)
|
||||
{
|
||||
return state->nsh.flavor == ARM_NEON_SAVED_STATE64;
|
||||
}
|
||||
|
||||
static inline arm_neon_saved_state32_t *
|
||||
neon_state32(arm_neon_saved_state_t *state)
|
||||
{
|
||||
return &state->ns_32;
|
||||
}
|
||||
|
||||
static inline arm_neon_saved_state64_t *
|
||||
neon_state64(arm_neon_saved_state_t *state)
|
||||
{
|
||||
return &state->ns_64;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Aggregated context
|
||||
*/
|
||||
|
||||
struct arm_context {
|
||||
struct arm_saved_state ss;
|
||||
struct arm_neon_saved_state ns;
|
||||
};
|
||||
typedef struct arm_context arm_context_t;
|
||||
|
||||
extern void saved_state_to_thread_state64(const arm_saved_state_t*, arm_thread_state64_t*);
|
||||
extern void thread_state64_to_saved_state(const arm_thread_state64_t*, arm_saved_state_t*);
|
||||
|
||||
#else /* defined(__arm__) */
|
||||
#error Unknown arch
|
||||
#endif /* defined(__arm__) */
|
||||
|
||||
extern void saved_state_to_thread_state32(const arm_saved_state_t*, arm_thread_state32_t*);
|
||||
extern void thread_state32_to_saved_state(const arm_thread_state32_t*, arm_saved_state_t*);
|
||||
|
||||
#endif /* XNU_KERNEL_PRIVATE */
|
||||
|
||||
#endif /* _ARM_THREAD_STATUS_H_ */
|
||||
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* FILE_ID: vm_param.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARM machine dependent virtual memory parameters.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_VM_PARAM_H_
|
||||
#define _MACH_ARM_VM_PARAM_H_
|
||||
|
||||
#if defined(KERNEL_PRIVATE) && __ARM_16K_PG__
|
||||
#include <arm64/proc_reg.h>
|
||||
#endif
|
||||
|
||||
#if !defined (KERNEL) && !defined (__ASSEMBLER__)
|
||||
#include <mach/vm_page_size.h>
|
||||
#endif
|
||||
|
||||
#define BYTE_SIZE 8 /* byte size in bits */
|
||||
|
||||
#if defined (KERNEL)
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#ifdef __arm__
|
||||
#define PAGE_SHIFT_CONST 12
|
||||
#elif defined(__arm64__)
|
||||
extern unsigned PAGE_SHIFT_CONST;
|
||||
#else
|
||||
#error Unsupported arch
|
||||
#endif
|
||||
|
||||
#if defined(KERNEL_PRIVATE) && __ARM_16K_PG__
|
||||
#define PAGE_SHIFT ARM_PGSHIFT
|
||||
#else
|
||||
#define PAGE_SHIFT PAGE_SHIFT_CONST
|
||||
#endif
|
||||
#define PAGE_SIZE (1 << PAGE_SHIFT)
|
||||
#define PAGE_MASK (PAGE_SIZE-1)
|
||||
|
||||
#define VM_PAGE_SIZE PAGE_SIZE
|
||||
|
||||
#define machine_ptob(x) ((x) << PAGE_SHIFT)
|
||||
|
||||
/*
|
||||
* Defined for the purpose of testing the pmap advertised page
|
||||
* size; this does not necessarily match the hardware page size.
|
||||
*/
|
||||
#define TEST_PAGE_SIZE_16K ((PAGE_SHIFT_CONST == 14))
|
||||
#define TEST_PAGE_SIZE_4K ((PAGE_SHIFT_CONST == 12))
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#else
|
||||
|
||||
#define PAGE_SHIFT vm_page_shift
|
||||
#define PAGE_SIZE vm_page_size
|
||||
#define PAGE_MASK vm_page_mask
|
||||
|
||||
#define VM_PAGE_SIZE vm_page_size
|
||||
|
||||
#define machine_ptob(x) ((x) << PAGE_SHIFT)
|
||||
|
||||
#endif
|
||||
|
||||
#define PAGE_MAX_SHIFT 14
|
||||
#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT)
|
||||
#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1)
|
||||
|
||||
#define PAGE_MIN_SHIFT 12
|
||||
#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT)
|
||||
#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1)
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#ifdef MACH_KERNEL_PRIVATE
|
||||
|
||||
#define VM32_SUPPORT 1
|
||||
#define VM32_MIN_ADDRESS ((vm32_offset_t) 0)
|
||||
#define VM32_MAX_ADDRESS ((vm32_offset_t) (VM_MAX_PAGE_ADDRESS & 0xFFFFFFFF))
|
||||
#define VM_MAX_PAGE_ADDRESS VM_MAX_ADDRESS /* ARM64_TODO: ?? */
|
||||
|
||||
/*
|
||||
* kalloc() parameters:
|
||||
*
|
||||
* Historically kalloc's underlying zones were power-of-2 sizes, with a
|
||||
* KALLOC_MINSIZE of 16 bytes. Thus the allocator ensured that
|
||||
* (sizeof == alignof) >= 16 for all kalloc allocations.
|
||||
*
|
||||
* Today kalloc may use zones with intermediate (small) sizes, constrained by
|
||||
* KALLOC_MINSIZE and a minimum alignment, expressed by KALLOC_LOG2_MINALIGN.
|
||||
*
|
||||
* Note that most dynamically allocated data structures contain more than
|
||||
* one int/long/pointer member, so KALLOC_MINSIZE should probably start at 8.
|
||||
*/
|
||||
|
||||
#if defined (__arm__)
|
||||
|
||||
#define KALLOC_MINSIZE 8 /* minimum allocation size */
|
||||
#define KALLOC_LOG2_MINALIGN 3 /* log2 minimum alignment */
|
||||
|
||||
#elif defined(__arm64__)
|
||||
|
||||
#define KALLOC_MINSIZE 16 /* minimum allocation size */
|
||||
#define KALLOC_LOG2_MINALIGN 4 /* log2 minimum alignment */
|
||||
|
||||
#else
|
||||
#error Unsupported arch
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (__arm__)
|
||||
|
||||
#define VM_MIN_ADDRESS ((vm_address_t) 0x00000000)
|
||||
#define VM_MAX_ADDRESS ((vm_address_t) 0x80000000)
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS)
|
||||
|
||||
#elif defined (__arm64__)
|
||||
|
||||
#define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL)
|
||||
#define VM_MAX_ADDRESS ((vm_address_t) 0x0000000080000000ULL)
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS_RAW 0x0ULL
|
||||
#define MACH_VM_MAX_ADDRESS_RAW 0x0000000FC0000000ULL
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW)
|
||||
|
||||
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS
|
||||
#define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#if defined (__arm__)
|
||||
#define VM_KERNEL_POINTER_SIGNIFICANT_BITS 32
|
||||
#define VM_MIN_KERNEL_ADDRESS ((vm_address_t) 0x80000000)
|
||||
#define VM_MAX_KERNEL_ADDRESS ((vm_address_t) 0xFFFEFFFF)
|
||||
#define VM_HIGH_KERNEL_WINDOW ((vm_address_t) 0xFFFE0000)
|
||||
#elif defined (__arm64__)
|
||||
/*
|
||||
* The minimum and maximum kernel address; some configurations may
|
||||
* constrain the address space further.
|
||||
*/
|
||||
#define VM_KERNEL_POINTER_SIGNIFICANT_BITS 37
|
||||
#define VM_MIN_KERNEL_ADDRESS ((vm_address_t) 0xffffffe000000000ULL)
|
||||
#define VM_MAX_KERNEL_ADDRESS ((vm_address_t) 0xfffffffbffffffffULL)
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#define VM_MIN_KERNEL_AND_KEXT_ADDRESS \
|
||||
VM_MIN_KERNEL_ADDRESS
|
||||
|
||||
#if __has_feature(ptrauth_calls)
|
||||
#include <ptrauth.h>
|
||||
#define VM_KERNEL_STRIP_PTR(_v) (ptrauth_strip((void *)(uintptr_t)(_v), ptrauth_key_asia))
|
||||
#else /* !ptrauth_calls */
|
||||
#define VM_KERNEL_STRIP_PTR(_v) (_v)
|
||||
#endif /* ptrauth_calls */
|
||||
|
||||
#define VM_KERNEL_ADDRESS(_va) \
|
||||
((((vm_address_t)VM_KERNEL_STRIP_PTR(_va)) >= VM_MIN_KERNEL_ADDRESS) && \
|
||||
(((vm_address_t)VM_KERNEL_STRIP_PTR(_va)) <= VM_MAX_KERNEL_ADDRESS))
|
||||
|
||||
#ifdef MACH_KERNEL_PRIVATE
|
||||
/*
|
||||
* Physical memory is mapped linearly at an offset virtual memory.
|
||||
*/
|
||||
extern unsigned long gVirtBase, gPhysBase, gPhysSize;
|
||||
|
||||
#define isphysmem(a) (((vm_address_t)(a) - gPhysBase) < gPhysSize)
|
||||
#define physmap_enclosed(a) isphysmem(a)
|
||||
|
||||
#if KASAN
|
||||
/* Increase the stack sizes to account for the redzones that get added to every
|
||||
* stack object. */
|
||||
# define KERNEL_STACK_SIZE (4*4*4096)
|
||||
#elif DEBUG
|
||||
/**
|
||||
* Increase the stack size to account for less efficient use of stack space when
|
||||
* compiling with -O0.
|
||||
*/
|
||||
# define KERNEL_STACK_SIZE (2*4*4096)
|
||||
#else
|
||||
# define KERNEL_STACK_SIZE (4*4096)
|
||||
#endif
|
||||
|
||||
#define INTSTACK_SIZE (4*4096)
|
||||
|
||||
#ifdef __arm64__
|
||||
#define EXCEPSTACK_SIZE (4*4096)
|
||||
#else
|
||||
#define FIQSTACK_SIZE (4096)
|
||||
#endif
|
||||
|
||||
#if defined (__arm__)
|
||||
#define HIGH_EXC_VECTORS ((vm_address_t) 0xFFFF0000)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TODO: We're hardcoding the expected virtual TEXT base here;
|
||||
* that gives us an ugly dependency on a linker argument in
|
||||
* the make files. Clean this up, so we don't hardcode it
|
||||
* twice; this is nothing but trouble.
|
||||
*/
|
||||
#if defined (__arm__)
|
||||
#define VM_KERNEL_LINK_ADDRESS ((vm_address_t) 0x80000000)
|
||||
#elif defined (__arm64__)
|
||||
#define VM_KERNEL_LINK_ADDRESS ((vm_address_t) 0xFFFFFFF007004000)
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* MACH_KERNEL_PRIVATE */
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#define SWI_SYSCALL 0x80
|
||||
|
||||
#endif /* _MACH_ARM_VM_PARAM_H_ */
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: vm_types.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1985
|
||||
*
|
||||
* Header file for VM data types. ARM version.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_VM_TYPES_H_
|
||||
#define _MACH_ARM_VM_TYPES_H_
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
|
||||
#include <arm/_types.h>
|
||||
#include <stdint.h>
|
||||
#include <Availability.h>
|
||||
|
||||
/*
|
||||
* natural_t and integer_t are Mach's legacy types for machine-
|
||||
* independent integer types (unsigned, and signed, respectively).
|
||||
* Their original purpose was to define other types in a machine/
|
||||
* compiler independent way.
|
||||
*
|
||||
* They also had an implicit "same size as pointer" characteristic
|
||||
* to them (i.e. Mach's traditional types are very ILP32 or ILP64
|
||||
* centric). We will likely support x86 ABIs that do not follow
|
||||
* either ofthese models (specifically LP64). Therefore, we had to
|
||||
* make a choice between making these types scale with pointers or stay
|
||||
* tied to integers. Because their use is predominantly tied to
|
||||
* to the size of an integer, we are keeping that association and
|
||||
* breaking free from pointer size guarantees.
|
||||
*
|
||||
* New use of these types is discouraged.
|
||||
*/
|
||||
typedef __darwin_natural_t natural_t;
|
||||
typedef int integer_t;
|
||||
|
||||
/*
|
||||
* A vm_offset_t is a type-neutral pointer,
|
||||
* e.g. an offset into a virtual memory space.
|
||||
*/
|
||||
#ifdef __LP64__
|
||||
typedef uintptr_t vm_offset_t;
|
||||
typedef uintptr_t vm_size_t;
|
||||
|
||||
typedef uint64_t mach_vm_address_t;
|
||||
typedef uint64_t mach_vm_offset_t;
|
||||
typedef uint64_t mach_vm_size_t;
|
||||
|
||||
typedef uint64_t vm_map_offset_t;
|
||||
typedef uint64_t vm_map_address_t;
|
||||
typedef uint64_t vm_map_size_t;
|
||||
#else
|
||||
typedef natural_t vm_offset_t;
|
||||
/*
|
||||
* A vm_size_t is the proper type for e.g.
|
||||
* expressing the difference between two
|
||||
* vm_offset_t entities.
|
||||
*/
|
||||
typedef natural_t vm_size_t;
|
||||
|
||||
/*
|
||||
* This new type is independent of a particular vm map's
|
||||
* implementation size - and represents appropriate types
|
||||
* for all possible maps. This is used for interfaces
|
||||
* where the size of the map is not known - or we don't
|
||||
* want to have to distinguish.
|
||||
*/
|
||||
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)
|
||||
typedef uint32_t mach_vm_address_t;
|
||||
typedef uint32_t mach_vm_offset_t;
|
||||
typedef uint32_t mach_vm_size_t;
|
||||
#else
|
||||
typedef uint64_t mach_vm_address_t;
|
||||
typedef uint64_t mach_vm_offset_t;
|
||||
typedef uint64_t mach_vm_size_t;
|
||||
#endif
|
||||
|
||||
typedef uint32_t vm_map_offset_t;
|
||||
typedef uint32_t vm_map_address_t;
|
||||
typedef uint32_t vm_map_size_t;
|
||||
#endif /* __LP64__ */
|
||||
|
||||
|
||||
typedef uint32_t vm32_offset_t;
|
||||
typedef uint32_t vm32_address_t;
|
||||
typedef uint32_t vm32_size_t;
|
||||
|
||||
typedef vm_offset_t mach_port_context_t;
|
||||
|
||||
#ifdef MACH_KERNEL_PRIVATE
|
||||
typedef vm32_offset_t mach_port_context32_t;
|
||||
typedef mach_vm_offset_t mach_port_context64_t;
|
||||
#endif
|
||||
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
/*
|
||||
* If composing messages by hand (please do not)
|
||||
*/
|
||||
#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
|
||||
|
||||
#endif /* _MACH_ARM_VM_TYPES_H_ */
|
||||
@@ -0,0 +1 @@
|
||||
../iPhoneOS/arm
|
||||
@@ -0,0 +1 @@
|
||||
../iPhoneOS/arm64
|
||||
@@ -0,0 +1,100 @@
|
||||
_accept$NOCANCEL$UNIX2003 ___accept_nocancel
|
||||
_accept$UNIX2003 ___accept
|
||||
_aio_suspend ___aio_suspend_nocancel
|
||||
_aio_suspend$NOCANCEL$UNIX2003 ___aio_suspend_nocancel
|
||||
_aio_suspend$UNIX2003 ___aio_suspend
|
||||
_bind$UNIX2003 ___bind
|
||||
_close ___close_nocancel
|
||||
_close$NOCANCEL$UNIX2003 ___close_nocancel
|
||||
_close$UNIX2003 ___close
|
||||
_chmod ___chmod
|
||||
_connect$NOCANCEL$UNIX2003 ___connect_nocancel
|
||||
_connect$UNIX2003 ___connect
|
||||
_fcntl ___fcntl_nocancel
|
||||
_fcntl$NOCANCEL$UNIX2003 ___fcntl_nocancel
|
||||
_fcntl$UNIX2003 ___fcntl
|
||||
_fstat$INODE64 ___fstat64
|
||||
_fstatat$INODE64 ___fstatat64
|
||||
_fstatfs$INODE64 ___fstatfs64
|
||||
_fsync ___fsync_nocancel
|
||||
_fsync$NOCANCEL$UNIX2003 ___fsync_nocancel
|
||||
_fsync$UNIX2003 ___fsync
|
||||
_getattrlist$UNIX2003 ___getattrlist
|
||||
_getfsstat$INODE64 ___getfsstat64
|
||||
_getpeername$UNIX2003 ___getpeername
|
||||
_getsockname$UNIX2003 ___getsockname
|
||||
_lchown$UNIX2003 ___lchown
|
||||
_listen$UNIX2003 ___listen
|
||||
_lstat$INODE64 ___lstat64
|
||||
_mmap ___mmap
|
||||
_mprotect$UNIX2003 ___mprotect
|
||||
_msgctl$UNIX2003 ___msgctl
|
||||
_msgrcv ___msgrcv_nocancel
|
||||
_msgrcv$NOCANCEL$UNIX2003 ___msgrcv_nocancel
|
||||
_msgrcv$UNIX2003 ___msgrcv
|
||||
_msgsnd ___msgsnd_nocancel
|
||||
_msgsnd$NOCANCEL$UNIX2003 ___msgsnd_nocancel
|
||||
_msgsnd$UNIX2003 ___msgsnd
|
||||
_msgsys ___msgsys
|
||||
_msync$NOCANCEL$UNIX2003 ___msync_nocancel
|
||||
_msync$UNIX2003 ___msync
|
||||
_open$NOCANCEL$UNIX2003 ___open_nocancel
|
||||
_open$UNIX2003 ___open
|
||||
_openat$NOCANCEL ___openat_nocancel
|
||||
_openat ___openat
|
||||
_poll ___poll_nocancel
|
||||
_poll$NOCANCEL$UNIX2003 ___poll_nocancel
|
||||
_poll$UNIX2003 ___poll
|
||||
_pread ___pread_nocancel
|
||||
_pread$NOCANCEL$UNIX2003 ___pread_nocancel
|
||||
_pread$UNIX2003 ___pread
|
||||
_pwrite ___pwrite_nocancel
|
||||
_pwrite$NOCANCEL$UNIX2003 ___pwrite_nocancel
|
||||
_pwrite$UNIX2003 ___pwrite
|
||||
_read ___read_nocancel
|
||||
_read$NOCANCEL$UNIX2003 ___read_nocancel
|
||||
_read$UNIX2003 ___read
|
||||
_readv ___readv_nocancel
|
||||
_readv$NOCANCEL$UNIX2003 ___readv_nocancel
|
||||
_readv$UNIX2003 ___readv
|
||||
_recvfrom$NOCANCEL$UNIX2003 ___recvfrom_nocancel
|
||||
_recvfrom$UNIX2003 ___recvfrom
|
||||
_recvmsg$NOCANCEL$UNIX2003 ___recvmsg_nocancel
|
||||
_recvmsg$UNIX2003 ___recvmsg
|
||||
_select$DARWIN_EXTSN ___select
|
||||
_select$DARWIN_EXTSN$NOCANCEL ___select_nocancel
|
||||
_sem_open ___sem_open
|
||||
_sem_wait ___sem_wait_nocancel
|
||||
_sem_wait$NOCANCEL$UNIX2003 ___sem_wait_nocancel
|
||||
_sem_wait$UNIX2003 ___sem_wait
|
||||
_semctl$UNIX2003 ___semctl
|
||||
_semsys ___semsys
|
||||
_sendmsg$NOCANCEL$UNIX2003 ___sendmsg_nocancel
|
||||
_sendmsg$UNIX2003 ___sendmsg
|
||||
_sendto$NOCANCEL$UNIX2003 ___sendto_nocancel
|
||||
_sendto$UNIX2003 ___sendto
|
||||
_setattrlist$UNIX2003 ___setattrlist
|
||||
_setpgrp ___setpgid
|
||||
_setregid$UNIX2003 ___setregid
|
||||
_setreuid$UNIX2003 ___setreuid
|
||||
_shmctl$UNIX2003 ___shmctl
|
||||
_shmsys ___shmsys
|
||||
_shm_open ___shm_open
|
||||
_socketpair$UNIX2003 ___socketpair
|
||||
_stat$INODE64 ___stat64
|
||||
_statfs$INODE64 ___statfs64
|
||||
_waitid ___waitid_nocancel
|
||||
_waitid$NOCANCEL$UNIX2003 ___waitid_nocancel
|
||||
_waitid$UNIX2003 ___waitid
|
||||
_write ___write_nocancel
|
||||
_write$NOCANCEL$UNIX2003 ___write_nocancel
|
||||
_write$UNIX2003 ___write
|
||||
_writev ___writev_nocancel
|
||||
_writev$NOCANCEL$UNIX2003 ___writev_nocancel
|
||||
_writev$UNIX2003 ___writev
|
||||
|
||||
_ioctl ___ioctl
|
||||
_sigaltstack ___sigaltstack
|
||||
_fchmod ___fchmod
|
||||
_setrlimit ___setrlimit
|
||||
_getrlimit ___getrlimit
|
||||
@@ -0,0 +1,77 @@
|
||||
_accept$NOCANCEL ___accept_nocancel
|
||||
_aio_suspend$NOCANCEL ___aio_suspend_nocancel
|
||||
_close$NOCANCEL ___close_nocancel
|
||||
_connect$NOCANCEL ___connect_nocancel
|
||||
_fstat ___fstat64
|
||||
_fstat64
|
||||
_fstatat ___fstatat64
|
||||
_fstatat64
|
||||
_fstatfs ___fstatfs64
|
||||
_fstatfs64
|
||||
_fstatx_np ___fstatx64_np
|
||||
_fstatx64_np
|
||||
_fsync$NOCANCEL ___fsync_nocancel
|
||||
_getfsstat ___getfsstat64
|
||||
_getfsstat64
|
||||
_getmntinfo ___getmntinfo64
|
||||
_getmntinfo64
|
||||
_lstat ___lstat64
|
||||
_lstat64
|
||||
_lstatx_np ___lstatx64_np
|
||||
_lstatx64_np
|
||||
_msgrcv$NOCANCEL ___msgrcv_nocancel
|
||||
_msgsnd$NOCANCEL ___msgsnd_nocancel
|
||||
_msync$NOCANCEL ___msync_nocancel
|
||||
_msgsys ___msgsys
|
||||
_open$NOCANCEL ___open_nocancel
|
||||
_openat$NOCANCEL ___openat_nocancel
|
||||
_poll$NOCANCEL ___poll_nocancel
|
||||
_pread$NOCANCEL ___pread_nocancel
|
||||
_pwrite$NOCANCEL ___pwrite_nocancel
|
||||
_read$NOCANCEL ___read_nocancel
|
||||
_readv$NOCANCEL ___readv_nocancel
|
||||
_recvfrom$NOCANCEL ___recvfrom_nocancel
|
||||
_recvmsg$NOCANCEL ___recvmsg_nocancel
|
||||
_select$DARWIN_EXTSN ___select
|
||||
_select$DARWIN_EXTSN$NOCANCEL ___select_nocancel
|
||||
_sem_wait$NOCANCEL ___sem_wait_nocancel
|
||||
_semsys ___semsys
|
||||
_sendmsg$NOCANCEL ___sendmsg_nocancel
|
||||
_sendto$NOCANCEL ___sendto_nocancel
|
||||
_stat ___stat64
|
||||
_stat64
|
||||
_statfs ___statfs64
|
||||
_statfs64
|
||||
_statx_np ___statx64_np
|
||||
_statx64_np
|
||||
_waitid$NOCANCEL ___waitid_nocancel
|
||||
_write$NOCANCEL ___write_nocancel
|
||||
_writev$NOCANCEL ___writev_nocancel
|
||||
|
||||
_accept ___accept
|
||||
_bind ___bind
|
||||
_getattrlist ___getattrlist
|
||||
_getpeername ___getpeername
|
||||
_getsockname ___getsockname
|
||||
_lchown ___lchown
|
||||
_listen ___listen
|
||||
_recvfrom ___recvfrom
|
||||
_recvmsg ___recvmsg
|
||||
_sendmsg ___sendmsg
|
||||
_sendto ___sendto
|
||||
_setattrlist ___setattrlist
|
||||
_socketpair ___socketpair
|
||||
|
||||
_mprotect ___mprotect
|
||||
_setregid ___setregid
|
||||
_setreuid ___setreuid
|
||||
_open ___open
|
||||
_openat ___openat
|
||||
_connect ___connect
|
||||
_msync ___msync
|
||||
_sem_open ___sem_open
|
||||
_semctl ___semctl
|
||||
_msgctl ___msgctl
|
||||
_shmctl ___shmctl
|
||||
_shmsys ___shmsys
|
||||
_shm_open ___shm_open
|
||||
@@ -0,0 +1,67 @@
|
||||
_accept$NOCANCEL ___accept_nocancel
|
||||
_aio_suspend$NOCANCEL ___aio_suspend_nocancel
|
||||
_close$NOCANCEL ___close_nocancel
|
||||
_connect$NOCANCEL ___connect_nocancel
|
||||
_fstat ___fstat64
|
||||
_fstat64
|
||||
_fstatat ___fstatat64
|
||||
_fstatat64
|
||||
_fstatfs ___fstatfs64
|
||||
_fstatfs64
|
||||
_fstatx_np ___fstatx64_np
|
||||
_fstatx64_np
|
||||
_fsync$NOCANCEL ___fsync_nocancel
|
||||
_getfsstat ___getfsstat64
|
||||
_getfsstat64
|
||||
_getmntinfo ___getmntinfo64
|
||||
_getmntinfo64
|
||||
_lstat ___lstat64
|
||||
_lstat64
|
||||
_lstatx_np ___lstatx64_np
|
||||
_lstatx64_np
|
||||
_msgrcv$NOCANCEL ___msgrcv_nocancel
|
||||
_msgsnd$NOCANCEL ___msgsnd_nocancel
|
||||
_msync$NOCANCEL ___msync_nocancel
|
||||
_poll$NOCANCEL ___poll_nocancel
|
||||
_pread$NOCANCEL ___pread_nocancel
|
||||
_pwrite$NOCANCEL ___pwrite_nocancel
|
||||
_read$NOCANCEL ___read_nocancel
|
||||
_readv$NOCANCEL ___readv_nocancel
|
||||
_recvfrom$NOCANCEL ___recvfrom_nocancel
|
||||
_recvmsg$NOCANCEL ___recvmsg_nocancel
|
||||
_select$DARWIN_EXTSN ___select
|
||||
_select$DARWIN_EXTSN$NOCANCEL ___select_nocancel
|
||||
_sem_wait$NOCANCEL ___sem_wait_nocancel
|
||||
_sendmsg$NOCANCEL ___sendmsg_nocancel
|
||||
_sendto$NOCANCEL ___sendto_nocancel
|
||||
_stat ___stat64
|
||||
_stat64
|
||||
_statfs ___statfs64
|
||||
_statfs64
|
||||
_statx_np ___statx64_np
|
||||
_statx64_np
|
||||
_waitid$NOCANCEL ___waitid_nocancel
|
||||
_write$NOCANCEL ___write_nocancel
|
||||
_writev$NOCANCEL ___writev_nocancel
|
||||
|
||||
_accept ___accept
|
||||
_bind ___bind
|
||||
_getattrlist ___getattrlist
|
||||
_getpeername ___getpeername
|
||||
_getsockname ___getsockname
|
||||
_lchown ___lchown
|
||||
_listen ___listen
|
||||
_recvfrom ___recvfrom
|
||||
_recvmsg ___recvmsg
|
||||
_sendmsg ___sendmsg
|
||||
_sendto ___sendto
|
||||
_setattrlist ___setattrlist
|
||||
_socketpair ___socketpair
|
||||
|
||||
_mprotect ___mprotect
|
||||
_setregid ___setregid
|
||||
_setreuid ___setreuid
|
||||
_connect ___connect
|
||||
_msync ___msync
|
||||
_msgctl ___msgctl
|
||||
_shmctl ___shmctl
|
||||
@@ -217,6 +217,369 @@ LEAF(pseudo, 0) ;\
|
||||
PSEUDO(pseudo, name, nargs, cerror) ;\
|
||||
ret
|
||||
|
||||
#elif defined(__arm__)
|
||||
|
||||
#include <architecture/arm/asm_help.h>
|
||||
#include <mach/arm/syscall_sw.h>
|
||||
|
||||
/*
|
||||
* ARM system call interface:
|
||||
*
|
||||
* swi 0x80
|
||||
* args: r0-r6
|
||||
* return code: r0
|
||||
* on error, carry bit is set in the psr, otherwise carry bit is cleared.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Macros.
|
||||
*/
|
||||
|
||||
/*
|
||||
* until we update the architecture project, these live here
|
||||
*/
|
||||
|
||||
#if defined(__DYNAMIC__)
|
||||
#define MI_GET_ADDRESS(reg,var) \
|
||||
ldr reg, 4f ;\
|
||||
3: ldr reg, [pc, reg] ;\
|
||||
b 5f ;\
|
||||
4: .long 6f - (3b + 8) ;\
|
||||
5: ;\
|
||||
.non_lazy_symbol_pointer ;\
|
||||
6: ;\
|
||||
.indirect_symbol var ;\
|
||||
.long 0 ;\
|
||||
.text ;\
|
||||
.align 2
|
||||
#else
|
||||
#define MI_GET_ADDRESS(reg,var) \
|
||||
ldr reg, 3f ;\
|
||||
b 4f ;\
|
||||
3: .long var ;\
|
||||
4:
|
||||
#endif
|
||||
|
||||
#if defined(__DYNAMIC__)
|
||||
#define MI_BRANCH_EXTERNAL(var) \
|
||||
.globl var ;\
|
||||
MI_GET_ADDRESS(ip, var) ;\
|
||||
bx ip
|
||||
#else
|
||||
#define MI_BRANCH_EXTERNAL(var) ;\
|
||||
.globl var ;\
|
||||
b var
|
||||
#endif
|
||||
|
||||
#if defined(__DYNAMIC__)
|
||||
#define MI_CALL_EXTERNAL(var) \
|
||||
.globl var ;\
|
||||
MI_GET_ADDRESS(ip,var) ;\
|
||||
blx ip
|
||||
#else
|
||||
#define MI_CALL_EXTERNAL(var) \
|
||||
.globl var ;\
|
||||
bl var
|
||||
#endif
|
||||
|
||||
#define MI_ENTRY_POINT(name) \
|
||||
.text ;\
|
||||
.align 2 ;\
|
||||
.globl name ;\
|
||||
name:
|
||||
|
||||
/* load the syscall number into r12 and trap */
|
||||
#define DO_SYSCALL(num) \
|
||||
.if (((num) & 0xff) == (num)) ;\
|
||||
mov r12, #(num) ;\
|
||||
.elseif (((num) & 0x3fc) == (num)) ;\
|
||||
mov r12, #(num) ;\
|
||||
.else ;\
|
||||
mov r12, #((num) & 0xffffff00) /* top half of the syscall number */ ;\
|
||||
orr r12, r12, #((num) & 0xff) /* bottom half */ ;\
|
||||
.endif ;\
|
||||
swi #SWI_SYSCALL
|
||||
|
||||
/* simple syscalls (0 to 4 args) */
|
||||
#define SYSCALL_0to4(name, cerror) \
|
||||
MI_ENTRY_POINT(_##name) ;\
|
||||
DO_SYSCALL(SYS_##name) ;\
|
||||
bxcc lr /* return if carry is clear (no error) */ ; \
|
||||
1: MI_BRANCH_EXTERNAL(_##cerror)
|
||||
|
||||
/* syscalls with 5 args is different, because of the single arg register load */
|
||||
#define SYSCALL_5(name, cerror) \
|
||||
MI_ENTRY_POINT(_##name) ;\
|
||||
mov ip, sp /* save a pointer to the args */ ; \
|
||||
stmfd sp!, { r4-r5 } /* save r4-r5 */ ;\
|
||||
ldr r4, [ip] /* load 5th arg */ ; \
|
||||
DO_SYSCALL(SYS_##name) ;\
|
||||
ldmfd sp!, { r4-r5 } /* restore r4-r5 */ ; \
|
||||
bxcc lr /* return if carry is clear (no error) */ ; \
|
||||
1: MI_BRANCH_EXTERNAL(_##cerror)
|
||||
|
||||
/* syscalls with 6 to 12 args. kernel may have to read from stack */
|
||||
#define SYSCALL_6to12(name, save_regs, arg_regs, cerror) \
|
||||
MI_ENTRY_POINT(_##name) ;\
|
||||
mov ip, sp /* save a pointer to the args */ ; \
|
||||
stmfd sp!, { save_regs } /* callee saved regs */ ;\
|
||||
ldmia ip, { arg_regs } /* load arg regs */ ; \
|
||||
DO_SYSCALL(SYS_##name) ;\
|
||||
ldmfd sp!, { save_regs } /* restore callee saved regs */ ; \
|
||||
bxcc lr /* return if carry is clear (no error) */ ; \
|
||||
1: MI_BRANCH_EXTERNAL(_##cerror)
|
||||
|
||||
#define COMMA ,
|
||||
|
||||
#if __BIGGEST_ALIGNMENT__ > 4
|
||||
|
||||
/* For the armv7k ABI, the alignment requirements may add padding. So we
|
||||
* let the kernel figure it out and push extra on the stack to avoid un-needed
|
||||
* copy-ins */
|
||||
|
||||
/* We'll also use r8 for moving arguments */
|
||||
|
||||
#define SYSCALL_0(name) SYSCALL_0to4(name)
|
||||
#define SYSCALL_1(name) SYSCALL_0to4(name)
|
||||
#define SYSCALL_2(name) SYSCALL_0to4(name)
|
||||
#define SYSCALL_3(name) SYSCALL_0to4(name)
|
||||
#define SYSCALL_4(name) SYSCALL_6to12(name, r4-r5, r4-r5)
|
||||
#undef SYSCALL_5
|
||||
#define SYSCALL_5(name) SYSCALL_6to12(name, r4-r5, r4-r5)
|
||||
#define SYSCALL_6(name) SYSCALL_6to12(name, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
#define SYSCALL_7(name) SYSCALL_6to12(name, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
#define SYSCALL_8(name) SYSCALL_6to12(name, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
#define SYSCALL_12(name) SYSCALL_6to12(name, r4-r6 COMMA r8, r4-r6 COMMA r8)
|
||||
|
||||
#else // !(__BIGGEST_ALIGNMENT__ > 4) (the normal arm32 ABI case)
|
||||
|
||||
#define SYSCALL_0(name) SYSCALL_0to4(name)
|
||||
#define SYSCALL_1(name) SYSCALL_0to4(name)
|
||||
#define SYSCALL_2(name) SYSCALL_0to4(name)
|
||||
#define SYSCALL_3(name) SYSCALL_0to4(name)
|
||||
#define SYSCALL_4(name) SYSCALL_0to4(name)
|
||||
/* SYSCALL_5 declared above */
|
||||
#define SYSCALL_6(name) SYSCALL_6to12(name, r4-r5, r4-r5)
|
||||
#define SYSCALL_7(name) SYSCALL_6to12(name, r4-r6 COMMA r8, r4-r6)
|
||||
#define SYSCALL_8(name) SYSCALL_6to12(name, r4-r6 COMMA r8, r4-r6) /* 8th on stack */
|
||||
#define SYSCALL_12(name) SYSCALL_6to12(name, r4-r6 COMMA r8, r4-r6) /* 8th-12th on stack */
|
||||
|
||||
#endif // __BIGGEST_ALIGNMENT__ > 4
|
||||
|
||||
/* select the appropriate syscall code, based on the number of arguments */
|
||||
#ifndef __SYSCALL_32BIT_ARG_BYTES
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_##nargs(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_##nargs(name, cerror)
|
||||
#else
|
||||
#if __SYSCALL_32BIT_ARG_BYTES < 20
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#elif __SYSCALL_32BIT_ARG_BYTES == 20
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_5(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_5(name, cerror)
|
||||
#elif __SYSCALL_32BIT_ARG_BYTES == 24
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_6(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_6(name, cerror)
|
||||
#elif __SYSCALL_32BIT_ARG_BYTES == 28
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_7(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_7(name, cerror)
|
||||
#elif __SYSCALL_32BIT_ARG_BYTES == 32
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_8(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_8(name, cerror)
|
||||
#elif __SYSCALL_32BIT_ARG_BYTES == 36
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_8(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_8(name, cerror)
|
||||
#elif __SYSCALL_32BIT_ARG_BYTES == 44
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_8(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_8(name, cerror)
|
||||
#elif __SYSCALL_32BIT_ARG_BYTES == 48
|
||||
#define SYSCALL(name, nargs, cerror) SYSCALL_12(name, cerror)
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) SYSCALL_NONAME_12(name, cerror)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SYSCALL_NONAME_0to4(name, cerror) \
|
||||
DO_SYSCALL(SYS_##name) ;\
|
||||
bcc 1f /* branch if carry bit is clear (no error) */ ; \
|
||||
MI_BRANCH_EXTERNAL(_##cerror) /* call cerror */ ; \
|
||||
1:
|
||||
|
||||
#define SYSCALL_NONAME_5(name, cerror) \
|
||||
mov ip, sp /* save a pointer to the args */ ; \
|
||||
stmfd sp!, { r4-r5 } /* save r4-r5 */ ;\
|
||||
ldr r4, [ip] /* load 5th arg */ ; \
|
||||
DO_SYSCALL(SYS_##name) ;\
|
||||
ldmfd sp!, { r4-r5 } /* restore r4-r7 */ ; \
|
||||
bcc 1f /* branch if carry bit is clear (no error) */ ; \
|
||||
MI_BRANCH_EXTERNAL(_##cerror) /* call cerror */ ; \
|
||||
1:
|
||||
|
||||
#define SYSCALL_NONAME_6to12(name, save_regs, arg_regs, cerror) \
|
||||
mov ip, sp /* save a pointer to the args */ ; \
|
||||
stmfd sp!, { save_regs } /* callee save regs */ ;\
|
||||
ldmia ip, { arg_regs } /* load arguments */ ; \
|
||||
DO_SYSCALL(SYS_##name) ;\
|
||||
ldmfd sp!, { save_regs } /* restore callee saved regs */ ; \
|
||||
bcc 1f /* branch if carry bit is clear (no error) */ ; \
|
||||
MI_BRANCH_EXTERNAL(_##cerror) /* call cerror */ ; \
|
||||
1:
|
||||
|
||||
|
||||
#if __BIGGEST_ALIGNMENT__ > 4
|
||||
|
||||
/* For the armv7k ABI, the alignment requirements may add padding. So we
|
||||
* let the kernel figure it out and push extra on the stack to avoid un-needed
|
||||
* copy-ins. We are relying on arguments that aren't in registers starting
|
||||
* 32 bytes from sp. We also use r8 like in the mach case. */
|
||||
|
||||
#define SYSCALL_NONAME_0(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME_1(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME_2(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME_3(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME_4(name, cerror) SYSCALL_NONAME_6to12(name, r4-r5, r4-r5, cerror)
|
||||
#undef SYSCALL_NONAME_5
|
||||
#define SYSCALL_NONAME_5(name, cerror) SYSCALL_NONAME_6to12(name, r4-r5, r4-r5, cerror)
|
||||
#define SYSCALL_NONAME_6(name, cerror) SYSCALL_NONAME_6to12(name, r4-r6 COMMA r8, r4-r6 COMMA r8, cerror)
|
||||
#define SYSCALL_NONAME_7(name, cerror) SYSCALL_NONAME_6to12(name, r4-r6 COMMA r8, r4-r6 COMMA r8, cerror)
|
||||
#define SYSCALL_NONAME_8(name, cerror) SYSCALL_NONAME_6to12(name, r4-r6 COMMA r8, r4-r6 COMMA r8, cerror)
|
||||
#define SYSCALL_NONAME_12(name, cerror) SYSCALL_NONAME_6to12(name, r4-r6 COMMA r8, r4-r6 COMMA r8, cerror)
|
||||
|
||||
#else // !(__BIGGEST_ALIGNMENT__ > 4) (the normal arm32 ABI case)
|
||||
|
||||
#define SYSCALL_NONAME_0(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME_1(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME_2(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME_3(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
#define SYSCALL_NONAME_4(name, cerror) SYSCALL_NONAME_0to4(name, cerror)
|
||||
/* SYSCALL_NONAME_5 declared above */
|
||||
#define SYSCALL_NONAME_6(name, cerror) SYSCALL_NONAME_6to12(name, r4-r5, r4-r5, cerror)
|
||||
#define SYSCALL_NONAME_7(name, cerror) SYSCALL_NONAME_6to12(name, r4-r6 COMMA r8, r4-r6, cerror)
|
||||
#define SYSCALL_NONAME_8(name, cerror) SYSCALL_NONAME_6to12(name, r4-r6 COMMA r8, r4-r6, cerror)
|
||||
#define SYSCALL_NONAME_12(name, cerror) SYSCALL_NONAME_6to12(name, r4-r6 COMMA r8, r4-r6, cerror)
|
||||
|
||||
#endif // __BIGGEST_ALIGNMENT__ > 4
|
||||
|
||||
#define PSEUDO(pseudo, name, nargs, cerror) \
|
||||
.globl pseudo ;\
|
||||
.text ;\
|
||||
.align 2 ;\
|
||||
pseudo: ;\
|
||||
SYSCALL_NONAME(name, nargs, cerror)
|
||||
|
||||
#define __SYSCALL2(pseudo, name, nargs, cerror) \
|
||||
PSEUDO(pseudo, name, nargs, cerror) ;\
|
||||
bx lr
|
||||
|
||||
#define __SYSCALL(pseudo, name, nargs) \
|
||||
PSEUDO(pseudo, name, nargs, cerror) ;\
|
||||
bx lr
|
||||
|
||||
#elif defined(__arm64__)
|
||||
|
||||
#include <mach/arm/syscall_sw.h>
|
||||
#include <mach/arm/vm_param.h>
|
||||
#include <mach/arm64/asm.h>
|
||||
|
||||
#if defined(__arm64__) && !defined(__LP64__)
|
||||
#define ZERO_EXTEND(argnum) uxtw x ## argnum, w ## argnum
|
||||
#else
|
||||
#define ZERO_EXTEND(argnum)
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__) && !defined(__LP64__)
|
||||
#define SIGN_EXTEND(argnum) sxtw x ## argnum, w ## argnum
|
||||
#else
|
||||
#define SIGN_EXTEND(argnum)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ARM64 system call interface:
|
||||
*
|
||||
* TBD
|
||||
*/
|
||||
|
||||
#define DO_SYSCALL(num, cerror) \
|
||||
mov x16, #(num) %%\
|
||||
svc #SWI_SYSCALL %%\
|
||||
b.cc 2f %%\
|
||||
PUSH_FRAME %%\
|
||||
bl _##cerror %%\
|
||||
POP_FRAME %%\
|
||||
ret %%\
|
||||
2:
|
||||
|
||||
#define MI_GET_ADDRESS(reg,var) \
|
||||
adrp reg, var@page %%\
|
||||
add reg, reg, var@pageoff %%
|
||||
|
||||
#define MI_CALL_EXTERNAL(sym) \
|
||||
.globl sym %% \
|
||||
bl sym
|
||||
|
||||
#define SYSCALL_NONAME(name, nargs, cerror) \
|
||||
DO_SYSCALL(SYS_##name, cerror) %% \
|
||||
1:
|
||||
|
||||
#define MI_ENTRY_POINT(name) \
|
||||
.text %% \
|
||||
.align 2 %% \
|
||||
.globl name %% \
|
||||
name:
|
||||
|
||||
#define PSEUDO(pseudo, name, nargs, cerror) \
|
||||
.text %% \
|
||||
.align 2 %% \
|
||||
.globl pseudo %% \
|
||||
pseudo: %% \
|
||||
SYSCALL_NONAME(name, nargs, cerror)
|
||||
|
||||
#define __SYSCALL(pseudo, name, nargs) \
|
||||
PSEUDO(pseudo, name, nargs, cerror) %% \
|
||||
ret
|
||||
|
||||
#define __SYSCALL2(pseudo, name, nargs, cerror) \
|
||||
PSEUDO(pseudo, name, nargs, cerror) %% \
|
||||
ret
|
||||
|
||||
#elif defined(__ppc__) || defined(__ppc64__)
|
||||
|
||||
#include <architecture/ppc/mode_independent_asm.h>
|
||||
|
||||
/*
|
||||
* Macros.
|
||||
*/
|
||||
|
||||
#define SYSCALL(name, nargs) \
|
||||
.globl cerror @\
|
||||
MI_ENTRY_POINT(_##name) @\
|
||||
li r0,SYS_##name @\
|
||||
sc @\
|
||||
b 1f @\
|
||||
blr @\
|
||||
1: MI_BRANCH_EXTERNAL(cerror)
|
||||
|
||||
|
||||
#define SYSCALL_NONAME(name, nargs) \
|
||||
.globl cerror @\
|
||||
li r0,SYS_##name @\
|
||||
sc @\
|
||||
b 1f @\
|
||||
b 2f @\
|
||||
1: MI_BRANCH_EXTERNAL(cerror) @\
|
||||
2:
|
||||
|
||||
|
||||
#define PSEUDO(pseudo, name, nargs) \
|
||||
.private_extern _##pseudo @\
|
||||
.text @\
|
||||
.align 2 @\
|
||||
_##pseudo: @\
|
||||
SYSCALL_NONAME(name, nargs)
|
||||
|
||||
#define __SYSCALL(pseudo, name, nargs) \
|
||||
PSEUDO(pseudo, name, nargs) @\
|
||||
blr
|
||||
|
||||
#else
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___old_semwait_signal_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(_____old_semwait_signal_nocancel, __old_semwait_signal_nocancel, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___sigwait_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(_____sigwait_nocancel, __sigwait_nocancel, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_abort_with_payload not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___abort_with_payload, abort_with_payload, 6, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_accept not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___accept, accept, 3, cerror)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___accept, accept, 3, cerror)
|
||||
.set _accept, ___accept
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _accept$UNIX2003
|
||||
.set _accept$UNIX2003, ___accept
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _accept
|
||||
.set _accept, ___accept
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _accept
|
||||
.set _accept, ___accept
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_accept_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___accept_nocancel, accept_nocancel, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___accept_nocancel, accept_nocancel, 3, cerror_nocancel)
|
||||
.set _accept$NOCANCEL, ___accept_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _accept$NOCANCEL$UNIX2003
|
||||
.set _accept$NOCANCEL$UNIX2003, ___accept_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _accept$NOCANCEL
|
||||
.set _accept$NOCANCEL, ___accept_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _accept$NOCANCEL
|
||||
.set _accept$NOCANCEL, ___accept_nocancel
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_access_extended not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___access_extended, access_extended, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___access_extended, access_extended, 4, cerror_nocancel)
|
||||
.set _accessx_np, ___access_extended
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _accessx_np
|
||||
.set _accessx_np, ___access_extended
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _accessx_np
|
||||
.set _accessx_np, ___access_extended
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _accessx_np
|
||||
.set _accessx_np, ___access_extended
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_aio_suspend_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___aio_suspend_nocancel, aio_suspend_nocancel, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -21,3 +21,20 @@ __SYSCALL2(___aio_suspend_nocancel, aio_suspend_nocancel, 3, cerror_nocancel)
|
||||
.set _aio_suspend$NOCANCEL, ___aio_suspend_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _aio_suspend
|
||||
.set _aio_suspend, ___aio_suspend_nocancel
|
||||
.globl _aio_suspend$NOCANCEL$UNIX2003
|
||||
.set _aio_suspend$NOCANCEL$UNIX2003, ___aio_suspend_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _aio_suspend$NOCANCEL
|
||||
.set _aio_suspend$NOCANCEL, ___aio_suspend_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _aio_suspend$NOCANCEL
|
||||
.set _aio_suspend$NOCANCEL, ___aio_suspend_nocancel
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_bind not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___bind, bind, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___bind, bind, 3, cerror_nocancel)
|
||||
.set _bind, ___bind
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _bind$UNIX2003
|
||||
.set _bind$UNIX2003, ___bind
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _bind
|
||||
.set _bind, ___bind
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _bind
|
||||
.set _bind, ___bind
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_bsdthread_create not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___bsdthread_create, bsdthread_create, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_bsdthread_ctl not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___bsdthread_ctl, bsdthread_ctl, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_bsdthread_register not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___bsdthread_register, bsdthread_register, 7, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_bsdthread_terminate not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___bsdthread_terminate, bsdthread_terminate, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_chmod not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___chmod, chmod, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -14,3 +14,8 @@ __SYSCALL2(___chmod, chmod, 2, cerror_nocancel)
|
||||
.set _chmod, ___chmod
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _chmod
|
||||
.set _chmod, ___chmod
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_chmod_extended not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___chmod_extended, chmod_extended, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_close_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___close_nocancel, close_nocancel, 1, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -21,3 +21,20 @@ __SYSCALL2(___close_nocancel, close_nocancel, 1, cerror_nocancel)
|
||||
.set _close$NOCANCEL, ___close_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _close
|
||||
.set _close, ___close_nocancel
|
||||
.globl _close$NOCANCEL$UNIX2003
|
||||
.set _close$NOCANCEL$UNIX2003, ___close_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _close$NOCANCEL
|
||||
.set _close$NOCANCEL, ___close_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _close$NOCANCEL
|
||||
.set _close$NOCANCEL, ___close_nocancel
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_coalition not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___coalition, coalition, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_coalition_info not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___coalition_info, coalition_info, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_connect not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___connect, connect, 3, cerror)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___connect, connect, 3, cerror)
|
||||
.set _connect, ___connect
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _connect$UNIX2003
|
||||
.set _connect$UNIX2003, ___connect
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _connect
|
||||
.set _connect, ___connect
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _connect
|
||||
.set _connect, ___connect
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_connect_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___connect_nocancel, connect_nocancel, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___connect_nocancel, connect_nocancel, 3, cerror_nocancel)
|
||||
.set _connect$NOCANCEL, ___connect_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _connect$NOCANCEL$UNIX2003
|
||||
.set _connect$NOCANCEL$UNIX2003, ___connect_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _connect$NOCANCEL
|
||||
.set _connect$NOCANCEL, ___connect_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _connect$NOCANCEL
|
||||
.set _connect$NOCANCEL, ___connect_nocancel
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_copyfile not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___copyfile, copyfile, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_csrctl not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___csrctl, csrctl, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_delete not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___delete, delete, 1, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___disable_threadsignal not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___disable_threadsignal, __disable_threadsignal, 1, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_exit not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___exit, exit, 1, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___exit, exit, 1, cerror_nocancel)
|
||||
.set __exit, ___exit
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl __exit
|
||||
.set __exit, ___exit
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl __exit
|
||||
.set __exit, ___exit
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl __exit
|
||||
.set __exit, ___exit
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_fchmod not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___fchmod, fchmod, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -14,3 +14,8 @@ __SYSCALL2(___fchmod, fchmod, 2, cerror_nocancel)
|
||||
.set _fchmod, ___fchmod
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _fchmod
|
||||
.set _fchmod, ___fchmod
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_fchmod_extended not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___fchmod_extended, fchmod_extended, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_fcntl not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___fcntl, fcntl, 3, cerror)
|
||||
#endif
|
||||
|
||||
@@ -14,3 +14,8 @@ __SYSCALL2(___fcntl, fcntl, 3, cerror)
|
||||
.set _fcntl$UNIX2003, ___fcntl
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _fcntl$UNIX2003
|
||||
.set _fcntl$UNIX2003, ___fcntl
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_fcntl_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___fcntl_nocancel, fcntl_nocancel, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -16,3 +16,10 @@ __SYSCALL2(___fcntl_nocancel, fcntl_nocancel, 3, cerror_nocancel)
|
||||
.set _fcntl$NOCANCEL$UNIX2003, ___fcntl_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _fcntl
|
||||
.set _fcntl, ___fcntl_nocancel
|
||||
.globl _fcntl$NOCANCEL$UNIX2003
|
||||
.set _fcntl$NOCANCEL$UNIX2003, ___fcntl_nocancel
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_fs_snapshot not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___fs_snapshot, fs_snapshot, 6, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_fstat64_extended not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___fstat64_extended, fstat64_extended, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_fstat_extended not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___fstat_extended, fstat_extended, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_fsync_nocancel not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___fsync_nocancel, fsync_nocancel, 1, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -21,3 +21,20 @@ __SYSCALL2(___fsync_nocancel, fsync_nocancel, 1, cerror_nocancel)
|
||||
.set _fsync$NOCANCEL, ___fsync_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _fsync
|
||||
.set _fsync, ___fsync_nocancel
|
||||
.globl _fsync$NOCANCEL$UNIX2003
|
||||
.set _fsync$NOCANCEL$UNIX2003, ___fsync_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _fsync$NOCANCEL
|
||||
.set _fsync$NOCANCEL, ___fsync_nocancel
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _fsync$NOCANCEL
|
||||
.set _fsync$NOCANCEL, ___fsync_nocancel
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_getattrlist not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___getattrlist, getattrlist, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___getattrlist, getattrlist, 5, cerror_nocancel)
|
||||
.set _getattrlist, ___getattrlist
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _getattrlist$UNIX2003
|
||||
.set _getattrlist$UNIX2003, ___getattrlist
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _getattrlist
|
||||
.set _getattrlist, ___getattrlist
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _getattrlist
|
||||
.set _getattrlist, ___getattrlist
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_getdirentries64 not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___getdirentries64, getdirentries64, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_gethostuuid not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___gethostuuid, gethostuuid, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_getlogin not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___getlogin, getlogin, 2, cerror)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_getpeername not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___getpeername, getpeername, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___getpeername, getpeername, 3, cerror_nocancel)
|
||||
.set _getpeername, ___getpeername
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _getpeername$UNIX2003
|
||||
.set _getpeername$UNIX2003, ___getpeername
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _getpeername
|
||||
.set _getpeername, ___getpeername
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _getpeername
|
||||
.set _getpeername, ___getpeername
|
||||
#endif
|
||||
|
||||
|
||||
@@ -102,8 +102,28 @@ LEAF(___getpid, 0)
|
||||
#else
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#if defined(__i386__)
|
||||
.globl _getpid
|
||||
_getpid = ___getpid
|
||||
.set _getpid, ___getpid
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
.globl _getpid
|
||||
.set _getpid, ___getpid
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _getpid
|
||||
.set _getpid, ___getpid
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _getpid
|
||||
.set _getpid, ___getpid
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _getpid
|
||||
.set _getpid, ___getpid
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_getrlimit not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___getrlimit, getrlimit, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -14,3 +14,8 @@ __SYSCALL2(___getrlimit, getrlimit, 2, cerror_nocancel)
|
||||
.set _getrlimit, ___getrlimit
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _getrlimit
|
||||
.set _getrlimit, ___getrlimit
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_getsgroups not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___getsgroups, getsgroups, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___getsgroups, getsgroups, 2, cerror_nocancel)
|
||||
.set _getsgroups_np, ___getsgroups
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _getsgroups_np
|
||||
.set _getsgroups_np, ___getsgroups
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _getsgroups_np
|
||||
.set _getsgroups_np, ___getsgroups
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _getsgroups_np
|
||||
.set _getsgroups_np, ___getsgroups
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_getsockname not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___getsockname, getsockname, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___getsockname, getsockname, 3, cerror_nocancel)
|
||||
.set _getsockname, ___getsockname
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _getsockname$UNIX2003
|
||||
.set _getsockname$UNIX2003, ___getsockname
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _getsockname
|
||||
.set _getsockname, ___getsockname
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _getsockname
|
||||
.set _getsockname, ___getsockname
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_gettid not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___gettid, gettid, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___gettid, gettid, 2, cerror_nocancel)
|
||||
.set _pthread_getugid_np, ___gettid
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _pthread_getugid_np
|
||||
.set _pthread_getugid_np, ___gettid
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _pthread_getugid_np
|
||||
.set _pthread_getugid_np, ___gettid
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _pthread_getugid_np
|
||||
.set _pthread_getugid_np, ___gettid
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_getwgroups not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___getwgroups, getwgroups, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___getwgroups, getwgroups, 2, cerror_nocancel)
|
||||
.set _getwgroups_np, ___getwgroups
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _getwgroups_np
|
||||
.set _getwgroups_np, ___getwgroups
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _getwgroups_np
|
||||
.set _getwgroups_np, ___getwgroups
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _getwgroups_np
|
||||
.set _getwgroups_np, ___getwgroups
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_guarded_open_dprotected_np not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___guarded_open_dprotected_np, guarded_open_dprotected_np, 7, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_guarded_open_np not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___guarded_open_np, guarded_open_np, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_identitysvc not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___identitysvc, identitysvc, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_initgroups not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___initgroups, initgroups, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_ioctl not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___ioctl, ioctl, 3, cerror)
|
||||
#endif
|
||||
|
||||
@@ -14,3 +14,8 @@ __SYSCALL2(___ioctl, ioctl, 3, cerror)
|
||||
.set _ioctl, ___ioctl
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _ioctl
|
||||
.set _ioctl, ___ioctl
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_iopolicysys not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___iopolicysys, iopolicysys, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_kdebug_trace not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___kdebug_trace, kdebug_trace, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_kdebug_trace64 not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___kdebug_trace64, kdebug_trace64, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_kdebug_typefilter not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___kdebug_typefilter, kdebug_typefilter, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_kill not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___kill, kill, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_kqueue_workloop_ctl not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___kqueue_workloop_ctl, kqueue_workloop_ctl, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_lchown not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___lchown, lchown, 3, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___lchown, lchown, 3, cerror_nocancel)
|
||||
.set _lchown, ___lchown
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _lchown$UNIX2003
|
||||
.set _lchown$UNIX2003, ___lchown
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _lchown
|
||||
.set _lchown, ___lchown
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _lchown
|
||||
.set _lchown, ___lchown
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_listen not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___listen, listen, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___listen, listen, 2, cerror_nocancel)
|
||||
.set _listen, ___listen
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _listen$UNIX2003
|
||||
.set _listen$UNIX2003, ___listen
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _listen
|
||||
.set _listen, ___listen
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _listen
|
||||
.set _listen, ___listen
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,3 +49,18 @@ __SYSCALL_INT(___lseek, lseek, 3)
|
||||
.set _lseek, ___lseek
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl _lseek
|
||||
.set _lseek, ___lseek
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl _lseek
|
||||
.set _lseek, ___lseek
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl _lseek
|
||||
.set _lseek, ___lseek
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_lstat64_extended not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___lstat64_extended, lstat64_extended, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS_lstat_extended not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___lstat_extended, lstat_extended, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_execve not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_execve, __mac_execve, 4, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___mac_execve, __mac_execve, 4, cerror_nocancel)
|
||||
.set ___sandbox_me, ___mac_execve
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl ___sandbox_me
|
||||
.set ___sandbox_me, ___mac_execve
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl ___sandbox_me
|
||||
.set ___sandbox_me, ___mac_execve
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl ___sandbox_me
|
||||
.set ___sandbox_me, ___mac_execve
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_get_fd not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_get_fd, __mac_get_fd, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_get_file not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_get_file, __mac_get_file, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_get_link not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_get_link, __mac_get_link, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_get_mount not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_get_mount, __mac_get_mount, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_get_pid not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_get_pid, __mac_get_pid, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_get_proc not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_get_proc, __mac_get_proc, 1, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_getfsstat not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_getfsstat, __mac_getfsstat, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_mount not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_mount, __mac_mount, 5, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
@@ -19,3 +19,18 @@ __SYSCALL2(___mac_mount, __mac_mount, 5, cerror_nocancel)
|
||||
.set ___sandbox_mm, ___mac_mount
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
.globl ___sandbox_mm
|
||||
.set ___sandbox_mm, ___mac_mount
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
.globl ___sandbox_mm
|
||||
.set ___sandbox_mm, ___mac_mount
|
||||
#endif
|
||||
|
||||
#if defined(__arm64__)
|
||||
.globl ___sandbox_mm
|
||||
.set ___sandbox_mm, ___mac_mount
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_set_fd not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_set_fd, __mac_set_fd, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_set_file not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_set_file, __mac_set_file, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#error "SYS___mac_set_link not defined. The header files libsyscall is building against do not match syscalls.master."
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__arm__) || defined(__arm64__)
|
||||
__SYSCALL2(___mac_set_link, __mac_set_link, 2, cerror_nocancel)
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user