mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::gpt: Additional task header/interface simplification.
This commit is contained in:
parent
b72a4590b1
commit
8bd78af128
6 changed files with 2 additions and 106 deletions
|
@ -1,31 +0,0 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2021 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice is present in all copies. The
|
||||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_GPT_GATE_H
|
||||
|
||||
/// Task Gate Descriptor
|
||||
///
|
||||
struct ircd_gpt_gate
|
||||
{
|
||||
ushort offset;
|
||||
ushort code[7];
|
||||
}
|
||||
__attribute__((aligned(16)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct ircd::gpt::gate
|
||||
:ircd_gpt_gate
|
||||
{
|
||||
gate()
|
||||
:ircd_gpt_gate{0}
|
||||
{}
|
||||
};
|
||||
#endif
|
|
@ -18,16 +18,13 @@ namespace ircd::gpt
|
|||
IRCD_EXCEPTION(ircd::error, error)
|
||||
|
||||
struct task;
|
||||
struct gate;
|
||||
|
||||
extern log::log log;
|
||||
}
|
||||
|
||||
#include "hypercall.h"
|
||||
#include "vocab.h"
|
||||
#include "model.h"
|
||||
#include "token.h"
|
||||
#include "gate.h"
|
||||
#include "opts.h"
|
||||
#include "ctrl.h"
|
||||
#include "task.h"
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2021 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice is present in all copies. The
|
||||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_GPT_HYPERCALL_H
|
||||
|
||||
/// Hypercalling code enumeration.
|
||||
///
|
||||
/// Error codes are all negative values. Zero is also an error.
|
||||
enum ircd_gpt_hypercall
|
||||
{
|
||||
/// General nominal completion code; similar to EXIT_SUCCESS, etc.
|
||||
IRCD_GPT_ACCEPT = 1,
|
||||
|
||||
/// Failed or incomplete execution occurred. After an execution attempt
|
||||
/// it indicates no execution likely took place. Device software never
|
||||
/// sets this value; it is the initial value set by the host before
|
||||
/// execution.
|
||||
IRCD_GPT_ECOMPLETE = 0,
|
||||
|
||||
/// Erroneous token buffer
|
||||
IRCD_GPT_ETOKENS = -1,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ircd::gpt
|
||||
{
|
||||
string_view reflect(const enum ircd_gpt_hypercall) noexcept;
|
||||
}
|
||||
#endif
|
|
@ -113,14 +113,6 @@ struct ircd_gpt_opts
|
|||
|
||||
/// Denorm smoothing
|
||||
float epsilon;
|
||||
|
||||
/// Number of gate descriptors attached to this page.
|
||||
uint gates;
|
||||
|
||||
/// The gate descriptor table starts at offset 2048 and continues to the
|
||||
/// end of the page. For more descriptors additional pages must be
|
||||
/// attached.
|
||||
struct ircd_gpt_gate gate[] __attribute__((aligned(2048)));
|
||||
}
|
||||
__attribute__((aligned(4096)));
|
||||
|
||||
|
|
26
ircd/gpt.cc
26
ircd/gpt.cc
|
@ -62,28 +62,6 @@ ircd::gpt::generate(const vector_view<u16> &out,
|
|||
ctrl.tokens.head = 0;
|
||||
|
||||
uint j(0);
|
||||
for(uint i(0); i < opts.gates; ++i)
|
||||
{
|
||||
const auto &gate
|
||||
{
|
||||
opts.gate[i]
|
||||
};
|
||||
|
||||
while(j < in.size() && j < gate.offset && ctrl.tokens.count < opts.buffer_tokens)
|
||||
ctrl.token[ctrl.tokens.count++] = in[j++];
|
||||
|
||||
for(uint k(0); k < 7; ++k)
|
||||
{
|
||||
if(ctrl.tokens.count >= opts.buffer_tokens)
|
||||
break;
|
||||
|
||||
if(gate.code[k] == 0)
|
||||
break;
|
||||
|
||||
ctrl.token[ctrl.tokens.count++] = gate.code[k];
|
||||
}
|
||||
}
|
||||
|
||||
while(j < in.size() && ctrl.tokens.count < opts.buffer_tokens)
|
||||
ctrl.token[ctrl.tokens.count++] = in[j++];
|
||||
|
||||
|
@ -402,9 +380,5 @@ noexcept
|
|||
{
|
||||
0.000001
|
||||
}
|
||||
,gates
|
||||
{
|
||||
0
|
||||
}
|
||||
{
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
#include <ircd/simt/simt.h>
|
||||
#include <ircd/gpt/token.h>
|
||||
#include <ircd/gpt/task/task.h>
|
||||
#include <ircd/gpt/opts.h>
|
||||
#include <ircd/gpt/ctrl.h>
|
||||
|
||||
inline void
|
||||
__attribute__((always_inline))
|
||||
|
|
Loading…
Reference in a new issue