Hello,
I am trying to setup my TSS descriptor with the following code:
;**** SYSTEM TSS
align 16
tssTable: ; SS:ESP0 not set yet
times 112 db 0
;*********
And in the gdtTable located further on I have:
nullDesc:
dw 0, 0, 0, 0 ; dummy
dw 0, 0, 0, 0 ; unused
kernelCode:
dw 0xFFFF ; 4Gb limit (low 4 nibbles)
dw 0 ; base address = 0
dw 0x9A00 ; code read/exec, DPL=0
dw 0x00CF ; big granularity, 5th nibble of limit
kernelData:
dw 0xFFFF ; 4Gb limit (low 4 nibbles)
dw 0 ; base address = 0
dw 0x9200 ; data read/write, DPL=0
dw 0x00CF ; big granularity, 5th nibble of limit
tssDescriptor:
dw 0x0070
; Limit of 112 bytes
dw tssTable & 0xFFFF
; Base
dw ((tssTable & 0x00FF0000) >> 16) + 0x8B00
; Base byte 2 in LSByte, flags in MSByte
dw (tssTable & 0xFF000000) >> 16
; Byte 6=0, byte 7=MSB of base >>24 <<8
When I try and compile Nasm generates the following error msg:
bootstrap.asm:254: error: `&' operator may only be applied to scalar values
bootstrap.asm:255: error: `&' operator may only be applied to scalar values
bootstrap.asm:256: error: `&' operator may only be applied to scalar values
so basically, nasm is complaining about the expression dw tssTable & 0xFFFF
Why???????????
PS If someone who runs this site has time could they please make the message box wider, code comments often overflow onto the next line. Other than that, this site is brilliant.
Problem with NASM????
Re:Problem with NASM????
i believe that if you save that value of tssTable to a register then mask the bits to 0xffff, it should work.
I hope this helps out
-GT
I hope this helps out
-GT
Re:Problem with NASM????
Thanks for your suggestion, but using AX is impossible, because I am hardcoding the values directly into the file, and it must be determined at compile time.
I managed to find the solution!
I tried (tssBase-$$) and it works.
Thanks anyway.
I managed to find the solution!
I tried (tssBase-$$) and it works.
Thanks anyway.