Re: Bootstrap Asm Question

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

 



On Thu, Mar 07, 2002 at 10:08:19PM +0600, Anuradha Weeraman wrote:
> 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

move immediate to segment register is not supported in Intel. i.e., you can't
move an immediate value directly to a segment register. Hence here, immediate
value BOOTSEG is moved to %ax(a general purpose register) first and then 
from %ax to %ds.

Regards,
Bharata.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux