Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Merging few files from i386/amd64 into x86



On Monday 30 March 2009 11:14:32 Mindaugas Rasiukevicius wrote:
> David Young <dyoung%pobox.com@localhost> wrote:
> > Can you avoid using new #ifdefs, or else confine them to the top of the
> > file?  They make even straightforward code hard to read. :-/
>
> More about this:
>
> http://www.netbsd.org/~rmind/x86_cpu.diff
>
>       if (stack != NULL) {
> #ifdef __x86_64__
>               tf->tf_rsp = (uint64_t)stack + stacksize;
> #else
>               tf->tf_esp = (u_int)stack + stacksize;
> #endif
>       }
>
> With these macros, such code would become:
>
>       if (stack != NULL)
>               X86_TF_RSP(tf) = (uintptr_t)stack + stacksize;
>
> This would make merge of trap.c and syscall.c into x86 quite nice.
>
> Concerns:
>
> - Any reason why we would want to keep the type size in MD (instead of
>   abstracting it out, eg. with uintptr_t)?

Ok with me, but take care about storage of physical addresses: uintptr_t
is not large enough in respect to 32bit PAE.

>   By the way: 
>   http://nxr.netbsd.org/source/xref/sys/arch/i386/include/frame.h#trapframe
>   Why these and others are not unsigned, eg. uint32_t?

IMO, this is a bug because this reduces the effective register size to 31bits.

> - Naming of macros could be better. Suggestions?
>
> Thanks.




Home | Main Index | Thread Index | Old Index