[Solved] Tysila + REX prefix = invalid in i586 mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mahibak
Posts: 2
Joined: Wed Sep 11, 2013 8:05 pm

[Solved] Tysila + REX prefix = invalid in i586 mode

Post by mahibak »

Greetings,

I did the Bare Bones C# tutorial with success on an Ubuntu VM. I can successfully launch QEMU, and display text. I did some modifications, then Tysila told me the following:

Code: Select all

Error: REX prefix invalid in i586 mode
I was confused, took a look at the wiki, found nothing that could help me. I then proceeded to remove all possible code that wasn't useful to reproduce the error. I got the following:

kernel.cs:

Code: Select all

namespace OS
{
    class Program
    {
        unsafe static void Main()
        {
            string s3 = "s3";
        }
    }
}
Compiling with GMCS or Tybuild won't change anything. My loader.asm, linker.ld, grub.cfg is like in the Bare Bones tutorial.

Here's my batch file to compile the project and launch emulation:

Code: Select all

#!/bin/bash
nasm -felf -o bin/loader.o source/loader.asm
gmcs /target:exe /out:bin/kernel.exe /unsafe source/*.cs
tysila2.exe --arch i586-elf-tysos -fno-rtti -o bin/kernel.o bin/kernel.exe
ld -m elf_i386 -T source/linker.ld -o iso/kernel.bin bin/loader.o bin/kernel.o
grub-mkrescue -o bin/barebones.iso iso
qemu-system-i386 -cdrom bin/barebones.iso
I get the following output in the terminal:

Code: Select all

source/kernel.cs(7,20): warning CS0219: The variable `s3' is assigned but its value is never used
Compilation succeeded - 1 warning(s)
Assembling Method: static void Main()
  in Type: OS.Program
Error: REX prefix invalid in i586 mode
What can I do to remove this error? Thanks!
Last edited by mahibak on Thu Sep 12, 2013 7:04 am, edited 1 time in total.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Tysila + REX prefix = invalid in i586 mode

Post by dozniak »

Hmm, looks like it generates 64 bit code in gmcs?
Learn to read.
mahibak
Posts: 2
Joined: Wed Sep 11, 2013 8:05 pm

Re: Tysila + REX prefix = invalid in i586 mode

Post by mahibak »

The GMCS manual says that the Mono runtime can only emit code for x86 and anycpu assembles (specified with the -platform argument). I added -platform x86, the error is still there.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: Tysila + REX prefix = invalid in i586 mode

Post by jnc100 »

Thanks, I'll look into it.

Regards,
John.



edit: I've fixed the error you found and updated the code and binaries in the repository. The i586 port is still a work in progress and sometimes still incorrectly ouputs x86_64 code. The REX error you've seen is basically a message to me saying 'at some point in the code an x86_64 opcode was outputted incorrectly'. I'd imagine if you want to still use 32 bit code then you may find more errors like this: in which case please let me know and I'll try and fix them. You can contact me directly rather than using the boards if you like.

Regards,
John.
Post Reply