Date: Sun, 21 Mar 2004 20:00:15 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 49502 for review Message-ID: <200403220400.i2M40F2c000158@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=49502 Change 49502 by marcel@marcel_nfs on 2004/03/21 20:00:14 s/db_active/kdb_active/g s/DDB/KDB/g Affected files ... .. //depot/projects/gdb/sys/ia64/ia64/unwind.c#2 edit Differences ... ==== //depot/projects/gdb/sys/ia64/ia64/unwind.c#2 (text+ko) ==== @@ -27,9 +27,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/ia64/ia64/unwind.c,v 1.10 2003/10/09 03:11:37 marcel Exp $"); -#include "opt_ddb.h" - #include <sys/param.h> +#include <sys/kdb.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/malloc.h> @@ -60,8 +59,8 @@ static struct unw_table_list unw_tables; -#ifdef DDB -#define DDBHEAPSZ 8192 +#ifdef KDB +#define KDBHEAPSZ 8192 struct mhdr { uint32_t sig; @@ -72,35 +71,33 @@ int32_t prev; }; -extern int db_active; +static struct mhdr *kdbheap; +#endif /* KDB */ -static struct mhdr *ddbheap; -#endif /* DDB */ - static void * unw_alloc(size_t sz) { -#ifdef DDB +#ifdef KDB struct mhdr *hdr, *hfree; - if (db_active) { + if (kdb_active) { sz = (sz + 15) >> 4; - hdr = ddbheap; + hdr = kdbheap; while (hdr->sig != MSIG_FREE || hdr->size < sz) { if (hdr->next == -1) return (NULL); - hdr = ddbheap + hdr->next; + hdr = kdbheap + hdr->next; } if (hdr->size > sz + 1) { hfree = hdr + sz + 1; hfree->sig = MSIG_FREE; hfree->size = hdr->size - sz - 1; - hfree->prev = hdr - ddbheap; + hfree->prev = hdr - kdbheap; hfree->next = hdr->next; hdr->size = sz; - hdr->next = hfree - ddbheap; + hdr->next = hfree - kdbheap; if (hfree->next >= 0) { - hfree = ddbheap + hfree->next; + hfree = kdbheap + hfree->next; hfree->prev = hdr->next; } } @@ -114,30 +111,30 @@ static void unw_free(void *p) { -#ifdef DDB +#ifdef KDB struct mhdr *hdr, *hfree; - if (db_active) { + if (kdb_active) { hdr = (struct mhdr*)p - 1; if (hdr->sig != MSIG_USED) return; hdr->sig = MSIG_FREE; - if (hdr->prev >= 0 && ddbheap[hdr->prev].sig == MSIG_FREE) { - hfree = ddbheap + hdr->prev; + if (hdr->prev >= 0 && kdbheap[hdr->prev].sig == MSIG_FREE) { + hfree = kdbheap + hdr->prev; hfree->size += hdr->size + 1; hfree->next = hdr->next; if (hdr->next >= 0) { - hfree = ddbheap + hdr->next; + hfree = kdbheap + hdr->next; hfree->prev = hdr->prev; } } else if (hdr->next >= 0 && - ddbheap[hdr->next].sig == MSIG_FREE) { - hfree = ddbheap + hdr->next; + kdbheap[hdr->next].sig == MSIG_FREE) { + hfree = kdbheap + hdr->next; hdr->size += hfree->size + 1; hdr->next = hfree->next; if (hdr->next >= 0) { - hfree = ddbheap + hdr->next; - hfree->prev = hdr - ddbheap; + hfree = kdbheap + hdr->next; + hfree->prev = hdr - kdbheap; } } return; @@ -372,12 +369,12 @@ LIST_INIT(&unw_tables); uwx_register_alloc_cb(unw_alloc, unw_free); -#ifdef DDB - ddbheap = malloc(DDBHEAPSZ, M_UNWIND, M_WAITOK); - ddbheap->sig = MSIG_FREE; - ddbheap->size = (DDBHEAPSZ - sizeof(struct mhdr)) >> 4; - ddbheap->next = -1; - ddbheap->prev = -1; +#ifdef KDB + kdbheap = malloc(KDBHEAPSZ, M_UNWIND, M_WAITOK); + kdbheap->sig = MSIG_FREE; + kdbheap->size = (KDBHEAPSZ - sizeof(struct mhdr)) >> 4; + kdbheap->next = -1; + kdbheap->prev = -1; #endif } SYSINIT(unwind, SI_SUB_KMEM, SI_ORDER_ANY, unw_initialize, 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403220400.i2M40F2c000158>