X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/1c79356b52d46aa6b508fb032f5ae709b1f2897b..de355530ae67247cbd0da700edb3a2a1dae884c2:/osfmk/ipc/ipc_table.h diff --git a/osfmk/ipc/ipc_table.h b/osfmk/ipc/ipc_table.h index 0fe414ca9..16a02b303 100644 --- a/osfmk/ipc/ipc_table.h +++ b/osfmk/ipc/ipc_table.h @@ -199,14 +199,15 @@ extern void ipc_table_free( vm_size_t size, vm_offset_t table); +#define it_entries_reallocable(its) \ + ((its)->its_size * sizeof(struct ipc_entry) >= PAGE_SIZE) + #define it_entries_alloc(its) \ ((ipc_entry_t) \ - ipc_table_alloc(round_page( \ - (its)->its_size * sizeof(struct ipc_entry)))) - -#define it_entries_reallocable(its) \ - ((its)->its_size * sizeof(struct ipc_entry) \ - >= PAGE_SIZE) + ipc_table_alloc(it_entries_reallocable(its) ? \ + round_page((its)->its_size * sizeof(struct ipc_entry)) : \ + (its)->its_size * sizeof(struct ipc_entry) \ + )) #define it_entries_realloc(its, table, nits) \ ((ipc_entry_t) \ @@ -217,8 +218,9 @@ extern void ipc_table_free( )) #define it_entries_free(its, table) \ - ipc_table_free( \ - round_page((its)->its_size * sizeof(struct ipc_entry)), \ + ipc_table_free(it_entries_reallocable(its) ? \ + round_page((its)->its_size * sizeof(struct ipc_entry)) : \ + (its)->its_size * sizeof(struct ipc_entry), \ (vm_offset_t)(table) \ )