Skip to content
Snippets Groups Projects
Unverified Commit 1dd6efa0 authored by Byron Lathi's avatar Byron Lathi
Browse files

Change exec to process, put in syscalls folder

Same code as before, but with more stuff in the header copied from mp3.

Also changes the read and write syscalls to do an rts instead of an rti,
since the rti is handled in the irq handler which we will return to.
parent 2ac97b07
Branches stdlib
No related tags found
No related merge requests found
Pipeline #209 failed
#ifndef _EXEC_H
#define _EXEC_H
void exec(char* filename);
#endif
......@@ -4,6 +4,7 @@
#include "filesystem/fat.h"
#include "filesystem/o65.h"
#include "syscalls/process.h"
void exec(char* filename) {
o65_header_t* header;
......
#ifndef _PROCESS_H
#define _PROCESS_H
#include <stdint.h>
#define FILE_DESC_SIZE 8
#define BUF_SIZE 128
#define STDIN 0
#define STDOUT 1
#define STDERR 2
#define FILE_DESC_IN_USE 1
/* file operations struct */
typedef struct fops_t {
int8_t (*open)(const uint8_t* filename);
int8_t (*close)(int32_t fd);
int8_t (*read)(int32_t fd, void* buf, int32_t nbytes);
int8_t (*write)(int32_t fd, const void* buf, int32_t nbytes);
} fops_t;
/* file descriptors struct */
typedef struct file_desc_t {
fops_t* file_ops;
uint16_t entry;
uint16_t file_pos; // change if this becomes a problem
uint8_t flags;
} file_desc_t;
/* Process Control Block struct */
typedef struct pcb_t {
file_desc_t file_desc_array[FILE_DESC_SIZE];
uint8_t args[64];
uint16_t execute_return;
int16_t pid;
int16_t parent_pid;
uint16_t parent_esp;
uint16_t parent_ebp;
} pcb_t;
void exec(char* filename);
#endif
\ No newline at end of file
......@@ -4,7 +4,6 @@
void read() {
cprintf("Read syscall.\n");
asm("rti");
}
#endif TEST
\ No newline at end of file
......@@ -4,7 +4,6 @@
void write() {
cprintf("Write syscall.\n");
asm("rti");
}
#endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment