; make sure current run-mode is kernel and previous is user MOV #0177776,R0 MOV #030000,(R0) NOP ; initialize kernel- and user stackpointers ; kernel MOV #1000,R6 ;; user ; MOV #0177717,R0 ; MOV #1000,(R0) ; user: 060000-080000 will be mapped to physical address 020000 MOV #0177646,R0 ; 020000 / 0100 (0100 => 64 decimal) MOV #0200,(R0) NOP ; user: make sure write- and read-access is possible MOV #0177606,R0 MOV #077406,(R0) ; kernel: flat mapping ; 0-010000 -> 0 MOV #0172340,R0 MOV #0000,(R0) ; 060000-0100000 -> 060000 MOV #0172346,R0 MOV #0600,(R0) NOP ; kernel: make sure write- and read-access is possible ; 0-010000 MOV #0172300,R0 MOV #077406,(R0) ; 060000-0100000 MOV #0172306,R0 MOV #077406,(R0) ; place a value at 020000 kernelspace which is ; 060000 in userspace MOV #020000,R0 MOV #01234,(R0) ; MRR0 MOV #0177572,R0 ; enable MMU traps BIS #512,(R0) ; enable MMU BIS #1,(R0) ; get word from 060000 in userspace and put that on ; the kernel stack MOV #060000,R0 MFPI (R0) NOP ; check for 01234 MOV (SP)+,R0 CMP #01234,R0 NOP HALT make_raw