ppaattcchh -- Command

/ccoonnff/ppaattcchh [-kkKKppvv] _i_m_a_g_e _s_y_m_b_o_l=_v_a_l_u_e ...

The command ppaattcchh  alters the value of datum _s_y_m_b_o_l  to _v_a_l_u_e in executable
_i_m_a_g_e.  In  general,  you should  use  ppaattcchh  to  alter configuration  data
(constants) in  programs, in  device drivers,  and in the  COHERENT kernel.
For ppaattcchh to work with a  symbolic constant, _i_m_a_g_e must have a symbol table
that includes  information about  _s_y_m_b_o_l. Therefore, executables  that have
been processed by the command ssttrriipp cannot be ppaattcchhed.

ppaattcchh recognizes the following _o_p_t_i_o_n_s:

-kk   Patch  the kernel  memory of  the running  COHERENT system  via device
     /ddeevv/kkmmeemm, as well as the _i_m_a_g_e.

-KK   Patch only  the kernel's data memory of the  running system via device
     /ddeevv/kkmmeemm.

-pp   Display (peek  at) the current values of  the specified variables, but
     do not change them.

-vv   Verbose.   Display the  values of the  specified variables  before and
     after patching.

Only the superuser rroooott can access kernel memory from the ppaattcchh command.

Both _s_y_m_b_o_l and _v_a_l_u_e may consist of numeric constants or a symbol from the
symbol table of _i_m_a_g_e.

Please  note  that the  COHERENT  286 kernel  references  variables with  a
trailing  underscore character;  for  example, aattppaarrmm_.   The COHERENT  386
kernel, however,  does _n_o_t use a trailing  underscore; for example, aattppaarrmm.
The following descriptions apply to both COHERENT 286 and COHERENT 386, but
the notation will be in the COHERENT-386 form.

_s_y_m_b_o_l and  _v_a_l_u_e expressions may  include an optional  numeric offset.  In
addition,  the _v_a_l_u_e  field  may optionally  be composed  of the  construct
mmaakkeeddeevv(_m_a_j_o_r,_m_i_n_o_r), where _m_a_j_o_r and _m_i_n_o_r are the ``major'' and ``minor''
device numbers, respectively, resulting in a ddeevv_tt-sized device type.

Numeric constants default to decimal, but may be specifyed with a leading 00
prefix to specify  an octal number or a 00xx  prefix to specify a hexadecimal
number.

The size  of the altered  _s_y_m_b_o_l field is, by  default, ssiizzeeooff(iinntt).  ppaattcchh
recognizes the following explicit size overrides:

:cc The size of the altered field is ssiizzeeooff(cchhaarr).

:ii The size of the altered field is ssiizzeeooff(iinntt).

:ll The size of the altered field is ssiizzeeooff(lloonngg).

:ss The size of the altered field is ssiizzeeooff(sshhoorrtt).

_E_x_a_m_p_l_e_s
The following  example patches the  value of kernel variable  KKBBBBOOOOTT in the
nnkkbb  keyboard device  driver to  disallow rebooting of  the system  via the
traditional  <ccttrrll><aalltt><ddeell> key  sequence.  See  Lexicon article  nnkkbb for
details.  Note that this command  changes /ccoohheerreenntt on the boot device, not
the copy of /ccoohheerreenntt that is now running in memory.

    /conf/patch /coherent KBBOOT=0

The second  example patches the value of character  variable mmyyvvaarr in user-
supplied program mmyypprroogg to hexadecimal value 12:

    /conf/patch myprog myvar=0x12:c

The final  example modifies the  default ``root'' and  ``pipe'' devices for
COHERENT-386 kernel /tteessttccoohh to be AT/IDE hard-disk partition /ddeevv/aatt00bb.

    /conf/patch /testcoh 'rootdev=makedev(11,1)' 'pipedev=makedev(11,1)'

Note that  in this last example,  the arguments to ppaattcchh  must be quoted to
avoid interpretation by the shell.

_S_e_e _A_l_s_o
ccoommmmaannddss, ddeevviiccee ddrriivveerrss

_N_o_t_e_s
No  spaces  can  appear  around  the  equal  sign  in  the  ssyymmbbooll=_c_o_n_s_t_a_n_t
construct.

Using ppaattcchh to modify the kernal data area of a running system is extremely
dangerous.   It  should  only be  done  by  experienced  writers of  device
drivers.  _C_a_v_e_a_t _u_t_i_l_i_t_o_r!
