From fd537e535fe9f4d2b0286cf7a7242ef1e6775e67 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 29 Jan 2009 00:17:57 +0000 Subject: [BZ #9750] * nscd/mem.c (gc): Use alloca_count to get the real stack usage. * include/alloca.h (alloca_account): Define. * sysdeps/x86_64/stackinfo.h (stackinfo_get_sp): Define. (stackinfo_sub_sp): Define. --- sysdeps/x86_64/stackinfo.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sysdeps/x86_64') diff --git a/sysdeps/x86_64/stackinfo.h b/sysdeps/x86_64/stackinfo.h index 60668d10b1..b11849d9ab 100644 --- a/sysdeps/x86_64/stackinfo.h +++ b/sysdeps/x86_64/stackinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,4 +25,14 @@ /* On x86_64 the stack grows down. */ #define _STACK_GROWS_DOWN 1 +/* Access to the stack pointer. The macros are used in alloca_account + for which they need to act as barriers as well, hence the additional + (unnecessary) parameters. */ +#define stackinfo_get_sp() \ + ({ void *p__; asm volatile ("mov %%rsp, %0" : "=r" (p__)); p__; }) +#define stackinfo_sub_sp(ptr) \ + ({ ptrdiff_t d__; \ + asm volatile ("sub %%rsp, %0" : "=r" (d__) : "0" (ptr)); \ + d__; }) + #endif /* stackinfo.h */ -- cgit 1.4.1