1148666Sjeff/*- 2148666Sjeff * Copyright (c) 2005 Antoine Brodin 3148666Sjeff * All rights reserved. 4148666Sjeff * 5148666Sjeff * Redistribution and use in source and binary forms, with or without 6148666Sjeff * modification, are permitted provided that the following conditions 7148666Sjeff * are met: 8148666Sjeff * 1. Redistributions of source code must retain the above copyright 9148666Sjeff * notice, this list of conditions and the following disclaimer. 10148666Sjeff * 2. Redistributions in binary form must reproduce the above copyright 11148666Sjeff * notice, this list of conditions and the following disclaimer in the 12148666Sjeff * documentation and/or other materials provided with the distribution. 13148666Sjeff * 14148666Sjeff * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15148666Sjeff * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16148666Sjeff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17148666Sjeff * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18148666Sjeff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19148666Sjeff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20148666Sjeff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21148666Sjeff * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22148666Sjeff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23148666Sjeff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24148666Sjeff * SUCH DAMAGE. 25148666Sjeff * 26148666Sjeff * $FreeBSD$ 27148666Sjeff */ 28148666Sjeff 29148666Sjeff#ifndef _SYS_STACK_H_ 30148666Sjeff#define _SYS_STACK_H_ 31148666Sjeff 32177957Sattilio#include <sys/_stack.h> 33148666Sjeff 34148666Sjeffstruct sbuf; 35148666Sjeff 36148666Sjeff/* MI Routines. */ 37148666Sjeffstruct stack *stack_create(void); 38148666Sjeffvoid stack_destroy(struct stack *); 39148666Sjeffint stack_put(struct stack *, vm_offset_t); 40227581Spjdvoid stack_copy(const struct stack *, struct stack *); 41148666Sjeffvoid stack_zero(struct stack *); 42227581Spjdvoid stack_print(const struct stack *); 43227581Spjdvoid stack_print_ddb(const struct stack *); 44227581Spjdvoid stack_print_short(const struct stack *); 45227581Spjdvoid stack_print_short_ddb(const struct stack *); 46227581Spjdvoid stack_sbuf_print(struct sbuf *, const struct stack *); 47227581Spjdvoid stack_sbuf_print_ddb(struct sbuf *, const struct stack *); 48148666Sjeff#ifdef KTR 49227581Spjdvoid stack_ktr(u_int, const char *, int, const struct stack *, 50227581Spjd u_int, int); 51149574Spjd#define CTRSTACK(m, st, depth, cheap) do { \ 52148666Sjeff if (KTR_COMPILE & (m)) \ 53149574Spjd stack_ktr((m), __FILE__, __LINE__, st, depth, cheap); \ 54148666Sjeff } while(0) 55148666Sjeff#else 56149574Spjd#define CTRSTACK(m, st, depth, cheap) 57148666Sjeff#endif 58148666Sjeff 59148666Sjeff/* MD Routine. */ 60174195Srwatsonstruct thread; 61148666Sjeffvoid stack_save(struct stack *); 62174195Srwatsonvoid stack_save_td(struct stack *, struct thread *); 63148666Sjeff 64148666Sjeff#endif 65