Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
- Loading branch information
Showing
5 changed files
with
152 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Miscellaneous kernel tests | ||
*/ | ||
|
||
#include <assert.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <sys/mman.h> | ||
#include <time.h> | ||
#include <unistd.h> | ||
|
||
#include "kernel.h" | ||
#include "util.h" | ||
|
||
uint32_t test3pflt(void) | ||
{ | ||
uint32_t pgsz, alloc; | ||
uint8_t *p; | ||
uint32_t i, s, e; | ||
|
||
pgsz = sysconf(_SC_PAGESIZE); | ||
alloc = pgsz * 32768; | ||
p = (uint8_t *)mmap(NULL, alloc, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); | ||
assert(p != MAP_FAILED); | ||
|
||
e = tm_ticks(); | ||
do { | ||
s = tm_ticks(); | ||
} while ((s - e) < 1); | ||
for (i = 0; i < alloc; i += pgsz) { | ||
p[i] = 0x1F; | ||
} | ||
e = tm_ticks(); | ||
i = e - s; | ||
munmap(p, alloc); | ||
return i; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef __included_kernel_h | ||
#define __included_kernel_h | ||
|
||
uint32_t test3pflt(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include <stdint.h> | ||
#include <time.h> | ||
#include <unistd.h> | ||
|
||
#include "util.h" | ||
|
||
|