> Hi all: > > I am very very new to kernel hacking. I have been reading lurking on > this list for some time and have to commend all you guys for the great > and friendly atmosphere. > > As I was reading the bootstrap code (bootsect.S), I came across : > movw $BOOTSEG, %ax > movw %ax, %ds # %ds = BOOTSEG > movw $INITSEG, %ax > > $BOOTSEG gets assigned to %ax which gets assigned to %ds. I am also new > to assembly, but could the first two lines be made into a single line like > movw $BOOTSEG, %ds > > Is this possible? or is there a reason for it going through %ax, which > appears to be a redundant middle-man since its immediately overwritten > in the third line. > movw $INITSEG, %ax > > Thanks. it is impossible in x86 assembly to move a constant into a segment register directly. thus we go thru ax. (iirc, it's been a while since ive done x86 asm with segments) however, one opto would be to load both ax and bx with bootseg and initseg, thus reducing the few cycles of register contention. negligible in any event. chris -- Even if schools don't teach literacy or thinking skills, they teach everyone to watch the clock constantly, to be sedentary most of the day, and do activities they have no interest in. They teach about pecking orders, that any weakness will be exploited, and that going against the grain will have very negative consequences. They teach you to wake up not when your body tells you to, but when the alarm goes off. They teach you to respond to bells and orders. They teach that displaying any extraordinary skills or talents will result in persecution. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/