Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/runtime/config/gen-offsets.c
ViewVC logotype

Annotation of /sml/trunk/src/runtime/config/gen-offsets.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download) (as text)

1 : monnier 249 /* gen-offsets.c
2 :     *
3 :     * COPYRIGHT (c) 1992 by AT&T Bell Laboratories.
4 :     *
5 :     * This C program generates a header file for the *.prim.asm files,
6 :     * which gives the offset values in the VProc and ML state vectors.
7 :     */
8 :    
9 :     #include "ml-base.h"
10 :     #include "vproc-state.h"
11 :     #include "ml-state.h"
12 :     #include "gen.h"
13 :    
14 :     #define MOFFSET(fld) (((Addr_t)&(M.s.fld)) - (Addr_t)&(M.b[0]))
15 :     #define VOFFSET(fld) (((Addr_t)&(V.s.fld)) - (Addr_t)&(V.b[0]))
16 :    
17 :     #define PVOFFSET(sym, fld) \
18 : blume 569 fprintf(f, "#define %sOffVSP %ld\n", (sym), (long int) VOFFSET(fld))
19 : monnier 249 #define PMOFFSET(sym, fld) \
20 : blume 569 fprintf(f, "#define %sOffMSP %ld\n", (sym), (long int) MOFFSET(fld))
21 : monnier 249
22 :    
23 : blume 569 int main (void)
24 : monnier 249 {
25 :     union {
26 :     vproc_state_t s;
27 :     char b[sizeof(vproc_state_t)];
28 :     } V;
29 :     union {
30 :     ml_state_t s;
31 :     char b[sizeof(ml_state_t)];
32 :     } M;
33 :     FILE *f;
34 :    
35 :     f = OpenFile ("mlstate-offsets.h", "_MLSTATE_OFFSETS_");
36 :    
37 :     #if TARGET_BYTECODE
38 :     fprintf (f, "/* TARGET_BYTECODE */\n");
39 :     #else
40 :     PMOFFSET("VProc", ml_vproc);
41 :     PMOFFSET("AllocPtr", ml_allocPtr);
42 :     PMOFFSET("LimitPtr", ml_limitPtr);
43 :     PMOFFSET("StorePtr", ml_storePtr);
44 :     PMOFFSET("StdArg", ml_arg);
45 :     PMOFFSET("StdCont", ml_cont);
46 :     PMOFFSET("StdClos", ml_closure);
47 :     PMOFFSET("LinkReg", ml_linkReg);
48 :     PMOFFSET("PC", ml_pc);
49 :     PMOFFSET("ExnPtr", ml_exnCont);
50 :     PMOFFSET("VarPtr", ml_varReg);
51 :     PMOFFSET("Misc0", ml_calleeSave[0]);
52 :     PMOFFSET("Misc1", ml_calleeSave[1]);
53 :     PMOFFSET("Misc2", ml_calleeSave[2]);
54 :     #ifdef SOFT_POLL
55 :     PMOFFSET("RealLimit", ml_realLimit);
56 :     PMOFFSET("PollPending", ml_pollPending);
57 :     PMOFFSET("InPollHandler", ml_inPollHandler);
58 :     #endif
59 :     PVOFFSET("InML", vp_inMLFlag);
60 :     PVOFFSET("HandlerPending", vp_handlerPending);
61 :     PVOFFSET("InSigHandler", vp_inSigHandler);
62 :     PVOFFSET("NPendingSys", vp_numPendingSysSigs);
63 :     PVOFFSET("NPending", vp_numPendingSigs);
64 :     #endif /* !BYTECODE */
65 :    
66 :     CloseFile (f, "_MLSTATE_OFFSETS_");
67 :    
68 :     exit (0);
69 :     }

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0