Changes to make sure after a fork a child process can safely return.

This copies the parent kernel stack to child only for the part where
the previous context is saved. Then the child registers are modified
so that it would begin execution from returning of the system call.
This commit is contained in:
Bahadir Balban
2008-08-21 16:21:08 +03:00
parent dada3e0b2c
commit 3ce220f062
7 changed files with 84 additions and 21 deletions

View File

@@ -57,8 +57,11 @@ struct ktcb {
/* User context */
task_context_t context;
/* Reference to syscall saved context */
syscall_args_t *syscall_regs;
/*
* Reference to the context on stack
* saved at the beginning of a syscall trap.
*/
syscall_context_t *syscall_regs;
/* Runqueue related */
struct list_head rq_list;

View File

@@ -18,7 +18,12 @@
extern unsigned int __syscall_page_start;
typedef struct syscall_args {
/*
* This structure is saved on the kernel stack
* just after entering a system call exception.
*/
typedef struct syscall_context {
u32 spsr
u32 r0;
u32 r1;
u32 r2;
@@ -28,7 +33,9 @@ typedef struct syscall_args {
u32 r6; /* MR3 */
u32 r7; /* MR4 */
u32 r8; /* MR5 */
} syscall_args_t;
u32 sp_usr;
u32 lr_usr;
} __attribute__((__packed__)) syscall_context_t;
typedef struct msg_regs {
u32 mr0;