I found some documentation that taught me to do this... I've got copies if you like. (ps.gz) I found them on one of Red Hat's sites several years ago and saved them.
#include <stdio.h> #include <unistd.h> #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 struct option_rom_header { unsigned char sig1; /* Signature byte 1 */ unsigned char sig2; /* Signature byte 2 */ unsigned char len; /* Option ROM length in 512-byte blocks */ void *entry; /* Initialization entry point */ unsigned char reserved[17]; unsigned int pci_data_offset; unsigned int expansion_header_struct_offset; }; int main (int argc, char ** argv) { FILE *kcore; int status; size_t n; struct option_rom_header hdr; long int where; if ((kcore = fopen ("/proc/kcore", "r")) == (FILE*)NULL) { perror ("fopen /proc/kcore"); exit (EXIT_FAILURE); } for (where = 0xC0000; where <= 0xEFFFF; where += 0x0800) { if ((status = fseek (kcore, where, SEEK_SET)) != 0) { perror ("fseek"); exit (EXIT_FAILURE); } if ((n = fread (&hdr, sizeof hdr, (size_t)1, kcore)) != 1) { perror ("fread"); exit (EXIT_FAILURE); } if ((hdr.sig1 == 0x55) && (hdr.sig2 == 0xAA)) { printf ("%p: %i blocks @ %p\n", where, hdr.len, hdr.entry); } } if ((status = fclose (kcore)) != 0) { perror ("fclose /proc/kcore"); exit (EXIT_FAILURE); } exit (EXIT_SUCCESS); }
-- mailto: Karl M. Hegbloom <[EMAIL PROTECTED]> http://people.debian.org/~karlheg/