2 * The x86 Linux incarnation of arch-dependent OS-dependent routines.
7 /* header files lifted wholesale from linux-os.c, some may be redundant */
10 #include <sys/param.h>
16 #include "interrupt.h"
20 #include <sys/socket.h>
21 #include <sys/utsname.h>
23 #include <sys/types.h>
25 /* #include <sys/sysinfo.h> */
31 size_t os_vm_page_size;
37 /* KLUDGE: As of kernel 2.2.14 on Red Hat 6.2, there's code in the
38 * <sys/ucontext.h> file to define symbolic names for offsets into
39 * gregs[], but it's conditional on __USE_GNU and not defined, so
40 * we need to do this nasty absolute index magic number thing
43 os_context_register_addr(os_context_t *context, int offset)
46 case 0: return &context->uc_mcontext.gregs[11]; /* EAX */
47 case 2: return &context->uc_mcontext.gregs[10]; /* ECX */
48 case 4: return &context->uc_mcontext.gregs[9]; /* EDX */
49 case 6: return &context->uc_mcontext.gregs[8]; /* EBX */
50 case 8: return &context->uc_mcontext.gregs[7]; /* ESP */
51 case 10: return &context->uc_mcontext.gregs[6]; /* EBP */
52 case 12: return &context->uc_mcontext.gregs[5]; /* ESI */
53 case 14: return &context->uc_mcontext.gregs[4]; /* EDI */
56 return &context->uc_mcontext.gregs[offset];
59 os_context_pc_addr(os_context_t *context)
61 return &context->uc_mcontext.gregs[14];
64 os_context_sp_addr(os_context_t *context)
66 return &context->uc_mcontext.gregs[17];
70 os_context_sigmask_addr(os_context_t *context)
72 return &context->uc_sigmask;
76 os_flush_icache(os_vm_address_t address, os_vm_size_t length)