removed trailing whitespaces

master
Anton Lydike 3 years ago
parent c2484838c1
commit 426a6508d1

@ -43,7 +43,7 @@ _start:
// jump to init
jal init
// halt machine after returning from init
li t0, -1
csrw CSR_HALT, t0
@ -130,10 +130,10 @@ memset:
// write a0 to memory starting at a1, until a2 (both must be four byte aligned)
// this uses a loop which writes 32 (numbytes) bytes at a time
// to prevent overshooting the end, we first calulate how many instructions to
// to prevent overshooting the end, we first calulate how many instructions to
// skip of the first iteration of the loop. this way, (a2 - a1) is a multiple of
// (numbytes) when we reach the blt instruction for the first time.
// this math works so good, because we write 4 bytes of mem, in 4 bytes of
// (numbytes) when we reach the blt instruction for the first time.
// this math works so good, because we write 4 bytes of mem, in 4 bytes of
// instructions. Therefore instruction bytes to skip = write bytes to skip
// bytes to skip = numbytes - ((a2 - a1) % numbytes)
memset:
@ -149,7 +149,7 @@ memset:
auipc t1, 0 // get current address
add t1, t2, t1 // add calulated offset
jalr zero, t1, 12 // skip the instructions by forward-jumping
// the 12 is added to compensate for the
// the 12 is added to compensate for the
// three instructions auipc, add, jalr
1:
sw a0, 0(a1)

@ -12,7 +12,7 @@ void write_mtimecmp(unsigned long long int mtimecmp) {
__asm__(
"li t0, %0\n"
"sw %1, 0(t0)\n"
"sw %2, 4(t0)" ::
"sw %2, 4(t0)" ::
"i"(TIMECMP_MEM_ADDR), "r"(lo), "r"(hi)
);
}
@ -24,7 +24,7 @@ void write_mtimecmp(unsigned long long int mtimecmp) {
unsigned int higher = mtimecmp >> 32;
__asm__(
"csrw %0, %2\n"
"csrw %1, %3" ::
"csrw %1, %3" ::
"I"(CSR_MTIMECMP),"I"(CSR_MTIMECMPH),
"r"(lower), "r"(higher)
);

@ -63,7 +63,7 @@ enum pcb_struct_registers {
/* This struct holds information about binaries which are currently loaded into
* memory. Currently the kernel is not able to load binaries into memory, as
* no file system layer is implemented. When the memory image is built, the
* no file system layer is implemented. When the memory image is built, the
* list of loaded binaries is populated aswell.
*/
typedef struct loaded_binary {
@ -76,7 +76,7 @@ typedef struct loaded_binary {
/*
* Optionals
*
* in this kernel, an optional can hold a value or an error, but we can't use
* in this kernel, an optional can hold a value or an error, but we can't use
* unions here because we need to be able to distinguish errors from results.
* this is a little space inefficient, but we'll have to deal with this, or else
* we get global errno variables.

@ -16,7 +16,7 @@ void malloc_init(malloc_info* given_info)
optional_voidptr malloc_stack(size_t size)
{
void* new_alloc_end = (void*) (((int) allocate_memory_end) - size);
if (new_alloc_end < global_malloc_info.allocate_memory_start)
if (new_alloc_end < global_malloc_info.allocate_memory_start)
return (optional_voidptr) { .error = ENOMEM };
void* stack_top = allocate_memory_end;
allocate_memory_end = new_alloc_end;

@ -70,7 +70,7 @@ ProcessControlBlock* scheduler_select_free()
while (pcb != current_process) {
if (pcb->status == PROC_RDY)
return pcb;
if (pcb->status == PROC_WAIT_SLEEP) {
if (pcb->asleep_until < mtime) {
return pcb;
@ -97,7 +97,7 @@ ProcessControlBlock* scheduler_select_free()
}
if (timeout_available == false) {
// either process deadlock or no processes alive.
// either process deadlock or no processes alive.
//TODO: handle missing executable thread
dbgln("No thread active!", 17);
HALT(22);
@ -185,7 +185,7 @@ optional_pcbptr find_available_pcb_slot() {
int start_index = index;
ProcessControlBlock* pcb = processes + index;
while (pcb->status != PROC_DEAD) {
while (pcb->status != PROC_DEAD) {
index = (index + 1) % PROCESS_COUNT;
if (index == start_index)
return (optional_pcbptr) { .error = ENOBUFS };
@ -288,7 +288,7 @@ void kill_child_processes(ProcessControlBlock* pcb)
{
for (int i = 0; i < PROCESS_COUNT; i++) {
ProcessControlBlock* proc = processes + i;
if (proc->parent != pcb)
if (proc->parent != pcb)
continue;
proc->status = PROC_DEAD;

@ -18,6 +18,7 @@ int* get_current_process_registers();
ProcessControlBlock* get_current_process();
void mark_ecall_entry();
// process creation / destruction
optional_pcbptr create_new_process(loaded_binary*, int);
optional_pcbptr create_new_thread(ProcessControlBlock*, void*, void*, int);
void kill_child_processes(ProcessControlBlock* pcb);

Loading…
Cancel
Save