Compare commits

...

7 Commits

7 changed files with 44 additions and 8 deletions
+1
View File
@@ -11,3 +11,4 @@ func seek[4](offset: offset, origin: int) -> (err: int, new_pos: offset);
func map[5](prot: int, flags: int) -> (err: int, vmo: handle); func map[5](prot: int, flags: int) -> (err: int, vmo: handle);
func getdents[6]() -> (err: int, dents: buffer); func getdents[6]() -> (err: int, dents: buffer);
func mount[7](path: string, nd: int, pid: int, chid: int) -> (err: int);
+1 -1
Submodule kernel updated: c425d6e389...bd6872d672
+29 -6
View File
@@ -28,14 +28,14 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <magenta/log.h>
#include <stdio.h>
long long strtoll( long long strtoll(const char *restrict ptr, char **restrict endptr, int base)
const char *restrict ptr,
char **restrict endptr,
register int base)
{ {
const char *s = ptr; const char *s = ptr;
long long acc; long long acc;
@@ -64,8 +64,31 @@ long long strtoll(
base = c == '0' ? 8 : 10; base = c == '0' ? 8 : 10;
} }
cutoff = (long long)LLONG_MAX / (long long)base; /* XXX cannot just divide by base here. Doing so results in a #DE
cutlim = (long long)LLONG_MAX % (long long)base; * exception when running under Bochs. Not sure if this is a bug in the
* kernel or in Bochs, but this switch statement is here as a workaround
* until the issue is resolved. */
switch (base) {
case 2:
cutoff = (long long)LLONG_MAX / (long long)2;
cutlim = (long long)LLONG_MAX % (long long)2;
break;
case 8:
cutoff = (long long)LLONG_MAX / (long long)8;
cutlim = (long long)LLONG_MAX % (long long)8;
break;
case 10:
cutoff = (long long)LLONG_MAX / (long long)10;
cutlim = (long long)LLONG_MAX % (long long)10;
break;
case 16:
cutoff = (long long)LLONG_MAX / (long long)16;
cutlim = (long long)LLONG_MAX % (long long)16;
break;
default:
return -1;
}
for (acc = 0, any = 0;; c = *s++) { for (acc = 0, any = 0;; c = *s++) {
if (isdigit(c)) { if (isdigit(c)) {
c -= '0'; c -= '0';
@@ -12,6 +12,7 @@ enum rosetta_bootstrap_handle_type {
enum rosetta_bootstrap_channel_type { enum rosetta_bootstrap_channel_type {
RSBS_CHANNEL_NONE, RSBS_CHANNEL_NONE,
RSBS_CHANNEL_SYSTEM, RSBS_CHANNEL_SYSTEM,
RSBS_CHANNEL_NAMESPACE,
}; };
struct rosetta_bootstrap_handle { struct rosetta_bootstrap_handle {
+3
View File
@@ -6,6 +6,9 @@ file(GLOB sources
add_executable(mxdbg ${sources}) add_executable(mxdbg ${sources})
find_package(Threads REQUIRED)
target_link_libraries(mxdbg target_link_libraries(mxdbg
magenta_debug magenta_debug
Threads::Threads
FX::Runtime FX::Collections FX::Term FX::Cmdline) FX::Runtime FX::Collections FX::Term FX::Cmdline)
+8
View File
@@ -5,6 +5,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <magenta/debug/packet.h> #include <magenta/debug/packet.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -26,7 +27,14 @@ void debug_context_cleanup(struct debug_context *ctx)
close(ctx->ctx_sock); close(ctx->ctx_sock);
} }
pthread_cond_broadcast(&ctx->ctx_packet_cond);
pthread_kill(ctx->ctx_packet_thread, SIGINT);
pthread_kill(ctx->ctx_event_thread, SIGINT);
printf("joining threads...\n");
pthread_join(ctx->ctx_packet_thread, NULL); pthread_join(ctx->ctx_packet_thread, NULL);
pthread_join(ctx->ctx_event_thread, NULL);
printf("threads joined\n");
} }
static void *packet_thread(void *arg) static void *packet_thread(void *arg)
+1 -1
View File
@@ -6,7 +6,7 @@ struct packet *packet_create(size_t packet_size)
{ {
size_t real_packet_size = sizeof(struct packet) + packet_size size_t real_packet_size = sizeof(struct packet) + packet_size
- sizeof(struct mxdbg_packet); - sizeof(struct mxdbg_packet);
return calloc(1, packet_size); return calloc(1, real_packet_size);
} }
void packet_destroy(struct packet *packet) void packet_destroy(struct packet *packet)