comp.lang.ada
 help / color / mirror / Atom feed
* Gnat Asm Insertion Question
@ 2001-10-22 11:20 Michael Garrett
  2001-10-22 11:26 ` Lutz Donnerhacke
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Michael Garrett @ 2001-10-22 11:20 UTC (permalink / raw)



I have the following snippet of code to put the processot into protected
mode:

Asm ("movl %%cr0,%%eax; " &
           "or $0x0001,%%eax; " &
           "movl %%eax,%%cr0; " &
           "ljmp $0x10,$1f; " &
           "1: " &
           "movl $0x18,%%eax; " &
           "movl %%eax,%%ds; " &
           "movl %%eax,%%es; " &
           "movl %%eax,%%fs; " &
           "movl %%eax,%%gs; " &
           "movl %%eax,%%ss; ",
           No_Output_Operands,
           No_Input_Operands);

When I try to compile this code, I get the following error:

C:\TEMP\cca00281.s: Assembler messages:
C:\TEMP\cca00281.s:89: Error: operands given don't match any known 386
instructi
on
gnatmake: "hardware\adaos-hardware-processor.adb" compilation error
make: *** [make_ada_main] Error 4

For some reason, the label for the ljmp instruction is not declared
properly.

How do I properly write this code so that the compiler creates a label?

Thank you in advance!!

--
Michael C. Garrett
Garrett Technologies Inc.
michaelgarrett@csi.com





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Gnat Asm Insertion Question
  2001-10-22 11:20 Gnat Asm Insertion Question Michael Garrett
@ 2001-10-22 11:26 ` Lutz Donnerhacke
  2001-10-22 12:37 ` Florian Weimer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Lutz Donnerhacke @ 2001-10-22 11:26 UTC (permalink / raw)


* Michael Garrett wrote:
>Asm ("movl %%cr0,%%eax; " &
>           "or $0x0001,%%eax; " &
>           "movl %%eax,%%cr0; " &
>           "ljmp $0x10,$1f; " &
>           "1: " &

Why do you put it all on one line?
Does labels work if declared in a column greater one?

>C:\TEMP\cca00281.s: Assembler messages:
>C:\TEMP\cca00281.s:89: Error: operands given don't match any known 386
>instruction

Adding Latin1.NL greatly improve debugging, because every instruction gets a
unique line number.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Gnat Asm Insertion Question
  2001-10-22 11:20 Gnat Asm Insertion Question Michael Garrett
  2001-10-22 11:26 ` Lutz Donnerhacke
@ 2001-10-22 12:37 ` Florian Weimer
  2001-10-22 14:50 ` Michael Garrett
  2001-10-22 18:50 ` FGD
  3 siblings, 0 replies; 8+ messages in thread
From: Florian Weimer @ 2001-10-22 12:37 UTC (permalink / raw)


"Michael Garrett" <michaelgarrett@csi.com> writes:

> I have the following snippet of code to put the processot into protected
> mode:
> 
> Asm ("movl %%cr0,%%eax; " &
>            "or $0x0001,%%eax; " &
>            "movl %%eax,%%cr0; " &
>            "ljmp $0x10,$1f; " &
>            "1: " &
>            "movl $0x18,%%eax; " &
>            "movl %%eax,%%ds; " &
>            "movl %%eax,%%es; " &
>            "movl %%eax,%%fs; " &
>            "movl %%eax,%%gs; " &
>            "movl %%eax,%%ss; ",
>            No_Output_Operands,
>            No_Input_Operands);

The output constraints are probably wrong, This sequence of
instructions changes a huge number of registers.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Gnat Asm Insertion Question
  2001-10-22 11:20 Gnat Asm Insertion Question Michael Garrett
  2001-10-22 11:26 ` Lutz Donnerhacke
  2001-10-22 12:37 ` Florian Weimer
@ 2001-10-22 14:50 ` Michael Garrett
  2001-10-22 14:57   ` Lutz Donnerhacke
                     ` (2 more replies)
  2001-10-22 18:50 ` FGD
  3 siblings, 3 replies; 8+ messages in thread
From: Michael Garrett @ 2001-10-22 14:50 UTC (permalink / raw)


I chaged the code to read:

Asm (Latin_1.LF & Latin_1.HT &
           "movl %%cr0,%%eax; "    & Latin_1.LF & Latin_1.HT &
           "or $0x0001,%%eax; "      & Latin_1.LF & Latin_1.HT &
           "movl %%eax,%%cr0; "    & Latin_1.LF & Latin_1.HT &
           "ljmp $0x10,$1f; "              & Latin_1.LF &
           "1: "                                     & Latin_1.LF &
Latin_1.HT &
           "movl $0x18,%%eax; "     & Latin_1.LF & Latin_1.HT &
           "movl %%eax,%%ds; "     & Latin_1.LF & Latin_1.HT &
           "movl %%eax,%%es; "     & Latin_1.LF & Latin_1.HT &
           "movl %%eax,%%fs; "      & Latin_1.LF & Latin_1.HT &
           "movl %%eax,%%gs; "     & Latin_1.LF & Latin_1.HT &
           "movl %%eax,%%ss; ",
           No_Output_Operands,
           No_Input_Operands);

In a Put statement, this gives me formated asm code with the label in the
first location on the line.
But the compiler is still choking after the label.

I took this code from a web reference which was supposed to have compiled at
one time.....


Michael Garrett <michaelgarrett@csi.com> wrote in message
news:9r0vhg$evr$1@suaar1aa.prod.compuserve.com...
>
> I have the following snippet of code to put the processot into protected
> mode:
>
> Asm ("movl %%cr0,%%eax; " &
>            "or $0x0001,%%eax; " &
>            "movl %%eax,%%cr0; " &
>            "ljmp $0x10,$1f; " &
>            "1: " &
>            "movl $0x18,%%eax; " &
>            "movl %%eax,%%ds; " &
>            "movl %%eax,%%es; " &
>            "movl %%eax,%%fs; " &
>            "movl %%eax,%%gs; " &
>            "movl %%eax,%%ss; ",
>            No_Output_Operands,
>            No_Input_Operands);
>
> When I try to compile this code, I get the following error:
>
> C:\TEMP\cca00281.s: Assembler messages:
> C:\TEMP\cca00281.s:89: Error: operands given don't match any known 386
> instructi
> on
> gnatmake: "hardware\adaos-hardware-processor.adb" compilation error
> make: *** [make_ada_main] Error 4
>
> For some reason, the label for the ljmp instruction is not declared
> properly.
>
> How do I properly write this code so that the compiler creates a label?
>
> Thank you in advance!!
>
> --
> Michael C. Garrett
> Garrett Technologies Inc.
> michaelgarrett@csi.com
>
>





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Gnat Asm Insertion Question
  2001-10-22 14:50 ` Michael Garrett
@ 2001-10-22 14:57   ` Lutz Donnerhacke
  2001-10-22 15:04   ` Florian Weimer
  2001-10-23  4:12   ` Michael Garrett
  2 siblings, 0 replies; 8+ messages in thread
From: Lutz Donnerhacke @ 2001-10-22 14:57 UTC (permalink / raw)


* Michael Garrett wrote:
>Asm (Latin_1.LF & Latin_1.HT &
>           "movl %%cr0,%%eax; "    & Latin_1.LF & Latin_1.HT &
>           "or $0x0001,%%eax; "    & Latin_1.LF & Latin_1.HT &
>           "movl %%eax,%%cr0; "    & Latin_1.LF & Latin_1.HT &
>           "ljmp $0x10,$1f; "      & Latin_1.LF &
>           "1: "                   & Latin_1.LF & Latin_1.HT &
>           "movl $0x18,%%eax; "    & Latin_1.LF & Latin_1.HT &
>           "movl %%eax,%%ds; "     & Latin_1.LF & Latin_1.HT &
>           "movl %%eax,%%es; "     & Latin_1.LF & Latin_1.HT &
>           "movl %%eax,%%fs; "     & Latin_1.LF & Latin_1.HT &
>           "movl %%eax,%%gs; "     & Latin_1.LF & Latin_1.HT &
>           "movl %%eax,%%ss; ",
>           No_Output_Operands,
>           No_Input_Operands);

Still 'Globbing => "..."' is missing.

>In a Put statement, this gives me formated asm code with the label in the
>first location on the line. But the compiler is still choking after the
>label.

Because a label has to start with an Alpha?

Please do not append the whole message: Learn to quote.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Gnat Asm Insertion Question
  2001-10-22 14:50 ` Michael Garrett
  2001-10-22 14:57   ` Lutz Donnerhacke
@ 2001-10-22 15:04   ` Florian Weimer
  2001-10-23  4:12   ` Michael Garrett
  2 siblings, 0 replies; 8+ messages in thread
From: Florian Weimer @ 2001-10-22 15:04 UTC (permalink / raw)


"Michael Garrett" <michaelgarrett@csi.com> writes:

> In a Put statement, this gives me formated asm code with the label in the
> first location on the line.

Have you checked the assembler file (you get it when you invoke gcc
with the -S option).

> But the compiler is still choking after the label.

It's not the compiler, but the assembler.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Gnat Asm Insertion Question
  2001-10-22 11:20 Gnat Asm Insertion Question Michael Garrett
                   ` (2 preceding siblings ...)
  2001-10-22 14:50 ` Michael Garrett
@ 2001-10-22 18:50 ` FGD
  3 siblings, 0 replies; 8+ messages in thread
From: FGD @ 2001-10-22 18:50 UTC (permalink / raw)


Try putting LF between each asm instruction, this way you can compile 
with the -s option and get exactly which instruction causes the problem.

The long jmp may be the problem. But I have had problems with moves to 
segment regs on some versions of GNAT, which may in fact depend on the 
version of GAS used. You have to use operands with matching size, so you 
have to write "movl %ax,%ds" and not "movl %eax,%ds" even with a -l 
instruction suffix. Don't write "movw %ax,%ds", that will add a 66h 
prefix. "mov %ax,%ds" will assemble but there seems to be no certain way 
to know whether or not it will add a 66h prefix.

-- Frank

Michael Garrett wrote:

> I have the following snippet of code to put the processot into protected
> mode:
> 
> Asm ("movl %%cr0,%%eax; " &
>            "or $0x0001,%%eax; " &
>            "movl %%eax,%%cr0; " &
>            "ljmp $0x10,$1f; " &
>            "1: " &
>            "movl $0x18,%%eax; " &
>            "movl %%eax,%%ds; " &
>            "movl %%eax,%%es; " &
>            "movl %%eax,%%fs; " &
>            "movl %%eax,%%gs; " &
>            "movl %%eax,%%ss; ",
>            No_Output_Operands,
>            No_Input_Operands);
> 
> When I try to compile this code, I get the following error:
> 
> C:\TEMP\cca00281.s: Assembler messages:
> C:\TEMP\cca00281.s:89: Error: operands given don't match any known 386
> instructi
> on
> gnatmake: "hardware\adaos-hardware-processor.adb" compilation error
> make: *** [make_ada_main] Error 4
> 
> For some reason, the label for the ljmp instruction is not declared
> properly.
> 
> How do I properly write this code so that the compiler creates a label?
> 
> Thank you in advance!!
> 
> --
> Michael C. Garrett
> Garrett Technologies Inc.
> michaelgarrett@csi.com
> 
> 
> 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Gnat Asm Insertion Question
  2001-10-22 14:50 ` Michael Garrett
  2001-10-22 14:57   ` Lutz Donnerhacke
  2001-10-22 15:04   ` Florian Weimer
@ 2001-10-23  4:12   ` Michael Garrett
  2 siblings, 0 replies; 8+ messages in thread
From: Michael Garrett @ 2001-10-23  4:12 UTC (permalink / raw)



Michael Garrett <michaelgarrett@csi.com> wrote in message
news:9r1bqc$nsp$1@suaar1aa.prod.compuserve.com...

 I chaged the code to read:

The LF and HT's in the right spot along with having the correct movl
operand size corrected the issue.

Thanks to everyone for the help. ( I will need more ......... )

Asm (Latin_1.LF & Latin_1.HT &
           "movl %%cr0,%%eax; "    & Latin_1.LF & Latin_1.HT &
            "or $0x0001,%%eax; "      & Latin_1.LF & Latin_1.HT &
            "movl %%eax,%%cr0; "    & Latin_1.LF & Latin_1.HT &
            "ljmp $0x10,$1f; "              & Latin_1.LF &
            "1: "                                     & Latin_1.LF &
Latin_1.HT &
            "movl $0x18,%%eax; "     & Latin_1.LF & Latin_1.HT &
            "movl %%ax,%%ds; "     & Latin_1.LF & Latin_1.HT &
            "movl %%ax,%%es; "     & Latin_1.LF & Latin_1.HT &
            "movl %%ax,%%fs; "      & Latin_1.LF & Latin_1.HT &
           "movl %%ax,%%gs; "     & Latin_1.LF & Latin_1.HT &
            "movl %%ax,%%ss; ",
            No_Output_Operands,
            No_Input_Operands);







^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-10-23  4:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-22 11:20 Gnat Asm Insertion Question Michael Garrett
2001-10-22 11:26 ` Lutz Donnerhacke
2001-10-22 12:37 ` Florian Weimer
2001-10-22 14:50 ` Michael Garrett
2001-10-22 14:57   ` Lutz Donnerhacke
2001-10-22 15:04   ` Florian Weimer
2001-10-23  4:12   ` Michael Garrett
2001-10-22 18:50 ` FGD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox