⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ohw.diff

📁 qemu虚拟机代码
💻 DIFF
📖 第 1 页 / 共 5 页
字号:
             ERROR("Unknown partition type [%s]\n", tmp);+            part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;+            part_register(bd, part, name, i);         }     }  error:diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/core.c OpenHackWare-release-0.4/src/libpart/core.c--- OpenHackWare-release-0.4.org/src/libpart/core.c	2005-03-31 09:23:33.000000000 +0200+++ OpenHackWare-release-0.4/src/libpart/core.c	2005-07-03 16:17:41.000000000 +0200@@ -126,7 +126,7 @@ }  int part_register (bloc_device_t *bd, part_t *partition,-                   const unsigned char *name)+                   const unsigned char *name, int partnum) {     part_t **cur; @@ -134,6 +134,7 @@     partition->bd = bd;     partition->next = NULL;     partition->name = strdup(name);+    partition->partnum = partnum;     for (cur = _bd_parts(bd); *cur != NULL; cur = &(*cur)->next)         continue;     *cur = partition;@@ -141,29 +142,15 @@     return 0; } -static inline int set_boot_part (bloc_device_t *bd, int partnum)-{-    part_t *cur;--    cur = part_get(bd, partnum);-    if (cur == NULL)-        return -1;-    bd_set_boot_part(bd, cur);--    return 0;-}- part_t *part_get (bloc_device_t *bd, int partnum) {     part_t **listp, *cur;-    int i;      listp = _bd_parts(bd);-    cur = *listp;-    for (i = 0; i != partnum; i++) {-        if (cur == NULL)+    +    for (cur = *listp; cur != NULL; cur = cur->next) {+        if (cur->partnum == partnum)             break;-        cur = cur->next;     }          return cur;@@ -192,17 +179,20 @@     part_set_blocsize(bd, part, 512);     part->bd = bd;     part->flags = PART_TYPE_RAW | PART_FLAG_BOOT;-    part_register(bd, part, "Raw");+    part_register(bd, part, "Raw", 0);      return part; } +bloc_device_t *part_get_bd (part_t *part)+{+    return part->bd;+}+ part_t *part_probe (bloc_device_t *bd, int set_raw) {-    part_t *part0, *boot_part, **cur;+    part_t *part0 = NULL, *boot_part, **cur; -    /* Register the 0 partition: raw partition containing the whole disk */-    part0 = part_get_raw(bd);     /* Try to find a valid boot partition */     boot_part = Apple_probe_partitions(bd);     if (boot_part == NULL) {@@ -210,10 +200,13 @@         if (boot_part == NULL && arch == ARCH_PREP)             boot_part = PREP_find_partition(bd);         if (boot_part == NULL && set_raw != 0) {-            boot_part = part0;-            set_boot_part(bd, 0);+            dprintf("Use bloc device as raw partition\n");         }     }+    if (_bd_parts(bd) == NULL) {+        /* Register the 0 partition: raw partition containing the whole disk */+        part0 = part_get_raw(bd);+    }     /* Probe filesystem on each found partition */     for (cur = _bd_parts(bd); *cur != NULL; cur = &(*cur)->next) {         const unsigned char *map, *type;@@ -248,23 +241,28 @@             type = "unknown";             break;         }-        DPRINTF("Probe filesystem on %s %s partition '%s' %s\n",+        dprintf("Probe filesystem on %s %s partition '%s' %s %p\n",                 type, map, (*cur)->name,-                ((*cur)->flags) & PART_FLAG_BOOT ? "(bootable)" : "");+                ((*cur)->flags) & PART_FLAG_BOOT ? "(bootable)" : "", *cur);         if (((*cur)->flags) & PART_FLAG_FS) {             if (((*cur)->flags) & PART_FLAG_BOOT)                 (*cur)->fs = fs_probe(*cur, 1);             else                 (*cur)->fs = fs_probe(*cur, 0);+        } else if (((*cur)->flags) & PART_TYPE_RAW) {+            (*cur)->fs = fs_probe(*cur, 2);         } else {             (*cur)->fs = fs_probe(*cur, 2);         }-        if (((*cur)->flags) & PART_FLAG_BOOT) {-            bd_set_boot_part(bd, *cur);             fs_get_bootfile((*cur)->fs);+        if (((*cur)->flags) & PART_FLAG_BOOT) {+            dprintf("Partition is bootable (%d)\n", (*cur)->partnum);+            bd_set_boot_part(bd, *cur, (*cur)->partnum);+            if (boot_part == NULL)+                boot_part = *cur;         }     }-    DPRINTF("Boot partition: %p %p %p %p\n", boot_part, boot_part->fs,+    dprintf("Boot partition: %p %p %p %p\n", boot_part, boot_part->fs,             part_fs(boot_part), part0);      return boot_part;@@ -279,6 +277,7 @@     part->boot_size.offset = 0;     part->boot_load = 0;     part->boot_entry = 0;+    part->flags |= PART_FLAG_BOOT;      return 0; }diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/isofs.c OpenHackWare-release-0.4/src/libpart/isofs.c--- OpenHackWare-release-0.4.org/src/libpart/isofs.c	2005-03-31 09:23:33.000000000 +0200+++ OpenHackWare-release-0.4/src/libpart/isofs.c	2005-07-03 16:17:41.000000000 +0200@@ -242,7 +242,7 @@                    part->boot_start.bloc, part->boot_size.bloc,                    part->boot_load, part->boot_entry);             part->flags = PART_TYPE_ISO9660 | PART_FLAG_BOOT;-            part_register(bd, part, name);+            part_register(bd, part, name, i + 1);             fs_raw_set_bootfile(part, part->boot_start.bloc,                                 part->boot_start.offset,                                 part->boot_size.bloc,diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/libpart.h OpenHackWare-release-0.4/src/libpart/libpart.h--- OpenHackWare-release-0.4.org/src/libpart/libpart.h	2005-03-31 09:23:33.000000000 +0200+++ OpenHackWare-release-0.4/src/libpart/libpart.h	2005-07-03 16:17:41.000000000 +0200@@ -30,6 +30,7 @@  struct part_t {     bloc_device_t *bd;+    int partnum;     uint32_t start;      /* Partition first bloc             */     uint32_t size;       /* Partition size, in blocs         */     uint32_t spb;@@ -54,7 +55,7 @@ };  int part_register (bloc_device_t *bd, part_t *partition,-                   const unsigned char *name);+                   const unsigned char *name, int partnum); void part_set_blocsize (bloc_device_t *bd, part_t *part, uint32_t blocsize); void part_private_set (part_t *part, void *private); void *part_private_get (part_t *part);diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/prep.c OpenHackWare-release-0.4/src/libpart/prep.c--- OpenHackWare-release-0.4.org/src/libpart/prep.c	2005-03-31 09:23:33.000000000 +0200+++ OpenHackWare-release-0.4/src/libpart/prep.c	2005-07-03 16:17:41.000000000 +0200@@ -164,7 +164,7 @@             part->boot_load = 0;             part->boot_entry = boot_offset - part->bloc_size;             part->flags = PART_TYPE_PREP | PART_FLAG_BOOT;-            part_register(bd, part, "PREP boot");+            part_register(bd, part, "PREP boot", i);             fs_raw_set_bootfile(part, part->boot_start.bloc,                                 part->boot_start.offset,                                 part->boot_size.bloc,diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/main.c OpenHackWare-release-0.4/src/main.c--- OpenHackWare-release-0.4.org/src/main.c	2005-03-31 09:23:33.000000000 +0200+++ OpenHackWare-release-0.4/src/main.c	2005-06-07 23:48:39.000000000 +0200@@ -364,20 +364,24 @@     void *load_base, *load_entry, *last_alloc, *load_end;     uint32_t memsize, boot_image_size, cmdline_size, ramdisk_size;     uint32_t boot_base, boot_nb;-    int boot_device;+    int boot_device, i;+    static const uint32_t isa_base_tab[3] = {+        0x80000000, /* PREP */+        0xFE000000, /* Grackle (Heathrow) */+        0xF2000000, /* UniNorth (Mac99)  */+    };      /* Retrieve NVRAM configuration */- nvram_retry:+    for(i = 0; i < 3; i++) {+        isa_io_base = isa_base_tab[i];     nvram = NVRAM_get_config(&memsize, &boot_device,                              &boot_image, &boot_image_size,                              &cmdline, &cmdline_size,                              &ramdisk, &ramdisk_size);-    if (nvram == NULL) {-        /* Retry with another isa_io_base */-        if (isa_io_base == 0x80000000) {-            isa_io_base = 0xF2000000;-            goto nvram_retry;+        if (nvram)+            break;         }+    if (i == 3) {         ERROR("Unable to load configuration from NVRAM. Aborting...\n");         return -1;     }@@ -402,7 +406,7 @@         cpu_name = CPU_get_name(pvr);         OF_register_cpu(cpu_name, 0, pvr,                         200 * 1000 * 1000, 200 * 1000 * 1000,-                        100 * 1000 * 1000, 10 * 1000 * 1000,+                        100 * 1000 * 1000, 100 * 1000 * 1000,                         0x0092);     }     OF_register_memory(memsize, 512 * 1024 /* TOFIX */);@@ -433,9 +437,12 @@     vga_puts(copyright);     vga_puts("\n"); +#if 0     /* QEMU is quite incoherent: d is cdrom, not second drive */+    /* XXX: should probe CD-ROM position */     if (boot_device == 'd')         boot_device = 'e';+#endif     /* Open boot device */     boot_part = bd_probe(boot_device);     if (boot_device == 'm') {diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/nvram.c OpenHackWare-release-0.4/src/nvram.c--- OpenHackWare-release-0.4.org/src/nvram.c	2005-03-31 09:23:33.000000000 +0200+++ OpenHackWare-release-0.4/src/nvram.c	2005-06-04 23:44:03.000000000 +0200@@ -334,6 +334,7 @@         ret = NVRAM_chrp_format(nvram);         break;     case ARCH_MAC99:+    case ARCH_HEATHROW: /* XXX: may be incorrect */         ret = NVRAM_mac99_format(nvram);         break;     case ARCH_POP:@@ -409,13 +410,12 @@         arch = ARCH_MAC99;     } else if (strcmp(sign, "POP") == 0) {         arch = ARCH_POP;+    } else if (strcmp(sign, "HEATHROW") == 0) {+        arch = ARCH_HEATHROW;     } else {         ERROR("Unknown PPC architecture: '%s'\n", sign);         return NULL;     }-    /* HACK */-    if (arch == ARCH_CHRP)-        arch = ARCH_MAC99;     lword = NVRAM_get_lword(nvram, 0x30);     *RAM_size = lword;     byte = NVRAM_get_byte(nvram, 0x34);diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/of.c OpenHackWare-release-0.4/src/of.c--- OpenHackWare-release-0.4.org/src/of.c	2005-04-06 23:17:26.000000000 +0200+++ OpenHackWare-release-0.4/src/of.c	2005-07-07 23:30:08.000000000 +0200@@ -489,7 +489,7 @@         ERROR("%s can't alloc new node '%s' name\n", __func__, name);         return NULL;     }-    new->prop_address = OF_prop_int_new(env, new, "address", address);+    new->prop_address = OF_prop_int_new(env, new, "unit-address", address);     if (new->prop_address == NULL) {         free(new->prop_name->value);         free(new->prop_name);@@ -1017,6 +1017,33 @@                            string, strlen(string) + 1); } +/* convert '\1' char to '\0' */+static OF_prop_t *OF_prop_string_new1 (OF_env_t *env, OF_node_t *node,+                                       const unsigned char *name,+                                       const unsigned char *string)+{+    int len, i;+    OF_prop_t *ret;+    unsigned char *str;++    if (strchr(string, '\1') == NULL) {+        return OF_prop_string_new(env, node, name, string);+    } else {+        len = strlen(string) + 1;+        str = malloc(len);+        if (!str)+            return NULL;+        memcpy(str, string, len);+        for(i = 0; i < len; i++)+            if (str[i] == '\1')+                str[i] = '\0';+        ret = OF_property_new(env, node, name,+                              str, len);+        free(str);+        return ret;+    }+}+ __attribute__ (( section (".OpenFirmware") )) static OF_prop_t *OF_prop_int_new (OF_env_t *env, OF_node_t *node,                                    const unsigned char *name, uint32_t value)@@ -1421,15 +1448,12 @@ __attribute__ (( section (".OpenFirmware") )) int OF_init (void) {-    const unsigned char compat_str[] = #if 0         "PowerMac3,1\0MacRISC\0Power Macintosh\0";         "PowerMac1,2\0MacRISC\0Power Macintosh\0";         "AAPL,PowerMac G3\0PowerMac G3\0MacRISC\0Power Macintosh\0";         "AAPL,PowerMac3,0\0MacRISC\0Power Macintosh\0";         "AAPL,Gossamer\0MacRISC\0Power Macintosh\0";-#else-        "AAPL,PowerMac G3\0PowerMac G3\0MacRISC\0Power Macintosh\0"; #endif     OF_env_t *OF_env;     OF_node_t *als, *opt, *chs, *pks;@@ -1455,15 +1479,21 @@         return -1;     }     OF_prop_string_new(OF_env, OF_node_root, "device_type", "bootrom");-#if 0-    OF_prop_string_new(OF_env, OF_node_root,-                       "model", "PPC Open Hack'Ware " BIOS_VERSION);-#else+    if (arch == ARCH_HEATHROW) {+        const unsigned char compat_str[] =+            "PowerMac1,1\0MacRISC\0Power Macintosh";+        OF_property_new(OF_env, OF_node_root, "compatible",+                        compat_str, sizeof(compat_str));     OF_prop_string_new(OF_env, OF_node_root,-                       "model", compat_str);-#endif+                           "model", "Power Macintosh");+    } else {+        const unsigned char compat_str[] =+            "PowerMac3,1\0MacRISC\0Power Macintosh";     OF_property_new(OF_env, OF_node_root, "compatible",                     compat_str, sizeof(compat_str));+        OF_prop_string_new(OF_env, OF_node_root,+                           "model", "PowerMac3,1");+    } #if 0     OF_prop_string_new(OF_env, OF_node_root, "copyright", copyright); #else@@ -1561,14 +1591,15 @@         range.size = 0x00800000;         OF_property_new(OF_env, rom, "ranges", &range, sizeof(OF_range_t));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -