Printing ticks doesn't work
-
- Posts: 10
- Joined: Sun May 29, 2016 11:23 am
- Location: Poland
- Contact:
Printing ticks doesn't work
Hello,
https://github.com/jpacanowski/GekonOS/ ... imer.c#L12
I want to print out the ticks on the screen and I don't know why this kprintf() function doesn't work...
It looks like something crashed.
It's been 2 weeks I've been trying to figure it out...
Could you help me, please?
Best regards
https://github.com/jpacanowski/GekonOS/ ... imer.c#L12
I want to print out the ticks on the screen and I don't know why this kprintf() function doesn't work...
It looks like something crashed.
It's been 2 weeks I've been trying to figure it out...
Could you help me, please?
Best regards
-
- Member
- Posts: 5586
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Printing ticks doesn't work
It looks like you're following James Molloy's tutorial, which is known to have bugs. Here's a list of the bugs we know about. (This list may not be complete.)
In particular, take a look at the section titled "Interrupt handlers corrupt interrupted state". That's usually the first one people run into.
In particular, take a look at the section titled "Interrupt handlers corrupt interrupted state". That's usually the first one people run into.
-
- Posts: 10
- Joined: Sun May 29, 2016 11:23 am
- Location: Poland
- Contact:
Re: Printing ticks doesn't work
Thanks for the reply.
I modified the interrupt.asm file according to the "James Molloy's Tutorial Known Bugs", but still the same... ;(
The rest of my code looks like it's OK.. Especially when I compare my code to this one:
https://github.com/cfenollosa/os-tutorial
Somebody, help me please...
I want to start further OS development, but I'm stuck with it...
It's been 2 weeks... ;(
I modified the interrupt.asm file according to the "James Molloy's Tutorial Known Bugs", but still the same... ;(
The rest of my code looks like it's OK.. Especially when I compare my code to this one:
https://github.com/cfenollosa/os-tutorial
Somebody, help me please...
I want to start further OS development, but I'm stuck with it...
It's been 2 weeks... ;(
Re: Printing ticks doesn't work
Your call to in timer.c shouln't do &timer_callback but just timer_callback since functions are all already pointers, and timer_callback should have registers_t in its arguments. Also you should do 23-fixes from https://github.com/cfenollosa/os-tutorial
Code: Select all
void register_interrupt_handler(u8 n, isr_t handler)
-
- Posts: 10
- Joined: Sun May 29, 2016 11:23 am
- Location: Poland
- Contact:
Re: Printing ticks doesn't work
I have done all the fixes according to the 23-fixes and your advice, but it still doesn't work...
I fixed interrupt.asm, created mem* functions, changed registers_t r into registers_t *t, and so on...
I fixed interrupt.asm, created mem* functions, changed registers_t r into registers_t *t, and so on...
Re: Printing ticks doesn't work
I've just cloned your repo and it seems to be working for me, so the one thing I could think about is compile eviroment changes. You should compile with a cross-compiler GCC_Cross-Compiler
edit: Here's a link to my compiled ISO https://mega.nz/#!lLhlFKKD!j_dt023QdXBT ... pKT93b02YI
edit: Here's a link to my compiled ISO https://mega.nz/#!lLhlFKKD!j_dt023QdXBT ... pKT93b02YI
-
- Member
- Posts: 799
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: Printing ticks doesn't work
thomtl is making a good suggesting about making a cross compiler rather than use you the native compiler on your OS. The problem is in how you are building and linking your code. The issue is that your native compiler is defaulting to position independent code and position independent executable code generation. You are hiding the problem(not fixing it) by adding --ignore-unresolved-symbol _GLOBAL_OFFSET_TABLE_ to your linking command. Remove this from the linking step, and add the `-fno-PIE` option instead. You will also have to compile the .c files without position independent code as well so you'll need to add the `-fno-PIC` flag to the C flags you are using. The changedlines in your build file could look like:then:I am curious where you might have learned to use --ignore-unresolved-symbol _GLOBAL_OFFSET_TABLE_? Someone else in the past few weeks had the same problem in a question on this forum.
Code: Select all
# default variables
CFLAGS="-m32 -c -g -O2 -W -Wall -Wextra -Werror -fno-PIC "\
"-ffreestanding -std=gnu99 -fno-builtin -Ikernel/include -Ilibc/include"
CFLAGS_LIBC="-m32 -c -g -O2 -W -Wall -Wextra -Werror -fno-PIC "\
"-ffreestanding -std=gnu99 -fno-builtin -Ikernel/include -Ilibc/include"
Code: Select all
ld -g -m elf_i386 -T kernel/link.ld -no-PIE -o kernel.bin kentry.o kernel.o video.o gdt.o idt.o isr.o timer.o x86.o interrupt.o vbe.o gui.o libc.a
-
- Posts: 10
- Joined: Sun May 29, 2016 11:23 am
- Location: Poland
- Contact:
Re: Printing ticks doesn't work
Thanks! Building own cross-compiler really helped. Now everything is working well...
But compiling big projects (like GCC) is what I really hate doing by myself... Why? Lots of code and lots of warning when compiling... My heart is beating faster when I type "make all". That's why I stayed away from compiling my own cross-compiler... It all happened for the first time when I wanted to compile the Linux kernel from sources...
I will also do what MichaelPetch wrote by fixing how I am linking the code by adding --ignore-unresolved-symbol _GLOBAL_OFFSET_TABLE_
Where did I find that? Well, on Stack overflow
Thank you, guys...
But compiling big projects (like GCC) is what I really hate doing by myself... Why? Lots of code and lots of warning when compiling... My heart is beating faster when I type "make all". That's why I stayed away from compiling my own cross-compiler... It all happened for the first time when I wanted to compile the Linux kernel from sources...
I will also do what MichaelPetch wrote by fixing how I am linking the code by adding --ignore-unresolved-symbol _GLOBAL_OFFSET_TABLE_
Where did I find that? Well, on Stack overflow
Thank you, guys...
-
- Member
- Posts: 799
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: Printing ticks doesn't work
In the context of making shared libraries it can make sense, but not here. Can you post a link to the StackOverflow post?
-
- Posts: 10
- Joined: Sun May 29, 2016 11:23 am
- Location: Poland
- Contact:
Re: Printing ticks doesn't work
I'm sorry, it was not Stack Overflow...
https://github.com/cfenollosa/os-tutorial/issues/16
https://github.com/cfenollosa/os-tutorial/issues/16
-
- Member
- Posts: 799
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: Printing ticks doesn't work
Thanks, I had a suspicion it was that. Last week I posted a warning there not to use it in that way.