Changed cookie type for get_next_area_info() to ssize_t.
The cookie is used to store the base address of the area that was just visited. On 64-bit systems, int32 is not sufficient. Therefore, changed to ssize_t which retains compatibility on x86 while expanding to a sufficient size on x86_64.
This commit is contained in:
parent
12b3e8a8a0
commit
6e2f6d1ace
@ -96,7 +96,7 @@ extern status_t set_area_protection(area_id id, uint32 newProtection);
|
||||
|
||||
/* system private, use macros instead */
|
||||
extern status_t _get_area_info(area_id id, area_info *areaInfo, size_t size);
|
||||
extern status_t _get_next_area_info(team_id team, int32 *cookie,
|
||||
extern status_t _get_next_area_info(team_id team, ssize_t *cookie,
|
||||
area_info *areaInfo, size_t size);
|
||||
|
||||
#define get_area_info(id, areaInfo) \
|
||||
|
@ -176,7 +176,7 @@ status_t _user_get_memory_properties(team_id teamID, const void *address,
|
||||
area_id _user_area_for(void *address);
|
||||
area_id _user_find_area(const char *name);
|
||||
status_t _user_get_area_info(area_id area, area_info *info);
|
||||
status_t _user_get_next_area_info(team_id team, int32 *cookie, area_info *info);
|
||||
status_t _user_get_next_area_info(team_id team, ssize_t *cookie, area_info *info);
|
||||
status_t _user_resize_area(area_id area, size_t newSize);
|
||||
area_id _user_transfer_area(area_id area, void **_address, uint32 addressSpec,
|
||||
team_id target);
|
||||
|
@ -411,7 +411,7 @@ extern status_t _kern_delete_area(area_id area);
|
||||
extern area_id _kern_area_for(void *address);
|
||||
extern area_id _kern_find_area(const char *name);
|
||||
extern status_t _kern_get_area_info(area_id area, area_info *info);
|
||||
extern status_t _kern_get_next_area_info(team_id team, int32 *cookie,
|
||||
extern status_t _kern_get_next_area_info(team_id team, ssize_t *cookie,
|
||||
area_info *info);
|
||||
extern status_t _kern_resize_area(area_id area, size_t newSize);
|
||||
extern area_id _kern_transfer_area(area_id area, void **_address,
|
||||
|
@ -246,7 +246,7 @@ void
|
||||
MemoryBarMenuItem::BarUpdate()
|
||||
{
|
||||
area_info areaInfo;
|
||||
int32 cookie = 0;
|
||||
ssize_t cookie = 0;
|
||||
int64 lram_size = 0;
|
||||
int64 lwram_size = 0;
|
||||
bool exists = false;
|
||||
|
@ -41,7 +41,7 @@ show_memory_totals(void)
|
||||
static void
|
||||
list_areas_for_id(team_id id)
|
||||
{
|
||||
int32 cookie = 0;
|
||||
ssize_t cookie = 0;
|
||||
team_info teamInfo;
|
||||
area_info areaInfo;
|
||||
|
||||
|
@ -86,7 +86,7 @@ RemoteMemoryAccessor::Init()
|
||||
|
||||
// get a list of the team's areas
|
||||
area_info areaInfo;
|
||||
int32 cookie = 0;
|
||||
ssize_t cookie = 0;
|
||||
status_t error;
|
||||
while ((error = get_next_area_info(fTeam, &cookie, &areaInfo)) == B_OK) {
|
||||
TRACE(("area %ld: address: %p, size: %ld, name: %s\n", areaInfo.area,
|
||||
|
@ -734,7 +734,7 @@ TeamDebugHandler::_LookupSymbolAddress(
|
||||
// lookup failed: find area containing the IP
|
||||
bool useAreaInfo = false;
|
||||
area_info info;
|
||||
int32 cookie = 0;
|
||||
ssize_t cookie = 0;
|
||||
while (get_next_area_info(fTeam, &cookie, &info) == B_OK) {
|
||||
if ((addr_t)info.address <= (addr_t)address
|
||||
&& (addr_t)info.address + info.size > (addr_t)address) {
|
||||
|
@ -1942,7 +1942,8 @@ fork_team(void)
|
||||
struct area_info info;
|
||||
thread_id threadID;
|
||||
status_t status;
|
||||
int32 cookie;
|
||||
ssize_t areaCookie;
|
||||
int32 imageCookie;
|
||||
|
||||
TRACE(("fork_team(): team %" B_PRId32 "\n", parentTeam->id));
|
||||
|
||||
@ -2030,8 +2031,8 @@ fork_team(void)
|
||||
// TODO: should be able to handle stack areas differently (ie. don't have
|
||||
// them copy-on-write)
|
||||
|
||||
cookie = 0;
|
||||
while (get_next_area_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
areaCookie = 0;
|
||||
while (get_next_area_info(B_CURRENT_TEAM, &areaCookie, &info) == B_OK) {
|
||||
if (info.area == parentTeam->user_data_area) {
|
||||
// don't clone the user area; just create a new one
|
||||
status = create_team_user_data(team);
|
||||
@ -2077,8 +2078,9 @@ fork_team(void)
|
||||
|
||||
// copy image list
|
||||
image_info imageInfo;
|
||||
cookie = 0;
|
||||
while (get_next_image_info(parentTeam->id, &cookie, &imageInfo) == B_OK) {
|
||||
imageCookie = 0;
|
||||
while (get_next_image_info(parentTeam->id, &imageCookie, &imageInfo)
|
||||
== B_OK) {
|
||||
image_id image = register_image(team, &imageInfo, sizeof(imageInfo));
|
||||
if (image < 0)
|
||||
goto err5;
|
||||
|
@ -5750,7 +5750,7 @@ _get_area_info(area_id id, area_info* info, size_t size)
|
||||
|
||||
|
||||
status_t
|
||||
_get_next_area_info(team_id team, int32* cookie, area_info* info, size_t size)
|
||||
_get_next_area_info(team_id team, ssize_t* cookie, area_info* info, size_t size)
|
||||
{
|
||||
addr_t nextBase = *(addr_t*)cookie;
|
||||
|
||||
@ -5779,8 +5779,7 @@ _get_next_area_info(team_id team, int32* cookie, area_info* info, size_t size)
|
||||
}
|
||||
|
||||
fill_area_info(area, info, size);
|
||||
*cookie = (int32)(area->Base());
|
||||
// TODO: Not 64 bit safe!
|
||||
*cookie = (ssize_t)(area->Base());
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -5987,13 +5986,13 @@ _user_get_area_info(area_id area, area_info* userInfo)
|
||||
|
||||
|
||||
status_t
|
||||
_user_get_next_area_info(team_id team, int32* userCookie, area_info* userInfo)
|
||||
_user_get_next_area_info(team_id team, ssize_t* userCookie, area_info* userInfo)
|
||||
{
|
||||
int32 cookie;
|
||||
ssize_t cookie;
|
||||
|
||||
if (!IS_USER_ADDRESS(userCookie)
|
||||
|| !IS_USER_ADDRESS(userInfo)
|
||||
|| user_memcpy(&cookie, userCookie, sizeof(int32)) < B_OK)
|
||||
|| user_memcpy(&cookie, userCookie, sizeof(ssize_t)) < B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
area_info info;
|
||||
@ -6004,7 +6003,7 @@ _user_get_next_area_info(team_id team, int32* userCookie, area_info* userInfo)
|
||||
|
||||
//info.protection &= B_USER_PROTECTION;
|
||||
|
||||
if (user_memcpy(userCookie, &cookie, sizeof(int32)) < B_OK
|
||||
if (user_memcpy(userCookie, &cookie, sizeof(ssize_t)) < B_OK
|
||||
|| user_memcpy(userInfo, &info, sizeof(area_info)) < B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
|
@ -70,7 +70,7 @@ _get_area_info(area_id id, area_info *areaInfo, size_t size)
|
||||
|
||||
|
||||
status_t
|
||||
_get_next_area_info(team_id team, int32 *cookie, area_info *areaInfo, size_t size)
|
||||
_get_next_area_info(team_id team, ssize_t *cookie, area_info *areaInfo, size_t size)
|
||||
{
|
||||
// size is not yet used, but may, if area_info changes
|
||||
(void)size;
|
||||
|
Loading…
Reference in New Issue
Block a user