Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Created July 4, 2012 15:22
Show Gist options
  • Save fjolnir/3047873 to your computer and use it in GitHub Desktop.
Save fjolnir/3047873 to your computer and use it in GitHub Desktop.
struct _va_list {
unsigned int gp_offset, fp_offset;
void *overflow_arg_area, *reg_save_area;
};
int foo(int bar, ...) {
va_list lst;
va_start(lst, bar);
struct _va_list *list = &lst;
int *first = list->reg_save_area+list->gp_offset;
printf("%d\n", sizeof(int));
printf("gpofs: %d fpofs: %d\n", list->gp_offset, list->fp_offset);
printf("arg: %d\n", *first);
va_end(lst);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment