static void xms_helper_init(void) { int i; if (!config.ext_mem) return; LWORD(eax) = 0; /* report success */ if (config.xms_size) return; config.xms_size = EXTMEM_SIZE >> 10; x_printf("XMS: initializing XMS... %d handles\n", NUM_HANDLES); freeHMA = 1; a20_global = a20_local = 0; handle_count = 0; for (i = 0; i < NUM_HANDLES + 1; i++) { if (handles[i].valid && handles[i].addr) xms_free(handles[i].addr); handles[i].valid = 0; } smdestroy(&mp); sminit(&mp, ext_mem_base, config.xms_size * 1024); smregister_error_notifier(&mp, xx_printf); }
/* xms_alloc Allocate XMS Memory Prototype in: xms.h Parameters Passed: unsigned size - size of the XMS memory to alloc Return Value: LPTR 100000L to the new block if sucessful LPTR -1L if unsucessfull Remarks: */ LPTR xms_alloc(unsigned size) { union REGS r; if (!xms_addr) xms_init(); if (handle) xms_free(1); r.h.ah=9; r.x.dx=size; xms_call(&r); if (!r.x.ax) return (LPTR)-1L; handle=r.x.dx; return (LPTR)0x100000L; }