Hi
In my bootloader i set my GDTs (data, code) base too 16 x DS at run time, this is because i am useing a com file loaded from a com file bootloader, i also have a linear based set to 0 .
Two questions,
1. will this couse me problems later on ??
2. If i set these to 0 i get a treble fault , is this because where the com file is loaded ??.
Many thanks for any help
ASHLEY4
GDT?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:GDT?
hmm ... i'm a bit confuse. Let's try to summarize.
Your kernel is written as a MsDOS COM executable (thus expecting org 100h and stuff). You load it somewhere in memory at address X*16 and launch it with CS = DS = SS = X, right ?
Now you'd like to keep the same offsets in pmode, and thus have your kernel independent of its actual location, right ? So you setup GDT[CODE_SELECTOR].base = X*16 and GDT[DATA_SELECTOR].base = X*16 ...
Blah.
Here what you get is a "Tripple Fault", which probably comes from the fact you have code that 'believes' myFunction is reachable with "call 0x1234", for instance, while it is actually at the address REAL_CS*16 + 0x1234 ... so as long as your base is REAL_CS*16, it works, but with a base of 0, it will send the execution out of your loaded kernel. The solution if you want to use a zero-based kernel is to know at compile-time the load address and to have the linker/assembler generate offsets for this location ...
This is usually achieved by a proper linker script.
Clicker uses the 'base' trick or custom-binary-tools to relocate modules, so i cannot really help you on this point...
Your kernel is written as a MsDOS COM executable (thus expecting org 100h and stuff). You load it somewhere in memory at address X*16 and launch it with CS = DS = SS = X, right ?
Now you'd like to keep the same offsets in pmode, and thus have your kernel independent of its actual location, right ? So you setup GDT[CODE_SELECTOR].base = X*16 and GDT[DATA_SELECTOR].base = X*16 ...
Well, it will not lead to 'problems', but to 'difficulties'... everytime you'll try to access something that is at a known physical (or linear when paging comes into play) address, you'll have to perform some address translation likewill this couse(sic) me problems later on ??
Code: Select all
#define Logical2Absolute(x) x + X*16
#define Absolute2Logical(x) x - X*16
lol. "Trebble fault" aka "Broken Crystal Exception", occurs when you overclock the speaker's frequency, which causes too high notes -- which tends to break glasses, etc. including the crystal clock of the PC ...If i set these to 0 i get a treble fault
Blah.
Here what you get is a "Tripple Fault", which probably comes from the fact you have code that 'believes' myFunction is reachable with "call 0x1234", for instance, while it is actually at the address REAL_CS*16 + 0x1234 ... so as long as your base is REAL_CS*16, it works, but with a base of 0, it will send the execution out of your loaded kernel. The solution if you want to use a zero-based kernel is to know at compile-time the load address and to have the linker/assembler generate offsets for this location ...
This is usually achieved by a proper linker script.
Clicker uses the 'base' trick or custom-binary-tools to relocate modules, so i cannot really help you on this point...