Import backup from 2006-01-02
This commit is contained in:
1 parent
89d962e33a
commit
0aaf5db5ad
14 files changed
+164
-67
No files matched your search
+10
-5
@@ -22,11 +22,11 @@ extern u32_t mm_freepages;
|
||||
#include "proc/hash.h"
|
||||
|
||||
extern "C" {
|
||||
u32_t cur_task = 0;
|
||||
u32_t n_processes = 0;
|
||||
u32_t cur_task = 0; /* PID of currently executing process */
|
||||
u32_t n_processes = 0; /* total number of processes */
|
||||
tss_t tss0;
|
||||
u32_t pid_base = 1024;
|
||||
u32_t pid_index = 0;
|
||||
u32_t pid_index = 0; /* index of running process in 'pids' vector */
|
||||
}
|
||||
|
||||
hash *processes;
|
||||
@@ -48,6 +48,11 @@ int proc_init()
|
||||
return 0;
|
||||
}
|
||||
|
||||
process_t *proc_get_struct(u32_t pid)
|
||||
{
|
||||
return (process_t *) processes->get(pid);
|
||||
}
|
||||
|
||||
void proc_sched(int_stack_t *int_stack)
|
||||
{
|
||||
u32_t new_pid_index = (pid_index + 1) % pids->size();
|
||||
@@ -125,7 +130,7 @@ void create_address_space(process_t *p)
|
||||
u32_t *ptr32 = p->page_dir;
|
||||
for (i = 0; i < 768; i++) /* zero 3 gigs */
|
||||
*ptr32++ = 0;
|
||||
memcpyd(ptr32, (void *)0xFFFFFC00, 256); /* 1 gig kernel mem */
|
||||
memcpyd(ptr32, (void *)0xFFFFFC00, 256); /* 1 gig kernel mem */
|
||||
}
|
||||
|
||||
void create_process_stack(process_t *p, void *entry)
|
||||
@@ -146,7 +151,7 @@ void create_process_stack(process_t *p, void *entry)
|
||||
p->int_stack.fs = SEG_USER_DATA | 0x3;
|
||||
p->int_stack.gs = SEG_USER_DATA | 0x3;
|
||||
p->int_stack.ss = SEG_USER_DATA | 0x3;
|
||||
p->int_stack.esp = 0x20000000;
|
||||
p->int_stack.esp = 0x80000000; /* esp at 2GB */
|
||||
p->int_stack.eflags = 0x0202;
|
||||
p->int_stack.cs = SEG_USER_CODE | 0x3;
|
||||
p->int_stack.eip = (u32_t)entry;
|
||||
|
||||
@@ -68,6 +68,8 @@ typedef struct
|
||||
} __attribute__((packed)) tss_t;
|
||||
|
||||
int proc_init();
|
||||
process_t *proc_get_struct(u32_t pid);
|
||||
|
||||
void proc_sched(int_stack_t *int_stack);
|
||||
u32_t get_pid();
|
||||
void switch_task(int_stack_t *int_stack, u32_t new_task);
|
||||
|
||||
Reference in new issue
Block a user