Skip to content

Commit

Permalink
libc_server: make 64-bit safe
Browse files Browse the repository at this point in the history
If we run on a 64-bit Linux kernel, we will have to replace 32-bit
pointers with 64-bit pointers. Make param_t always 64 bits, then the
payload doesn't need to care if that is the case or not.
  • Loading branch information
Ulrich Hecht committed Jan 8, 2024
1 parent a5a43e7 commit 453dee0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion libc_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct newlib_stat {
/* uid_t */ unsigned short st_uid;
/* gid_t */ unsigned short st_gid;
/* dev_t */ unsigned short st_rdev;
/* off_t */ long st_size;
/* off_t */ int32_t st_size;
};

struct newlib_timeval {
Expand Down
6 changes: 0 additions & 6 deletions libc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
#error INT_MAX/LONG_MAX not defined
#endif

// Find a data type that fits both pointers and integers.

#if INT_MAX == LONG_MAX
typedef uint32_t param_t;
#else
typedef uint64_t param_t;
#endif

enum libc_funcs {
LIBC_WRITE,
Expand Down

0 comments on commit 453dee0

Please sign in to comment.