Page 2 of 2
Re: MASM can not support QWORD ?
Posted: Thu Jan 15, 2009 3:10 am
by ru2aqare
david wrote:Code:
The error line is "lgdt qword ptr cs:[bx]".
I tried ml 8.0, It also has the error.
how to solve it ?
Use
The point is the fword modifier. Using qword won't work, because the GDTR is not quad-word sized, its six bytes. The x64 version of masm however doesn't need the fword modifier for lgdt, if I remember correctly.
Re: MASM can not support QWORD ?
Posted: Thu Jan 15, 2009 10:09 pm
by david
It's OK, thank you!
Microsoft Macro Assembler Reference
FWORD
Allocates and optionally initializes 6 bytes of storage for each initializer.
[[name]] FWORD initializer [[, initializer]]... Remarks
Also can be used as a type specifier anywhere a type is legal.
Microsoft Macro Assembler Reference
DF
Can be used to define data such as FWORD.
Re: MASM can not support QWORD ?
Posted: Tue Jan 20, 2009 11:04 pm
by tantrikwizard
FYI, MASM cannot be used for OS development, its in the license agreement (or was last time I checked).
Check out JWASM
http://www.japheth.de/JWasm.html it's a side project of the Open Watcom's assembler and I believe there are plans to integrate it into the standard OW source tree. JWASM kicks MASM's butt.
Re: MASM can not support QWORD ?
Posted: Tue Jan 20, 2009 11:09 pm
by Love4Boobies
tantrikwizard wrote:FYI, MASM cannot be used for OS development, its in the license agreement (or was last time I checked).
That's what poor ol' Troy Martin was trying to explain until he finally had to quit...
Re: MASM can not support QWORD ?
Posted: Wed Jan 21, 2009 11:33 am
by JAAman
tantrikwizard wrote:FYI, MASM cannot be used for OS development, its in the license agreement (or was last time I checked).
...
ok, i think its time to set the record straight on the oft-quoted misconseption...
it is a violation of the license to use masm32 to develop an OS (or any software for non-microsoft OSs)
it is
not a violation of the license to use masm to develop an OS (or any software for non-microsoft OSs)
this comes from the fact that people think masm and masm32 are related (they arnt)
masm == the microsoft macro assembler -- since this is created by MS, it would be a major violation of policy to have any such restriction on it -- however (at least for the stand-alone version) you are not allowed to create commercial software with it or use it to disassemble itself (those are the only 2 restrictions for its use)
masm32 -- a non-microsoft masm-compatable assembler whose license doesnt permit any use other than developing win32 programs (although commercial use is allowed, OSdev and software development for non-MS OSs is explicitly forbidden)
i highly recommend the practice of looking it up before making such claims (although you admitted you didnt know for certain yourself, many others specifically claim otherwise...)
Re: MASM can not support QWORD ?
Posted: Wed Jan 21, 2009 11:41 am
by Creature
I guess he's just not getting the point. Even though you can write your own OS and not distribute it so nobody knows you're making it illegally with MASM, you won't be able to EVER show your OS to ANYONE on these forums or distribute it to your friends. So suppose after 5 years, you've made a Windows clone (hardly unlikely) and you want to show your friends or us the hard work you've been doing, too bad, cause that's against the license. Maybe you should try to find an assembler that supports MASM's syntax (even closer than NASM) but doesn't prevent you from writing an OS with it. If you don't want to run an external tool all the time, create your own build rule or use
YASM's built-in Visual Studio plugin.
Re: MASM can not support QWORD ?
Posted: Wed Jan 21, 2009 12:07 pm
by JAAman
ummm...
there is nothing in the masm license which prevents its use for writing operating systems...
is that a little clearer for you??
Re: MASM can not support QWORD ?
Posted: Wed Jan 21, 2009 12:35 pm
by ru2aqare
JAAman wrote:ummm...
there is nothing in the masm license which prevents its use for writing operating systems...
is that a little clearer for you??
I have to agree. Most people think that the MS macro assembler is the same thing as masm32 - but they aren't. Masm32 is some additional code, libraries and whatnot bundled with the assembler. It's eared towards Win32 application programming. It's licence doesn't permit you to use it for OS development. However, my university participates in this MSDNAA program, so I got the whole VisualStudio 2003 (and later versions, 2005 and 2008) for free, and it actually comes with the MS assembler. And (as far as I can remember) there is nothing in the VS licence which forbids you to use the assembler for OS development.
As for the original question, masm (and it's 64-bit version, ml64) does support the qword qualifier. Just not with the lgdt, lidt and lldt instructions - they require fword (or I think no qualifiers in the case of ml64).
Re: MASM can not support QWORD ?
Posted: Thu Jan 22, 2009 1:06 am
by david
http://msdn.microsoft.com/en-us/library ... S.80).aspx
Microsoft Macro Assembler Reference
MASM for x64 (ml64.exe)
ml64.exe is the assembler that accepts x64 assembly language. For information on ml64.exe compiler options, see ML and ML64 Command-Line Reference.
Inline ASM is not supported for x64. Use MASM or compiler intrinsics (x64 Intrinsics).
The two workarounds are separate assembly with MASM (which supports x64 fully) and compiler intrinsics. We’ve added a lot of intrinsics to allow customers to make use of special-function instructions (e.g. privileged, bit scan/test, interlocked, etc…) in as close to cross-platform a manner as possible.
32-Bit Address Mode (Address Size Override)
MASM will emit the 0x67 address size override if a memory operand includes 32-bit registers. For example, the following examples cause the address size override to be emitted:
mov rax, QWORD PTR [ecx]
mov eax, DWORD PTR [ecx*2+r10d]
mov eax, DWORD PTR [ecx*2+r10d+0100h]
prefetch [eax]
movnti rax, QWORD PTR [r8d]MASM assumes that if a 32-bit displacement appears alone as a memory operand, 64-bit addressing is intended. There is currently no support for 32-bit addressing with such operands.
Finally, mixing register sizes within a memory operand, as demonstrated in the following code, will generate an error.
mov eax, DWORD PTR [rcx*2+r10d]
mov eax, DWORD PTR [ecx*2+r10+0100h]
but I don't have time to try it.
Re: MASM can not support QWORD ?
Posted: Fri Jan 23, 2009 8:24 am
by exkor
Troy Martin wrote:david wrote:and my own os doesn't need to support MASM. I use it in windows.
/facepalm
That's not the point, the point is it's illegal to write an OS or stuff for another OS with MASM. .
Dont forget that if there is nobody to enforce that, then everything is legal especially for hobby OSes and as temporary solution.
Re: MASM can not support QWORD ?
Posted: Fri Jan 23, 2009 8:44 am
by AJ
exkor wrote:if there is nobody to enforce that, then everything is legal especially for hobby OSes and as temporary solution.
I don't know about the specific MASM(32) license, but from a legal point of view, that sounds wrong to me. Just because no-one chooses to enforce something now, doesn't mean they won't in the future. It sounds like saying "murder is legal if nobody catches me" - which I hope most people here would disagree with
Also, although I haven't read the MASM licence, I'm sure it won't have any clause saying "but it's alright for hobby OSes or temporary use..."
Cheers,
Adam
Re: MASM can not support QWORD ?
Posted: Fri Jan 23, 2009 9:11 am
by JAAman
Also, although I haven't read the MASM licence, I'm sure it won't have any clause saying "but it's alright for hobby OSes or temporary use..."
your right, there is no clause saying that... but there is nothing saying you cant either... at all... for anyone
the license for the stand-alone masm (as downloaded from the MS website) is very short, and has no restrictions on use for OSdev, as long as its not commercial (and the one built into VS would be subject to the same restrictions as the rest of VS, which also has no such restrictions)
Re: MASM can not support QWORD ?
Posted: Fri Jan 23, 2009 11:18 am
by DeletedAccount
Hi,
If I am not mistaken masm32 is just an sdk and masm is the assembler [
] that drives masm32 , i guess . I am not therefore really clear about the license.I am not really not sure of license , I am not a lawyer , just go to the bin folder of masm32 and type ml [
] . But I seriously doubt that Microsoft will be concerned with someone doing thier hobby os in masm32 or masm .
Regards
Shrek
Re: MASM can not support QWORD ?
Posted: Sat Jan 31, 2009 10:46 pm
by david
In fact, I don't think you will be the next microsoft even though your os is as same as windows, so I don't think microsoft cares that.
Re: MASM can not support QWORD ?
Posted: Sat Jan 31, 2009 11:41 pm
by AndrewAPrice
Shrek wrote:But I seriously doubt that Microsoft will be concerned with someone doing thier hobby os in masm32 or masm.
Contact them, you never know. I'm sure the masm team will be happy to help you. Don't be scared of a company by it's size, it's still split into small teams made up of programmers (and other professions) like you and me who are passionate about what they are doing.
If you find a bug in their software, have any suggestions for improvements, or you have code which does not build successfully, the masm team would love to hear from you.