mirror of
https://github.com/drasko/codezero.git
synced 2026-04-17 09:19:05 +02:00
Added MR #define place holders so that these are used instead of real register names
This commit is contained in:
@@ -16,4 +16,8 @@
|
|||||||
#define MR_UNUSED_TOTAL (MR_TOTAL - MR_UNUSED_START)
|
#define MR_UNUSED_TOTAL (MR_TOTAL - MR_UNUSED_START)
|
||||||
#define MR_USABLE_TOTAL MR_UNUSED_TOTAL
|
#define MR_USABLE_TOTAL MR_UNUSED_TOTAL
|
||||||
|
|
||||||
|
/* These are defined so that we don't hard-code register names */
|
||||||
|
#define MR0_REGISTER r3
|
||||||
|
#define MR_RETURN_REGISTER r3
|
||||||
|
|
||||||
#endif /* __GLUE_ARM_MESSAGE_H__ */
|
#endif /* __GLUE_ARM_MESSAGE_H__ */
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#define __ARM_GLUE_SYSCALL_H__
|
#define __ARM_GLUE_SYSCALL_H__
|
||||||
|
|
||||||
#include <l4/types.h>
|
#include <l4/types.h>
|
||||||
|
#include INC_GLUE(message.h)
|
||||||
|
|
||||||
/* Only specific call is the trap that gives back the kip address
|
/* Only specific call is the trap that gives back the kip address
|
||||||
* from which other system calls can be discovered. */
|
* from which other system calls can be discovered. */
|
||||||
@@ -57,7 +58,7 @@ typedef struct msg_regs {
|
|||||||
* that imitates a page fault ipc etc.
|
* that imitates a page fault ipc etc.
|
||||||
*/
|
*/
|
||||||
#define KTCB_REF_ARG0(ktcb) (&(ktcb)->syscall_regs->r0)
|
#define KTCB_REF_ARG0(ktcb) (&(ktcb)->syscall_regs->r0)
|
||||||
#define KTCB_REF_MR0(ktcb) (&(ktcb)->syscall_regs->r3)
|
#define KTCB_REF_MR0(ktcb) (&(ktcb)->syscall_regs->MR0_REGISTER)
|
||||||
|
|
||||||
/* Represents each syscall. We get argument registers
|
/* Represents each syscall. We get argument registers
|
||||||
* from stack for now. This is slower but the simplest. */
|
* from stack for now. This is slower but the simplest. */
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
void exregs_set_mr(struct exregs_data *s, int offset, unsigned long val)
|
void exregs_set_mr(struct exregs_data *s, int offset, unsigned long val)
|
||||||
{
|
{
|
||||||
/* Get MR0 */
|
/* Get MR0 */
|
||||||
u32 *mr = &s->context.r3;
|
u32 *mr = &s->context.MR0_REGISTER;
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
BUG_ON(offset > MR_TOTAL || offset < 0);
|
BUG_ON(offset > MR_TOTAL || offset < 0);
|
||||||
@@ -21,7 +21,7 @@ void exregs_set_mr(struct exregs_data *s, int offset, unsigned long val)
|
|||||||
mr[offset] = val;
|
mr[offset] = val;
|
||||||
|
|
||||||
/* Set valid bit for mr register */
|
/* Set valid bit for mr register */
|
||||||
s->valid_vect |= FIELD_TO_BIT(exregs_context_t, r3) << offset;
|
s->valid_vect |= FIELD_TO_BIT(exregs_context_t, MR0_REGISTER) << offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void exregs_set_pager(struct exregs_data *s, l4id_t pagerid)
|
void exregs_set_pager(struct exregs_data *s, l4id_t pagerid)
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <l4lib/arch/asm.h>
|
#include <l4lib/arch/asm.h>
|
||||||
#include <l4lib/arch/utcb.h>
|
#include <l4lib/arch/utcb.h>
|
||||||
#include <l4/generic/space.h>
|
#include <l4/generic/space.h>
|
||||||
|
#include <l4/macros.h>
|
||||||
|
#include INC_GLUE(message.h)
|
||||||
|
|
||||||
.macro utcb_address rx
|
.macro utcb_address rx
|
||||||
ldr \rx, =utcb
|
ldr \rx, =utcb
|
||||||
@@ -43,10 +45,7 @@ END_PROC(l4_kread)
|
|||||||
* For clone() we need special assembler handling
|
* For clone() we need special assembler handling
|
||||||
* Same signature as ipc(): @r0 = to, @r1 = from
|
* Same signature as ipc(): @r0 = to, @r1 = from
|
||||||
*
|
*
|
||||||
* NOTE: MR_RETURN register is hardcoded here.
|
* NOTE: Note that this breaks l4 system call interface,
|
||||||
* It must be updated if MR_RETURN offset is changed!
|
|
||||||
*
|
|
||||||
* NOTE: Note that this also breaks l4 system call interface,
|
|
||||||
* this should be moved elsewhere and modified using existing l4 mechanisms.
|
* this should be moved elsewhere and modified using existing l4 mechanisms.
|
||||||
*/
|
*/
|
||||||
BEGIN_PROC(arch_clone)
|
BEGIN_PROC(arch_clone)
|
||||||
@@ -65,7 +64,7 @@ BEGIN_PROC(arch_clone)
|
|||||||
*/
|
*/
|
||||||
cmp r0, #0 @ Check ipc success
|
cmp r0, #0 @ Check ipc success
|
||||||
blt ipc_failed
|
blt ipc_failed
|
||||||
cmp r3, #0 @ Check ipc return register MR_RETURN.
|
cmp MR_RETURN_REGISTER, #0 @ Check ipc return register MR_RETURN.
|
||||||
blt clone_failed @ Ipc was ok but clone() failed.
|
blt clone_failed @ Ipc was ok but clone() failed.
|
||||||
bgt parent_return @ It has child pid, goto parent return.
|
bgt parent_return @ It has child pid, goto parent return.
|
||||||
child:
|
child:
|
||||||
|
|||||||
Reference in New Issue
Block a user