[haiku-commits] BRANCH xyzzy-github.x86_64 - in src: servers/input kits/support system/kernel

  • From: xyzzy-github.x86_64 <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 5 Aug 2012 09:49:16 +0200 (CEST)

added 3 changesets to branch 'refs/remotes/xyzzy-github/x86_64'
old head: 25871c6895b536640b3d9f453e95219a54b84d20
new head: f4294645358d2eeec007d93493f092581e9bb504

----------------------------------------------------------------------------

57ab039: 64-bit fixes for input_server.

049d149: Handle 64-bit types correctly.

f429464: User symbol lookup works now on x86_64.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

9 files changed, 46 insertions(+), 48 deletions(-)
src/kits/support/ByteOrder.cpp          |   14 ++++++---
src/servers/input/AddOnManager.cpp      |    2 +-
src/servers/input/InputServer.cpp       |    4 +--
src/servers/input/InputServerMethod.cpp |   10 +++----
src/servers/input/MethodMenuItem.cpp    |    4 +--
src/servers/input/MethodMenuItem.h      |    8 ++---
src/servers/input/MethodReplicant.cpp   |   42 +++++++++++++--------------
src/servers/input/MethodReplicant.h     |    2 +-
src/system/kernel/elf.cpp               |    8 -----

############################################################################

Commit:      57ab0395ad31761e27ef6d5aa3af68cc3e4d71b2

Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug  4 15:10:00 2012 UTC

64-bit fixes for input_server.

----------------------------------------------------------------------------

diff --git a/src/servers/input/AddOnManager.cpp 
b/src/servers/input/AddOnManager.cpp
index 0d75e6a..d5b8b47f 100644
--- a/src/servers/input/AddOnManager.cpp
+++ b/src/servers/input/AddOnManager.cpp
@@ -440,7 +440,7 @@ AddOnManager::_UnregisterAddOn(BEntry& entry)
                        gInputServer->SetMethodReplicant(NULL);
                } else if (method != NULL) {
                        BMessage msg(IS_REMOVE_METHOD);
-                       msg.AddInt32("cookie", (uint32)method);
+                       msg.AddPointer("cookie", method);
                        if (gInputServer->MethodReplicant())
                                
gInputServer->MethodReplicant()->SendMessage(&msg);
                }
diff --git a/src/servers/input/InputServer.cpp 
b/src/servers/input/InputServer.cpp
index 685c548..3fcc5b0 100644
--- a/src/servers/input/InputServer.cpp
+++ b/src/servers/input/InputServer.cpp
@@ -625,8 +625,8 @@ void
 InputServer::HandleSetMethod(BMessage* message)
 {
        CALLED();
-       uint32 cookie;
-       if (message->FindInt32("cookie", (int32*)&cookie) == B_OK) {
+       void* cookie;
+       if (message->FindPointer("cookie", &cookie) == B_OK) {
                BInputServerMethod *method = (BInputServerMethod*)cookie;
                PRINT(("%s cookie %p\n", __PRETTY_FUNCTION__, method));
                SetActiveMethod(method);
diff --git a/src/servers/input/InputServerMethod.cpp 
b/src/servers/input/InputServerMethod.cpp
index 06adee4..34fc75f 100644
--- a/src/servers/input/InputServerMethod.cpp
+++ b/src/servers/input/InputServerMethod.cpp
@@ -183,7 +183,7 @@ _BMethodAddOn_::SetName(const char* name)
                fName = strdup(name);
 
        BMessage msg(IS_UPDATE_NAME);
-       msg.AddInt32("cookie", (uint32)fMethod);
+       msg.AddPointer("cookie", fMethod);
        msg.AddString("name", name);
        if (((InputServer*)be_app)->MethodReplicant())
                return 
((InputServer*)be_app)->MethodReplicant()->SendMessage(&msg);
@@ -203,7 +203,7 @@ _BMethodAddOn_::SetIcon(const uchar* icon)
                memset(fIcon, 0x1d, 16*16*1);
 
        BMessage msg(IS_UPDATE_ICON);
-       msg.AddInt32("cookie", (uint32)fMethod);
+       msg.AddPointer("cookie", fMethod);
        msg.AddData("icon", B_RAW_TYPE, icon, 16*16*1);
        if (((InputServer*)be_app)->MethodReplicant())
                return 
((InputServer*)be_app)->MethodReplicant()->SendMessage(&msg);
@@ -220,7 +220,7 @@ _BMethodAddOn_::SetMenu(const BMenu *menu, const BMessenger 
&messenger)
        fMessenger = messenger;
 
        BMessage msg(IS_UPDATE_MENU);
-       msg.AddInt32("cookie", (uint32)fMethod);
+       msg.AddPointer("cookie", fMethod);
        BMessage menuMsg;
        if (menu)
                menu->Archive(&menuMsg);
@@ -241,7 +241,7 @@ _BMethodAddOn_::MethodActivated(bool activate)
                PRINT(("%s cookie %p\n", __PRETTY_FUNCTION__, fMethod));
                if (activate && ((InputServer*)be_app)->MethodReplicant()) {
                        BMessage msg(IS_UPDATE_METHOD);
-                       msg.AddInt32("cookie", (uint32)fMethod);
+                       msg.AddPointer("cookie", fMethod);
                        
((InputServer*)be_app)->MethodReplicant()->SendMessage(&msg);
                }
                return fMethod->MethodActivated(activate);
@@ -255,7 +255,7 @@ _BMethodAddOn_::AddMethod()
 {
        PRINT(("%s cookie %p\n", __PRETTY_FUNCTION__, fMethod));
        BMessage msg(IS_ADD_METHOD);
-       msg.AddInt32("cookie", (uint32)fMethod);
+       msg.AddPointer("cookie", fMethod);
        msg.AddString("name", fName);
        msg.AddData("icon", B_RAW_TYPE, fIcon, 16*16*1);
        if (((InputServer*)be_app)->MethodReplicant())
diff --git a/src/servers/input/MethodMenuItem.cpp 
b/src/servers/input/MethodMenuItem.cpp
index daa66b0..f6c7b2f 100644
--- a/src/servers/input/MethodMenuItem.cpp
+++ b/src/servers/input/MethodMenuItem.cpp
@@ -17,7 +17,7 @@
 #include <string.h>
 #include "MethodMenuItem.h"
 
-MethodMenuItem::MethodMenuItem(int32 cookie, const char* name, const uchar* 
icon, BMenu *subMenu, BMessenger &messenger)
+MethodMenuItem::MethodMenuItem(void *cookie, const char* name, const uchar* 
icon, BMenu *subMenu, BMessenger &messenger)
        : BMenuItem(subMenu),
        fIcon(BRect(0, 0, MENUITEM_ICON_SIZE - 1, MENUITEM_ICON_SIZE - 1), 
B_CMAP8),
        fCookie(cookie)
@@ -28,7 +28,7 @@ MethodMenuItem::MethodMenuItem(int32 cookie, const char* 
name, const uchar* icon
 }
 
 
-MethodMenuItem::MethodMenuItem(int32 cookie, const char* name, const uchar* 
icon)
+MethodMenuItem::MethodMenuItem(void *cookie, const char* name, const uchar* 
icon)
        : BMenuItem(name, NULL),
        fIcon(BRect(0, 0, MENUITEM_ICON_SIZE - 1, MENUITEM_ICON_SIZE - 1), 
B_CMAP8),
        fCookie(cookie)
diff --git a/src/servers/input/MethodMenuItem.h 
b/src/servers/input/MethodMenuItem.h
index f2608db..25aa5c9 100644
--- a/src/servers/input/MethodMenuItem.h
+++ b/src/servers/input/MethodMenuItem.h
@@ -24,8 +24,8 @@
 
 class MethodMenuItem : public BMenuItem {
        public:
-               MethodMenuItem(int32 cookie, const char *label, const uchar 
*icon, BMenu *subMenu, BMessenger &messenger);
-               MethodMenuItem(int32 cookie, const char *label, const uchar 
*icon);
+               MethodMenuItem(void *cookie, const char *label, const uchar 
*icon, BMenu *subMenu, BMessenger &messenger);
+               MethodMenuItem(void *cookie, const char *label, const uchar 
*icon);
 
                virtual ~MethodMenuItem();
 
@@ -38,10 +38,10 @@ class MethodMenuItem : public BMenuItem {
                void SetIcon(const uchar *icon);
                const uchar *Icon() { return(uchar *)fIcon.Bits(); };
 
-               int32 Cookie() { return fCookie; };
+               void *Cookie() { return fCookie; };
        private:
                BBitmap fIcon;
-               int32 fCookie;
+               void *fCookie;
                BMessenger fMessenger;
 };
 
diff --git a/src/servers/input/MethodReplicant.cpp 
b/src/servers/input/MethodReplicant.cpp
index 2a6c9df..2c99a53 100644
--- a/src/servers/input/MethodReplicant.cpp
+++ b/src/servers/input/MethodReplicant.cpp
@@ -194,7 +194,7 @@ MethodReplicant::MouseDown(BPoint point)
 
        if (dynamic_cast<MethodMenuItem*>(item) != NULL) {
                BMessage msg(IS_SET_METHOD);
-               msg.AddInt32("cookie", ((MethodMenuItem*)item)->Cookie());
+               msg.AddPointer("cookie", ((MethodMenuItem*)item)->Cookie());
                BMessenger messenger(fSignature);
                messenger.SendMessage(&msg);
        }
@@ -212,15 +212,15 @@ void
 MethodReplicant::UpdateMethod(BMessage* message)
 {
        CALLED();
-       int32 cookie;
-       if (message->FindInt32("cookie", &cookie) != B_OK) {
+       void* cookie;
+       if (message->FindPointer("cookie", &cookie) != B_OK) {
                fprintf(stderr, "can't find cookie in message\n");
                return;
        }
 
        MethodMenuItem* item = FindItemByCookie(cookie);
        if (item == NULL) {
-               fprintf(stderr, "can't find item with cookie %lx\n", cookie);
+               fprintf(stderr, "can't find item with cookie %p\n", cookie);
                return;
        }
        item->SetMarked(true);
@@ -235,8 +235,8 @@ void
 MethodReplicant::UpdateMethodIcon(BMessage* message)
 {
        CALLED();
-       int32 cookie;
-       if (message->FindInt32("cookie", &cookie) != B_OK) {
+       void* cookie;
+       if (message->FindPointer("cookie", &cookie) != B_OK) {
                fprintf(stderr, "can't find cookie in message\n");
                return;
        }
@@ -251,7 +251,7 @@ MethodReplicant::UpdateMethodIcon(BMessage* message)
 
        MethodMenuItem* item = FindItemByCookie(cookie);
        if (item == NULL) {
-               fprintf(stderr, "can't find item with cookie 0x%lx\n", cookie);
+               fprintf(stderr, "can't find item with cookie %p\n", cookie);
                return;
        }
 
@@ -263,8 +263,8 @@ void
 MethodReplicant::UpdateMethodMenu(BMessage* message)
 {
        CALLED();
-       int32 cookie;
-       if (message->FindInt32("cookie", &cookie) != B_OK) {
+       void* cookie;
+       if (message->FindPointer("cookie", &cookie) != B_OK) {
                fprintf(stderr, "can't find cookie in message\n");
                return;
        }
@@ -290,7 +290,7 @@ MethodReplicant::UpdateMethodMenu(BMessage* message)
 
        MethodMenuItem* item = FindItemByCookie(cookie);
        if (item == NULL) {
-               fprintf(stderr, "can't find item with cookie 0x%lx\n", cookie);
+               fprintf(stderr, "can't find item with cookie %p\n", cookie);
                return;
        }
        int32 index = fMenu.IndexOf(item);
@@ -313,8 +313,8 @@ void
 MethodReplicant::UpdateMethodName(BMessage* message)
 {
        CALLED();
-       int32 cookie;
-       if (message->FindInt32("cookie", &cookie) != B_OK) {
+       void* cookie;
+       if (message->FindPointer("cookie", &cookie) != B_OK) {
                fprintf(stderr, "can't find cookie in message\n");
                return;
        }
@@ -327,7 +327,7 @@ MethodReplicant::UpdateMethodName(BMessage* message)
 
        MethodMenuItem* item = FindItemByCookie(cookie);
        if (item == NULL) {
-               fprintf(stderr, "can't find item with cookie 0x%lx\n", cookie);
+               fprintf(stderr, "can't find item with cookie %p\n", cookie);
                return;
        }
 
@@ -336,11 +336,11 @@ MethodReplicant::UpdateMethodName(BMessage* message)
 
 
 MethodMenuItem*
-MethodReplicant::FindItemByCookie(int32 cookie)
+MethodReplicant::FindItemByCookie(void* cookie)
 {
        for (int32 i = 0; i < fMenu.CountItems(); i++) {
                MethodMenuItem* item = (MethodMenuItem*)fMenu.ItemAt(i);
-               PRINT(("cookie : 0x%lx\n", item->Cookie()));
+               PRINT(("cookie : %p\n", item->Cookie()));
                if (item->Cookie() == cookie)
                        return item;
        }
@@ -353,8 +353,8 @@ void
 MethodReplicant::AddMethod(BMessage* message)
 {
        CALLED();
-       int32 cookie;
-       if (message->FindInt32("cookie", &cookie) != B_OK) {
+       void* cookie;
+       if (message->FindPointer("cookie", &cookie) != B_OK) {
                fprintf(stderr, "can't find cookie in message\n");
                return;
        }
@@ -375,7 +375,7 @@ MethodReplicant::AddMethod(BMessage* message)
 
        MethodMenuItem* item = FindItemByCookie(cookie);
        if (item != NULL) {
-               fprintf(stderr, "item with cookie %lx already exists\n", 
cookie);
+               fprintf(stderr, "item with cookie %p already exists\n", cookie);
                return;
        }
 
@@ -392,15 +392,15 @@ void
 MethodReplicant::RemoveMethod(BMessage* message)
 {
        CALLED();
-       int32 cookie;
-       if (message->FindInt32("cookie", &cookie) != B_OK) {
+       void* cookie;
+       if (message->FindPointer("cookie", &cookie) != B_OK) {
                fprintf(stderr, "can't find cookie in message\n");
                return;
        }
 
        MethodMenuItem* item = FindItemByCookie(cookie);
        if (item == NULL) {
-               fprintf(stderr, "can't find item with cookie %lx\n", cookie);
+               fprintf(stderr, "can't find item with cookie %p\n", cookie);
                return;
        }
        fMenu.RemoveItem(item);
diff --git a/src/servers/input/MethodReplicant.h 
b/src/servers/input/MethodReplicant.h
index b826fba..d40c704 100644
--- a/src/servers/input/MethodReplicant.h
+++ b/src/servers/input/MethodReplicant.h
@@ -57,7 +57,7 @@ class MethodReplicant : public BView {
                void UpdateMethodName(BMessage *);
                void AddMethod(BMessage *message);
                void RemoveMethod(BMessage *message);
-               MethodMenuItem *FindItemByCookie(int32 cookie);
+               MethodMenuItem *FindItemByCookie(void *cookie);
 };
 
 #endif

############################################################################

Commit:      049d149cf760ee2c95b5f10032d39a9ade92525b

Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sat Aug  4 17:58:26 2012 UTC

Handle 64-bit types correctly.

----------------------------------------------------------------------------

diff --git a/src/kits/support/ByteOrder.cpp b/src/kits/support/ByteOrder.cpp
index 6494487..c009a5f 100644
--- a/src/kits/support/ByteOrder.cpp
+++ b/src/kits/support/ByteOrder.cpp
@@ -49,14 +49,15 @@ swap_data(type_code type, void *_data, size_t length, 
swap_action action)
                case B_FLOAT_TYPE:
                case B_INT32_TYPE:
                case B_UINT32_TYPE:
-               case B_SIZE_T_TYPE:
-               case B_SSIZE_T_TYPE:
                case B_TIME_TYPE:
-               case B_POINTER_TYPE:
                case B_RECT_TYPE:
                case B_POINT_TYPE:
+#if B_HAIKU_32_BIT
+               case B_SIZE_T_TYPE:
+               case B_SSIZE_T_TYPE:
+               case B_POINTER_TYPE:
+#endif
                {
-                       // ToDo: some of these types may not be 32-bit on 
64-bit platforms!
                        uint32 *data = (uint32 *)_data;
                        uint32 *end = (uint32 *)((addr_t)_data + length);
 
@@ -72,6 +73,11 @@ swap_data(type_code type, void *_data, size_t length, 
swap_action action)
                case B_INT64_TYPE:
                case B_UINT64_TYPE:
                case B_OFF_T_TYPE:
+#if B_HAIKU_64_BIT
+               case B_SIZE_T_TYPE:
+               case B_SSIZE_T_TYPE:
+               case B_POINTER_TYPE:
+#endif
                {
                        uint64 *data = (uint64 *)_data;
                        uint64 *end = (uint64 *)((addr_t)_data + length);

############################################################################

Commit:      f4294645358d2eeec007d93493f092581e9bb504

Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Sun Aug  5 07:12:39 2012 UTC

User symbol lookup works now on x86_64.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/elf.cpp b/src/system/kernel/elf.cpp
index 8c639e5..2c068fc 100644
--- a/src/system/kernel/elf.cpp
+++ b/src/system/kernel/elf.cpp
@@ -1338,8 +1338,6 @@ error1:
 //     #pragma mark - userland symbol lookup
 
 
-// TODO x86_64
-#ifndef __x86_64__
 class UserSymbolLookup {
 public:
        static UserSymbolLookup& Default()
@@ -1546,7 +1544,6 @@ UserSymbolLookup::_Read(const T* address, T& data)
 
 UserSymbolLookup UserSymbolLookup::sLookup;
        // doesn't need construction, but has an Init() method
-#endif
 
 
 //     #pragma mark - public kernel API
@@ -1733,8 +1730,6 @@ elf_debug_lookup_user_symbol_address(Team* team, addr_t 
address,
        addr_t *_baseAddress, const char **_symbolName, const char **_imageName,
        bool *_exactMatch)
 {
-       // TODO x86_64
-#ifndef __x86_64__
        if (team == NULL || team == team_get_kernel_team())
                return B_BAD_VALUE;
 
@@ -1745,9 +1740,6 @@ elf_debug_lookup_user_symbol_address(Team* team, addr_t 
address,
 
        return lookup.LookupSymbolAddress(address, _baseAddress, _symbolName,
                _imageName, _exactMatch);
-#else
-       return B_ENTRY_NOT_FOUND;
-#endif
 }
 
 


Other related posts: