mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-08 16:36:14 +00:00
high level summary of the files: * debug_rdata - get current state from debug registers. Helpful when developing the debugger, and could serve some purpose in the future. * eudb - the debugger itself * eviction_macro - generate the proper macro to flush the EU render cache until I get control flow working * pre_cpp - an evaluating c preprocesser like thing, to be used before cpp * sr - the system routine, exception handler which runs on the EU * test - a very basic test system routine * debug.h
65 lines
2.2 KiB
Plaintext
65 lines
2.2 KiB
Plaintext
/*
|
|
* Copyright © 2011 Intel Corporation
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice (including the next
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
* Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
* IN THE SOFTWARE.
|
|
*
|
|
* Authors:
|
|
* Ben Widawsky <ben@bwidawsk.net>
|
|
*
|
|
*/
|
|
|
|
#include "debug.h"
|
|
|
|
#define CR0_0_ME_STATE_CTRL (1 << 31)
|
|
#define CR0_0_BP_SUPPRESS (1 << 15)
|
|
#define CR0_0_SPF_EN (1 << 2)
|
|
#define CR0_0_ACC_DIS (1 << 1)
|
|
#define CR0_1_BES_CTRL (1 << 31)
|
|
#define CR0_1_HALT_CTRL (1 << 30)
|
|
#define CR0_1_SOFT_EXCEPTION_CTRL (1 << 29)
|
|
#define CR0_1_ILLGL_OP_STS (1 << 28)
|
|
#define CR0_1_STACK_OVRFLW_STS (1 << 27)
|
|
|
|
#define CR0_0_ENTRY_UNMASK (CR0_0_SPF_EN | CR0_0_ACC_DIS)
|
|
// TODO: Need to fix this for non breakpoint case
|
|
#define CR0_1_ENTRY_UNMASK ~(CR0_1_BES_CTRL)
|
|
#define CR0_0_RETURN_MASK ~(CR0_0_ME_STATE_CTRL | CR0_0_SPF_EN | CR0_0_ACC_DIS)
|
|
|
|
#ifndef SANDYBRIDGE
|
|
#error Only SandyBridge is supported
|
|
#endif
|
|
|
|
/* Default flags for an instruction */
|
|
#define FLAGS { ALIGN1, SWITCH, MASK_DISABLE, ACCWRCTRL}
|
|
|
|
Enter:
|
|
nop;
|
|
|
|
or (1) cr0.0 cr0.0 CR0_0_ENTRY_UNMASK:ud FLAGS;
|
|
|
|
/* Clear breakpoint status */
|
|
and (1) cr0.1 cr0.1 CR0_1_ENTRY_UNMASK:ud FLAGS;
|
|
|
|
/* set breakpoint suppress this should be conditional on bes */
|
|
or (1) cr0.0 cr0.0 CR0_0_BP_SUPPRESS:ud FLAGS;
|
|
|
|
and (1) cr0.0 cr0.0 CR0_0_RETURN_MASK:ud FLAGS;
|
|
nop;
|