Use the "small" model for the init code (split code/data). This will enable

us to use the same CS for resident and init code for Watcom (Borland's
too big), and share a bit.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@859 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-04-10 10:59:57 +00:00
parent 512f48e962
commit e6e3b7a3a4
4 changed files with 27 additions and 19 deletions

View File

@ -82,8 +82,13 @@ void __int__(int);
#define VA_CDECL
#define PASCAL pascal
#define __int__(intno) asm int intno;
#define _SS SS()
static unsigned short __inline SS(void)
#define _CS getCS()
static unsigned short __inline getCS(void)
{
asm mov ax, cs;
}
#define _SS getSS()
static unsigned short __inline getSS(void)
{
asm mov ax, ss;
}
@ -97,9 +102,12 @@ static unsigned short __inline SS(void)
#define CDECL __cdecl
#define VA_CDECL
#define PASCAL pascal
#define _SS SS()
unsigned short SS(void);
#pragma aux SS = "mov dx,ss" value [dx];
#define _CS getCS()
unsigned short getCS(void);
#pragma aux getCS = "mov dx,cs" value [dx] modify exact[dx];
#define _SS getSS()
unsigned short getSS(void);
#pragma aux getSS = "mov dx,ss" value [dx] modify exact[dx];
/* enable Possible loss of precision warning for compatibility with Borland */
#pragma enable_message(130)

View File

@ -119,23 +119,28 @@ kernel_start:
pop bx
pop ax
mov ax,cs
mov ax,seg init_tos
cli
mov ss,ax
mov sp,init_tos
int 12h ; move the init code to higher memory
mov cl,6
shl ax,cl
mov dx,init_end+15
mov dx,15 + init_end wrt INIT_TEXT
mov cl,4
shr dx,cl
sub ax,dx
mov es,ax
mov dx,__INIT_DATA_START wrt INIT_TEXT
shr dx,cl
add ax,dx
mov ss,ax ; set SS to init data segment
sti ; now enable them
mov ax,cs
mov ds,ax
xor si,si
xor di,di
mov cx,init_end+1
mov cx,1 + init_end wrt INIT_TEXT
shr cx,1
cld
rep movsw
@ -143,14 +148,10 @@ kernel_start:
mov ax,cont
push ax
retf
cont: mov ax,cs
mov ss,ax
; Now set up call frame
cont: ; Now set up call frame
mov ds,[cs:_INIT_DGROUP]
mov bp,sp ; and set up stack frame for c
sti ; now enable them
push ax
push bx
pushf
mov ax, 0e33h ; '3' Tracecode - kernel entered
@ -158,7 +159,6 @@ cont: mov ax,cs
int 010h
popf
pop bx
pop ax
mov byte [_BootDrive],bl ; tell where we came from
@ -171,7 +171,7 @@ cont: mov ax,cs
mov ax,ss
mov ds,ax
mov es,ax
jmp _FreeDOSmain
jmp _FreeDOSmain
%ifdef WATCOM
global _IU4M

View File

@ -227,8 +227,7 @@ STATIC void init_kernel(void)
ram_top = init_oem();
/* move kernel to high conventional RAM, just below the init code */
lpTop = MK_FP(ram_top * 64 - (FP_OFF(_init_end) + 15) / 16 -
(FP_OFF(_HMATextEnd) + 15) / 16, 0);
lpTop = MK_FP(_CS - (FP_OFF(_HMATextEnd) + 15) / 16, 0);
MoveKernel(FP_SEG(lpTop));
lpTop = MK_FP(FP_SEG(lpTop) - 0xfff, 0xfff0);

View File

@ -31,7 +31,8 @@ group PGROUP PSP
group LGROUP _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT
group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA
group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END
group I_GROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END ID_B ID ID_E IC IDATA ICONST ICONST2 I_DATA IB_B I_BSS IB IB_E
group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END
group I_GROUP ID_B ID ID_E IC IDATA ICONST ICONST2 I_DATA IB_B I_BSS IB IB_E
segment PSP class=PSP
segment _LOWTEXT class=LCODE
@ -54,7 +55,7 @@ segment HMA_TEXT_END class=CODE
segment INIT_TEXT_START class=CODE align=16
segment INIT_TEXT class=CODE
segment INIT_TEXT_END class=CODE
segment ID_B class=ID align=2
segment ID_B class=ID align=16
segment ID class=ID align=2
segment ID_E class=ID align=2
segment IDATA class=ID align=2