TSS implicit function delcleration [SOLVED]

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.
Post Reply
aether123
Posts: 18
Joined: Fri Jun 20, 2025 5:23 pm
Libera.chat IRC: aether123

TSS implicit function delcleration [SOLVED]

Post by aether123 »

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:

Code: Select all

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.

Here are my up to date project files: https://github.com/i-love-winter/SolsticeOS

Any help would be much appreciated!
Last edited by aether123 on Fri Jun 20, 2025 10:17 pm, edited 1 time in total.
Capybara Gymastics is one of the most prestigious Olympic sports
nullplan
Member
Member
Posts: 1908
Joined: Wed Aug 30, 2017 8:24 am

Re: TSS implicit function delcleration

Post by nullplan »

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!
Carpe diem!
aether123
Posts: 18
Joined: Fri Jun 20, 2025 5:23 pm
Libera.chat IRC: aether123

Re: TSS implicit function delcleration

Post by aether123 »

Now that I've included the header file it seems to give this error:

Code: Select all

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
Octocontrabass
Member
Member
Posts: 5873
Joined: Mon Mar 25, 2013 7:01 pm

Re: TSS implicit function delcleration

Post by Octocontrabass »

...That's not a header file. Are you sure you understand C well enough to write an OS in C?

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.
aether123
Posts: 18
Joined: Fri Jun 20, 2025 5:23 pm
Libera.chat IRC: aether123

Re: TSS implicit function delcleration

Post by aether123 »

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
aether123
Posts: 18
Joined: Fri Jun 20, 2025 5:23 pm
Libera.chat IRC: aether123

Re: TSS implicit function delcleration

Post by aether123 »

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 #-o
Anyway, thanks for helping me solve it!
Capybara Gymastics is one of the most prestigious Olympic sports
Post Reply