Setting the TSS is breaking my OS!

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
User avatar
Sa41848
Posts: 4
Joined: Thu Mar 14, 2024 6:31 pm

Setting the TSS is breaking my OS!

Post by Sa41848 »

Hello ladies and gentleman. I am new to this forum so sorry if somehow I broke a rule :wink:
I want to create a working TSS for my OS, but it is stopping my OS from working.
I really dont know what is happening but when I remove the TSS the KERNLDR just works fine!
I would really appreciate any help about it. [-o<
Attachments
teos32nob.zip
(14.72 KiB) Downloaded 133 times
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: Setting the TSS is breaking my OS!

Post by Octocontrabass »

What kind of debugging have you tried so far?
User avatar
Sa41848
Posts: 4
Joined: Thu Mar 14, 2024 6:31 pm

Re: Setting the TSS is breaking my OS!

Post by Sa41848 »

well... I think none
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: Setting the TSS is breaking my OS!

Post by Octocontrabass »

Most virtual machines have some debugging capabilities. Are you using a virtual machine, and if so, which one?
User avatar
Sa41848
Posts: 4
Joined: Thu Mar 14, 2024 6:31 pm

Re: Setting the TSS is breaking my OS!

Post by Sa41848 »

I'm using virtualbox to test my OS
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: Setting the TSS is breaking my OS!

Post by Octocontrabass »

VirtualBox has some logging capabilities and a built-in debugger. The logs might give some hints about what's wrong, and you can use the debugger to examine your code while it's running. You can share the logs here if you're not sure how to interpret them. Unfortunately I'm not very familiar with VirtualBox, so I can't give you any more specific advice than that.

You may have better luck using a different virtual machine, such as QEMU or Bochs. QEMU has much better logging functions, but requires an external debugger (usually GDB). Bochs has a built-in debugger.
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Setting the TSS is breaking my OS!

Post by MichaelPetch »

I'd recommend using BOCHS debugger to step through the code to see where things go wrong. BOCHS is better suited for debugging real mode code than QEMU (IMHO). In this case you read 23 sectors of 512 bytes (11766 bytes = 0x2E00 bytes) from KERNLDR.SYS to memory address 0x500. This means you are reading code/data to address 0x500 to 0x3300 (0x500+0x2E00). You then read TEOS32.TEX to 0x3000. 0x3000 < 0x3300 so you have started to overwrite TEOS32.TEX on top of the memory where your KERNLDR.SYS was loaded into memory. To fix this in kernldr.asm change 0x3000 to something higher like 0x4000 (or some other value that won't collide with memory you are already using).

Likely this worked without the TSS since the TSS added over 8KiB to your KERNLDR.SYS and never reached memory address 0x0000:0x3000 so reading TEOS32.TEX to 0x0000:0x3000 wasn't a problem.
User avatar
Sa41848
Posts: 4
Joined: Thu Mar 14, 2024 6:31 pm

Re: Setting the TSS is breaking my OS!

Post by Sa41848 »

OOOOOOHH I SEE NOW!!! THANK YOU DUDE [-o< [-o< [-o<
Both answer where good in my opinion, I really needed a debugger :D
TYSM!!! I could never come to that conclusion... hehe
Post Reply