mirror of https://github.com/FDOS/kernel.git
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:
parent
05f3cdd165
commit
c863987e18
|
@ -490,7 +490,7 @@ VOID configDone(VOID)
|
||||||
unsigned short kernel_seg;
|
unsigned short kernel_seg;
|
||||||
unsigned short hma_paras = (HMAFree+0xf)/16;
|
unsigned short hma_paras = (HMAFree+0xf)/16;
|
||||||
|
|
||||||
allocmem(hma_paras, &kernel_seg);
|
kernel_seg = allocmem(hma_paras);
|
||||||
p = para2far(kernel_seg - 1);
|
p = para2far(kernel_seg - 1);
|
||||||
|
|
||||||
p->m_name[0] = 'S';
|
p->m_name[0] = 'S';
|
||||||
|
@ -2589,7 +2589,7 @@ VOID DoInstall(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_strategy(LAST_FIT);
|
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));
|
InstallPrintf(("allocated memory at %x\n",installMemory));
|
||||||
|
|
||||||
|
|
|
@ -161,8 +161,8 @@ unsigned ASMPASCAL init_call_intr(int nr, iregs * rp);
|
||||||
unsigned ASMPASCAL read(int fd, void *buf, unsigned count);
|
unsigned ASMPASCAL read(int fd, void *buf, unsigned count);
|
||||||
int ASMPASCAL open(const char *pathname, int flags);
|
int ASMPASCAL open(const char *pathname, int flags);
|
||||||
int ASMPASCAL close(int fd);
|
int ASMPASCAL close(int fd);
|
||||||
int ASMPASCAL dup2(int oldfdk, int newfd);
|
int ASMPASCAL dup2(int oldfd, int newfd);
|
||||||
int ASMPASCAL allocmem(UWORD size, seg * segp);
|
seg ASMPASCAL allocmem(UWORD size);
|
||||||
void ASMPASCAL init_PSPSet(seg psp_seg);
|
void ASMPASCAL init_PSPSet(seg psp_seg);
|
||||||
int ASMPASCAL init_DosExec(int mode, exec_blk * ep, char * lp);
|
int ASMPASCAL init_DosExec(int mode, exec_blk * ep, char * lp);
|
||||||
int ASMPASCAL init_setdrive(int drive);
|
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) init_DosOpen modify exact [ax bx dx]
|
||||||
#pragma aux (pascal) close modify exact [ax bx]
|
#pragma aux (pascal) close modify exact [ax bx]
|
||||||
#pragma aux (pascal) dup2 modify exact [ax bx cx]
|
#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_PSPSet modify exact [ax bx]
|
||||||
#pragma aux (pascal) init_DosExec modify exact [ax bx dx es]
|
#pragma aux (pascal) init_DosExec modify exact [ax bx dx es]
|
||||||
#pragma aux (pascal) init_setdrive modify exact [ax bx dx]
|
#pragma aux (pascal) init_setdrive modify exact [ax bx dx]
|
||||||
|
|
|
@ -199,7 +199,6 @@ INIT_DOSOPEN:
|
||||||
common_int21:
|
common_int21:
|
||||||
int 21h
|
int 21h
|
||||||
jnc common_no_error
|
jnc common_no_error
|
||||||
common_error:
|
|
||||||
mov ax, -1
|
mov ax, -1
|
||||||
common_no_error:
|
common_no_error:
|
||||||
ret
|
ret
|
||||||
|
@ -278,19 +277,18 @@ INIT_SWITCHAR:
|
||||||
mov ax, 0x3701
|
mov ax, 0x3701
|
||||||
jmp short common_dl_int21
|
jmp short common_dl_int21
|
||||||
|
|
||||||
;; int allocmem(UWORD size, seg *segp)
|
;
|
||||||
|
; seg ASMPASCAL allocmem(UWORD size);
|
||||||
|
;
|
||||||
global ALLOCMEM
|
global ALLOCMEM
|
||||||
ALLOCMEM:
|
ALLOCMEM:
|
||||||
pop ax ; ret address
|
pop ax ; ret address
|
||||||
pop dx ; segp
|
|
||||||
pop bx ; size
|
pop bx ; size
|
||||||
push ax ; ret address
|
push ax ; ret address
|
||||||
mov ah, 48h
|
mov ah, 48h
|
||||||
int 21h
|
int 21h
|
||||||
jc short common_error
|
sbb bx, bx ; carry=1 -> ax=-1
|
||||||
mov bx, dx ; segp
|
or ax, bx ; segment
|
||||||
mov [bx], ax
|
|
||||||
xor ax, ax
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;; void set_DTA(void far *dta)
|
;; void set_DTA(void far *dta)
|
||||||
|
|
Loading…
Reference in New Issue