Skip to content

var_lookup_local sometimes faults #24

Open
@Frityet

Description

@Frityet

Offending code, specifically the if statment

/* Lookup local variable name. */
static BCReg var_lookup_local(FuncState *fs, GCstr *n)
{
  int i;
  for (i = fs->nactvar-1; i >= 0; i--) {
    if (n == strref(var_get(fs->ls, fs, i).name))
      return (BCReg)i;
  }
  return (BCReg)-1;  /* Not found. */
}

Log:

Started LuaOS
[*] start.c:105 2 + 2 = 4
[*] start.c:106 Hello, World!
[*] start.c:108 Initialising GDT
[+] gdt.c:42 Done
[+] start.c:110 Done
[*] start.c:112 Initialising IDT
[+] start.c:114 Done
[*] start.c:117 Initialising memory
[*] start.c:119   Magazines...
[+] start.c:121   Done
[*] start.c:123   Kernel memory allocator...
[+] start.c:125   Done
[+] start.c:127 Done
[*] start.c:137 Initialising APIC
[*] start.c:147   Found entry with ID 0
[+] start.c:151   Found LAPIC at core 0 (address: 0xFFFF80007FB7802C)
[*] start.c:152     Processor ID: 0
[*] start.c:153     APIC ID: 0
[*] start.c:154     Flags: 1
[*] start.c:147   Found entry with ID 0
[+] start.c:151   Found LAPIC at core 1 (address: 0xFFFF80007FB78034)
[*] start.c:152     Processor ID: 1
[*] start.c:153     APIC ID: 1
[*] start.c:154     Flags: 1
[*] start.c:147   Found entry with ID 1
[*] start.c:147   Found entry with ID 2
[*] start.c:147   Found entry with ID 2
[*] start.c:147   Found entry with ID 2
[*] start.c:147   Found entry with ID 2
[*] start.c:147   Found entry with ID 2
[*] start.c:147   Found entry with ID 4
[+] start.c:159 Done
[*] start.c:161 Initalising LAPIC
[*] start.c:163 LAPIC base: 0xFFFF8000FEE00000
[+] start.c:164 Done
[*] start.c:171 Initialising scheduler
[+] start.c:173 Done
[*] idt.c:63 CPU Info
[*] idt.c:64 RAX: 0x0000000000000202 | RBX: 0x0000700000211EA0 | RCX: 0xB4458A00000B3CE8 | RDX: 0x00000000000C0000
[*] idt.c:65 RSI: 0x0000000000000000 | RDI: 0xFFFF80007FE2F8D0 | RSP: 0xFFFF80007FE2F720 | RBP: 0xFFFF80007FE2F720
[*] idt.c:66 R8:  0x0000000000000000 | R9:  0x0000000000000000 | R10: 0x0000000000000000 | R11: 0xFFFFFFFFFFFFFFF7
[*] idt.c:67 R12: 0xFFFF80007E4FB000 | R13: 0xFFFFFFFF8005190F | R14: 0x0000700000212328 | R15: 0x0000000000000000
[*] idt.c:68 RIP: 0xFFFFFFFF800338FA | RFL: 0x0000000000000286 | ERR: 0x0000000000000000 | ISR: 0x000000000000000D
[-] idt.c:80 unexpected interrupt!

Possible causes:

  • Page overflow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    LuabugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions