| <head> |
| <title>mach(3) - Plan 9 from User Space</title> |
| <meta content="text/html; charset=utf-8" http-equiv=Content-Type> |
| </head> |
| <body bgcolor=#ffffff> |
| <table border=0 cellpadding=0 cellspacing=0 width=100%> |
| <tr height=10><td> |
| <tr><td width=20><td> |
| <tr><td width=20><td><b>MACH(3)</b><td align=right><b>MACH(3)</b> |
| <tr><td width=20><td colspan=2> |
| <br> |
| <p><font size=+1><b>NAME </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| machbytype, machbyname – machine-independent access to executables |
| and programs<br> |
| |
| </table> |
| <p><font size=+1><b>SYNOPSIS </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>#include <u.h><br> |
| #include <libc.h><br> |
| #include <mach.h> |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <tt><font size=+1>void machbytype(int type) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>int machbyname(char *name) |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| </font></tt> |
| <tt><font size=+1>extern Mach *mach;<br> |
| </font></tt> |
| </table> |
| <p><font size=+1><b>DESCRIPTION </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <i>Libmach</i> provides an interface for accessing the executable files |
| and executing images of various architectures and operating systems. |
| The interface is machine-independent, meaning that, for example, |
| Mac OS X core dumps may be inspected using an x86 Linux machine |
| and vice versa. In its current form, the library is |
| mainly useful for writing debuggers of one sort or another. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| An architecture is described primarily by a <tt><font size=+1>Mach</font></tt> structure, which |
| contains data structures and parameters describing the particular |
| architecture. Most library functions assume that the global variable |
| <i>mach</i> points at the structure for the architecture being debugged. |
| It is set implicitly by <i>crackhdr</i> (see <a href="../man3/mach-file.html"><i>mach-file</i>(3)</a>) and |
| can be set explicitly by calling <i>machbyname</i> or <i>machbytype</i>. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| There is no operating system-specific structure akin to <i>mach</i>. |
| Typically the choice of operating system on a particular architecture |
| affects only the executable and core dump formats; the various |
| file parsers deduce the operating system from information in the |
| binary files themselves and adjust accordingly. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| The supported architectures are <tt><font size=+1>386</font></tt> (Intel 32-bit x86) 386 and |
| later) and <tt><font size=+1>power</font></tt> (IBM PowerPC, typically running Mac OS X). |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| Other manual pages describe the library functions in detail. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <a href="../man3/Mach-cmd.html"><i>Mach-cmd</i>(3)</a> describes some convenience routines for attaching |
| to processes and core files. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <a href="../man3/Mach-file.html"><i>Mach-file</i>(3)</a> describes the manipulation of binary files. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <a href="../man3/Mach-map.html"><i>Mach-map</i>(3)</a> describes the interface to address spaces and register |
| sets in executable files and executing programs. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <a href="../man3/Mach-stack.html"><i>Mach-stack</i>(3)</a> describes support for unwinding the stack. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <a href="../man3/Mach-swap.html"><i>Mach-swap</i>(3)</a> describes helper functions for accessing data in |
| a particular byte order. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| <a href="../man3/Mach-symbol.html"><i>Mach-symbol</i>(3)</a> describes the interface to debugging symbol information.<br> |
| |
| </table> |
| <p><font size=+1><b>SOURCE </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <tt><font size=+1>/usr/local/plan9/src/libmach<br> |
| </font></tt> |
| </table> |
| <p><font size=+1><b>SEE ALSO </b></font><br> |
| |
| <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td> |
| |
| <a href="../man3/mach-file.html"><i>mach-file</i>(3)</a>, <a href="../man3/mach-map.html"><i>mach-map</i>(3)</a>, <a href="../man3/mach-stack.html"><i>mach-stack</i>(3)</a>, <a href="../man3/mach-swap.html"><i>mach-swap</i>(3)</a>, <a href="../man3/mach-symbol.html"><i>mach-symbol</i>(3)</a><br> |
| |
| </table> |
| |
| <td width=20> |
| <tr height=20><td> |
| </table> |
| <!-- TRAILER --> |
| <table border=0 cellpadding=0 cellspacing=0 width=100%> |
| <tr height=15><td width=10><td><td width=10> |
| <tr><td><td> |
| <center> |
| <a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a> |
| </center> |
| </table> |
| <!-- TRAILER --> |
| </body></html> |