syscall problem
syscall problem
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?
- matthias
- Member
- Posts: 158
- Joined: Fri Oct 22, 2004 11:00 pm
- Location: Vlaardingen, Holland
- Contact:
Re: syscall problem
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.
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: syscall problem
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
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
Re: syscall problem
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
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
Re: syscall problem
Problem solved. Thanks for the help.