Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #include <stdio.h> |
Al Viro | da998a2 | 2005-05-05 16:15:27 -0700 | [diff] [blame] | 2 | #include <kernel-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
| 4 | void 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 Viro | da998a2 | 2005-05-05 16:15:27 -0700 | [diff] [blame] | 10 | void print(char *name, char *type, int offset) |
| 11 | { |
| 12 | printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type, |
| 13 | offset); |
| 14 | } |
| 15 | |
| 16 | int main(int argc, char **argv) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | { |
| 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 Viro | da998a2 | 2005-05-05 16:15:27 -0700 | [diff] [blame] | 25 | print_ptr("TASK_REGS", "union uml_pt_regs", TASK_REGS); |
| 26 | print("TASK_PID", "int", TASK_PID); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | printf("\n"); |
| 28 | printf("#endif\n"); |
Al Viro | da998a2 | 2005-05-05 16:15:27 -0700 | [diff] [blame] | 29 | return(0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | } |