Skip to content

Instantly share code, notes, and snippets.

View strejda's full-sized avatar

Michal Meloun strejda

  • self employee
  • Prague, Czech Republic
View GitHub Profile
@strejda
strejda / pritntf_test.c
Created January 23, 2021 15:23
pritntf_test.c
#include <stdio.h>
int main()
{
unsigned char *ptr; double d;
d = 1.001;
printf("test 1.001 - %G %g, sizeof(d): %d\n",d, d, (int)sizeof(d));
ptr = (unsigned char *)&d;
printf(" 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
@strejda
strejda / iflib_test1.diff
Created November 18, 2020 10:40
iflib test
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 9e7bc7f57b7..22015825774 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5990,11 +5990,13 @@ iflib_irq_set_affinity(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type,
co += ctx->ifc_softc_ctx.isc_nrxqsets;
cpuid = find_nth(ctx, qid + co);
tid = get_core_offset(ctx, type, qid);
+printf("%s: get_core_offset qid %d, co: %d, cpuid: %d, tid: %d\n", __func__, qid, co, cpuid, tid);
if (tid < 0) {

DRM cdev pager is not compatible with ARM pmap.

Actually, this is the only problematic part of linux KPI and/or kernel VM. And it need longer clarification: The DRM device pager is based on OBJT_DEVICE, OBJT_MDEVICE or OBJT_SG objects. All these pagers uses fake pages (vm_page_getfake(), vm_page_updatefake()) for mmaping memory used by GPU to user space. On ARM, fake pages aliases are allowed only if they are backed by fictitious pages (i.e. memory on GPU card), not by normal memory pages (CPU memory). The later breaks ARM basic pmap assumption that

paddr == VM_PAGE_TO_PHYS(PHYS_TO_VM_PAGE(paddr))

and I’m unable, nor as ARM pmap coauthor, to find any reasonable solution. I spent weeks of tests on this, but without success.

@strejda
strejda / qemu-static-fail1
Created January 18, 2017 14:37
qemu-static signal 11 in fork_end
static -c qemu-arm-static.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `qemu-arm-static -L /usr/gnemul/qemu-arm /usr/local/bin/python3.5 ./waf configure'.
Program terminated with signal 11, Segmentation fault.
Assertion failed: ((PartVT.isInteger() || PartVT == MVT::x86mmx) && ValueVT.isInteger() && "Unknown mismatch!"), function getCopyToParts, file /usr/src/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp, line 436.
Abort (core dumped)
root@tegra124:/tmp #
root@tegra124:/tmp #
@strejda
strejda / timer
Last active December 19, 2016 16:22
diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c
index e42a699986c..647645cf756 100644
--- a/sys/arm/arm/generic_timer.c
+++ b/sys/arm/arm/generic_timer.c
@@ -275,6 +275,7 @@ arm_tmr_intr(void *arg)
if (ctrl & GT_CTRL_INT_STAT) {
ctrl |= GT_CTRL_INT_MASK;
set_ctrl(ctrl, sc->physical);
+ get_ctrl(sc->physical);
}
File: libauditd/libauditd.so.5
93: 0000000000003878 456 FUNC GLOBAL DEFAULT 11 __aeabi_uidiv
76: 0000000000003878 456 FUNC GLOBAL DEFAULT 11 __aeabi_uidiv
File: libauditd/libauditd.so.5.debug
85: 0000000000003878 456 FUNC GLOBAL DEFAULT 11 __aeabi_uidiv
File: libauditd/libauditd.so.5.full
93: 0000000000003878 456 FUNC GLOBAL DEFAULT 11 __aeabi_uidiv
85: 0000000000003878 456 FUNC GLOBAL DEFAULT 11 __aeabi_uidiv
File: libbegemot/libbegemot.so.4
36: 0000000000002064 456 FUNC GLOBAL DEFAULT 11 __aeabi_uidiv
tegra_hda0: Starting CORB Engine...
tegra_hda0: Starting RIRB Engine...
tegra_hda0: Enabling controller interrupt...
tegra_hda0: Scanning HDA codecs ...
tegra_hda0: Found CODEC at address 3
hdacc0: <NVIDIA (0x0028) HDA CODEC> at cad 3 on tegra_hda0
Root Node at nid=0: 1 subnodes 1-1
hdaa0: <NVIDIA (0x0028) Audio Function Group> at nid 1 on hdacc0
hdaa0: hdac_intr_handler: intsts: 0xC0000000, intctrl: 0xC0000000
Subsystem ID: 0x10de0101
#
# Firmware
#
tegra124_xusb_fw.c optional tegra124_xusb_fw \
dependency "$S/arm/nvidia/tegra124/files.tegra124" \
compile-with "${AWK} -f $S/tools/fw_stub.awk tegra124_xusb.fw:tegra124_xusb_fw -mtegra124_xusb_fw -c${.TARGET}" \
no-implicit-rule before-depend local \
clean "tegra124_xusb_fw.c"
tegra124_xusb.fwo optional tegra124_xusb_fw \
dependency "tegra124_xusb.fw" \
@strejda
strejda / test.c
Created June 21, 2016 15:06
clang
int i;
struct s
{
int b;
} __attribute__((packed));
void test1(void);
void test1(void)
{