/home/runner/work/netbsd-src/netbsd-src/src/tools/hp300-mkboot/../../sys/arch/hp300/stand/mkboot/mkboot.c: In function 'main':
/home/runner/work/netbsd-src/netbsd-src/src/tools/compat/../../sys/sys/bootblock.h:994:34: error: 'LIF_NUMDIR' undeclared (first use in this function); did you mean 'HPPA_LIF_NUMDIR'?
994 | #define HP300_LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct hp300_lifdir))
| ^~~~~~~~~~
またミスっている
Cursed fire or #define black magic
L: https://ssloy.github.io/strange/cursed-fire/#these-are-dark-times-or-the-time-has-come-for-the-black-magic
C: https://news.ycombinator.com/item?id=43110514
posted on 2025.02.19 at 21:46:45 (c=1, p=6)
uaa@framboise:~/z/open-watcom-v2/bld/wasm$ cc -I ../watcom/h mkopcod1.c
ld: warning: mkopcod1.c(/tmp/mkopcod1-75d04f.o:(main)): warning: strcpy() is almost always misused, please use strlcpy()
uaa@framboise:~/z/open-watcom-v2/bld/wasm$ ./a.out a.txt
uaa@framboise:~/z/open-watcom-v2/bld/wasm$ cat a.txt
typedef enum asm_token {
T_NULL,
T_OP_TIMES,
T_OP_DIVIDE,
} asm_token;
#define MAX_KEYWORD_LEN 0
uaa@framboise:~/z/open-watcom-v2/bld/wasm$
ここが腐ってるのは何故だろう
このマクロは何の意味があるんだ
#define FOO(...) __VA_ARGS__
traceも限界があるか…#define DEBUG_FLOPPY 1を使う時かな…
main things i needed to patch:
- GHOST_ContextVK.cc: ensure_vulkan_device() -> comment out the unsupported device_features: geometryShader (not needed anymore), dualSrcBlend, multiDrawIndirect, multiViewport, shaderClipDistance, drawIndirectFirstInstance. also skip the "continue" for missing geometryShader and dualSrcBlend.
- vk_backend.cc: not sure if needed, but removed all adding to the missing_capabilities vec.
- vk_device.cc: init_glsl_patch(): add a "#define gpu_BaseInstance(0)"
While working on this, also found this: `#define ARCH_CPU_31_BITS 1`. Yeah it's trying to handle IBM System/390 platform, which I'm sure still totally works and is well tested. Of course. Yes.
さっき調べたんですけど、#define int long longの亜種でtypedef long long intってのもあるらしくて、そういう問題じゃねぇぞって顔してる
I may have let out a little snigger when writing this.
"#define TMC5240_MSLUTSTART 0x69"
how to count page faults from userspace on x86 (no clocks were harmed in the making of this):
$ cat faultdetect.c
#define _GNU_SOURCE
#include <err.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#define SYSCHK(x) ({ \
typeof(x) __res = (x); \
if (__res == (typeof(x))-1) \
err(1, "SYSCHK(" #x ")"); \
__res; \
})
int main(int argc, char **argv) {
if (argc != 3) errx(1, "bad invocation");
int prefault = atoi(argv[1]);
int use_file = atoi(argv[2]);
printf("will first read from and then write to a %s page, %s first triggering a separate read fault\n",
use_file?"file":"anonymous", prefault?"after":"without");
int fd = -1;
if (use_file) {
fd = SYSCHK(open("/var/tmp", O_TMPFILE|O_RDWR, 0600));
SYSCHK(ftruncate(fd, 0x2000));
}
char *test_area = SYSCHK(mmap(NULL, 0x2000, PROT_READ|PROT_WRITE, MAP_SHARED|(use_file?0:MAP_ANONYMOUS), fd, 0));
if (prefault)
*(volatile char *)test_area;
unsigned long *boundary = (void*)(test_area + 0x1000);
for (int i=0; i<29; i++)
boundary[i] = i;
asm volatile(
"mov %%rsp, %%r15\n"
"mov %%rbp, %%r14\n"
"mov %[rspval], %%rsp\n"
"mov %[rbpval], %%rbp\n"
"enter $0, $31\n"
"mov %%r14, %%rbp\n"
"mov %%r15, %%rsp\n"
:: [rspval] "r"(boundary+31), [rbpval] "r"(boundary+29)
:"cc","memory","r15","r14"
);
unsigned long number_of_faults = 28 - boundary[29];
printf("instruction fault-restarted %lu times\n", number_of_faults);
}
$ gcc -o faultdetect faultdetect.c
$ ./faultdetect 0 0
will first read from and then write to a anonymous page, without first triggering a separate read fault
instruction fault-restarted 1 times
$ ./faultdetect 1 0
will first read from and then write to a anonymous page, after first triggering a separate read fault
instruction fault-restarted 0 times
$ ./faultdetect 0 1
will first read from and then write to a file page, without first triggering a separate read fault
instruction fault-restarted 2 times
$ ./faultdetect 1 1
will first read from and then write to a file page, after first triggering a separate read fault
instruction fault-restarted 1 times
$
The worst thing about C flexible array members is that even though the standard says “you can malloc one with sizeof(T) + sizeof(Elem)*N”, this over-estimates the size, so you shouldn’t assume that a pointer to one has that much memory available. Example:
https://godbolt.org/z/M18acYEcK
The right way to calculate fucking sucks: it’s offsetof(T, flex_field[N]) rounded up to alignof(T), which ends up looking like this:
#define ALIGN_MASK(T) (_Alignof(T) - 1)
#define FAM_SIZE(T, FAM, COUNT) \
((offsetof(T, FAM[COUNT]) + ALIGN_MASK(T)) & ~ALIGN_MASK(T))
とりあえず:
xenocara/app/xterm/xtermcfg.hで#define OPT_STATUS_LINE 1でビルドはできる
termcapは適当に設定しないといけない(けどどう設定する?)
hs/es両対応かどうかは不明
xenocara/app/xterm/configureには、--enable-status-lineのオプションがある。 http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/xenocara/app/xterm/configure?rev=1.5&content-type=text/plain これを有効にすると#define OPT_STATUS_LINE 1になるのでこの設定を拾ってくれるかどうかってのが一つの鍵になるのか。