#
✕ nick:gordonfreeman
#asahi-dev · 2023-05-30 11:41
gordonfreemanSo I cannot correlate them with the process
#asahi-dev · 2023-05-30 11:40
gordonfreemanI've printed TPIDR_EL0 and TPIDR_EL1 values during the exception but seemingly TPIDR_EL0 is set to cpu id of the process and changes
#asahi-dev · 2023-05-30 11:39
gordonfreemanis there any way to know which EL0 process caused EL1 to generate an exception?
#asahi-dev · 2023-04-28 15:45
gordonfreemanAm I missing something?
#asahi-dev · 2023-04-28 15:45
gordonfreemanthis prevents the debug exception generation but also the kernel panics after the first handling.
#asahi-dev · 2023-04-28 15:45
gordonfreemanwhat I currently do in handle_step C version is: u64 mdscr_el1 = BIT(15); // MDE=1 msr(MDSCR_EL1, mdscr_el1); return true;
#asahi-dev · 2023-04-28 15:43
gordonfreemanI'm actually moving the py code to c verbatim. The issue in the python comment in handle_step happens in C, too: "not sure why MDSCR_EL1.SS needs to be disabled here but otherwise if also SPSR.SS=0 no instruction will be executed after eret and instead a debug exception is generated again"
#asahi-dev · 2023-04-28 15:42
gordonfreemanhello! I'm trying to move the single step handler of m1n1 from py to c. single stepping is ok, but I couldn't handle the SSTEP_LOWER exception which comes after stepping.
#asahi-dev · 2023-04-04 12:52
gordonfreemanHCR_EL2.TGE is 0. E0PD0 and E0PD1 are zero.
#asahi-dev · 2023-04-04 12:37
gordonfreemanWhat's wrong?
#asahi-dev · 2023-04-04 12:36
gordonfreemanOkay, right after mmap'ing and memset'ting a fixed address from EL0, I trigger a brk. In brk handler I run hv_translate but 0x0 is returned. checked out SPSR and it's M=SPSR_M.EL0t, which is what we want.
#asahi-dev · 2023-04-04 11:53
gordonfreemanoh so EL0 brk's are also handled in m1n1? I thought only EL1 ones... will try this out
#asahi-dev · 2023-04-04 11:50
gordonfreemanany idea how can I drop to m1n1 shell while executing user code? What I currently do is to trigger kernel to make a hvc call to stop the execution. But obviously we switch to kernel context while doing this
#asahi-dev · 2023-04-04 11:49
gordonfreeman> *executing user code
#asahi-dev · 2023-04-04 11:44
gordonfreemanso seemingly xnu doesn't do EL0 VA-PA conversion as well... but then what manages this mapping?
#asahi-dev · 2023-04-04 11:43
gordonfreemanInteresting fact is `at s1e0r` has only 1 reference in XNU src, in `mmu_uvtop` ("MMU user virtual to physical address translation"). But this mmu_uvtop is meant to be used only in KDP.
#asahi-dev · 2023-04-04 11:27
gordonfreemanAlso tried to run `at s1e0r`at EL1 for EL0 VA--->PA conversion but what I get in the PAR_EL1 is "Translation fault, level 2" error code.
#asahi-dev · 2023-04-04 11:24
gordonfreemanthere are `at` instructions in hv_translate function but they require SPSR.M value to be EL0. However in m1n1 shell we are not EL0. Set it to EL0 forcefully then called hv_translate but didn't work
#asahi-dev · 2023-04-04 11:23
gordonfreemanhello, I'm running macos under m1n1 for kernel debugging. How can I locate physical address of an EL0 virtual address?