solo_interface.h
3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
* Copyright (C) 1996-1998 by the Board of Trustees
* of Leland Stanford Junior University.
*
* This file is part of the SimOS distribution.
* See LICENSE file for terms of the license.
*
*/
/*****************************************************************
* solo_interface.h
*
* This is the interface between an application and solo mipsy.
*****************************************************************/
#ifndef _SOLO_INTERFACE_H_
#define _SOLO_INTERFACE_H_
/*
* All backdoor calls will go through this structure
*/
typedef void (*Func)(void) ;
typedef struct CommArea {
void (*SetupCommArea)(void);
void (*Create)( void (*func)() );
void (*Exit)(void);
int (*GetCPUNum)(void);
int (*ActiveProcs)(void);
void (*ResetStats)(void);
int (*Flush)(void *);
void (*Sync)(void);
void (*TurnOnCaches)(void);
void (*TurnOffCaches)(void);
unsigned long long (*CurrentTime)(void);
void (*IOMap)(unsigned, long long);
void (*IOMapGeneral)(unsigned, int details, long long);
void (*PlaceRange)(unsigned start, unsigned stop, int node);
void (*WaitForEnd)(int);
/* Fake synchronization calls */
void *(*LockInit)(void);
int (*Lock)(void *);
void (*Unlock)(void *);
void (*BarEnter)(void);
void (*BarExit)(void);
#ifdef FLASHPOINT
void (*FP_Malloc)(int, unsigned, void *, char *);
unsigned long long (*FP_Virtual_To_Physical)(unsigned long long);
unsigned (*FP_GetNumCpus)(void);
#endif
void *libcStart;
} CommArea;
#define IN_MIPSY 51071; /* Code returned by a syscall to
say that I'm in Mipsy. */
#define COMM_LENGTH 0x00004000
/* This start point (also defined in the SOLO Makefile work fine, but don't
allow enough space for big runs
#define COMM_START 0x50000000
*/
/* These start points leave an additional 256MB of space for address-hungry
flashlite runs of 64 procs and up.. */
#define COMM_START 0x40000000
#define MIPSY_COMM_ADDR COMM_START
#define SOLO_STACK_SIZE (1024 * 1024)
#ifndef T5_MODEL
#define SOLO_STACK_TOP COMM_START
#else
#define SOLO_STACK_TOP 0x1600000
/* I load the stack down low for T5-model runs,
since I need to pack everything close
together since I hand-code the TLB entries */
#endif
#define CommAreaPtr ((CommArea *) MIPSY_COMM_ADDR)
#ifndef SOLO_CACHE_LINE_SIZE
#define SOLO_CACHE_LINE_SIZE 256 /* Maximum cache line size supported */
#endif
#define IO_MAP_UNCACHED 0x80000000
#define IO_MAP_ACCELERATED 0x40000000
/* Any routines that are linked within the application (inside the
macros) need to be defined here so that the app will link */
extern void *LibcStart(void);
extern unsigned long long _LoadDouble(unsigned long long *);
extern void _StoreDouble(unsigned long long *, unsigned long long);
extern void _Sync(void);
extern void _Prefetch(void *);
extern void _PrefetchX(void *);
extern void _SoloLockEnter(unsigned int *);
extern void _SoloUnlock(unsigned int *);
extern void _SoloBarrier(void *, int);
extern void _SoloExit(void);
extern int _CheckPlatform(void);
extern void SoloIOMapGeneral(unsigned va, int details, long long pa);
extern int _FetchAndStore(void *addr, int value);
extern int _CompareAndSwap(void *, int oldval, int newval);
typedef struct MCSnode {
struct MCSnode *next;
volatile int locked;
} MCSnode;
typedef MCSnode *MCSlock;
#endif