summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-06 20:43:57 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-06 20:43:57 +0100
commit1271f4f3e3891b1de2f810c2063490c4a71a2518 (patch)
treee4d872454a8e2e1330fd16e8af360da3abe9bcd6
parent2a30fa85fd50919aa45fac4b961cc9508732b62a (diff)
vdi target for virtualbox.
-rw-r--r--Makefile7
-rw-r--r--boot/disk_load_16.asm41
-rw-r--r--boot/stage2.asm4
-rw-r--r--kernel/kernel.c2
4 files changed, 43 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index c130e17..64ae1f9 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,7 @@ FILLUP=./data/fill.bin
############ final image (default target) ############
-all: FoolOS.img FoolData.img
+all: FoolOS.vdi
new: clean all
@@ -113,6 +113,9 @@ FoolData.img: binfont.bin $(MP_BIN) userspace/ext2.img
dd if=binfont.bin of=$@ bs=512 seek=1 conv=notrunc
dd if=userspace/ext2.img of=$@ bs=512 seek=4 conv=notrunc #will end up at 0x80800 in ram
+FoolOS.vdi: FoolOS.img
+ VBoxManage convertfromraw FoolOS.img FoolOS.vdi
+
############ vm stuff ############
# run in our local bochs (we need cirrus support for our vesa mode)
@@ -128,7 +131,7 @@ clean_release:
make -C userspace clean
clean: clean_release
- -rm FoolOS.img
+ -rm FoolOS.img FoolOS.vdi
release: new
-mv FoolOS.img release/
diff --git a/boot/disk_load_16.asm b/boot/disk_load_16.asm
index ae34360..52912f4 100644
--- a/boot/disk_load_16.asm
+++ b/boot/disk_load_16.asm
@@ -108,13 +108,42 @@ disk_load_chs:
pusha
+ ; get boot drive geometry
+ mov ah,8
+ mov dl,[BOOT_DRIVE]
+ int 0x13
+
+ add dh,1
+ and cl,0x3f
+
+ mov [bpbSectorsPerTrack],cl
+ mov [bpbHeadsPerCylinder],dh
+ ;
+
+ ;show geometry
+ mov al,dh
+ call print_hex_byte
+
+ mov bx, STR_SPACE
+ call print_string
+
+ mov al,cl
+ call print_hex_byte
+
+ call print_nextline
+ popa
+ ;
+
+ pusha
+
+
mov bx,0x1800 ;target es:bx
mov es,bx
mov bx,0
next_sectors_chs:
- jmp skip_debug
+ ;jmp skip_debug
pusha
mov bx, STR_SPACE
@@ -132,7 +161,7 @@ disk_load_chs:
mov bx, STR_SPACE
call print_string
- ;load and show next LBA numer
+ ;show next LBA numer
mov ax,[LBA]
mov al,ah
call print_hex_byte
@@ -171,7 +200,7 @@ disk_load_chs:
call lba_to_chs
; and now READ it!
- mov al,16 ;number of sectors to read
+ mov al,1 ;number of sectors to read
mov dl,[BOOT_DRIVE]
mov ah,0x02 ;BIOS read sector func
@@ -180,15 +209,15 @@ disk_load_chs:
jc disk_read_error
mov bx,es
- add bx,0x0200
- cmp bx,0x9e00
+ add bx,0x0020
+ cmp bx,0x9000
je disk_load_finish
mov es,bx
mov bx,0
mov ax,[LBA]
- add ax,16
+ add ax,1
mov [LBA],ax
jmp next_sectors_chs
diff --git a/boot/stage2.asm b/boot/stage2.asm
index 9a1c74c..517e481 100644
--- a/boot/stage2.asm
+++ b/boot/stage2.asm
@@ -39,8 +39,8 @@
;
MEMMAP_SIZE_OFFSET equ 0x7c00
MEMMAP_OFFSET equ 0x7c01
-VESA_MODES equ 0x8300 ; do NOT overwrite yourself! be careful!
-VESA_MODE_INFO equ 0x8400
+VESA_MODES equ 0x9300 ; do NOT overwrite yourself! be careful!
+VESA_MODE_INFO equ 0x9400
VESA_MODE_SELECT equ 0x4114
;
diff --git a/kernel/kernel.c b/kernel/kernel.c
index fa6c349..f3c20e9 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -94,7 +94,7 @@ void kernel_main(uint32_t initial_stack, int mp)
// this function returns the physical base address of
// our video memory
//
- uint32_t vesa_physbase=vesa_init(0x8300,0x8400,0x168000+512);//0x80000+0x200);
+ uint32_t vesa_physbase=vesa_init(0x9300,0x9400,0x168000+512);//0x80000+0x200);
// self-log message of logger :P
log_log();