3 * Support calls to use HIMEM.SYS
4 * (C) 2009-2012 Jonathan Campbell.
5 * Hackipedia DOS library.
7 * This code is licensed under the LGPL.
8 * <insert LGPL legal text here>
11 #ifndef __HW_DOS_XMM_H
12 #define __HW_DOS_XMM_H
14 #if !defined(TARGET_WINDOWS) && !defined(TARGET_OS2)
24 //#include "src/lib/doslib/cpu.h"
25 #include "src/lib/doslib/dos.h"
27 /* HMA memory is present */
28 #define HIMEM_F_HMA (1 << 0)
29 /* HIMEM.SYS supports extended functions to address up to 4GB of RAM (surpassing the older API's 64MB limit) */
30 #define HIMEM_F_4GB (1 << 1)
32 extern unsigned char himem_sys_present;
33 extern unsigned int himem_sys_version;
34 extern unsigned long himem_sys_entry;
35 extern unsigned char himem_sys_flags;
36 extern unsigned long himem_sys_total_free;
37 extern unsigned long himem_sys_largest_free;
40 struct himem_block_info {
41 uint32_t block_length_kb;
42 unsigned char lock_count;
43 unsigned char free_handles;
47 int probe_himem_sys();
48 int himem_sys_query_a20();
49 int himem_sys_local_a20(int enable);
50 int himem_sys_global_a20(int enable);
51 void himem_sys_update_free_memory_status();
52 int __cdecl himem_sys_alloc(unsigned long size/* in KB---not bytes*/);
53 int himem_sys_move(unsigned int dst_handle,uint32_t dst_offset,unsigned int src_handle,uint32_t src_offset,uint32_t length);
54 int __cdecl himem_sys_realloc(unsigned int handle,unsigned long size/* in KB---not bytes*/);
55 int himem_sys_get_handle_info(unsigned int handle,struct himem_block_info *b);
56 uint32_t himem_sys_lock(unsigned int handle);
57 int himem_sys_unlock(unsigned int handle);
58 int himem_sys_free(int handle);
60 #endif /* !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) */
62 #endif /* __HW_DOS_EMM_H */