Blame sysdeps/mach/i386/sysdep.h

Packit 6c4009
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit 6c4009
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _MACH_I386_SYSDEP_H
Packit 6c4009
#define _MACH_I386_SYSDEP_H 1
Packit 6c4009
Packit 6c4009
/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
Packit 6c4009
#include <dl-sysdep.h>
Packit 6c4009
#include <tls.h>
Packit 6c4009
Packit 6c4009
#define LOSE asm volatile ("hlt")
Packit 6c4009
Packit 6c4009
#define SNARF_ARGS(entry_sp, argc, argv, envp)				      \
Packit 6c4009
  do									      \
Packit 6c4009
    {									      \
Packit 6c4009
      char **p;								      \
Packit 6c4009
      argc = (int) *entry_sp;						      \
Packit 6c4009
      argv = (char **) (entry_sp + 1);					      \
Packit 6c4009
      p = argv;								      \
Packit 6c4009
      while (*p++ != NULL)						      \
Packit 6c4009
	;								      \
Packit 6c4009
      if (p >= (char **) argv[0])					      \
Packit 6c4009
	--p;								      \
Packit 6c4009
      envp = p;							      \
Packit 6c4009
    } while (0)
Packit 6c4009
Packit 6c4009
#define CALL_WITH_SP(fn, info, sp) \
Packit 6c4009
  do {									      \
Packit 6c4009
	void **ptr = (void **) sp;					      \
Packit 6c4009
	*--(__typeof (info) *) ptr = info;				      \
Packit 6c4009
	ptr[-1] = ptr;							      \
Packit 6c4009
	--ptr;								      \
Packit 6c4009
    asm volatile ("movl %0, %%esp; call %1" : : 			      \
Packit 6c4009
		  "g" (ptr), "m" (*(long int *) (fn)) : "%esp"); 	      \
Packit 6c4009
  } while (0)
Packit 6c4009
Packit 6c4009
#define RETURN_TO(sp, pc, retval) \
Packit 6c4009
  asm volatile ("movl %0, %%esp; jmp %*%1 # %2" \
Packit 6c4009
		: : "g" (sp), "r" (pc), "a" (retval))
Packit 6c4009
Packit 6c4009
Packit 6c4009
#define STACK_GROWTH_DOWN
Packit 6c4009
Packit 6c4009
/* Get the machine-independent Mach definitions.  */
Packit 6c4009
#include <sysdeps/mach/sysdep.h>
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* This should be rearranged, but at the moment this file provides
Packit 6c4009
   the most useful definitions for assembler syntax details.  */
Packit 6c4009
#undef ENTRY
Packit 6c4009
#undef ALIGN
Packit 6c4009
#include <sysdeps/unix/i386/sysdep.h>
Packit 6c4009
Packit 6c4009
#endif /* mach/i386/sysdep.h */