Added exregs_set_mr() function

Moved all exregs-related calls to libl4 since these are part of the L4 api.
This commit is contained in:
Bahadir Balban
2008-09-15 17:57:09 +03:00
parent b7d1e46138
commit 9c2c9676e8
7 changed files with 73 additions and 46 deletions

View File

@@ -0,0 +1,45 @@
/*
* Generic to arch-specific interface for
* exchange_registers()
*
* Copyright (C) 2008 Bahadir Balban
*/
#include <l4/macros.h>
#include <l4lib/exregs.h>
#include INC_GLUE(message.h)
void exregs_set_mr(struct exregs_data *s, int offset, unsigned long val)
{
/* Get MR0 */
u32 *mr = &s->context.r3;
/* Sanity check */
BUG_ON(offset > MR_TOTAL || offset < 0);
/* Set MR */
mr[offset] = val;
/* Set valid bit for mr register */
s->valid_vect |= offsetof(exregs_context_t, r3) +
(offset * sizeof(int));
}
void exregs_set_pager(struct exregs_data *s, l4id_t pagerid)
{
s->pagerid = pagerid;
s->flags |= EXREGS_SET_PAGER;
}
void exregs_set_stack(struct exregs_data *s, unsigned long sp)
{
s->context.sp = sp;
s->valid_vect |= 1 << (offsetof(exregs_context_t, sp) >> 2);
}
void exregs_set_pc(struct exregs_data *s, unsigned long pc)
{
s->context.pc = pc;
s->valid_vect |= 1 << (offsetof(exregs_context_t, pc) >> 2);
}

View File

@@ -65,7 +65,7 @@ BEGIN_PROC(arch_clone)
*/
cmp r0, #0 @ Check ipc success
blt ipc_failed
cmp r2, #0 @ Check ipc return register MR_RETURN.
cmp r3, #0 @ Check ipc return register MR_RETURN.
blt clone_failed @ Ipc was ok but clone() failed.
bgt parent_return @ It has child pid, goto parent return.
child: