Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 8d427a3 in mainline


Ignore:
Timestamp:
2014-08-27T23:07:42Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
f27f3fd
Parents:
b8fac76
Message:

Autogenerate istate_t and its offsets on ia32.

Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/Makefile.inc

    rb8fac76 r8d427a3  
    105105        arch/$(KARCH)/src/fpu_context.c \
    106106        arch/$(KARCH)/src/syscall.c
     107
     108ARCH_AUTOGENS_AG = \
     109        arch/$(KARCH)/include/arch/istate_struct.ag
     110
  • kernel/arch/ia32/include/arch/istate.h

    rb8fac76 r8d427a3  
    3838#include <trace.h>
    3939
    40 typedef struct istate {
    41         /*
    42          * The strange order of the GPRs is given by the requirement to use the
    43          * istate structure for both regular interrupts and exceptions as well
    44          * as for syscall handlers which use this order as an optimization.
    45          */
    46         uint32_t edx;
    47         uint32_t ecx;
    48         uint32_t ebx;
    49         uint32_t esi;
    50         uint32_t edi;
    51         uint32_t ebp;
    52         uint32_t eax;
    53        
    54         uint32_t ebp_frame;  /* imitation of frame pointer linkage */
    55         uint32_t eip_frame;  /* imitation of return address linkage */
    56        
    57         uint32_t gs;
    58         uint32_t fs;
    59         uint32_t es;
    60         uint32_t ds;
    61        
    62         uint32_t error_word;  /* real or fake error word */
    63         uint32_t eip;
    64         uint32_t cs;
    65         uint32_t eflags;
    66         uint32_t esp;         /* only if istate_t is from uspace */
    67         uint32_t ss;          /* only if istate_t is from uspace */
    68 } istate_t;
     40#ifdef KERNEL
     41#include <arch/istate_struct.h>
     42#else
     43#include <libarch/istate_struct.h>
     44#endif /* KERNEL */
    6945
    7046#define RPL_USER        3
  • kernel/arch/ia32/src/asm.S

    rb8fac76 r8d427a3  
    3434#include <arch/cpu.h>
    3535#include <arch/mm/page.h>
     36#include <arch/istate_struct.h>
    3637
    3738.text
     
    136137        ret
    137138
    138 #define ISTATE_OFFSET_EDX         0
    139 #define ISTATE_OFFSET_ECX         4
    140 #define ISTATE_OFFSET_EBX         8
    141 #define ISTATE_OFFSET_ESI         12
    142 #define ISTATE_OFFSET_EDI         16
    143 #define ISTATE_OFFSET_EBP         20
    144 #define ISTATE_OFFSET_EAX         24
    145 #define ISTATE_OFFSET_EBP_FRAME   28
    146 #define ISTATE_OFFSET_EIP_FRAME   32
    147 #define ISTATE_OFFSET_GS          36
    148 #define ISTATE_OFFSET_FS          40
    149 #define ISTATE_OFFSET_ES          44
    150 #define ISTATE_OFFSET_DS          48
    151 #define ISTATE_OFFSET_ERROR_WORD  52
    152 #define ISTATE_OFFSET_EIP         56
    153 #define ISTATE_OFFSET_CS          60
    154 #define ISTATE_OFFSET_EFLAGS      64
    155 #define ISTATE_OFFSET_ESP         68
    156 #define ISTATE_OFFSET_SS          72
    157 
    158139/*
    159140 * Size of the istate structure without the hardware-saved part
    160141 * and without the error word.
    161142 */
    162 #define ISTATE_SOFT_SIZE  52
     143#define ISTATE_SOFT_SIZE        ISTATE_SIZE - (6 * 4)
    163144
    164145/*
Note: See TracChangeset for help on using the changeset viewer.