feat: implemented errno, strtol. Started ustar. Reformatted headers and
code. Added some self-tests. Started prepwork for vfs.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#define TASK_STATE_STOPPED (1 << 6)
|
||||
#define TASK_STATE_ERROR (1 << 7)
|
||||
|
||||
int errno = 0;
|
||||
|
||||
typedef struct task {
|
||||
bool present: 1;
|
||||
@@ -31,6 +32,8 @@ typedef struct task {
|
||||
|
||||
uint32_t tid;
|
||||
|
||||
int errno;
|
||||
|
||||
struct task *next;
|
||||
|
||||
void *stack;
|
||||
@@ -142,10 +145,14 @@ void task_switch_next_inner(task_t *next_task) {
|
||||
}
|
||||
task_t *previous_task = current_task;
|
||||
current_task = next_task;
|
||||
if (previous_task->state == TASK_STATE_RUNNING) {
|
||||
previous_task->state = TASK_STATE_RUNNABLE;
|
||||
if (previous_task != NULL) {
|
||||
previous_task->errno = errno;
|
||||
if (previous_task->state == TASK_STATE_RUNNING) {
|
||||
previous_task->state = TASK_STATE_RUNNABLE;
|
||||
}
|
||||
}
|
||||
current_task->state = TASK_STATE_RUNNING;
|
||||
errno = current_task->errno;
|
||||
// switch task
|
||||
switch_task(previous_task == NULL ? NULL : &previous_task->task_registers, current_task->task_registers);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user