Author Topic: Does NASM not know fword ?  (Read 8394 times)

nobody

  • Guest
Does NASM not know fword ?
« on: May 08, 2009, 08:07:02 PM »
If I try to use the instructions sgdt and lgdt to store and to load the globle descriptor table in PM, it doesn't work
(error: mismatch in operand sizes)

For these registers I need a six-byte specifizer, but NASM only seems to know byte, word, dword, qword and tword. But to use the registers also instructions like resb or times  aren't helpful.

I need a specifizer for fword. What can I do, to make NASM accept an instruction like sgdt (lgdt) fword [fwordvar] ?

Perhaps I don't see yet a very simple alternative ?

Has anayone an idea ?

Thanks
Michel

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Does NASM not know fword ?
« Reply #1 on: May 08, 2009, 08:47:07 PM »
True, Nasm is an innocent little assembler and doesn't know the fword. :)

What would you do with it if you had it?

lgdt [fwordvar]
...
fwordvar df ???

Seems to me you'd need to break it up anyway...

fwordvar:
dw
dd <*linear* address>

No?

Best,
Frank

nobody

  • Guest
Re: Does NASM not know fword ?
« Reply #2 on: May 09, 2009, 07:57:57 AM »
Yes, allright, but to break up seems not to be the main problem.

Perhaps I'm a little bit blind or stuppid here, but I really don't see, how to store for example the content of sgdt into a six byte aera. That's what this instruction is looking for. I can't use
sgdt dword [var] or sgdt qword [var] - and the following, of course, is not possible at all: sgdt [var] or sgdt var.

Even if I have to break up the given result of sgdt, first I have to store it somewhere in a memory location or in a registry, before I can handle it, but I don't know how. Surely there must be a simple way I don't see yet, cause otherwise you couldn't handle a virtual monitor (VM86) and other stuff to work with routines of the OS. And NASM of course is able to do this.
Right?

Best
Michel

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Does NASM not know fword ?
« Reply #3 on: May 09, 2009, 10:11:28 AM »
Right. I don't see why not.

section .bss
var resb 6

section .text
...
sgdt [var]
...

Size (-1?) is at [var] (7Fh), address is at [var + 2] (C0326E80h - an address not accessable from userland in Linux, of course, so I can't go any farther than that).

What problem are you having with this, Michel?

Best,
Frank