Page 1 of 1

Setting the TSS is breaking my OS!

Posted: Mon Apr 01, 2024 4:54 pm
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<

Re: Setting the TSS is breaking my OS!

Posted: Tue Jun 11, 2024 6:39 pm
by Octocontrabass
What kind of debugging have you tried so far?

Re: Setting the TSS is breaking my OS!

Posted: Wed Jul 03, 2024 11:22 am
by Sa41848
well... I think none

Re: Setting the TSS is breaking my OS!

Posted: Wed Jul 03, 2024 9:39 pm
by Octocontrabass
Most virtual machines have some debugging capabilities. Are you using a virtual machine, and if so, which one?

Re: Setting the TSS is breaking my OS!

Posted: Thu Jul 04, 2024 2:14 pm
by Sa41848
I'm using virtualbox to test my OS

Re: Setting the TSS is breaking my OS!

Posted: Thu Jul 04, 2024 5:42 pm
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.

Re: Setting the TSS is breaking my OS!

Posted: Sat Jul 06, 2024 2:20 pm
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.

Re: Setting the TSS is breaking my OS!

Posted: Sat Jul 06, 2024 9:52 pm
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