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 250 - (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 :     fprintf(f, "#define %sOffVSP %d\n", (sym), VOFFSET(fld))
19 :     #define PMOFFSET(sym, fld) \
20 :     fprintf(f, "#define %sOffMSP %d\n", (sym), MOFFSET(fld))
21 :    
22 :    
23 :     main ()
24 :     {
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 :     int i;
34 :     FILE *f;
35 :    
36 :     f = OpenFile ("mlstate-offsets.h", "_MLSTATE_OFFSETS_");
37 :    
38 :     #if TARGET_BYTECODE
39 :     fprintf (f, "/* TARGET_BYTECODE */\n");
40 :     #else
41 :     PMOFFSET("VProc", ml_vproc);
42 :     PMOFFSET("AllocPtr", ml_allocPtr);
43 :     PMOFFSET("LimitPtr", ml_limitPtr);
44 :     PMOFFSET("StorePtr", ml_storePtr);
45 :     PMOFFSET("StdArg", ml_arg);
46 :     PMOFFSET("StdCont", ml_cont);
47 :     PMOFFSET("StdClos", ml_closure);
48 :     PMOFFSET("LinkReg", ml_linkReg);
49 :     PMOFFSET("PC", ml_pc);
50 :     PMOFFSET("ExnPtr", ml_exnCont);
51 :     PMOFFSET("VarPtr", ml_varReg);
52 :     PMOFFSET("Misc0", ml_calleeSave[0]);
53 :     PMOFFSET("Misc1", ml_calleeSave[1]);
54 :     PMOFFSET("Misc2", ml_calleeSave[2]);
55 :     #ifdef SOFT_POLL
56 :     PMOFFSET("RealLimit", ml_realLimit);
57 :     PMOFFSET("PollPending", ml_pollPending);
58 :     PMOFFSET("InPollHandler", ml_inPollHandler);
59 :     #endif
60 :     PVOFFSET("InML", vp_inMLFlag);
61 :     PVOFFSET("HandlerPending", vp_handlerPending);
62 :     PVOFFSET("InSigHandler", vp_inSigHandler);
63 :     PVOFFSET("NPendingSys", vp_numPendingSysSigs);
64 :     PVOFFSET("NPending", vp_numPendingSigs);
65 :     #endif /* !BYTECODE */
66 :    
67 :     CloseFile (f, "_MLSTATE_OFFSETS_");
68 :    
69 :     exit (0);
70 :     }

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