From e68f66db37a0620991f022f59aa7c6a26b63ae6c Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Mon, 10 May 2004 20:49:43 +0000 Subject: [PATCH] Convert getvec into a C function. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@929 6ac86273-5f31-0410-b378-82cca8765d1b --- drivers/makefile | 4 ++-- filelist | 1 - kernel/globals.h | 3 +-- kernel/init-mod.h | 5 ++++- kernel/inthndlr.c | 2 +- kernel/main.c | 11 ++++++++++- kernel/task.c | 13 +++++++++++-- 7 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/makefile b/drivers/makefile index 9864788..94bba96 100644 --- a/drivers/makefile +++ b/drivers/makefile @@ -22,9 +22,9 @@ #AFLAGS = /Mx /Dmem$(MODEL)=1 #LIBFLAGS = /c -OBJS = floppy.obj getvec.obj rdpcclk.obj wrpcclk.obj wratclk.obj +OBJS = floppy.obj rdpcclk.obj wrpcclk.obj wratclk.obj -LIBOBJS= +floppy +getvec +rdpcclk +wrpcclk +wratclk +LIBOBJS= +floppy +rdpcclk +wrpcclk +wratclk diff --git a/filelist b/filelist index 9b4ed55..e86d481 100644 --- a/filelist +++ b/filelist @@ -28,7 +28,6 @@ */*/docs/readme.txt */*/docs/sys.txt */*/drivers/floppy.asm -*/*/drivers/getvec.asm */*/drivers/makefile */*/drivers/rdpcclk.asm */*/drivers/wratclk.asm diff --git a/kernel/globals.h b/kernel/globals.h index c200fdb..1489896 100644 --- a/kernel/globals.h +++ b/kernel/globals.h @@ -375,12 +375,11 @@ VOID ASMCFUNC FAR restore_stack(VOID); ULONG ASMPASCAL ReadPCClock(VOID); VOID ASMPASCAL WriteATClock(BYTE *, BYTE, BYTE, BYTE); VOID ASMPASCAL WritePCClock(ULONG); -intvec ASMPASCAL getvec(UWORD); +intvec getvec(unsigned char); #ifdef __WATCOMC__ #pragma aux (pascal) ReadPCClock modify exact [ax cx dx] #pragma aux (pascal) WriteATClock modify exact [ax bx cx dx] #pragma aux (pascal) WritePCClock modify exact [ax cx dx] -#pragma aux (pascal) getvec modify exact [ax bx dx es] #endif /* */ diff --git a/kernel/init-mod.h b/kernel/init-mod.h index 05fae04..0dc72ed 100644 --- a/kernel/init-mod.h +++ b/kernel/init-mod.h @@ -101,7 +101,10 @@ extern BYTE DosLoadedInHMA; void MoveKernel(unsigned NewKernelSegment); void setvec(unsigned char intno, intvec vector); -#define getvec(n) (*(intvec FAR *)MK_FP(0,4 * (n))) +#ifndef __WATCOMC__ +#define getvec init_getvec +#endif +intvec getvec(unsigned char intno); #define GLOBAL extern #define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */ diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 837e506..804d225 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -71,7 +71,7 @@ VOID ASMCFUNC int21_syscall(iregs FAR * irp) { /* Set Interrupt Vector */ case 0x25: - setvec(irp->AL, MK_FP(irp->DS, irp->DX)); + setvec(irp->AL, (intvec)MK_FP(irp->DS, irp->DX)); break; /* DosVars - get/set dos variables */ diff --git a/kernel/main.c b/kernel/main.c index 1a48a59..fa0dddd 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -208,7 +208,16 @@ STATIC void PSPInit(void) } #ifndef __WATCOMC__ -/* for WATCOMC we can use the one in task.c */ +/* for WATCOMC we can use the ones in task.c */ +intvec getvec(unsigned char intno) +{ + intvec iv; + disable(); + iv = *(intvec FAR *)MK_FP(0,4 * (intno)); + enable(); + return iv; +} + void setvec(unsigned char intno, intvec vector) { disable(); diff --git a/kernel/task.c b/kernel/task.c index 6ad97dc..2a173bb 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -65,6 +65,15 @@ static BYTE *RcsId = + 1 byte: '\0' -- 1999/04/21 ska */ +intvec getvec(unsigned char intno) +{ + intvec iv; + disable(); + iv = *(intvec FAR *)MK_FP(0,4 * (intno)); + enable(); + return iv; +} + void setvec(unsigned char intno, intvec vector) { disable(); @@ -488,7 +497,7 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) psp FAR *p; /* point to the PSP so we can build it */ - setvec(0x22, MK_FP(user_r->CS, user_r->IP)); + setvec(0x22, (intvec)MK_FP(user_r->CS, user_r->IP)); child_psp(mem, cu_psp, mem + asize); fcbcode = patchPSP(mem - 1, env, exp, namep); @@ -739,7 +748,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) UWORD fcbcode; /* point to the PSP so we can build it */ - setvec(0x22, MK_FP(user_r->CS, user_r->IP)); + setvec(0x22, (intvec)MK_FP(user_r->CS, user_r->IP)); child_psp(mem, cu_psp, mem + asize); fcbcode = patchPSP(mem - 1, env, exp, namep);