mk_user_constants.c 769 B

1234567891011121314151617181920212223242526272829
  1. #include <stdio.h>
  2. #include <asm/types.h>
  3. /* For some reason, x86_64 nowhere defines u64 and u32, even though they're
  4. * used throughout the headers.
  5. */
  6. typedef __u64 u64;
  7. typedef __u32 u32;
  8. #include <asm/user.h>
  9. int main(int argc, char **argv)
  10. {
  11. printf("/*\n");
  12. printf(" * Generated by mk_user_constants\n");
  13. printf(" */\n");
  14. printf("\n");
  15. printf("#ifndef __UM_USER_CONSTANTS_H\n");
  16. printf("#define __UM_USER_CONSTANTS_H\n");
  17. printf("\n");
  18. /* I'd like to use FRAME_SIZE from ptrace.h here, but that's wrong on
  19. * x86_64 (216 vs 168 bytes). user_regs_struct is the correct size on
  20. * both x86_64 and i386.
  21. */
  22. printf("#define UM_FRAME_SIZE %d\n", (int) sizeof(struct user_regs_struct));
  23. printf("\n");
  24. printf("#endif\n");
  25. return(0);
  26. }