Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
hi all!, ok, my problem is I have switched my scheduler from an array with tasks on it to a linked-list with tasks on it, this doesn't work, the first time the swither gets called and pushes all regs(the first time is switches these should be kernel regs) it stores them in the first task(kernel task)and switches, but it doesn't find the next task(select(); finds the next task with a READY state and sets it as RUNNING_PROCESS) but this fails, it looks like it got intrupted(becouse different emulators get more or less far?)even though i do CLI();? with is another ? i have: when i do get it to crash i get a error with should print the regs then stop the system, but the reg ESP moves!!!!!!!!!! the ONLY way this could happen is if it is being intrupted then crashing with a different ESP over and over so it looks like continueus movement(ESP gest smaller each time), bit i locked the system????how is that possible????
heres the code for the scheduler and process creator: "process.c":
#ifndef __PROCESS_H
#define __PROCESS_H
#include <los/syslib.h>
#include <los/clock.h>
#include <los/text.h>
#define CREATED 0
#define READY 1
#define RUNNING 2
#define BLOCKED 3
#define TERMINATED 4
#define KERNEL_PID 0
struct stack_data
{
unsigned int gs;
unsigned int fs;
unsigned int es;
unsigned int ds;
unsigned int edi;
unsigned int esi;
unsigned int ebp;
unsigned int esp;
unsigned int ebx;
unsigned int edx;
unsigned int ecx;
unsigned int eax;
unsigned int eip;
unsigned int cs;
unsigned int eflags;
};
struct tss
{
short backlink, __blh;
int esp0;
short ss0, __ss0h;
int esp1;
short ss1, __ss1h;
int esp2;
short ss2, __ss2h;
int cr3;
int eip;
int eflags;
int eax, ecx, edx, ebx;
int esp, ebp, esi, edi;
short es, __esh;
short cs, __csh;
short ss, __ssh;
short ds, __dsh;
short fs, __fsh;
short gs, __gsh;
short ldt, __ldth;
short trace, bitmap;
}__attribute__((packed));
struct task_data
{
char name[33];
struct stack_data *stack;
unsigned int ss;
unsigned int kstack;
unsigned int ustack;
unsigned int PID;
unsigned int P_PID;
unsigned int time;
unsigned int priority;
unsigned int state;
struct task_data *prev;
};
/* sched.c */
extern void tester_asm();
extern void test();
extern void start_sys();
extern int is_empty();
extern int cur_task_time();
extern int cur_task_pri();
extern void front_to_end();
extern void dec_cur_task_time();
extern void cur_task_time_equ(int time);
extern int get_pri_time(int pri);
extern struct stack_data *schedule(struct stack_data *regs);
extern struct stack_data *task_timer_c(struct stack_data *regs);
extern void task_timer();
extern int remove_process(struct task_data *process);
extern void add_process(struct task_data *process);
extern int get_pri_time(int pri);
#endif