Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80002
b: refs/heads/master
c: a95d67f
h: refs/heads/master
v: v3
  • Loading branch information
Markus Metzger authored and Ingo Molnar committed Jan 30, 2008
1 parent 06b9eaf commit 6918130
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 143 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e4811f2568c55e595a7bf15a3b9aba863b31fb94
refs/heads/master: a95d67f87e1a5f1b4429be3ba3bf7b4051657908
56 changes: 51 additions & 5 deletions trunk/arch/x86/kernel/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,20 @@ static inline void set_info_data(char *base, unsigned long value)
}


int ds_allocate(void **dsp, size_t bts_size_in_records)
int ds_allocate(void **dsp, size_t bts_size_in_bytes)
{
size_t bts_size_in_bytes = 0;
void *bts = 0;
void *ds = 0;
size_t bts_size_in_records;
void *bts;
void *ds;

if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts)
return -EOPNOTSUPP;

if (bts_size_in_records < 0)
if (bts_size_in_bytes < 0)
return -EINVAL;

bts_size_in_records =
bts_size_in_bytes / ds_cfg.sizeof_bts;
bts_size_in_bytes =
bts_size_in_records * ds_cfg.sizeof_bts;

Expand Down Expand Up @@ -233,9 +235,21 @@ int ds_get_bts_size(void *ds)
if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts)
return -EOPNOTSUPP;

if (!ds)
return 0;

size_in_bytes =
get_bts_absolute_maximum(ds) -
get_bts_buffer_base(ds);
return size_in_bytes;
}

int ds_get_bts_end(void *ds)
{
size_t size_in_bytes = ds_get_bts_size(ds);

if (size_in_bytes <= 0)
return size_in_bytes;

return size_in_bytes / ds_cfg.sizeof_bts;
}
Expand All @@ -254,6 +268,38 @@ int ds_get_bts_index(void *ds)
return index_offset_in_bytes / ds_cfg.sizeof_bts;
}

int ds_set_overflow(void *ds, int method)
{
switch (method) {
case DS_O_SIGNAL:
return -EOPNOTSUPP;
case DS_O_WRAP:
return 0;
default:
return -EINVAL;
}
}

int ds_get_overflow(void *ds)
{
return DS_O_WRAP;
}

int ds_clear(void *ds)
{
int bts_size = ds_get_bts_size(ds);
void *bts_base;

if (bts_size <= 0)
return bts_size;

bts_base = get_bts_buffer_base(ds);
memset(bts_base, 0, bts_size);

set_bts_index(ds, bts_base);
return 0;
}

int ds_read_bts(void *ds, size_t index, struct bts_struct *out)
{
void *bts;
Expand Down
Loading

0 comments on commit 6918130

Please sign in to comment.