|
Finding a struct member in Assembly?
I am trying to call a function in Assembly, but I don't know how to access a struct member of the return value. The function I am trying to call is getgrgid(), which has definition: struct group *getgrgid(gid_t gid); After I call the function and set the return value to a local register, I want to access and return a struct member of the return value.
Here are the instructions:
displayGroupName.s
This routine will call getgrgid() to get a pointer to the struct group for this gid so we can get the group's name as a string (gr_name member). If the group entry cannot be found, just print the numeric value of the gid. In either case, the group's name or gid will be printed with a field width of 8 left justified. Use the left-adjustment flag '-' in the printf format specifier.
How the hell do I do this?
Thanks.
|