PERFORCE change 119083 for review
Alexey Tarasov
taleks at FreeBSD.org
Tue May 1 13:40:10 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=119083
Change 119083 by taleks at taleks_th on 2007/05/01 13:39:58
made first version of compilable assembler code. Updated isr_install definition, int_num now is 16bit to simplify popping it from stack.
Affected files ...
.. //depot/projects/soc2007/taleks-pxe_http/btx_mod/btx/btx.S#3 edit
.. //depot/projects/soc2007/taleks-pxe_http/btx_mod/lib/btxv86.h#3 edit
Differences ...
==== //depot/projects/soc2007/taleks-pxe_http/btx_mod/btx/btx.S#3 (text+ko) ====
@@ -871,7 +871,8 @@
jmp exit # Exit
/*
* Here we need to modify IDT in such way, that at interrupt handle
- * will be run isr_trump, which role is to run provided function in user space.
+ * will be run user_isr_call, which role is to run provided function
+ * in user space.
*/
intx30.2: xorl %eax,%eax # clear eax
@@ -879,44 +880,51 @@
* updating call gate
*/
mov gdtdesc,%edi # calculating descriptors entry
- add $SEL_CALLGATE, %edi # pointing callgate selector
+ add $SEL_CALLGATE,%edi # pointing callgate selector
popl %eax # got 32bit offset to handler
- mov %ax, (%di) # +0: store offset
- shr $0x10, %eax # getting high word
- mov %ax, 0x6(%di) # +6: handler offset 16..31
+ movw %ax,(%edi) # +0: store offset 00..15
+ shr $0x10,%eax # getting high word
+ add $0x06,%edi # +6:
+ mov %ax,(%edi) # handler offset 16..31
/*
* installing handler
*/
- xor %ax,%ax # clear eax
- pop %ah # getting interrupt number
- mul $0x08,%ax #
+ xor %ax,%ax # clear ax
+ pop %ax # getting interrupt number
+ mov $0x08, %bl #
+ mulb %bl #
- mov $MEM_IDT, %di # point to IDT.
+ mov $MEM_IDT,%di # point to IDT.
add %ax,%di # calculate entry
mov $SEL_SCODE,%dh # supervisor code selector
- mov user_isr_call, %ax # tramp address
+ mov user_isr_call,%ax # tramp address
- mov $0x8e, %dl # i386+ interrupt gate, DPL=0
+ mov $0x8e,%dl # i386+ interrupt gate, DPL=0
- mov %ax,(%di) # 0: handler offset 0..15
- mov %dh,0x2(%di) # +2: dest selector
- # +4: 000:word_count
- mov %dl,0x5(%di) # +5: P:DPL:type
+ mov %ax,(%edi) # 0: handler offset 0..15
+ mov %dh,0x2(%edi) # +2: dest selector
+ # +4: 000:word_count=0
+ mov %dl,0x5(%edi) # +5: P:DPL:type
# +6: handler offset 16..31
/*
- * NOTE: do we need flush caches?
+ * NOTE: it seems nothing else must be done
*/
iret # return from syscall
user_isr_call:
/*
- * NOTE: do we need update CS,DS & etc before and restore after?
+ * NOTE: isr must use lret to return and restore SS, ESP, CS, EIP.
*/
- # far call via callgate selector
- lcall $SEL_S2U_CALL # NOTE: find how it must be.
+ push %ds # saving ds
+ mov $SEL_UDATA,%ax #
+ mov %ax,%ds # setting it to userspace data
+ # cs is updated from selector
+ lcall $SEL_CALLGATE,$0x00000000 # far call via callgate selector
+ # offset is ignored
+ pop %ds # restore data segment
iret # return from interrupt handler
/*
==== //depot/projects/soc2007/taleks-pxe_http/btx_mod/lib/btxv86.h#3 (text+ko) ====
@@ -63,6 +63,6 @@
* Installs interrupt handler function for interrupt int_num.
* caddr_t - in userspace.
*/
-void __isr_install(caddr_t isr, uint8_t int_num);
+void __isr_install(caddr_t isr, uint16_t int_num);
#endif /* !_BTXV86_H_ */
More information about the p4-projects
mailing list