Skip to content

Instantly share code, notes, and snippets.

View nonakap's full-sized avatar

Kimihiro Nonaka nonakap

View GitHub Profile
@nonakap
nonakap / pkgsrc-sysutils-duf.shar
Last active March 25, 2021 10:30
New pkgsrc sysutils/duf: Simple Disk Usage/Free Utility
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# sysutils/duf/DESCR
# sysutils/duf/Makefile
# sysutils/duf/PLIST
@nonakap
nonakap / nbsd-x86-efiboot-bootefi-cmd.diff
Created December 30, 2019 15:55
NetBSD/x86 efiboot: bootefi command
diff --git a/sys/arch/i386/stand/efiboot/boot.c b/sys/arch/i386/stand/efiboot/boot.c
index a8685c1cb1c..ba447ebe282 100644
--- a/sys/arch/i386/stand/efiboot/boot.c
+++ b/sys/arch/i386/stand/efiboot/boot.c
@@ -63,6 +63,7 @@ static const char * const names[][2] = {
void command_help(char *);
void command_quit(char *);
void command_boot(char *);
+void command_bootefi(char *);
void command_pkboot(char *);
@nonakap
nonakap / nbsd-x86-raise-MAX_INTR_SOURCES-to-56.diff
Created September 22, 2019 08:36
NetBSD/x86: Raise the number of interrupt sources per CPU from 32 to 56. Based on http://mail-index.netbsd.org/port-amd64/2018/12/14/msg002817.html
diff --git a/sys/arch/amd64/amd64/amd64_trap.S b/sys/arch/amd64/amd64/amd64_trap.S
index 3f510e98ab2..2b61e394630 100644
--- a/sys/arch/amd64/amd64/amd64_trap.S
+++ b/sys/arch/amd64/amd64/amd64_trap.S
@@ -344,7 +344,7 @@ IDTVEC(trap07)
ZTRAP_NJ(T_DNA)
INTRENTRY
#ifdef DIAGNOSTIC
- movl CPUVAR(ILEVEL),%ebx
+ movzbl CPUVAR(ILEVEL),%ebx
@nonakap
nonakap / samsung-ssd-970-evo-plus-250gb-pcictl-dump.txt
Created September 12, 2019 14:38
Samsung SSD 970 EVO Plus NVMe M.2 250GB (MZ-V7S250B): PCI configuration space
PCI configuration registers:
Common header:
0x00: 0xa808144d 0x00100006 0x01080200 0x00000010
Vendor Name: Samsung Electronics (3rd vendor ID) (0x144d)
Device ID: 0xa808
Command register: 0x0006
I/O space accesses: off
Memory space accesses: on
Bus mastering: on
@nonakap
nonakap / pkgsrc-sysutils-xenkernel411-build-xen-efi.diff
Created September 6, 2019 04:40
pkgsrc/sysutils/xenkernel411: build xen.efi
Index: sysutils/xenkernel411/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/xenkernel411/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- sysutils/xenkernel411/Makefile 30 Aug 2019 13:16:27 -0000 1.8
+++ sysutils/xenkernel411/Makefile 6 Sep 2019 04:38:42 -0000
@@ -51,10 +51,18 @@ EXTRA_CFLAGS+= -falign-functions=16
.endif
@nonakap
nonakap / convert-iso8601-to-localtime.c
Last active July 31, 2019 04:09
convert ISO8601 format string to localtime string (no error handling)
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define SBUFSIZE 3 /* 3: milli, 6: micro, 9: nano */
@nonakap
nonakap / nbsd-x86-efiboot-compact-BTINFO_EFIMEMMAP.diff
Last active July 29, 2019 08:56
NetBSD/x86 efiboot: Compact BTINFO_EFIMEMMAP before pass it to the kernel.
diff --git a/sys/arch/i386/stand/efiboot/boot.c b/sys/arch/i386/stand/efiboot/boot.c
index 3ae137e961a..d5a6a1f642f 100644
--- a/sys/arch/i386/stand/efiboot/boot.c
+++ b/sys/arch/i386/stand/efiboot/boot.c
@@ -351,7 +351,7 @@ command_help(char *arg)
#if LIBSA_ENABLE_LS_OP
"ls [path]\n"
#endif
- "memmap [{sorted|unsorted}]\n"
+ "memmap [{sorted|unsorted|compact}]\n"
@nonakap
nonakap / nbsd-x86-BTINFO_EFIMEMMAP2.diff
Last active July 31, 2019 01:52
x86: BTINFO_EFIMEMMAP2: pass no compacted UEFI memory descriptors to the kernel like modules.
diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S
index 39313961aef..98120222c47 100644
--- a/sys/arch/amd64/amd64/locore.S
+++ b/sys/arch/amd64/amd64/locore.S
@@ -333,6 +333,8 @@
.globl _C_LABEL(biosbasemem)
.globl _C_LABEL(biosextmem)
.globl _C_LABEL(lwp0uarea)
+ .globl _C_LABEL(efimemmap_start)
+ .globl _C_LABEL(efimemmap_end)
@nonakap
nonakap / nbsd-amd64-8.99.51-with-KUBSAN-qemu-bootlog.txt
Created July 25, 2019 07:54
NetBSD/amd64 8.99.51 with options KUBSAN (qemu)
>> NetBSD/x86 EFI Boot (x64), Revision 1.0 (Thu Jul 25 05:09:18 UTC 2019) (from NetBSD 8.99.51)
>> Memory: 640/4140976 k
>
> boot -xv
booting cd0a:netbsd (howto 0xa0000)
50651184+39802048+2140992 [1317936+932616+17587]=0x5c2a768
Loading /stand/amd64/8.99.51/modules/cd9660/cd9660.kmod FAILED
[ 1.0000000] UBSan: Undefined Behavior in /home/nonaka/repo/external/netbsd-src/sys/arch/x86/x86/efi.c:516:8, member access within misaligned address 0xffffffff85a3c07c for type 'struct efi_md' which requires 8 byte alignment
[ 1.0000000] UBSan: Undefined Behavior in /home/nonaka/repo/external/netbsd-src/sys/arch/x86/x86/efi.c:517:12, member access within misaligned address 0xffffffff85a3c07c for type 'struct efi_md' which requires 8 byte alignment
[ 1.0000000] UBSan: Undefined Behavior in /home/nonaka/repo/external/netbsd-src/sys/arch/x86/x86/efi.c:518:10, member access within misaligned address 0xffffffff85a3c07c for type 'struct efi_md' which requires 8 byte alignment
@nonakap
nonakap / nbsd-pr54391.diff
Last active July 24, 2019 01:39
NetBSD: fix PR/54391
diff --git a/sys/arch/i386/stand/efiboot/efimemory.c b/sys/arch/i386/stand/efiboot/efimemory.c
index ee70f325cc0..789960fbc86 100644
--- a/sys/arch/i386/stand/efiboot/efimemory.c
+++ b/sys/arch/i386/stand/efiboot/efimemory.c
@@ -28,6 +28,8 @@
#include "efiboot.h"
+#include <machine/limits.h>
+