Arkady changed/optimized allocmem()

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@950 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-05-23 20:01:30 +00:00
parent 05f3cdd165
commit c863987e18
3 changed files with 10 additions and 12 deletions

View File

@ -490,7 +490,7 @@ VOID configDone(VOID)
unsigned short kernel_seg;
unsigned short hma_paras = (HMAFree+0xf)/16;
allocmem(hma_paras, &kernel_seg);
kernel_seg = allocmem(hma_paras);
p = para2far(kernel_seg - 1);
p->m_name[0] = 'S';
@ -2589,7 +2589,7 @@ VOID DoInstall(void)
*/
set_strategy(LAST_FIT);
allocmem(((unsigned)_init_end + ebda_size + 15) / 16, &installMemory);
installMemory = allocmem(((unsigned)_init_end + ebda_size + 15) / 16);
InstallPrintf(("allocated memory at %x\n",installMemory));

View File

@ -161,8 +161,8 @@ unsigned ASMPASCAL init_call_intr(int nr, iregs * rp);
unsigned ASMPASCAL read(int fd, void *buf, unsigned count);
int ASMPASCAL open(const char *pathname, int flags);
int ASMPASCAL close(int fd);
int ASMPASCAL dup2(int oldfdk, int newfd);
int ASMPASCAL allocmem(UWORD size, seg * segp);
int ASMPASCAL dup2(int oldfd, int newfd);
seg ASMPASCAL allocmem(UWORD size);
void ASMPASCAL init_PSPSet(seg psp_seg);
int ASMPASCAL init_DosExec(int mode, exec_blk * ep, char * lp);
int ASMPASCAL init_setdrive(int drive);
@ -175,7 +175,7 @@ void ASMPASCAL set_DTA(void far *dta);
#pragma aux (pascal) init_DosOpen modify exact [ax bx dx]
#pragma aux (pascal) close modify exact [ax bx]
#pragma aux (pascal) dup2 modify exact [ax bx cx]
#pragma aux (pascal) allocmem modify exact [ax bx dx]
#pragma aux (pascal) allocmem modify exact [ax bx]
#pragma aux (pascal) init_PSPSet modify exact [ax bx]
#pragma aux (pascal) init_DosExec modify exact [ax bx dx es]
#pragma aux (pascal) init_setdrive modify exact [ax bx dx]

View File

@ -199,7 +199,6 @@ INIT_DOSOPEN:
common_int21:
int 21h
jnc common_no_error
common_error:
mov ax, -1
common_no_error:
ret
@ -278,19 +277,18 @@ INIT_SWITCHAR:
mov ax, 0x3701
jmp short common_dl_int21
;; int allocmem(UWORD size, seg *segp)
;
; seg ASMPASCAL allocmem(UWORD size);
;
global ALLOCMEM
ALLOCMEM:
pop ax ; ret address
pop dx ; segp
pop bx ; size
push ax ; ret address
mov ah, 48h
int 21h
jc short common_error
mov bx, dx ; segp
mov [bx], ax
xor ax, ax
sbb bx, bx ; carry=1 -> ax=-1
or ax, bx ; segment
ret
;; void set_DTA(void far *dta)