2d4b596a8aa08bc2681c0d9477c400878c5137cb
[dragonfly.git] / lib / libcaps / asdefs.c
1 /*
2  * ASDEFS.C
3  *
4  * Generate assembly defs.
5  *
6  * $DragonFly: src/lib/libcaps/asdefs.c,v 1.2 2003/12/07 04:21:52 dillon Exp $
7  */
8
9 #include <sys/cdefs.h>                  /* for __dead2 needed by thread.h */
10 #include "libcaps/thread.h"
11 #include <sys/thread.h>
12 #include "libcaps/globaldata.h"
13 #include <stddef.h>                     /* for offsetof(type, field) */
14 #include <stdio.h>
15
16 #define OFFSET(name, offset)    printf("#define %s %d\n", #name, offset);
17
18 int
19 main(int ac, char **av)
20 {
21     OFFSET(TD_SP, offsetof(struct thread, td_sp));
22     OFFSET(TD_FLAGS, offsetof(struct thread, td_flags));
23     OFFSET(TD_MPCOUNT, offsetof(struct thread, td_mpcount));
24     OFFSET(TD_PRI, offsetof(struct thread, td_pri));
25
26     OFFSET(UPC_MAGIC, offsetof(struct upcall, upc_magic));
27     OFFSET(UPC_CRITOFF, offsetof(struct upcall, upc_critoff));
28     OFFSET(UPC_PENDING, offsetof(struct upcall, upc_pending));
29     OFFSET(UPC_UTHREAD, offsetof(struct upcall, upc_uthread));
30
31     OFFSET(TDF_RUNNING, TDF_RUNNING);
32     OFFSET(TDPRI_CRIT, TDPRI_CRIT);
33
34     OFFSET(gd_curthread, offsetof(struct globaldata, gd_upcall.upc_uthread));
35     OFFSET(gd_cpuid, offsetof(struct globaldata, gd_cpuid));
36
37     return(0);
38 }
39