summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kernel/arch/amd64/driver/rtl8139.c1
-rw-r--r--src/kernel/execbuf.c32
-rw-r--r--src/user/app/netstack/tcp.c4
-rw-r--r--src/user/app/tests/kernel/misc.c4
-rw-r--r--src/user/bootstrap/main.c2
5 files changed, 24 insertions, 19 deletions
diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c
index 8a40f28..09b0ca5 100644
--- a/src/kernel/arch/amd64/driver/rtl8139.c
+++ b/src/kernel/arch/amd64/driver/rtl8139.c
@@ -118,6 +118,7 @@ static int try_rx(Proc *proc, void __user *dest, size_t dlen) {
* 0 - Receive OK
* 14 - Physical Address Matched */
flags = *(uint16_t*)(rxbuf + rxpos);
+ (void)flags; // TODO check rtl8139 rx flags
rxpos += 2;
/* doesn't include the header, includes a 4 byte crc */
size = *(uint16_t*)(rxbuf + rxpos);
diff --git a/src/kernel/execbuf.c b/src/kernel/execbuf.c
index 33bb94a..fe9e159 100644
--- a/src/kernel/execbuf.c
+++ b/src/kernel/execbuf.c
@@ -22,23 +22,25 @@ static void try_fetch(Proc *proc, uint64_t *buf, size_t amt) {
_Noreturn void execbuf_run(Proc *proc) {
uint64_t buf[6];
- assert(proc == proc_cur); // idiotic, but needed because of _syscall.
- assert(proc->state == PS_RUNNING);
- assert(proc->execbuf.buf);
+ for (;;) {
+ assert(proc == proc_cur); /* idiotic, but needed because of _syscall. */
+ assert(proc->state == PS_RUNNING);
+ assert(proc->execbuf.buf);
- try_fetch(proc, buf, 1);
- switch (buf[0]) {
- case EXECBUF_SYSCALL:
- try_fetch(proc, buf, 6);
- _syscall(buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
- proc_switch_any();
+ try_fetch(proc, buf, 1);
+ switch (buf[0]) {
+ case EXECBUF_SYSCALL:
+ try_fetch(proc, buf, 6);
+ _syscall(buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+ proc_switch_any();
- case EXECBUF_JMP:
- try_fetch(proc, buf, 1);
- proc->regs.rcx = buf[0];
- execbuf_run(proc);
+ case EXECBUF_JMP:
+ try_fetch(proc, buf, 1);
+ proc->regs.rcx = buf[0];
+ break;
- default:
- halt(proc);
+ default:
+ halt(proc);
+ }
}
}
diff --git a/src/user/app/netstack/tcp.c b/src/user/app/netstack/tcp.c
index daa728f..490ad5b 100644
--- a/src/user/app/netstack/tcp.c
+++ b/src/user/app/netstack/tcp.c
@@ -175,8 +175,8 @@ void tcp_parse(const uint8_t *buf, size_t len, struct ipv4 ip) {
uint32_t seq = nget32(buf + Seq);
uint32_t acknum = nget32(buf + AckNum);
uint16_t flags = nget16(buf + Flags);
- uint16_t winsize = nget16(buf + WinSize);
- uint16_t chksum = nget16(buf + Checksum);
+ // uint16_t winsize = nget16(buf + WinSize);
+ // uint16_t chksum = nget16(buf + Checksum);
uint16_t hdrlen = ((flags & FlagSize) >> 12) * 4;
if (hdrlen > len) return;
uint16_t payloadlen = len - hdrlen;
diff --git a/src/user/app/tests/kernel/misc.c b/src/user/app/tests/kernel/misc.c
index b60ebc0..5d6b531 100644
--- a/src/user/app/tests/kernel/misc.c
+++ b/src/user/app/tests/kernel/misc.c
@@ -21,6 +21,7 @@ static void test_fault_kill(void) {
}
static void test_efault(void) {
+#if 0
const char *str = "o, 16 characters";
char str2[16];
char *invalid = (void*)0x1000;
@@ -51,6 +52,7 @@ static void test_efault(void) {
test(_sys_write(h, str, 16, 0, 0) == 16);
close(h);
+#endif
}
static void test_invalid_syscall(void) {
@@ -59,6 +61,6 @@ static void test_invalid_syscall(void) {
void r_k_misc(void) {
run_test(test_fault_kill);
- // run_test(test_efault);
+ run_test(test_efault);
run_test(test_invalid_syscall);
}
diff --git a/src/user/bootstrap/main.c b/src/user/bootstrap/main.c
index f2938b9..b6d30f4 100644
--- a/src/user/bootstrap/main.c
+++ b/src/user/bootstrap/main.c
@@ -13,7 +13,7 @@ extern char _bss_end;
extern char _initrd;
__attribute__((section(".text")))
-_Noreturn void main(void) {
+int main(void) {
_sys_memflag(_libc_psdata, 1, MEMFLAG_PRESENT);
setprogname("bootstrap");
setproctitle(NULL);