Skip to content

Commit

Permalink
Merge pull request #33 from chaos4ever/feature/make-boot-server-work-…
Browse files Browse the repository at this point in the history
…again

Made the boot server work again
  • Loading branch information
perlun committed May 21, 2015
2 parents 73ec24a + 7968e2a commit b0b0b46
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 93 deletions.
18 changes: 9 additions & 9 deletions grub.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
timeout 5

title chaos
rootnoverify (fd0)
kernel /storm
module /servers/console
timeout 5

title chaos
rootnoverify (fd0)
kernel /storm
module /servers/console
module /servers/keyboard
module /servers/vga
#module /servers/log
#module /servers/boot
module /servers/vga
module /servers/log
module /servers/boot
6 changes: 3 additions & 3 deletions libraries/system/system_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static inline return_type system_call_memory_deallocate(void **address)
asm volatile("pushl %2\n"
"lcall %3, $0"
: "=a" (return_value),
"=ri" (*address)
"=m" (*address)
: "ri" (address),
"n" (SYSTEM_CALL_MEMORY_DEALLOCATE << 3));

Expand All @@ -174,7 +174,7 @@ static inline return_type system_call_memory_get_physical_address(void *virtual_
"pushl %3\n"
"lcall %4, $0"
: "=a" (return_value),
"=ri" (*physical_address)
"=m" (*physical_address)
: "ri" (physical_address),
"ri" (virtual_address),
"n" (SYSTEM_CALL_MEMORY_GET_PHYSICAL_ADDRESS << 3));
Expand All @@ -192,7 +192,7 @@ static inline return_type system_call_memory_reserve(address_type start, unsigne
"pushl %4\n"
"lcall %5, $0"
: "=a" (return_value),
"=ri" (*virtual_address)
"=m" (*virtual_address)
: "ri" (virtual_address),
"ri" (size),
"ri" (start),
Expand Down
2 changes: 1 addition & 1 deletion qemu.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
qemu -s -m 32 -curses -fda floppy.img
qemu -s -m 32 -curses -fda floppy.img -d int
25 changes: 0 additions & 25 deletions servers/system/boot/autochaos.rules

This file was deleted.

11 changes: 0 additions & 11 deletions servers/system/boot/changelog

This file was deleted.

2 changes: 1 addition & 1 deletion servers/system/keyboard/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ void keyboard_handle_event(u8 scancode)

if ((scancode & 0x80) == 0)
{
// A key was pressed. */
// A key was pressed.
keyboard_pressed_keys[scancode / 8] |= (1 << (scancode % 8));

// Check if the pressed key is a lock key.
Expand Down
88 changes: 45 additions & 43 deletions servers/video/vga/vgalib.asm
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
; Abstract: x86 assembly-level VGA helper functions
; Author: Johan Thim (Thank you for your great help!)
;
; Copyright 1999-2000, 2013 chaos development.
; © Copyright 1999-2000 chaos development
; © Copyright 2013 chaos development
; © Copyright 2015 chaos development

; FIXME: Rewrite this in C!

extern font_8x8
extern graphic_video_memory
global vga_set_mode
global vga_set_mode

section .data
section .data

mode_80x50: db 067h, 000h, 003h, 000h, 003h, 000h, 002h, 05Fh, 04Fh, 050h, 082h, 055h, 081h, 0BFh, 01Fh, 000h
db 047h, 006h, 007h, 000h, 000h, 000h, 000h, 09Ch, 08Eh, 08Fh, 028h, 01Fh, 096h, 0B9h, 0A3h, 0FFh
db 000h, 000h, 000h, 000h, 000h, 010h, 00Eh, 000h, 0FFh, 000h, 001h, 002h, 003h, 004h, 005h, 014h
db 007h, 038h, 039h, 03Ah, 03Bh, 03Ch, 03Dh, 03Eh, 03Fh, 00Ch, 000h, 00Fh, 008h, 000h
mode_80x50: db 067h, 000h, 003h, 000h, 003h, 000h, 002h, 05Fh, 04Fh, 050h, 082h, 055h, 081h, 0BFh, 01Fh, 000h
db 047h, 006h, 007h, 000h, 000h, 000h, 000h, 09Ch, 08Eh, 08Fh, 028h, 01Fh, 096h, 0B9h, 0A3h, 0FFh
db 000h, 000h, 000h, 000h, 000h, 010h, 00Eh, 000h, 0FFh, 000h, 001h, 002h, 003h, 004h, 005h, 014h
db 007h, 038h, 039h, 03Ah, 03Bh, 03Ch, 03Dh, 03Eh, 03Fh, 00Ch, 000h, 00Fh, 008h, 000h

mode_320x200x256:
db 063h, 000h, 003h, 001h, 00Fh, 000h, 00Eh, 05Fh, 04Fh, 050h, 082h, 054h, 080h, 0BFh, 01Fh, 000h
db 041h, 000h, 000h, 000h, 000h, 000h, 000h, 09Ch, 08Eh, 08Fh, 028h, 040h, 096h, 0B9h, 0A3h, 0FFh
db 000h, 000h, 000h, 000h, 000h, 040h, 005h, 00Fh, 0FFh, 000h, 001h, 002h, 003h, 004h, 005h, 006h
db 007h, 008h, 009h, 00Ah, 00Bh, 00Ch, 00Dh, 00Eh, 00Fh, 041h, 000h, 00Fh, 000h, 000h
db 063h, 000h, 003h, 001h, 00Fh, 000h, 00Eh, 05Fh, 04Fh, 050h, 082h, 054h, 080h, 0BFh, 01Fh, 000h
db 041h, 000h, 000h, 000h, 000h, 000h, 000h, 09Ch, 08Eh, 08Fh, 028h, 040h, 096h, 0B9h, 0A3h, 0FFh
db 000h, 000h, 000h, 000h, 000h, 040h, 005h, 00Fh, 0FFh, 000h, 001h, 002h, 003h, 004h, 005h, 006h
db 007h, 008h, 009h, 00Ah, 00Bh, 00Ch, 00Dh, 00Eh, 00Fh, 041h, 000h, 00Fh, 000h, 000h

mode_640x400x256:
db 063h, 000h, 003h, 001h, 00Fh, 000h, 006h, 05Fh, 04Fh, 050h, 082h, 054h, 080h, 0BFh, 01Fh, 000h
db 040h, 000h, 000h, 000h, 000h, 000h, 000h, 09Ch, 08Eh, 08Fh, 050h, 000h, 096h, 0B9h, 0E3h, 0FFh
db 000h, 000h, 000h, 000h, 000h, 040h, 005h, 00Fh, 0FFh, 000h, 001h, 002h, 003h, 004h, 005h, 006h
db 007h, 008h, 009h, 00Ah, 00Bh, 00Ch, 00Dh, 00Eh, 00Fh, 041h, 000h, 00Fh, 000h, 000h
db 063h, 000h, 003h, 001h, 00Fh, 000h, 006h, 05Fh, 04Fh, 050h, 082h, 054h, 080h, 0BFh, 01Fh, 000h
db 040h, 000h, 000h, 000h, 000h, 000h, 000h, 09Ch, 08Eh, 08Fh, 050h, 000h, 096h, 0B9h, 0E3h, 0FFh
db 000h, 000h, 000h, 000h, 000h, 040h, 005h, 00Fh, 0FFh, 000h, 001h, 002h, 003h, 004h, 005h, 006h
db 007h, 008h, 009h, 00Ah, 00Bh, 00Ch, 00Dh, 00Eh, 00Fh, 041h, 000h, 00Fh, 000h, 000h

mode_640x480x16:
db 0E3h, 000h, 003h, 001h, 00Fh, 000h, 006h, 05Fh, 04Fh, 050h, 082h, 054h, 080h, 00Bh, 03Eh, 000h
db 040h, 000h, 000h, 000h, 000h, 000h, 000h, 0EAh, 08Ch, 0DFh, 028h, 000h, 0E7h, 004h, 0E3h, 0FFh
db 000h, 000h, 000h, 000h, 000h, 000h, 005h, 00Fh, 0FFh, 000h, 001h, 002h, 003h, 004h, 005h, 014h
db 007h, 038h, 039h, 03Ah, 03Bh, 03Ch, 03Dh, 03Eh, 03Fh, 001h, 000h, 00Fh, 000h, 000h
db 0E3h, 000h, 003h, 001h, 00Fh, 000h, 006h, 05Fh, 04Fh, 050h, 082h, 054h, 080h, 00Bh, 03Eh, 000h
db 040h, 000h, 000h, 000h, 000h, 000h, 000h, 0EAh, 08Ch, 0DFh, 028h, 000h, 0E7h, 004h, 0E3h, 0FFh
db 000h, 000h, 000h, 000h, 000h, 000h, 005h, 00Fh, 0FFh, 000h, 001h, 002h, 003h, 004h, 005h, 014h
db 007h, 038h, 039h, 03Ah, 03Bh, 03Ch, 03Dh, 03Eh, 03Fh, 001h, 000h, 00Fh, 000h, 000h

mode_table: dd mode_320x200x256
dd mode_80x50
dd mode_80x50
dd mode_640x480x16
dd mode_640x400x256

Expand All @@ -52,33 +54,33 @@ vga_buff dd miff
; FIXME: for some reason, the VGA server won't start if this is put into the
; BSS section.

;section .bss
;section .bss

miff times 300 db 0
miff times 300 db 0

section .text
section .text

vga_set_mode: push ebp
mov ebp, esp
mov ebp, esp
pusha

mov eax, [ebp + 8]
mov esi, [mode_table + eax * 4]
push eax
call setmode
mov eax, [ebp + 8]
mov esi, [mode_table + eax * 4]
push eax
call setmode

pop eax
cmp byte [mode_t_table + eax], 1
jne .no_font
pop eax
cmp byte [mode_t_table + eax], 1
jne .no_font

mov dword [font_ptr], font_8x8
mov byte [font_bytes], 8
mov dword [font_ptr], font_8x8
mov byte [font_bytes], 8

call loadfont

.no_font: popa
pop ebp
ret
ret

; End of vga_set_mode

Expand All @@ -102,13 +104,13 @@ setmode: mov dx,3c2h ; misc addr

mov dx,3d4h ; crtc addr
mov ax,0e11h ; clear protection
out dx,ax
out dx,ax

xor ecx,ecx
mov dx,3d4h ; crtc addr
.2: lodsb
xchg al,ah
mov al,cl
mov al,cl
out dx,ax
inc ecx
cmp cl,18h
Expand All @@ -125,23 +127,23 @@ setmode: mov dx,3c2h ; misc addr
jbe .3

mov dx,3dah ; clear flip/flop
in al,dx
in al,dx

xor ecx,ecx
mov dx,3c0h ; attrcon
.4: in al, dx ; change flip/flop state
mov ah, al
in al, dx
mov al,cl
out dx,al
mov ah, al
in al, dx
mov al,cl
out dx,al
lodsb
out dx,al
inc ecx
cmp cl,14h
jbe .4

mov al,20h
out dx,al
mov al,20h
out dx,al

ret

Expand Down

0 comments on commit b0b0b46

Please sign in to comment.