diff options
author | rsc <devnull@localhost> | 2004-06-09 14:22:41 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-06-09 14:22:41 +0000 |
commit | f9aa99c72e86fa546a504d34ade4b3ca3164d9da (patch) | |
tree | de385e058928a7da9bdb678481ff1f123888d203 /src/cmd/acid | |
parent | 9c635587071dcd7db349ec24ece1b397d24ac486 (diff) | |
download | plan9port-f9aa99c72e86fa546a504d34ade4b3ca3164d9da.tar.gz plan9port-f9aa99c72e86fa546a504d34ade4b3ca3164d9da.tar.bz2 plan9port-f9aa99c72e86fa546a504d34ade4b3ca3164d9da.zip |
dumb maps again
Diffstat (limited to 'src/cmd/acid')
-rw-r--r-- | src/cmd/acid/main.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/cmd/acid/main.c b/src/cmd/acid/main.c index 712831c0..0d1909ce 100644 --- a/src/cmd/acid/main.c +++ b/src/cmd/acid/main.c @@ -26,6 +26,29 @@ usage(void) exits("usage"); } +Map* +dumbmap(int fd) +{ + Map *dumb; + Seg s; + + dumb = allocmap(); + memset(&s, 0, sizeof s); + s.fd = fd; + s.base = 0; + s.offset = 0; + s.size = 0xFFFFFFFF; + s.name = "data"; + s.file = "<dumb>"; + if(addseg(dumb, s) < 0){ + freemap(dumb); + return nil; + } + if(mach == nil) + mach = machcpu; + return dumb; +} + void main(int argc, char *argv[]) { @@ -150,7 +173,7 @@ main(int argc, char *argv[]) static int attachfiles(int argc, char **argv) { - int pid; + int fd, pid; char *s; int i, omode; Fhdr *hdr; @@ -182,6 +205,14 @@ attachfiles(int argc, char **argv) } if((hdr = crackhdr(argv[i], omode)) == nil){ fprint(2, "crackhdr %s: %r\n", argv[i]); + if(argc == 1 && (fd = open(argv[i], omode)) > 0){ + fprint(2, "loading %s direct mapped\n", argv[i]); + symmap = dumbmap(fd); + cormap = dumbmap(fd); + symfil = argv[i]; + corfil = argv[i]; + goto Run; + } continue; } fprint(2, "%s: %s %s %s\n", argv[i], hdr->aname, hdr->mname, hdr->fname); @@ -245,6 +276,7 @@ attachfiles(int argc, char **argv) mapfile(symhdr, 0, cormap, nil); } +Run: l = mkvar("objtype"); v = l->v; v->store.fmt = 's'; |