For example,
I have a kmain that do gdt, idt, isrs, irq, video and timer initialization then when I write :
Code: Select all
test_func("test");
Code: Select all
void test_func(char * string)
{
if(string[0] == '\0'){
putch('n');
}else{
putch('o');
}
}
and if I test :
Code: Select all
if (string == NULL){
putch('n');
}else{
putch('o');
putch(string[0]);
}
for linking and compiling , I'm using
Code: Select all
ld -m i386linux -T linker/link.ld -nostdlib -o kern.my ../obj/start.o \
../obj/main.o \
../obj/scrn.o \
../obj/gdt.o \
../obj/idt.o \
../obj/isrs.o \
../obj/irq.o \
../obj/timer.o \
../obj/io.o \
../obj/yshell.o \
../obj/kb.o
[Linker script]
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
Code: Select all
eax 0x1 1
ecx 0x0 0
edx 0x3d5 981
ebx 0x9500 38144
esp 0x104fe0 0x104fe0
ebp 0x0 0x0
esi 0x0 0
edi 0x108000 1081344
eip 0x100356 0x100356
eflags 0x6 [ PF ]
cs 0x8 8
ss 0x10 16
ds 0x10 16
es 0x10 16
fs 0x10 16
gs 0x10 16