ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/name_registry.cpp
(Generate patch)

Comparing SheepShaver/src/name_registry.cpp (file contents):
Revision 1.13 by gbeauche, 2004-11-13T14:09:15Z vs.
Revision 1.18 by gbeauche, 2005-03-19T04:31:59Z

# Line 1 | Line 1
1   /*
2   *  name_registry.cpp - Name Registry handling
3   *
4 < *  SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig
4 > *  SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 37 | Line 37 | typedef int16 (*rcec_ptr)(const RegEntry
37   static uint32 rcec_tvect = 0;
38   static inline int16 RegistryCStrEntryCreate(uintptr arg1, const char *arg2, uint32 arg3)
39   {
40 <        return (int16)CallMacOS3(rcec_ptr, rcec_tvect, (const RegEntryID *)arg1, Host2MacAddr((uint8 *)arg2), arg3);
40 >        SheepString arg2str(arg2);
41 >        return (int16)CallMacOS3(rcec_ptr, rcec_tvect, (const RegEntryID *)arg1, arg2str.addr(), arg3);
42   }
43   typedef int16 (*rpc_ptr)(const RegEntryID *, const char *, const void *, uint32);
44   static uint32 rpc_tvect = 0;
45   static inline int16 RegistryPropertyCreate(uintptr arg1, const char *arg2, uintptr arg3, uint32 arg4)
46   {
47 <        return (int16)CallMacOS4(rpc_ptr, rpc_tvect, (const RegEntryID *)arg1, Host2MacAddr((uint8 *)arg2), (const void *)arg3, arg4);
47 >        SheepString arg2str(arg2);
48 >        return (int16)CallMacOS4(rpc_ptr, rpc_tvect, (const RegEntryID *)arg1, arg2str.addr(), (const void *)arg3, arg4);
49 > }
50 > static inline int16 RegistryPropertyCreateStr(uintptr arg1, const char *arg2, const char *arg3)
51 > {
52 >        SheepString arg3str(arg3);
53 >        return RegistryPropertyCreate(arg1, arg2, arg3str.addr(), strlen(arg3) + 1);
54   }
48 #define RegistryPropertyCreateStr(e,n,s) RegistryPropertyCreate(e,n,Host2MacAddr((uint8 *)s),strlen(s)+1)
55  
56   // Video driver stub
57   static const uint8 video_driver[] = {
# Line 125 | Line 131 | void DoPatchNameRegistry(void)
131                          case 80:        // 860
132                                  str = "PowerPC,860";
133                                  break;
134 +                        case 12:        // 7400, 7410, 7450, 7455, 7457
135 +                        case 0x800c:
136 +                        case 0x8000:
137 +                        case 0x8001:
138 +                        case 0x8002:
139 +                                str = "PowerPC,G4";
140 +                                break;
141                          default:
142                                  str = "PowerPC,???";
143                                  break;
# Line 313 | Line 326 | void DoPatchNameRegistry(void)
326                  if (!RegistryCStrEntryCreate(device_tree.addr(), "video", video.addr())) {
327                          RegistryPropertyCreateStr(video.addr(), "AAPL,connector", "monitor");
328                          RegistryPropertyCreateStr(video.addr(), "device_type", "display");
329 <                        RegistryPropertyCreate(video.addr(), "driver,AAPL,MacOS,PowerPC", Host2MacAddr((uint8 *)video_driver), sizeof(video_driver));
329 >                        SheepArray<sizeof(video_driver)> the_video_driver;
330 >                        Host2Mac_memcpy(the_video_driver.addr(), video_driver, sizeof(video_driver));
331 >                        RegistryPropertyCreate(video.addr(), "driver,AAPL,MacOS,PowerPC", the_video_driver.addr(), sizeof(video_driver));
332                          RegistryPropertyCreateStr(video.addr(), "model", "SheepShaver Video");
333                  }
334  
335                  // Create "ethernet"
336 +                // XXX the current ethernet driver is not direct addressing clean
337 + #if REAL_ADDRESSING
338                  SheepRegEntryID ethernet;
339                  if (!RegistryCStrEntryCreate(device_tree.addr(), "ethernet", ethernet.addr())) {
340                          RegistryPropertyCreateStr(ethernet.addr(), "AAPL,connector", "ethernet");
341                          RegistryPropertyCreateStr(ethernet.addr(), "device_type", "network");
342 <                        RegistryPropertyCreate(ethernet.addr(), "driver,AAPL,MacOS,PowerPC", Host2MacAddr((uint8 *)ethernet_driver), sizeof(ethernet_driver));
342 >                        SheepArray<sizeof(ethernet_driver)> the_ethernet_driver;
343 >                        Host2Mac_memcpy(the_ethernet_driver.addr(), ethernet_driver, sizeof(ethernet_driver));
344 >                        RegistryPropertyCreate(ethernet.addr(), "driver,AAPL,MacOS,PowerPC", the_ethernet_driver.addr(), sizeof(ethernet_driver));
345                          // local-mac-address
346                          // max-frame-size 2048
347                  }
348 + #endif
349          }
350          D(bug("done.\n"));
351   }
# Line 333 | Line 353 | void DoPatchNameRegistry(void)
353   void PatchNameRegistry(void)
354   {
355          // Find RegistryCStrEntryCreate() and RegistryPropertyCreate() TVECTs
356 <        rcec_tvect = (uint32)FindLibSymbol("\017NameRegistryLib", "\027RegistryCStrEntryCreate");
356 >        rcec_tvect = FindLibSymbol("\017NameRegistryLib", "\027RegistryCStrEntryCreate");
357          D(bug("RegistryCStrEntryCreate TVECT at %08x\n", rcec_tvect));
358 <        rpc_tvect = (uint32)FindLibSymbol("\017NameRegistryLib", "\026RegistryPropertyCreate");
358 >        rpc_tvect = FindLibSymbol("\017NameRegistryLib", "\026RegistryPropertyCreate");
359          D(bug("RegistryPropertyCreate TVECT at %08x\n", rpc_tvect));
360          if (rcec_tvect == 0 || rpc_tvect == 0) {
361                  ErrorAlert(GetString(STR_NO_NAME_REGISTRY_ERR));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines