Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
No se puede abrir el archivo en Linux a través de 0x80

Estoy tratando de implementar en GAS un programa de prueba simple que abre un archivo, escribe un texto y sale. Sin embargo, la llamada del sistema para 'abrir' sigue devolviendo '-14' ("EFAULT - dirección incorrecta" si entiendo correctamente). El código del programa es el siguiente:

 .intel_syntax noprefix .section .data textoutput: .asciz "Hello world!" pstr_end: .set lentext, pstr_end - textoutput filetoopen: .asciz "/tmp/tsttxt" .section .text .globl main .func main main: mov eax, 5 # open mov ebx, filetoopen # filname mov ecx, 2 # flags: read and write mov edx, 0700 # mode int 0x80 mov ebx, eax # <<< !!! eax here contains -14 mov eax, 4 mov ecx, textoutput mov edx, lentext int 0x80 mov eax, 1 mov ebx, 0 int 0x80

El problema parece estar en la cadena filetoopen (la página de manual para open dice que EFAULT significa pathname points outside your accessible address space ). ¿Está filetoopen declarado correctamente en el código del programa? ¿Cuál puede ser la causa de este error?

Gracias.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

En la sintaxis de Intel, debe usar mov ebx, offset filetoopen . Si observa la instrucción real ensamblada, puede ver que es una carga de memoria:

 80483e1: 8b 1d 2d 96 04 08 mov ebx,DWORD PTR ds:0x804962d

Por supuesto, eso es incorrecto, necesita la dirección aquí. Esto también se aplica a las otras dos ocurrencias de este patrón.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!