home *** CD-ROM | disk | FTP | other *** search
-
-
- Virtual Store for C
- -------------------
-
- Public Domain - David McQuillan 20th September 1992
-
- This directory contains the first version of a Virtual Store Handler
- for Acorn Ansi C. The software in VSI_C including the virtual store
- handling subroutines and the !vsilink utility is unrestricted Public
- Domain. There is no commitment to maintain the interfaces of these
- routines, this software is issued with the intention of learning
- from your problems and changing anything that proves unoptimal.
- You are entitled (encouraged) if you can to produce your own version
- of any of this software with your extension, perhaps you can produce
- that definitive edition that gives what everyone wants.
-
- With this package and a C compiler you can produce applications that
- would normally occupy megabytes of space and run them in a couple of
- hundred kilobytes. Of course they will run slower if frequent paging
- is necessary.
-
- The application !vsilink is an example of VSI handling in action -
- and is an essential utility. !vsilink2 is a copy of !vsilink that is
- made by running 'run_vlink'. A '!Swap' file of 2Mbyte will be used
- as a swap space in !vsilink and the files !RunImage and !RunHigh will
- be created in !vsilink2.
-
- The !vsilink utility enables an application to be built which has its
- code and data in two parts, a locked down portion and a pageable
- portion. The pageable part can use the Ansi C library freely except
- perhaps for signal handling and calls to system. Calls to malloc from
- the pageable part allocate pageable space and calls from the locked
- down part allocate locked down space.
-
- Treat this software with caution. It is a first version and it is
- characteristic of virtual store problems that everything seems to
- work fine for ages and then a weird problem crops up. Do not run
- any application generated under the Task Manager in !Edit as it can
- change the page mapping at odd times.
-
- This directory needs to be copied onto a hard disk with 3Mbyte or
- more of free space before anything is run.
-
-
- !vsilink
- --------
-
- !vsilink is a linker that produces !RunImage and !RunHigh in an
- application directory. The two parts are linked in that direct calls
- and data references can be made from one part to the other.
-
- Syntax is !vsilink input_files [options]*
- Options:
- -L files Modules for low area
- -P files Modules for pageable area
- -O !dir Application directory
- -V file Take file names from via file
- -A file Alias file for references from high area
- -M Produce area and symbol maps
- -H Produce this help message
-
- Via File:
- Each line contains the name of a file to link or an option.
- A line with -P (pageable) means the following files are to be
- linked in the high area. A line with -L means the following
- files are to be put into the low area. Initially files are
- to be put into the low area.
-
- Alias File
- Pairs of names, the first is the name referred to in the high
- area. The second is where the name is redirected to.
- For instance malloc in the high area could be redirected to
- VSI_malloc so that any mallocs in the high area get pageable
- space and mallocs in the low area get non-pageable space.
-
- The output is put into the application directory. The low
- area is put in !RunImage and looks like normal Acorn object
- format. The High area is put in !RunHigh and must be loaded
- into a pageable area starting at 0x800000.
-
- !vsilink.!Run Just an Obey file calling !RunImage
- !vsilink.!RunImage The unpaged part of !vsilink
- !vsilink.!RunHigh The pageable part of !vsilink.
-
-
- The source files
- ----------------
-
- WingPass Assembler source
- -------------------------
-
- a.IncAsm Include file for WingPass assembler
- a.vsilinkass !RunImage header for !vsilink
- a.VSImanass Assembler support for Virtual Store Handling
- a.VSImanRTSK Support for C diagnostics for errors in !RunHigh.
-
- C source
- --------
-
- c.VSIclib Intercepts for C library calls from !RunHigh
- c.vsilinklo The startup code for !vsilink in !RunImage
- c.vsilinkhi The main code of !vsilink in !RunHigh
- c.VSIman Main support code for Virtual store Handling
-
- Header files
- ------------
-
- h.vsilink header for !vsilink application
- h.VSIman header for Virtual Store Handling use. See
- c.vsilinklo for its use calling VSI_Setup.
-
- Miscellaneous files
- -------------------
-
- make_vlink A call to Amu to produce !vsilink2 using
- vsilink2 and !vsilink.
-
- run_vlink A direct call to !vsilink producing !vsilink2.
- This also produces logfile.
-
- logfile A map of the application !vsilink2 produced by
- running run_vlink.
-
- vsilink2Mk The makefile used in make_vlink. Worth studying
- for the line with !vsilink in it.
-
- VSIalias An alias file for use with !vsilink
-
- VSIvia A via file including the VSI routines to be
- linked when using Virtual Store handling.
-
- ReadMe This read-me file
-
-
- The linked form
- ---------------
-
- The modules 'o.VSIclib o.VSIman o.VSImanass o.VSImanRTSK' must be
- linked to the low store part of an application along with the stubs
- module <c$LibRoot>o.stubs using !vsilink.
-
- The initial entry must be into !RunImage and call VSI_Setup as in
- c.vsilinklo. This specifies the minimum size to page into, the
- virtual store size, and the application directory name.
-
- A virtual store space will be set up in the directory and !RunHigh
- loaded. Calls can then be made to the high area as desired.
-
- Data in the high area should never be passed over directly to the
- system. Calls to the C routines including fread and fwrite are ok,
- dangerous ones are intercepted using VSIalias. It is ok to pass over
- references to local space on the stack. Calls to system or using
- signal should be avoided - I'm not sure of all the consequences.
-
- The modules in !RunImage should call the intercept routines VSI_<name>
- if there is any chance that a parameter may be from !RunHigh, or else
- should copy the parameter to a low area - for example the stack. The
- intercept routines in VSIclib and File_Size in vsilinklo show the
- general pattern of what has to be done.
-
- And there you have it. The application can be used single tasking
- but not under the task manager in !Edit as it mangles up the addressing
- at odd times. To produce an application running under the Wimp the
- system calls should be placed in !RunImage. VSI_Save should be called
- before Wimp_Poll and VSI_Restore called afterwards so the space is
- restored as it was before the Poll.
-
-
- Where I'd like it to go- ideas for development
- ----------------------------------------------
-
- I would like to centralize the virtual store allocation into a single
- application !VSI which would allocate space from a central pool. This
- would have an associated module which would be better at trapping when
- the page map changes. Doing this would allow all the pageable space of
- an application to be paged out and used by another application -
- useful for allowing a number of large Wimp applications to be
- permanently loaded and paged out while waiting for the user to do
- something with them.
-
- I would like to get it to work with the task manager or have some
- equivalent facility built in.
-
- I would like to be able to load a page for a virtual store interrupt
- in the background whilst executing another task - this would have to
- be only if the application was willing to relinquish control.
-
- Support for debugging via !DDT should be put in (probably requires
- Acorn to do something).
-
- I would like it to be eventually supported by Acorn or someone else
- who could look after it properly.
-