Fix glaring problems.
[rsc] --rw-rw-r-- M 208448 glenda sys 87619 Jan 3 10:38 sys/doc/9.html
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1,9 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1,10
+
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:84,90 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:85,91
It soon became clear that this model was richer
than we had foreseen, and the ideas of per-process name spaces
and file-system-like resources were extended throughout
- the systemto processes, graphics, even the network itself.
+ the system—to processes, graphics, even the network itself.
By 1989 the system had become solid enough
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:142,148 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:143,149
It also serves as an introduction to the rest of the Plan 9 Programmer's Manual,
which it accompanies. More detail about topics in this paper
can be found elsewhere in the manual.
-
+
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:167,173 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:168,174
in Plan 9 terminology.
Figure 1 shows the arrangement.
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:265,271 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:266,272
(This is a distinction from `object-oriented' models, where these issues
must be faced anew for every class of object.)
Examples in the sections that follow illustrate these ideas in action.
-
+
The Command-level View
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:272,287 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:273,288
Plan 9 is meant to be used from a machine with a screen running
the window system.
It has no notion of `teletype' in the UNIX sense. The keyboard handling of
- the bare system is rudimentary, but once the window system, 8½ [Pike91],
+ the bare system is rudimentary, but once the window system, 8½ [Pike91],
is running,
text can be edited with `cut and paste' operations from a pop-up menu,
copied between windows, and so on.
- 8½ permits editing text from the past, not just on the current input line.
- The text-editing capabilities of 8½ are strong enough to displace
+ 8½ permits editing text from the past, not just on the current input line.
+ The text-editing capabilities of 8½ are strong enough to displace
special features such as history in the shell,
paging and scrolling,
and mail editors.
- 8½ windows do not support cursor addressing and,
+ 8½ windows do not support cursor addressing and,
except for one terminal emulator to simplify connecting to traditional systems,
there is no cursor-addressing software in Plan 9.
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:307,320 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:308,321
/dev/cons
(analogous to UNIX's
/dev/tty).
- These files are provided by 8½, which is implemented as a file server.
+ These files are provided by 8½, which is implemented as a file server.
Unlike X windows, where a new application typically creates a new window
- to run in, an 8½ graphics application usually runs in the window where it starts.
+ to run in, an 8½ graphics application usually runs in the window where it starts.
It is possible and efficient for an application to create a new window, but
that is not the style of the system.
Again contrasting to X, in which a remote application makes a network
call to the X server to start running,
- a remote 8½ application sees the
+ a remote 8½ application sees the
mouse,
bitblt,
and
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:366,372 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:367,373
Compatibility was not a requirement for the system.
Where the old commands or notation seemed good enough, we
kept them. When they didn't, we replaced them.
-
+
The File Server
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:491,497 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:492,498
If we were to upgrade to the new media,
we would have more free space than in the original empty jukebox.
Technology has created storage faster than we can use it.
-
+
Unusual file servers
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:503,511 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:504,512
There are dozens of such servers; in this section we present three representative ones.
- Perhaps the most remarkable file server in Plan 9 is 8½, the window system.
+ Perhaps the most remarkable file server in Plan 9 is 8½, the window system.
It is discussed at length elsewhere [Pike91], but deserves a brief explanation here.
- 8½ provides two interfaces: to the user seated at the terminal, it offers a traditional
+ 8½ provides two interfaces: to the user seated at the terminal, it offers a traditional
style of interaction with multiple windows, each running an application, all controlled
by a mouse and keyboard.
To the client programs, the view is also fairly traditional:
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:526,552 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:527,553
bitblt
(RasterOp).
What is unusual is how this is done:
- 8½ is a file server, serving the files in
+ 8½ is a file server, serving the files in
/dev
to the clients running in each window.
Although every window looks the same to its client,
each window has a distinct set of files in
/dev.
- 8½ multiplexes its clients' access to the resources of the terminal
+ 8½ multiplexes its clients' access to the resources of the terminal
by serving multiple sets of files. Each client is given a private name space
with a
different
set of files that behave the same as in all other windows.
There are many advantages to this structure.
- One is that 8½ serves the same files it needs for its own implementationit
- multiplexes its own interfaceso it may be run, recursively, as a client of itself.
+ One is that 8½ serves the same files it needs for its own implementation—it
+ multiplexes its own interface—so it may be run, recursively, as a client of itself.
Also, consider the implementation of
/dev/tty
in UNIX, which requires special code in the kernel to redirect
open
calls to the appropriate device.
- Instead, in 8½ the equivalent service falls out
- automatically: 8½ serves
+ Instead, in 8½ the equivalent service falls out
+ automatically: 8½ serves
/dev/cons
as its basic function; there is nothing extra to do.
When a program wants to
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:557,563 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:558,564
the files within them make it natural.
- 8½ has a unique feature made possible by its design.
+ 8½ has a unique feature made possible by its design.
Because it is implemented as a file server,
it has the power to postpone answering read requests for a particular window.
This behavior is toggled by a reserved key on the keyboard.
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:690,696 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:691,697
to start a window system in a window running a
cpu
command; all windows created there automatically start processes on the CPU server.
-
+
Configurability and administration
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:716,723 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:717,724
by storing private information on local disk.
We reject this style of use,
although the system itself can be used this way.
- In our group, we have a laboratory with many public-access machinesa terminal
- roomand a user may sit down at any one of them and work.
+ In our group, we have a laboratory with many public-access machines—a terminal
+ room—and a user may sit down at any one of them and work.
Central file servers centralize not just the files, but also their administration
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:772,778 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:773,779
is instead spent on the newest, fastest multiprocessor servers.
We estimate this costs about half the money of networked workstations
yet provides general access to more powerful machines.
-
+
C Programming
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:805,811 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:806,812
so all C source files include
<libc.h>.
These rules guarantee that all functions
- are called with arguments having the expected types something
+ are called with arguments having the expected types — something
that was not true with pre-ANSI C programs.
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:909,915 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:910,916
To port network-based software such as X Windows, it was necessary to add
some extensions to those
specifications, such as the BSD networking functions.
-
+
Portability and Compilation
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1047,1053 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1048,1054
Although simple-minded, this technique works well in practice:
all applications in Plan 9 are built from a single source tree
and it is possible to build the various architectures in parallel without conflict.
-
+
Parallel programming
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1114,1120 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1115,1121
rfork
with the same bits set; programs
use it to create many different forms of sharing and resource allocation.
- A system with just two types of processesregular processes and threadscould
+ A system with just two types of processes—regular processes and threads—could
not handle this variety.
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1217,1223 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1218,1224
careful operating system support can reduce the difficulty of writing
multi-threaded applications without moving threading and
synchronization primitives into the kernel.
-
+
Implementation of Name Spaces
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1537,1543 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1538,1544
as an entry in the mount table, they are the same file and the
corresponding substitution from the mount table is made.
This is how the name space is implemented.
-
+
File Caching
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1559,1571 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1560,1572
This user-level server interposes on the 9P connection to the remote server and
monitors the traffic, copying data to a local disk.
When it sees a read of known data, it answers directly,
- while writes are passed on immediatelythe cache is write-throughto keep
+ while writes are passed on immediately—the cache is write-through—to keep
the central copy up to date.
This is transparent to processes on the terminal and requires no change to 9P;
it works well on home machines connected over serial lines.
A similar method can be applied to build a general client cache in unused local
memory, but this has not been done in Plan 9.
-
+
Networks and Communication Devices
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1686,1692 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1687,1693
The uniform structure for networks in Plan 9 makes the
import
command all that is needed to construct gateways.
-
+
Kernel structure for networks
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1709,1715 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1710,1716
Each module calls the succeeding one to send data up or down the stream.
Like UNIX streams [Rit84],
Plan 9 streams can be dynamically configured.
-
+
The IL Protocol
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1739,1745 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1740,1746
In Plan 9, the implementation of IL is smaller and faster than TCP.
IL is our main Internet transport protocol.
-
+
Overview of authentication
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1804,1815 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1805,1816
Plan 9's authentication structure builds
secure services rather than depending on firewalls.
Whereas firewalls require special code for every service penetrating the wall,
- the Plan 9 approach permits authentication to be done in a single place9Pfor
+ the Plan 9 approach permits authentication to be done in a single place—9P—for
all services.
For example, the
cpu
command works securely across the Internet.
-
+
Authenticating external connections
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1826,1832 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1827,1833
and keys are never sent over the network,
this procedure is not susceptible to replay attacks, yet
is compatible with protocols like Telnet and FTP.
-
+
Special users
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1880,1886 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1881,1887
by binding them explicitly into the space.
A restricted name space is more secure than the usual technique of exporting
an ad hoc directory tree; the result is a kind of cage around untrusted users.
-
+
The cpu command and proxied authentication
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1915,1921 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1916,1922
in one domain is the same person as user
rtmorris
in another.
-
+
File Permissions
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:1990,1996 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:1991,1997
it is read-protected forever.
Drawbacks are that if the file is readable but should have been read-protected,
it is readable forever, and that user names are hard to re-use.
-
+
Performance
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:2022,2034 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:2023,2035
It also measures the time to send a byte on a pipe from one process
to another and the throughput on a pipe between two processes.
The results appear in Table 1.
-
+
Table 1. Performance comparison.
Although the Plan 9 times are not spectacular, they show that the kernel is
competitive with commercial systems.
- Discussion
+ Discussion
Plan 9 has a relatively conventional kernel;
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:2173,2179 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:2174,2180
to solve our problems.
Through this process, Plan 9 has become a comfortable, productive programming
environment, as well as a vehicle for further systems research.
-
+
References
- [9man]
-
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:2203,2209 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:2204,2210
- [ISO10646]
-
ISO/IEC DIS 10646-1:1993
Information technology -
- Universal Multiple-Octet Coded Character Set (UCS)
+ Universal Multiple-Octet Coded Character Set (UCS) —
Part 1: Architecture and Basic Multilingual Plane.
- [Kill84]
-
T.J. Killian,
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:2255,2261 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:2256,2262
Software - Practice and Experience,
Nov 1987, 17(11), pp. 813-845; reprinted in this volume.
- [Pike91]
-
- Rob Pike, ``8½, the Plan 9 Window System'',
+ Rob Pike, ``8½, the Plan 9 Window System'',
USENIX Summer Conf. Proc.,
Nashville, June, 1991, pp. 257-265,
reprinted in this volume.
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:2279,2285 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:2280,2286
Murray Hill, NJ,
1995.
- [POSIX]
-
- Information TechnologyPortable Operating
+ Information Technology—Portable Operating
System Interface (POSIX) Part 1:
System Application Program Interface (API)
[C Language],
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:2333,2339 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:2334,2340
63(8), October, 1984.
- [Tric95]
-
Howard Trickey,
- ``APE The ANSI/POSIX Environment'',
+ ``APE — The ANSI/POSIX Environment'',
Plan 9 Programmer's Manual,
Volume 2,
AT&T Bell Laboratories,
/n/sourcesdump/2006/0103/plan9/sys/doc/9.html:2368,2372 -
/n/sourcesdump/2006/0104/plan9/sys/doc/9.html:2369,2373
- Copyright © 2004 Lucent Technologies Inc. All rights reserved.
+ Copyright © 2006 Lucent Technologies Inc. All rights reserved.
[rsc] --rw-rw-r-- M 208448 glenda sys 87619 Jan 3 10:38 sys/doc/9.html
[rsc] --rw-rw-r-- M 208448 glenda sys 87619 Jan 3 10:38 sys/doc/9.html
Cleanup.
[jmk] --rw-rw-r-- M 208448 glenda sys 15220 Jan 3 13:17 sys/src/cmd/acid/expr.c
/n/sourcesdump/2006/0103/plan9/sys/src/cmd/acid/expr.c:20,28 -
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/acid/expr.c:20,28
['S'] 4,
['U'] 4,
['V'] 8,
+ ['W'] 8,
['X'] 4,
['Y'] 8,
- ['W'] 8,
['Z'] 8,
['a'] 4,
['b'] 1,
[jmk] --rw-rw-r-- M 208448 glenda sys 4671 Jan 3 13:17 sys/src/cmd/acid/util.c
/n/sourcesdump/2006/0103/plan9/sys/src/cmd/acid/util.c:190,200 -
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/acid/util.c:190,206
if(s == 0)
fatal("rget: %s\n", reg);
- if(s->v->fmt == 'W')
- ret = get8(map, s->v->ival, &v);
- else {
+ switch(s->v->fmt){
+ default:
ret = get4(map, s->v->ival, &x);
v = x;
+ break;
+ case 'V':
+ case 'W':
+ case 'Y':
+ case 'Z':
+ ret = get8(map, s->v->ival, &v);
+ break;
}
if(ret < 0)
error("can't get register %s: %r\n", reg);
/n/sourcesdump/2006/0103/plan9/sys/src/cmd/acid/util.c:190,200 -
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/acid/util.c:190,206
if(s == 0)
fatal("rget: %s\n", reg);
- if(s->v->fmt == 'W')
- ret = get8(map, s->v->ival, &v);
- else {
+ switch(s->v->fmt){
+ default:
ret = get4(map, s->v->ival, &x);
v = x;
+ break;
+ case 'V':
+ case 'W':
+ case 'Y':
+ case 'Z':
+ ret = get8(map, s->v->ival, &v);
+ break;
}
if(ret < 0)
error("can't get register %s: %r\n", reg);
More 64-bit fixes and cleanups.
[jmk] --rw-rw-r-- M 208448 glenda sys 61334 Jan 3 16:06 sys/src/libmach/2db.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/2db.c:1296,1301 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/2db.c:1296,1303
return 0;
}
+ #pragma varargck argpos bprint 2
+
static void
bprint(Inst *i, char *fmt, ...)
{
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/2db.c:1315,1321 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/2db.c:1317,1324
static void
plocal(Inst *ip, Operand *ap)
{
- int ret, offset;
+ int ret;
+ long offset;
uvlong moved;
Symbol s;
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/2db.c:1533,1539 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/2db.c:1536,1542
case ADisp: /* references off the static base */
if (reg == 6 && mach->sb && ap->disp) {
ip->curr += symoff(ip->curr, left, ap->disp+mach->sb, CANY);
- bprint(ip, "(SB)", reg);
+ bprint(ip, "(SB)");
break;
}
/* reference autos and parameters off the stack */
[jmk] --rw-rw-r-- M 208448 glenda sys 21586 Jan 3 16:06 sys/src/libmach/5db.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/5db.c:212,217 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/5db.c:212,219
return 1;
}
+ #pragma varargck argpos bprint 2
+
static void
bprint(Instr *i, char *fmt, ...)
{
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/5db.c:254,260 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/5db.c:256,262
class == CAUTO ? " auto" : "param", offset);
return 0;
}
- bprint(i, "%s%c%d%s", s.name, class == CPARAM ? '+' : '-', s.value, reg);
+ bprint(i, "%s%c%lld%s", s.name, class == CPARAM ? '+' : '-', s.value, reg);
return 1;
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/5db.c:885,895 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/5db.c:887,897
break;
case 'M':
- bprint(i, "%d", (i->w>>8) & 0xf);
+ bprint(i, "%lud", (i->w>>8) & 0xf);
break;
case 'm':
- bprint(i, "%d", (i->w>>7) & 0x1f);
+ bprint(i, "%lud", (i->w>>7) & 0x1f);
break;
case 'h':
[jmk] --rw-rw-r-- M 208448 glenda sys 17355 Jan 3 16:06 sys/src/libmach/7db.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/7db.c:169,174 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/7db.c:169,176
return 1;
}
+ #pragma varargck argpos bprint 2
+
static void
bprint(Instr *i, char *fmt, ...)
{
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/7db.c:256,262 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/7db.c:258,264
if (i->rb == 29 && mach->sb) {
bprint(i, "%s\t%c%d,", m, r, i->ra);
i->curr += symoff(i->curr, i->end-i->curr, i->mem+mach->sb, CANY);
- bprint(i, "(SB)", r, i->ra);
+ bprint(i, "(SB)");
return;
}
format(o->mnemonic, i, o->ken);
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/7db.c:769,775 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/7db.c:771,777
case 'v':
if (i->islit)
- bprint(i, "$%lx", i->literal);
+ bprint(i, "$%ux", i->literal);
else
bprint(i, "R%d", i->rb);
break;
[jmk] --rw-rw-r-- M 208448 glenda sys 50889 Jan 3 16:06 sys/src/libmach/8db.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/8db.c:1701,1706 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/8db.c:1701,1708
return op;
}
+ #pragma varargck argpos bprint 2
+
static void
bprint(Instr *ip, char *fmt, ...)
{
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/8db.c:1750,1756 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/8db.c:1752,1759
static void
plocal(Instr *ip)
{
- int ret, offset;
+ int ret;
+ long offset;
Symbol s;
char *reg;
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/8db.c:1975,1981 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/8db.c:1978,1984
bprint(ip, "CBW");
break;
case 'd':
- bprint(ip,"%lux:%lux",ip->seg,ip->disp);
+ bprint(ip,"%ux:%lux",ip->seg,ip->disp);
break;
case 'm':
if (ip->mod == 3 && ip->osize != 'B') {
[jmk] --rw-rw-r-- M 208448 glenda sys 21222 Jan 3 16:06 sys/src/libmach/kdb.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:277,282 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:277,302
[0x1F] "swapa", loada, 0,
};
+ #pragma varargck argpos bprint 2
+ #pragma varargck type "T" char*
+
+ /* convert to lower case from upper, according to dascase */
+ static int
+ Tfmt(Fmt *f)
+ {
+ char buf[128];
+ char *s, *t, *oa;
+
+ oa = va_arg(f->args, char*);
+ if(dascase){
+ for(s=oa,t=buf; *t = *s; s++,t++)
+ if('A'<=*t && *t<='Z')
+ *t += 'a'-'A';
+ return fmtstrcpy(f, buf);
+ }
+ return fmtstrcpy(f, oa);
+ }
+
static void
bprint(Instr *i, char *fmt, ...)
{
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:375,381 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:395,401
break;
case 1:
- bprint(&instr, "%X", "CALL\t");
+ bprint(&instr, "%T", "CALL\t");
instr.curr += symoff(instr.curr, instr.end-instr.curr,
pc+instr.disp30*4, CTEXT);
if (!dascase)
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:406,429 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:426,432
return instr.size*4;
}
- /* convert to lower case from upper, according to dascase */
static int
- Xfmt(Fmt *f)
- {
- char buf[128];
- char *s, *t, *oa;
-
- oa = va_arg(f->args, char*);
- if(dascase){
- for(s=oa,t=buf; *t = *s; s++,t++)
- if('A'<=*t && *t<='Z')
- *t += 'a'-'A';
- return fmtstrcpy(f, buf);
- }
- return fmtstrcpy(f, oa);
- }
-
- static int
sparcinst(Map *map, uvlong pc, char modifier, char *buf, int n)
{
static int fmtinstalled = 0;
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:431,437 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:434,440
/* a modifier of 'I' toggles the dissassembler type */
if (!fmtinstalled) {
fmtinstalled = 1;
- fmtinstall('X', Xfmt);
+ fmtinstall('T', Tfmt);
}
if ((asstype == ASUNSPARC && modifier == 'i')
|| (asstype == ASPARC && modifier == 'I'))
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:483,489 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:486,492
return -1;
if (s.value > i->simm13) {
if(getauto(&s, s.value-i->simm13, CAUTO, &s)) {
- bprint(i, "%s+%d(SP)", s.name, s.value);
+ bprint(i, "%s+%lld(SP)", s.name, s.value);
return 1;
}
} else {
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:518,534 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:521,537
}
bprint(i, "%s", s.name);
if (s.value != off)
- bprint(i, "+%lux", s.value-off);
+ bprint(i, "+%llux", s.value-off);
bprint(i, "(SB)");
return;
}
- bprint(i, "%lux(R%d)", i->simm13, i->rs1);
+ bprint(i, "%ux(R%d)", i->simm13, i->rs1);
}
static void
unimp(Instr *i, char *m)
{
- bprint(i, "%X", m);
+ bprint(i, "%T", m);
}
static char *bratab[16] = { /* page 91 */
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:595,603 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:598,606
imm = i->simmdisp22;
if(i->a)
- bprint(i, "%X%X.%c\t", m, tab[i->cond], 'A'+dascase);
+ bprint(i, "%T%T.%c\t", m, tab[i->cond], 'A'+dascase);
else
- bprint(i, "%X%X\t", m, tab[i->cond]);
+ bprint(i, "%T%T\t", m, tab[i->cond]);
i->curr += symoff(i->curr, i->end-i->curr, i->addr+4*imm, CTEXT);
if (!dascase)
bprint(i, "(SB)");
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:625,633 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:628,636
trap(Instr *i, char *m) /* page 101 */
{
if(i->i == 0)
- bprint(i, "%X%X\tR%d+R%d", m, bratab[i->cond], i->rs2, i->rs1);
+ bprint(i, "%T%T\tR%d+R%d", m, bratab[i->cond], i->rs2, i->rs1);
else
- bprint(i, "%X%X\t$%lux+R%d", m, bratab[i->cond], i->simm13, i->rs1);
+ bprint(i, "%T%T\t$%ux+R%d", m, bratab[i->cond], i->simm13, i->rs1);
}
static void
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:637,643 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:640,646
imm = i->immdisp22<<10;
if(dascase){
- bprint(i, "%X\t%lux, R%d", m, imm, i->rd);
+ bprint(i, "%T\t%lux, R%d", m, imm, i->rd);
return;
}
if(imm==0 && i->rd==0){
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:733,757 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:736,760
if(i->i == 0){
if(i->rs1 == i->rd)
if(dascase)
- bprint(i, "%X\tR%d, R%d", m, i->rs1, i->rs2);
+ bprint(i, "%T\tR%d, R%d", m, i->rs1, i->rs2);
else
- bprint(i, "%X\tR%d, R%d", m, i->rs2, i->rs1);
+ bprint(i, "%T\tR%d, R%d", m, i->rs2, i->rs1);
else
if(dascase)
- bprint(i, "%X\tR%d, R%d, R%d", m, i->rs1, i->rs2, i->rd);
+ bprint(i, "%T\tR%d, R%d, R%d", m, i->rs1, i->rs2, i->rd);
else
- bprint(i, "%X\tR%d, R%d, R%d", m, i->rs2, i->rs1, i->rd);
+ bprint(i, "%T\tR%d, R%d, R%d", m, i->rs2, i->rs1, i->rd);
}else{
if(i->rs1 == i->rd)
if(dascase)
- bprint(i, "%X\t$%d,R%d", m, i->simm13&0x1F, i->rs1);
+ bprint(i, "%T\t$%d,R%d", m, i->simm13&0x1F, i->rs1);
else
- bprint(i, "%X\tR%d, $%d", m, i->rs1, i->simm13&0x1F);
+ bprint(i, "%T\tR%d, $%d", m, i->rs1, i->simm13&0x1F);
else
if(dascase)
- bprint(i, "%X\tR%d, $%d, R%d",m,i->rs1,i->simm13&0x1F,i->rd);
+ bprint(i, "%T\tR%d, $%d, R%d",m,i->rs1,i->simm13&0x1F,i->rd);
else
- bprint(i, "%X\t$%d, R%d, R%d",m,i->simm13&0x1F,i->rs1,i->rd);
+ bprint(i, "%T\t$%d, R%d, R%d",m,i->simm13&0x1F,i->rs1,i->rd);
}
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:760,783 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:763,786
{
if(i->i == 0){
if(dascase)
- bprint(i, "%X\tR%d, R%d", m, i->rs1, i->rs2);
+ bprint(i, "%T\tR%d, R%d", m, i->rs1, i->rs2);
else
if(i->op3==2 && i->rs1==0 && i->rd) /* OR R2, R0, R1 */
bprint(i, "MOVW\tR%d", i->rs2);
else
- bprint(i, "%X\tR%d, R%d", m, i->rs2, i->rs1);
+ bprint(i, "%T\tR%d, R%d", m, i->rs2, i->rs1);
}else{
if(dascase)
- bprint(i, "%X\tR%d, $%lux", m, i->rs1, i->simm13);
+ bprint(i, "%T\tR%d, $%ux", m, i->rs1, i->simm13);
else
if(i->op3==0 && i->rd && i->rs1==0) /* ADD $x, R0, R1 */
- bprint(i, "MOVW\t$%lux", i->simm13);
+ bprint(i, "MOVW\t$%ux", i->simm13);
else if(i->op3==0 && i->rd && i->rs1==2){
/* ADD $x, R2, R1 -> MOVW $x(SB), R1 */
bprint(i, "MOVW\t$");
address(i);
} else
- bprint(i, "%X\t$%lux, R%d", m, i->simm13, i->rs1);
+ bprint(i, "%T\t$%ux, R%d", m, i->simm13, i->rs1);
}
if(i->rs1 != i->rd)
bprint(i, ", R%d", i->rd);
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:793,799 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:796,802
if(i->i == 0)
bprint(i, "CMP\tR%d, R%d", i->rs1, i->rs2);
else
- bprint(i, "CMP\tR%d, $%lux", i->rs1, i->simm13);
+ bprint(i, "CMP\tR%d, $%ux", i->rs1, i->simm13);
}
static char *regtab[4] = {
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:810,816 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:813,819
if(i->i == 0)
bprint(i, "%s\tR%d, R%d", m, i->rs1, i->rs2);
else
- bprint(i, "%s\tR%d, $%lux", m, i->rs1, i->simm13);
+ bprint(i, "%s\tR%d, $%ux", m, i->rs1, i->simm13);
}else{
if(i->i && i->simm13==0)
bprint(i, "MOVW\tR%d", i->rs1);
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:817,823 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:820,826
else if(i->i == 0)
bprint(i, "wr\tR%d, R%d", i->rs2, i->rs1);
else
- bprint(i, "wr\t$%lux, R%d", i->simm13, i->rs1);
+ bprint(i, "wr\t$%ux, R%d", i->simm13, i->rs1);
}
bprint(i, ", %s", regtab[i->op3&3]);
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:842,855 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:845,858
{
if(i->i == 0){
if(i->rd == 15)
- bprint(i, "%X\t(R%d+R%d)", "CALL", i->rs2, i->rs1);
+ bprint(i, "%T\t(R%d+R%d)", "CALL", i->rs2, i->rs1);
else
- bprint(i, "%X\t(R%d+R%d), R%d", m, i->rs2, i->rs1, i->rd);
+ bprint(i, "%T\t(R%d+R%d), R%d", m, i->rs2, i->rs1, i->rd);
}else{
if(!dascase && i->simm13==8 && i->rs1==15 && i->rd==0)
bprint(i, "RETURN");
else{
- bprint(i, "%X\t", m);
+ bprint(i, "%T\t", m);
address(i);
bprint(i, ", R%d", i->rd);
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/kdb.c:995,1009 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/kdb.c:998,1012
}
for(j=0; fptab1[j].name; j++)
if(fptab1[j].opf == i->opf){
- bprint(i, "%X\tF%d, F%d", fptab1[j].name, i->rs2, i->rd);
+ bprint(i, "%T\tF%d, F%d", fptab1[j].name, i->rs2, i->rd);
return;
}
for(j=0; fptab2[j].name; j++)
if(fptab2[j].opf == i->opf){
- bprint(i, "%X\tF%d, F%d, F%d", fptab2[j].name, i->rs1, i->rs2, i->rd);
+ bprint(i, "%T\tF%d, F%d, F%d", fptab2[j].name, i->rs1, i->rs2, i->rd);
return;
}
- bprint(i, "%X%ux\tF%d, F%d, F%d", m, i->opf, i->rs1, i->rs2, i->rd);
+ bprint(i, "%T%ux\tF%d, F%d, F%d", m, i->opf, i->rs1, i->rs2, i->rd);
}
static int
[jmk] --rw-rw-r-- M 208448 glenda sys 27544 Jan 3 16:06 sys/src/libmach/qdb.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:157,162 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:157,164
#define IBF(v,a,b) (((ulong)(v)>>(32-(b)-1)) & ~(~0L<<(((b)-(a)+1))))
#define IB(v,b) IBF((v),(b),(b))
+ #pragma varargck argpos bprint 2
+
static void
bprint(Instr *i, char *fmt, ...)
{
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:250,256 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:252,258
static int
plocal(Instr *i)
{
- int offset;
+ long offset;
Symbol s;
if (!findsym(i->addr, CTEXT, &s) || !findlocal(&s, FRAMENAME, &s))
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:258,269 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:260,271
offset = s.value - i->immediate;
if (offset > 0) {
if(getauto(&s, offset, CAUTO, &s)) {
- bprint(i, "%s+%d(SP)", s.name, s.value);
+ bprint(i, "%s+%lld(SP)", s.name, s.value);
return 1;
}
} else {
if (getauto(&s, -offset-4, CPARAM, &s)) {
- bprint(i, "%s+%d(FP)", s.name, -offset);
+ bprint(i, "%s+%ld(FP)", s.name, -offset);
return 1;
}
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:289,301 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:291,303
}
bprint(i, "%s", s.name);
if (s.value != off)
- bprint(i, "+%lux", off-s.value);
+ bprint(i, "+%llux", off-s.value);
bprint(i, reg);
return 1;
}
if(!anyoff)
return 0;
- bprint(i, "%lux%s", off, reg);
+ bprint(i, "%llux%s", off, reg);
return 1;
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:307,313 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:309,315
if (i->ra == REGSB && mach->sb && pglobal(i, mach->sb+i->immediate, 0, "(SB)") >= 0)
return;
if(i->simm < 0)
- bprint(i, "-%lx(R%d)", -i->simm, i->ra);
+ bprint(i, "-%x(R%d)", -i->simm, i->ra);
else
bprint(i, "%lux(R%d)", i->immediate, i->ra);
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:389,395 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:391,397
address(i);
bprint(i, ",R%d", i->rd);
} else if(i->op==15 && v < 0) {
- bprint(i, "SUB\t$%d,R%d", -v, i->ra);
+ bprint(i, "SUB\t$%ld,R%d", -v, i->ra);
if(i->rd != i->ra)
bprint(i, ",R%d", i->rd);
} else {
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:1058,1074 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:1060,1076
case 'l':
if(i->simm < 0)
- bprint(i, "-%lx(R%d)", -i->simm, i->ra);
+ bprint(i, "-%x(R%d)", -i->simm, i->ra);
else
- bprint(i, "%lx(R%d)", i->simm, i->ra);
+ bprint(i, "%x(R%d)", i->simm, i->ra);
break;
case 'i':
- bprint(i, "$%ld", i->simm);
+ bprint(i, "$%d", i->simm);
break;
case 'I':
- bprint(i, "$%lx", i->uimm);
+ bprint(i, "$%ux", i->uimm);
break;
case 'w':
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:1099,1109 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:1101,1111
break;
case 'm':
- bprint(i, "%lx", i->crm);
+ bprint(i, "%ux", i->crm);
break;
case 'M':
- bprint(i, "%lx", i->fm);
+ bprint(i, "%ux", i->fm);
break;
case 'z':
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:157,162 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:157,164
#define IBF(v,a,b) (((ulong)(v)>>(32-(b)-1)) & ~(~0L<<(((b)-(a)+1))))
#define IB(v,b) IBF((v),(b),(b))
+ #pragma varargck argpos bprint 2
+
static void
bprint(Instr *i, char *fmt, ...)
{
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:250,256 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:252,258
static int
plocal(Instr *i)
{
- int offset;
+ long offset;
Symbol s;
if (!findsym(i->addr, CTEXT, &s) || !findlocal(&s, FRAMENAME, &s))
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:258,269 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:260,271
offset = s.value - i->immediate;
if (offset > 0) {
if(getauto(&s, offset, CAUTO, &s)) {
- bprint(i, "%s+%d(SP)", s.name, s.value);
+ bprint(i, "%s+%lld(SP)", s.name, s.value);
return 1;
}
} else {
if (getauto(&s, -offset-4, CPARAM, &s)) {
- bprint(i, "%s+%d(FP)", s.name, -offset);
+ bprint(i, "%s+%ld(FP)", s.name, -offset);
return 1;
}
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:289,301 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:291,303
}
bprint(i, "%s", s.name);
if (s.value != off)
- bprint(i, "+%lux", off-s.value);
+ bprint(i, "+%llux", off-s.value);
bprint(i, reg);
return 1;
}
if(!anyoff)
return 0;
- bprint(i, "%lux%s", off, reg);
+ bprint(i, "%llux%s", off, reg);
return 1;
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:307,313 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:309,315
if (i->ra == REGSB && mach->sb && pglobal(i, mach->sb+i->immediate, 0, "(SB)") >= 0)
return;
if(i->simm < 0)
- bprint(i, "-%lx(R%d)", -i->simm, i->ra);
+ bprint(i, "-%x(R%d)", -i->simm, i->ra);
else
bprint(i, "%lux(R%d)", i->immediate, i->ra);
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:389,395 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:391,397
address(i);
bprint(i, ",R%d", i->rd);
} else if(i->op==15 && v < 0) {
- bprint(i, "SUB\t$%d,R%d", -v, i->ra);
+ bprint(i, "SUB\t$%ld,R%d", -v, i->ra);
if(i->rd != i->ra)
bprint(i, ",R%d", i->rd);
} else {
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:1058,1074 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:1060,1076
case 'l':
if(i->simm < 0)
- bprint(i, "-%lx(R%d)", -i->simm, i->ra);
+ bprint(i, "-%x(R%d)", -i->simm, i->ra);
else
- bprint(i, "%lx(R%d)", i->simm, i->ra);
+ bprint(i, "%x(R%d)", i->simm, i->ra);
break;
case 'i':
- bprint(i, "$%ld", i->simm);
+ bprint(i, "$%d", i->simm);
break;
case 'I':
- bprint(i, "$%lx", i->uimm);
+ bprint(i, "$%ux", i->uimm);
break;
case 'w':
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/qdb.c:1099,1109 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/qdb.c:1101,1111
break;
case 'm':
- bprint(i, "%lx", i->crm);
+ bprint(i, "%ux", i->crm);
break;
case 'M':
- bprint(i, "%lx", i->fm);
+ bprint(i, "%ux", i->fm);
break;
case 'z':
[jmk] --rw-rw-r-- M 208448 jmk sys 21967 Jan 3 16:06 sys/src/libmach/udb.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:304,309 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:304,329
[0x1F] "swapa", loada, 0,
};
+ #pragma varargck argpos bprint 2
+ #pragma varargck type "T" char*
+
+ /* convert to lower case from upper, according to dascase */
+ static int
+ Tfmt(Fmt *f)
+ {
+ char buf[128];
+ char *s, *t, *oa;
+
+ oa = va_arg(f->args, char*);
+ if(dascase){
+ for(s=oa,t=buf; *t = *s; s++,t++)
+ if('A'<=*t && *t<='Z')
+ *t += 'a'-'A';
+ return fmtstrcpy(f, buf);
+ }
+ return fmtstrcpy(f, oa);
+ }
+
static void
bprint(Instr *i, char *fmt, ...)
{
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:402,408 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:422,428
break;
case 1:
- bprint(&instr, "%X", "CALL\t");
+ bprint(&instr, "CALL\t");
instr.curr += symoff(instr.curr, instr.end-instr.curr,
pc+instr.disp30*4, CTEXT);
if (!dascase)
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:433,456 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:453,459
return instr.size*4;
}
- /* convert to lower case from upper, according to dascase */
static int
- Xfmt(Fmt *f)
- {
- char buf[128];
- char *s, *t, *oa;
-
- oa = va_arg(f->args, char*);
- if(dascase){
- for(s=oa,t=buf; *t = *s; s++,t++)
- if('A'<=*t && *t<='Z')
- *t += 'a'-'A';
- return fmtstrcpy(f, buf);
- }
- return fmtstrcpy(f, oa);
- }
-
- static int
sparc64inst(Map *map, uvlong pc, char modifier, char *buf, int n)
{
static int fmtinstalled = 0;
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:458,464 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:461,467
/* a modifier of 'I' toggles the dissassembler type */
if (!fmtinstalled) {
fmtinstalled = 1;
- fmtinstall('X', Xfmt);
+ fmtinstall('T', Tfmt);
}
if ((asstype == ASUNSPARC && modifier == 'i')
|| (asstype == ASPARC && modifier == 'I'))
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:503,509 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:506,512
static int
plocal(Instr *i)
{
- int offset;
+ long offset;
Symbol s;
if (!findsym(i->addr, CTEXT, &s) || !findlocal(&s, FRAMENAME, &s))
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:510,522 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:513,525
return -1;
if (s.value > i->simm13) {
if(getauto(&s, s.value-i->simm13, CAUTO, &s)) {
- bprint(i, "%s+%d(SP)", s.name, s.value);
+ bprint(i, "%s+%lld(SP)", s.name, s.value);
return 1;
}
} else {
offset = i->simm13-s.value;
if (getauto(&s, offset-4, CPARAM, &s)) {
- bprint(i, "%s+%d(FP)", s.name, offset);
+ bprint(i, "%s+%ld(FP)", s.name, offset);
return 1;
}
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:545,561 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:548,564
}
bprint(i, "%s", s.name);
if (s.value != off)
- bprint(i, "+%lux", s.value-off);
+ bprint(i, "+%llux", s.value-off);
bprint(i, "(SB)");
return;
}
- bprint(i, "%lux(R%d)", i->simm13, i->rs1);
+ bprint(i, "%ux(R%d)", i->simm13, i->rs1);
}
static void
unimp(Instr *i, char *m)
{
- bprint(i, "%X", m);
+ bprint(i, "%T", m);
}
static char *bratab[16] = { /* page 91 */
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:622,630 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:625,633
imm = i->simmdisp22;
if(i->a)
- bprint(i, "%X%X.%c\t", m, tab[i->cond], 'A'+dascase);
+ bprint(i, "%T%T.%c\t", m, tab[i->cond], 'A'+dascase);
else
- bprint(i, "%X%X\t", m, tab[i->cond]);
+ bprint(i, "%T%T\t", m, tab[i->cond]);
i->curr += symoff(i->curr, i->end-i->curr, i->addr+4*imm, CTEXT);
if (!dascase)
bprint(i, "(SB)");
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:652,660 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:655,663
trap(Instr *i, char *m) /* page 101 */
{
if(i->i == 0)
- bprint(i, "%X%X\tR%d+R%d", m, bratab[i->cond], i->rs2, i->rs1);
+ bprint(i, "%T%T\tR%d+R%d", m, bratab[i->cond], i->rs2, i->rs1);
else
- bprint(i, "%X%X\t$%lux+R%d", m, bratab[i->cond], i->simm13, i->rs1);
+ bprint(i, "%T%T\t$%ux+R%d", m, bratab[i->cond], i->simm13, i->rs1);
}
static void
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:664,670 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:667,673
imm = i->immdisp22<<10;
if(dascase){
- bprint(i, "%X\t%lux, R%d", m, imm, i->rd);
+ bprint(i, "%T\t%lux, R%d", m, imm, i->rd);
return;
}
if(imm==0 && i->rd==0){
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:760,784 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:763,787
if(i->i == 0){
if(i->rs1 == i->rd)
if(dascase)
- bprint(i, "%X\tR%d, R%d", m, i->rs1, i->rs2);
+ bprint(i, "%T\tR%d, R%d", m, i->rs1, i->rs2);
else
- bprint(i, "%X\tR%d, R%d", m, i->rs2, i->rs1);
+ bprint(i, "%T\tR%d, R%d", m, i->rs2, i->rs1);
else
if(dascase)
- bprint(i, "%X\tR%d, R%d, R%d", m, i->rs1, i->rs2, i->rd);
+ bprint(i, "%T\tR%d, R%d, R%d", m, i->rs1, i->rs2, i->rd);
else
- bprint(i, "%X\tR%d, R%d, R%d", m, i->rs2, i->rs1, i->rd);
+ bprint(i, "%T\tR%d, R%d, R%d", m, i->rs2, i->rs1, i->rd);
}else{
if(i->rs1 == i->rd)
if(dascase)
- bprint(i, "%X\t$%d,R%d", m, i->simm13&0x1F, i->rs1);
+ bprint(i, "%T\t$%d,R%d", m, i->simm13&0x1F, i->rs1);
else
- bprint(i, "%X\tR%d, $%d", m, i->rs1, i->simm13&0x1F);
+ bprint(i, "%T\tR%d, $%d", m, i->rs1, i->simm13&0x1F);
else
if(dascase)
- bprint(i, "%X\tR%d, $%d, R%d",m,i->rs1,i->simm13&0x1F,i->rd);
+ bprint(i, "%T\tR%d, $%d, R%d",m,i->rs1,i->simm13&0x1F,i->rd);
else
- bprint(i, "%X\t$%d, R%d, R%d",m,i->simm13&0x1F,i->rs1,i->rd);
+ bprint(i, "%T\t$%d, R%d, R%d",m,i->simm13&0x1F,i->rs1,i->rd);
}
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:787,810 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:790,813
{
if(i->i == 0){
if(dascase)
- bprint(i, "%X\tR%d, R%d", m, i->rs1, i->rs2);
+ bprint(i, "%T\tR%d, R%d", m, i->rs1, i->rs2);
else
if(i->op3==2 && i->rs1==0 && i->rd) /* OR R2, R0, R1 */
bprint(i, "MOVW\tR%d", i->rs2);
else
- bprint(i, "%X\tR%d, R%d", m, i->rs2, i->rs1);
+ bprint(i, "%T\tR%d, R%d", m, i->rs2, i->rs1);
}else{
if(dascase)
- bprint(i, "%X\tR%d, $%lux", m, i->rs1, i->simm13);
+ bprint(i, "%T\tR%d, $%ux", m, i->rs1, i->simm13);
else
if(i->op3==0 && i->rd && i->rs1==0) /* ADD $x, R0, R1 */
- bprint(i, "MOVW\t$%lux", i->simm13);
+ bprint(i, "MOVW\t$%ux", i->simm13);
else if(i->op3==0 && i->rd && i->rs1==2){
/* ADD $x, R2, R1 -> MOVW $x(SB), R1 */
bprint(i, "MOVW\t$");
address(i);
} else
- bprint(i, "%X\t$%lux, R%d", m, i->simm13, i->rs1);
+ bprint(i, "%T\t$%ux, R%d", m, i->simm13, i->rs1);
}
if(i->rs1 != i->rd)
bprint(i, ", R%d", i->rd);
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:820,826 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:823,829
if(i->i == 0)
bprint(i, "CMP\tR%d, R%d", i->rs1, i->rs2);
else
- bprint(i, "CMP\tR%d, $%lux", i->rs1, i->simm13);
+ bprint(i, "CMP\tR%d, $%ux", i->rs1, i->simm13);
}
static char *regtab[4] = {
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:837,843 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:840,846
if(i->i == 0)
bprint(i, "%s\tR%d, R%d", m, i->rs1, i->rs2);
else
- bprint(i, "%s\tR%d, $%lux", m, i->rs1, i->simm13);
+ bprint(i, "%s\tR%d, $%ux", m, i->rs1, i->simm13);
}else{
if(i->i && i->simm13==0)
bprint(i, "MOVW\tR%d", i->rs1);
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:844,850 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:847,853
else if(i->i == 0)
bprint(i, "wr\tR%d, R%d", i->rs2, i->rs1);
else
- bprint(i, "wr\t$%lux, R%d", i->simm13, i->rs1);
+ bprint(i, "wr\t$%ux, R%d", i->simm13, i->rs1);
}
bprint(i, ", %s", regtab[i->op3&3]);
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:869,882 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:872,885
{
if(i->i == 0){
if(i->rd == 15)
- bprint(i, "%X\t(R%d+R%d)", "CALL", i->rs2, i->rs1);
+ bprint(i, "%T\t(R%d+R%d)", "CALL", i->rs2, i->rs1);
else
- bprint(i, "%X\t(R%d+R%d), R%d", m, i->rs2, i->rs1, i->rd);
+ bprint(i, "%T\t(R%d+R%d), R%d", m, i->rs2, i->rs1, i->rd);
}else{
if(!dascase && i->simm13==8 && i->rs1==15 && i->rd==0)
bprint(i, "RETURN");
else{
- bprint(i, "%X\t", m);
+ bprint(i, "%T\t", m);
address(i);
bprint(i, ", R%d", i->rd);
}
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/udb.c:1022,1036 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/udb.c:1025,1039
}
for(j=0; fptab1[j].name; j++)
if(fptab1[j].opf == i->opf){
- bprint(i, "%X\tF%d, F%d", fptab1[j].name, i->rs2, i->rd);
+ bprint(i, "%T\tF%d, F%d", fptab1[j].name, i->rs2, i->rd);
return;
}
for(j=0; fptab2[j].name; j++)
if(fptab2[j].opf == i->opf){
- bprint(i, "%X\tF%d, F%d, F%d", fptab2[j].name, i->rs1, i->rs2, i->rd);
+ bprint(i, "%T\tF%d, F%d, F%d", fptab2[j].name, i->rs1, i->rs2, i->rd);
return;
}
- bprint(i, "%X%ux\tF%d, F%d, F%d", m, i->opf, i->rs1, i->rs2, i->rd);
+ bprint(i, "%T%ux\tF%d, F%d, F%d", m, i->opf, i->rs1, i->rs2, i->rd);
}
static int
[jmk] --rw-rw-r-- M 208448 glenda sys 10293 Jan 3 18:02 sys/src/libmach/vcodas.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/vcodas.c:306,311 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/vcodas.c:306,313
return 1;
}
+ #pragma varargck argpos bprint 2
+
static void
bprint(Instr *i, char *fmt, ...)
{
[jmk] --rw-rw-r-- M 208448 glenda sys 22299 Jan 3 18:02 sys/src/libmach/vdb.c
/n/sourcesdump/2006/0103/plan9/sys/src/libmach/vdb.c:224,229 -
/n/sourcesdump/2006/0104/plan9/sys/src/libmach/vdb.c:224,231
return 1;
}
+ #pragma varargck argpos bprint 2
+
static void
bprint(Instr *i, char *fmt, ...)
{
Various mmu cleanups.
[rsc] --rw-rw-r-- M 208448 glenda sys 24152 Jan 3 19:54 sys/src/9/pc/mmu.c
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:211,216 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:211,217
ulong *pdb;
s = splhi();
+ m->pdballoc++;
if(m->pdbpool == 0){
spllo();
page = newpage(0, 0, 0);
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:234,239 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:235,241
{
if(islo())
panic("mmupdbfree: islo");
+ m->pdbfree++;
if(m->pdbcnt >= 10){
p->next = proc->mmufree;
proc->mmufree = p;
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:240,245 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:242,248
}else{
p->next = m->pdbpool;
m->pdbpool = p;
+ m->pdbcnt++;
}
}
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:322,331 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:325,335
void
mmurelease(Proc* proc)
{
- int s;
Page *page, *next;
ulong *pdb;
+ if(islo())
+ panic("mmurelease: islo");
taskswitch(PADDR(m->pdb), (ulong)m + BY2PG);
if(proc->kmaptable){
if(proc->mmupdb == nil)
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:337,343 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:341,346
/*
* remove kmaptable from pdb before putting pdb up for reuse.
*/
- s = splhi();
pdb = tmpmap(proc->mmupdb);
if(PPN(pdb[PDX(KMAP)]) != proc->kmaptable->pa)
panic("mmurelease: bad kmap pde %#.8lux kmap %#.8lux",
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:344,350 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:347,352
pdb[PDX(KMAP)], proc->kmaptable->pa);
pdb[PDX(KMAP)] = 0;
tmpunmap(pdb);
- splx(s);
/*
* move kmaptable to free list.
*/
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:383,389 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:385,392
pdb[PDX(MACHADDR)] = m->pdb[PDX(MACHADDR)];
tmpunmap(pdb);
up->mmupdb = page;
- mmuflushtlb(up->mmupdb->pa);
+ //XXX should have this m->tss->cr3 = up->mmupdb->pa;
+ putcr3(up->mmupdb->pa);
splx(s);
}
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:393,405 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:396,407
void
putmmu(ulong va, ulong pa, Page*)
{
- int old, s;
+ int old;
Page *page;
if(up->mmupdb == nil)
upallocpdb();
- s = splhi();
if(!(vpd[PDX(va)]&PTEVALID)){
if(up->mmufree == 0)
page = newpage(0, 0, 0);
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:418,424 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:420,427
vpt[VPTX(va)] = pa|PTEUSER|PTEVALID;
if(old&PTEVALID)
flushpg(va);
- splx(s);
+ if(getcr3() != up->mmupdb->pa)
+ print("bad cr3 %.8lux %.8lux\n", getcr3(), up->mmupdb->pa);
}
/*
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/mmu.c:572,578 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/mmu.c:575,581
n = (size+4*MB-1) / (4*MB);
if((o = findhole(vpdb, vpdbsize, n)) != -1)
return VMAP + o*4*MB;
- return VMAP + o;
+ return 0;
}
n = (size+BY2PG-1) / BY2PG;
for(i=0; ipa, i);
}
}
- if(!print)
+ if(!print){
iprint("%d pages in mach pdbpools\n", n);
+ for(i=0; ipdballoc, MACHP(i)->pdbfree);
+ }
}
void
[rsc] --rw-rw-r-- M 208448 glenda sys 13971 Jan 3 19:54 sys/src/9/pc/screen.c
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/screen.c:511,516 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/screen.c:511,522
npaddr = paddr-x;
nsize = PGROUND(size+x);
+ /*
+ * Don't bother trying to map more than 4000x4000x32 = 64MB.
+ * We only have a 256MB window.
+ */
+ if(nsize > 64*MB)
+ nsize = 64*MB;
scr->vaddr = vmap(npaddr, nsize);
if(scr->vaddr == 0)
error("cannot allocate vga frame buffer");
[jmk] --rw-rw-r-- M 208448 glenda sys 6583 Jan 3 22:57 sys/src/9/pc/dat.h
/n/sourcesdump/2006/0103/plan9/sys/src/9/pc/dat.h:214,219 -
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/dat.h:214,221
int havetsc;
int havepge;
uvlong tscticks;
+ int pdballoc;
+ int pdbfree;
vlong mtrrcap;
vlong mtrrdef;
Remember rotations across pages.
[rsc] --rw-rw-r-- M 208511 glenda sys 2152 Jan 4 07:22 sys/src/cmd/page/page.h
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/page.h:42,47 -
/n/sources/plan9/sys/src/cmd/page/page.h:42,48
void rot180(Image*);
Image *rot90(Image*);
+ Image *rot270(Image*);
Image *resample(Image*, Image*);
/* ghostscript interface shared by ps, pdf */
[rsc] --rw-rw-r-- M 208511 glenda sys 10435 Jan 4 07:22 sys/src/cmd/page/rotate.c
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/rotate.c:245,250 -
/n/sources/plan9/sys/src/cmd/page/rotate.c:245,275
return(tmp);
}
+ /* rotates an image 270 degrees clockwise */
+ Image *
+ rot270(Image *im)
+ {
+ Image *tmp;
+ int i, j, dx, dy;
+
+ dx = Dx(im->r);
+ dy = Dy(im->r);
+ tmp = xallocimage(display, Rect(0, 0, dy, dx), im->chan, 0, DCyan);
+ if(tmp == nil) {
+ fprint(2, "out of memory during rot270: %r\n");
+ wexits("memory");
+ }
+
+ for(i = 0; i < dy; i++) {
+ for(j = 0; j < dx; j++) {
+ drawop(tmp, Rect(i, j, i+1, j+1), im, nil, Pt(dx-(j+1), i), S);
+ }
+ }
+ freeimage(im);
+
+ return(tmp);
+ }
+
/* from resample.c -- resize from → to using interpolation */
[rsc] --rw-rw-r-- M 208511 glenda sys 22893 Jan 4 07:22 sys/src/cmd/page/view.c
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:16,22 -
/n/sources/plan9/sys/src/cmd/page/view.c:16,22
Document *doc;
Image *im;
int page;
- int upside = 0;
+ int angle = 0;
int showbottom = 0; /* on the next showpage, move the image so the bottom is visible. */
Rectangle ulrange; /* the upper left corner of the image must be in this rectangle */
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:156,163 -
/n/sources/plan9/sys/src/cmd/page/view.c:156,172
im = tmp;
}
- if(upside)
+ switch(angle){
+ case 90:
+ im = rot90(im);
+ break;
+ case 180:
rot180(im);
+ break;
+ case 270:
+ im = rot270(im);
+ break;
+ }
esetcursor(nil);
if(showbottom){
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:390,396 -
/n/sources/plan9/sys/src/cmd/page/view.c:399,405
esetcursor(&reading);
rot180(im);
esetcursor(nil);
- upside = !upside;
+ angle = (angle+180) % 360;
redraw(screen);
flushimage(display, 1);
break;
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:589,594 -
/n/sources/plan9/sys/src/cmd/page/view.c:598,604
esetcursor(&reading);
im = rot90(im);
esetcursor(nil);
+ angle = (angle+90) % 360;
redraw(screen);
flushimage(display, 1);
break;
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:598,604 -
/n/sources/plan9/sys/src/cmd/page/view.c:608,614
esetcursor(&reading);
rot180(im);
esetcursor(nil);
- upside = !upside;
+ angle = (angle+180) % 360;
redraw(screen);
flushimage(display, 1);
break;
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:16,22 -
/n/sources/plan9/sys/src/cmd/page/view.c:16,22
Document *doc;
Image *im;
int page;
- int upside = 0;
+ int angle = 0;
int showbottom = 0; /* on the next showpage, move the image so the bottom is visible. */
Rectangle ulrange; /* the upper left corner of the image must be in this rectangle */
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:156,163 -
/n/sources/plan9/sys/src/cmd/page/view.c:156,172
im = tmp;
}
- if(upside)
+ switch(angle){
+ case 90:
+ im = rot90(im);
+ break;
+ case 180:
rot180(im);
+ break;
+ case 270:
+ im = rot270(im);
+ break;
+ }
esetcursor(nil);
if(showbottom){
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:390,396 -
/n/sources/plan9/sys/src/cmd/page/view.c:399,405
esetcursor(&reading);
rot180(im);
esetcursor(nil);
- upside = !upside;
+ angle = (angle+180) % 360;
redraw(screen);
flushimage(display, 1);
break;
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:589,594 -
/n/sources/plan9/sys/src/cmd/page/view.c:598,604
esetcursor(&reading);
im = rot90(im);
esetcursor(nil);
+ angle = (angle+90) % 360;
redraw(screen);
flushimage(display, 1);
break;
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:598,604 -
/n/sources/plan9/sys/src/cmd/page/view.c:608,614
esetcursor(&reading);
rot180(im);
esetcursor(nil);
- upside = !upside;
+ angle = (angle+180) % 360;
redraw(screen);
flushimage(display, 1);
break;
Man page and usage updates.
[rsc] --rw-rw-r-- M 208511 glenda sys 735 Jan 4 07:37 sys/man/1/freq
/n/sourcesdump/2006/0104/plan9/sys/man/1/freq:4,10 -
/n/sources/plan9/sys/man/1/freq:4,10
.SH SYNOPSIS
.B freq
[
- .B -dxocr
+ .B -cdorx
]
[
.I file ...
[rsc] --rw-rw-r-- M 208511 glenda sys 2257 Jan 4 07:37 sys/man/1/grep
/n/sourcesdump/2006/0104/plan9/sys/man/1/grep:4,12 -
/n/sources/plan9/sys/man/1/grep:4,18
.SH SYNOPSIS
.B grep
[
- .I option ...
+ .B -bchiLlnsv
]
+ [
+ .B -e
.I pattern
+ [
+ .B -f
+ .I patternfile
+ ]
[
.I file ...
]
[rsc] --rw-rw-r-- M 208511 presotto sys 4361 Jan 4 07:37 sys/man/1/gview
/n/sourcesdump/2006/0104/plan9/sys/man/1/gview:4,17 -
/n/sources/plan9/sys/man/1/gview:4,14
.SH SYNOPSIS
.B gview
[
- .B -l
- .I logfile
+ .B -mp
]
[
- .B -m
- ]
- [
- .B -p
+ .B -l
+ .I logfile
]
[
.I files
[rsc] --rw-rw-r-- M 208511 glenda sys 2357 Jan 4 07:37 sys/man/1/hoc
/n/sourcesdump/2006/0104/plan9/sys/man/1/hoc:4,14 -
/n/sources/plan9/sys/man/1/hoc:4,14
.SH SYNOPSIS
.B hoc
[
- .I file ...
- ]
- [
.B -e
.I expression
+ ]
+ [
+ .I file ...
]
.SH DESCRIPTION
.I Hoc
[rsc] --rw-rw-r-- M 208511 glenda sys 6098 Jan 4 07:37 sys/src/cmd/history.c
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/history.c:12,17 -
/n/sources/plan9/sys/src/cmd/history.c:12,18
int diffb;
char* sflag;
+ void usage(void);
void ysearch(char*, char*);
long starttime(char*);
void lastbefore(ulong, char*, char*, char*);
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/history.c:26,32 -
/n/sources/plan9/sys/src/cmd/history.c:27,33
ndump = nil;
ARGBEGIN {
default:
- goto usage;
+ usage();
case 'v':
verb = 1;
break;
/n/sourcesdump/2006/0104/plan9/sys/src/cmd/history.c:50,64 -
/n/sources/plan9/sys/src/cmd/history.c:51,69
break;
} ARGEND
- if(argc == 0) {
- usage:
- fprint(2, "usage: history [-bDfuv] [-d 9fsname] [-s yyyymmdd] files\n");
- exits(0);
- }
+ if(argc == 0)
+ usage();
for(i=0; immio + Pramin + 0x1E00 * 4);
break;
default:
- p = (void*)((uchar*)scr->vaddr + scr->storage - 96*1024);
+ /*
+ * Reset the cursor location, since the kernel may
+ * have allocated less storage than aux/vga
+ * expected.
+ */
+ tmp = scr->storage - 96*1024;
+ p = (void*)((uchar*)scr->vaddr + tmp);
+ vgaxo(Crtx, 0x30, 0x80|(tmp>>17));
+ vgaxo(Crtx, 0x31, (tmp>>11)<<2);
+ vgaxo(Crtx, 0x2F, tmp>>24);
break;
}
/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/vganvidia.c:184,190 -
/n/sources/plan9/sys/src/9/pc/vganvidia.c:184,199
p = (void*)((uchar*)scr->mmio + Pramin + 0x1E00 * 4);
break;
default:
- p = (void*)((uchar*)scr->vaddr + scr->storage - 96*1024);
+ /*
+ * Reset the cursor location, since the kernel may
+ * have allocated less storage than aux/vga
+ * expected.
+ */
+ tmp = scr->storage - 96*1024;
+ p = (void*)((uchar*)scr->vaddr + tmp);
+ vgaxo(Crtx, 0x30, 0x80|(tmp>>17));
+ vgaxo(Crtx, 0x31, (tmp>>11)<<2);
+ vgaxo(Crtx, 0x2F, tmp>>24);
break;
}