Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:26

0001 /**
0002  *  @file
0003  *
0004  *  @brief x86_64 Dependent Source
0005  */
0006 
0007 /*
0008  * Copyright (c) 2018 Amaan Cheval <amaan.cheval@gmail.com>
0009  *
0010  * Copyright (c) 1989-1999.
0011  * On-Line Applications Research Corporation (OAR).
0012  *
0013  * Redistribution and use in source and binary forms, with or without
0014  * modification, are permitted provided that the following conditions
0015  * are met:
0016  * 1. Redistributions of source code must retain the above copyright
0017  *    notice, this list of conditions and the following disclaimer.
0018  * 2. Redistributions in binary form must reproduce the above copyright
0019  *    notice, this list of conditions and the following disclaimer in the
0020  *    documentation and/or other materials provided with the distribution.
0021  *
0022  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
0023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0025  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
0026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0032  * SUCH DAMAGE.
0033  */
0034 
0035 #ifdef HAVE_CONFIG_H
0036 #include "config.h"
0037 #endif
0038 
0039 #include <rtems/score/cpuimpl.h>
0040 #include <rtems/score/idt.h>
0041 #include <rtems/score/isr.h>
0042 #include <rtems/score/tls.h>
0043 
0044 void _CPU_Exception_frame_print(const CPU_Exception_frame *ctx)
0045 {
0046 }
0047 
0048 Context_Control_fp _CPU_Null_fp_context;
0049 
0050 void _CPU_Initialize(void)
0051 {
0052  /*
0053   * Save the FP context intialized by the UEFI firmware in "_CPU_Null_fp_context"
0054   * which is given to each task at start and restart time.
0055   * According to the UEFI specification this should mean that:
0056   * _CPU_Null_fp_context.mxcsr = 0x1F80
0057   * _CPU_Null_fp_context.fpucw = 0x37F
0058   */
0059   asm volatile( "stmxcsr %0" : "=m"(_CPU_Null_fp_context.mxcsr) );
0060   asm volatile( "fstcw %0" : "=m"(_CPU_Null_fp_context.fpucw) );
0061 }