Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I'm currently making a 32 bit OS, and I'm having a problem with the Task State Segment. It appears that my tss_flush function is not found in the code. Running make gives this error:
src/kernel/gdt/gdt.c: In function 'initGdt':
src/kernel/gdt/gdt.c:31:3: error: implicit declaration of function 'tss_flush'; did you mean 'gdt_flush'? [-Wimplicit-function-declaration]
31 | tss_flush(); // this line doesn't work for some reason, need to figure out what's going on
| ^~~~~~~~~
| gdt_flush
make: *** [Makefile:14: includes] Error 1
The code seemed to be working fine before I started working on the TSS, the GDT was working fine, without any errors at all, so I think there might be a problem with the makefile, but I'm very confused as to what's going wrong.
What this message means is that at the point you are calling tss_flush(), you have not declared it. This typically happens when you forget to put the prototype in the header file, or forget to include the header file. Just leaving the code as it currently is is not advisable, since if the implicit declaration the compiler generates does not exactly match the actual definition of the function, you invoke undefined behavior. Just include the header file!
In file included from src/kernel/gdt/gdt.c:4:
src/kernel/gdt/gdt.s:1:1: error: unknown type name 'global'
1 | global gdt_flush
| ^~~~~~
src/kernel/gdt/gdt.s:3:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdt_flush'
3 | gdt_flush:
| ^~~~~~~~~
src/kernel/gdt/gdt.c: In function 'initGdt':
src/kernel/gdt/gdt.c:31:3: error: implicit declaration of function 'gdt_flush' [-Wimplicit-function-declaration]
31 | gdt_flush((uint32_t)&gdt_ptr);
| ^~~~~~~~~
src/kernel/gdt/gdt.c:32:3: error: implicit declaration of function 'tss_flush' [-Wimplicit-function-declaration]
32 | tss_flush(); // this line doesn't work for some reason, need to figure out what's going on
| ^~~~~~~~~
make: *** [Makefile:14: includes] Error 1
Capybara Gymastics is one of the most prestigious Olympic sports
Anyway, the original problem is a missing declaration. I don't see the declaration for tss_flush() anywhere in your code, so perhaps start by figuring out what the declaration should be, then figure out where you want to put it.
My plan for how I wanted to do the tss_flush command was that I was going to write it in the gdt.s file, and compile it with the gdt.c file into one file, so that they would work together, but is what you're saying that I can't create the function in gdt.s and use it in gdt.c?
Capybara Gymastics is one of the most prestigious Olympic sports
Thank you so much! It's working fine (nearly) now that I put the function declaration in gdt.c, I guess I just forgot it
Anyway, thanks for helping me solve it!
Capybara Gymastics is one of the most prestigious Olympic sports