diff --git a/docs/internals/design.tex b/docs/internals/design.tex index 39d0f397d1de22bb71ef3ef510694093e66d3b12..753ed61f3be04d186db85e5c6df4d92393a17282 100644 --- a/docs/internals/design.tex +++ b/docs/internals/design.tex @@ -67,6 +67,7 @@ \def\bottomfraction{.9} % was .3 \def\topfraction{.9} +\newcommand{\code}[1]{\textnormal{{\sffamily #1}}} %% Some common abbreviations \newcommand{\cmucl}{\textsc{cmucl}} diff --git a/docs/internals/lowlev.tex b/docs/internals/lowlev.tex index a8e81c444c74d5c7fdcbf39cd3991cf431655b90..c68f8e848cb2cab48b7b6529fd6bd0c3bc769c50 100644 --- a/docs/internals/lowlev.tex +++ b/docs/internals/lowlev.tex @@ -16,47 +16,47 @@ A table of functions is used which is filled in with the appropriate code to jump to the correct address. For \cmucl{}, this table is stored at -\verb|target-foreign-linkage-space-start|. Each entry is -\verb|target-foreign-linkage-entry-size| bytes long. +\code{target-foreign-linkage-space-start}. Each entry is +\code{target-foreign-linkage-entry-size} bytes long. At startup, the table is initialized with default values in -\verb|os_foreign_linkage_init|. On x86 platforms, the first entry is -code to call the routine \verb|resolve_linkage_tramp|. All other +\code{os\_foreign\_linkage\_init}. On x86 platforms, the first entry is +code to call the routine \code{resolve\_linkage\_tramp}. All other entries jump to the first entry. The function -\verb|resolve_linkage_tramp| looks at where it was called from to +\code{resolve\_linkage\_tramp} looks at where it was called from to figure out which entry in the table was used. It calls -\verb|lazy_resolve_linkage| with the address of the linkage entry. +\code{lazy\_resolve\_linkage} with the address of the linkage entry. This routine then fills in the appropriate linkage entry with code to jump to where the real routine is located, and returns the address of -the entry. On return, \verb|resolve_linkage_tramp| then just jumps to +the entry. On return, \code{resolve\_linkage\_tramp} then just jumps to the returned address to call the desired function. On all subsequent -calls, the entry no longer points to \verb|resolve_linkage_tramp| but +calls, the entry no longer points to \code{resolve\_linkage\_tramp} but to the real function. This describes how function calls are made. For foreign data, -\verb|lazy_resolve_linkage| stuffs the address of the actual foreign +\code{lazy\_resolve\_linkage} stuffs the address of the actual foreign data into the linkage table. The lisp code then just loads the address from there to get the actual address of the foreign data. For sparc, the linkage table is slightly different. The first entry is -the entry for \verb|call_into_c| so we never have to look this up. All -other entries are for \verb|resolve_linkage_tramp|. This has the -advantage that \verb|resolve_linkage_tramp| can be much simpler since -all calls to foreign code go through \verb|call_into_c| anyway, and +the entry for \code{call\_into\_c} so we never have to look this up. All +other entries are for \code{resolve\_linkage\_tramp}. This has the +advantage that \code{resolve\_linkage\_tramp} can be much simpler since +all calls to foreign code go through \code{call\_into\_c} anyway, and that means all live Lisp registers have already been saved. Also, to -make life simpler, we lie about \verb|closure_tramp| and -\verb|undefined_tramp| in the Lisp code. These are really functions, +make life simpler, we lie about \code{closure\_tramp} and +\code{undefined\_tramp} in the Lisp code. These are really functions, but we treat them as foreign data since these two routines are only used as addresses in the Lisp code to stuff into a lisp function header. On the Lisp side, there are two supporting data structures for the -linkage table: \verb|*linkage-table-data*| and -\verb|*foreign-linkage-symbols*|. The latter is a hash table whose key +linkage table: \code{*linkage-table-data*} and +\code{*foreign-linkage-symbols*}. The latter is a hash table whose key is the foriegn symbol (a string) and whose value is an index into -\verb|*linkage-table-data*|. +\code{*linkage-table-data*}. -\verb|*linkage-table-data*| is a vector with an unlispy layout. Each +\code{*linkage-table-data*} is a vector with an unlispy layout. Each entry has 3 parts: \begin{itemize} @@ -66,11 +66,11 @@ entry has 3 parts: \end{itemize} Whenever a new foreign symbol is defined, a new -\verb|*linkage-table-data*| entry is created. -\verb|*foreign-linkage-symbols*| is updated with the symbol and the -entry number into \verb|*linkage-table-data*|. +\code{*linkage-table-data*} entry is created. +\code{*foreign-linkage-symbols*} is updated with the symbol and the +entry number into \code{*linkage-table-data*}. -The \verb|*linkage-table-data*| is accessed from C (hence the unlispy +The \code{*linkage-table-data*} is accessed from C (hence the unlispy layout), to figure out the symbol name and the type so that the address of the symbol can be determined. The type tells the C code how to fill in the entry in the linkage-table itself.