1 /* $Header: d:/cvsroot/tads/tads3/VMINIT.H,v 1.2 1999/05/17 02:52:28 MJRoberts Exp $ */ 2 3 /* 4 * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved. 5 * 6 * Please see the accompanying license file, LICENSE.TXT, for information 7 * on using and copying this software. 8 */ 9 /* 10 Name 11 vminit.h - initialize and terminate a VM session 12 Function 13 14 Notes 15 VM initialization is configurable via the linker. To select a 16 configuration, link in exactly one of the vmcfgxxx.cpp object files. 17 Modified 18 04/06/99 MJRoberts - Creation 19 */ 20 21 #ifndef VMINIT_H 22 #define VMINIT_H 23 24 #include "vmglob.h" 25 26 /* 27 * Generic initialization function. Client code calls this function to 28 * initialize the VM. The actual implementation of this function is 29 * selected at link time from the several provided configurations. 30 * 31 * 'charset' is the name of the display character mapping that we should 32 * use. If 'charset' is null, we'll use the default character set 33 * obtained from the OS layer. 34 */ 35 void vm_initialize(struct vm_globals **vmg, class CVmHostIfc *hostifc, 36 class CVmMainClientIfc *clientifc, 37 const char *charset); 38 39 /* 40 * Initialization, phase 2 - just before loading the image file 41 */ 42 void vm_init_before_load(VMG_ const char *image_filename); 43 44 /* 45 * Initialization, phase 3 - just after loading the image file 46 */ 47 void vm_init_after_load(VMG0_); 48 49 /* 50 * Terminate the VM. Deletes all objects created by vm_init(). This 51 * can be used to clean up memory after a program has finished 52 * executing. 53 */ 54 void vm_terminate(struct vm_globals *vmg, class CVmMainClientIfc *clientifc); 55 56 57 /* ------------------------------------------------------------------------ */ 58 /* 59 * Private interface. Client code does not call any of the following 60 * routines; they're for use internally by the initialization mechanism 61 * only. 62 */ 63 64 /* 65 * Initialize the VM with in-memory pools. Creates all global objects 66 * necessary for the VM to run. 67 */ 68 void vm_init_in_mem(struct vm_globals **vmg, class CVmHostIfc *hostifc, 69 class CVmMainClientIfc *clientifc, 70 const char *charset); 71 72 /* initialize the VM with the "flat" memory pool manager */ 73 void vm_init_flat(struct vm_globals **vmg, class CVmHostIfc *hostifc, 74 class CVmMainClientIfc *clientifc, 75 const char *charset); 76 77 /* 78 * Initialize the VM with swapping pools with the given maximum number 79 * of pages in memory. 80 */ 81 void vm_init_swap(struct vm_globals **vmg, size_t max_mem_pages, 82 class CVmHostIfc *hostifc, 83 class CVmMainClientIfc *clientifc, 84 const char *charset); 85 86 /* 87 * Internal base initialization routine. Clients do not call this 88 * routine directly; it's for use by vm_init_in_mem(), vm_init_swap(), 89 * and any other vm_init_xxx routines. 90 */ 91 void vm_init_base(struct vm_globals **vmg, class CVmHostIfc *hostifc, 92 class CVmMainClientIfc *clientifc, 93 const char *charset); 94 95 /* 96 * Initialize debugger-related objects. For non-debug versions, this 97 * doesn't need to do anything. 98 */ 99 void vm_init_debugger(VMG0_); 100 101 /* 102 * Get the amount of stack space to allocate as a reserve for handling 103 * stack overflows in the debugger. For non-debug versions, we don't 104 * normally use a reserve, since the reserve is only useful for manually 105 * recovering from stack overflows in the debugger. 106 */ 107 size_t vm_init_stack_reserve(); 108 109 /* 110 * Termination - shut down the debugger. Notifies the debugger UI that 111 * we're terminating the executable. 112 */ 113 void vm_terminate_debug_shutdown(VMG0_); 114 115 /* 116 * termination - delete debugger-related objects, if any were allocated 117 * in vm_init_debugger() 118 */ 119 void vm_terminate_debug_delete(VMG0_); 120 121 122 #endif /* VMINIT_H */ 123 124