mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Now we save/restore utcb registers if we do a second ipc before returning the first.
This commit is contained in:
@@ -30,6 +30,8 @@ int pager_sys_open(l4id_t sender, int fd, unsigned long vnum, unsigned long size
|
||||
{
|
||||
int err;
|
||||
|
||||
l4_save_ipcregs();
|
||||
|
||||
write_mr(L4SYS_ARG0, sender);
|
||||
write_mr(L4SYS_ARG1, fd);
|
||||
write_mr(L4SYS_ARG2, vnum);
|
||||
@@ -46,6 +48,7 @@ int pager_sys_open(l4id_t sender, int fd, unsigned long vnum, unsigned long size
|
||||
printf("%s: Pager open Error: %d.\n", __FUNCTION__, fd);
|
||||
return err;
|
||||
}
|
||||
l4_restore_ipcregs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,17 @@ static inline l4id_t l4_get_sender(void)
|
||||
return (l4id_t)read_mr(MR_SENDER);
|
||||
}
|
||||
|
||||
/*
|
||||
* When doing an ipc the sender never has to be explicitly set in
|
||||
* the utcb via this function since it is passed in the argument
|
||||
* registers. This is only used for restoring the sender on the
|
||||
* utcb in order to complete an earlier ipc.
|
||||
*/
|
||||
static inline void l4_set_sender(l4id_t sender)
|
||||
{
|
||||
write_mr(MR_SENDER, sender);
|
||||
}
|
||||
|
||||
static inline unsigned int l4_get_tag(void)
|
||||
{
|
||||
return read_mr(MR_TAG);
|
||||
@@ -48,6 +59,23 @@ static inline void l4_set_tag(unsigned int tag)
|
||||
write_mr(MR_TAG, tag);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're about to do another ipc, this saves the last ipc's
|
||||
* parameters such as the sender and tag information.
|
||||
* Any previously saved data in save slots are destroyed.
|
||||
*/
|
||||
static inline void l4_save_ipcregs(void)
|
||||
{
|
||||
l4_get_utcb()->saved_sender = l4_get_sender();
|
||||
l4_get_utcb()->saved_tag = l4_get_tag();
|
||||
}
|
||||
|
||||
static inline void l4_restore_ipcregs(void)
|
||||
{
|
||||
l4_set_tag(l4_get_utcb()->saved_tag);
|
||||
l4_set_sender(l4_get_utcb()->saved_sender);
|
||||
}
|
||||
|
||||
static inline l4id_t self_tid(void)
|
||||
{
|
||||
struct task_ids ids;
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
*/
|
||||
struct utcb {
|
||||
u32 mr[MR_TOTAL];
|
||||
u32 tid; /* Thread id */
|
||||
u32 saved_tag;
|
||||
u32 saved_sender;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
extern struct utcb utcb;
|
||||
|
||||
Reference in New Issue
Block a user