summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/machdep.c10
-rw-r--r--sys/crypto/chacha20.c (renamed from sys/dev/random/chacha20.c)2
-rw-r--r--sys/crypto/siphash.c (renamed from sys/dev/random/siphash.c)2
-rw-r--r--sys/dev/random/entropy.c2
-rw-r--r--sys/dev/random/random.c4
-rw-r--r--sys/include/crypto/chacha20.h (renamed from sys/include/dev/random/chacha20.h)0
-rw-r--r--sys/include/crypto/siphash.h (renamed from sys/include/dev/random/siphash.h)0
-rw-r--r--sys/kern/kern_exit.c3
-rw-r--r--sys/kern/kern_panic.c17
-rw-r--r--sys/kern/kern_sched.c3
-rw-r--r--sys/kern/kern_time.c3
-rw-r--r--usr.bin/date/date.c1
-rw-r--r--usr.bin/login/login.c1
13 files changed, 35 insertions, 13 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 9b65d6e..d310460 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -44,6 +44,8 @@
#include <machine/intr.h>
#include <machine/cdefs.h>
#include <machine/isa/i8042var.h>
+#include <dev/cons/cons.h>
+#include <string.h>
#define pr_trace(fmt, ...) kprintf("cpu: " fmt, ##__VA_ARGS__)
#define pr_error(...) pr_trace(__VA_ARGS__)
@@ -224,6 +226,7 @@ md_backtrace(void)
uintptr_t rip;
off_t off;
const char *name;
+ char line[256];
__ASMV("mov %%rbp, %0" : "=r" (rbp) :: "memory");
while (1) {
@@ -236,7 +239,8 @@ md_backtrace(void)
if (name == NULL)
name = "???";
- kprintf(OMIT_TIMESTAMP "%p @ <%s+0x%x>\n", rip, name, off);
+ snprintf(line, sizeof(line), "%p @ <%s+0x%x>\n", rip, name, off);
+ cons_putstr(&g_root_scr, line, strlen(line));
}
}
@@ -294,6 +298,10 @@ this_cpu(void)
{
struct cpu_info *ci;
+ if (rdmsr(IA32_GS_BASE) == 0) {
+ return NULL;
+ }
+
/*
* This might look crazy but we are just leveraging the "m"
* constraint to add the offset of the self field within
diff --git a/sys/dev/random/chacha20.c b/sys/crypto/chacha20.c
index 41f823c..5c979a2 100644
--- a/sys/dev/random/chacha20.c
+++ b/sys/crypto/chacha20.c
@@ -27,7 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <dev/random/chacha20.h>
+#include <crypto/chacha20.h>
static const char sigma[16] = "expand 32-byte k";
diff --git a/sys/dev/random/siphash.c b/sys/crypto/siphash.c
index 2b2243f..e0cad44 100644
--- a/sys/dev/random/siphash.c
+++ b/sys/crypto/siphash.c
@@ -29,7 +29,7 @@
Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)
*/
-#include <dev/random/siphash.h>
+#include <crypto/siphash.h>
#include <stdint.h>
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
diff --git a/sys/dev/random/entropy.c b/sys/dev/random/entropy.c
index d392b9c..4e723a4 100644
--- a/sys/dev/random/entropy.c
+++ b/sys/dev/random/entropy.c
@@ -30,7 +30,7 @@
#include <stdint.h>
#include <string.h>
#include <dev/random/entropy.h>
-#include <dev/random/siphash.h>
+#include <crypto/siphash.h>
void
mix_entropy(struct entropy_pool *ep, const uint8_t *input,
diff --git a/sys/dev/random/random.c b/sys/dev/random/random.c
index d79df69..9bca719 100644
--- a/sys/dev/random/random.c
+++ b/sys/dev/random/random.c
@@ -30,9 +30,9 @@
#include <sys/sio.h>
#include <sys/device.h>
#include <sys/driver.h>
-#include <dev/random/chacha20.h>
-#include <dev/random/siphash.h>
#include <dev/random/entropy.h>
+#include <crypto/chacha20.h>
+#include <crypto/siphash.h>
#include <fs/devfs.h>
#include <string.h>
diff --git a/sys/include/dev/random/chacha20.h b/sys/include/crypto/chacha20.h
index d35702a..d35702a 100644
--- a/sys/include/dev/random/chacha20.h
+++ b/sys/include/crypto/chacha20.h
diff --git a/sys/include/dev/random/siphash.h b/sys/include/crypto/siphash.h
index ecabb4a..ecabb4a 100644
--- a/sys/include/dev/random/siphash.h
+++ b/sys/include/crypto/siphash.h
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index b1bd9ba..2c9e2e4 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -33,6 +33,7 @@
#include <sys/panic.h>
#include <sys/filedesc.h>
#include <sys/vnode.h>
+#include <dev/cons/cons.h>
#include <vm/physmem.h>
#include <vm/dynalloc.h>
#include <vm/vm.h>
@@ -89,6 +90,8 @@ proc_reap(struct proc *td)
vaddr_t stack_va;
paddr_t stack_pa;
+ cons_detach();
+
/* Clear out all fds */
for (size_t i = 4; i < PROC_MAX_FILEDES; ++i) {
fdp = td->fds[i];
diff --git a/sys/kern/kern_panic.c b/sys/kern/kern_panic.c
index 2df4537..13b4964 100644
--- a/sys/kern/kern_panic.c
+++ b/sys/kern/kern_panic.c
@@ -34,6 +34,7 @@
#include <dev/cons/cons.h>
#include <machine/cdefs.h>
#include <machine/cpu.h>
+#include <string.h>
#if defined(__PANIC_SCR)
#define PANIC_SCR __PANIC_SCR
@@ -41,6 +42,15 @@
#define PANIC_SCR 0
#endif
+static void
+panic_puts(const char *str)
+{
+ size_t len;
+
+ len = strlen(str);
+ cons_putstr(&g_root_scr, str, len);
+}
+
/*
* Burn and sizzle - the core logic that really ends
* things ::)
@@ -56,11 +66,11 @@ bas(bool do_trace, int reboot_type)
spinlock_acquire(&lock); /* Never released */
if (do_trace) {
- kprintf(OMIT_TIMESTAMP "** backtrace\n");
+ panic_puts(" ** backtrace\n");
md_backtrace();
}
- kprintf(OMIT_TIMESTAMP "\n-- ALL CORES HAVE BEEN HALTED --\n");
+ panic_puts("\n-- ALL CORES HAVE BEEN HALTED --\n");
cpu_reboot(reboot_type);
__builtin_unreachable();
}
@@ -82,7 +92,8 @@ static void
do_panic(const char *fmt, va_list *ap)
{
syslog_silence(false);
- kprintf(OMIT_TIMESTAMP "panic: ");
+ spinlock_release(&g_root_scr.lock);
+ panic_puts("panic: ");
vkprintf(fmt, ap);
bas(true, REBOOT_HALT);
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index 774ba71..24806db 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -159,6 +159,9 @@ this_td(void)
struct cpu_info *ci;
ci = this_cpu();
+ if (ci == NULL) {
+ return NULL;
+ }
return ci->curtd;
}
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 102648c..e741157 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -68,9 +68,6 @@ sys_sleep(struct syscall_args *scargs)
timeout_msec = ts.tv_nsec / 1000000;
timeout_msec += ts.tv_sec * 1000;
-
- md_inton();
tmr.msleep(timeout_msec);
- md_intoff();
return 0;
}
diff --git a/usr.bin/date/date.c b/usr.bin/date/date.c
index ab26c4c..8c4a9d1 100644
--- a/usr.bin/date/date.c
+++ b/usr.bin/date/date.c
@@ -107,6 +107,7 @@ main(int argc, char **argv)
error = set_time(rtc_fd, &d, argv[1]);
if (error < 0)
printf("bad time specified, not set\n");
+ read(rtc_fd, &d, sizeof(d));
}
close(rtc_fd);
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index e9b5e88..93b08ed 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -254,7 +254,6 @@ getuser(FILE *fp)
while (fgets(entry, sizeof(entry), fp) != NULL) {
retval = check_user(alias, pwhash, entry);
if (retval == 0) {
- printf("login: successful\n");
free(alias);
return 0;
}