add some comments regarding relocation of kernel during configuration

This commit is contained in:
Kenneth J Davis 2024-02-10 17:38:19 -05:00
parent 114236da17
commit a593799eb0
No known key found for this signature in database
GPG Key ID: 59D5F216C38F11FD
2 changed files with 13 additions and 1 deletions

View File

@ -305,6 +305,7 @@ VOID FAR * HMAalloc(COUNT bytesToAllocate)
unsigned CurrentKernelSegment = 0;
/* relocate segment with HMA_TEXT code group */
void MoveKernel(unsigned NewKernelSegment)
{
UBYTE FAR *HMADest;
@ -312,9 +313,11 @@ void MoveKernel(unsigned NewKernelSegment)
unsigned len;
unsigned jmpseg = CurrentKernelSegment;
/* if the first time called, initialize to end of HMA_TEXT code group segment */
if (CurrentKernelSegment == 0)
CurrentKernelSegment = FP_SEG(_HMATextEnd);
/* if already relocated into HMA, nothing to do */
if (CurrentKernelSegment == 0xffff)
return;
@ -324,6 +327,8 @@ void MoveKernel(unsigned NewKernelSegment)
len = (FP_OFF(_HMATextEnd) | 0x000f) - (FP_OFF(_HMATextStart) & 0xfff0);
/* HMA doesn't start until a paragraph into 0xffff segment */
/* HMA begins with VDISK header to mark area is used */
if (NewKernelSegment == 0xffff)
{
HMASource += HMAOFFSET;

View File

@ -305,7 +305,14 @@ STATIC void init_kernel(void)
/* Init oem hook - returns memory size in KB */
ram_top = init_oem();
/* move kernel to high conventional RAM, just below the init code */
/* Note: HMA_TEXT and init code already moved higher in
conventional memory by startup code, however, we still
need to adjust any references to new location. So use
current CS as that is where we were moved to and perform
any fixups needed. Note this will also re-copy the
HMA_TEXT segment, so be sure not to overwrite it prior
to the MoveKernel() call. Kernel moved to around 8F??:0000
*/
#ifdef __WATCOMC__
lpTop = MK_FP(_CS, 0);
#else