int test_nested1 (int i) { int __attribute__ ((__noinline__, __regparm__(3))) foo(int j, int k, int l) { return i + j + k + l; } return foo (i, i+1, i+2); }
int test_nested2 (int i) { int x; int __attribute__ ((__noinline__, __regparm__(3))) foo(int j, int k, int l) { return i + j + k + l; } x = foo (i+3, i+1, i+2); if (x != (4*i + 6)) abort (); return x; }
INTERFACE [svm]: #include "config.h" #include "vm.h" class Vmcb; class Vm_svm : public Vm { private: static void resume_vm_svm(Mword phys_vmcb, Vcpu_state *regs) asm("resume_vm_svm") __attribute__((__regparm__(3))); Unsigned8 _asid[Config::Max_num_cpus]; Unsigned32 _asid_generation[Config::Max_num_cpus]; enum { EFER_LME = 1 << 8, EFER_LMA = 1 << 10, }; };
(tls_msg(#cond ": assert failed: " __FILE__ ":" \ __XSTRING(__LINE__) "\n"), abort())) #define tls_msg(s) write(STDOUT_FILENO, s, strlen(s)) /* Provided by jemalloc to avoid bootstrapping issues. */ void *__je_bootstrap_malloc(size_t size); void *__je_bootstrap_calloc(size_t num, size_t size); void __je_bootstrap_free(void *ptr); __weak_reference(__libc_allocate_tls, _rtld_allocate_tls); __weak_reference(__libc_free_tls, _rtld_free_tls); #ifdef __i386__ __weak_reference(___libc_tls_get_addr, ___tls_get_addr); __attribute__((__regparm__(1))) void * ___libc_tls_get_addr(void *); #endif void * __libc_tls_get_addr(void *); __weak_reference(__libc_tls_get_addr, __tls_get_addr); void *_rtld_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign); void _rtld_free_tls(void *tls, size_t tcbsize, size_t tcbalign); void *__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign); void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); #if defined(__amd64__) #define TLS_TCB_ALIGN 16 #elif defined(__aarch64__) || defined(__arm__) || defined(__i386__) || \ defined(__mips__) || defined(__powerpc__) || defined(__riscv) || \
#include <Std.h> #include <Riva.h> #include <Agg.h> #include <Agg/IntegerTable.h> #include <Agg/ObjectTable.h> typedef struct { unsigned long int ti_module; unsigned long int ti_offset; } tls_index; void * __attribute__((__regparm__ (1))) ___tls_get_addr(tls_index *ti) { }; TYPE(T); TYPE(VertexT); TYPE(EdgeT); TYPE(VertexSelectionT); TYPE(EdgeSelectionT); #undef TYPE #include <igraph/igraph.h> SYMBOL($out, "out"); SYMBOL($in, "in"); SYMBOL($all, "all"); typedef struct graph_t graph_t; typedef struct vertex_t vertex_t;
futex_unlock (g_vdl.futex); } return retval; } // It's hard to believe but _dl_get_tls_static_info as well as other functions // were defined with a non-standard calling convention as an optimization. Since // these functions are called by the outside world, we have to do precisely // the same to be compatible. # if defined (__i386__) # define internal_function __attribute ((regparm (3), stdcall)) // this is the prototype for the GNU version of the i386 TLS ABI // note the extra leading underscore used here to identify this optimized // version of _get_addr EXPORT void * __attribute__ ((__regparm__ (1))) ___tls_get_addr (struct tls_index *ti) { void *retval = (void*) vdl_tls_get_addr_fast (ti->ti_module, ti->ti_offset); if (retval == 0) { futex_lock (g_vdl.futex); retval = (void*) vdl_tls_get_addr_slow (ti->ti_module, ti->ti_offset); futex_unlock (g_vdl.futex); } return retval; } # else # define internal_function # endif EXPORT void
//============================================================================= // scrolls a specific number of lines of a LCD buffer (240x128) 1 line // downwards (160 pixels get moved) ... // // NOTE: given buffer has to start on an even address, otherwise function will // crash !!! //============================================================================= void __attribute__((__regparm__(2))) ScrollDown160_R(unsigned short* buffer asm("%a0"),unsigned short lines asm("%d0")) { short* dest = buffer; short* src; short tmplines = lines; dest += (tmplines<<4) - (tmplines) - 5; src = dest - 15; tmplines -= 2; asm volatile ("0:\n" "move.l -(%0),-(%1);move.l -(%0),-(%1);move.l -(%0),-(%1)\n" "move.l -(%0),-(%1);move.l -(%0),-(%1)\n" "lea -10(%0),%0\n" "lea -10(%1),%1\n" "dbf %2,0b\n" "clr.l -(%1);clr.l -(%1);clr.l -(%1);clr.l -(%1);clr.l -(%1)" : "=a" (src), "=a" (dest), "=d" (tmplines) : "0" (src), "1" (dest), "2" (tmplines)); }
void __free_tls_arch(tcb_t *tcb, size_t size) { tls_free_variant_2(tcb, size); } /* * Rtld TLS support */ typedef struct { unsigned long int ti_module; unsigned long int ti_offset; } tls_index; void __attribute__ ((__regparm__ (1))) *___tls_get_addr(tls_index *ti); void __attribute__ ((__regparm__ (1))) *___tls_get_addr(tls_index *ti) { size_t tls_size; uint8_t *tls; /* Calculate size of TLS block */ tls_size = ALIGN_UP(&_tbss_end - &_tdata_start, &_tls_alignment); /* The TLS block is just before TCB */ tls = (uint8_t *)__tcb_get() - tls_size; return tls + ti->ti_offset;
/* APPLE LOCAL file 4525731 */ /* { dg-do compile { target i?86-*-* } } */ /* { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } } */ /* { dg-options "-O3" } */ #include <stdlib.h> static void __attribute__ ((__force_align_arg_pointer__, __noinline__, __regparm__(3))) callee (int i1, int i2, int i3, int i4, int i5, int i6, int i7) { /* { dg-error "force_align_arg_pointer functions limited to 2 register parameters" } */ if (i1 != 1) abort (); if (i2 != 2) abort (); if (i3 != 3) abort (); if (i4 != 4) abort (); if (i5 != 5) abort (); if (i6 != 6) abort (); if (i7 != 7) abort (); } main() { callee (1, 2, 3, 4, 5, 6, 7); return 0; }
int dladdr(const void *addr, struct dl_info *info) { printf("Wrong dl symbols!\n"); return -1; } /* Thread Local Storage argument structure */ typedef struct { unsigned long int ti_module; unsigned long int ti_offset; } tls_index; void *__tls_get_addr(tls_index *) __attribute__((weak)); #ifdef __i386 void *___tls_get_addr(tls_index *) __attribute__((weak, __regparm__(1))); #endif #if defined(__amd64) || defined(__i386) || defined(__sparc64) void * __tls_get_addr(tls_index *ti) { return NULL; } #ifdef __i386 __attribute__((__regparm__(1))) void * ___tls_get_addr(tls_index *ti) { return NULL; }