Skip to content

Commit

Permalink
Fixes bug in revoke and in uart
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik Karlsson committed Oct 10, 2023
1 parent 23c640b commit 7878104
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
7 changes: 0 additions & 7 deletions common/inc/s3k/pmp.h

This file was deleted.

1 change: 0 additions & 1 deletion common/inc/s3k/s3k.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef S3K_H
#define S3K_H

#include "s3k/pmp.h"
#include "s3k/syscall.h"
#include "s3k/types.h"
#include "s3k/util.h"
Expand Down
4 changes: 4 additions & 0 deletions common/inc/s3k/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ bool s3k_is_valid(s3k_cap_t a);
bool s3k_is_parent(s3k_cap_t a, s3k_cap_t b);
bool s3k_is_derivable(s3k_cap_t a, s3k_cap_t b);

void s3k_napot_decode(s3k_napot_t napot_addr, s3k_addr_t *begin,
s3k_addr_t *end);
s3k_napot_t s3k_napot_encode(s3k_addr_t base, s3k_addr_t size);

static inline bool s3k_is_ready(s3k_state_t state)
{
return state == 0;
Expand Down
10 changes: 8 additions & 2 deletions common/src/drivers/ns16550a.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#include "drivers/uart.h"

#define LINE_STATUS_DATA_READY 0x1
#define FIFO_CONTROL_REGISTER 0x2
#define LINE_CONTROL_REGISTER 0x3
#define LINE_STATUS_REGISTER 0x5

extern volatile char _uart[];

void uart_init(void)
{
/** TODO: Proper init code for uart */
_uart[LINE_CONTROL_REGISTER] = 0x3;
_uart[FIFO_CONTROL_REGISTER] = 0x1;
}

int uart_putc(char c)
Expand All @@ -15,7 +21,7 @@ int uart_putc(char c)

int uart_getc(void)
{
while (!(_uart[5] & 0x1))
while (!(_uart[LINE_STATUS_REGISTER] & LINE_STATUS_DATA_READY))
;
return _uart[0];
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/cap_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ err_t cap_delete(cte_t c)

void cap_reclaim(cte_t p, cap_t pcap, cte_t c, cap_t ccap)
{
if ((cte_prev(c) != p) || cte_cap(c).raw == ccap.raw)
if ((cte_prev(c) != p) || cte_cap(c).raw != ccap.raw)
return;

cte_delete(c);
Expand Down

0 comments on commit 7878104

Please sign in to comment.