arm64 pwmbl(4): simplify ramp case

2022-07-04 Thread Miod Vallat
When the fdt does not provide a list of brightness states, pwmbl(4) builds a 256 state ramp (i.e. state[i] = i with 0 <= i < 256). The following diff keeps that behaviour, but gets rid of the malloc call for that ramp, since the values are trivially known. Compiles but not tested due to the lack

Re: powerpc, macppc: retrigger deferred DEC interrupts from splx(9)

2022-06-30 Thread Miod Vallat
> We only run on New World Macs, and the only ones without openpic(4) > might be the oldest models of iMac G3 from 1998; these would attach > macintr0 and not openpic0 in dmesg. I don't know anyone who might > have such an iMac. The iMac model PowerMac2,1 from 1999 (with the > (slot-loading cd

Re: kernel: remove global "randompid" toggle

2022-06-16 Thread Miod Vallat
> Are we keeping this "randompid" global around to make it possible to > disable random PIDs by toggling it in ddb(4)? IIRC this logic was needed because some kthreads were created before arc4random was operational, but that was before substantial changes to the random generator. However since

Re: powerpc*: make EXC_LAST less awkward

2022-05-18 Thread Miod Vallat
> > As seen in sys/arch/powerpc64/include/trap.h, not-so-ancient PowerPC and > > POWER processors define exception addresses past EXC_LAST. > > Erh, wait, not really. EXC_AST is "fake" and EXC_USER is a flag that > indicates we came from userland. I was referring to the few hardware vectors

powerpc*: make EXC_LAST less awkward

2022-05-17 Thread Miod Vallat
As seen in sys/arch/powerpc64/include/trap.h, not-so-ancient PowerPC and POWER processors define exception addresses past EXC_LAST. The following diff changes EXC_LAST to no longer be the last "traditional" (0x100 bytes long) exception address, but the (conveniently page-aligned) end of the

pf: remove unused include files

2022-05-17 Thread Miod Vallat
sys/net/pf.c r1.968 added a call to m_print() #ifdef DDB in a troublesome situation. Once the root cause of the problem was fixed, the DDB-specific code path was removed in r1.970, but the added includes were kept, although nothing in pf.c depends on DDB anymore. Index: pf.c

riscv64: minor tweaks to sig_machdep.c

2022-03-21 Thread Miod Vallat
Two simple changes here: - dumpframe() is not used by anything. I opted to remove it, but it could be wrapped in #if 0 or #ifdef DEBUG if people want to keep it around. - the /* NOTREACHED */ comment in sendsig() is obviously reachable, so remove it and update the comment to match the new

riscv64: fix kernel longjmp

2022-03-21 Thread Miod Vallat
Unlike userland, the OpenBSD kernel longjmp() function does not take a return value for setjmp as second argument, but is guaranteed to return nonzero. The following diff makes sure the code matches this expectation. Completely untested, yadda yadda. Index: support.S

riscv64: faster setregs()

2022-03-21 Thread Miod Vallat
The current state of the kernel starts userland processes with register a0 pointing to the stack, with a comment mentioning this is copied from FreeBSD. But while FreeBSD userland startup code (lib/csu) depends on this, OpenBSD binaries do not need this. Thus, don't bother setting up a0 upon

riscv64: adjust VM_MIN_ADDRESS

2022-03-21 Thread Miod Vallat
A long, long time ago (I think it was late 2003), OpenBSD/i386 was vulnerable to a trusted-yet-NULL pointer dereference in the agp code. The attack involved using mmap(2) with MAP_FIXED and a hint of zero. Shortly afterwards, in addition to fixing the overtrusting code, it was decided never to

riscv64: simplify

2022-03-21 Thread Miod Vallat
The riscv64 was likely copied from an architecture providing optimized byte-swapping code (I'd bet arm64), but doesn't have any such optimization, and copies the MI code. Acknowledge this by dropping the __HAVE_MD_SWAP define to get the MI code for free, rather than duplicating it. Completely

constify *_hw_if

2022-03-21 Thread Miod Vallat
The following diff makes {audio,midi,radio,video}_hw_if structs in the kernel const, in order to move them to rodata. Index: share/man/man9/audio.9 === RCS file: /OpenBSD/src/share/man/man9/audio.9,v retrieving revision 1.29 diff -u

Re: fix boot timeout on arm64

2022-03-17 Thread Miod Vallat
> This issue has been fixed somewhat recently in U-Boot. It only > happens if you connect a USB keyboard to the machine. With the > exception of Apple machines and possibly the Raspberry Pi, I expect > most people to use a serial console on arm64 (and armv7 and riscv64) > machines. And Apple

fix boot timeout on arm64

2022-03-17 Thread Miod Vallat
By default (with no override in /etc/boot.conf), the arm64 boot loader will attempt to boot the kernel after a 5 second timeout. On the RPi 4b here, it will indeed boot the kernel, but after about 80 seconds. The reason for this delay is that there is logic in the boot code, while waiting for

network drivers' manual page consistency

2022-03-17 Thread Miod Vallat
I have noticed that a few manual page for network drivers mention the duplex options in square brackets. This is inconsistent with the vast majority of the network drivers' manual pages, so let's homogeneize this. Index: bse.4 ===

bwfm@sdmmc: use symbolic constants for matching

2022-03-17 Thread Miod Vallat
The following diff declares the various devices bwfm@sdmmc checks for, and introduces no functional change. Index: if_bwfm_sdio.c === RCS file: /OpenBSD/src/sys/dev/sdmmc/if_bwfm_sdio.c,v retrieving revision 1.42 diff -u -p -r1.42

sdmmc: simplify devlist2h

2022-03-17 Thread Miod Vallat
sys/dev/sdmmc/devlist2h.awk was based upon sys/dev/pcmcia/devlist2h.awk. The latter contains code to define optional CIS tuple overrides, which are not used in sdmmc - there is only one override and it is applied in sdmmc_check_cis_quirks(). The following diff removes this feature from devlist2h.

Re: add -k / --keep for gzip(1)

2022-03-03 Thread Miod Vallat
> I think this makes sense if only for better GNU gzip compatibility. > OK millert@ But does the `-k' flag needs to be added to compress(1) too?

Re: makefs, inodes, the universe and everything

2022-02-25 Thread Miod Vallat
> Should the default for makefs not be changed, rather than requiring an > argument? I'm not fond of that idea, but why not, as long as it gets documented. > 100 seem extremely small. Imagine a person installing a machine with 5 > drives. Our installer lets people iterate over all their

makefs, inodes, the universe and everything

2022-02-25 Thread Miod Vallat
As you may vaguely remember, I have plans to clean up MAKEDEV a bit, which have the side effect of removing many unneeded device nodes from the ramdisk target, used on the installation media. Doing this will in turn expose a slight difference in filesystem creation between the pre-makefs(8) world

Re: more MAKEDEV cleanup

2022-02-10 Thread Miod Vallat
> What happened to this? I need to split this into orthogonal diffs, and also since this will expose an issue in makefs(8), I need to polish and send a fix for makefs first...

Re: Use installboot(8) in install.md of riscv64

2022-02-02 Thread Miod Vallat
> Index: usr.sbin/installboot/armv7_installboot.c > === > RCS file: src/usr.sbin/installboot/armv7_installboot.c,v > retrieving revision 1.11 > diff -u -p -r1.11 armv7_installboot.c > --- usr.sbin/installboot/armv7_installboot.c 20

[macppc] mpcpcibr buglet

2022-02-02 Thread Miod Vallat
On PowerMac11,2 systems, the PCIe bus attaches as: mpcpcibr0 at mainbus0 pci: u4-pcie pci0 at mpcpcibr0 bus 0 However none of the devices attached to pci0 will appear in pcidump. This is caused by an incorrect bus number during attachment of the pci(4) subdevice. The following diff queries the

Re: in4_cksum changes, step 1

2022-01-31 Thread Miod Vallat
> The register is set to -1, all bits set, and then its upper half > is cleared. Now that the "and" has been removed, the value seems > unused. The result of the removed "and" seemed unused too. Oh, indeed, you're right, that makes things even simpler. New diff: Index:

Re: in4_cksum changes, step 1

2022-01-30 Thread Miod Vallat
> > - sum += in_cksumdata((caddr_t) , sizeof(ipov)); > > + sum += in_cksumdata((caddr_t) + 8, sizeof(ipov) - 8); > > I think this would be clearer with a comment. Sure, added one. > Please remove the trailing space that some of the changed lines have. Ok. Updated patch

Re: passwd(1) does not need librpcsvc

2022-01-27 Thread Miod Vallat
> Hi, > > linking with librpcsvc should be superfluous now. Then you should also update DPADD to remove $(LIBRPCSVC}... > Index: Makefile > === > RCS file: /var/cvs/src/usr.bin/passwd/Makefile,v > retrieving revision 1.41 > diff -u

in4_cksum changes, step 1

2022-01-25 Thread Miod Vallat
in4_cksum(), used to compute packet checksums for the legacy internet protocol, has been hand-optimized for speed on most elderly platforms, with the most recent pieces of silicon using a portable C implementation. Most of these implementations, in a not-so-uncommon case, need to checksum an

Re: kubsan tcp timer shift

2022-01-21 Thread Miod Vallat
> Sounds like a call for the huge U change. Since none of these #define seem to be used by .S files, go for it. We don't really want to bring Mach's U() macro back.

Re: kubsan tcp timer shift

2022-01-20 Thread Miod Vallat
> An unsinged TF_TIMER does not create that problem. Why don't you simply append an U suffix to TF_TMR_REXMT?

fix isascii(3) manpage

2021-06-11 Thread Miod Vallat
All the is*() ctype.h functions take an int as argument, but valid values are only EOF, and the range of values of `unsigned char'. All, but one: the XPG4 isascii(), which has no such restriction. Quoting https://pubs.opengroup.org/onlinepubs/9699919799/ : ``The isascii() function is defined on

remove gccism from com(4)

2021-05-06 Thread Miod Vallat
`return f()' when f is a void function is not allowed by the C standard but is a gcc extension. Index: com.c === RCS file: /OpenBSD/src/sys/dev/ic/com.c,v retrieving revision 1.173 diff -u -p -r1.173 com.c --- com.c 14 Aug 2020

dead clock functions

2021-04-21 Thread Miod Vallat
The todr_handle struct contains two unused function pointers, which are either not implemented or with clones of eopnotsupp(). The following diff removes this waste of kernel text. Index: arch/sparc64/dev/rtc.c === RCS file:

more MAKEDEV cleanup

2021-04-05 Thread Miod Vallat
The following diff attempts to clean up a few loose ends in the current MAKEDEV files: - remove no-longer applicable device definitions (MSCP and SMD disks, this kind of thing). - makes sure all platforms use the same `ramdisk' target for installation media devices, rather than a mix of

no ptys on ramdisk filesystems

2021-03-29 Thread Miod Vallat
A few platforms create pty nodes in /dev in the installation media filesystem. That wastes 2x62 inodes on an tight filesystem. The following diff removes these useless (since installation media kernels lack the pty pseudo-device) /dev entries. Miod PS: while there, one might want to unify the

Re: safer sigcode page filling

2021-03-08 Thread Miod Vallat
> I guess the rest of the page contains 0? No, it contains a truncated copy of the sigcode. > It would be better if it contained "trap" instructions. We still don't > have an ideal way of doing that tho. That would work, but that would make the code a bit more complicated. And I'm not sure

safer sigcode page filling

2021-03-08 Thread Miod Vallat
The code responsible for filling a page with repeated copies of the signal trampoline code assumes that PAGE_SIZE % sigfillsz == 0. While this is true on all currently supported OpenBSD platforms, this might not be the case in the future (and isn't the case on some no-longer official platforms).

harmonize maxusers on 64-bit platforms

2021-02-28 Thread Miod Vallat
The following diff causes all 64-bit platforms to use the same maxusers settings. (which in turn affects the maxprocess, maxthread, maxfiles and initialvnodes kernel variables) Index: sys/arch/alpha/conf/files.alpha === RCS file:

Re: occasional SSIGSEGV on C++ exception handling

2021-02-22 Thread Miod Vallat
> No problem, real-life often takes precedence. No way! operator(7) would need an update!

hppa: terminate backtrace of secondary processors

2021-02-07 Thread Miod Vallat
When asking for the backtrace of a secondary processor in ddb, if that backtrace reaches the secondary cpu startup code before the switch_trampoline call, it will trust uninitialized stack data and is likely to panic with an unaligned access at db_stack_trace_print+0x1d0. (this was found the hard

Re: all platforms: isolate hardclock(9) from statclock()

2021-01-14 Thread Miod Vallat
> My understanding is that HZ=100 was a practical choice because the > machines of the day could not reliably drive a faster clock interrupt. The VAX architecture defines a 100Hz timer, which is the only timer you can be sure will be available to the kernel. A few of the later models (VAXstation

Re: libc/regex: safer pointer arithmetic

2021-01-03 Thread Miod Vallat
> regcomp.c uses the "start + count < end" idiom to check that there are > "count" bytes available in an array of char "start" and "end" both point > to. > > This is fine, unless "start + count" goes beyond the last element of the > array. In this case, pedantic interpretation of the C standard

Re: compress sparc64 bsd.rd

2021-01-03 Thread Miod Vallat
> > Rebooting with command: boot bsd.rd.gz > > This is interesting. The change has it just being named bsd.rd, without the > .gz. That's just me testing a compressed bsd.rd.

Re: compress sparc64 bsd.rd

2021-01-03 Thread Miod Vallat
> Since this change went in, bsd.rd doesn't boot unless I uncompress it first. > > upgrade detected: switching to /bsd.upgrade > Trying /bsd.upgrade... > NOTE: random seed is being reused. > Booting /pci@400/pci@2/pci@0/pci@c/nvme@0/disk@1:a/bsd.upgrade >

libc/regex: drop debug helpers

2021-01-03 Thread Miod Vallat
regex(3) documents non-standard extensions REG_ITOA and REG_ATOI to regerror(). In the OpenBSD tree, the only use of them is by the regress test, so why not move that specific code to the regress test and shrink libc a bit - remember that this code is present in the installation media through

Re: libc/regex: turn unsafe macros to inline functions

2021-01-03 Thread Miod Vallat
> Is there a reason not to do > > return (cs->ptr[(uch)c] & cs->mask) != 0; > > This would allow us to get rid of the !! construct in regcomp.c Why not. What about that? Index: regcomp.c === RCS file:

libc/regex: turn unsafe macros to inline functions

2021-01-02 Thread Miod Vallat
That code was written before inline functions were supported by compilers; now that they are even part of the language standard, turn macros into inline functions so that there is no need to document in comments that they will evaluate their arguments multiple times. (one may consider switching

libc/regex: more dead code

2021-01-02 Thread Miod Vallat
The removal of the categories code made these two functions unused, so remove them as well. Index: regcomp.c === RCS file: /OpenBSD/src/lib/libc/regex/regcomp.c,v retrieving revision 1.41 diff -u -p -r1.41 regcomp.c --- regcomp.c

libc/regex: more regular error handling

2020-12-30 Thread Miod Vallat
The REQUIRE macro is used to check for a condition, and set an error in the parse struct if it is not satisfied. This changes it from ((condition) || function call) to a, IMHO more readable, if() test. Index: regcomp.c === RCS file:

libc/regex: drop more unused data

2020-12-30 Thread Miod Vallat
re_guts catspace[] is only written to (via categories[]), and never used for anything, so don't bother keeping that. Index: lib/libc/regex/regcomp.c === RCS file: /OpenBSD/src/lib/libc/regex/regcomp.c,v retrieving revision 1.38 diff

libc/regex: const'r'us

2020-12-30 Thread Miod Vallat
Spencer's code was written before const was a thing, but we can do better. Neither regcomp(3) nor regex(3) modify the strings they are being passed, so we can keep internal pointers as const as well and avoid {dub,spur}ious casts. While there, the temporary array in nonnewline() can be made

compress sparc64 bsd.rd

2020-12-30 Thread Miod Vallat
Up until 6.5, sparc64 bsd.rd were gzipped kernels. This got lost during the Great Installation Media Unification of the 6.6 release cycle, and since then bsd.rd are uncompressed. The following diff ought to fix this and bring back sparc64 netboot times down to acceptable times. Index:

libc/regex: safer pointer arithmetic

2020-12-29 Thread Miod Vallat
regcomp.c uses the "start + count < end" idiom to check that there are "count" bytes available in an array of char "start" and "end" both point to. This is fine, unless "start + count" goes beyond the last element of the array. In this case, pedantic interpretation of the C standard makes the

libc/regex: regerror minor tweaks

2020-12-29 Thread Miod Vallat
The following diff constifies the strings in regerror.c and also makes use of the strlcpy() return value to avoid a redundant strlen() call. Index: regerror.c === RCS file: /OpenBSD/src/lib/libc/regex/regerror.c,v retrieving revision

libc/regex: remove dead code

2020-12-29 Thread Miod Vallat
cclasses[] multis field is always an empty string. Remove it and code dealing with it. This code was incomplete anyway. Index: cclass.h === RCS file: /OpenBSD/src/lib/libc/regex/cclass.h,v retrieving revision 1.6 diff -u -p -r1.6

libc/regex: constify more data

2020-12-29 Thread Miod Vallat
The following diff constifies the strings in cnames[]. No functional change. Index: cname.h === RCS file: /OpenBSD/src/lib/libc/regex/cname.h,v retrieving revision 1.5 diff -u -p -r1.5 cname.h --- cname.h 2 Jun 2003 20:18:36

Re: uvm_map_inentry() checks in trap()

2020-09-25 Thread Miod Vallat
> Repeating diffs from i386, amd64, sh. Improve alpha diff to handle an > additional fault case. Adding diffs for powerpc, powerc64, and m88k. The m88k diff is incomplete: - changes need to be done in both m88100_trap() and m88110_trap(). - the uvm_map_inentry() check should be put after the

Re: fix eeprom(8) on macppc

2020-09-20 Thread Miod Vallat
> > Suggested diff below; clue from NetBSD. > I looked for openprom code there but only found it for SPARC, can you > point me to where you got the "clue" from exactly? http://bxr.su/NetBSD/sys/dev/ofw/openfirmio.c#205

fix eeprom(8) on macppc

2020-09-20 Thread Miod Vallat
I had noticed for years that eeprom(8) always reported failure when attempting to change OpenFirmware environment variables on macppc. Upon further examination, it doesn't - the variables get changed, but error is reported. This is caused by a difference in implementation behaviour between

Re: sigabort(), p_sigmask & p_siglist

2020-09-16 Thread Miod Vallat
> Something doesn't feel right. > > db_kill_cmd finds a process, called p, then kills it. In your new diff > calling sigexit, take note of the comment at the top: > > * Force the current process to exit with the specified signal, dumping core > > current process? Doesn't look like it, it

Re: sigabort(), p_sigmask & p_siglist

2020-09-16 Thread Miod Vallat
> Diff below introduces an helper for sending an uncatchable SIGABRT and > annotate that `p_siglist' and `p_sigmask' are updated using atomic > operations. Why not use sigexit(p, SIGABRT); for that purpose?

Re: symmetric toeplitz hashing

2020-06-14 Thread Miod Vallat
>> Others have pointed out off-list that one can use __builtin_popcount(), >> but __builtin_parity() is exactly what I want. Is it available on all >> architectures? > > I don't think it is available on gcc 3.x for m88k but someone with > an m88k should confirm. __builtin_popcount() does not

Re: powerpc64: ldbrx/stdbrx for endian.h?

2020-06-08 Thread Miod Vallat
> There is an interest in supporting PowerPC 970 ("G5"). That would > allow people to use more than 2G of RAM on the last generations of > Apple PowerMac machines. Otherwise I don't think we are interested in > anything before POWER8. Years ago, a decision was made to ditch 64-bit PA-RISC

Re: sparc64 boot issue on qemu

2020-05-30 Thread Miod Vallat
Yet another case where the emulator does not match the real hardware. Why bother with them? Get qemu to fix their shit so that the frame buffer metrics variable are aligned on 64-bit boundaries. There might not be a written specification for this requirement, but that's the way real hardware

tcpdump gtp bugfix

2020-05-19 Thread Miod Vallat
There seems to be a logic error in tcpdump's print-gtp.c. The code is printing some values by passing a pointer to the array of strings, and the index within the array, and the routine uses sizeof(array) / sizeof(array[0]) to figure out the bound. But since the caller is passing a pointer,

Re: Increase default number of devices created for LDOMs on sparc64

2020-05-18 Thread Miod Vallat
> Learning how LDOMs work on this T4-1 and we only create 8 devices > (each /dev/ldom* and /dev/ttyV*) by default. The now-commonly-available > T4-1 machines can do far more than that pretty easily, so bump up the > number created by default from 8 to 16. > > ok? MAKEDEV is a generated file.

Re: Code changes for clarity

2020-05-18 Thread Miod Vallat
> For instance, in the wsdisplay_emulops structure, there are: > > int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp); > void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul); > > And at the end of the structure is this comment, showing that at > least someone

ld.so and ldconfig manpage nits

2020-05-08 Thread Miod Vallat
This ensures consistent spelling of set-{user,group}-ID, and also mentions LD_DEBUG is ignored by ld.so for such binaries. Index: ld.so.1 === RCS file: /OpenBSD/src/libexec/ld.so/ld.so.1,v retrieving revision 1.23 diff -u -p -r1.23

Re: Kill indirect configuration in autoconf(9)

2020-01-21 Thread Miod Vallat
>> While discussing recent config_detach(9) vs close(2) race I figured >> out that the 'indirect' flag (`cd_indirect') is never set. Some struct cfdriver initialize it to 1. See isa_cd in sys/dev/isa/isa.c. >> Time to kill this feature? Please don't.

Re: fd(4): tsleep(9) -> tsleep_nsec(9), timeout_add(9) -> timeout_add_msec(9)

2020-01-07 Thread Miod Vallat
> Convert ticks to milliseconds. > > The 33 milliseconds in the timeout_add_msec(9) call will be truncated > to 3 ticks, but that was already the case with the current (hz / 30) > code so this is no worse. [...] > /* allow 1/30 second for heads to settle */ > -

sparc64: simplify boot()

2020-01-03 Thread Miod Vallat
Although Open Firmware supports it, there is no way from OpenBSD to reboot with a specified boot command line, so drop vestigial support for it from boot(). Index: sparc64/machdep.c === RCS file:

sparc64: kill BOOT_ARG

2020-01-03 Thread Miod Vallat
BOOT_ARG from is a NetBSDism which did not make its way to OpenBSD, where parsing kernel commandline options is done inline. It is no surprise then, that it is only used by the sparc64 boot blocks; but boot blocks really only care about one option, -a, so there is no need to check for more

Re: TIMESPEC_TO_NSEC(), futex(2) & __thrsleep(2)

2019-12-31 Thread Miod Vallat
> Should we use inline instead of __inline for new code? inline is a C99 keyword, C99 is 20 years old now, and the kernel source is using C99 named initializers, therefore it is safe to assume C99 support from the compiler. It's time to stop defining __const, __inline, __signed and __volatile in

sparc64: remove bogus comment

2019-12-31 Thread Miod Vallat
sparc_bus_protect() was copied from uvm_chgkprot() (which was a KGDB support routine and is no longer present in uvm_glue.c). The "cheezy hack" comment predates the pmap_extract() interface change of 2001 (uvm_glue.c 1.15) and ought to have been removed back then. Index: machdep.c

grep -R with no path

2019-12-02 Thread Miod Vallat
grep(1), when invoked with the -R option but no path, displays a "recursive search of stdin" warning and acts as if -R had not been specified. GNU grep, in that case, will perform a recursive search in the current directory, i.e. uses an implicit "." path if none is given. This is IMO a much

Re: syscall call-from verification

2019-11-28 Thread Miod Vallat
> For dynamic binaries, valid regions are ld.so's text segment, the signal > trampoline, and libc.so's text segment... AND the main program's text. > > Unfortunately our current go build model hasn't followed solaris/macos > approach yet of calling libc stubs, and uses the inappropriate "embed >

Re: ppppoe octeon kernel panic .6.6

2019-10-23 Thread Miod Vallat
> Try changing all the final 0 in sppp_auth_send() to 0UL and this ought > to work. This function needs __attribute__((__sentinel__)) as well to > prevent such mistakes from occurring again. The sentinel attribute wants a pointer, not a zero size_t, unfortunately. Please try this diff. Index:

Re: ppppoe octeon kernel panic .6.6

2019-10-23 Thread Miod Vallat
> The system has a trap 2, which I looked up as: > > #define T_TLB_LD_MISS 2 /* TLB miss on load or ifetch */ > > what happens before this patch, I think, is that there is a varargs size_t > (which is size 8 in mips64), that gets promoted (I think) in varargs to int > (which

Re: minor INSTALL.loongson tweaks

2019-08-13 Thread Miod Vallat
> Is suspend-resume not working on the lemote anymore? It works (or used to work) on the Yeeloong, not on the Gdium (different battery controller chip).

minor INSTALL.loongson tweaks

2019-08-10 Thread Miod Vallat
Hello, I have noticed a few inaccuracies in the installation notes. The following diff fixes them. Index: hardware === RCS file: /OpenBSD/src/distrib/notes/loongson/hardware,v retrieving revision 1.10 diff -u -p -r1.10 hardware

missing splnet in network drivers

2019-07-03 Thread Miod Vallat
The recent mii_tick diff made me ponder whether the mii tick timeout could be put in the mii_data struct rather than each driver softc (not that a good idea, actually). While looking at this, I noticed that two drivers may end up invoking mii_tick() while not being at IPL_NET. bnx: bnx_tick()

unused sparc64 extern

2019-06-29 Thread Miod Vallat
The following declaration has actually never been used, for `ver' is a local in cpuattach() and locore does rdpr %ver every time it needs the value. Index: include/psl.h === RCS file: /OpenBSD/src/sys/arch/sparc64/include/psl.h,v

missing trap.c code for m88k

2019-06-17 Thread Miod Vallat
Exception handling code on superH and m88k does not check for a valid stack pointer, like other platforms do. The following (mechanical) diff addresses the m88k case, and has been tested to work on 88100 and 88110 processors. Index: sys/arch/m88k/m88k/trap.c

Re: free() sizes in zlib

2019-05-14 Thread Miod Vallat
> I have serious doubt whether the whole "plan" for using the sizes to > change the malloc implementation is feasable. The drm(4) code for > example relies on emulation of Linux memory allocation APIs to keep > the diffs small and jsg@ and myself sane. Most of these APIs don't > pass sizes in

free() sizes in zlib

2019-05-14 Thread Miod Vallat
This tries to keep diffability against upstream, hence a questionable choice of the size type for zcfree() - but all sizes should fit in 32 bits anyway. Since all zcfree routines used in the tree cope with NULL arguments (including the various alloc.c used by the boot blocks), I have simplified

free() sizes for ahc(4)

2019-05-14 Thread Miod Vallat
Note ahc_set_name() gets invoked with the dv_xname field of a struct device, so it's not a good idea to free anything, should it be invoked more than once. Tested on: ahc0 at pci0 dev 1 function 0 "Adaptec AIC-7880" rev 0x00: irq 8 ahc0: Host Adapter Bios disabled. Using default SCSI device

free() sizes in sys/arch/alpha

2019-05-13 Thread Miod Vallat
Index: dev/sgmap_common.c === RCS file: /OpenBSD/src/sys/arch/alpha/dev/sgmap_common.c,v retrieving revision 1.14 diff -u -p -r1.14 sgmap_common.c --- dev/sgmap_common.c 9 Dec 2014 06:58:28 - 1.14 +++ dev/sgmap_common.c 13

Re: Removing PF

2019-04-01 Thread Miod Vallat
> Will the bpf JIT changes be done in time for 6.6? I have no doubt > that "pfctl -p /dev/bfp" can be made to work in time but for a truly > performant firewall we will need bpf JIT. I wrote a vax BPF jit as a simple exercize some time ago, so all you really need now is to implement

Re: replacing timeout_add() with timeout_add_msec()

2019-01-21 Thread Miod Vallat
> The intent was to wait a 30th of a second. In practice it has always > fired 30ms hence. It's a magic number, so I'd just call it 30ms. > miod might have an opinion on whether those extra milliseconds would > be useful in the event that sparc64 is ever able to timeout with > millisecond or

Re: minor ttyflags(8) diff

2019-01-13 Thread Miod Vallat
> > Opening a pseudo-tty (/dev/tty[p-zP-T][0-9a-zA-Z]) causes the kernel to > > allocate a struct tty for it, as well as ring buffers for tty data. This > > memory will not get released if the pseudo-tty is closed, for it may be > > opened again in the future. > > The change seems reasonable to

minor ttyflags(8) diff

2019-01-13 Thread Miod Vallat
Opening a pseudo-tty (/dev/tty[p-zP-T][0-9a-zA-Z]) causes the kernel to allocate a struct tty for it, as well as ring buffers for tty data. This memory will not get released if the pseudo-tty is closed, for it may be opened again in the future. On pseudo-ttys, the largest possible ring buffer

SGI O2 mec(4) cold boot issue (and workaround)

2018-12-08 Thread Miod Vallat
I have noticed, for a while, that my O2 systems were horribly slow during installs or upgrades, when fetching sets from the network (28 *minutes* to fetch base64.tgz). At first, I thought this was a bsd.rd specific bug, but couldn't find anything obvious. After gathering enough data, I found out

hppa minor cleanup

2018-11-15 Thread Miod Vallat
In the never ending story of "encoding of diag instructions is hard, let's go shopping" (as shown by at least rev 1.65, 1.66 and 1.189 of hppa locore.S), the following diff attempts to clean and fix things for good: - macros get a cpu-family suffix, since encoding differ accross processor

Remove debug options in hppa GENERIC

2018-11-03 Thread Miod Vallat
The hppa GENERIC kernel contains various debug options for pcmcia and cardbus code. None of the other platforms enables these options in GENERIC. Index: sys/arch/hppa/conf/GENERIC === RCS file:

Re: re-enable -Wshadow for openssl(1)?

2018-08-23 Thread Miod Vallat
> The -Wshadow warning was briefly enabled, but it turned out to break vax > builds with gcc3. Among other things, this warning helps catching stupid > mistakes in refactoring early, so I was wondering whether we could > re-enable it. The commit that disabled it also mentions gcc3, so I'm >

[sparc64] dead code in emul.c

2018-08-07 Thread Miod Vallat
emul.c r1.19 removed a bunch of code, but not enough, and left dead code around. Index: emul.c === RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/emul.c,v retrieving revision 1.23 diff -u -p -r1.23 emul.c --- emul.c 16 Nov 2014

Re: reduce hppa interrupt guts awfulness

2018-05-03 Thread Miod Vallat
> Regarding your diff. The approach seems reasonable to me. The magic > number in the gscbus.c doesn't fill me with joy. > > > + r[4] = cpu_gethpa(0) | (31 - irqbit); /* iar */ > > I realise you're following existing practice, but maybe you could you > add a gscbus_reg struct

unbreak gsckbc (possibly iockbc and mkbc)

2018-05-03 Thread Miod Vallat
sys/dev/pckbc/pckbd.c introduces a buglet, where the value computed for local variable `table' in pckbd_set_xtscancode() in the non-translating case, is overwritten by accident. Unfortunately, this means that the keyboard ends up using a scancode set which is not the one expected by the driver,

Re: avoid uninitialised attr in rasops_scrollback()

2018-05-01 Thread Miod Vallat
> Thanks, looks good/ok. Shouldn't the eraserows call in > rasops_doswitch() also use scr->rs_defattr for the attr argument? Yes, indeed. Good catch!

reduce hppa interrupt guts awfulness

2018-05-01 Thread Miod Vallat
[this is long, and hppa-specific, feel free to ignore if you don't care about OpenBSD/hppa. Noone does anyway nowadays] At the beginning of the hppa port, no interrupts were shared - the processor allows for 32 interrupt sources and the existing designs made sure to allocate distinct interrupts

Re: avoid uninitialised attr in rasops_scrollback()

2018-05-01 Thread Miod Vallat
> scrollback isn't part of wsdisplay_emulops but rather wsdisplay_accessops. > It isn't clear how to properly get an attr in wsscrollback() > GETCHAR/getchar is part of wsmoused and sc->sc_accessops->getchar > may be NULL. Ok, ignore that. There is a simpler solution. Index: rasops.c

  1   2   3   4   >