[hacks] HACKS

This commit is contained in:
Kevin Lange 2011-03-28 20:34:53 -05:00
parent 9b1ab6e97f
commit 516490a711
5 changed files with 76 additions and 2 deletions

View File

@ -8,6 +8,7 @@
void
parse_args(char * arg) {
if (!arg) { return; }
char * pch;
char * cmd;
char * save;

View File

@ -105,7 +105,7 @@ tasking_install() {
current_task->esp = 0;
current_task->ebp = 0;
current_task->eip = 0;
current_task->stack = copy_stack((void *)0xE000000, KERNEL_STACK_SIZE, initial_esp);
current_task->stack = initial_esp; //copy_stack((void *)0xE000000, KERNEL_STACK_SIZE, initial_esp);
current_task->page_directory = current_directory;
current_task->next = 0;

View File

@ -16,7 +16,7 @@ uint16_t bochs_resolution_x = 0;
uint16_t bochs_resolution_y = 0;
uint16_t bochs_resolution_b = 0;
#define BOCHS_VID_MEMORY ((uint32_t *)0xE0000000) //((uint32_t *)0xA0000)
uint32_t * BOCHS_VID_MEMORY = (uint32_t *)0xE0000000;
#define TERM_WIDTH 128
#define TERM_HEIGHT 64
@ -58,6 +58,24 @@ graphics_install_bochs() {
outports(0x1CF, 0x41);
/* Herp derp */
uint32_t * herp = (uint32_t *)0xA0000;
herp[0] = 0xA5ADFACE;
uint16_t lfb_addr = pci_get_lfb_addr(0x1234);
kprintf("%x!\n", lfb_addr);
if (lfb_addr) {
BOCHS_VID_MEMORY = (uint32_t *)((uint32_t)lfb_addr << 16);
} else {
/* Go find it */
for (uintptr_t x = (uintptr_t)herp + 0x1000; x < 0xFFFFF000; x += 0x1000) {
if (((uintptr_t *)x)[0] == 0xA5ADFACE) {
BOCHS_VID_MEMORY = (uint32_t *)x;
break;
}
}
}
for (uint16_t x = 0; x < 1024; ++x) {
for (uint16_t y = 0; y < 768; ++y) {
BOCHS_VID_MEMORY[y * 1024 + x] = 0xFFFFFF;

View File

@ -10,6 +10,8 @@
extern void *sbrk(uintptr_t increment);
extern uint16_t pci_get_lfb_addr(uint16_t id);
/* Kernel Main */
extern void *memcpy(void *restrict dest, const void *restrict src, size_t count);
extern void *memmove(void *restrict dest, const void *restrict src, size_t count);

View File

@ -234,6 +234,59 @@ copy_page_physical:
pop ebx
ret
global pci_get_lfb_addr
pci_get_lfb_addr:
push bx
push cx
push dx
push eax
mov bx, ax
xor cx, cx
mov dl, 0x00
call pci_read_reg
cmp ax, 0xffff
jz pci_get_lfb_addr_7
pci_get_lfb_addr_3:
mov cx, 0x1111
mov dl, 0x00
call pci_read_reg
cmp ax, bx
jz pci_get_lfb_addr_4
add cx, 0x8
cmp cx, 0x200
jb pci_get_lfb_addr_3
pci_get_lfb_addr_5:
xor dx, dx
jmp pci_get_lfb_addr_6
pci_get_lfb_addr_7:
mov dx, 0xffff
jmp pci_get_lfb_addr_6
pci_get_lfb_addr_4:
mov dl, 0x10
call pci_read_reg
test ax, 0xfff1
jnz pci_get_lfb_addr_5
shr eax, 16
mov dx, ax
pci_get_lfb_addr_6:
pop eax
mov ax, dx
pop dx
pop cx
pop bx
ret
pci_read_reg:
mov eax, 0x00800000
mov ax, cx
shl eax, 8
mov al, dl
mov dx, 0xcf8
out dx, eax
add dl, 4
in eax, dx
ret
; BSS Section
SECTION .bss
resb 8192 ; 8KB of memory reserved