Move module "header" to "common"

This commit is contained in:
Alex Kotov 2022-01-28 00:26:06 +05:00
parent a49f858112
commit 1129507371
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 32 additions and 39 deletions

View File

@ -9,12 +9,11 @@ CROSS="$BIN/i386-elf-"
STAGE1_LDFLAGS='--defsym=program_start=0x7c00'
STAGE2_LDFLAGS='--defsym=program_start=0x7e00'
STAGE1_OBJS="$SRC/header.o $SRC/common.o $SRC/stage1.o"
STAGE2_OBJS="$SRC/header.o $SRC/common.o $SRC/stage2.o"
STAGE1_OBJS="$SRC/common.o $SRC/stage1.o"
STAGE2_OBJS="$SRC/common.o $SRC/stage2.o"
./clean.sh
${CROSS}gcc -c $SRC/header.S -o $SRC/header.o
${CROSS}gcc -c $SRC/common.S -o $SRC/common.o
${CROSS}gcc -c $SRC/stage1.S -o $SRC/stage1.o
${CROSS}gcc -c $SRC/stage2.S -o $SRC/stage2.o

View File

@ -2,13 +2,43 @@
#include "config.h"
#endif
#define STACK_BASE 0x2000
.code16
.global disk_number
.global restore_disk_number
.global hang
.global print_char
.global print_str
.global print_number
.section .data
disk_number: .byte 0
.section .header
ljmp $0, $init
.align 4
.word program_size
init:
cli
xor %ax, %ax
mov %ax, %ss
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
mov $STACK_BASE, %sp
mov %dl, disk_number
ljmp $0, $_start
.section .text
restore_disk_number:
mov $disk_number, %bx
mov (%bx), %dl
ret
hang:
cli
hlt

View File

@ -1,36 +0,0 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define STACK_BASE 0x2000
.code16
.global disk_number
.global restore_disk_number
.section .data
disk_number: .byte 0
.section .header
ljmp $0, $init
.align 4
.word program_size
init:
cli
xor %ax, %ax
mov %ax, %ss
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
mov $STACK_BASE, %sp
mov %dl, disk_number
ljmp $0, $_start
.section .text
restore_disk_number:
mov $disk_number, %bx
mov (%bx), %dl
ret