Code: Select all
void kmain() {
unsigned char *videoram = (unsigned char *)0xb8000;
videoram[0]='H';
videoram[2]='i';
}
However, if I start using global variables...
Code: Select all
char h = 'H';
void kmain() {
unsigned char *videoram = (unsigned char *)0xb8000;
videoram[0]=h;
videoram[2]='i';
}
Code: Select all
ENTRY (loader)
SECTIONS {
. = 0x00100000;
.text : {
*(.text)
}
.rodata ALIGN (0x1000) : {
*(.rodata)
}
.data ALIGN (0x1000) : {
*(.data)
}
.bss : {
sbss = .;
*(COMMON)
*(.bss)
ebss = .;
}
/DISCARD/ : {
*(.comment)
}
}
Code: Select all
global loader ; making entry point visible to linker
extern kmain ; kmain is defined elsewhere
; reserve initial kernel stack space
STACKSIZE equ 0x4000 ; that's 16k.
loader:
mov esp, stack+STACKSIZE ; set up the stack
call kmain ; call kernel proper
cli
hang:
hlt ; halt machine should kernel return
jmp hang
section .bss
align 4
stack:
resb STACKSIZE ; reserve 16k stack on a doubleword boundary
Any idea what sort of thing could be causing this?
(My code is at github.com/bytbox/wyvern if I left something important out.)