mirror of
https://github.com/darlinghq/darling-xnu.git
synced 2024-11-26 22:10:24 +00:00
Partially Restore Darling-Specific Changes
Since we don't build the kernel module anymore, I want to take the opportunity to only include changes that are needed for Darling to function (build and sucessfully bring up `bash`).
This commit is contained in:
parent
e5177fae0a
commit
c128ce938e
@ -31,7 +31,7 @@
|
||||
/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
|
||||
* example, already has a Clang-compatible stdatomic.h header.
|
||||
*/
|
||||
#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
|
||||
#if !defined(DARLING) && __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
|
||||
# include_next <stdatomic.h>
|
||||
#else
|
||||
|
||||
|
@ -42,7 +42,9 @@ typedef void *xpc_object_t;
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#ifndef DARLING
|
||||
extern void *__dso_handle;
|
||||
#endif
|
||||
|
||||
OS_ALWAYS_INLINE
|
||||
static inline void
|
||||
|
@ -74,20 +74,39 @@
|
||||
/*
|
||||
* Syscall entry macros for use in libc:
|
||||
*/
|
||||
#ifndef DARLING
|
||||
|
||||
#define UNIX_SYSCALL_TRAP \
|
||||
int $(UNIX_INT)
|
||||
#define MACHDEP_SYSCALL_TRAP \
|
||||
int $(MACHDEP_INT)
|
||||
|
||||
#else // DARLING
|
||||
|
||||
#define UNIX_SYSCALL_TRAP \
|
||||
call __darling_bsd_syscall
|
||||
#define MACHDEP_SYSCALL_TRAP \
|
||||
call __darling_machdep_syscall
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro to generate Mach call stubs in libc:
|
||||
*/
|
||||
#ifndef DARLING
|
||||
|
||||
#define kernel_trap(trap_name,trap_number,number_args) \
|
||||
LEAF(_##trap_name,0) ;\
|
||||
movl $##trap_number, %eax ;\
|
||||
call __sysenter_trap ;\
|
||||
END(_##trap_name)
|
||||
#else // DARLING
|
||||
#define kernel_trap(trap_name,trap_number,number_args) \
|
||||
LEAF(_##trap_name,0) ;\
|
||||
movl $##trap_number, %eax ;\
|
||||
call __darling_mach_syscall ;\
|
||||
END(_##trap_name)
|
||||
#endif
|
||||
|
||||
#endif /* !KERNEL */
|
||||
|
||||
@ -97,10 +116,17 @@ END(_##trap_name)
|
||||
|
||||
#ifndef KERNEL
|
||||
|
||||
#ifndef DARLING
|
||||
#define UNIX_SYSCALL_TRAP \
|
||||
syscall
|
||||
#define MACHDEP_SYSCALL_TRAP \
|
||||
syscall
|
||||
#else // DARLING
|
||||
#define UNIX_SYSCALL_TRAP \
|
||||
call __darling_bsd_syscall
|
||||
#define MACHDEP_SYSCALL_TRAP \
|
||||
call __darling_machdep_syscall
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro to generate Mach call stubs in Libc.
|
||||
@ -109,13 +135,20 @@ END(_##trap_name)
|
||||
* macro above, we negate those numbers here for the 64-bit
|
||||
* code path.
|
||||
*/
|
||||
#ifndef DARLING
|
||||
#define kernel_trap(trap_name,trap_number,number_args) \
|
||||
LEAF(_##trap_name,0) ;\
|
||||
movq %rcx, %r10 ;\
|
||||
movl $ SYSCALL_CONSTRUCT_MACH(-##trap_number), %eax ;\
|
||||
syscall ;\
|
||||
END(_##trap_name)
|
||||
|
||||
#else // DARLING
|
||||
#define kernel_trap(trap_name,trap_number,number_args) \
|
||||
LEAF(_##trap_name,0) ;\
|
||||
movl $##trap_number, %eax ;\
|
||||
call __darling_mach_syscall;\
|
||||
END(_##trap_name)
|
||||
#endif
|
||||
#endif /* !KERNEL */
|
||||
|
||||
#endif /* defined(__x86_64__) */
|
||||
|
Loading…
Reference in New Issue
Block a user