Skip to content

Commit

Permalink
[kernel] Get CONFIG_ROMCODE kernel build operational again
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Oct 17, 2020
1 parent 1c9900d commit 02c160c
Show file tree
Hide file tree
Showing 13 changed files with 368 additions and 68 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

.project
*~
.DS_Store

#
# Build ignores
Expand Down
6 changes: 3 additions & 3 deletions bootblocks/boot_sect.S
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ track_max:
#elif defined(CONFIG_IMG_HD)
.word CONFIG_IMG_CYL
#else
.error "Unknown number of disk tracks!"
.warning "Unknown number of disk tracks!"
.word 0
#endif

Expand All @@ -610,7 +610,7 @@ sect_max:
#elif defined(CONFIG_IMG_HD)
.byte CONFIG_IMG_SECT
#else
.error "Unknown number of disk sectors per track!"
.warning "Unknown number of disk sectors per track!"
.byte 0
#endif

Expand All @@ -624,7 +624,7 @@ head_max:
#elif defined(CONFIG_IMG_HD)
.byte CONFIG_IMG_HEAD
#else
.error "Unknown number of disk sides/heads!"
.warning "Unknown number of disk sides/heads!"
.byte 0
#endif

Expand Down
23 changes: 13 additions & 10 deletions config-emu86
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,25 @@ CONFIG_CPU_8086=y
CONFIG_HW_VIDEO_LINES_PER_CHARACTER=8
CONFIG_HW_VIDEO_LINES_PER_SCREEN=25
# CONFIG_HW_259_USE_ORIGINAL_MASK is not set
CONFIG_APM=y
# CONFIG_HW_SERIAL_FIFO is not set
CONFIG_APM=Y

#
# Kernel settings
#

#
# Memory manager
#
CONFIG_SMALL_KERNEL=y
# CONFIG_BOOTOPTS is not set
CONFIG_SYS_VERSION=y
# CONFIG_STRACE is not set
CONFIG_IDLE_HALT=y
CONFIG_ROMCODE=y
CONFIG_EXPERIMENTAL=y
# CONFIG_MODULES is not set
# CONFIG_FARTEXT_KERNEL is not set

#
# Memory manager
#

#
# ROM-CODE kernel-loader
Expand Down Expand Up @@ -118,7 +121,6 @@ CONFIG_ROM_CHECKSUM_SIZE=64
CONFIG_SOCKET=y
# CONFIG_NANO is not set
CONFIG_INET=y
CONFIG_CSLIP=y
# CONFIG_UNIX is not set

#
Expand All @@ -144,13 +146,14 @@ CONFIG_ROMFS_BASE=8000
# CONFIG_ROOT_READONLY is not set
# CONFIG_FS_RO is not set
# CONFIG_FULL_VFS is not set
CONFIG_32BIT_INODES=y
CONFIG_FS_EXTERNAL_BUFFER=y
CONFIG_PIPE=y

#
# Executable file formats
#
CONFIG_EXEC_ELKS=y
# CONFIG_EXEC_MMODEL is not set

#
# Drivers
Expand Down Expand Up @@ -212,7 +215,7 @@ CONFIG_PSEUDO_TTY=y
# Shell
#
# CONFIG_APP_ASH is not set
# CONFIG_APP_SH_UTILS is not set
CONFIG_APP_SH_UTILS=y

#
# sash as default shell
Expand All @@ -226,7 +229,7 @@ CONFIG_APP_SASH=y
# CONFIG_APP_DBG_UTILS is not set
# CONFIG_APP_DISK_UTILS is not set
# CONFIG_APP_ELVIS is not set
# CONFIG_APP_FILE_UTILS is not set
CONFIG_APP_FILE_UTILS=y
# CONFIG_APP_LEVEE is not set
# CONFIG_APP_M4 is not set
# CONFIG_APP_MINIX1 is not set
Expand All @@ -239,6 +242,7 @@ CONFIG_APP_SASH=y
# CONFIG_APP_PRN_UTILS is not set
# CONFIG_APP_SYS_UTILS is not set
# CONFIG_APP_SCREEN is not set
# CONFIG_APP_CRON is not set
# CONFIG_APP_TEST is not set
# CONFIG_APP_XVI is not set

Expand All @@ -258,4 +262,3 @@ CONFIG_APP_SASH=y
# CONFIG_IMG_FAT is not set
# CONFIG_IMG_RAW is not set
CONFIG_IMG_ROM=y
CONFIG_IMG_LINK=y
13 changes: 8 additions & 5 deletions elks/arch/i86/boot/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ _start:
// Start cleaning BSS. Still using setup.S stack

mov _enddata,%di // start of BSS
mov %dx,%cx // CX = BSS size
mov %dx,%cx // CX = BSS size
xor %ax,%ax
shr $1,%cx
cld
Expand All @@ -48,12 +48,15 @@ _start:

// Set SS:SP to task[0] kernel stack area

mov %ds,%ax // in ROMCODE stack is ready placed
mov %ax,%ss // SS=ES=DS
mov %ds,%ax
mov %ax,%ss // SS=ES=DS
mov $task + TASK_USER_AX,%sp

call start_kernel // Break point if it returns
int $3
call start_kernel // fall through into breakpoint if returns

.global int3
int3: int $3 // C breakpoint for emu86
ret

early_printk:
push %bp
Expand Down
7 changes: 5 additions & 2 deletions elks/arch/i86/boot/setup.S
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ size_ok:
mov 14,%cx //; Check data section size
or %cx,%cx
jnz size_error //; .data section too big
mov 4,%cx // check for no fartext header
cmp $0x20,%cx
jnz size_error

//;and now copy the kerneldata
// WARNING: Next code fails if code_size+data_size+32 > 64K
Expand All @@ -431,8 +434,7 @@ size_ok:
mov 0x10,%dx // bss size
mov 0x0c,%si // data size
mov 0x08,%bx // text size
xor %di,%di // far text size
mov 0x18,%ax // entry point
mov 0x14,%ax // entry point
mov %es,%cx // data segment
mov %cx,%ds

Expand All @@ -443,6 +445,7 @@ size_ok:
mov $SYSSEG+2,%di
push %di
push %ax
xor %di,%di // far text size
lret

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
1 change: 0 additions & 1 deletion elks/arch/i86/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ CONFIG_PIPE=y
#
# Executable file formats
#
CONFIG_EXEC_ELKS=y

#
# Drivers
Expand Down
1 change: 0 additions & 1 deletion elks/arch/i86/drivers/char/bioscon.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ void console_init(void)

C++;
}

printk("BIOS console %ux%u"TERM_TYPE"(%u virtual consoles)\n",
Width, Height, NumConsoles);
}
Expand Down
93 changes: 93 additions & 0 deletions elks/arch/i86/lib/unused/divmodsi3.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

.code16

.text
.extern ldivmod
.extern ludivmod

.global __divsi3
.align 1

__divsi3:
push %bp
mov %sp,%bp
push %bx
push %cx
push %di
mov 4(%bp),%ax
mov 6(%bp),%bx
mov 8(%bp),%cx
mov 10(%bp),%di
call ldivmod
mov %di,%dx
mov %cx,%ax
pop %di
pop %cx
pop %bx
pop %bp
ret

.global __modsi3
.align 1

__modsi3:
push %bp
mov %sp,%bp
push %bx
push %cx
push %di
mov 4(%bp),%ax
mov 6(%bp),%bx
mov 8(%bp),%cx
mov 10(%bp),%di
call ldivmod
mov %bx,%dx
pop %di
pop %cx
pop %bx
pop %bp
ret

.global __udivsi3
.align 1

__udivsi3:
push %bp
mov %sp,%bp
push %bx
push %cx
push %di
mov 4(%bp),%ax
mov 6(%bp),%bx
mov 8(%bp),%cx
mov 10(%bp),%di
call ludivmod
mov %di,%dx
mov %cx,%ax
pop %di
pop %cx
pop %bx
pop %bp
ret

.global __umodsi3
.align 1

__umodsi3:
push %bp
mov %sp,%bp
push %bx
push %cx
push %di
mov 4(%bp),%ax
mov 6(%bp),%bx
mov 8(%bp),%cx
mov 10(%bp),%di
call ludivmod
mov %bx,%dx
pop %di
pop %cx
pop %bx
pop %bp
ret

Loading

0 comments on commit 02c160c

Please sign in to comment.