From 92c6bf4d3a42e30e90fb6a54f1b965f99e674eec Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 16 Feb 1995 21:09:22 +0000 Subject: [PATCH] Rewrite Linux insque/remque support again. --- gdb/ChangeLog | 4 ++++ gdb/dcache.c | 38 +++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fd277f2..9928db6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +Thu Feb 16 16:06:50 1995 Michael Meissner + + * dcache.c (insque, remque): Rewrite Linux support. + Wed Feb 15 12:33:20 1995 Michael Meissner * config/powerpc/tm-ppc-eabi.h (TEXT_SEGMENT_BASE): Define as 1. diff --git a/gdb/dcache.c b/gdb/dcache.c index d92cd1b..30d9547 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -23,20 +23,20 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "dcache.h" #include "gdbcmd.h" -#if defined(__STDC__) && defined(__linux__) +int remote_dcache = 0; + +#if defined(__linux__) /* In case the system header files define a prototype for insque and remque that uses a pointer to a struct qelem, silence the warnings */ struct qelem; -#define insque(a,b) (insque)((struct qelem *)(a), (struct qelem *)(b)) -#define remque(a) (remque)((struct qelem *)(a)) -#else +#define Insque(a,b) insque((struct qelem *)(a), (struct qelem *)(b)) +#define Remque(a) remque((struct qelem *)(a)) -extern int insque(); -extern int remque(); +#else +#define Insque(a,b) insque(a, b) +#define Remque(a) remque(a) #endif -int remote_dcache = 0; - /* The data cache records all the data read from the remote machine since the last time it stopped. @@ -56,8 +56,8 @@ dcache_flush (dcache) if (remote_dcache > 0) while ((db = dcache->dcache_valid.next) != &dcache->dcache_valid) { - remque (db); - insque (db, &dcache->dcache_free); + Remque (db); + Insque (db, &dcache->dcache_free); } return; @@ -126,12 +126,12 @@ dcache_alloc (dcache) /* If we can't get one from the free list, take last valid and put it on the free list. */ db = dcache->dcache_valid.last; - remque (db); - insque (db, &dcache->dcache_free); + Remque (db); + Insque (db, &dcache->dcache_free); } - remque (db); - insque (db, &dcache->dcache_valid); + Remque (db); + Insque (db, &dcache->dcache_valid); return (db); } @@ -160,8 +160,8 @@ dcache_fetch (dcache, addr) (*dcache->read_memory) (addr & ~LINE_SIZE_MASK, (unsigned char *) db->data, LINE_SIZE); immediate_quit--; db->addr = addr & ~LINE_SIZE_MASK; - remque (db); /* Off the free list */ - insque (db, &dcache->dcache_valid); /* On the valid list */ + Remque (db); /* Off the free list */ + Insque (db, &dcache->dcache_valid); /* On the valid list */ } return (dcache_value (db, addr)); } @@ -190,8 +190,8 @@ dcache_poke (dcache, addr, data) (*dcache->write_memory) (addr & ~LINE_SIZE_MASK, (unsigned char *) db->data, LINE_SIZE); immediate_quit--; db->addr = addr & ~LINE_SIZE_MASK; - remque (db); /* Off the free list */ - insque (db, &dcache->dcache_valid); /* On the valid list */ + Remque (db); /* Off the free list */ + Insque (db, &dcache->dcache_valid); /* On the valid list */ } /* Modify the word in the cache. */ @@ -222,7 +222,7 @@ dcache_init (reading, writing) dcache->dcache_free.next = dcache->dcache_free.last = &dcache->dcache_free; dcache->dcache_valid.next = dcache->dcache_valid.last = &dcache->dcache_valid; for (db = dcache->the_cache, i = 0; i < DCACHE_SIZE; i++, db++) - insque (db, &dcache->dcache_free); + Insque (db, &dcache->dcache_free); return(dcache); } -- 2.7.4