1 | ; $Id: bs3-cmn-Syscall.asm 60000 2016-03-11 19:12:05Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - Bs3Syscall.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2016 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 | ; The contents of this file may alternatively be used under the terms
|
---|
18 | ; of the Common Development and Distribution License Version 1.0
|
---|
19 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | ; CDDL are applicable instead of those of the GPL.
|
---|
22 | ;
|
---|
23 | ; You may elect to license modified versions of this file under the
|
---|
24 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | ;
|
---|
26 |
|
---|
27 |
|
---|
28 | ;*********************************************************************************************************************************
|
---|
29 | ;* Header Files *
|
---|
30 | ;*********************************************************************************************************************************
|
---|
31 | %include "bs3kit-template-header.mac"
|
---|
32 |
|
---|
33 |
|
---|
34 | ;*********************************************************************************************************************************
|
---|
35 | ;* External Symbols *
|
---|
36 | ;*********************************************************************************************************************************
|
---|
37 | %if TMPL_BITS == 16
|
---|
38 | BS3_EXTERN_DATA16 g_bBs3CurrentMode
|
---|
39 | %endif
|
---|
40 | BS3_EXTERN_DATA16 g_uBs3TrapEipHint
|
---|
41 | TMPL_BEGIN_TEXT
|
---|
42 |
|
---|
43 |
|
---|
44 | ;;
|
---|
45 | ; Worker for doing a syscall - Assembly only.
|
---|
46 | ;
|
---|
47 | ; This worker deals with the needing to use a different opcode
|
---|
48 | ; sequence in v8086 mode as well as the high EIP word hint for
|
---|
49 | ; the weird PE16_32, PP16_32 and PAE16_32 modes.
|
---|
50 | ;
|
---|
51 | ; @uses Whatever the syscall modified (xBX and XBP are always saved).
|
---|
52 | ;
|
---|
53 | BS3_PROC_BEGIN_CMN Bs3Syscall
|
---|
54 | push xBP
|
---|
55 | mov xBP, xSP
|
---|
56 | push xBX
|
---|
57 |
|
---|
58 | %if TMPL_BITS == 16
|
---|
59 | mov bl, [BS3_DATA16_WRT(g_bBs3CurrentMode)]
|
---|
60 | and bl, BS3_MODE_CODE_MASK
|
---|
61 | cmp bl, BS3_MODE_CODE_V86
|
---|
62 | mov bx, 0
|
---|
63 | mov [2 + BS3_DATA16_WRT(g_uBs3TrapEipHint)], bx
|
---|
64 | jne .normal
|
---|
65 | db 0xf0 ; lock prefix
|
---|
66 | %else
|
---|
67 | BS3_LEA_MOV_WRT_RIP(xBX, .return)
|
---|
68 | mov [BS3_DATA16_WRT(g_uBs3TrapEipHint)], ebx
|
---|
69 | %endif
|
---|
70 | .normal:
|
---|
71 | int BS3_TRAP_SYSCALL
|
---|
72 |
|
---|
73 | .return:
|
---|
74 | pop xBX
|
---|
75 | pop xBP
|
---|
76 | ret
|
---|
77 | BS3_PROC_END_CMN Bs3Syscall
|
---|
78 |
|
---|