the weird thing when I deal with the ipc

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
taxus
Posts: 9
Joined: Mon Dec 13, 2010 9:01 am

the weird thing when I deal with the ipc

Post by taxus »

now I am working on my os about the ipc
I use the message to implement it
I had two system task and three user process
the user process are mostly same, just like this

Code: Select all

void TestA()
{
	while(1){
		printf("A");
		milli_delay(200);
	}
}
The IPC is almost finished,but there is an weird thing :
the first user process (TestA) can't call any function that really do something,but other process can do it well
when I use printf() in TestA ,the exception says " #UD Unvaliable Operate eip 0x10b cs 0x5"
I use bochs to unassemble the code ,got the information below

Code: Select all

0000010b: (                    ): lock pop edx                  ; f05a
0000010d: (                    ): and eax, 0xff53c000       ; 2500c053ff
00000112: (                    ): add al, dh                      ; 00f0
00000114: (                    ): push ebx                       ; 53
00000115: (                    ): inc dword ptr ds:[eax]      ; ff00
00000117: (                    ): lock dec ebp                  ; f04d
00000119: (                    ): add al, al                       ; 00c0
0000011b: (                    ): lahf                               ; 9f
0000011c: (                    ): push ebx                        ; 53
0000011d: (                    ): inc dword ptr ds:[eax]     ; ff00
and the bochs also print these message

Code: Select all

00019680650i[CPU0 ] LOCK prefix unallowed (op1=0x5a, modrm=0x00)
00019681939i[CPU0 ] WARNING: HLT instruction with IF=0!
I had stuck by this problem a week,it's so weird that the problem just appear to TestA
anyone has met this problem before?
User avatar
Combuster
Member
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:

Re: the weird thing when I deal with the ipc

Post by Combuster »

Looks like you're jumping to address 0 (or somewhere close). You're apparently running the BIOS data in the IVT as if it were code.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: the weird thing when I deal with the ipc

Post by Chandra »

taxus wrote:#UD Unvaliable Operate eip 0x10b cs 0x5"
And what sort of CS selector is that? Looks like you're messing with the stack.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
taxus
Posts: 9
Joined: Mon Dec 13, 2010 9:01 am

Re: the weird thing when I deal with the ipc

Post by taxus »

I check the LDT initial , there is no error about it
when I didn't implement the message IPC ,just use system call,all these process work well
but when I finish IPC, no matter how ,the third process in the proc_table will not work,and other work well,can it eliminate the error of IPC ?
I use the same function to initial all of the process,so......It's so weird
taxus
Posts: 9
Joined: Mon Dec 13, 2010 9:01 am

Re: the weird thing when I deal with the ipc

Post by taxus »

thanks everybody's help
now it works
the reason is I upset down these code

Code: Select all

taskstackpoint -= p_task->stacksize;
p_task++;
the sequence before is

Code: Select all

p_task++;
taskstackpoint -= p_task->stacksize;
that I plus the p_task before I use it
anyway ,thanks everyone
Post Reply