replace PAGE_SIZE macro with this function.

2006-10-24  Soren Sandmann <sandmann@daimi.au.dk>

	* process.c (page_size): replace PAGE_SIZE macro with this function.

	* binfile.c: Remove obsolete comment.
This commit is contained in:
Soren Sandmann
2006-10-25 02:02:44 +00:00
committed by Søren Sandmann Pedersen
parent c02712dc85
commit a715b55029
3 changed files with 22 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2006-10-24 Soren Sandmann <sandmann@daimi.au.dk>
* process.c (page_size): replace PAGE_SIZE macro with this function.
* binfile.c: Remove obsolete comment.
2006-10-24 Soren Sandmann <sandmann@daimi.au.dk>
* process.c (struct Process): Use an array instead of list of

View File

@ -90,7 +90,6 @@ separate_debug_file_exists (const char *name, guint32 crc)
return parser;
}
/* FIXME - not10: this should probably be detected by config.h -- find out what gdb does*/
static const char *const debug_file_directory = DEBUGDIR;
static ElfParser *

View File

@ -30,8 +30,6 @@
#include "process.h"
#include "binfile.h"
#define PAGE_SIZE (getpagesize())
static GHashTable *processes_by_cmdline;
static GHashTable *processes_by_pid;
@ -281,12 +279,27 @@ process_has_page (Process *process, gulong addr)
return FALSE;
}
static int
page_size (void)
{
static int page_size;
static gboolean has_page_size;
if (!has_page_size)
{
page_size = getpagesize();
has_page_size = TRUE;
}
return page_size;
}
void
process_ensure_map (Process *process, int pid, gulong addr)
{
/* Round down to closest page */
addr = (addr - addr % PAGE_SIZE);
addr = (addr - addr % page_size());
if (process_has_page (process, addr))
return;