JIT com Simple Assemble !

1. JIT com Simple Assemble !

???
gokernel

(usa Linux Mint)

Enviado em 27/10/2018 - 10:58h

Olá Pessoal !

Estou atualizando uma API JIT( x86 ) 32/64 Bits e resolvi para testar criar uma Simples Linguagem ( Assembler ) para "brincar"...


Testado em:
01 - Windows 7 - 32 e 64 Bits
02 - Linux - 32 e 64 Bits

Projeto aqui:
https://github.com/gokernel2017/asm

Exemplo test.asm:

//-----------------------------------------------
//
// Simple Example:
//
// FILE:
//   test.asm
//
// USAGE:
//   simple test.asm
//
//-----------------------------------------------
//
long a
long b

#ifdef __x86_32__
  sub   $16, %esp
#endif

#ifdef __x86_64__
  hello
#endif

label_hello:

  mov   $1000, a
  mov   $1500, b

  // call function with argument: 1
  //
  info  1

  version
 


Estou implementando um "assembler" em MAIS Alto Nível.

OBS: As chamadas de funcões por enquanto só está implementada para 2 argumentos ...

Para compilar leia o arquivo README.txt ou:


// TO COMPILE IN 32 BITS:
//   gcc -c src/asm.c -m32 -Wall
//   gcc src/simple.c -o simple asm.o -m32 -Wall
//
//
// TO COMPILE IN 64 BITS:
//   gcc -c src/asm.c -m64 -Wall
//   gcc src/simple.c -o simple asm.o -m64 -Wall
 


Para testar:

  simple test.asm

 


E se alguém gostou do projeto, favor clicar na "strela" lá no github... ;)

Projeto em BETA AINDA ...





  


2. Re: JIT com Simple Assemble !

???
gokernel

(usa Linux Mint)

Enviado em 28/10/2018 - 11:31h


Projeto atualizado ... BUG encontrado em:
-----------------------------------------------------------
Arquivo: src/simple.c
Função: void Execute (ASM *a, char *FileName);
-----------------------------------------------------------

E já corrigido !




3. Re: JIT com Simple Assemble !

???
gokernel

(usa Linux Mint)

Enviado em 29/10/2018 - 18:27h

Olá pessoal !

Projeto atualizado:

Implementada funções:


//-----------------------------------------------
//
// Simple Example:
//
// FILE:
//   test.asm
//
// USAGE:
//   simple test.asm
//
//-----------------------------------------------
//
long a
long b

function version_set_var
  version

  mov   $1, %eax
  mov   $1500, %ebx

  mov   %eax, a
  mov   %ebx, b
end

#ifdef __x86_32__
  sub   $32, %esp
#endif

  version_set_var

  // call function with argument: 1
  //
  info  a

 


OBS: Nas próximas "releases" a funcao interna ( version ) será implementada em ( info ) usando o parâmetro 4 ou 5.




4. Re: JIT com Simple Assemble !

???
gokernel

(usa Linux Mint)

Enviado em 31/10/2018 - 20:01h

Olá Pessoal !

Projeto atualizado com opcode ( cmp ) e opcode ( if ) em MAIS alto nível.

OBS: opcode ( if ) só está implementado para comparar ( > ) ou ( < ) ...

Exemplo: if_cmp.asm


//-------------------------------------------------------------------
//
// OPCODE ( if / cmp ) Example:
//
// FILE:
//   if_cmp.asm
//
//-------------------------------------------------------------------
//
long a
long b

  mov   $200, a
  mov   $100, b
  

  if a > b { // if em MAIS alto nível
    hello
  }

  //---------------------------------------------
  //
  // C Similar Code:
  //
  // if (a > b) {
  //     version();
  // }
  //
  //---------------------------------------------
  //
  mov   a, %ebx
  mov   b, %eax
  cmp   %eax, %ebx
  jle   label_pula  // >
    version
  label_pula:

 


Sugestões serão bem-vindas !!!








Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts