Arch-abstraction:

- Moved VG_MAX_REALREGS into x86/ part.
- Tweaked basic types so they're suitable for both 32-bit and 64-bit platforms.
  Main change was to change 'Addr' to "unsigned long" which is the same size as
  a pointer.  Had to make a couple of minor changes to accommodate this.
  Also, introduced 'UWord' and 'Word' types which will be necessary for making
  code 64-bit clean.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2669
This commit is contained in:
Nicholas Nethercote 2004-09-07 10:17:02 +00:00
parent 28864b7564
commit 4ecc334c35
6 changed files with 48 additions and 38 deletions

View File

@ -1472,7 +1472,7 @@ __attribute__ ((noreturn))
extern void VG_(missing_tool_func) ( const Char* fn );
/* ---------------------------------------------------------------------
The state of the simulated CPU.
The baseBlock -- arch-neutral bits
------------------------------------------------------------------ */
#define INVALID_OFFSET (-1)

View File

@ -1026,9 +1026,10 @@ static Addr setup_client_stack(char **orig_argv, char **orig_envp,
if (0)
printf("stringsize=%d auxsize=%d stacksize=%d\n"
"clstk_base %x\n"
"clstk_end %x\n",
stringsize, auxsize, stacksize, VG_(clstk_base), VG_(clstk_end));
"clstk_base %p\n"
"clstk_end %p\n",
stringsize, auxsize, stacksize,
(void*)VG_(clstk_base), (void*)VG_(clstk_end));
/* ==================== allocate space ==================== */
@ -2645,8 +2646,9 @@ int main(int argc, char **argv)
esp_at_startup = setup_client_stack(cl_argv, env, &info, &client_auxv);
if (0)
printf("entry=%x client esp=%x vg_argc=%d brkbase=%x\n",
client_eip, esp_at_startup, vg_argc, VG_(brk_base));
printf("entry=%p client esp=%p vg_argc=%d brkbase=%p\n",
(void*)client_eip, (void*)esp_at_startup, vg_argc,
(void*)VG_(brk_base));
//==============================================================
// Finished setting up operating environment. Now initialise

View File

@ -63,7 +63,7 @@ static Int readchar ( Char* buf, Char* ch )
return 1;
}
static Int readhex ( Char* buf, UInt* val )
static Int readhex ( Char* buf, UWord* val )
{
Int n = 0;
*val = 0;
@ -148,9 +148,9 @@ void VG_(parse_procselfmaps) (
Int i, j, i_eol;
Addr start, endPlusOne;
UChar* filename;
UInt foffset;
UChar rr, ww, xx, pp, ch, tmp;
UInt maj, min, ino;
UInt ino;
UWord foffset, maj, min;
sk_assert( '\0' != procmap_buf[0] && 0 != buf_n_tot);

View File

@ -1711,7 +1711,7 @@ static void bus_unlock(void);
static
void eraser_pre_mem_read(CorePart part, ThreadId tid,
Char* s, UInt base, UInt size )
Char* s, Addr base, UInt size )
{
if (tid > 50) { VG_(printf)("pid = %d, s = `%s`, part = %d\n", tid, s, part); VG_(skin_panic)("a");}
eraser_mem_read(base, size, tid);
@ -1719,14 +1719,14 @@ void eraser_pre_mem_read(CorePart part, ThreadId tid,
static
void eraser_pre_mem_read_asciiz(CorePart part, ThreadId tid,
Char* s, UInt base )
Char* s, Addr base )
{
eraser_mem_read(base, VG_(strlen)((Char*)base), tid);
}
static
void eraser_pre_mem_write(CorePart part, ThreadId tid,
Char* s, UInt base, UInt size )
Char* s, Addr base, UInt size )
{
eraser_mem_write(base, size, tid);
}

View File

@ -40,19 +40,26 @@
/*=== Basic types ===*/
/*====================================================================*/
typedef unsigned char UChar;
typedef unsigned short UShort;
typedef unsigned int UInt;
typedef unsigned long long int ULong;
// By choosing the right types, we can get these right for 32-bit and 64-bit
// platforms without having to do any conditional compilation or anything.
//
// Size in bits on: 32-bit archs 64-bit archs
// ------------ ------------
typedef unsigned char UChar; // 8 8
typedef unsigned short UShort; // 16 16
typedef unsigned int UInt; // 32 32
typedef unsigned long UWord; // 32 64
typedef unsigned long long ULong; // 64 64
typedef signed char Char;
typedef signed short Short;
typedef signed int Int;
typedef signed long long int Long;
typedef signed char Char; // 8 8
typedef signed short Short; // 16 16
typedef signed int Int; // 32 32
typedef signed long Word; // 32 64
typedef signed long long Long; // 64 64
typedef unsigned int Addr;
typedef UWord Addr; // 32 64
typedef unsigned char Bool;
typedef UChar Bool; // 8 8
#define False ((Bool)0)
#define True ((Bool)1)
@ -89,22 +96,6 @@ typedef unsigned char Bool;
the need for a higher number presents itself. */
#define VG_N_THREAD_KEYS 50
/* Total number of integer registers available for allocation -- all of
them except %esp, %ebp. %ebp permanently points at VG_(baseBlock).
If you increase this you'll have to also change at least these:
- VG_(rank_to_realreg)()
- VG_(realreg_to_rank)()
- ppRegsLiveness()
- the RegsLive type (maybe -- RegsLive type must have more than
VG_MAX_REALREGS bits)
You can decrease it, and performance will drop because more spills will
occur. If you decrease it too much, everything will fall over.
Do not change this unless you really know what you are doing! */
#define VG_MAX_REALREGS 6
/*====================================================================*/
/*=== Useful macros ===*/

View File

@ -48,6 +48,23 @@
#define MIN_INSTR_SIZE 1
#define MAX_INSTR_SIZE 16
/* Total number of integer registers available for allocation -- all of
them except %esp (points to Valgrind's stack) and %ebp (permanently
points at the baseBlock).
If you increase this you'll have to also change at least these:
- VG_(rank_to_realreg)()
- VG_(realreg_to_rank)()
- ppRegsLiveness()
- the RegsLive type (maybe -- RegsLive type must have more than
VG_MAX_REALREGS bits)
You can decrease it, and performance will drop because more spills will
occur. If you decrease it too much, everything will fall over.
Do not change this unless you really know what you are doing! */
#define VG_MAX_REALREGS 6
/*====================================================================*/
/*=== Instrumenting UCode ===*/