blob: 36c9606505e2a69b753a49766e0090816f8b2bd9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <stdio.h>
Al Viroda998a22005-05-05 16:15:27 -07002#include <kernel-offsets.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
4void print_ptr(char *name, char *type, int offset)
5{
6 printf("#define %s(task) ((%s *) &(((char *) (task))[%d]))\n", name, type,
7 offset);
8}
9
Al Viroda998a22005-05-05 16:15:27 -070010void print(char *name, char *type, int offset)
11{
12 printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
13 offset);
14}
15
16int main(int argc, char **argv)
Linus Torvalds1da177e2005-04-16 15:20:36 -070017{
18 printf("/*\n");
19 printf(" * Generated by mk_task\n");
20 printf(" */\n");
21 printf("\n");
22 printf("#ifndef __TASK_H\n");
23 printf("#define __TASK_H\n");
24 printf("\n");
Al Viroda998a22005-05-05 16:15:27 -070025 print_ptr("TASK_REGS", "union uml_pt_regs", TASK_REGS);
26 print("TASK_PID", "int", TASK_PID);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 printf("\n");
28 printf("#endif\n");
Al Viroda998a22005-05-05 16:15:27 -070029 return(0);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030}