reactos/subsystems/mvdm/ntvdm/bios/umamgr.h

33 lines
1,016 B
C
Raw Normal View History

[NTVDM] EMS: - Introduce (and use) helpers for checking validity of EMS handles. - Do not hardcode the EMS page frame segment, but instead allow it to be changed (for now, it is still set to a default value; in the future, via some configuration file or via the registry). This is done by acquiring a UMB block (see after). XMS: - Implement functions 0x01 "Request HMA" and 0x02 "Release HMA". - Fix the return value of functions 0x04 "Global disable A20" and 0x08 "Query free Extended Memory"; simplify code of function 0x0B "Move EMB". - Halfplement function 0x0F "Reallocate Extended Memory Block" in the simple case of size reduction (size expansion is left to the programmer as an exercise :PP ) - Rewrite the UMB provider support (functions 0x10, 0x11, 0x12) by calling the Upper Memory Area manager helpers (see after) (this is closer to reality: UMBs are either provided by XMS driver itself, or by an EMS driver which hooks into the XMS driver chain -- as it is done with MS' himem+EMM386; sometimes all that stuff is contained inside one driver only --) instead of calling back into DOS. This is the DOS which calls XMS for getting the UMB blocks and initializing them! (and not the other way around as it was done in r68001!). NTVDM: - Introduce an "Upper Memory Area manager" which maintains a list of areas of upper memory (>= A000:0000 and <= FFFF:000F) that can be used as RAM blocks. It is intended to work closely with the NTVDM memory manager and be used by XMS for getting possible free UMBs, and by VDDs for implementing the VDDInclude/ExcludeMem APIs (which adds/remove blocks in/from the UMB pool; those are unaccessible to DOS if those APIs are called after NTVDM have been started, but are accessible by XMS). DOS: - Add a helper function for detecting early DOS arena corruptions (for debugging purposes only). - Make the DOS memory manager really UMB-compatible. This means: * not hardcoding the start of the UMB chain; * getting all the available UMB blocks from XMS and initializing them, marking the reserved blocks as read-only (with a correct header; reserved blocks are eg. VGA memory area, ROM blocks...). There is room for improvements obviously (see the FIXMEs in the code). Used documentation is mentioned in comments in the code. This commit should fix quite some apps, as well as it fixes corruptions of loaded ROMs in upper memory: that's how I came into working on fixing the UMB support. In other words, during those two last weeks, I was like in: http://i.imgur.com/zoWpqEB.gifv CORE-9969 #resolve svn path=/trunk/; revision=68586
2015-08-01 17:07:07 +00:00
/*
* COPYRIGHT: GPLv2+ - See COPYING in the top level directory
* PROJECT: ReactOS Virtual DOS Machine
* FILE: subsystems/mvdm/ntvdm/bios/umamgr.h
[NTVDM] EMS: - Introduce (and use) helpers for checking validity of EMS handles. - Do not hardcode the EMS page frame segment, but instead allow it to be changed (for now, it is still set to a default value; in the future, via some configuration file or via the registry). This is done by acquiring a UMB block (see after). XMS: - Implement functions 0x01 "Request HMA" and 0x02 "Release HMA". - Fix the return value of functions 0x04 "Global disable A20" and 0x08 "Query free Extended Memory"; simplify code of function 0x0B "Move EMB". - Halfplement function 0x0F "Reallocate Extended Memory Block" in the simple case of size reduction (size expansion is left to the programmer as an exercise :PP ) - Rewrite the UMB provider support (functions 0x10, 0x11, 0x12) by calling the Upper Memory Area manager helpers (see after) (this is closer to reality: UMBs are either provided by XMS driver itself, or by an EMS driver which hooks into the XMS driver chain -- as it is done with MS' himem+EMM386; sometimes all that stuff is contained inside one driver only --) instead of calling back into DOS. This is the DOS which calls XMS for getting the UMB blocks and initializing them! (and not the other way around as it was done in r68001!). NTVDM: - Introduce an "Upper Memory Area manager" which maintains a list of areas of upper memory (>= A000:0000 and <= FFFF:000F) that can be used as RAM blocks. It is intended to work closely with the NTVDM memory manager and be used by XMS for getting possible free UMBs, and by VDDs for implementing the VDDInclude/ExcludeMem APIs (which adds/remove blocks in/from the UMB pool; those are unaccessible to DOS if those APIs are called after NTVDM have been started, but are accessible by XMS). DOS: - Add a helper function for detecting early DOS arena corruptions (for debugging purposes only). - Make the DOS memory manager really UMB-compatible. This means: * not hardcoding the start of the UMB chain; * getting all the available UMB blocks from XMS and initializing them, marking the reserved blocks as read-only (with a correct header; reserved blocks are eg. VGA memory area, ROM blocks...). There is room for improvements obviously (see the FIXMEs in the code). Used documentation is mentioned in comments in the code. This commit should fix quite some apps, as well as it fixes corruptions of loaded ROMs in upper memory: that's how I came into working on fixing the UMB support. In other words, during those two last weeks, I was like in: http://i.imgur.com/zoWpqEB.gifv CORE-9969 #resolve svn path=/trunk/; revision=68586
2015-08-01 17:07:07 +00:00
* PURPOSE: Upper Memory Area Manager
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#ifndef _UMAMGR_H_
#define _UMAMGR_H_
/* DEFINITIONS ****************************************************************/
typedef enum
{
UMA_FREE = 0, // Free RAM block
UMA_SYSTEM, // System memory (eg. VGA memory, etc...)
UMA_ROM, // ROM block
UMA_UMB, // Upper memory block
UMA_VDD // VDD-reserved block
} UMA_DESC_TYPE;
/* FUNCTIONS ******************************************************************/
BOOLEAN UmaDescReserve(IN OUT PUSHORT UmbSegment, IN OUT PUSHORT Size);
BOOLEAN UmaDescRelease(IN USHORT UmbSegment);
BOOLEAN UmaDescReallocate(IN USHORT UmbSegment, IN OUT PUSHORT Size);
BOOLEAN UmaMgrInitialize(VOID);
VOID UmaMgrCleanup(VOID);
#endif /* _UMAMGR_H_ */