syscall problem

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
deadmutex
Member
Member
Posts: 85
Joined: Wed Sep 28, 2005 11:00 pm

syscall problem

Post by deadmutex »

In my os, applications communicate with the kernel via interrupts. If the kernel returns an allocated pointer, then the app will crash whenever it uses it because of the different address spaces. Is there a way for the app to get its own copy of the pointer while in its address space?
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Re: syscall problem

Post by matthias »

I think you've to map the pointer-address into the application's address-space ;) -> paging
The source of my problems is in the source.
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Re: syscall problem

Post by carbonBased »

Most definitly. Either map the memory into each address space that requires it, or implement a shared memory API.

Shared memory APIs are a good idea in general. In essense, this equates to a resizeable buffer (or several buffers) of memory that is shared between an app (or all apps) and the kernel.

--Jeff
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: syscall problem

Post by JAAman »

much can be shared however for a single application data point there may be something simpler:

i dont know what syscall your trying to implement but most people map much of the API into the users address space -- this also improves performance by removing 2 task-switches and also completely eliminates the pointer problem (just make sure the data is ring-3 accessable)

the kernel takes the upper part of virtual mem and user takes the lower part (usually) by marking kernel space as global it is never removed from the TLBs and is always availible in every address-space without a task-switch or complicated memory-remapping which would be required to share data between user and kernel space
User avatar
deadmutex
Member
Member
Posts: 85
Joined: Wed Sep 28, 2005 11:00 pm

Re: syscall problem

Post by deadmutex »

Problem solved. Thanks for the help.
Post Reply