Changeset 7243
- Timestamp:
- Sep 17, 2007, 5:35:08 PM (13 years ago)
- Location:
- branches/ia32/lisp-kernel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ia32/lisp-kernel/thread_manager.c
r7017 r7243 554 554 #endif 555 555 556 556 #ifdef X8632 557 #ifdef DARWIN 558 #include <architecture/i386/table.h> 559 #include <architecture/i386/sel.h> 560 #include <i386/user_ldt.h> 561 562 void setup_tcr_extra_segment(TCR *tcr) 563 { 564 unsigned int *addr = (unsigned int *)tcr; 565 unsigned int size = sizeof(TCR); 566 ldt_entry_t desc; 567 sel_t sel; 568 int i; 569 570 desc.data.limit00 = (size - 1) & 0xffff; 571 desc.data.limit16 = ((size - 1) >> 16) & 0xf; 572 desc.data.base00 = addr & 0xfff; 573 desc.data.base16 = (addr >> 16) & 0xff; 574 desc.data.base24 = (addr >> 24) & 0xff; 575 desc.data.type = DESC_DATA_WRITE; 576 desc.data.dpl = USER_PRIV; 577 desc.data.present = 1; 578 desc.data.stksz = DESC_CODE_32B; 579 desc.data.granular = DESC_GRAN_BYTE; 580 581 i = i386_set_ldt(LDT_AUTO_ALLOC, &desc, 1); 582 583 if (i < 0) { 584 perror("i386_set_ldt"); 585 } else { 586 sel.index = i; 587 sel.rpl = USER_PRIV; 588 sel.ti = SEL_LDT; 589 tcr->ldt_index = i; 590 } 591 } 592 #endif 593 #endif 557 594 558 595 /* … … 578 615 #else 579 616 TCR *tcr = allocate_tcr(); 617 #ifdef X8632 618 setup_tcr_extra_segment(tcr); 619 #endif 580 620 #endif 581 621 … … 646 686 ((void (*)())ptr_from_lispobj(callback_ptr))(1); 647 687 tsd_set(lisp_global(TCR_KEY), NULL); 688 /* x8632: remove segment descriptor here? */ 648 689 } 649 690 #ifdef DARWIN … … 757 798 tcr->errno_loc = &errno; 758 799 tsd_set(lisp_global(TCR_KEY), TCR_TO_TSD(tcr)); 800 /* x8632: load %fs here? */ 759 801 #ifdef DARWIN 760 802 extern Boolean use_mach_exception_handling; -
branches/ia32/lisp-kernel/x86-constants32.h
r7024 r7243 384 384 void *safe_ref_address; 385 385 int ldt_index; 386 int ldt_selector; 386 387 } TCR; 387 388 -
branches/ia32/lisp-kernel/x86-constants32.s
r7016 r7243 36 36 fulltag_misc = 6 37 37 fulltag_immheader = 7 38 39 TCR_BIAS = 0 40 41 /* Thread context record. */ 42 43 _struct(tcr,TCR_BIAS) 44 _node(prev) /* in doubly-linked list */ 45 _node(next) /* in doubly-linked list */ 46 _word(node_regs_mask) 47 _node(linear) /* our linear (non-segment-based) address. */ 48 _node(save_ebp) /* lisp EBP when in foreign code */ 49 _word(lisp_mxcsr) 50 _word(foreign_mxcsr) 51 _node(db_link) /* special binding chain head */ 52 _node(catch_top) /* top catch frame */ 53 _node(save_vsp) /* VSP when in foreign code */ 54 _node(save_tsp) /* TSP when in foreign code */ 55 _node(foreign_sp) /* Saved foreign SP when in lisp code */ 56 _node(cs_area) /* cstack area pointer */ 57 _node(vs_area) /* vstack area pointer */ 58 _node(ts_area) /* tstack area pointer */ 59 _node(cs_limit) /* cstack overflow limit */ 60 _word(bytes_consed_low) 61 _word(bytes_consed_high) 62 _node(log2_allocation_quantum) 63 _node(interrupt_pending) 64 _node(xframe) /* per-thread exception frame list */ 65 _node(errno_loc) /* per-thread errno location */ 66 _node(ffi_exception) /* mxcsr exception bits from ff-call */ 67 _node(osid) /* OS thread id */ 68 _node(valence) /* odd when in foreign code */ 69 _node(foreign_exception_status) 70 _node(native_thread_info) 71 _node(native_thread_id) 72 _node(last_allocptr) 73 _node(save_allocptr) 74 _node(save_allocbase) 75 _node(reset_completion) 76 _node(activate) 77 _node(suspend_count) 78 _node(suspend_context) 79 _node(pending_exception_context) 80 _node(suspend) /* semaphore for suspension notify */ 81 _node(resume) /* sempahore for resumption notify */ 82 _node(flags) 83 _node(gc_context) 84 _node(termination_semaphore) 85 _node(unwinding) 86 _node(tlb_limit) 87 _node(tlb_pointer) /* Consider using tcr+N as tlb_pointer */ 88 _node(shutdown_count) 89 _node(next_tsp) 90 _node(safe_ref_address) 91 _word(ldt_index) 92 _word(ldt_selector) 93 _ends -
branches/ia32/lisp-kernel/x86-exceptions.h
r7017 r7243 167 167 #define RECOVER_FN_FROM_RIP_WORD0 0x8d4c /* 0x4c 0x8d, little-endian */ 168 168 #define RECOVER_FN_FROM_RIP_BYTE2 0x2d /* third byte of opcode */ 169 170 #ifdef X8632 171 /* The 32-bit immediate value in the instruction 172 * "(mov ($ 0x12345678) (% fn))" at a tagged return address 173 * refers to the associated function. 174 */ 175 #define RECOVER_FN_OPCODE 0xbf 176 #define RECOVER_FN_LENGTH 5 177 #endif -
branches/ia32/lisp-kernel/x86-subprims32.s
r7061 r7243 31 31 __(movl $TCR_STATE_FOREIGN, %rcontext:tcr.valence) 32 32 __(emms) 33 __(add $12, % sp) /* discard alignment space */33 __(add $12, %esp) /* discard alignment space */ 34 34 __(pop %ebx) 35 35 __(pop %esi)
Note: See TracChangeset
for help on using the changeset viewer.