mirror of https://github.com/tailix/loadwarka.git
Move module "header" to "common"
This commit is contained in:
parent
a49f858112
commit
1129507371
5
build.sh
5
build.sh
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue