Jump to content

MFSH SEGALLOC: Difference between revisions

From EDM2
Created page with "{{DISPLAYTITLE:MFSH_SEGALLOC}} Allocate memory. ==Syntax== int far pascal MFSH_SEGALLOC(usFlag, cbSeg, pusSel) ==Parameters== ; usFlag: is set to 1 if the memory must be belo..."
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:MFSH_SEGALLOC}}
{{DISPLAYTITLE:MFSH_SEGALLOC}}
Allocate memory.
Allocate memory.
==Syntax==
==Syntax==
  int far pascal MFSH_SEGALLOC(usFlag, cbSeg, pusSel)
  int far pascal MFSH_SEGALLOC(usFlag, cbSeg, pusSel)
==Parameters==
==Parameters==
; usFlag: is set to 1 if the memory must be below the 1-meg boundary or 0 if its location does not matter.  
;usFlag: is set to 1 if the memory must be below the 1-meg boundary or 0 if its location does not matter.
; cbSeg: contains the length of the segment.  
;cbSeg: contains the length of the segment.
; pusSel: is a pointer to a word in which the helper returns the selector of the segment.  
;pusSel: is a pointer to a word in which the helper returns the selector of the segment.


==Returns==
==Returns==
If no error is detected, a zero error code is returned. If an error is detected, one of the following error codes is returned:  
If no error is detected, a zero error code is returned. If an error is detected, one of the following error codes is returned:
; ERROR_NOT_ENOUGH_MEMORY: too much memory is allocated.
;ERROR_NOT_ENOUGH_MEMORY: too much memory is allocated.
; ERROR_PROTECTION_VIOLATION: the supplied address is invalid.
;ERROR_PROTECTION_VIOLATION: the supplied address is invalid.
; ERROR_INVALID_PARAMETER: either the supplied flag or length is invalid.
;ERROR_INVALID_PARAMETER: either the supplied flag or length is invalid.


==Sample==
==Sample==
Line 22: Line 24:


==Remarks==
==Remarks==
This function allocates memory with the following attributes:  
This function allocates memory with the following attributes:
* Allocated from the GDT
* Allocated from the GDT
* Non-swappable  
* Non-swappable
Memory not allocated specifically below the 1-Meg boundary may be given to the FSD by passing the selectors through pMiniFSD (see MFS_INIT and FS_INIT).
Memory not allocated specifically below the 1-Meg boundary may be given to the FSD by passing the selectors through pMiniFSD (see MFS_INIT and FS_INIT).


[[Category:IFS]]
[[Category:IFS Interfaces]]

Latest revision as of 21:35, 20 November 2019

Allocate memory.

Syntax

int far pascal MFSH_SEGALLOC(usFlag, cbSeg, pusSel)

Parameters

usFlag
is set to 1 if the memory must be below the 1-meg boundary or 0 if its location does not matter.
cbSeg
contains the length of the segment.
pusSel
is a pointer to a word in which the helper returns the selector of the segment.

Returns

If no error is detected, a zero error code is returned. If an error is detected, one of the following error codes is returned:

ERROR_NOT_ENOUGH_MEMORY
too much memory is allocated.
ERROR_PROTECTION_VIOLATION
the supplied address is invalid.
ERROR_INVALID_PARAMETER
either the supplied flag or length is invalid.

Sample

unsigned short usFlag;
unsigned long cbSeg;
unsigned short far * pusSel;

int far pascal MFSH_SEGALLOC(usFlag, cbSeg, pusSel)

Remarks

This function allocates memory with the following attributes:

  • Allocated from the GDT
  • Non-swappable

Memory not allocated specifically below the 1-Meg boundary may be given to the FSD by passing the selectors through pMiniFSD (see MFS_INIT and FS_INIT).