Chameleon

Chameleon Commit Details

Date:2014-10-23 05:58:58 (4 years 8 months ago)
Author:Chuck Fry
Commit:2443
Parents: 2442
Message:Fix null pointer handling
Changes:
M/branches/chucko/i386/libsaio/nvidia.c

File differences

branches/chucko/i386/libsaio/nvidia.c
14781478
14791479
14801480
1481
1482
1483
1484
1481
1482
1483
1484
1485
1486
1487
1488
14851489
14861490
14871491
......
17051709
17061710
17071711
1708
17091712
17101713
17111714
......
18801883
18811884
18821885
1883
18841886
18851887
18861888
......
19251927
19261928
19271929
1930
19281931
19291932
19301933
......
19321935
19331936
19341937
1938
19351939
19361940
19371941
......
19671971
19681972
19691973
1970
1974
19711975
19721976
19731977
static int patch_nvidia_rom(uint8_t *rom)
{
if (!rom || (rom[0] != 0x55 && rom[1] != 0xaa)) {
printf("False ROM signature: 0x%02x%02x\n", rom[0], rom[1]);
return PATCH_ROM_FAILED;
}
if (!rom) {
printf("ROM not found\n");
return PATCH_ROM_FAILED;
}
if (rom[0] != 0x55 && rom[1] != 0xaa) {
printf("False ROM signature: 0x%02x%02x\n", rom[0], rom[1]);
return PATCH_ROM_FAILED;
}
uint16_t dcbptr = READ_LE_SHORT(rom, 0x36);
for (i = 0; i < (sizeof(nvidia_card_exceptions) / sizeof(nvidia_card_exceptions[0])); i++) {
if ((nvidia_card_exceptions[i].device == device_id) && (nvidia_card_exceptions[i].subdev == subsys_id)){
return nvidia_card_exceptions[i].name;
break;
}
}
}
option_rom_pci_header_t*rom_pci_header;
volatile uint8_t*regs;
uint8_t*rom = NULL;
uint8_t*nvRom;
uint8_tnvCardType = 0;
unsigned long longvideoRam = 0;
uint32_tnvBiosOveride;
return false;
}
} else {
uint8_t*nvRom;
rom = malloc(NVIDIA_ROM_SIZE);
// Otherwise read bios from card
nvBiosOveride = 0;
// PROM first
// Enable PROM access
(REG32(NV_PBUS_PCI_NV_20)) = NV_PBUS_PCI_NV_20_ROM_SHADOW_DISABLED;
nvRom = (uint8_t*)&regs[NV_PROM_OFFSET];
// Valid Signature ?
if ((nvPatch = patch_nvidia_rom(rom)) == PATCH_ROM_FAILED) {
printf("ERROR: nVidia ROM Patching Failed!\n");
free(rom);
//return false;
return false;
}
rom_pci_header = (option_rom_pci_header_t*)(rom + *(uint16_t *)&rom[24]);

Archive Download the corresponding diff file

Revision: 2443