summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bennett <sb476@cam.ac.uk>2007-12-07 01:00:51 +0000
committerStuart Bennett <sb476@cam.ac.uk>2007-12-07 01:19:05 +0000
commit882dded4c0bb5c9cd49edce060e5bd068b233c2f (patch)
treeeb33b4960300ecfa2d1f9f15331112fc829b85c1
parent12e580608c4abd1bf0bfbb5e3de5da5e5e83eeff (diff)
Add bios dumper
-rw-r--r--README5
-rw-r--r--vbtracetool.c18
2 files changed, 20 insertions, 3 deletions
diff --git a/README b/README
index 604348d..29453f7 100644
--- a/README
+++ b/README
@@ -8,14 +8,15 @@ Building:
Run make
Running:
-./vbtracetool [-d] [-l] [-g | -p | -s MODENUMBER]
+./vbtracetool [-d] [-l] [-g | -p | -s MODENUMBER | -w]
-d gives trace output *to stderr*. you'll want to redirect that.
-l gives IO logging *to stderr*. you'll want to redirect that.
--g gets the current display mode number
+-g gets the current display mode number (default)
-p posts the card. could induce several seconds of pants cacking with -d.
-s sets the given mode number
+-w writes the bios image that would be executed by the other options *to stderr*
./postandrestore.bash [-d] [-l]
diff --git a/vbtracetool.c b/vbtracetool.c
index 8230935..9a1e88b 100644
--- a/vbtracetool.c
+++ b/vbtracetool.c
@@ -89,6 +89,16 @@ int do_post_int(unsigned pci_device)
return 0;
}
+int do_writeout_bios(void)
+{
+ int i;
+
+ for (i = 0; i < ((*((char *)0xc0002) * 512 < 0x10000) ? *((char *)0xc0002) * 512 : 0x10000); i++)
+ fprintf(stderr, "%c", *((char *)0xc0000 + i));
+
+ return 0;
+}
+
int main(int argc, char *argv[])
{
static struct pci_access *pacc;
@@ -97,7 +107,7 @@ int main(int argc, char *argv[])
unsigned int pci_id = 0, pci_vendor;
int opt, debug = 0, mode, op = 'g', opset = 0, nvlog = 0;
- while ((opt = getopt(argc, argv, "dglps:")) != -1) {
+ while ((opt = getopt(argc, argv, "dglps:w")) != -1) {
switch (opt) {
case 'd':
debug = 1;
@@ -117,6 +127,10 @@ int main(int argc, char *argv[])
opset++;
mode = atoi(optarg);
break;
+ case 'w':
+ op = 'w';
+ opset++;
+ break;
default:
opset = 2;
}
@@ -185,6 +199,8 @@ int main(int argc, char *argv[])
return (do_post_int(pci_id));
case 's':
return (do_set_mode(mode));
+ case 'w':
+ return (do_writeout_bios());
}
return 0;