virtual mode...
Hi...
I changed the cs to 0 and all other registers are 0x10 as my data
segment descripotr,but unfortunately I got GPF ,so now
my kernel is 1MB marked,cs=0, all other registers are 0x10.
Also when I set tss[1].eip=0x1000 I get stack fault exception
I think I've tried to fix every possible bug but nothing worked
I'm frustrated but I'll keep going untill I do it.
Thanx.
I changed the cs to 0 and all other registers are 0x10 as my data
segment descripotr,but unfortunately I got GPF ,so now
my kernel is 1MB marked,cs=0, all other registers are 0x10.
Also when I set tss[1].eip=0x1000 I get stack fault exception
I think I've tried to fix every possible bug but nothing worked
I'm frustrated but I'll keep going untill I do it.
Thanx.
The value for ss0 and esp0 must be valid protected mode values. They will be the values that are used when the processor handles an interrupt and switches to PL0. Try this set eip to 0x1000 and set esp to a value less than 1mb. Also fix the values in ss0 and esp0 to proper protected mode ones. Then see what happens.
Hi...
I changed eip to 0x1000 esp to 0x8000 also ss0 is 0x10
esp0(dword)&PL0_stack, cs is 0 and I got stack fault exception.
Every time I set esp0 to 0x1000 I get stack fault exception
what ever the other values are..
I'm afraid we are missing something so here's the whole picture:
our multitasking consistes of two tasks:main() PL0 and the virtual task()
which is PL0 too.the virtual task is 1MB marked ,cs,ds fs,gs,ss and es are
all zero ,eip =0x1000 ,ss0=0x10,esp0=(dword)&pl0_stack,EFLAGS = 0x23202L
paging is not enabled and I'm usign long call to switch to the selector
of the virtual task.
With all this values I'm getting stack fault exception,but when I change
eip to tss[1].eip=(dword)&task I get general protection fault.
Thanx.
I changed eip to 0x1000 esp to 0x8000 also ss0 is 0x10
esp0(dword)&PL0_stack, cs is 0 and I got stack fault exception.
Every time I set esp0 to 0x1000 I get stack fault exception
what ever the other values are..
I'm afraid we are missing something so here's the whole picture:
our multitasking consistes of two tasks:main() PL0 and the virtual task()
which is PL0 too.the virtual task is 1MB marked ,cs,ds fs,gs,ss and es are
all zero ,eip =0x1000 ,ss0=0x10,esp0=(dword)&pl0_stack,EFLAGS = 0x23202L
paging is not enabled and I'm usign long call to switch to the selector
of the virtual task.
With all this values I'm getting stack fault exception,but when I change
eip to tss[1].eip=(dword)&task I get general protection fault.
Thanx.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
For your faults, you should dump the CPU state before the exception (all the general purpose registers, segment descriptors and CR0-CR3).abuashraf wrote:Hi...
when I point my virtual task to 0x1000What instruction is causing that stack fault?
like this :
tss[1].eip=(void *)0x1000
or this:
tss[1].eip=0x1000
Thanx.
For the purposes of debugging your OS, I'd also suggest you print the opcode at the CS:EIP of the exception.
Hi...
I'm usign QEMU and its mointor but unfortunaely it dosen't have break points
to stop the executing befor the exception the only thing the monitor
could help me by dump cpu register after the exception and take a look
into them.but all that after the exception,I'll get Bochs with debugger
as soon as I can ...
Here's an IMG file,would you please guys debuge it with bochs debugger
and see what's wrong with it,I'm so grateful for your help.
The values with this IMG are:
This IMG will give you general protection fault.
Thanx.
I'm usign QEMU and its mointor but unfortunaely it dosen't have break points
to stop the executing befor the exception the only thing the monitor
could help me by dump cpu register after the exception and take a look
into them.but all that after the exception,I'll get Bochs with debugger
as soon as I can ...
Here's an IMG file,would you please guys debuge it with bochs debugger
and see what's wrong with it,I'm so grateful for your help.
The values with this IMG are:
Code: Select all
for(i;i<max_tasks;i++)
{
tss[i].trace=0;
tss[i].io_map_addr=sizeof(TSS);
tss[i].ldtr=0;
if (i) {
tss[i].fs=tss[i].gs=0;
tss[i].ds=tss[i].es=tss[i].ss=0x0;
tss[i].cs=0x0;
tss[i].eflags=0x23202L; //0x23202L VM=1 ,IOPL=3, interrupts are enabled
tss[i].esp=(dword)&task_stack[i]; //points to task() stack top
tss[i].ss0=0x10;
tss[i].esp0=(dword)&pl0_stack[i]; //stack for kernel
}
}
memcpy( (void*) 0x1000, &task, 1024 );
tss[1].eip=&task;
ltr(0x28);
Thanx.
- Attachments
-
- a.tar.gz
- IMG
- (47.5 KiB) Downloaded 114 times
Firstly read the F**king manual, it tells you what you need to set it up and how to set it up. As I could not be bothered looking up it my self(need to download it again as I it didn't name it correctly when I downloaded it and it's in a folder with names like 123456.pdf, 123465.pdf). If I remember correctly to get into v8086. You have to create a code segment and set the 16bit code flag and also set the base of the descriptor to the base address of the. the segemnt selectors should then be set the processos segements.

Microsoft: "let everyone run after us. We'll just INNOV~1"
Hi...
Doesn't this mean its 1MB mark and aligned to a 4K boundry?
but I got general protection fault.
And about the Intel manual I've read it for about ten times,
Also I saw that eip and esp don't change whatever I'm doing with them
I pointed esp to become tss.esp(dword *)0x2000 and it still 0x10789e0
also eip tss[1].eip=(dword *)0x1000 and it still 0x100fc2,this two fields
never changed.
Thanx.
Code: Select all
memcpy((void *)0x2000,&task_stak,2048);
tss[1].esp=(dword)0x2000;
but I got general protection fault.
And about the Intel manual I've read it for about ten times,
Also I saw that eip and esp don't change whatever I'm doing with them
I pointed esp to become tss.esp(dword *)0x2000 and it still 0x10789e0
also eip tss[1].eip=(dword *)0x1000 and it still 0x100fc2,this two fields
never changed.
Thanx.
As I said before, if you download the win32 installers from the bochs site (which you've said you did) then you get both bochs.exe and bochsdbg.exe in the bochs directory. If you run bochsdbg, you'll find that it is a bochs with debugging enabled.abuashraf wrote:I'll get Bochs with debugger
as soon as I can ...
John.
i...
Okay now I'm using Bochsdbg.exe and I've been debugging my kernel
for more than two houres.
This values have never been changed what ever I do with code
EFLAGS=0x3002 eip=0x100fc2 esp=0x107830,cs=0x8
fs,gs,ds,ss are all 0x10
Also here's my init_task would you please take a look at it:
what's wrong with my code....
Thanx.
Okay now I'm using Bochsdbg.exe and I've been debugging my kernel
for more than two houres.
This values have never been changed what ever I do with code
EFLAGS=0x3002 eip=0x100fc2 esp=0x107830,cs=0x8
fs,gs,ds,ss are all 0x10
Also here's my init_task would you please take a look at it:
Code: Select all
void init_task()
{
disable();
memcpy( (void *) 0x2000,(dword)&task_stack, 2048 );
unsigned int i=0;
for(i;i<max_tasks;i++)
{
tss[i].trace=0;
tss[i].io_map_addr=sizeof(TSS);
tss[i].ldtr=0;
tss[i].fs=tss[i].gs=0;
tss[i].ds=tss[i].es=tss[i].ss=0x0;
tss[i].cs=0x0;
tss[i].eflags=0x23202L; //0x23202L VM=1 ,IOPL=3
tss[i].esp=(dword *)0x2000;
tss[i].ss0=0x10;
tss[i].esp0=(dword)&pl0_stack[i]; //stack for kernel
}
memcpy( (void*) 0x1000, (dword)&task, 1024 );
//tss[1].eip=&task;
tss[1].eip=(dword *)0x1000;
ltr(0x28);
enable();
}




Thanx.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Once again,
Until we got that information we can at best only guess what is going on.For your faults, you should dump the CPU state before the exception (all the general purpose registers, segment descriptors and CR0-CR3).
For the purposes of debugging your OS, I'd also suggest you print the opcode at the CS:EIP of the exception.