I am new to assembly and I am trying to understand Linux 0.01 bootloader code but I got stuck at this part (at very beginning :) ):
.globl begtext, begdata, begbss, endtext, enddata, endbss
.text
begtext:
.data
begdata:
.bss
begbss:
.text
BOOTSEG = 0x07c0
INITSEG = 0x9000
SYSSEG = 0x1000 | system loaded at 0x10000 (65536).
ENDSEG = SYSSEG + SYSSIZE
entry start
start:
mov ax,#BOOTSEG
mov ds,ax
mov ax,#INITSEG
mov es,ax
mov cx,#256
sub si,si
sub di,di
rep
movw
jmpi go,INITSEG
This code (as explained in source comments) copies the bootloader to a new location and continues execution from go
.
rep
followed by movs
should do this (copying part), but instead the instruction mov{w}
is used.
rep
movw
In every reference book for x86 I looked rep
is used with string instructions. Same for Intel's manual entry for the prefix.
Can rep
be used with all data transfer instructions or just string ones, and if so why is it not mentioned in reference manuals?