Commit 70e39deb authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.44pre2

parent d5977cd7
...@@ -287,17 +287,19 @@ CONFIG_BLK_DEV_RZ1000 ...@@ -287,17 +287,19 @@ CONFIG_BLK_DEV_RZ1000
Linux. This may slow disk throughput by a few percent, but at least Linux. This may slow disk throughput by a few percent, but at least
things will operate 100% reliably. If unsure, say Y. things will operate 100% reliably. If unsure, say Y.
Intel 82371 PIIX (Triton I/II) DMA support Intel 82371 PIIX (Triton I/II), VIA VP-1 DMA support
CONFIG_BLK_DEV_TRITON CONFIG_BLK_DEV_TRITON
If your PCI system uses an IDE harddrive (as opposed to SCSI, say) If your PCI system uses an IDE harddrive (as opposed to SCSI, say)
and includes the Intel Triton I/II IDE interface chipset (i82371FB, and includes the Intel Triton I/II IDE interface chipset (i82371FB,
i82371SB or i82371AB), you will want to enable this option to allow i82371SB or i82371AB), or the VIA VP-1 IDE interface chipset
use of bus-mastering DMA data transfers. Read the comments at the (VT82C586), you will want to enable this option to allow use of
bus-mastering DMA data transfers. Read the comments at the
beginning of drivers/block/triton.c and Documentation/ide.txt. beginning of drivers/block/triton.c and Documentation/ide.txt.
You can get the latest version of the hdparm utility via You can get the latest version of the hdparm utility via
ftp (user: anonymous) from ftp (user: anonymous) from
sunsite.unc.edu/pub/Linux/kernel/patches/diskdrives/; it is sunsite.unc.edu/pub/Linux/kernel/patches/diskdrives/; it is
used to tune your harddisk. It is safe to say Y to this question. used to tune your harddisk.
It is safe to say Y to this question.
Other IDE chipset support Other IDE chipset support
CONFIG_IDE_CHIPSETS CONFIG_IDE_CHIPSETS
......
VERSION = 2 VERSION = 2
PATCHLEVEL = 1 PATCHLEVEL = 1
SUBLEVEL = 43 SUBLEVEL = 44
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/) ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
......
...@@ -2603,6 +2603,7 @@ __initfunc(static void probe_for_hwifs (void)) ...@@ -2603,6 +2603,7 @@ __initfunc(static void probe_for_hwifs (void))
ide_probe_pci (PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_1, &ide_init_triton, 0); ide_probe_pci (PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_1, &ide_init_triton, 0);
ide_probe_pci (PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB, &ide_init_triton, 0); ide_probe_pci (PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB, &ide_init_triton, 0);
#endif /* CONFIG_BLK_DEV_TRITON */ #endif /* CONFIG_BLK_DEV_TRITON */
ide_probe_pci (PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, &ide_init_triton, 0);
#ifdef CONFIG_BLK_DEV_OPTI621 #ifdef CONFIG_BLK_DEV_OPTI621
ide_probe_pci (PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C621, &ide_init_opti621, 0); ide_probe_pci (PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C621, &ide_init_opti621, 0);
#endif /* CONFIG_BLK_DEV_OPTI621 */ #endif /* CONFIG_BLK_DEV_OPTI621 */
......
...@@ -298,7 +298,7 @@ typedef void (ide_selectproc_t) (ide_drive_t *); ...@@ -298,7 +298,7 @@ typedef void (ide_selectproc_t) (ide_drive_t *);
typedef enum { ide_unknown, ide_generic, ide_triton, typedef enum { ide_unknown, ide_generic, ide_triton,
ide_cmd640, ide_dtc2278, ide_ali14xx, ide_cmd640, ide_dtc2278, ide_ali14xx,
ide_qd6580, ide_umc8672, ide_ht6560b, ide_qd6580, ide_umc8672, ide_ht6560b,
ide_promise } ide_promise, ide_via }
hwif_chipset_t; hwif_chipset_t;
typedef struct hwif_s { typedef struct hwif_s {
......
...@@ -122,15 +122,25 @@ static unsigned int piix_key; ...@@ -122,15 +122,25 @@ static unsigned int piix_key;
#define PIIX_FLAGS_PREFETCH 4 #define PIIX_FLAGS_PREFETCH 4
#define PIIX_FLAGS_FAST_DMA 8 #define PIIX_FLAGS_FAST_DMA 8
typedef struct {
unsigned d0_flags :4; union chip_en_reg_u {
unsigned d1_flags :4; struct {
unsigned recovery :2; unsigned d0_flags :4;
unsigned reserved :2; unsigned d1_flags :4;
unsigned sample :2; unsigned recovery :2;
unsigned sidetim_enabled:1; unsigned reserved :2;
unsigned ports_enabled :1; unsigned sample :2;
} piix_timing_t; unsigned sidetim_enabled:1;
unsigned ports_enabled :1;
} piix_s;
struct {
unsigned sec_en :1;
unsigned pri_en :1;
unsigned reserved :14;
} via_s;
};
typedef union chip_en_reg_u piix_timing_t;
typedef struct { typedef struct {
unsigned pri_recovery :2; unsigned pri_recovery :2;
...@@ -269,16 +279,16 @@ static int piix_dmaproc (ide_dma_action_t func, ide_drive_t *drive) ...@@ -269,16 +279,16 @@ static int piix_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
printk("%s: pcibios read failed\n", HWIF(drive)->name); printk("%s: pcibios read failed\n", HWIF(drive)->name);
return 1; return 1;
} }
dflags = drive->select.b.unit ? timing.d1_flags : timing.d0_flags; dflags = drive->select.b.unit ? timing.piix_s.d1_flags : timing.piix_s.d0_flags;
if (dflags & PIIX_FLAGS_FAST_PIO) { if (dflags & PIIX_FLAGS_FAST_PIO) {
if (func == ide_dma_on && drive->media == ide_disk) if (func == ide_dma_on && drive->media == ide_disk)
dflags |= PIIX_FLAGS_FAST_DMA; dflags |= PIIX_FLAGS_FAST_DMA;
else else
dflags &= ~PIIX_FLAGS_FAST_DMA; dflags &= ~PIIX_FLAGS_FAST_DMA;
if (drive->select.b.unit == 0) if (drive->select.b.unit == 0)
timing.d0_flags = dflags; timing.piix_s.d0_flags = dflags;
else else
timing.d1_flags = dflags; timing.piix_s.d1_flags = dflags;
if (pcibios_write_config_word(piix_pci_bus, piix_pci_fn, reg, *(short *)&timing)) { if (pcibios_write_config_word(piix_pci_bus, piix_pci_fn, reg, *(short *)&timing)) {
printk("%s: pcibios write failed\n", HWIF(drive)->name); printk("%s: pcibios write failed\n", HWIF(drive)->name);
return 1; return 1;
...@@ -456,8 +466,14 @@ void ide_init_triton (byte bus, byte fn) ...@@ -456,8 +466,14 @@ void ide_init_triton (byte bus, byte fn)
chipset = "PIIX4"; chipset = "PIIX4";
else if (devid == PCI_DEVICE_ID_INTEL_82371SB_1) else if (devid == PCI_DEVICE_ID_INTEL_82371SB_1)
chipset = "PIIX3"; chipset = "PIIX3";
else else if (devid == PCI_DEVICE_ID_INTEL_82371_1)
chipset = "PIIX"; chipset = "PIIX";
else if (devid == PCI_DEVICE_ID_VIA_82C586_1)
chipset = "VP1";
else {
printk("Unknown PCI IDE interface 0x%x\n", devid);
goto quit;
}
printk("%s: bus-master IDE device on PCI bus %d function %d\n", chipset, bus, fn); printk("%s: bus-master IDE device on PCI bus %d function %d\n", chipset, bus, fn);
...@@ -470,13 +486,24 @@ void ide_init_triton (byte bus, byte fn) ...@@ -470,13 +486,24 @@ void ide_init_triton (byte bus, byte fn)
printk("%s: IDE ports are not enabled (BIOS)\n", chipset); printk("%s: IDE ports are not enabled (BIOS)\n", chipset);
goto quit; goto quit;
} }
if ((rc = pcibios_read_config_word(bus, fn, 0x40, (short *)&timings[0]))) if (devid == PCI_DEVICE_ID_VIA_82C586_1) {
goto quit; /* pri and sec channel enables are in port 0x40 */
if ((rc = pcibios_read_config_word(bus, fn, 0x42, (short *)&timings[1]))) if ((rc = pcibios_read_config_word(bus, fn, 0x40, (short *)&timings[0])))
goto quit; goto quit;
if ((!timings[0].ports_enabled) && (!timings[1].ports_enabled)) { if ((!timings[0].via_s.pri_en && (!timings[0].via_s.sec_en))) {
printk("%s: neither IDE port is enabled\n", chipset); printk("%s: neither IDE port is enabled\n", chipset);
goto quit; goto quit;
}
}
else { /* INTEL piix */
if ((rc = pcibios_read_config_word(bus, fn, 0x40, (short *)&timings[0])))
goto quit;
if ((rc = pcibios_read_config_word(bus, fn, 0x42, (short *)&timings[1])))
goto quit;
if ((!timings[0].piix_s.ports_enabled) && (!timings[1].piix_s.ports_enabled)) {
printk("%s: neither IDE port is enabled\n", chipset);
goto quit;
}
} }
/* /*
...@@ -526,10 +553,30 @@ void ide_init_triton (byte bus, byte fn) ...@@ -526,10 +553,30 @@ void ide_init_triton (byte bus, byte fn)
case 0x170: pri_sec = 1; break; case 0x170: pri_sec = 1; break;
default: continue; default: continue;
} }
if (devid == PCI_DEVICE_ID_VIA_82C586_1) {
timing = timings[0];
switch (h) {
case 0:
if (!timing.piix_s.ports_enabled) {
printk("port 0 DMA not enabled\n");
continue;
}
case 1:
if (!timing.piix_s.sidetim_enabled) {
printk("port 1 DMA not enabled\n");
continue;
}
}
hwif->chipset = ide_via;
}
else { /* PIIX */
timing = timings[pri_sec]; timing = timings[pri_sec];
if (!timing.ports_enabled) /* interface disabled? */ if (!timing.piix_s.ports_enabled) /* interface disabled? */
continue; continue;
hwif->chipset = ide_triton; hwif->chipset = ide_triton;
}
if (dma_enabled) if (dma_enabled)
init_piix_dma(hwif, bmiba + (pri_sec ? 8 : 0)); init_piix_dma(hwif, bmiba + (pri_sec ? 8 : 0));
#ifdef DISPLAY_PIIX_TIMINGS #ifdef DISPLAY_PIIX_TIMINGS
...@@ -539,17 +586,32 @@ void ide_init_triton (byte bus, byte fn) ...@@ -539,17 +586,32 @@ void ide_init_triton (byte bus, byte fn)
{ {
const char *slave; const char *slave;
piix_sidetim_t sidetim; piix_sidetim_t sidetim;
byte sample = 5 - timing.sample; byte sample = 5 - timing.piix_s.sample;
byte recovery = 4 - timing.recovery; byte recovery = 4 - timing.piix_s.recovery;
unsigned int drvtim;
if (devid == PCI_DEVICE_ID_VIA_82C586_1) {
pcibios_read_config_dword(bus, fn, 0x48, &drvtim);
if (pri_sec == 0) {
printk(" %s master: active_pulse_CLKs=%d, recovery_CLKs=%d\n", hwif->name, 1+(drvtim>>28), 1+((drvtim & 0x0f000000)>>24));
printk(" %s slave: active_pulse_CLKs=%d, recovery_CLKs=%d\n", hwif->name, 1+((drvtim & 0xf00000)>>20), 1+((drvtim & 0x0f0000)>>16));
continue;
} else {
printk(" %s master: active_pulse_CLKs=%d, recovery_CLKs=%d\n", hwif->name, 1+((drvtim & 0xf000)>>12), 1+((drvtim & 0x0f00)>>8));
printk(" %s slave: active_pulse_CLKs=%d, recovery_CLKs=%d\n", hwif->name, 1+((drvtim & 0xf0)>>4), 1+(drvtim & 0x0f));
continue;
}
}
if ((devid == PCI_DEVICE_ID_INTEL_82371SB_1 if ((devid == PCI_DEVICE_ID_INTEL_82371SB_1
|| devid == PCI_DEVICE_ID_INTEL_82371AB) || devid == PCI_DEVICE_ID_INTEL_82371AB)
&& timing.sidetim_enabled && timing.piix_s.sidetim_enabled
&& !pcibios_read_config_byte(bus, fn, 0x44, (byte *) &sidetim)) && !pcibios_read_config_byte(bus, fn, 0x44, (byte *) &sidetim))
slave = ""; /* PIIX3 and later */ slave = ""; /* PIIX3 and later */
else else
slave = "/slave"; /* PIIX, or PIIX3 in compatibility mode */ slave = "/slave"; /* PIIX, or PIIX3 in compatibility mode */
printk(" %s master%s: sample_CLKs=%d, recovery_CLKs=%d\n", hwif->name, slave, sample, recovery); printk(" %s master%s: sample_CLKs=%d, recovery_CLKs=%d\n", hwif->name, slave, sample, recovery);
print_piix_drive_flags ("master:", timing.d0_flags); print_piix_drive_flags ("master:", timing.piix_s.d0_flags);
if (!*slave) { if (!*slave) {
if (pri_sec == 0) { if (pri_sec == 0) {
sample = 5 - sidetim.pri_sample; sample = 5 - sidetim.pri_sample;
...@@ -560,7 +622,7 @@ void ide_init_triton (byte bus, byte fn) ...@@ -560,7 +622,7 @@ void ide_init_triton (byte bus, byte fn)
} }
printk(" slave : sample_CLKs=%d, recovery_CLKs=%d\n", sample, recovery); printk(" slave : sample_CLKs=%d, recovery_CLKs=%d\n", sample, recovery);
} }
print_piix_drive_flags ("slave :", timing.d1_flags); print_piix_drive_flags ("slave :", timing.piix_s.d1_flags);
} }
#endif /* DISPLAY_PIIX_TIMINGS */ #endif /* DISPLAY_PIIX_TIMINGS */
} }
......
...@@ -180,7 +180,7 @@ static long rtc_read(struct inode *inode, struct file *file, char *buf, ...@@ -180,7 +180,7 @@ static long rtc_read(struct inode *inode, struct file *file, char *buf,
data = rtc_irq_data; data = rtc_irq_data;
rtc_irq_data = 0; rtc_irq_data = 0;
restore_flags(flags); restore_flags(flags);
retval = put_user(data, (unsigned long *)buf)) ?: sizeof(unsigned long); retval = put_user(data, (unsigned long *)buf) ?: sizeof(unsigned long);
} }
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
......
...@@ -143,12 +143,8 @@ if [ "$CONFIG_NET_RADIO" != "n" ]; then ...@@ -143,12 +143,8 @@ if [ "$CONFIG_NET_RADIO" != "n" ]; then
bool 'Soundmodem support for 2400 baud AFSK modulation (8MHz crystal)' CONFIG_SOUNDMODEM_AFSK2400_8 bool 'Soundmodem support for 2400 baud AFSK modulation (8MHz crystal)' CONFIG_SOUNDMODEM_AFSK2400_8
bool 'Soundmodem support for 4800 baud HAPN-1 modulation' CONFIG_SOUNDMODEM_HAPN4800 bool 'Soundmodem support for 4800 baud HAPN-1 modulation' CONFIG_SOUNDMODEM_HAPN4800
bool 'Soundmodem support for 9600 baud FSK G3RUH modulation' CONFIG_SOUNDMODEM_FSK9600 bool 'Soundmodem support for 9600 baud FSK G3RUH modulation' CONFIG_SOUNDMODEM_FSK9600
if [ -f drivers/net/soundmodem/sm_afsk2666.c ]; then #bool 'Soundmodem support for 2666 baud AFSK modulation' CONFIG_SOUNDMODEM_AFSK2666
bool 'Soundmodem support for 2666 baud AFSK modulation' CONFIG_SOUNDMODEM_AFSK2666 #bool 'Soundmodem support for 4800 baud PSK modulation' CONFIG_SOUNDMODEM_PSK4800
fi
if [ -f drivers/net/soundmodem/sm_psk4800.c ]; then
bool 'Soundmodem support for 4800 baud PSK modulation' CONFIG_SOUNDMODEM_PSK4800
fi
fi fi
fi fi
tristate 'STRIP (Metricom starmode radio IP)' CONFIG_STRIP tristate 'STRIP (Metricom starmode radio IP)' CONFIG_STRIP
......
...@@ -204,7 +204,7 @@ struct pci_dev_info dev_info[] = { ...@@ -204,7 +204,7 @@ struct pci_dev_info dev_info[] = {
DEVICE( VIA, VIA_82C586_1, "VT 82C586 Apollo VP-1"), DEVICE( VIA, VIA_82C586_1, "VT 82C586 Apollo VP-1"),
DEVICE( VIA, VIA_82C576, "VT 82C576 3V"), DEVICE( VIA, VIA_82C576, "VT 82C576 3V"),
DEVICE( VIA, VIA_82C585, "VT 82C585VP Apollo VP-1"), DEVICE( VIA, VIA_82C585, "VT 82C585VP Apollo VP-1"),
DEVICE( VIA, VIA_82C586_0, "VT 82C586 Apollo VP-1"), DEVICE( VIA, VIA_82C586, "VT 82C586 Apollo VP-1"),
DEVICE( VIA, VIA_82C416, "VT 82C416MV"), DEVICE( VIA, VIA_82C416, "VT 82C416MV"),
DEVICE( VORTEX, VORTEX_GDT60x0, "GDT 60x0"), DEVICE( VORTEX, VORTEX_GDT60x0, "GDT 60x0"),
DEVICE( VORTEX, VORTEX_GDT6000B,"GDT 6000b"), DEVICE( VORTEX, VORTEX_GDT6000B,"GDT 6000b"),
......
This diff is collapsed.
...@@ -951,7 +951,7 @@ static void basket_name(struct inode * dir, struct dentry * entry) ...@@ -951,7 +951,7 @@ static void basket_name(struct inode * dir, struct dentry * entry)
{ {
char prefix[32]; char prefix[32];
struct qstr prename = { prefix, 14 }; struct qstr prename = { prefix, 14 };
struct qstr entname = { entry->d_name, entry->d_len }; struct qstr entname = { entry->d_name.name, entry->d_name.len };
struct inode * inode; struct inode * inode;
struct dentry * old = entry; /* dummy */ struct dentry * old = entry; /* dummy */
int i; int i;
......
...@@ -266,8 +266,8 @@ asmlinkage int sys_getdents(unsigned int fd, void * dirent, unsigned int count) ...@@ -266,8 +266,8 @@ asmlinkage int sys_getdents(unsigned int fd, void * dirent, unsigned int count)
if(inode) { if(inode) {
nr++; nr++;
if(nr > (file->f_pos & ~BASKET_BIT)) { if(nr > (file->f_pos & ~BASKET_BIT)) {
int err = filldir(&buf, ptr->d_name, int err = filldir(&buf, ptr->d_name.name,
ptr->d_len, ptr->d_name.len,
file->f_pos, file->f_pos,
inode->i_ino); inode->i_ino);
if(err) if(err)
......
...@@ -765,9 +765,9 @@ int do_mount(kdev_t dev, const char * dev_name, const char * dir_name, const cha ...@@ -765,9 +765,9 @@ int do_mount(kdev_t dev, const char * dev_name, const char * dir_name, const cha
struct dentry * old = dir_i->i_dentry; struct dentry * old = dir_i->i_dentry;
struct dentry * new; struct dentry * new;
vfs_lock(); vfs_lock();
new = d_alloc(old->d_parent, old->d_len, 1); new = d_alloc(old->d_parent, old->d_name.len, 1);
if(new) { if(new) {
struct qstr copy = { old->d_name, old->d_len }; struct qstr copy = { old->d_name.name, old->d_name.len };
d_add(new, sb->s_mounted, &copy, D_DUPLICATE); d_add(new, sb->s_mounted, &copy, D_DUPLICATE);
vfs_unlock(); vfs_unlock();
} else { } else {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* <schoebel@informatik.uni-stuttgart.de>. * <schoebel@informatik.uni-stuttgart.de>.
*/ */
#define D_MAXLEN 1024 #define D_MAXLEN 1024
/* public flags for d_add() */ /* public flags for d_add() */
#define D_NORMAL 0 #define D_NORMAL 0
...@@ -26,6 +26,16 @@ ...@@ -26,6 +26,16 @@
#define IS_ROOT(x) ((x) == (x)->d_parent) #define IS_ROOT(x) ((x) == (x)->d_parent)
/* "quick string" -- I introduced this to shorten the parameter list
* of many routines. Think of it as a (str,stlen) pair.
* Storing the len instead of doing strlen() very often is performance
* critical.
*/
struct qstr {
char * name;
int len;
};
struct dentry { struct dentry {
union { union {
struct inode * d_inode; /* Where the name belongs to */ struct inode * d_inode; /* Where the name belongs to */
...@@ -38,19 +48,8 @@ struct dentry { ...@@ -38,19 +48,8 @@ struct dentry {
struct dentry * d_hash_prev; struct dentry * d_hash_prev;
struct dentry * d_basket_next; struct dentry * d_basket_next;
struct dentry * d_basket_prev; struct dentry * d_basket_prev;
short d_len; /* set by dalloc() */ struct qstr d_name;
short d_flag; unsigned int d_flag;
char d_name[D_MAXLEN];
};
/* "quick string" -- I introduced this to shorten the parameter list
* of many routines. Think of it as a (str,stlen) pair.
* Storing the len instead of doing strlen() very often is performance
* critical.
*/
struct qstr {
const char * name;
int len;
}; };
extern struct dentry * the_root; extern struct dentry * the_root;
......
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
#include <linux/net.h> #include <linux/net.h>
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <asm/bitops.h>
/* Prefixes for routines (having no effect), but indicate what /* Prefixes for routines (having no effect), but indicate what
* the routine may do. This can greatly ease reasoning about routines... * the routine may do. This can greatly ease reasoning about routines...
......
...@@ -497,7 +497,7 @@ ...@@ -497,7 +497,7 @@
#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 #define PCI_DEVICE_ID_VIA_82C586_1 0x0571
#define PCI_DEVICE_ID_VIA_82C576 0x0576 #define PCI_DEVICE_ID_VIA_82C576 0x0576
#define PCI_DEVICE_ID_VIA_82C585 0x0585 #define PCI_DEVICE_ID_VIA_82C585 0x0585
#define PCI_DEVICE_ID_VIA_82C586_0 0x0586 #define PCI_DEVICE_ID_VIA_82C586 0x0586
#define PCI_DEVICE_ID_VIA_82C416 0x1571 #define PCI_DEVICE_ID_VIA_82C416 0x1571
#define PCI_VENDOR_ID_VORTEX 0x1119 #define PCI_VENDOR_ID_VORTEX 0x1119
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
// * Only resolves operands of jump and call instructions. // * Only resolves operands of jump and call instructions.
#include <fstream.h> #include <fstream.h>
#include <strstream.h>
#include <iomanip.h> #include <iomanip.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -184,9 +185,23 @@ NameList::decode(unsigned char* code, long eip_addr) ...@@ -184,9 +185,23 @@ NameList::decode(unsigned char* code, long eip_addr)
char buf[1024]; char buf[1024];
int lines = 0; int lines = 0;
int eip_seen = 0;
long offset;
while (fgets(buf, sizeof(buf), objdump_FILE)) { while (fgets(buf, sizeof(buf), objdump_FILE)) {
if (eip_seen && buf[4] == ':') {
// assume objdump from binutils 2.8..., reformat to old style
offset = strtol(buf, 0, 16);
char newbuf[sizeof(buf)];
memset(newbuf, '\0', sizeof(newbuf));
ostrstream ost(newbuf, sizeof(newbuf));
ost.width(8);
ost << offset;
ost << " <_EIP+" << offset << ">: " << &buf[6] << ends;
strcpy(buf, newbuf);
}
if (!strnequ(&buf[9], "<_EIP", 5)) if (!strnequ(&buf[9], "<_EIP", 5))
continue; continue;
eip_seen = 1;
if (strstr(buf, " is out of bounds")) if (strstr(buf, " is out of bounds"))
break; break;
lines++; lines++;
...@@ -195,19 +210,28 @@ NameList::decode(unsigned char* code, long eip_addr) ...@@ -195,19 +210,28 @@ NameList::decode(unsigned char* code, long eip_addr)
cout << buf; cout << buf;
continue; continue;
} }
long offset = strtol(buf, 0, 16); offset = strtol(buf, 0, 16);
char* bp_0 = strchr(buf, '>') + 2; char* bp_0 = strchr(buf, '>');
KSym* ksym = find(eip_addr + offset); KSym* ksym = find(eip_addr + offset);
if (bp_0)
bp_0 += 2;
else
bp_0 = strchr(buf, ':');
if (ksym) if (ksym)
cout << *ksym << ' '; cout << *ksym << ' ';
char* bp = bp_0; char *bp_1 = strstr(bp_0, "\t"); // objdump from binutils 2.8...
if (bp_1)
++bp_1;
else
bp_1 = bp_0;
char *bp = bp_1;
while (!isspace(*bp)) while (!isspace(*bp))
bp++; bp++;
while (isspace(*bp)) while (isspace(*bp))
bp++; bp++;
if (*bp != '0') { if (!isxdigit(*bp)) {
cout << bp_0; cout << bp_0;
} else if (*bp_0 == 'j' || strnequ(bp_0, "call", 4)) { // a jump or call insn } else if (*bp_1 == 'j' || strnequ(bp_1, "call", 4)) { // a jump or call insn
long rel_addr = strtol(bp, 0, 16); long rel_addr = strtol(bp, 0, 16);
ksym = find(eip_addr + rel_addr); ksym = find(eip_addr + rel_addr);
if (ksym) { if (ksym) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment