Miguel de Icaza writes:
> > 0x20000 (not 0x200000) is automatically mapped in a process
> > by the kernel when referenced. See <sys/prctl.h> on IRIX for
> > the definitions.
> Ok, thanks for the pointer. btw, the code seems to indicate that the
> address is indeed 0x200000 (it does a lui $reg,0x20). Oops. Hold
> on. The sys/prctl agrees with me, it is 0x200000.
Yes, you are correct.
> > Most of the fields you can probably ignore, but you should set
> > t_pid, t_rpid, and t_prid (where the latter is the value of the
> > $prid COP0 register). Set t_pid and t_rpid to the pid of the
> > process. (They cannot really be different in IRIX.)
> Ok. There is another bit that looks promising: the t_cpu field, which
> is supposed to have the cpu number where the process is executing.
> Does IRIX update this on every context switch?
Yes, on a multiprocessor, but it is a constant on a uniprocessor.
> > Simply automatically create the page in the page fault handler
> > when it is first referenced. Treat as if it were an mmap() of /dev/zero
> > for 1 page.
> Ok. The code that I used last night to work around this was to map
> a /dev/zero page at sys_irix_elfexec time, I think I will just poke
> the right values there.
As someone else pointed out, mapping the page is sys_irix_elfexec
time is probably better, since it will avoid slowing down the page