Don't make interrupt stubs global symbols.
[pintos-anon] / src / threads / intr-stubs.S
index d2507771704699479481a547724a7d99c1b19a9b..adb674e0f2e36755d95066e2156f53c2876d2ca4 100644 (file)
@@ -1,6 +1,5 @@
 #include "threads/loader.h"
 
-       .intel_syntax noprefix
         .text
 
 /* Main interrupt entry point.
 .func intr_entry
 intr_entry:
        /* Save caller's registers. */
-       push ds
-       push es
-       push fs
-       push gs
-       pusha
+       pushl %ds
+       pushl %es
+       pushl %fs
+       pushl %gs
+       pushal
         
        /* Set up kernel environment. */
        cld                     /* String instructions go upward. */
-       mov eax, SEL_KDSEG      /* Initialize segment registers. */
-       mov ds, eax
-       mov es, eax
-       lea ebp, [esp + 56]     /* Set up frame pointer. */
+       mov $SEL_KDSEG, %eax    /* Initialize segment registers. */
+       mov %eax, %ds
+       mov %eax, %es
+       leal 56(%esp), %ebp     /* Set up frame pointer. */
 
        /* Call interrupt handler. */
-       push esp
+       pushl %esp
 .globl intr_handler
        call intr_handler
-       add esp, 4
+       addl $4, %esp
 .endfunc
 
 /* Interrupt exit.
@@ -45,21 +44,21 @@ intr_entry:
    stack, and returns to the caller.
 
    This is a separate function because it is called directly when
-   we launch a new user process (see execute_thread() in
+   we launch a new user process (see start_process() in
    userprog/process.c). */
 .globl intr_exit
 .func intr_exit
 intr_exit:
         /* Restore caller's registers. */
-       popa
-       pop gs
-       pop fs
-       pop es
-       pop ds
+       popal
+       popl %gs
+       popl %fs
+       popl %es
+       popl %ds
 
         /* Discard `struct intr_frame' vec_no, error_code,
            frame_pointer members. */
-       add esp, 12
+       addl $12, %esp
 
         /* Return to caller. */
        iret
@@ -75,19 +74,19 @@ intr_exit:
 
    Most of the stubs do this:
 
-        1. Push EBP on the stack (frame_pointer in `struct intr_frame').
+        1. Push %ebp on the stack (frame_pointer in `struct intr_frame').
 
         2. Push 0 on the stack (error_code).
 
         3. Push the interrupt number on the stack (vec_no).
 
    The CPU pushes an extra "error code" on the stack for a few
-   interrupts.  Because we want EBP to be where the error code
+   interrupts.  Because we want %ebp to be where the error code
    is, we follow a different path:
 
         1. Push a duplicate copy of the error code on the stack.
 
-        2. Replace the original copy of the error code by EBP.
+        2. Replace the original copy of the error code by %ebp.
 
         3. Push the interrupt number on the stack. */
 
@@ -98,25 +97,24 @@ intr_stubs:
 /* This implements steps 1 and 2, described above, in the common
    case where we just push a 0 error code. */
 #define zero                                    \
-       push ebp;                               \
-       push 0
+       pushl %ebp;                             \
+       pushl $0
 
 /* This implements steps 1 and 2, described above, in the case
    where the CPU already pushed an error code. */
 #define REAL                                    \
-        push dword ptr [esp];                   \
-        mov [esp + 4], ebp
+        pushl (%esp);                           \
+        movl %ebp, 4(%esp)
 
 /* Emits a stub for interrupt vector NUMBER.
    TYPE is `zero', for the case where we push a 0 error code,
    or `REAL', if the CPU pushes an error code for us. */
 #define STUB(NUMBER, TYPE)                      \
        .text;                                  \
-.globl intr##NUMBER##_stub;                     \
 .func intr##NUMBER##_stub;                     \
 intr##NUMBER##_stub:                            \
        TYPE;                                   \
-       push 0x##NUMBER;                        \
+       push $0x##NUMBER;                       \
         jmp intr_entry;                         \
 .endfunc;                                      \
                                                 \