1#------------------------------------------------------------------------------
2#*
3#*   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
4#*   This program and the accompanying materials
5#*   are licensed and made available under the terms and conditions of the BSD License
6#*   which accompanies this distribution.  The full text of the license may be found at
7#*   http://opensource.org/licenses/bsd-license.php
8#*
9#*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10#*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11#*
12#*    CpuAsm.S
13#*
14#*   Abstract:
15#*
16#------------------------------------------------------------------------------
17
18
19#.MMX
20#.XMM
21
22#------------------------------------------------------------------------------
23# VOID
24# SetCodeSelector (
25#   UINT16 Selector
26#   );
27#------------------------------------------------------------------------------
28ASM_GLOBAL ASM_PFX(SetCodeSelector)
29ASM_PFX(SetCodeSelector):
30    movl    4(%esp), %ecx
31    subl    $0x10, %esp
32    leal    setCodeSelectorLongJump, %eax
33    movl    %eax, (%esp)
34    movw    %cx, 4(%esp)
35    .byte   0xFF, 0x2C, 0x24   # jmp *(%esp)  note:(FWORD jmp)
36setCodeSelectorLongJump:
37    addl    $0x10, %esp
38    ret
39
40#------------------------------------------------------------------------------
41# VOID
42# SetDataSelectors (
43#   UINT16 Selector
44#   );
45#------------------------------------------------------------------------------
46ASM_GLOBAL ASM_PFX(SetDataSelectors)
47ASM_PFX(SetDataSelectors):
48    movl    4(%esp), %ecx
49    movw    %cx, %ss
50    movw    %cx, %ds
51    movw    %cx, %es
52    movw    %cx, %fs
53    movw    %cx, %gs
54    ret
55
56#END
57
58